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
This commit is contained in:
Alexander Motin 2017-02-26 14:29:09 +00:00
parent 645b154260
commit 2d4a5bcccb
2 changed files with 6 additions and 4 deletions

@ -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, ispstatusreq_t *sp, XS_T *xs, long *rp)
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;

@ -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