summaryrefslogtreecommitdiffstats
path: root/sys/dev/isp/isp_library.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2015-11-30 21:58:51 +0000
committermav <mav@FreeBSD.org>2015-11-30 21:58:51 +0000
commit97189158140218a2e5bfbd037679e515e9b2c64e (patch)
tree7d2745eb767919ae36eed1656e80ff70595c31c5 /sys/dev/isp/isp_library.c
parent7e425797577f91547491a85ffd37c7eab99b9bb2 (diff)
downloadFreeBSD-src-97189158140218a2e5bfbd037679e515e9b2c64e.zip
FreeBSD-src-97189158140218a2e5bfbd037679e515e9b2c64e.tar.gz
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.
Diffstat (limited to 'sys/dev/isp/isp_library.c')
-rw-r--r--sys/dev/isp/isp_library.c49
1 files changed, 24 insertions, 25 deletions
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";
OpenPOWER on IntegriCloud