Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Aug 2005 12:18:46 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 81593 for review
Message-ID:  <200508071218.j77CIkiU080830@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=81593

Change 81593 by rwatson@rwatson_peppercorn on 2005/08/07 12:18:17

	A variety of fix-ups, especially relating to #ifdef __FreeBSD__,
	and some other incorrectities.
	
	Submitted by:	bz

Affected files ...

.. //depot/projects/netsmp/src/sys/dev/bge/if_bge.c#5 edit
.. //depot/projects/netsmp/src/sys/dev/cnw/if_cnw.c#3 edit
.. //depot/projects/netsmp/src/sys/dev/firewire/if_fwe.c#3 edit
.. //depot/projects/netsmp/src/sys/dev/firewire/if_fwip.c#3 edit
.. //depot/projects/netsmp/src/sys/dev/gem/if_gem.c#6 edit
.. //depot/projects/netsmp/src/sys/dev/lge/if_lge.c#5 edit
.. //depot/projects/netsmp/src/sys/dev/lnc/if_lnc.c#5 edit
.. //depot/projects/netsmp/src/sys/dev/usb/if_udav.c#5 edit

Differences ...

==== //depot/projects/netsmp/src/sys/dev/bge/if_bge.c#5 (text+ko) ====

@@ -3594,7 +3594,7 @@
 				bge_stop(sc);
 			}
 		}
-		sc->bge_if_flags = ifp->if_flags | ifp->if_drv_flags;
+		sc->bge_if_flags = ifp->if_flags;
 		BGE_UNLOCK(sc);
 		error = 0;
 		break;

==== //depot/projects/netsmp/src/sys/dev/cnw/if_cnw.c#3 (text+ko) ====

@@ -571,7 +571,7 @@
 {
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 
-	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+	if ((ifp->if_flags & IFF_RUNNING) != 0)
 		return (0);
 
 	sc->sc_ih = pcmcia_intr_establish(sc->sc_pf, IPL_NET, cnw_intr, sc);
@@ -586,8 +586,8 @@
 	}
 	sc->sc_resource |= CNW_RES_PCIC;
 	cnw_init(sc);
-	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-	ifp->if_drv_flags |= IFF_DRV_RUNNING;
+	ifp->if_flags &= ~IFF_OACTIVE;
+	ifp->if_flags |= IFF_RUNNING;
 	return (0);
 }
 
@@ -601,13 +601,13 @@
 {
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 
-	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
 		return;
 
 	pcmcia_function_disable(sc->sc_pf);
 	sc->sc_resource &= ~CNW_RES_PCIC;
 	pcmcia_intr_disestablish(sc->sc_pf, sc->sc_ih);
-	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+	ifp->if_flags &= ~IFF_RUNNING;
 	ifp->if_timer = 0;
 }
 
@@ -773,16 +773,22 @@
 #ifdef CNW_DEBUG
 	if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG)
 		printf("%s: cnw_start\n", ifp->if_xname);
+#if defined(__FreeBSD__)
 	if (ifp->if_drv_flags & IFF_DRV_OACTIVE)
+#else
+	if (ifp->if_flags & IFF_OACTIVE)
+#endif
 		printf("%s: cnw_start reentered\n", ifp->if_xname);
 #endif
 
 #if defined(__FreeBSD__)
 	if (sc->cnw_gone)
 		return;
-#endif
 
 	ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+#else
+	ifp->if_flags |= IFF_OACTIVE;
+#endif
 
 	for (;;) {
 #ifdef ONE_AT_A_TIME
@@ -863,7 +869,11 @@
 		sc->sc_active = 1;
 	}
 
+#if defined(__FreeBSD__)
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+#else
+	ifp->if_flags &= ~IFF_OACTIVE;
+#endif
 }
 
 /*
@@ -1082,7 +1092,7 @@
 
 
 #if !defined(__FreeBSD__)
-	if ((sc->sc_ethercom.ec_if.if_drv_flags & IFF_DRV_RUNNING) == 0 ||
+	if ((sc->sc_ethercom.ec_if.if_flags & IFF_RUNNING) == 0 ||
 	    (sc->sc_dev.dv_flags & DVF_ACTIVE) == 0)
 		return (0);
 #else
@@ -1201,7 +1211,11 @@
 			}
 
 			sc->sc_active = 0;
+#if defined(__FreeBSD__)
 			ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+#else
+			ifp->if_flags &= ~IFF_OACTIVE;
+#endif
 
 			/* Continue to send packets from the queue */
 #if !defined(__FreeBSD__)
@@ -1249,7 +1263,7 @@
 
 	case SIOCSIFADDR:
 #if !defined(__FreeBSD__)
-		if (!(ifp->if_drv_flags & IFF_DRV_RUNNING) &&
+		if (!(ifp->if_flags & IFF_RUNNING) &&
 		    (error = cnw_enable(sc)) != 0)
 			break;
 		ifp->if_flags |= IFF_UP;
@@ -1271,14 +1285,13 @@
 
 	case SIOCSIFFLAGS:
 #if !defined(__FreeBSD__)
-		if (!(ifp->if_flags & IFF_UP) && (ifp->if_drv_flags & IFF_DRV_RUNNIG)) {
+		if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == IFF_RUNNING) {
 			/*
 			 * The interface is marked down and it is running, so
 			 * stop it.
 			 */
 			cnw_disable(sc);
-		} else if ((ifp->if_flags & IFF_UP) &&
-		    !(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+		} else if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == IFF_UP){
 			/*
 			 * The interface is marked up and it is stopped, so
 			 * start it.
@@ -1353,7 +1366,11 @@
 #endif
 		if (error)
 			break;
+#if !defined(__FreeBSD__)
+		if ((ifp->if_flags & IFF_RUNNING) == 0)
+#else
 		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+#endif
 			break;
 		bus_space_read_region_1(sc->sc_memt, sc->sc_memh,
 		    sc->sc_memoff + CNW_EREG_CB,

==== //depot/projects/netsmp/src/sys/dev/firewire/if_fwe.c#3 (text+ko) ====

@@ -289,7 +289,11 @@
 		fwe->dma_ch = -1;
 	}
 
+#if defined(__FreeBSD__)
 	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+#else
+	ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+#endif
 }
 
 static int
@@ -404,8 +408,13 @@
 	if ((xferq->flag & FWXFERQ_RUNNING) == 0)
 		fc->irx_enable(fc, fwe->dma_ch);
 
+#if defined(__FreeBSD__)
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+#else
+	ifp->if_flags |= IFF_RUNNING;
+	ifp->if_flags &= ~IFF_OACTIVE;
+#endif
 
 	FWE_POLL_REGISTER(fwe_poll, fwe, ifp);
 #if 0
@@ -426,10 +435,18 @@
 		case SIOCSIFFLAGS:
 			s = splimp();
 			if (ifp->if_flags & IFF_UP) {
+#if defined(__FreeBSD__)
 				if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+#else
+				if (!(ifp->if_flags & IFF_RUNNING))
+#endif
 					fwe_init(&fwe->eth_softc);
 			} else {
+#if defined(__FreeBSD__)
 				if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+#else
+				if (ifp->if_flags & IFF_RUNNING)
+#endif
 					fwe_stop(fwe);
 			}
 			/* XXX keep promiscoud mode */
@@ -525,12 +542,20 @@
 	}
 
 	s = splimp();
+#if defined(__FreeBSD__)
 	ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+#else
+	ifp->if_flags |= IFF_OACTIVE;
+#endif
 
 	if (ifp->if_snd.ifq_len != 0)
 		fwe_as_output(fwe, ifp);
 
+#if defined(__FreeBSD__)
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+#else
+	ifp->if_flags &= ~IFF_OACTIVE;
+#endif
 	splx(s);
 }
 

==== //depot/projects/netsmp/src/sys/dev/firewire/if_fwip.c#3 (text+ko) ====

@@ -269,7 +269,11 @@
 		fwip->dma_ch = -1;
 	}
 
+#if defined(__FreeBSD__)
 	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+#else
+	ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+#endif
 }
 
 static int
@@ -397,8 +401,13 @@
 	if ((xferq->flag & FWXFERQ_RUNNING) == 0)
 		fc->irx_enable(fc, fwip->dma_ch);
 
+#if defined(__FreeBSD__)
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+#else
+	ifp->if_flags |= IFF_RUNNING;
+	ifp->if_flags &= ~IFF_OACTIVE;
+#endif
 
 	FWIP_POLL_REGISTER(fwip_poll, fwip, ifp);
 #if 0
@@ -417,10 +426,18 @@
 	case SIOCSIFFLAGS:
 		s = splimp();
 		if (ifp->if_flags & IFF_UP) {
+#if defined(__FreeBSD__)
 			if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+#else
+			if (!(ifp->if_flags & IFF_RUNNING))
+#endif
 				fwip_init(&fwip->fw_softc);
 		} else {
+#if defined(__FreeBSD__)
 			if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+#else
+			if (ifp->if_flags & IFF_RUNNING)
+#endif
 				fwip_stop(fwip);
 		}
 		splx(s);
@@ -536,12 +553,20 @@
 	}
 
 	s = splimp();
+#if defined(__FreeBSD__)
 	ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+#else
+	ifp->if_flags |= IFF_OACTIVE;
+#endif
 
 	if (ifp->if_snd.ifq_len != 0)
 		fwip_async_output(fwip, ifp);
 
+#if defined(__FreeBSD__)
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+#else
+	ifp->if_flags &= ~IFF_OACTIVE;
+#endif
 	splx(s);
 }
 

==== //depot/projects/netsmp/src/sys/dev/gem/if_gem.c#6 (text+ko) ====

@@ -975,7 +975,7 @@
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 	ifp->if_timer = 0;
-	sc->sc_ifflags = ifp->if_flags | ifp->if_drv_flags;
+	sc->sc_ifflags = ifp->if_flags;
 }
 
 static int
@@ -1877,7 +1877,7 @@
 			if (ifp->if_drv_flags & IFF_DRV_RUNNING)
 				gem_stop(ifp, 0);
 		}
-		sc->sc_ifflags = ifp->if_flags | ifp->if_drv_flags;
+		sc->sc_ifflags = ifp->if_flags;
 		error = 0;
 		break;
 	case SIOCADDMULTI:

==== //depot/projects/netsmp/src/sys/dev/lge/if_lge.c#5 (text+ko) ====

@@ -1460,7 +1460,7 @@
 			if (ifp->if_drv_flags & IFF_DRV_RUNNING)
 				lge_stop(sc);
 		}
-		sc->lge_if_flags = ifp->if_flags | ifp->if_drv_flags;
+		sc->lge_if_flags = ifp->if_flags;
 		error = 0;
 		break;
 	case SIOCADDMULTI:

==== //depot/projects/netsmp/src/sys/dev/lnc/if_lnc.c#5 (text+ko) ====

@@ -1213,9 +1213,9 @@
 }
 
 /*
- * IFF_DRV_OACTIVE and IFF_DRV_RUNNING are checked in ether_output so it's redundant
- * to check them again since we wouldn't have got here if they were not
- * appropriately set. This is also called from lnc_init and lncintr but the
+ * IFF_DRV_OACTIVE and IFF_DRV_RUNNING are checked in ether_output so it's
+ * redundant to check them again since we wouldn't have got here if they were
+ * not appropriately set. This is also called from lnc_init and lncintr but the
  * flags should be ok at those points too.
  */
 

==== //depot/projects/netsmp/src/sys/dev/usb/if_udav.c#5 (text+ko) ====

@@ -519,7 +519,11 @@
 		/* Wait for processes to go away */
 		usb_detach_wait(USBDEV(sc->sc_dev));
 	}
+#if defined(__FreeBSD__)
 	if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+#else
+	if (ifp->if_flags & IFF_RUNNING)
+#endif
 		udav_stop(GET_IFP(sc), 1);
 
 #if NRND > 0
@@ -913,8 +917,13 @@
 		}
 	}
 
+#if defined(__FreeBSD__)
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+#else
+	ifp->if_flags |= IFF_RUNNING;
+	ifp->if_flags &= ~IFF_OACTIVE;
+#endif
 
 #if defined(__NetBSD__)
 	splx(s);
@@ -1151,7 +1160,11 @@
 	if (!sc->sc_link)
 		return;
 
+#if defined(__FreeBSD__)
 	if (ifp->if_drv_flags & IFF_DRV_OACTIVE)
+#else
+	if (ifp->if_flags & IFF_OACTIVE)
+#endif
 		return;
 #if defined(__NetBSD__)
 	IFQ_POLL(&ifp->if_snd, m_head);
@@ -1164,8 +1177,10 @@
 	if (udav_send(sc, m_head, 0)) {
 #if defined(__FreeBSD__)
 		IF_PREPEND(&ifp->if_snd, m_head);
+		ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+#else
+		ifp->if_flags |= IFF_OACTIVE;
 #endif
-		ifp->if_drv_flags |= IFF_DRV_OACTIVE;
 		return;
 	}
 
@@ -1177,7 +1192,11 @@
 	BPF_MTAP(ifp, m_head);
 #endif
 
+#if defined(__FreeBSD__)
 	ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+#else
+	ifp->if_flags |= IFF_OACTIVE;
+#endif
 
 	/* Set a timeout in case the chip goes out to lunch. */
 	ifp->if_timer = 5;
@@ -1257,7 +1276,11 @@
 	DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__));
 
 	ifp->if_timer = 0;
+#if defined(__FreeBSD__)
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+#else
+	ifp->if_flags &= ~IFF_OACTIVE;
+#endif
 
 	if (status != USBD_NORMAL_COMPLETION) {
 		if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) {
@@ -1617,7 +1640,11 @@
 	usb_ether_tx_list_free(&sc->sc_cdata);
 
 	sc->sc_link = 0;
+#if defined(__FreeBSD__)
 	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+#else
+	ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+#endif
 }
 
 /* Set media options */
@@ -1655,7 +1682,11 @@
 	if (sc->sc_dying)
 		return;
 
+#if defined(__FreeBSD__)
 	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
+#else
+	if ((ifp->if_flags & IFF_RUNNING) == 0) {
+#endif
 		ifmr->ifm_active = IFM_ETHER | IFM_NONE;
 		ifmr->ifm_status = 0;
 		return;



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