Author: mav
Date: Sun Mar 12 15:36:07 2017
New Revision: 315161
URL: https://svnweb.freebsd.org/changeset/base/315161

Log:
  Try to slight untangle I/O and loop status handling.
  
  MFC after:    2 weeks

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

Modified: head/sys/dev/isp/isp.c
==============================================================================
--- head/sys/dev/isp/isp.c      Sun Mar 12 14:17:57 2017        (r315160)
+++ head/sys/dev/isp/isp.c      Sun Mar 12 15:36:07 2017        (r315161)
@@ -4343,13 +4343,6 @@ isp_start(XS_T *xs)
                        return (CMD_COMPLETE);
                }
 
-               /*
-                * Try again later.
-                */
-               if (fcp->isp_loopstate != LOOP_READY) {
-                       return (CMD_RQLATER);
-               }
-
                isp_prt(isp, ISP_LOGDEBUG2, "XS_TGT(xs)=%d", target);
                lp = &fcp->portdb[target];
                if (target < 0 || target >= MAX_FC_TARG ||
@@ -4357,6 +4350,12 @@ isp_start(XS_T *xs)
                        XS_SETERR(xs, HBA_SELTIMEOUT);
                        return (CMD_COMPLETE);
                }
+               if (fcp->isp_loopstate != LOOP_READY) {
+                       isp_prt(isp, ISP_LOGDEBUG1,
+                           "%d.%d.%jx loop is not ready",
+                           XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs));
+                       return (CMD_RQLATER);
+               }
                if (lp->state == FC_PORTDB_STATE_ZOMBIE) {
                        isp_prt(isp, ISP_LOGDEBUG1,
                            "%d.%d.%jx target zombie",
@@ -6544,7 +6543,8 @@ isp_parse_status(ispsoftc_t *isp, ispsta
        case RQCS_PORT_CHANGED:
                isp_prt(isp, ISP_LOGWARN, "port changed for target %d", 
XS_TGT(xs));
                if (XS_NOERR(xs)) {
-                       XS_SETERR(xs, HBA_SELTIMEOUT);
+                       *XS_STSP(xs) = SCSI_BUSY;
+                       XS_SETERR(xs, HBA_TGTBSY);
                }
                return;
 
@@ -6693,11 +6693,11 @@ isp_parse_status_24xx(ispsoftc_t *isp, i
        case RQCS_PORT_CHANGED:
                isp_prt(isp, ISP_LOGWARN, "port changed for target %d chan %d", 
XS_TGT(xs), chan);
                if (XS_NOERR(xs)) {
-                       XS_SETERR(xs, HBA_SELTIMEOUT);
+                       *XS_STSP(xs) = SCSI_BUSY;
+                       XS_SETERR(xs, HBA_TGTBSY);
                }
                return;
 
-
        case RQCS_24XX_ENOMEM:  /* f/w resource unavailable */
                isp_prt(isp, ISP_LOGWARN, "f/w resource unavailable for target 
%d chan %d", XS_TGT(xs), chan);
                if (XS_NOERR(xs)) {

Modified: head/sys/dev/isp/isp_freebsd.c
==============================================================================
--- head/sys/dev/isp/isp_freebsd.c      Sun Mar 12 14:17:57 2017        
(r315160)
+++ head/sys/dev/isp/isp_freebsd.c      Sun Mar 12 15:36:07 2017        
(r315161)
@@ -3073,7 +3073,6 @@ isp_loop_changed(ispsoftc_t *isp, int ch
        isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGDEBUG0, "Chan %d Loop changed", 
chan);
        if (fcp->role & ISP_ROLE_INITIATOR)
                isp_freeze_loopdown(isp, chan);
-       fc->loop_dead = 0;
        fc->loop_down_time = time_uptime;
        wakeup(fc);
 }
@@ -3085,7 +3084,6 @@ isp_loop_up(ispsoftc_t *isp, int chan)
 
        isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGDEBUG0, "Chan %d Loop is up", chan);
        fc->loop_seen_once = 1;
-       fc->loop_dead = 0;
        fc->loop_down_time = 0;
        isp_unfreeze_loopdown(isp, chan);
 }
@@ -3149,7 +3147,6 @@ isp_loop_dead(ispsoftc_t *isp, int chan)
        }
 
        isp_unfreeze_loopdown(isp, chan);
-       fc->loop_dead = 1;
        fc->loop_down_time = 0;
 }
 
@@ -3377,18 +3374,6 @@ isp_action(struct cam_sim *sim, union cc
                        callout_reset(&PISP_PCMD(ccb)->wdog, ts, isp_watchdog, 
ccb);
                        break;
                case CMD_RQLATER:
-                       /*
-                        * We get this result if the loop isn't ready
-                        * or if the device in question has gone zombie.
-                        */
-                       if (ISP_FC_PC(isp, bus)->loop_dead) {
-                               isp_prt(isp, ISP_LOGDEBUG0,
-                                   "%d.%jx loop is dead",
-                                   XS_TGT(ccb), (uintmax_t)XS_LUN(ccb));
-                               ccb->ccb_h.status = CAM_SEL_TIMEOUT;
-                               isp_done((struct ccb_scsiio *) ccb);
-                               break;
-                       }
                        isp_prt(isp, ISP_LOGDEBUG0, "%d.%jx retry later",
                            XS_TGT(ccb), (uintmax_t)XS_LUN(ccb));
                        cam_freeze_devq(ccb->ccb_h.path);
@@ -3913,8 +3898,6 @@ isp_action(struct cam_sim *sim, union cc
        }
 }
 
-#define        ISPDDB  (CAM_DEBUG_INFO|CAM_DEBUG_TRACE|CAM_DEBUG_CDB)
-
 void
 isp_done(XS_T *sccb)
 {
@@ -3935,27 +3918,10 @@ isp_done(XS_T *sccb)
 
        sccb->ccb_h.status &= ~CAM_SIM_QUEUED;
        status = sccb->ccb_h.status & CAM_STATUS_MASK;
-       if (status != CAM_REQ_CMP) {
-               if (status != CAM_SEL_TIMEOUT)
-                       isp_prt(isp, ISP_LOGDEBUG0,
-                           "target %d lun %jx CAM status 0x%x SCSI status 
0x%x",
-                           XS_TGT(sccb), (uintmax_t)XS_LUN(sccb),
-                           sccb->ccb_h.status, sccb->scsi_status);
-               else if ((IS_FC(isp))
-                     && (XS_TGT(sccb) < MAX_FC_TARG)) {
-                       fcparam *fcp;
-
-                       fcp = FCPARAM(isp, XS_CHANNEL(sccb));
-                       fcp->portdb[XS_TGT(sccb)].is_target = 0;
-               }
-               if ((sccb->ccb_h.status & CAM_DEV_QFRZN) == 0) {
-                       sccb->ccb_h.status |= CAM_DEV_QFRZN;
-                       xpt_freeze_devq(sccb->ccb_h.path, 1);
-               }
-       }
-
-       if ((CAM_DEBUGGED(sccb->ccb_h.path, ISPDDB)) && (sccb->ccb_h.status & 
CAM_STATUS_MASK) != CAM_REQ_CMP) {
-               xpt_print(sccb->ccb_h.path, "cam completion status 0x%x\n", 
sccb->ccb_h.status);
+       if (status != CAM_REQ_CMP &&
+           (sccb->ccb_h.status & CAM_DEV_QFRZN) == 0) {
+               sccb->ccb_h.status |= CAM_DEV_QFRZN;
+               xpt_freeze_devq(sccb->ccb_h.path, 1);
        }
 
        if (ISP_PCMD(sccb)) {

Modified: head/sys/dev/isp/isp_freebsd.h
==============================================================================
--- head/sys/dev/isp/isp_freebsd.h      Sun Mar 12 14:17:57 2017        
(r315160)
+++ head/sys/dev/isp/isp_freebsd.h      Sun Mar 12 15:36:07 2017        
(r315161)
@@ -225,8 +225,6 @@ struct isp_fc {
                simqfrozen      : 3,
                default_id      : 8,
                def_role        : 2,    /* default role */
-               gdt_running     : 1,
-               loop_dead       : 1,
                loop_seen_once  : 1,
                fcbsy           : 1,
                ready           : 1;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to