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/8e9084eb593f
branches:  trunk
changeset: 367215:8e9084eb593f
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 3bf239aa58b7 -r 8e9084eb593f 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
@@ -668,35 +668,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