Author: mav
Date: Mon Mar  6 06:39:42 2017
New Revision: 314759
URL: https://svnweb.freebsd.org/changeset/base/314759

Log:
  MFC r314302: 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.

Modified:
  stable/10/sys/dev/isp/isp.c
  stable/10/sys/dev/isp/isp_freebsd.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp.c
==============================================================================
--- stable/10/sys/dev/isp/isp.c Mon Mar  6 06:39:10 2017        (r314758)
+++ stable/10/sys/dev/isp/isp.c Mon Mar  6 06:39:42 2017        (r314759)
@@ -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: stable/10/sys/dev/isp/isp_freebsd.h
==============================================================================
--- stable/10/sys/dev/isp/isp_freebsd.h Mon Mar  6 06:39:10 2017        
(r314758)
+++ stable/10/sys/dev/isp/isp_freebsd.h Mon Mar  6 06:39:42 2017        
(r314759)
@@ -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
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to