Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Apr 2009 05:37:31 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r191195 - in user/thompsa/vaptq/sys: dev/ipw dev/iwn dev/wi dev/wpi net80211
Message-ID:  <200904170537.n3H5bVcI012340@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: thompsa
Date: Fri Apr 17 05:37:31 2009
New Revision: 191195
URL: http://svn.freebsd.org/changeset/base/191195

Log:
  Move beacon miss handling into the vap taskq so that it is safe to call from
  any context.

Modified:
  user/thompsa/vaptq/sys/dev/ipw/if_ipw.c
  user/thompsa/vaptq/sys/dev/iwn/if_iwn.c
  user/thompsa/vaptq/sys/dev/wi/if_wi.c
  user/thompsa/vaptq/sys/dev/wpi/if_wpi.c
  user/thompsa/vaptq/sys/net80211/ieee80211_proto.c

Modified: user/thompsa/vaptq/sys/dev/ipw/if_ipw.c
==============================================================================
--- user/thompsa/vaptq/sys/dev/ipw/if_ipw.c	Fri Apr 17 04:23:11 2009	(r191194)
+++ user/thompsa/vaptq/sys/dev/ipw/if_ipw.c	Fri Apr 17 05:37:31 2009	(r191195)
@@ -120,7 +120,6 @@ static uint16_t	ipw_read_prom_word(struc
 static void	ipw_rx_cmd_intr(struct ipw_softc *, struct ipw_soft_buf *);
 static void	ipw_assocsuccess(void *, int);
 static void	ipw_assocfailed(void *, int);
-static void	ipw_bmiss(void *, int);
 static void	ipw_rx_newstate_intr(struct ipw_softc *, struct ipw_soft_buf *);
 static void	ipw_rx_data_intr(struct ipw_softc *, struct ipw_status *,
 		    struct ipw_soft_bd *, struct ipw_soft_buf *);
@@ -237,7 +236,6 @@ ipw_attach(device_t dev)
 	    MTX_DEF | MTX_RECURSE);
 
 	TASK_INIT(&sc->sc_init_task, 0, ipw_init_task, sc);
-	TASK_INIT(&sc->sc_bmiss_task, 0, ipw_bmiss, sc);
 	callout_init_mtx(&sc->sc_wdtimer, &sc->sc_mtx, 0);
 
 	if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
@@ -415,7 +413,6 @@ ipw_detach(device_t dev)
 
 	callout_drain(&sc->sc_wdtimer);
 	taskqueue_drain(taskqueue_fast, &sc->sc_init_task);
-	taskqueue_drain(taskqueue_fast, &sc->sc_bmiss_task);
 
 	ipw_release(sc);
 
@@ -1027,14 +1024,6 @@ ipw_assocfailed(void *arg, int npending)
 }
 
 static void
-ipw_bmiss(void *arg, int npending)
-{
-	struct ieee80211com *ic = arg;
-
-	ieee80211_beacon_miss(ic);
-}
-
-static void
 ipw_rx_newstate_intr(struct ipw_softc *sc, struct ipw_soft_buf *sbuf)
 {
 #define	IEEESTATE(vap)	ieee80211_state_name[vap->iv_state]
@@ -1074,7 +1063,7 @@ ipw_rx_newstate_intr(struct ipw_softc *s
 		 */
 		if (sc->flags & IPW_FLAG_ASSOCIATED) {
 			/* XXX probably need to issue disassoc to fw */
-			taskqueue_enqueue(taskqueue_swi, &sc->sc_bmiss_task);
+			ieee80211_beacon_miss(ic);
 		}
 		break;
 

Modified: user/thompsa/vaptq/sys/dev/iwn/if_iwn.c
==============================================================================
--- user/thompsa/vaptq/sys/dev/iwn/if_iwn.c	Fri Apr 17 04:23:11 2009	(r191194)
+++ user/thompsa/vaptq/sys/dev/iwn/if_iwn.c	Fri Apr 17 05:37:31 2009	(r191195)
@@ -129,7 +129,6 @@ void		iwn_rx_intr(struct iwn_softc *, st
 void		iwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *);
 void		iwn_tx_intr(struct iwn_softc *, struct iwn_rx_desc *);
 void		iwn_cmd_intr(struct iwn_softc *, struct iwn_rx_desc *);
-static void	iwn_bmiss(void *, int);
 void		iwn_notif_intr(struct iwn_softc *);
 void		iwn_intr(void *);
 void		iwn_read_eeprom(struct iwn_softc *,
@@ -309,7 +308,6 @@ iwn_attach(device_t dev)
                 device_get_nameunit(dev));
 
         TASK_INIT(&sc->sc_ops_task, 0, iwn_ops, sc );
-	TASK_INIT(&sc->sc_bmiss_task, 0, iwn_bmiss, sc);
 
 	/*
 	 * Put adapter into a known state.
@@ -1651,15 +1649,6 @@ iwn_cmd_intr(struct iwn_softc *sc, struc
 	wakeup(&ring->cmd[desc->idx]);
 }
 
-static void
-iwn_bmiss(void *arg, int npending)
-{
-	struct iwn_softc *sc = arg;
-	struct ieee80211com *ic = sc->sc_ifp->if_l2com;
-
-	ieee80211_beacon_miss(ic);
-}
-
 void
 iwn_notif_intr(struct iwn_softc *sc)
 {
@@ -1720,8 +1709,7 @@ iwn_notif_intr(struct iwn_softc *sc)
 			if (vap->iv_state == IEEE80211_S_RUN && misses > 5)
 				(void) iwn_init_sensitivity(sc);
 			if (misses >= vap->iv_bmissthreshold)
-				taskqueue_enqueue(taskqueue_swi,
-				    &sc->sc_bmiss_task);
+				ieee80211_beacon_miss(ic);
 			break;
 		}
 		case IWN_UC_READY: {

Modified: user/thompsa/vaptq/sys/dev/wi/if_wi.c
==============================================================================
--- user/thompsa/vaptq/sys/dev/wi/if_wi.c	Fri Apr 17 04:23:11 2009	(r191194)
+++ user/thompsa/vaptq/sys/dev/wi/if_wi.c	Fri Apr 17 05:37:31 2009	(r191195)
@@ -78,7 +78,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/random.h>
 #include <sys/syslog.h>
 #include <sys/sysctl.h>
-#include <sys/taskqueue.h>
 
 #include <machine/bus.h>
 #include <machine/resource.h>
@@ -134,7 +133,6 @@ static void wi_rx_intr(struct wi_softc *
 static void wi_tx_intr(struct wi_softc *);
 static void wi_tx_ex_intr(struct wi_softc *);
 
-static void wi_status_oor(void *, int);
 static void wi_info_intr(struct wi_softc *);
 
 static int  wi_write_txrate(struct wi_softc *, struct ieee80211vap *);
@@ -448,7 +446,6 @@ wi_attach(device_t dev)
 	}
 
 	sc->sc_portnum = WI_DEFAULT_PORT;
-	TASK_INIT(&sc->sc_oor_task, 0, wi_status_oor, ic);
 
 	ieee80211_ifattach(ic, macaddr);
 	ic->ic_raw_xmit = wi_raw_xmit;
@@ -1505,14 +1502,6 @@ wi_tx_intr(struct wi_softc *sc)
 	}
 }
 
-static void
-wi_status_oor(void *arg, int pending)
-{
-	struct ieee80211com *ic = arg;
-
-	ieee80211_beacon_miss(ic);
-}
-
 static __noinline void
 wi_info_intr(struct wi_softc *sc)
 {
@@ -1555,7 +1544,7 @@ wi_info_intr(struct wi_softc *sc)
 			break;
 		case WI_INFO_LINK_STAT_AP_OOR:
 			/* XXX does this need to be per-vap? */
-			taskqueue_enqueue(taskqueue_swi, &sc->sc_oor_task);
+			ieee80211_beacon_miss(ic);
 			break;
 		case WI_INFO_LINK_STAT_ASSOC_FAILED:
 			if (vap->iv_opmode == IEEE80211_M_STA)

Modified: user/thompsa/vaptq/sys/dev/wpi/if_wpi.c
==============================================================================
--- user/thompsa/vaptq/sys/dev/wpi/if_wpi.c	Fri Apr 17 04:23:11 2009	(r191194)
+++ user/thompsa/vaptq/sys/dev/wpi/if_wpi.c	Fri Apr 17 05:37:31 2009	(r191195)
@@ -192,7 +192,6 @@ static void	wpi_rx_intr(struct wpi_softc
 		    struct wpi_rx_data *);
 static void	wpi_tx_intr(struct wpi_softc *, struct wpi_rx_desc *);
 static void	wpi_cmd_intr(struct wpi_softc *, struct wpi_rx_desc *);
-static void	wpi_bmiss(void *, int);
 static void	wpi_notif_intr(struct wpi_softc *);
 static void	wpi_intr(void *);
 static void	wpi_ops(void *, int);
@@ -525,7 +524,6 @@ wpi_attach(device_t dev)
 
 	/* Create the tasks that can be queued */
 	TASK_INIT(&sc->sc_opstask, 0, wpi_ops, sc);
-	TASK_INIT(&sc->sc_bmiss_task, 0, wpi_bmiss, sc);
 
 	WPI_LOCK_INIT(sc);
 	WPI_CMD_LOCK_INIT(sc);
@@ -1653,15 +1651,6 @@ wpi_cmd_intr(struct wpi_softc *sc, struc
 }
 
 static void
-wpi_bmiss(void *arg, int npending)
-{
-	struct wpi_softc *sc = arg;
-	struct ieee80211com *ic = sc->sc_ifp->if_l2com;
-
-	ieee80211_beacon_miss(ic);
-}
-
-static void
 wpi_notif_intr(struct wpi_softc *sc)
 {
 	struct ifnet *ifp = sc->sc_ifp;
@@ -1770,8 +1759,7 @@ wpi_notif_intr(struct wpi_softc *sc)
 				DPRINTF(("Beacon miss: %u >= %u\n",
 					 le32toh(beacon->consecutive),
 					 vap->iv_bmissthreshold));
-				taskqueue_enqueue(taskqueue_swi,
-				    &sc->sc_bmiss_task);
+				ieee80211_beacon_miss(ic);
 			}
 			break;
 		}
@@ -3041,8 +3029,7 @@ wpi_rfkill_resume(struct wpi_softc *sc)
 	if (vap != NULL) {
 		if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) {
 			if (vap->iv_opmode != IEEE80211_M_MONITOR) {
-				taskqueue_enqueue(taskqueue_swi,
-				    &sc->sc_bmiss_task);
+				ieee80211_beacon_miss(ic);
 				wpi_set_led(sc, WPI_LED_LINK, 0, 1);
 			} else
 				wpi_set_led(sc, WPI_LED_LINK, 5, 5);

Modified: user/thompsa/vaptq/sys/net80211/ieee80211_proto.c
==============================================================================
--- user/thompsa/vaptq/sys/net80211/ieee80211_proto.c	Fri Apr 17 04:23:11 2009	(r191194)
+++ user/thompsa/vaptq/sys/net80211/ieee80211_proto.c	Fri Apr 17 05:37:31 2009	(r191195)
@@ -96,6 +96,7 @@ const char *ieee80211_wme_acnames[] = {
 	"WME_UPSD",
 };
 
+static void beacon_miss(void *, int);
 static void parent_updown(void *, int);
 static void update_mcast(void *, int);
 static void update_promisc(void *, int);
@@ -140,6 +141,7 @@ ieee80211_proto_attach(struct ieee80211c
 	TASK_INIT(&ic->ic_mcast_task, 0, update_mcast, ic);
 	TASK_INIT(&ic->ic_promisc_task, 0, update_promisc, ic);
 	TASK_INIT(&ic->ic_chan_task, 0, update_channel, ic);
+	TASK_INIT(&ic->ic_bmiss_task, 0, beacon_miss, ic);
 
 	ic->ic_wme.wme_hipri_switch_hysteresis =
 		AGGRESSIVE_MODE_SWITCH_HYSTERESIS;
@@ -1120,6 +1122,7 @@ ieee80211_waitfor_parent(struct ieee8021
 	taskqueue_drain(ic->ic_tq, &ic->ic_mcast_task);
 	taskqueue_drain(ic->ic_tq, &ic->ic_promisc_task);
 	taskqueue_drain(ic->ic_tq, &ic->ic_chan_task);
+	taskqueue_drain(ic->ic_tq, &ic->ic_bmiss_task);
 }
 
 /*
@@ -1358,6 +1361,14 @@ ieee80211_resume_all(struct ieee80211com
 void
 ieee80211_beacon_miss(struct ieee80211com *ic)
 {
+	/* Process in a taskq, the bmiss handler may reenter the driver */
+	taskqueue_enqueue(ic->ic_tq, &ic->ic_bmiss_task);
+}
+
+static void
+beacon_miss(void *arg, int npending)
+{
+	struct ieee80211com *ic = arg;
 	struct ieee80211vap *vap;
 
 	if (ic->ic_flags & IEEE80211_F_SCAN)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904170537.n3H5bVcI012340>