Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Mar 2017 13:46:11 +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: r315545 - head/sys/dev/isp
Message-ID:  <201703191346.v2JDkBRt047247@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sun Mar 19 13:46:11 2017
New Revision: 315545
URL: https://svnweb.freebsd.org/changeset/base/315545

Log:
  Remove hackish code delaying ATIOs to unknown virtual port.
  
  Since we support RQSTYPE_RPT_ID_ACQ, that functionality is only useful
  in loop mode, which probably doesn't worth having this hack in 2017.
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/isp/isp_target.c
  head/sys/dev/isp/ispvar.h

Modified: head/sys/dev/isp/isp.c
==============================================================================
--- head/sys/dev/isp/isp.c	Sun Mar 19 10:41:36 2017	(r315544)
+++ head/sys/dev/isp/isp.c	Sun Mar 19 13:46:11 2017	(r315545)
@@ -1323,7 +1323,6 @@ isp_init(ispsoftc_t *isp)
 	} else {
 		isp_scsi_init(isp);
 	}
-	GET_NANOTIME(&isp->isp_init_time);
 }
 
 static void
@@ -2368,7 +2367,6 @@ isp_fc_enable_vp(ispsoftc_t *isp, int ch
 		    __func__, chan, vp.vp_mod_hdr.rqs_flags, vp.vp_mod_status);
 		return (EIO);
 	}
-	GET_NANOTIME(&isp->isp_init_time);
 	return (0);
 }
 
@@ -5655,7 +5653,6 @@ isp_parse_async_fc(ispsoftc_t *isp, uint
 		 * These are broadcast events that have to be sent across
 		 * all active channels.
 		 */
-		GET_NANOTIME(&isp->isp_init_time);
 		for (chan = 0; chan < isp->isp_nchan; chan++) {
 			fcp = FCPARAM(isp, chan);
 			int topo = fcp->isp_topo;
@@ -5710,7 +5707,6 @@ isp_parse_async_fc(ispsoftc_t *isp, uint
 		 * This is a broadcast event that has to be sent across
 		 * all active channels.
 		 */
-		GET_NANOTIME(&isp->isp_init_time);
 		for (chan = 0; chan < isp->isp_nchan; chan++) {
 			fcp = FCPARAM(isp, chan);
 			if (fcp->role == ISP_ROLE_NONE)
@@ -5750,7 +5746,6 @@ isp_parse_async_fc(ispsoftc_t *isp, uint
 		 * This is a broadcast event that has to be sent across
 		 * all active channels.
 		 */
-		GET_NANOTIME(&isp->isp_init_time);
 		for (chan = 0; chan < isp->isp_nchan; chan++) {
 			fcp = FCPARAM(isp, chan);
 			if (fcp->role == ISP_ROLE_NONE)
@@ -5942,7 +5937,6 @@ isp_handle_other_response(ispsoftc_t *is
 		portid = (uint32_t)rid.ridacq_vp_port_hi << 16 |
 		    rid.ridacq_vp_port_lo;
 		if (rid.ridacq_format == 0) {
-			GET_NANOTIME(&isp->isp_init_time);
 			for (chan = 0; chan < isp->isp_nchan; chan++) {
 				fcparam *fcp = FCPARAM(isp, chan);
 				if (fcp->role == ISP_ROLE_NONE)

Modified: head/sys/dev/isp/isp_freebsd.c
==============================================================================
--- head/sys/dev/isp/isp_freebsd.c	Sun Mar 19 10:41:36 2017	(r315544)
+++ head/sys/dev/isp/isp_freebsd.c	Sun Mar 19 13:46:11 2017	(r315545)
@@ -1817,44 +1817,17 @@ isp_handle_platform_atio7(ispsoftc_t *is
 	sid = (aep->at_hdr.s_id[0] << 16) | (aep->at_hdr.s_id[1] << 8) | aep->at_hdr.s_id[2];
 	lun = CAM_EXTLUN_BYTE_SWIZZLE(be64dec(aep->at_cmnd.fcp_cmnd_lun));
 
-	/*
-	 * Find the N-port handle, and Virtual Port Index for this command.
-	 *
-	 * If we can't, we're somewhat in trouble because we can't actually respond w/o that information.
-	 * We also, as a matter of course, need to know the WWN of the initiator too.
-	 */
 	if (ISP_CAP_MULTI_ID(isp) && isp->isp_nchan > 1) {
-		/*
-		 * Find the right channel based upon D_ID
-		 */
+		/* Channel has to be derived from D_ID */
 		isp_find_chan_by_did(isp, did, &chan);
-
 		if (chan == ISP_NOCHAN) {
-			NANOTIME_T now;
-
-			/*
-			 * If we don't recognizer our own D_DID, terminate the exchange, unless we're within 2 seconds of startup
-			 * It's a bit tricky here as we need to stash this command *somewhere*.
-			 */
-			GET_NANOTIME(&now);
-			if (NANOTIME_SUB(&now, &isp->isp_init_time) > 2000000000ULL) {
-				isp_prt(isp, ISP_LOGWARN, "%s: [RX_ID 0x%x] D_ID %x not found on any channel- dropping", __func__, aep->at_rxid, did);
-				isp_endcmd(isp, aep, NIL_HANDLE, ISP_NOCHAN, ECMD_TERMINATE, 0);
-				return;
-			}
-			tptr = get_lun_statep(isp, 0, 0);
-			if (tptr == NULL) {
-				tptr = get_lun_statep(isp, 0, CAM_LUN_WILDCARD);
-				if (tptr == NULL) {
-					isp_prt(isp, ISP_LOGWARN, "%s: [RX_ID 0x%x] D_ID %x not found on any channel and no tptr- dropping", __func__, aep->at_rxid, did);
-					isp_endcmd(isp, aep, NIL_HANDLE, ISP_NOCHAN, ECMD_TERMINATE, 0);
-					return;
-				}
-			}
-			isp_prt(isp, ISP_LOGWARN, "%s: [RX_ID 0x%x] D_ID %x not found on any channel- deferring", __func__, aep->at_rxid, did);
-			goto noresrc;
+			isp_prt(isp, ISP_LOGWARN,
+			    "%s: [RX_ID 0x%x] D_ID %x not found on any channel",
+			    __func__, aep->at_rxid, did);
+			isp_endcmd(isp, aep, NIL_HANDLE, ISP_NOCHAN,
+			    ECMD_TERMINATE, 0);
+			return;
 		}
-		isp_prt(isp, ISP_LOGTDEBUG0, "%s: [RX_ID 0x%x] D_ID 0x%06x found on Chan %d for S_ID 0x%06x", __func__, aep->at_rxid, did, chan, sid);
 	} else {
 		chan = 0;
 	}

Modified: head/sys/dev/isp/isp_target.c
==============================================================================
--- head/sys/dev/isp/isp_target.c	Sun Mar 19 10:41:36 2017	(r315544)
+++ head/sys/dev/isp/isp_target.c	Sun Mar 19 13:46:11 2017	(r315545)
@@ -688,8 +688,11 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_en
 		/* 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);
-			isp_endcmd(isp, aep, NIL_HANDLE, ISP_NOCHAN, ECMD_TERMINATE, 0);
+			isp_prt(isp, ISP_LOGWARN,
+			    "%s: D_ID 0x%x not found on any channel",
+			    __func__, did);
+			isp_endcmd(isp, aep, NIL_HANDLE, ISP_NOCHAN,
+			    ECMD_TERMINATE, 0);
 			return;
 		}
 	} else {
@@ -891,17 +894,23 @@ isp_handle_abts(ispsoftc_t *isp, abts_t 
 	nt->nt_did = did;
 	nt->nt_nphdl = abts->abts_nphdl;
 	nt->nt_sid = sid;
-	isp_find_chan_by_did(isp, did, &chan);
-	if (chan == ISP_NOCHAN) {
-		nt->nt_tgt = TGT_ANY;
-	} else {
-		nt->nt_tgt = FCPARAM(isp, chan)->isp_wwpn;
-		if (isp_find_pdb_by_handle(isp, chan, abts->abts_nphdl, &lp)) {
-			nt->nt_wwn = lp->port_wwn;
-		} else {
-			nt->nt_wwn = INI_ANY;
+	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);
+			isp_acknak_abts(isp, abts, ENXIO);
+			return;
 		}
-	}
+	} else
+		chan = 0;
+	nt->nt_tgt = FCPARAM(isp, chan)->isp_wwpn;
+	if (isp_find_pdb_by_handle(isp, chan, abts->abts_nphdl, &lp))
+		nt->nt_wwn = lp->port_wwn;
+	else
+		nt->nt_wwn = INI_ANY;
 	nt->nt_lun = LUN_ANY;
 	nt->nt_need_ack = 1;
 	nt->nt_tagval = abts->abts_rxid_task;

Modified: head/sys/dev/isp/ispvar.h
==============================================================================
--- head/sys/dev/isp/ispvar.h	Sun Mar 19 10:41:36 2017	(r315544)
+++ head/sys/dev/isp/ispvar.h	Sun Mar 19 13:46:11 2017	(r315545)
@@ -544,7 +544,6 @@ struct ispsoftc {
 	uint32_t		isp_rqstoutrp;	/* register for REQOUTP */
 	uint32_t		isp_respinrp;	/* register for RESINP */
 	uint32_t		isp_respoutrp;	/* register for RESOUTP */
-	NANOTIME_T		isp_init_time;		/* time were last initialized */
 
 	/*
 	 * Volatile state



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