diff options
author | rwatson <rwatson@FreeBSD.org> | 2005-08-09 10:20:02 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2005-08-09 10:20:02 +0000 |
commit | 5d770a09e85126b8b3e9fe302c36350a90210cbe (patch) | |
tree | bb70e59641e2310a3c26ec449af5ab0cb7420d9d /sys/dev/ti | |
parent | 74759aaa78777146f23aa05c856f574efdfb41d9 (diff) | |
download | FreeBSD-src-5d770a09e85126b8b3e9fe302c36350a90210cbe.zip FreeBSD-src-5d770a09e85126b8b3e9fe302c36350a90210cbe.tar.gz |
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
Diffstat (limited to 'sys/dev/ti')
-rw-r--r-- | sys/dev/ti/if_ti.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index 5ce58c5..bef01ae 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -2594,7 +2594,7 @@ ti_txeof(sc) } if (cur_tx != NULL) - ifp->if_flags &= ~IFF_OACTIVE; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } static void @@ -2620,7 +2620,7 @@ ti_intr(xsc) /* Ack interrupt and stop others from occuring. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1); - if (ifp->if_flags & IFF_RUNNING) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* Check RX return ring producer/consumer */ ti_rxeof(sc); @@ -2633,7 +2633,8 @@ ti_intr(xsc) /* Re-enable interrupts. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0); - if (ifp->if_flags & IFF_RUNNING && ifp->if_snd.ifq_head != NULL) + if (ifp->if_drv_flags & IFF_DRV_RUNNING && + ifp->if_snd.ifq_head != NULL) ti_start(ifp); TI_UNLOCK(sc); @@ -2789,7 +2790,7 @@ ti_start(ifp) if ((TI_TX_RING_CNT - sc->ti_txcnt) < m_head->m_pkthdr.csum_data + 16) { IF_PREPEND(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } } @@ -2801,7 +2802,7 @@ ti_start(ifp) */ if (ti_encap(sc, m_head, &prodidx)) { IF_PREPEND(&ifp->if_snd, m_head); - ifp->if_flags |= IFF_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } @@ -2909,8 +2910,8 @@ static void ti_init2(sc) /* Enable host interrupts. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0); - ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; /* * Make sure to set media properly. We have to do this @@ -3110,12 +3111,12 @@ ti_ioctl(ifp, command, data) * waiting for it to start up, which may take a * second or two. */ - if (ifp->if_flags & IFF_RUNNING && + if (ifp->if_drv_flags & IFF_DRV_RUNNING && ifp->if_flags & IFF_PROMISC && !(sc->ti_if_flags & IFF_PROMISC)) { TI_DO_CMD(TI_CMD_SET_PROMISC_MODE, TI_CMD_CODE_PROMISC_ENB, 0); - } else if (ifp->if_flags & IFF_RUNNING && + } else if (ifp->if_drv_flags & IFF_DRV_RUNNING && !(ifp->if_flags & IFF_PROMISC) && sc->ti_if_flags & IFF_PROMISC) { TI_DO_CMD(TI_CMD_SET_PROMISC_MODE, @@ -3123,7 +3124,7 @@ ti_ioctl(ifp, command, data) } else ti_init(sc); } else { - if (ifp->if_flags & IFF_RUNNING) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { ti_stop(sc); } } @@ -3132,7 +3133,7 @@ ti_ioctl(ifp, command, data) break; case SIOCADDMULTI: case SIOCDELMULTI: - if (ifp->if_flags & IFF_RUNNING) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { ti_setmulti(sc); error = 0; } @@ -3148,7 +3149,7 @@ ti_ioctl(ifp, command, data) ifp->if_capenable &= ~IFCAP_HWCSUM; else ifp->if_capenable |= IFCAP_HWCSUM; - if (ifp->if_flags & IFF_RUNNING) + if (ifp->if_drv_flags & IFF_DRV_RUNNING) ti_init(sc); } error = 0; @@ -3529,7 +3530,7 @@ ti_stop(sc) sc->ti_tx_considx.ti_idx = 0; sc->ti_tx_saved_considx = TI_TXCONS_UNSET; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); TI_UNLOCK(sc); } |