Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Apr 2010 23:05:56 +0000 (UTC)
From:      Matt Jacob <mjacob@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r207171 - stable/8/sys/dev/isp
Message-ID:  <201004242305.o3ON5ucN073230@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjacob
Date: Sat Apr 24 23:05:56 2010
New Revision: 207171
URL: http://svn.freebsd.org/changeset/base/207171

Log:
  This is an MFC of 205236
  
  Put gone device timer into a structure tag that can hold more than 32 seconds. Oops.
  
  Untangle some of the confusion about what role means when it's in the FCPARAM/SDPARAM
  or isp_fc/isp_spi structures. This fixed a problem about seeing targets appear if you've
  turned off autologin and find them, or rather don't, via camcontrol rescan.

Modified:
  stable/8/sys/dev/isp/isp_freebsd.c
  stable/8/sys/dev/isp/isp_freebsd.h
  stable/8/sys/dev/isp/isp_pci.c
  stable/8/sys/dev/isp/isp_sbus.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/geom/sched/   (props changed)

Modified: stable/8/sys/dev/isp/isp_freebsd.c
==============================================================================
--- stable/8/sys/dev/isp/isp_freebsd.c	Sat Apr 24 22:52:14 2010	(r207170)
+++ stable/8/sys/dev/isp/isp_freebsd.c	Sat Apr 24 23:05:56 2010	(r207171)
@@ -3945,11 +3945,15 @@ isp_gdt(void *arg)
 		if (lp->dev_map_idx == 0 || lp->target_mode) {
 			continue;
 		}
-		if (lp->new_reserved == 0) {
+		/*
+		 * We can use new_portid here because it is untouched
+		 * while the state is ZOMBIE
+		 */
+		if (lp->new_portid == 0) {
 			continue;
 		}
-		lp->new_reserved -= 1;
-		if (lp->new_reserved != 0) {
+		lp->new_portid -= 1;
+		if (lp->new_portid != 0) {
 			more_to_do++;
 			continue;
 		}
@@ -4059,7 +4063,7 @@ isp_kthread(void *arg)
 		 *
 		 * If not, we simply just wait for loop to come up.
 		 */
-		if (lb && (fc->role & ISP_ROLE_INITIATOR)) {
+		if (lb && (FCPARAM(isp, chan)->role & ISP_ROLE_INITIATOR)) {
 			/*
 			 * Increment loop down time by the last sleep interval
 			 */
@@ -4927,7 +4931,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm
 			/*
 			 * We don't do any simq freezing if we are only in target mode
 			 */
-			if (fc->role & ISP_ROLE_INITIATOR) {
+			if (FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) {
 				if (fc->path) {
 					isp_freeze_loopdown(isp, bus, msg);
 				}
@@ -4963,7 +4967,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm
 		va_end(ap);
 		fc = ISP_FC_PC(isp, bus);
 		lp->reserved = 0;
-		if ((fc->role & ISP_ROLE_INITIATOR) && (lp->roles & (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT))) {
+		if ((FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) && (lp->roles & (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT))) {
 			int dbidx = lp - FCPARAM(isp, bus)->portdb;
 			int i;
 
@@ -5051,10 +5055,13 @@ isp_async(ispsoftc_t *isp, ispasync_t cm
 		 *
 		 * If it isn't marked that isp_gdt is going to get rid of it,
 		 * announce that it's gone.
+		 *
+		 * We can use new_portid for the gone timer because it's
+		 * undefined while the state is ZOMBIE.
 		 */
 		if (lp->dev_map_idx && lp->reserved == 0) {
 			lp->reserved = 1;
-			lp->new_reserved = ISP_FC_PC(isp, bus)->gone_device_time;
+			lp->new_portid = ISP_FC_PC(isp, bus)->gone_device_time;
 			lp->state = FC_PORTDB_STATE_ZOMBIE;
 			if (fc->ready && !callout_active(&fc->gdt)) {
 				isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d starting Gone Device Timer", bus);
@@ -5101,7 +5108,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm
 			callout_stop(&fc->ldt);
 		}
 		isp_prt(isp, ISP_LOGINFO, msg, bus);
-		if (fc->role & ISP_ROLE_INITIATOR) {
+		if (FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) {
 			isp_freeze_loopdown(isp, bus, msg);
 		}
 		wakeup(fc);

Modified: stable/8/sys/dev/isp/isp_freebsd.h
==============================================================================
--- stable/8/sys/dev/isp/isp_freebsd.h	Sat Apr 24 22:52:14 2010	(r207170)
+++ stable/8/sys/dev/isp/isp_freebsd.h	Sat Apr 24 23:05:56 2010	(r207171)
@@ -175,7 +175,7 @@ struct isp_fc {
 		simqfrozen	: 3,
 		default_id	: 8,
 		hysteresis	: 8,
-		role		: 2,
+		def_role	: 2,	/* default role */
 		gdt_running	: 1,
 		loop_dead	: 1,
 		fcbsy		: 1,
@@ -203,7 +203,7 @@ struct isp_spi {
 		tm_enabled	: 1,
 #endif
 		simqfrozen	: 3,
-		role		: 3,
+		def_role	: 2,
 		iid		: 4;
 #ifdef	ISP_TARGET_MODE
 	struct tslist lun_hash[LUN_HASH_SIZE];
@@ -469,12 +469,12 @@ default:							\
 #define	DEFAULT_EXEC_THROTTLE(isp)	isp->isp_osinfo.exec_throttle
 
 #define	GET_DEFAULT_ROLE(isp, chan)	\
-	(IS_FC(isp)? ISP_FC_PC(isp, chan)->role : ISP_SPI_PC(isp, chan)->role)
+	(IS_FC(isp)? ISP_FC_PC(isp, chan)->def_role : ISP_SPI_PC(isp, chan)->def_role)
 #define	SET_DEFAULT_ROLE(isp, chan, val)		\
 	if (IS_FC(isp)) { 				\
-		ISP_FC_PC(isp, chan)->role = val;	\
+		ISP_FC_PC(isp, chan)->def_role = val;	\
 	} else {					\
-		ISP_SPI_PC(isp, chan)->role = val;	\
+		ISP_SPI_PC(isp, chan)->def_role = val;	\
 	}
 
 #define	DEFAULT_IID(isp, chan)		isp->isp_osinfo.pc.spi[chan].iid

Modified: stable/8/sys/dev/isp/isp_pci.c
==============================================================================
--- stable/8/sys/dev/isp/isp_pci.c	Sat Apr 24 22:52:14 2010	(r207170)
+++ stable/8/sys/dev/isp/isp_pci.c	Sat Apr 24 23:05:56 2010	(r207171)
@@ -547,10 +547,10 @@ isp_get_specific_options(device_t dev, i
 	}
 
 	if (IS_SCSI(isp)) {
-		ISP_SPI_PC(isp, chan)->role = tval;
+		ISP_SPI_PC(isp, chan)->def_role = tval;
 		return;
 	}
-	ISP_FC_PC(isp, chan)->role = tval;
+	ISP_FC_PC(isp, chan)->def_role = tval;
 
 	tval = 0;
 	if (resource_int_value(device_get_name(dev), device_get_unit(dev), "fullduplex", &tval) == 0 && tval != 0) {
@@ -833,7 +833,7 @@ isp_pci_attach(device_t dev)
 	 * The 'it' suffix really only matters for SCSI cards in target mode.
 	 */
 	isp->isp_osinfo.fw = NULL;
-	if (IS_SCSI(isp) && (ISP_SPI_PC(isp, 0)->role & ISP_ROLE_TARGET)) {
+	if (IS_SCSI(isp) && (ISP_SPI_PC(isp, 0)->def_role & ISP_ROLE_TARGET)) {
 		snprintf(fwname, sizeof (fwname), "isp_%04x_it", did);
 		isp->isp_osinfo.fw = firmware_get(fwname);
 	} else if (IS_24XX(isp) && (isp->isp_nchan > 1 || isp->isp_osinfo.forcemulti)) {

Modified: stable/8/sys/dev/isp/isp_sbus.c
==============================================================================
--- stable/8/sys/dev/isp/isp_sbus.c	Sat Apr 24 22:52:14 2010	(r207170)
+++ stable/8/sys/dev/isp/isp_sbus.c	Sat Apr 24 23:05:56 2010	(r207171)
@@ -195,7 +195,7 @@ isp_sbus_attach(device_t dev)
 	isp->isp_revision = 0;	/* XXX */
 	isp->isp_dev = dev;
 	isp->isp_nchan = 1;
-	ISP_SET_PC(isp, 0, role, role);
+	ISP_SET_PC(isp, 0, def_role, role);
 
 	/*
 	 * Get the clock frequency and convert it from HZ to MHz,



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