diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2017-01-30 21:54:31 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2017-01-30 21:54:31 +0000 |
commit | c4c9f4d6979086500502cead132f24a7a2d38e06 (patch) | |
tree | fccb537a1e1479251271ef6c1296ce484aceb17f | |
parent | 6127ed20408f93f972c67ecf5f5150dd01b6d1eb (diff) |
Make urtwn(4) run slot time updates from a USB task.
Fixes 'usbd_do_request: not in process context' warnings introduced recently.
Fix reported and confirmed by Mikhail aka mp39590 aka misha
-rw-r--r-- | sys/dev/ic/rtwn.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/rtwnvar.h | 3 | ||||
-rw-r--r-- | sys/dev/usb/if_urtwn.c | 25 |
3 files changed, 27 insertions, 5 deletions
diff --git a/sys/dev/ic/rtwn.c b/sys/dev/ic/rtwn.c index 586c987e797..c9dff3f134a 100644 --- a/sys/dev/ic/rtwn.c +++ b/sys/dev/ic/rtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtwn.c,v 1.14 2017/01/30 17:48:26 stsp Exp $ */ +/* $OpenBSD: rtwn.c,v 1.15 2017/01/30 21:54:30 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -90,8 +90,6 @@ int rtwn_r88e_ra_init(struct rtwn_softc *, u_int8_t, u_int32_t, void rtwn_tsf_sync_enable(struct rtwn_softc *); void rtwn_set_led(struct rtwn_softc *, int, int); void rtwn_update_short_preamble(struct ieee80211com *); -void rtwn_updateslot(struct ieee80211com *); -void rtwn_updateedca(struct ieee80211com *); void rtwn_update_avgrssi(struct rtwn_softc *, int, int8_t); int8_t rtwn_r88e_get_rssi(struct rtwn_softc *, int, void *); void rtwn_watchdog(struct ifnet *); diff --git a/sys/dev/ic/rtwnvar.h b/sys/dev/ic/rtwnvar.h index ff52d1560ba..f7c57c68fab 100644 --- a/sys/dev/ic/rtwnvar.h +++ b/sys/dev/ic/rtwnvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rtwnvar.h,v 1.7 2016/06/17 10:53:55 stsp Exp $ */ +/* $OpenBSD: rtwnvar.h,v 1.8 2017/01/30 21:54:30 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -110,6 +110,7 @@ void rtwn_update_avgrssi(struct rtwn_softc *, int, int8_t); void rtwn_calib(struct rtwn_softc *); void rtwn_next_scan(struct rtwn_softc *); int rtwn_newstate(struct ieee80211com *, enum ieee80211_state, int); +void rtwn_updateslot(struct ieee80211com *); void rtwn_updateedca(struct ieee80211com *); int rtwn_set_key(struct ieee80211com *, struct ieee80211_node *, struct ieee80211_key *); diff --git a/sys/dev/usb/if_urtwn.c b/sys/dev/usb/if_urtwn.c index 22a537315e0..9f3cd6bfd1e 100644 --- a/sys/dev/usb/if_urtwn.c +++ b/sys/dev/usb/if_urtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtwn.c,v 1.68 2017/01/22 10:17:39 dlg Exp $ */ +/* $OpenBSD: if_urtwn.c,v 1.69 2017/01/30 21:54:30 stsp Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -326,6 +326,8 @@ void urtwn_cancel_scan(void *); int urtwn_newstate(struct ieee80211com *, enum ieee80211_state, int); void urtwn_newstate_cb(struct urtwn_softc *, void *); +void urtwn_updateslot(struct ieee80211com *); +void urtwn_updateslot_cb(struct urtwn_softc *, void *); void urtwn_updateedca(struct ieee80211com *); void urtwn_updateedca_cb(struct urtwn_softc *, void *); int urtwn_set_key(struct ieee80211com *, struct ieee80211_node *, @@ -447,6 +449,7 @@ urtwn_attach(struct device *parent, struct device *self, void *aux) ifp = &sc->sc_sc.sc_ic.ic_if; ifp->if_ioctl = urtwn_ioctl; + ic->ic_updateslot = urtwn_updateslot; ic->ic_updateedca = urtwn_updateedca; #ifdef notyet ic->ic_set_key = urtwn_set_key; @@ -932,6 +935,26 @@ urtwn_newstate_cb(struct urtwn_softc *sc, void *arg) } void +urtwn_updateslot(struct ieee80211com *ic) +{ + struct rtwn_softc *sc_sc = ic->ic_softc; + struct device *self = sc_sc->sc_pdev; + struct urtwn_softc *sc = (struct urtwn_softc *)self; + + /* Do it in a process context. */ + urtwn_do_async(sc, urtwn_updateslot_cb, NULL, 0); +} + +/* ARGSUSED */ +void +urtwn_updateslot_cb(struct urtwn_softc *sc, void *arg) +{ + struct ieee80211com *ic = &sc->sc_sc.sc_ic; + + rtwn_updateslot(ic); +} + +void urtwn_updateedca(struct ieee80211com *ic) { struct rtwn_softc *sc_sc = ic->ic_softc; |