Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Add a software beacon.



details:   https://anonhg.NetBSD.org/src/rev/86708e4be9e1
branches:  trunk
changeset: 448383:86708e4be9e1
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Feb 01 03:20:35 2019 +0000

description:
Add a software beacon.
XXX: As all the other usb software beacons this is driven at fixed intervals
when usb task fires.

diffstat:

 sys/dev/usb/if_urtwn.c    |  33 +++++++++++++++++++++++++++++++--
 sys/dev/usb/if_urtwnvar.h |   4 +++-
 2 files changed, 34 insertions(+), 3 deletions(-)

diffs (81 lines):

diff -r 6c211ff921d9 -r 86708e4be9e1 sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c    Thu Jan 31 22:07:46 2019 +0000
+++ b/sys/dev/usb/if_urtwn.c    Fri Feb 01 03:20:35 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_urtwn.c,v 1.67 2018/12/20 15:16:07 tih Exp $        */
+/*     $NetBSD: if_urtwn.c,v 1.68 2019/02/01 03:20:35 christos Exp $   */
 /*     $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $       */
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.67 2018/12/20 15:16:07 tih Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.68 2019/02/01 03:20:35 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -813,15 +813,44 @@
        }
 }
 
+static int
+urtwn_tx_beacon(struct urtwn_softc *sc, struct mbuf *m,
+    struct ieee80211_node *ni)
+{
+       struct urtwn_tx_data *data =
+           urtwn_get_tx_data(sc, sc->ac2idx[WME_AC_VO]);
+       return urtwn_tx(sc, m, ni, data);
+}
+
 static void
 urtwn_task(void *arg)
 {
        struct urtwn_softc *sc = arg;
+       struct ieee80211com *ic = &sc->sc_ic;
        struct urtwn_host_cmd_ring *ring = &sc->cmdq;
        struct urtwn_host_cmd *cmd;
        int s;
 
        DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+       if (ic->ic_state == IEEE80211_S_RUN && 
+           (ic->ic_opmode == IEEE80211_M_HOSTAP ||
+           ic->ic_opmode == IEEE80211_M_IBSS)) {
+
+               struct mbuf *m = ieee80211_beacon_alloc(ic, ic->ic_bss,
+                   &sc->sc_bo);
+               if (m == NULL) {
+                       aprint_error_dev(sc->sc_dev,
+                           "could not allocate beacon");
+               }
+
+               if (urtwn_tx_beacon(sc, m, ic->ic_bss) != 0) {
+                       m_freem(m);
+                       aprint_error_dev(sc->sc_dev, "could not send beacon");
+               }
+
+               /* beacon is no longer needed */
+               m_freem(m);
+       }
 
        /* Process host commands. */
        s = splusb();
diff -r 6c211ff921d9 -r 86708e4be9e1 sys/dev/usb/if_urtwnvar.h
--- a/sys/dev/usb/if_urtwnvar.h Thu Jan 31 22:07:46 2019 +0000
+++ b/sys/dev/usb/if_urtwnvar.h Fri Feb 01 03:20:35 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_urtwnvar.h,v 1.11 2018/06/29 04:02:10 thorpej Exp $ */
+/*     $NetBSD: if_urtwnvar.h,v 1.12 2019/02/01 03:20:35 christos Exp $        */
 /*     $OpenBSD: if_urtwnreg.h,v 1.3 2010/11/16 18:02:59 damien Exp $  */
 
 /*-
@@ -196,6 +196,8 @@
 #define sc_txtap       sc_txtapu.th
        int                             sc_txtap_len;
        bool                            sc_running;
+
+       struct ieee80211_beacon_offsets sc_bo;
 };
 
 #endif /* _IF_URTWNVAR_H_ */



Home | Main Index | Thread Index | Old Index