From 5d770a09e85126b8b3e9fe302c36350a90210cbe Mon Sep 17 00:00:00 2001 From: rwatson Date: Tue, 9 Aug 2005 10:20:02 +0000 Subject: Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field. Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so. Reviewed by: pjd, bz MFC after: 7 days --- sys/pci/if_xl.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'sys/pci/if_xl.c') diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c index 72c8ce0..78d100d 100644 --- a/sys/pci/if_xl.c +++ b/sys/pci/if_xl.c @@ -2159,7 +2159,7 @@ xl_txeof(struct xl_softc *sc) } if (sc->xl_cdata.xl_tx_head == NULL) { - ifp->if_flags &= ~IFF_OACTIVE; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; sc->xl_cdata.xl_tx_tail = NULL; } else { if (CSR_READ_4(sc, XL_DMACTL) & XL_DMACTL_DOWN_STALLED || @@ -2209,7 +2209,7 @@ xl_txeof_90xB(struct xl_softc *sc) sc->xl_cdata.xl_tx_cons = idx; if (cur_tx != NULL) - ifp->if_flags &= ~IFF_OACTIVE; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } /* @@ -2611,7 +2611,7 @@ xl_start_locked(struct ifnet *ifp) xl_txeoc(sc); xl_txeof(sc); if (sc->xl_cdata.xl_tx_free == NULL) { - ifp->if_flags |= IFF_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; return; } } @@ -2729,7 +2729,7 @@ xl_start_90xB_locked(struct ifnet *ifp) XL_LOCK_ASSERT(sc); - if (ifp->if_flags & IFF_OACTIVE) + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) return; idx = sc->xl_cdata.xl_tx_prod; @@ -2738,7 +2738,7 @@ xl_start_90xB_locked(struct ifnet *ifp) while (sc->xl_cdata.xl_tx_chain[idx].xl_mbuf == NULL) { if ((XL_TX_LIST_CNT - sc->xl_cdata.xl_tx_cnt) < 3) { - ifp->if_flags |= IFF_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } @@ -3029,8 +3029,8 @@ xl_init_locked(struct xl_softc *sc) /* Select window 7 for normal operations. */ XL_SEL_WIN(7); - ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; sc->xl_stat_ch = timeout(xl_stats_update, sc, hz); } @@ -3166,14 +3166,14 @@ xl_ioctl(struct ifnet *ifp, u_long command, caddr_t data) XL_SEL_WIN(5); rxfilt = CSR_READ_1(sc, XL_W5_RX_FILTER); if (ifp->if_flags & IFF_UP) { - if (ifp->if_flags & IFF_RUNNING && + if (ifp->if_drv_flags & IFF_DRV_RUNNING && ifp->if_flags & IFF_PROMISC && !(sc->xl_if_flags & IFF_PROMISC)) { rxfilt |= XL_RXFILTER_ALLFRAMES; CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt); XL_SEL_WIN(7); - } else if (ifp->if_flags & IFF_RUNNING && + } else if (ifp->if_drv_flags & IFF_DRV_RUNNING && !(ifp->if_flags & IFF_PROMISC) && sc->xl_if_flags & IFF_PROMISC) { rxfilt &= ~XL_RXFILTER_ALLFRAMES; @@ -3181,11 +3181,11 @@ xl_ioctl(struct ifnet *ifp, u_long command, caddr_t data) XL_CMD_RX_SET_FILT|rxfilt); XL_SEL_WIN(7); } else { - if ((ifp->if_flags & IFF_RUNNING) == 0) + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) xl_init_locked(sc); } } else { - if (ifp->if_flags & IFF_RUNNING) + if (ifp->if_drv_flags & IFF_DRV_RUNNING) xl_stop(sc); } sc->xl_if_flags = ifp->if_flags; @@ -3344,7 +3344,7 @@ xl_stop(struct xl_softc *sc) if (sc->xl_ldata.xl_tx_list != NULL) bzero(sc->xl_ldata.xl_tx_list, XL_TX_LIST_SZ); - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); } /* -- cgit v1.1