Module Name: src
Committed By: christos
Date: Fri Feb 1 03:20:36 UTC 2019
Modified Files:
src/sys/dev/usb: if_urtwn.c if_urtwnvar.h
Log Message:
Add a software beacon.
XXX: As all the other usb software beacons this is driven at fixed intervals
when usb task fires.
To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/usb/if_urtwnvar.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.67 src/sys/dev/usb/if_urtwn.c:1.68
--- src/sys/dev/usb/if_urtwn.c:1.67 Thu Dec 20 10:16:07 2018
+++ src/sys/dev/usb/if_urtwn.c Thu Jan 31 22:20:35 2019
@@ -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 @@ urtwn_free_tx_list(struct urtwn_softc *s
}
}
+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();
Index: src/sys/dev/usb/if_urtwnvar.h
diff -u src/sys/dev/usb/if_urtwnvar.h:1.11 src/sys/dev/usb/if_urtwnvar.h:1.12
--- src/sys/dev/usb/if_urtwnvar.h:1.11 Fri Jun 29 00:02:10 2018
+++ src/sys/dev/usb/if_urtwnvar.h Thu Jan 31 22:20:35 2019
@@ -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 @@ struct urtwn_softc {
#define sc_txtap sc_txtapu.th
int sc_txtap_len;
bool sc_running;
+
+ struct ieee80211_beacon_offsets sc_bo;
};
#endif /* _IF_URTWNVAR_H_ */