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/71320fdb7ede
branches:  trunk
changeset: 371707:71320fdb7ede
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 c787e8172e78 -r 71320fdb7ede 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 @@
     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 @@
 
        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 @@
                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 @@
                }
        }
 
-       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 c787e8172e78 -r 71320fdb7ede 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 @@
        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 @@
                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 @@
 
        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 @@
         */
        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 @@
                }
        }
 
-       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 c787e8172e78 -r 71320fdb7ede 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 @@
     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 @@
                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 @@
                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