Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Aug 2017 20:24:28 +0000 (UTC)
From:      "Kenneth D. Merry" <ken@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: r321945 - stable/10/sys/dev/isp
Message-ID:  <201708022024.v72KOSbT019077@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ken
Date: Wed Aug  2 20:24:28 2017
New Revision: 321945
URL: https://svnweb.freebsd.org/changeset/base/321945

Log:
  MFC r321622, r321623:
  
    ------------------------------------------------------------------------
    r321622 | ken | 2017-07-27 09:33:57 -0600 (Thu, 27 Jul 2017) | 44 lines
  
    Fix probing FC targets with hard addressing turned on.
  
    This largely reverts FreeBSD SVN change 289937 from October 25th, 2015.
  
    The intent of that change was to keep loop IDs persistent across
    chip reinits.
  
    The problem is that the change turned on the PREVLOOP /
    PREV_ADDRESS bit (bit 7 in Firmware Options 2), which tells the
    Qlogic chip to not participate in the loop if it can't get the
    requested loop address.  It also turned off soft addressing on 2400
    (4Gb) and newer controllers.
  
    The isp(4) driver defaults to loop address 0, and the tape drives
    I have tested default to loop address 0 if hard addressing is turned
    on.  So when hard loop addressing is turned on on the drive, the isp(4)
    driver just refuses to participate in the loop.
  
    The solution is to largely revert that change.  I left some elements
    in place that are related to virtual ports, since they were new.
  
    This does work with IBM tape drives with hard and soft addressing
    turned on.  I have tested it with 4Gb, 8Gb, and 16Gb controllers.
  
    sys/dev/isp.c:
    	Largely revert FreeBSD SVN change 289937.  I left the
    	ispmbox.h changes in place.
  
    	Don't use the PREV_ADDRESS bit on initialization.  It tells
    	the chip to not participate if it can't get the requested
    	loop ID.
  
    	Do use soft addressing on 2400 and newer chips.
  
    	Use hard addressing when the user has requested a specific
    	initiator ID.  (hint.isp.X.iid=N in /boot/loader.conf)
  
    	Leave some of the virtual port options from that change in
    	place, but don't turn on the PREV_ADDRESS bit.
  
    Reviewed by:	mav
    Sponsored by:	Spectra Logic
  
    ------------------------------------------------------------------------
    r321623 | ken | 2017-07-27 09:51:56 -0600 (Thu, 27 Jul 2017) | 6 lines
  
    Remove duplicate assignments from r321622.
  
    Submitted by:	mav
    Sponsored by:	Spectra Logic
  
    ------------------------------------------------------------------------

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	Wed Aug  2 20:24:26 2017	(r321944)
+++ stable/10/sys/dev/isp/isp.c	Wed Aug  2 20:24:28 2017	(r321945)
@@ -1632,6 +1632,7 @@ isp_fibre_init(ispsoftc_t *isp)
 	fcparam *fcp;
 	isp_icb_t local, *icbp = &local;
 	mbreg_t mbs;
+	int ownloopid;
 
 	/*
 	 * We only support one channel on non-24XX cards
@@ -1710,15 +1711,22 @@ isp_fibre_init(ispsoftc_t *isp)
 	}
 	icbp->icb_retry_delay = fcp->isp_retry_delay;
 	icbp->icb_retry_count = fcp->isp_retry_count;
-	if (fcp->isp_loopid < LOCAL_LOOP_LIM) {
-		icbp->icb_hardaddr = fcp->isp_loopid;
-		if (isp->isp_confopts & ISP_CFG_OWNLOOPID)
-			icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS;
-		else
-			icbp->icb_fwoptions |= ICBOPT_PREV_ADDRESS;
+	icbp->icb_hardaddr = fcp->isp_loopid;
+	ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0;
+	if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) {
+		icbp->icb_hardaddr = 0;
+		ownloopid = 0;
 	}
 
 	/*
+	 * Our life seems so much better with 2200s and later with
+	 * the latest f/w if we set Hard Address.
+	 */
+	if (ownloopid || ISP_FW_NEWER_THAN(isp, 2, 2, 5)) {
+		icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS;
+	}
+
+	/*
 	 * Right now we just set extended options to prefer point-to-point
 	 * over loop based upon some soft config options.
 	 *
@@ -1952,6 +1960,7 @@ isp_fibre_init_2400(ispsoftc_t *isp)
 	isp_icb_2400_t local, *icbp = &local;
 	mbreg_t mbs;
 	int chan;
+	int ownloopid = 0;
 
 	/*
 	 * Check to see whether all channels have *some* kind of role
@@ -2024,14 +2033,17 @@ isp_fibre_init_2400(ispsoftc_t *isp)
 			icbp->icb_xchgcnt >>= 1;
 	}
 
-	if (fcp->isp_loopid < LOCAL_LOOP_LIM) {
-		icbp->icb_hardaddr = fcp->isp_loopid;
-		if (isp->isp_confopts & ISP_CFG_OWNLOOPID)
-			icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS;
-		else
-			icbp->icb_fwoptions1 |= ICB2400_OPT1_PREV_ADDRESS;
+
+	ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0;
+	icbp->icb_hardaddr = fcp->isp_loopid;
+	if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) {
+		icbp->icb_hardaddr = 0;
+		ownloopid = 0;
 	}
 
+	if (ownloopid)
+		icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS;
+
 	if (isp->isp_confopts & ISP_CFG_NOFCTAPE) {
 		icbp->icb_fwoptions2 &= ~ICB2400_OPT2_FCTAPE;
 	}
@@ -2133,6 +2145,9 @@ isp_fibre_init_2400(ispsoftc_t *isp)
 			break;
 		}
 	}
+	if (ownloopid == 0) {
+		icbp->icb_fwoptions3 |= ICB2400_OPT3_SOFTID;
+	}
 	icbp->icb_logintime = ICB_LOGIN_TOV;
 
 	if (fcp->isp_wwnn && fcp->isp_wwpn) {
@@ -2245,14 +2260,13 @@ isp_fibre_init_2400(ispsoftc_t *isp)
 					pi.vp_port_options |= ICB2400_VPOPT_INI_ENABLE;
 				if ((fcp2->role & ISP_ROLE_TARGET) == 0)
 					pi.vp_port_options |= ICB2400_VPOPT_TGT_DISABLE;
+				if (fcp2->isp_loopid < LOCAL_LOOP_LIM) {
+					pi.vp_port_loopid = fcp2->isp_loopid;
+					if (isp->isp_confopts & ISP_CFG_OWNLOOPID)
+						pi.vp_port_options |= ICB2400_VPOPT_HARD_ADDRESS;
+				}
+
 			}
-			if (fcp2->isp_loopid < LOCAL_LOOP_LIM) {
-				pi.vp_port_loopid = fcp2->isp_loopid;
-				if (isp->isp_confopts & ISP_CFG_OWNLOOPID)
-					pi.vp_port_options |= ICB2400_VPOPT_HARD_ADDRESS;
-				else
-					pi.vp_port_options |= ICB2400_VPOPT_PREV_ADDRESS;
-			}
 			MAKE_NODE_NAME_FROM_WWN(pi.vp_port_portname, fcp2->isp_wwpn);
 			MAKE_NODE_NAME_FROM_WWN(pi.vp_port_nodename, fcp2->isp_wwnn);
 			off = fcp->isp_scratch;
@@ -2330,8 +2344,6 @@ isp_fc_enable_vp(ispsoftc_t *isp, int chan)
 		vp.vp_mod_ports[0].loopid = fcp->isp_loopid;
 		if (isp->isp_confopts & ISP_CFG_OWNLOOPID)
 			vp.vp_mod_ports[0].options |= ICB2400_VPOPT_HARD_ADDRESS;
-		else
-			vp.vp_mod_ports[0].options |= ICB2400_VPOPT_PREV_ADDRESS;
 	}
 	MAKE_NODE_NAME_FROM_WWN(vp.vp_mod_ports[0].wwpn, fcp->isp_wwpn);
 	MAKE_NODE_NAME_FROM_WWN(vp.vp_mod_ports[0].wwnn, fcp->isp_wwnn);



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