Date: Mon, 30 Nov 2015 21:39:33 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291513 - stable/10/sys/dev/isp Message-ID: <201511302139.tAULdXC3070486@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Mon Nov 30 21:39:33 2015 New Revision: 291513 URL: https://svnweb.freebsd.org/changeset/base/291513 Log: MFC r291014: Simplify fabric tasting code. Except cosmetic changes this removes fabric ports from our port database. It is always firmware duty to manage them, so driver don't need to worry. Modified: stable/10/sys/dev/isp/isp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Mon Nov 30 21:38:51 2015 (r291512) +++ stable/10/sys/dev/isp/isp.c Mon Nov 30 21:39:33 2015 (r291513) @@ -2766,10 +2766,9 @@ static int isp_fclink_test(ispsoftc_t *isp, int chan, int usdelay) { mbreg_t mbs; - int check_for_fabric, r; + int r; uint16_t nphdl; fcparam *fcp; - fcportdb_t *lp; isp_pdb_t pdb; NANOTIME_T hra, hrb; @@ -2826,7 +2825,14 @@ isp_fclink_test(ispsoftc_t *isp, int cha } if (IS_2100(isp)) { - fcp->isp_topo = TOPO_NL_PORT; + /* + * Don't bother with fabric if we are using really old + * 2100 firmware. It's just not worth it. + */ + if (ISP_FW_NEWER_THAN(isp, 1, 15, 37)) + fcp->isp_topo = TOPO_FL_PORT; + else + fcp->isp_topo = TOPO_NL_PORT; } else { int topo = (int) mbs.param[6]; if (topo < TOPO_NL_PORT || topo > TOPO_PTP_STUB) { @@ -2836,22 +2842,6 @@ isp_fclink_test(ispsoftc_t *isp, int cha } fcp->isp_portid = mbs.param[2] | (mbs.param[3] << 16); - if (IS_2100(isp)) { - /* - * Don't bother with fabric if we are using really old - * 2100 firmware. It's just not worth it. - */ - if (ISP_FW_NEWER_THAN(isp, 1, 15, 37)) { - check_for_fabric = 1; - } else { - check_for_fabric = 0; - } - } else if (fcp->isp_topo == TOPO_FL_PORT || fcp->isp_topo == TOPO_F_PORT) { - check_for_fabric = 1; - } else { - check_for_fabric = 0; - } - /* * Check to make sure we got a valid loopid * The 24XX seems to mess this up for multiple channels. @@ -2878,54 +2868,22 @@ isp_fclink_test(ispsoftc_t *isp, int cha } } - - if (IS_24XX(isp)) { /* XXX SHOULDN'T THIS BE FOR 2K F/W? XXX */ - nphdl = NPH_FL_ID; - } else { - nphdl = FL_ID; - } - if (check_for_fabric) { + if (fcp->isp_topo == TOPO_F_PORT || fcp->isp_topo == TOPO_FL_PORT) { + nphdl = IS_24XX(isp) ? NPH_FL_ID : FL_ID; r = isp_getpdb(isp, chan, nphdl, &pdb, 1); - if (r && (fcp->isp_topo == TOPO_F_PORT || fcp->isp_topo == TOPO_FL_PORT)) { - isp_prt(isp, ISP_LOGWARN, "fabric topology but cannot get info about fabric controller (0x%x)", r); - fcp->isp_topo = TOPO_PTP_STUB; - } - } else { - r = -1; - } - if (r == 0) { - if (IS_2100(isp)) { - fcp->isp_topo = TOPO_FL_PORT; - } - if (pdb.portid == 0) { - /* - * Crock. - */ - fcp->isp_topo = TOPO_NL_PORT; + if (r != 0 || pdb.portid == 0) { + if (IS_2100(isp)) { + fcp->isp_topo = TOPO_NL_PORT; + } else { + isp_prt(isp, ISP_LOGWARN, + "fabric topology, but cannot get info about fabric controller (0x%x)", r); + fcp->isp_topo = TOPO_PTP_STUB; + } goto not_on_fabric; } - /* - * Save the Fabric controller's port database entry. - */ - lp = &fcp->portdb[FL_ID]; - lp->state = FC_PORTDB_STATE_PENDING_VALID; - MAKE_WWN_FROM_NODE_NAME(lp->node_wwn, pdb.nodename); - MAKE_WWN_FROM_NODE_NAME(lp->port_wwn, pdb.portname); - lp->prli_word3 = pdb.prli_word3; - lp->portid = pdb.portid; - lp->handle = pdb.handle; - lp->new_portid = lp->portid; - lp->new_prli_word3 = lp->prli_word3; if (IS_24XX(isp)) { - if (check_for_fabric) { - /* - * The mbs is still hanging out from the MBOX_GET_LOOP_ID above. - */ - fcp->isp_fabric_params = mbs.param[7]; - } else { - fcp->isp_fabric_params = 0; - } + fcp->isp_fabric_params = mbs.param[7]; fcp->isp_sns_hdl = NPH_SNS_ID; r = isp_register_fc4_type_24xx(isp, chan); if (r == 0) @@ -2938,11 +2896,9 @@ isp_fclink_test(ispsoftc_t *isp, int cha isp_prt(isp, ISP_LOGWARN|ISP_LOG_SANCFG, "%s: register fc4 type failed", __func__); return (-1); } - } else { -not_on_fabric: - fcp->portdb[FL_ID].state = FC_PORTDB_STATE_NIL; } +not_on_fabric: fcp->isp_gbspeed = 1; if (IS_23XX(isp) || IS_24XX(isp)) { MBSINIT(&mbs, MBOX_GET_SET_DATA_RATE, MBLOGALL, 3000000); @@ -3054,10 +3010,6 @@ isp_pdb_sync(ispsoftc_t *isp, int chan) lp->prli_word3 = lp->new_prli_word3; lp->state = FC_PORTDB_STATE_VALID; isp_async(isp, ISPASYNC_DEV_STAYED, chan, lp); - if (dbidx != FL_ID) { - lp->new_prli_word3 = 0; - lp->new_portid = 0; - } break; case FC_PORTDB_STATE_ZOMBIE: break; @@ -3532,11 +3484,7 @@ abort: /* * Make sure we still are logged into the fabric controller. */ - if (IS_24XX(isp)) { /* XXX SHOULDN'T THIS BE TRUE FOR 2K F/W? XXX */ - nphdl = NPH_FL_ID; - } else { - nphdl = FL_ID; - } + nphdl = IS_24XX(isp) ? NPH_FL_ID : FL_ID; r = isp_getpdb(isp, chan, nphdl, &pdb, 0); if ((r & 0xffff) == MBOX_NOT_LOGGED_IN) { isp_dump_chip_portdb(isp, chan, 0); @@ -3590,12 +3538,6 @@ abort: return (0); } - - /* - * If we get this far, we certainly still have the fabric controller. - */ - fcp->portdb[FL_ID].state = FC_PORTDB_STATE_PENDING_VALID; - /* * Go through the list and remove duplicate port ids. */ @@ -3840,10 +3782,6 @@ abort: dbidx = MAX_FC_TARG; for (lp = fcp->portdb; lp < &fcp->portdb[MAX_FC_TARG]; lp++) { - if (lp >= &fcp->portdb[FL_ID] && - lp <= &fcp->portdb[SNS_ID]) { - continue; - } if (lp->state == FC_PORTDB_STATE_NIL) { if (dbidx == MAX_FC_TARG) { dbidx = lp - fcp->portdb; @@ -3909,9 +3847,6 @@ abort: * WWNN/WWPN duple */ for (dbidx = 0; dbidx < MAX_FC_TARG; dbidx++) { - if (dbidx >= FL_ID && dbidx <= SNS_ID) { - continue; - } if ((fcp->portdb[dbidx].node_wwn == wwnn || fcp->portdb[dbidx].node_wwn == 0) && fcp->portdb[dbidx].port_wwn == wwpn) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511302139.tAULdXC3070486>