Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Mar 2017 06:18:08 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r315137 - stable/11/sys/cam/ctl
Message-ID:  <201703120618.v2C6I8MU087881@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sun Mar 12 06:18:08 2017
New Revision: 315137
URL: https://svnweb.freebsd.org/changeset/base/315137

Log:
  MFC r314307: Add support for SIMs without autosense.
  
  If we asked to send sense data by setting CAM_SEND_SENSE, but SIM didn't
  confirm transmission by setting CAM_SENT_SENSE, assume it was not sent.
  Queue the I/O back to CTL for later REQUEST SENSE with ctl_queue_sense().
  This is needed for error reporting on SPI HBAs like ahc(4)/ahd(4).

Modified:
  stable/11/sys/cam/ctl/scsi_ctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/scsi_ctl.c
==============================================================================
--- stable/11/sys/cam/ctl/scsi_ctl.c	Sun Mar 12 05:42:57 2017	(r315136)
+++ stable/11/sys/cam/ctl/scsi_ctl.c	Sun Mar 12 06:18:08 2017	(r315137)
@@ -1229,6 +1229,20 @@ ctlfedone(struct cam_periph *periph, uni
 		 * datamove done routine.
 		 */
 		if ((io->io_hdr.flags & CTL_FLAG_DMA_INPROG) == 0) {
+			/*
+			 * If we asked to send sense data but it wasn't sent,
+			 * queue the I/O back to CTL for later REQUEST SENSE.
+			 */
+			if ((done_ccb->ccb_h.flags & CAM_SEND_SENSE) != 0 &&
+			    (done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP &&
+			    (done_ccb->ccb_h.status & CAM_SENT_SENSE) == 0 &&
+			    (io = ctl_alloc_io_nowait(bus_softc->port.ctl_pool_ref)) != NULL) {
+				PRIV_INFO(io) = PRIV_INFO(
+				    (union ctl_io *)atio->ccb_h.io_ptr);
+				ctl_queue_sense(atio->ccb_h.io_ptr);
+				atio->ccb_h.io_ptr = io;
+			}
+
 			/* Abort ATIO if CTIO sending status has failed. */
 			if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) !=
 			    CAM_REQ_CMP) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703120618.v2C6I8MU087881>