From 97189158140218a2e5bfbd037679e515e9b2c64e Mon Sep 17 00:00:00 2001 From: mav Date: Mon, 30 Nov 2015 21:58:51 +0000 Subject: MFC r291365, r291369: One more round of port scanner rewrite. - Make scan aborted by event restart immediately and infinitely. - Improve handling of some loop events from firmware. - Remove loop down timer, adding its functionality to scanner thread. - Some more unification and simplification. --- sys/dev/isp/isp_library.c | 49 +++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'sys/dev/isp/isp_library.c') diff --git a/sys/dev/isp/isp_library.c b/sys/dev/isp/isp_library.c index 6003d00..9e8f3ab 100644 --- a/sys/dev/isp/isp_library.c +++ b/sys/dev/isp/isp_library.c @@ -394,33 +394,31 @@ isp_print_bytes(ispsoftc_t *isp, const char *msg, int amt, void *arg) int isp_fc_runstate(ispsoftc_t *isp, int chan, int tval) { - fcparam *fcp; + fcparam *fcp = FCPARAM(isp, chan); + int res; - fcp = FCPARAM(isp, chan); - if (fcp->role == ISP_ROLE_NONE) { - return (0); - } - if (isp_control(isp, ISPCTL_FCLINK_TEST, chan, tval) != 0) { - isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: linktest failed for channel %d", chan); - return (-1); - } - if (isp_control(isp, ISPCTL_SCAN_LOOP, chan) != 0) { - isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: scan loop failed on channel %d", chan); - return (LOOP_LTEST_DONE); - } - if (isp_control(isp, ISPCTL_SCAN_FABRIC, chan) != 0) { - isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: scan fabric failed on channel %d", chan); - return (LOOP_LSCAN_DONE); - } - if (isp_control(isp, ISPCTL_PDB_SYNC, chan) != 0) { - isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: pdb_sync failed on channel %d", chan); - return (LOOP_FSCAN_DONE); - } - if (fcp->isp_loopstate != LOOP_READY) { - isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: not ready again on channel %d", chan); +again: + if (fcp->role == ISP_ROLE_NONE) return (-1); - } - return (0); + res = isp_control(isp, ISPCTL_FCLINK_TEST, chan, tval); + if (res > 0) + goto again; + if (res < 0) + return (fcp->isp_loopstate); + res = isp_control(isp, ISPCTL_SCAN_LOOP, chan); + if (res > 0) + goto again; + if (res < 0) + return (fcp->isp_loopstate); + res = isp_control(isp, ISPCTL_SCAN_FABRIC, chan); + if (res > 0) + goto again; + if (res < 0) + return (fcp->isp_loopstate); + res = isp_control(isp, ISPCTL_PDB_SYNC, chan); + if (res > 0) + goto again; + return (fcp->isp_loopstate); } /* @@ -545,6 +543,7 @@ isp_fc_loop_statename(int state) { switch (state) { case LOOP_NIL: return "NIL"; + case LOOP_HAVE_LINK: return "Have Link"; case LOOP_TESTING_LINK: return "Testing Link"; case LOOP_LTEST_DONE: return "Link Test Done"; case LOOP_SCANNING_LOOP: return "Scanning Loop"; -- cgit v1.1