Source-Changes-HG archive

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

[src-draft/trunk]: src/sys/dev/usb Fix the old style beacon handling to avoid...



details:   https://anonhg.NetBSD.org/src-all/rev/6d06f009b523
branches:  trunk
changeset: 370550:6d06f009b523
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Sun Feb 20 15:39:53 2022 +0100

description:
Fix the old style beacon handling to avoid crashes at least.
Will be replaced with something less expensive soon.

diffstat:

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

diffs (53 lines):

diff -r c8c80ebddb63 -r 6d06f009b523 sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c    Sun Feb 20 11:17:30 2022 +0100
+++ b/sys/dev/usb/if_urtwn.c    Sun Feb 20 15:39:53 2022 +0100
@@ -669,35 +669,33 @@
 {
        struct urtwn_softc *sc = arg;
        struct ieee80211com *ic = usbwifi_ic(&sc->sc_uw);
-       struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
-/* XXX VAP is wrong */
+       struct ieee80211vap *vap;
        struct urtwn_host_cmd_ring *ring = &sc->cmdq;
        struct urtwn_host_cmd *cmd;
        int s;
 
        URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
-       if (vap->iv_state == IEEE80211_S_RUN && 
-           (ic->ic_opmode == IEEE80211_M_HOSTAP ||
-           ic->ic_opmode == IEEE80211_M_IBSS)) {
+       usbwifi_lock_ic(&sc->sc_uw);
+       /* handling beacon frames here is way too expensive! */
+       TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
+               if (vap->iv_state != IEEE80211_S_RUN ||
+                   (vap->iv_opmode != IEEE80211_M_HOSTAP &&
+                   vap->iv_opmode != IEEE80211_M_IBSS &&
+                   vap->iv_opmode != IEEE80211_M_MBSS))
+                       continue;
+
+               /* Send a beacon frame. */
                struct mbuf *m = ieee80211_beacon_alloc(vap->iv_bss);
                if (m == NULL) {
                        aprint_error_dev(sc->sc_uw.uw_dev,
                            "could not allocate beacon");
                }
-
-               /*
-                * Send a beacon frame.
-                * XXX - old code used to bypass all queueing - is that
-                * needed here?
-                * XXX - can we get rid of the whole urtwn_task?
-                */
                if (ic->ic_raw_xmit(vap->iv_bss, m, NULL) != 0)
-                       aprint_error_dev(sc->sc_uw.uw_dev, "could not send beacon\n");
-
-               /* beacon is no longer needed */
-               m_freem(m);
+                       aprint_error_dev(sc->sc_uw.uw_dev,
+                           "could not send beacon\n");
        }
+       usbwifi_unlock_ic(&sc->sc_uw);
 
        /* Process host commands. */
        s = splusb();



Home | Main Index | Thread Index | Old Index