From ace7039eaacb4a6b6302a1b2fdf6488c97fe7459 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Wed, 13 Apr 2016 10:35:17 +0000 Subject: [PATCH] Filter Port Database Changed notifications. For some reason firmware sends Port Database Changed notifications in case of explicit login requests from the driver when target port is unavailabe. Those notifications don't give driver any new information, but only cause infinite scan loop. --- sys/dev/isp/isp.c | 11 +++++++++-- sys/dev/isp/ispvar.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c index 567b0a58ed17..dd8112f6703e 100644 --- a/sys/dev/isp/isp.c +++ b/sys/dev/isp/isp.c @@ -2630,6 +2630,7 @@ isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid, int flags isp_put_plogx(isp, &pl, (isp_plogx_t *)reqp); if (isp->isp_dblev & ISP_LOGDEBUG1) isp_print_bytes(isp, "IOCB LOGX", QENTRY_LEN, reqp); + FCPARAM(isp, chan)->isp_login_hdl = handle; ISP_SYNC_REQUEST(isp); if (msleep(resp, &isp->isp_lock, 0, "PLOGX", 3 * ICB_LOGIN_TOV * hz) == EWOULDBLOCK) { @@ -2638,6 +2639,7 @@ isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid, int flags isp_destroy_handle(isp, pl.plogx_handle); return (-1); } + FCPARAM(isp, chan)->isp_login_hdl = NIL_HANDLE; if (isp->isp_dblev & ISP_LOGDEBUG1) isp_print_bytes(isp, "IOCB LOGX response", QENTRY_LEN, resp); isp_get_plogx(isp, (isp_plogx_t *)resp, &pl); @@ -6000,9 +6002,13 @@ isp_parse_async_fc(ispsoftc_t *isp, uint16_t mbox) fcp = FCPARAM(isp, chan); if (fcp->role == ISP_ROLE_NONE) continue; - if (fcp->isp_loopstate > LOOP_LTEST_DONE) + if (fcp->isp_loopstate > LOOP_LTEST_DONE) { + if (nphdl != NIL_HANDLE && + nphdl == fcp->isp_login_hdl && + reason == PDB24XX_AE_OPN_2) + continue; fcp->isp_loopstate = LOOP_LTEST_DONE; - else if (fcp->isp_loopstate < LOOP_HAVE_LINK) + } else if (fcp->isp_loopstate < LOOP_HAVE_LINK) fcp->isp_loopstate = LOOP_HAVE_LINK; isp_async(isp, ISPASYNC_CHANGE_NOTIFY, chan, ISPASYNC_CHANGE_PDB, nphdl, nlstate, reason); @@ -7818,6 +7824,7 @@ isp_setdfltfcparm(ispsoftc_t *isp, int chan) fcp->isp_xfwoptions = 0; fcp->isp_zfwoptions = 0; fcp->isp_lasthdl = NIL_HANDLE; + fcp->isp_login_hdl = NIL_HANDLE; if (IS_24XX(isp)) { fcp->isp_fwoptions |= ICB2400_OPT1_FAIRNESS; diff --git a/sys/dev/isp/ispvar.h b/sys/dev/isp/ispvar.h index f1fae6cd9f6b..104782b6def8 100644 --- a/sys/dev/isp/ispvar.h +++ b/sys/dev/isp/ispvar.h @@ -449,6 +449,7 @@ typedef struct { uint16_t isp_lasthdl; /* only valid for channel 0 */ uint16_t isp_maxalloc; uint16_t isp_fabric_params; + uint16_t isp_login_hdl; /* Logging in handle */ uint8_t isp_retry_delay; uint8_t isp_retry_count;