From e6feb66fafc44db45fdddc09f7bb1c6c1cc3424b Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Mon, 25 May 2015 15:09:17 +0000 Subject: [PATCH] Store softc in ic_softc and access it without using struct ifnet. Sponsored by: Netflix Sponsored by: Nginx, Inc. --- sys/dev/iwn/if_iwn.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c index 3bb2e399d19f..0c93d4144870 100644 --- a/sys/dev/iwn/if_iwn.c +++ b/sys/dev/iwn/if_iwn.c @@ -556,6 +556,7 @@ iwn_attach(device_t dev) ic = ifp->if_l2com; ic->ic_ifp = ifp; + ic->ic_softc = sc; ic->ic_name = device_get_nameunit(dev); ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */ @@ -1316,10 +1317,10 @@ iwn_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t mac[IEEE80211_ADDR_LEN]) { + struct iwn_softc *sc = ic->ic_softc; struct iwn_vap *ivp; struct ieee80211vap *vap; uint8_t mac1[IEEE80211_ADDR_LEN]; - struct iwn_softc *sc = ic->ic_ifp->if_softc; if (!TAILQ_EMPTY(&ic->ic_vaps)) /* only one at a time */ return NULL; @@ -2526,7 +2527,7 @@ static int iwn_setregdomain(struct ieee80211com *ic, struct ieee80211_regdomain *rd, int nchan, struct ieee80211_channel chans[]) { - struct iwn_softc *sc = ic->ic_ifp->if_softc; + struct iwn_softc *sc = ic->ic_softc; int i; for (i = 0; i < nchan; i++) { @@ -2798,7 +2799,7 @@ iwn_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) { struct iwn_vap *ivp = IWN_VAP(vap); struct ieee80211com *ic = vap->iv_ic; - struct iwn_softc *sc = ic->ic_ifp->if_softc; + struct iwn_softc *sc = ic->ic_softc; int error = 0; DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__); @@ -5248,7 +5249,7 @@ static int iwn_updateedca(struct ieee80211com *ic) { #define IWN_EXP2(x) ((1 << (x)) - 1) /* CWmin = 2^ECWmin - 1 */ - struct iwn_softc *sc = ic->ic_ifp->if_softc; + struct iwn_softc *sc = ic->ic_softc; struct iwn_edca_params cmd; int aci; @@ -7082,7 +7083,7 @@ iwn_ampdu_rx_start(struct ieee80211_node *ni, struct ieee80211_rx_ampdu *rap, int baparamset, int batimeout, int baseqctl) { #define MS(_v, _f) (((_v) & _f) >> _f##_S) - struct iwn_softc *sc = ni->ni_ic->ic_ifp->if_softc; + struct iwn_softc *sc = ni->ni_ic->ic_softc; struct iwn_ops *ops = &sc->ops; struct iwn_node *wn = (void *)ni; struct iwn_node_info node; @@ -7118,7 +7119,7 @@ static void iwn_ampdu_rx_stop(struct ieee80211_node *ni, struct ieee80211_rx_ampdu *rap) { struct ieee80211com *ic = ni->ni_ic; - struct iwn_softc *sc = ic->ic_ifp->if_softc; + struct iwn_softc *sc = ic->ic_softc; struct iwn_ops *ops = &sc->ops; struct iwn_node *wn = (void *)ni; struct iwn_node_info node; @@ -7146,7 +7147,7 @@ static int iwn_addba_request(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap, int dialogtoken, int baparamset, int batimeout) { - struct iwn_softc *sc = ni->ni_ic->ic_ifp->if_softc; + struct iwn_softc *sc = ni->ni_ic->ic_softc; int qid; DPRINTF(sc, IWN_DEBUG_TRACE, "->Doing %s\n", __func__); @@ -7176,7 +7177,7 @@ static int iwn_addba_response(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap, int code, int baparamset, int batimeout) { - struct iwn_softc *sc = ni->ni_ic->ic_ifp->if_softc; + struct iwn_softc *sc = ni->ni_ic->ic_softc; int qid = *(int *)tap->txa_private; uint8_t tid = tap->txa_tid; int ret; @@ -7205,7 +7206,7 @@ iwn_ampdu_tx_start(struct ieee80211com *ic, struct ieee80211_node *ni, uint8_t tid) { struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[tid]; - struct iwn_softc *sc = ni->ni_ic->ic_ifp->if_softc; + struct iwn_softc *sc = ni->ni_ic->ic_softc; struct iwn_ops *ops = &sc->ops; struct iwn_node *wn = (void *)ni; struct iwn_node_info node; @@ -7239,7 +7240,7 @@ iwn_ampdu_tx_start(struct ieee80211com *ic, struct ieee80211_node *ni, static void iwn_ampdu_tx_stop(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap) { - struct iwn_softc *sc = ni->ni_ic->ic_ifp->if_softc; + struct iwn_softc *sc = ni->ni_ic->ic_softc; struct iwn_ops *ops = &sc->ops; uint8_t tid = tap->txa_tid; int qid; @@ -8774,8 +8775,8 @@ static void iwn_scan_curchan(struct ieee80211_scan_state *ss, unsigned long maxdwell) { struct ieee80211vap *vap = ss->ss_vap; - struct iwn_softc *sc = vap->iv_ic->ic_ifp->if_softc; struct ieee80211com *ic = vap->iv_ic; + struct iwn_softc *sc = ic->ic_softc; int error; IWN_LOCK(sc);