Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src-draft/trunk]: src/sys/dev/pci Retire IC2IFP for phil wifi one should use...



details:   https://anonhg.NetBSD.org/src-all/rev/a01d4bd1960e
branches:  trunk
changeset: 988452:a01d4bd1960e
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Sat Aug 29 03:16:20 2020 +1000

description:
Retire IC2IFP for phil wifi one should use a vap instead.

diffstat:

 sys/dev/pci/if_iwm.c |  30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diffs (121 lines):

diff -r 9a155013a4c1 -r a01d4bd1960e sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c      Sat Aug 29 03:02:57 2020 +1000
+++ b/sys/dev/pci/if_iwm.c      Sat Aug 29 03:16:20 2020 +1000
@@ -145,7 +145,6 @@
 #include <net80211/ieee80211_radiotap.h>
 
 #define DEVNAME(_s)    device_xname((_s)->sc_dev)
-#define IC2IFP(_ic_)   ((_ic_)->ic_ifp)
 
 #define le16_to_cpup(_a_) (le16toh(*(const uint16_t *)(_a_)))
 #define le32_to_cpup(_a_) (le32toh(*(const uint32_t *)(_a_)))
@@ -2891,7 +2890,7 @@
     uint8_t tid)
 {
        struct ieee80211_rx_ba *ba = &ni->ni_rx_ba[tid];
-       struct iwm_softc *sc = IC2IFP(ic)->if_softc;
+       struct iwm_softc *sc = ic->if_softc;
 
        if (sc->sc_rx_ba_sessions >= IWM_MAX_RX_BA_SESSIONS)
                return ENOSPC;
@@ -2912,7 +2911,7 @@
 iwm_ampdu_rx_stop(struct ieee80211com *ic, struct ieee80211_node *ni,
     uint8_t tid)
 {
-       struct iwm_softc *sc = IC2IFP(ic)->if_softc;
+       struct iwm_softc *sc = ic->if_softc;
 
        sc->ba_start = 0;
        sc->ba_tid = tid;
@@ -3985,12 +3984,12 @@
        return (nbant == 0) ? -127 : (total / nbant) - 107;
 }
 
-#ifdef notyet
 static void
 iwm_rx_rx_mpdu(struct iwm_softc *sc, struct iwm_rx_packet *pkt,
     struct iwm_rx_data *data)
 {
        struct ieee80211com *ic = &sc->sc_ic;
+       struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
        struct ieee80211_frame *wh;
        struct ieee80211_node *ni;
        struct ieee80211_channel *c = NULL;
@@ -4043,7 +4042,7 @@
        if (iwm_rx_addbuf(sc, IWM_RBUF_SIZE, sc->rxq.cur) != 0)
                return;
 
-       m_set_rcvif(m, IC2IFP(ic));
+       m_set_rcvif(m, vap->iv_ifp);
 
        if (le32toh(phy_info->channel) < __arraycount(ic->ic_channels))
                c = &ic->ic_channels[le32toh(phy_info->channel)];
@@ -4118,14 +4117,14 @@
        }
        splx(s);
 }
-#endif
 
 static void
 iwm_rx_tx_cmd_single(struct iwm_softc *sc, struct iwm_rx_packet *pkt,
     struct iwm_node *in)
 {
        struct ieee80211com *ic = &sc->sc_ic;
-       struct ifnet *ifp = IC2IFP(ic);
+       struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
+       struct ifnet *ifp = vap->iv_ifp;
        struct iwm_tx_resp *tx_resp = (void *)pkt->data;
        int status = le16toh(tx_resp->status.status) & IWM_TX_STATUS_MSK;
        int failack = tx_resp->failure_frame;
@@ -4150,7 +4149,8 @@
     struct iwm_rx_data *data)
 {
        struct ieee80211com *ic = &sc->sc_ic;
-       struct ifnet *ifp = IC2IFP(ic);
+       struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
+       struct ifnet *ifp = vap->iv_ifp;
        struct iwm_cmd_header *cmd_hdr = &pkt->hdr;
        int idx = cmd_hdr->idx;
        int qid = cmd_hdr->qid;
@@ -6150,7 +6150,7 @@
 {
        struct ieee80211_node *ni = &in->in_ni;
        struct ieee80211com *ic = ni->ni_ic;
-       struct iwm_softc *sc = IC2IFP(ic)->if_softc;
+       struct iwm_softc *sc = ic->if_softc;
        struct iwm_lq_cmd *lq = &in->in_lq;
        struct ieee80211_rateset *rs = &ni->ni_rates;
        int i, j, ridx, ridx_min, tab = 0;
@@ -6285,8 +6285,9 @@
 static int
 iwm_do_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
 {
-       struct ifnet *ifp = IC2IFP(ic);
-       struct iwm_softc *sc = ifp->if_softc;
+       struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
+       struct ifnet *ifp = vap->iv_ifp;
+       struct iwm_softc *sc = ic->if_softc;
        enum ieee80211_state ostate = ic->ic_state;
        struct iwm_node *in;
        int err;
@@ -6457,8 +6458,7 @@
 iwm_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
 {
        struct iwm_newstate_state *iwmns;
-       struct ifnet *ifp = IC2IFP(ic);
-       struct iwm_softc *sc = ifp->if_softc;
+       struct iwm_softc *sc = ic->if_softc;
 
        callout_stop(&sc->sc_calib_to);
 
@@ -7693,7 +7693,9 @@
 iwm_softintr(void *arg)
 {
        struct iwm_softc *sc = arg;
-       struct ifnet *ifp = IC2IFP(&sc->sc_ic);
+       struct iwm_softc *sc = ic->ic_softc;
+       struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
+       struct ifnet *ifp = vap->iv_ifp);
        uint32_t r1, r2;
        int isperiodic = 0, s;
 



Home | Main Index | Thread Index | Old Index