Source-Changes-HG archive

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

[src-draft/trunk]: src/sys/net80211 Remove the additional queue for managemen...



details:   https://anonhg.NetBSD.org/src-all/rev/9b11435e612b
branches:  trunk
changeset: 949108:9b11435e612b
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Tue Dec 15 18:44:07 2020 +0100

description:
Remove the additional queue for management frames.

Simplify the code, and also remove all tests in drivers checking for the
VAP's state before sending packets - the stack will deal with that.

diffstat:

 sys/dev/pci/if_iwm.c         |  16 +---------------
 sys/dev/pci/if_iwn.c         |  15 ---------------
 sys/dev/pci/if_rtwn.c        |  14 +-------------
 sys/dev/usb/if_urtwn.c       |  36 +++++-------------------------------
 sys/net80211/ieee80211_var.h |   3 ---
 5 files changed, 7 insertions(+), 77 deletions(-)

diffs (230 lines):

diff -r 4a86af951c3b -r 9b11435e612b sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c      Mon Dec 14 16:39:56 2020 +0100
+++ b/sys/dev/pci/if_iwm.c      Tue Dec 15 18:44:07 2020 +0100
@@ -6861,31 +6861,19 @@
                return;
 
        for (;;) {
-               /* why isn't this done per-queue? */
                if (sc->qfullmsk != 0) {
                        sc->sc_flags |= IWM_FLAG_TX_RUNNING;
                        break;
                }
 
-               /* need to send management frames even if we're not RUNning */
-               IF_DEQUEUE(&sc->sc_ic.ic_mgtq, m);
-               if (m) {
-                       ni = M_GETCTX(m, struct ieee80211_node *);
-                       M_CLEARCTX(m);
-                       goto sendit;
-               }
-
                /* check for data frames */
-               IFQ_POLL(&sc->sc_sendq, m);
+               IFQ_DEQUEUE(&sc->sc_sendq, m);
                if (m == NULL)
                        break;
 
                ni = M_GETCTX(m, struct ieee80211_node *);
                M_CLEARCTX(m);
                vap = ni->ni_vap;
-               
-               if (vap->iv_state != IEEE80211_S_RUN)
-                       break;
 
                wh = mtod(m, struct ieee80211_frame *);
                 if (m->m_len < (int)sizeof(*wh) &&
@@ -6893,7 +6881,6 @@
                         if_statinc(vap->iv_ifp, if_oerrors);
                         continue;
                 }
-                IFQ_DEQUEUE(&sc->sc_sendq, m);
 
                 bpf_mtap(vap->iv_ifp, m, BPF_D_OUT);
 
@@ -6903,7 +6890,6 @@
                         continue;
                 }
 
- sendit:
                if (iwm_raw_xmit(ni, m, NULL) != 0) {
                        ieee80211_free_node(ni);
                        if (vap != NULL)
diff -r 4a86af951c3b -r 9b11435e612b sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c      Mon Dec 14 16:39:56 2020 +0100
+++ b/sys/dev/pci/if_iwn.c      Tue Dec 15 18:44:07 2020 +0100
@@ -3272,11 +3272,6 @@
        if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
                return 0;
 
-#if 0
-       if (vap->iv_state != IEEE80211_S_RUN)
-               return ENXIO;
-#endif
-
        if (m->m_len < sizeof (*eh) &&
            (m = m_pullup(m, sizeof (*eh))) == NULL) {
                if_statinc(ifp, if_oerrors);
@@ -3637,15 +3632,6 @@
                        ifp->if_flags |= IFF_OACTIVE;
                        break;
                }
-               /* Send pending management frames first. */
-               IF_DEQUEUE(&ic->ic_mgtq, m);
-               if (m != NULL) {
-                       ni = M_GETCTX(m, struct ieee80211_node *);
-                       ac = 0;
-                       goto sendit;
-               }
-               if (vap->iv_state != IEEE80211_S_RUN)
-                       break;
 
                /* Encapsulate and send data frames. */
                IFQ_DEQUEUE(&ifp->if_snd, m);
@@ -3686,7 +3672,6 @@
 
                if (sc->sc_beacon_wait == 0)
                        bpf_mtap(ifp, m, BPF_D_OUT);
-sendit:
                if (sc->sc_beacon_wait)
                        continue;
 
diff -r 4a86af951c3b -r 9b11435e612b sys/dev/pci/if_rtwn.c
--- a/sys/dev/pci/if_rtwn.c     Mon Dec 14 16:39:56 2020 +0100
+++ b/sys/dev/pci/if_rtwn.c     Tue Dec 15 18:44:07 2020 +0100
@@ -2162,16 +2162,9 @@
                        sc->sc_flags |= RTWN_FLAG_TX_RUNNING;
                        break;
                }
-               /* Send pending management frames first. */
-               IF_DEQUEUE(&ic->ic_mgtq, m);
-               if (m != NULL) {
-                       ni = M_GETCTX(m, struct ieee80211_node *);
-                       M_CLEARCTX(m);
-                       goto sendit;
-               }
 
                /* Encapsulate and send data frames. */
-               IFQ_POLL(&sc->sc_sendq, m);
+               IFQ_DEQUEUE(&sc->sc_sendq, m);
                if (m == NULL)
                        break;
 
@@ -2179,16 +2172,12 @@
                M_CLEARCTX(m);
                vap = ni->ni_vap;
 
-               if (vap->iv_state != IEEE80211_S_RUN)
-                       break;
-
                struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *);
                if (m->m_len < (int)sizeof(*wh) &&
                    (m = m_pullup(m, sizeof(*wh))) == NULL) {
                        ic->ic_oerrors++;
                        continue;
                }
-               IFQ_DEQUEUE(&sc->sc_sendq, m);
 
                bpf_mtap(vap->iv_ifp, m, BPF_D_OUT);
 
@@ -2197,7 +2186,6 @@
                        if_statinc(vap->iv_ifp, if_oerrors);
                        continue;
                }
-sendit:
 
                if (rtwn_raw_xmit(ni, m, NULL) != 0) {
                        ieee80211_free_node(ni);
diff -r 4a86af951c3b -r 9b11435e612b sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c    Mon Dec 14 16:39:56 2020 +0100
+++ b/sys/dev/usb/if_urtwn.c    Tue Dec 15 18:44:07 2020 +0100
@@ -3250,7 +3250,6 @@
 urtwn_start(struct urtwn_softc *sc)
 {
        struct urtwn_tx_data *data;
-       struct ieee80211com *ic = &sc->sc_ic;
        struct ether_header *eh;
        struct ieee80211_node *ni;
        struct ieee80211vap *vap = NULL;
@@ -3263,39 +3262,17 @@
 
        data = NULL;
        for (;;) {
-               /* Send pending management frames first. */
-               IF_POLL(&ic->ic_mgtq, m);
-               if (m != NULL) {
-                       /* Use AC_VO for management frames. */
-
-                       data = urtwn_get_tx_data(sc, sc->ac2idx[WME_AC_VO]);
-
-                       if (data == NULL) {
-                               sc->sc_oactive = true;
-                               DPRINTFN(DBG_TX, (
-                                   "%s: empty tx_free_list for mgmt\n",
-                                   device_xname(sc->sc_dev)));
-                               return;
-                       }
-                       IF_DEQUEUE(&ic->ic_mgtq, m);
-                       ni = M_GETCTX(m, struct ieee80211_node *);
-                       KASSERT(ni != NULL);
-                       M_CLEARCTX(m);
-                       goto sendit;
-               }
+               IFQ_DEQUEUE(&sc->sc_sendq, m);
+               if (m == NULL)
+                       break;
 
                /* Encapsulate and send data frames. */
-               IFQ_POLL(&sc->sc_sendq, m);
-               if (m == NULL)
-                       break;
-
                ni = M_GETCTX(m, struct ieee80211_node *);
                KASSERTMSG(ni != NULL, "wifi mbuf w/o node: %p", m);
                M_CLEARCTX(m);
                vap = ni->ni_vap;
-
-               if (vap->iv_state != IEEE80211_S_RUN)
-                       break;
+               KASSERTMSG(vap != NULL, "wifi mbuf w/o VAP, mbuf: %p node: %p",
+                   m, ni);
 
                struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *);
                uint8_t type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
@@ -3309,7 +3286,6 @@
                        qid = WME_AC_VO;
                }
                data = urtwn_get_tx_data(sc, sc->ac2idx[qid]);
-
                if (data == NULL) {
                        vap->iv_ifp->if_flags |= IFF_OACTIVE;
                        DPRINTFN(DBG_TX, (
@@ -3317,7 +3293,6 @@
                            device_xname(sc->sc_dev), qid));
                        return;
                }
-               IFQ_DEQUEUE(&sc->sc_sendq, m);
 
                if (m->m_len < (int)sizeof(*eh) &&
                    (m = m_pullup(m, sizeof(*eh))) == NULL) {
@@ -3327,7 +3302,6 @@
 
                bpf_mtap(vap->iv_ifp, m, BPF_D_OUT);
 
- sendit:
                if (urtwn_tx(sc, m, ni, data) != 0) {
                        m_freem(m);
                        ieee80211_free_node(ni);
diff -r 4a86af951c3b -r 9b11435e612b sys/net80211/ieee80211_var.h
--- a/sys/net80211/ieee80211_var.h      Mon Dec 14 16:39:56 2020 +0100
+++ b/sys/net80211/ieee80211_var.h      Tue Dec 15 18:44:07 2020 +0100
@@ -147,9 +147,6 @@
        int                     ic_headroom;    /* driver tx headroom needs */
        enum ieee80211_phytype  ic_phytype;     /* XXX wrong for multi-mode */
        enum ieee80211_opmode   ic_opmode;      /* operation mode */
-#if __NetBSD__
-       struct ifqueue          ic_mgtq;        /* NNN Needed? */
-#endif
        struct taskqueue        *ic_tq;         /* deferred state thread */
        struct task             ic_parent_task; /* deferred parent processing */
        struct task             ic_promisc_task;/* deferred promisc update */



Home | Main Index | Thread Index | Old Index