svn commit: r314302 - head/sys/dev/isp

Alexander Motin mav at FreeBSD.org
Sun Feb 26 14:29:11 UTC 2017


Author: mav
Date: Sun Feb 26 14:29:09 2017
New Revision: 314302
URL: https://svnweb.freebsd.org/changeset/base/314302

Log:
  Return better error code in case of too long CDB.
  
  Its more important for SPI HBAs, as they don't support CDBs above 12 bytes.
  The new error code makes CAM to fall back to alternative commands.
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.h

Modified: head/sys/dev/isp/isp.c
==============================================================================
--- head/sys/dev/isp/isp.c	Sun Feb 26 13:25:56 2017	(r314301)
+++ head/sys/dev/isp/isp.c	Sun Feb 26 14:29:09 2017	(r314302)
@@ -4317,7 +4317,7 @@ isp_start(XS_T *xs)
 
 	if (XS_CDBLEN(xs) > (IS_FC(isp)? 16 : 44) || XS_CDBLEN(xs) == 0) {
 		isp_prt(isp, ISP_LOGERR, "unsupported cdb length (%d, CDB[0]=0x%x)", XS_CDBLEN(xs), XS_CDBP(xs)[0] & 0xff);
-		XS_SETERR(xs, HBA_BOTCH);
+		XS_SETERR(xs, HBA_REQINVAL);
 		return (CMD_COMPLETE);
 	}
 
@@ -4494,7 +4494,7 @@ isp_start(XS_T *xs)
 	if (IS_SCSI(isp)) {
 		if (cdblen > sizeof (reqp->req_cdb)) {
 			isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this chip", cdblen);
-			XS_SETERR(xs, HBA_BOTCH);
+			XS_SETERR(xs, HBA_REQINVAL);
 			return (CMD_COMPLETE);
 		}
 		reqp->req_target = target | (XS_CHANNEL(xs) << 7);
@@ -4506,7 +4506,7 @@ isp_start(XS_T *xs)
 
 		if (cdblen > sizeof (t7->req_cdb)) {
 			isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this chip", cdblen);
-			XS_SETERR(xs, HBA_BOTCH);
+			XS_SETERR(xs, HBA_REQINVAL);
 			return (CMD_COMPLETE);
 		}
 
@@ -4539,7 +4539,7 @@ isp_start(XS_T *xs)
 
 		if (cdblen > sizeof t2->req_cdb) {
 			isp_prt(isp, ISP_LOGERR, "Command Length %u too long for this chip", cdblen);
-			XS_SETERR(xs, HBA_BOTCH);
+			XS_SETERR(xs, HBA_REQINVAL);
 			return (CMD_COMPLETE);
 		}
 		if (FCPARAM(isp, XS_CHANNEL(xs))->fctape_enabled && (lp->prli_word3 & PRLI_WD3_RETRY)) {
@@ -6567,6 +6567,7 @@ isp_parse_status(ispsoftc_t *isp, ispsta
 	case RQCS_PORT_BUSY:
 		isp_prt(isp, ISP_LOGWARN, "port busy for target %d", XS_TGT(xs));
 		if (XS_NOERR(xs)) {
+			*XS_STSP(xs) = SCSI_BUSY;
 			XS_SETERR(xs, HBA_TGTBSY);
 		}
 		return;

Modified: head/sys/dev/isp/isp_freebsd.h
==============================================================================
--- head/sys/dev/isp/isp_freebsd.h	Sun Feb 26 13:25:56 2017	(r314301)
+++ head/sys/dev/isp/isp_freebsd.h	Sun Feb 26 14:29:09 2017	(r314302)
@@ -574,6 +574,7 @@ default:							\
 #	define	HBA_CMDTIMEOUT		CAM_CMD_TIMEOUT
 #	define	HBA_SELTIMEOUT		CAM_SEL_TIMEOUT
 #	define	HBA_TGTBSY		CAM_SCSI_STATUS_ERROR
+#	define	HBA_REQINVAL		CAM_REQ_INVALID
 #	define	HBA_BUSRESET		CAM_SCSI_BUS_RESET
 #	define	HBA_ABORTED		CAM_REQ_ABORTED
 #	define	HBA_DATAOVR		CAM_DATA_RUN_ERR


More information about the svn-src-all mailing list