Widen EPOCH(9) usage in PCI WLAN drivers.
Make sure all occurrences of ieee80211_input_xxx() in sys/dev are covered by a network epoch section. Do not depend on the interrupt handler nor any taskqueues being in a network epoch section. This patch should unbreak the PCI WLAN drivers after r357004. Pointy hat: glebius@ Sponsored by: Mellanox Technologies
This commit is contained in:
parent
0fc4033ca8
commit
5663f9d133
@ -1506,6 +1506,7 @@ bwi_stop_locked(struct bwi_softc *sc, int statechg)
|
||||
void
|
||||
bwi_intr(void *xsc)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct bwi_softc *sc = xsc;
|
||||
struct bwi_mac *mac;
|
||||
uint32_t intr_status;
|
||||
@ -1625,7 +1626,9 @@ bwi_intr(void *xsc)
|
||||
device_printf(sc->sc_dev, "intr noise\n");
|
||||
|
||||
if (txrx_intr_status[0] & BWI_TXRX_INTR_RX) {
|
||||
NET_EPOCH_ENTER(et);
|
||||
rx_data = sc->sc_rxeof(sc);
|
||||
NET_EPOCH_EXIT(et);
|
||||
if (sc->sc_flags & BWI_F_STOP) {
|
||||
BWI_UNLOCK(sc);
|
||||
return;
|
||||
|
@ -5072,6 +5072,7 @@ bwn_intr(void *arg)
|
||||
static void
|
||||
bwn_intrtask(void *arg, int npending)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct bwn_mac *mac = arg;
|
||||
struct bwn_softc *sc = mac->mac_sc;
|
||||
uint32_t merged = 0;
|
||||
@ -5132,6 +5133,7 @@ bwn_intrtask(void *arg, int npending)
|
||||
if (mac->mac_reason_intr & BWN_INTR_NOISESAMPLE_OK)
|
||||
bwn_intr_noise(mac);
|
||||
|
||||
NET_EPOCH_ENTER(et);
|
||||
if (mac->mac_flags & BWN_MAC_FLAG_DMA) {
|
||||
if (mac->mac_reason[0] & BWN_DMAINTR_RX_DONE) {
|
||||
bwn_dma_rx(mac->mac_method.dma.rx);
|
||||
@ -5139,6 +5141,7 @@ bwn_intrtask(void *arg, int npending)
|
||||
}
|
||||
} else
|
||||
rx = bwn_pio_rx(&mac->mac_method.pio.rx);
|
||||
NET_EPOCH_EXIT(et);
|
||||
|
||||
KASSERT(!(mac->mac_reason[1] & BWN_DMAINTR_RX_DONE), ("%s", __func__));
|
||||
KASSERT(!(mac->mac_reason[2] & BWN_DMAINTR_RX_DONE), ("%s", __func__));
|
||||
|
@ -1159,6 +1159,7 @@ static void
|
||||
ipw_rx_data_intr(struct ipw_softc *sc, struct ipw_status *status,
|
||||
struct ipw_soft_bd *sbd, struct ipw_soft_buf *sbuf)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
struct mbuf *mnew, *m;
|
||||
struct ieee80211_node *ni;
|
||||
@ -1230,11 +1231,13 @@ ipw_rx_data_intr(struct ipw_softc *sc, struct ipw_status *status,
|
||||
|
||||
IPW_UNLOCK(sc);
|
||||
ni = ieee80211_find_rxnode(ic, mtod(m, struct ieee80211_frame_min *));
|
||||
NET_EPOCH_ENTER(et);
|
||||
if (ni != NULL) {
|
||||
(void) ieee80211_input(ni, m, rssi - nf, nf);
|
||||
ieee80211_free_node(ni);
|
||||
} else
|
||||
(void) ieee80211_input_all(ic, m, rssi - nf, nf);
|
||||
NET_EPOCH_EXIT(et);
|
||||
IPW_LOCK(sc);
|
||||
|
||||
bus_dmamap_sync(sc->rbd_dmat, sc->rbd_map, BUS_DMASYNC_PREWRITE);
|
||||
|
@ -1181,6 +1181,7 @@ static void
|
||||
iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_data *data, int i,
|
||||
struct iwi_frame *frame)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
struct mbuf *mnew, *m;
|
||||
struct ieee80211_node *ni;
|
||||
@ -1270,11 +1271,13 @@ iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_data *data, int i,
|
||||
IWI_UNLOCK(sc);
|
||||
|
||||
ni = ieee80211_find_rxnode(ic, mtod(m, struct ieee80211_frame_min *));
|
||||
NET_EPOCH_ENTER(et);
|
||||
if (ni != NULL) {
|
||||
type = ieee80211_input(ni, m, rssi, nf);
|
||||
ieee80211_free_node(ni);
|
||||
} else
|
||||
type = ieee80211_input_all(ic, m, rssi, nf);
|
||||
NET_EPOCH_EXIT(et);
|
||||
|
||||
IWI_LOCK(sc);
|
||||
if (sc->sc_softled) {
|
||||
|
@ -3465,6 +3465,7 @@ static bool
|
||||
iwm_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset,
|
||||
bool stolen)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct ieee80211com *ic;
|
||||
struct ieee80211_frame *wh;
|
||||
struct ieee80211_node *ni;
|
||||
@ -3484,6 +3485,8 @@ iwm_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset,
|
||||
ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh);
|
||||
|
||||
IWM_UNLOCK(sc);
|
||||
|
||||
NET_EPOCH_ENTER(et);
|
||||
if (ni != NULL) {
|
||||
IWM_DPRINTF(sc, IWM_DEBUG_RECV, "input m %p\n", m);
|
||||
ieee80211_input_mimo(ni, m);
|
||||
@ -3492,6 +3495,8 @@ iwm_rx_mpdu(struct iwm_softc *sc, struct mbuf *m, uint32_t offset,
|
||||
IWM_DPRINTF(sc, IWM_DEBUG_RECV, "inputall m %p\n", m);
|
||||
ieee80211_input_mimo_all(ic, m);
|
||||
}
|
||||
NET_EPOCH_EXIT(et);
|
||||
|
||||
IWM_LOCK(sc);
|
||||
|
||||
return true;
|
||||
|
@ -3031,6 +3031,7 @@ static void
|
||||
iwn_rx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc,
|
||||
struct iwn_rx_data *data)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct iwn_ops *ops = &sc->ops;
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
struct iwn_rx_ring *ring = &sc->rxq;
|
||||
@ -3190,6 +3191,7 @@ iwn_rx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc,
|
||||
}
|
||||
|
||||
IWN_UNLOCK(sc);
|
||||
NET_EPOCH_ENTER(et);
|
||||
|
||||
/* Send the frame to the 802.11 layer. */
|
||||
if (ni != NULL) {
|
||||
@ -3201,6 +3203,7 @@ iwn_rx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc,
|
||||
} else
|
||||
(void)ieee80211_input_all(ic, m, rssi - nf, nf);
|
||||
|
||||
NET_EPOCH_EXIT(et);
|
||||
IWN_LOCK(sc);
|
||||
|
||||
DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
|
||||
|
@ -1939,6 +1939,7 @@ malo_set_channel(struct ieee80211com *ic)
|
||||
static void
|
||||
malo_rx_proc(void *arg, int npending)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct malo_softc *sc = arg;
|
||||
struct ieee80211com *ic = &sc->malo_ic;
|
||||
struct malo_rxbuf *bf;
|
||||
@ -2071,11 +2072,13 @@ malo_rx_proc(void *arg, int npending)
|
||||
/* dispatch */
|
||||
ni = ieee80211_find_rxnode(ic,
|
||||
(struct ieee80211_frame_min *)wh);
|
||||
NET_EPOCH_ENTER(et);
|
||||
if (ni != NULL) {
|
||||
(void) ieee80211_input(ni, m, rssi, ds->nf);
|
||||
ieee80211_free_node(ni);
|
||||
} else
|
||||
(void) ieee80211_input_all(ic, m, rssi, ds->nf);
|
||||
NET_EPOCH_EXIT(et);
|
||||
rx_next:
|
||||
/* NB: ignore ENOMEM so we process more descriptors */
|
||||
(void) malo_rxbuf_init(sc, bf);
|
||||
|
@ -2608,6 +2608,7 @@ cvtrssi(uint8_t ssi)
|
||||
static void
|
||||
mwl_rx_proc(void *arg, int npending)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct mwl_softc *sc = arg;
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
struct mwl_rxbuf *bf;
|
||||
@ -2796,6 +2797,8 @@ mwl_rx_proc(void *arg, int npending)
|
||||
/* dispatch */
|
||||
ni = ieee80211_find_rxnode(ic,
|
||||
(const struct ieee80211_frame_min *) wh);
|
||||
|
||||
NET_EPOCH_ENTER(et);
|
||||
if (ni != NULL) {
|
||||
mn = MWL_NODE(ni);
|
||||
#ifdef MWL_ANT_INFO_SUPPORT
|
||||
@ -2811,6 +2814,7 @@ mwl_rx_proc(void *arg, int npending)
|
||||
ieee80211_free_node(ni);
|
||||
} else
|
||||
(void) ieee80211_input_all(ic, m, rssi, nf);
|
||||
NET_EPOCH_EXIT(et);
|
||||
rx_next:
|
||||
/* NB: ignore ENOMEM so we process more descriptors */
|
||||
(void) mwl_rxbuf_init(sc, bf);
|
||||
|
@ -1086,6 +1086,7 @@ rt2560_prio_intr(struct rt2560_softc *sc)
|
||||
static void
|
||||
rt2560_decryption_intr(struct rt2560_softc *sc)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
struct rt2560_rx_desc *desc;
|
||||
struct rt2560_rx_data *data;
|
||||
@ -1196,12 +1197,13 @@ rt2560_decryption_intr(struct rt2560_softc *sc)
|
||||
wh = mtod(m, struct ieee80211_frame *);
|
||||
ni = ieee80211_find_rxnode(ic,
|
||||
(struct ieee80211_frame_min *)wh);
|
||||
NET_EPOCH_ENTER(et);
|
||||
if (ni != NULL) {
|
||||
(void) ieee80211_input(ni, m, rssi, nf);
|
||||
ieee80211_free_node(ni);
|
||||
} else
|
||||
(void) ieee80211_input_all(ic, m, rssi, nf);
|
||||
|
||||
NET_EPOCH_EXIT(et);
|
||||
RAL_LOCK(sc);
|
||||
sc->sc_flags &= ~RT2560_F_INPUT_RUNNING;
|
||||
skip: desc->flags = htole32(RT2560_RX_BUSY);
|
||||
|
@ -958,6 +958,7 @@ rt2661_tx_dma_intr(struct rt2661_softc *sc, struct rt2661_tx_ring *txq)
|
||||
static void
|
||||
rt2661_rx_intr(struct rt2661_softc *sc)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
struct rt2661_rx_desc *desc;
|
||||
struct rt2661_rx_data *data;
|
||||
@ -1074,11 +1075,13 @@ rt2661_rx_intr(struct rt2661_softc *sc)
|
||||
/* send the frame to the 802.11 layer */
|
||||
ni = ieee80211_find_rxnode(ic,
|
||||
(struct ieee80211_frame_min *)wh);
|
||||
NET_EPOCH_ENTER(et);
|
||||
if (ni != NULL) {
|
||||
(void) ieee80211_input(ni, m, rssi, nf);
|
||||
ieee80211_free_node(ni);
|
||||
} else
|
||||
(void) ieee80211_input_all(ic, m, rssi, nf);
|
||||
NET_EPOCH_EXIT(et);
|
||||
|
||||
RAL_LOCK(sc);
|
||||
sc->sc_flags &= ~RAL_INPUT_RUNNING;
|
||||
|
@ -1179,6 +1179,7 @@ rt2860_maxrssi_chain(struct rt2860_softc *sc, const struct rt2860_rxwi *rxwi)
|
||||
static void
|
||||
rt2860_rx_intr(struct rt2860_softc *sc)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct rt2860_rx_radiotap_header *tap;
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
struct ieee80211_frame *wh;
|
||||
@ -1326,11 +1327,13 @@ rt2860_rx_intr(struct rt2860_softc *sc)
|
||||
/* send the frame to the 802.11 layer */
|
||||
ni = ieee80211_find_rxnode(ic,
|
||||
(struct ieee80211_frame_min *)wh);
|
||||
NET_EPOCH_ENTER(et);
|
||||
if (ni != NULL) {
|
||||
(void)ieee80211_input(ni, m, rssi - nf, nf);
|
||||
ieee80211_free_node(ni);
|
||||
} else
|
||||
(void)ieee80211_input_all(ic, m, rssi - nf, nf);
|
||||
NET_EPOCH_EXIT(et);
|
||||
|
||||
RAL_LOCK(sc);
|
||||
|
||||
|
@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/taskqueue.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/endian.h>
|
||||
#include <sys/epoch.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
@ -85,6 +86,7 @@ rtwn_pci_setup_rx_desc(struct rtwn_pci_softc *pc,
|
||||
static void
|
||||
rtwn_pci_rx_frame(struct rtwn_pci_softc *pc)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct rtwn_softc *sc = &pc->pc_sc;
|
||||
struct rtwn_rx_ring *ring = &pc->rx_ring;
|
||||
struct rtwn_rx_stat_pci *rx_desc = &ring->desc[ring->cur];
|
||||
@ -164,12 +166,15 @@ rtwn_pci_rx_frame(struct rtwn_pci_softc *pc)
|
||||
|
||||
/* Send the frame to the 802.11 layer. */
|
||||
RTWN_UNLOCK(sc);
|
||||
|
||||
NET_EPOCH_ENTER(et);
|
||||
if (ni != NULL) {
|
||||
(void)ieee80211_input_mimo(ni, m);
|
||||
/* Node is no longer needed. */
|
||||
ieee80211_free_node(ni);
|
||||
} else
|
||||
(void)ieee80211_input_mimo_all(ic, m);
|
||||
NET_EPOCH_EXIT(et);
|
||||
|
||||
RTWN_LOCK(sc);
|
||||
|
||||
|
@ -1254,6 +1254,7 @@ wi_sync_bssid(struct wi_softc *sc, u_int8_t new_bssid[IEEE80211_ADDR_LEN])
|
||||
static __noinline void
|
||||
wi_rx_intr(struct wi_softc *sc)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
struct wi_frame frmhdr;
|
||||
struct mbuf *m;
|
||||
@ -1349,11 +1350,14 @@ wi_rx_intr(struct wi_softc *sc)
|
||||
WI_UNLOCK(sc);
|
||||
|
||||
ni = ieee80211_find_rxnode(ic, mtod(m, struct ieee80211_frame_min *));
|
||||
|
||||
NET_EPOCH_ENTER(et);
|
||||
if (ni != NULL) {
|
||||
(void) ieee80211_input(ni, m, rssi, nf);
|
||||
ieee80211_free_node(ni);
|
||||
} else
|
||||
(void) ieee80211_input_all(ic, m, rssi, nf);
|
||||
NET_EPOCH_EXIT(et);
|
||||
|
||||
WI_LOCK(sc);
|
||||
}
|
||||
|
@ -1909,6 +1909,7 @@ static void
|
||||
wpi_rx_done(struct wpi_softc *sc, struct wpi_rx_desc *desc,
|
||||
struct wpi_rx_data *data)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
struct wpi_rx_ring *ring = &sc->rxq;
|
||||
struct wpi_rx_stat *stat;
|
||||
@ -2028,6 +2029,7 @@ wpi_rx_done(struct wpi_softc *sc, struct wpi_rx_desc *desc,
|
||||
}
|
||||
|
||||
WPI_UNLOCK(sc);
|
||||
NET_EPOCH_ENTER(et);
|
||||
|
||||
/* Send the frame to the 802.11 layer. */
|
||||
if (ni != NULL) {
|
||||
@ -2037,6 +2039,7 @@ wpi_rx_done(struct wpi_softc *sc, struct wpi_rx_desc *desc,
|
||||
} else
|
||||
(void)ieee80211_input_all(ic, m, stat->rssi, WPI_RSSI_OFFSET);
|
||||
|
||||
NET_EPOCH_EXIT(et);
|
||||
WPI_LOCK(sc);
|
||||
|
||||
return;
|
||||
|
@ -451,6 +451,7 @@ wtap_inject(struct wtap_softc *sc, struct mbuf *m)
|
||||
void
|
||||
wtap_rx_deliver(struct wtap_softc *sc, struct mbuf *m)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
struct ieee80211_node *ni;
|
||||
int type;
|
||||
@ -472,6 +473,7 @@ wtap_rx_deliver(struct wtap_softc *sc, struct mbuf *m)
|
||||
*/
|
||||
ni = ieee80211_find_rxnode_withkey(ic,
|
||||
mtod(m, const struct ieee80211_frame_min *),IEEE80211_KEYIX_NONE);
|
||||
NET_EPOCH_ENTER(et);
|
||||
if (ni != NULL) {
|
||||
/*
|
||||
* Sending station is known, dispatch directly.
|
||||
@ -481,11 +483,13 @@ wtap_rx_deliver(struct wtap_softc *sc, struct mbuf *m)
|
||||
} else {
|
||||
type = ieee80211_input_all(ic, m, 1<<7, 10);
|
||||
}
|
||||
NET_EPOCH_EXIT(et);
|
||||
}
|
||||
|
||||
static void
|
||||
wtap_rx_proc(void *arg, int npending)
|
||||
{
|
||||
struct epoch_tracker et;
|
||||
struct wtap_softc *sc = (struct wtap_softc *)arg;
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
struct mbuf *m;
|
||||
@ -526,6 +530,7 @@ wtap_rx_proc(void *arg, int npending)
|
||||
ni = ieee80211_find_rxnode_withkey(ic,
|
||||
mtod(m, const struct ieee80211_frame_min *),
|
||||
IEEE80211_KEYIX_NONE);
|
||||
NET_EPOCH_ENTER(et);
|
||||
if (ni != NULL) {
|
||||
/*
|
||||
* Sending station is known, dispatch directly.
|
||||
@ -535,7 +540,8 @@ wtap_rx_proc(void *arg, int npending)
|
||||
} else {
|
||||
type = ieee80211_input_all(ic, m, 1<<7, 10);
|
||||
}
|
||||
|
||||
NET_EPOCH_EXIT(et);
|
||||
|
||||
/* The mbufs are freed by the Net80211 stack */
|
||||
free(bf, M_WTAP_RXBUF);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user