From owner-svn-src-stable-10@freebsd.org Sun Mar 12 06:18:42 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DE53CF9CDB; Sun, 12 Mar 2017 06:18:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A78512C5; Sun, 12 Mar 2017 06:18:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2C6IfTY087956; Sun, 12 Mar 2017 06:18:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2C6Ifii087955; Sun, 12 Mar 2017 06:18:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201703120618.v2C6Ifii087955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 12 Mar 2017 06:18:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r315138 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Mar 2017 06:18:42 -0000 Author: mav Date: Sun Mar 12 06:18:41 2017 New Revision: 315138 URL: https://svnweb.freebsd.org/changeset/base/315138 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/10/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Sun Mar 12 06:18:08 2017 (r315137) +++ stable/10/sys/cam/ctl/scsi_ctl.c Sun Mar 12 06:18:41 2017 (r315138) @@ -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) {