Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 May 2016 16:15:09 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300157 - head/sys/dev/isp
Message-ID:  <201605181615.u4IGF9d5039990@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed May 18 16:15:09 2016
New Revision: 300157
URL: https://svnweb.freebsd.org/changeset/base/300157

Log:
  Unify Multi ID target code by reusing isp_find_chan_by_did().

Modified:
  head/sys/dev/isp/isp_target.c

Modified: head/sys/dev/isp/isp_target.c
==============================================================================
--- head/sys/dev/isp/isp_target.c	Wed May 18 15:57:13 2016	(r300156)
+++ head/sys/dev/isp/isp_target.c	Wed May 18 16:15:09 2016	(r300157)
@@ -775,18 +775,17 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_en
 	notify.nt_tagval |= (((uint64_t)(isp->isp_serno++)) << 32);
 	notify.nt_lreserved = aep;
 	sid = (aep->at_hdr.s_id[0] << 16) | (aep->at_hdr.s_id[1] <<  8) | (aep->at_hdr.s_id[2]);
-
-	/* Channel has to derived from D_ID */
 	did = (aep->at_hdr.d_id[0] << 16) | (aep->at_hdr.d_id[1] << 8) | aep->at_hdr.d_id[2];
-	for (chan = 0; chan < isp->isp_nchan; chan++) {
-		if (FCPARAM(isp, chan)->isp_portid == did) {
-			break;
+	if (ISP_CAP_MULTI_ID(isp) && isp->isp_nchan > 1) {
+		/* Channel has to be derived from D_ID */
+		isp_find_chan_by_did(isp, did, &chan);
+		if (chan == ISP_NOCHAN) {
+			isp_prt(isp, ISP_LOGWARN, "%s: D_ID 0x%x not found on any channel", __func__, did);
+			/* just drop on the floor */
+			return;
 		}
-	}
-	if (chan == isp->isp_nchan) {
-		isp_prt(isp, ISP_LOGWARN, "%s: D_ID 0x%x not found on any channel", __func__, did);
-		/* just drop on the floor */
-		return;
+	} else {
+		chan = 0;
 	}
 	notify.nt_nphdl = NIL_HANDLE; /* unknown here */
 	notify.nt_sid = sid;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605181615.u4IGF9d5039990>