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 Simplify RX path by using ieee80211_rx_enq...



details:   https://anonhg.NetBSD.org/src-all/rev/7cb4a247acd6
branches:  trunk
changeset: 375281:7cb4a247acd6
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Wed Sep 21 17:26:42 2022 +0200

description:
Simplify RX path by using ieee80211_rx_enqueue

diffstat:

 sys/dev/pci/if_iwm.c  |  28 +---------------------------
 sys/dev/pci/if_iwn.c  |  30 +++++-------------------------
 sys/dev/pci/if_rtwn.c |  21 +--------------------
 3 files changed, 7 insertions(+), 72 deletions(-)

diffs (172 lines):

diff -r cdb60e6f1128 -r 7cb4a247acd6 sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c      Tue Sep 20 20:53:48 2022 +0200
+++ b/sys/dev/pci/if_iwm.c      Wed Sep 21 17:26:42 2022 +0200
@@ -4025,9 +4025,6 @@ iwm_rx_rx_mpdu(struct iwm_softc *sc, str
     struct iwm_rx_data *data)
 {
        struct ieee80211com *ic = &sc->sc_ic;
-       struct ieee80211_frame *wh;
-       struct ieee80211_node *ni;
-       struct ieee80211_channel *c = NULL;
        struct mbuf *m;
        struct iwm_rx_phy_info *phy_info;
        struct iwm_rx_mpdu_res_start *rx_res;
@@ -4042,7 +4039,6 @@ iwm_rx_rx_mpdu(struct iwm_softc *sc, str
 
        phy_info = &sc->sc_last_phy_info;
        rx_res = (struct iwm_rx_mpdu_res_start *)pkt->data;
-       wh = (struct ieee80211_frame *)(pkt->data + sizeof(*rx_res));
        len = le16toh(rx_res->byte_count);
        rx_pkt_status = le32toh(*(uint32_t *)(pkt->data +
            sizeof(*rx_res) + len));
@@ -4079,9 +4075,6 @@ iwm_rx_rx_mpdu(struct iwm_softc *sc, str
                return;
        }
 
-       if (le32toh(phy_info->channel) < __arraycount(ic->ic_channels))
-               c = &ic->ic_channels[le32toh(phy_info->channel)];
-
        if (__predict_false(ic->ic_flags_ext & IEEE80211_FEXT_BPF)) {
                struct iwm_rx_radiotap_header *tap = &sc->sc_rxtap;
 
@@ -4125,26 +4118,7 @@ iwm_rx_rx_mpdu(struct iwm_softc *sc, str
                }
        }
 
-       ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh);
-       if (ni && c)
-               ni->ni_chan = c;
-
-       if (ni != NULL) {
-               if (ni->ni_vap == NULL) {
-                       ieee80211_free_node(ni);
-                       return;
-               }
-               /* push the frame up to the 802.11 stack */
-               /* NNN Convert rssi to -10 to 110 ? for 802.11 layer */
-               ieee80211_input(ni, m, rssi + 116, 0);
-
-               /* Node is no longer needed. */
-               ieee80211_free_node(ni);
-
-       } else {
-               /* Managment frame */
-               (void) ieee80211_input_all(ic, m, rssi + 116, 0);
-       }
+       ieee80211_rx_enqueue(ic, m, rssi);
 }
 
 static void
diff -r cdb60e6f1128 -r 7cb4a247acd6 sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c      Tue Sep 20 20:53:48 2022 +0200
+++ b/sys/dev/pci/if_iwn.c      Wed Sep 21 17:26:42 2022 +0200
@@ -2416,8 +2416,6 @@ iwn_rx_done(struct ieee80211vap *vap, st
        struct iwn_ops *ops = &sc->ops;
        struct ifnet *ifp = vap->iv_ifp;
        struct iwn_rx_ring *ring = &sc->rxq;
-       struct ieee80211_frame *wh;
-       struct ieee80211_node *ni;
        struct mbuf *m, *m1;
        struct iwn_rx_stat *stat;
        char    *head;
@@ -2461,7 +2459,7 @@ iwn_rx_done(struct ieee80211vap *vap, st
                return;
        }
        /* Discard frames that are too short. */
-       if (len < sizeof (*wh)) {
+       if (len < sizeof (struct ieee80211_frame)) {
                DPRINTF(("frame too short: %d\n", len));
                if_statinc(ifp, if_ierrors);
                return;
@@ -2512,10 +2510,6 @@ iwn_rx_done(struct ieee80211vap *vap, st
 
        s = splnet();
 
-       /* Grab a reference to the source node. */
-       wh = mtod(m, struct ieee80211_frame *);
-       ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh);
-
        /* XXX OpenBSD adds decryption here (see also comments in iwn_tx). */
        /* NetBSD does decryption in ieee80211_input. */
 
@@ -2566,6 +2560,9 @@ iwn_rx_done(struct ieee80211vap *vap, st
         */
        if (sc->sc_beacon_wait) {
                uint8_t type, subtype;
+               struct ieee80211_frame *wh;
+
+               wh = mtod(m, struct ieee80211_frame *);
                type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
                subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
                /*
@@ -2580,24 +2577,7 @@ iwn_rx_done(struct ieee80211vap *vap, st
                }
        }
 
-       if (ni != NULL) {
-               if (ni->ni_vap == NULL) {
-                       ieee80211_free_node(ni);
-                       splx(s);
-                       return;
-               }
-               /* push the frame up to the 802.11 stack */
-               /* NNN Convert rssi to -10 to 110 ? for 802.11 layer */
-               ieee80211_input(ni, m, rssi + 116, 0);
-
-               /* Node is no longer needed. */
-               ieee80211_free_node(ni);
-
-       } else {
-
-               /* No node found ... process differently. */
-               (void) ieee80211_input_all(ic, m, rssi + 116, 0);
-       }
+       ieee80211_rx_enqueue(ic, m, rssi);
        splx(s);
 }
 
diff -r cdb60e6f1128 -r 7cb4a247acd6 sys/dev/pci/if_rtwn.c
--- a/sys/dev/pci/if_rtwn.c     Tue Sep 20 20:53:48 2022 +0200
+++ b/sys/dev/pci/if_rtwn.c     Wed Sep 21 17:26:42 2022 +0200
@@ -1729,8 +1729,6 @@ rtwn_rx_frame(struct rtwn_softc *sc, str
     struct rtwn_rx_data *rx_data, int desc_idx)
 {
        struct ieee80211com *ic = &sc->sc_ic;
-       struct ieee80211_frame *wh;
-       struct ieee80211_node *ni;
        struct r92c_rx_phystat *phy = NULL;
        uint32_t rxdw0, rxdw3;
        struct mbuf *m, *m1;
@@ -1838,7 +1836,6 @@ rtwn_rx_frame(struct rtwn_softc *sc, str
                m_adj(m, infosz + shift);
        else
                m_adj(m, shift);
-       wh = mtod(m, struct ieee80211_frame *);
 
        if (__predict_false(ic->ic_flags_ext & IEEE80211_FEXT_BPF)) {
                struct rtwn_rx_radiotap_header *tap = &sc->sc_rxtap;
@@ -1872,23 +1869,7 @@ rtwn_rx_frame(struct rtwn_softc *sc, str
                tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags);
        }
 
-       ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh);
-       if (ni != NULL) {
-               if (ni->ni_vap == NULL) {
-                       ieee80211_free_node(ni);
-                       return;
-               }
-
-               /* push the frame up to the 802.11 stack */
-               ieee80211_input(ni, m, rssi, 0);
-
-               /* Node is no longer needed. */
-               ieee80211_free_node(ni);
-
-       } else {
-               /* Managment frame */
-               (void) ieee80211_input_all(ic, m, rssi, 0);
-       }
+       ieee80211_rx_enqueue(ic, m, rssi);
 }
 
 static int



Home | Main Index | Thread Index | Old Index