From owner-svn-src-stable@freebsd.org Tue May 3 08:05:32 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77DAEB29401; Tue, 3 May 2016 08:05:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C407171A; Tue, 3 May 2016 08:05:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4385VC2045131; Tue, 3 May 2016 08:05:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4385VcT045128; Tue, 3 May 2016 08:05:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605030805.u4385VcT045128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 May 2016 08:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298972 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2016 08:05:32 -0000 Author: mav Date: Tue May 3 08:05:31 2016 New Revision: 298972 URL: https://svnweb.freebsd.org/changeset/base/298972 Log: MFC r297991: Extract virtual port address from RQSTYPE_RPT_ID_ACQ. This should close the race between request arriving on new target mode virtual port and its scanner thread finally fetch its address for request routing. Modified: stable/10/sys/dev/isp/isp.c stable/10/sys/dev/isp/isp_library.c stable/10/sys/dev/isp/ispvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Tue May 3 08:05:14 2016 (r298971) +++ stable/10/sys/dev/isp/isp.c Tue May 3 08:05:31 2016 (r298972) @@ -3011,7 +3011,6 @@ isp_fclink_test(ispsoftc_t *isp, int cha return (0); isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC link test", chan); - fcp->isp_loopstate = LOOP_TESTING_LINK; /* * Wait up to N microseconds for F/W to go to a ready state. @@ -3022,7 +3021,7 @@ isp_fclink_test(ispsoftc_t *isp, int cha if (fcp->isp_fwstate == FW_READY) { break; } - if (fcp->isp_loopstate < LOOP_TESTING_LINK) + if (fcp->isp_loopstate < LOOP_HAVE_LINK) goto abort; GET_NANOTIME(&hrb); if ((NANOTIME_SUB(&hrb, &hra) / 1000 + 1000 >= usdelay)) @@ -3077,6 +3076,11 @@ isp_fclink_test(ispsoftc_t *isp, int cha fcp->isp_loopid = i; } +#if 0 + fcp->isp_loopstate = LOOP_HAVE_ADDR; +#endif + fcp->isp_loopstate = LOOP_TESTING_LINK; + 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); @@ -6138,7 +6142,7 @@ isp_handle_other_response(ispsoftc_t *is { isp_ridacq_t rid; int chan, c; - uint32_t hdl; + uint32_t hdl, portid; void *ptr; switch (type) { @@ -6150,6 +6154,8 @@ isp_handle_other_response(ispsoftc_t *is return (1); case RQSTYPE_RPT_ID_ACQ: isp_get_ridacq(isp, (isp_ridacq_t *)hp, &rid); + portid = (uint32_t)rid.ridacq_vp_port_hi << 16 | + rid.ridacq_vp_port_lo; if (rid.ridacq_format == 0) { for (chan = 0; chan < isp->isp_nchan; chan++) { fcparam *fcp = FCPARAM(isp, chan); @@ -6171,7 +6177,9 @@ isp_handle_other_response(ispsoftc_t *is fcparam *fcp = FCPARAM(isp, rid.ridacq_vp_index); if (rid.ridacq_vp_status == RIDACQ_STS_COMPLETE || rid.ridacq_vp_status == RIDACQ_STS_CHANGED) { - fcp->isp_loopstate = LOOP_HAVE_LINK; + fcp->isp_topo = (rid.ridacq_map[0] >> 9) & 0x7; + fcp->isp_portid = portid; + fcp->isp_loopstate = LOOP_HAVE_ADDR; isp_async(isp, ISPASYNC_CHANGE_NOTIFY, rid.ridacq_vp_index, ISPASYNC_CHANGE_OTHER); } else { Modified: stable/10/sys/dev/isp/isp_library.c ============================================================================== --- stable/10/sys/dev/isp/isp_library.c Tue May 3 08:05:14 2016 (r298971) +++ stable/10/sys/dev/isp/isp_library.c Tue May 3 08:05:31 2016 (r298972) @@ -532,6 +532,7 @@ isp_fc_loop_statename(int state) switch (state) { case LOOP_NIL: return "NIL"; case LOOP_HAVE_LINK: return "Have Link"; + case LOOP_HAVE_ADDR: return "Have Address"; case LOOP_TESTING_LINK: return "Testing Link"; case LOOP_LTEST_DONE: return "Link Test Done"; case LOOP_SCANNING_LOOP: return "Scanning Loop"; @@ -548,7 +549,7 @@ const char * isp_fc_toponame(fcparam *fcp) { - if (fcp->isp_loopstate < LOOP_LTEST_DONE) { + if (fcp->isp_loopstate < LOOP_HAVE_ADDR) { return "Unavailable"; } switch (fcp->isp_topo) { @@ -2329,7 +2330,7 @@ isp_find_chan_by_did(ispsoftc_t *isp, ui for (chan = 0; chan < isp->isp_nchan; chan++) { fcparam *fcp = FCPARAM(isp, chan); if ((fcp->role & ISP_ROLE_TARGET) == 0 || - fcp->isp_loopstate < LOOP_LTEST_DONE) { + fcp->isp_loopstate < LOOP_HAVE_ADDR) { continue; } if (fcp->isp_portid == did) { Modified: stable/10/sys/dev/isp/ispvar.h ============================================================================== --- stable/10/sys/dev/isp/ispvar.h Tue May 3 08:05:14 2016 (r298971) +++ stable/10/sys/dev/isp/ispvar.h Tue May 3 08:05:31 2016 (r298972) @@ -490,14 +490,15 @@ typedef struct { #define LOOP_NIL 0 #define LOOP_HAVE_LINK 1 -#define LOOP_TESTING_LINK 2 -#define LOOP_LTEST_DONE 3 -#define LOOP_SCANNING_LOOP 4 -#define LOOP_LSCAN_DONE 5 -#define LOOP_SCANNING_FABRIC 6 -#define LOOP_FSCAN_DONE 7 -#define LOOP_SYNCING_PDB 8 -#define LOOP_READY 9 +#define LOOP_HAVE_ADDR 2 +#define LOOP_TESTING_LINK 3 +#define LOOP_LTEST_DONE 4 +#define LOOP_SCANNING_LOOP 5 +#define LOOP_LSCAN_DONE 6 +#define LOOP_SCANNING_FABRIC 7 +#define LOOP_FSCAN_DONE 8 +#define LOOP_SYNCING_PDB 9 +#define LOOP_READY 10 #define TOPO_NL_PORT 0 #define TOPO_FL_PORT 1