Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Oct 2007 03:31:46 GMT
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 127085 for review
Message-ID:  <200710020331.l923Vkkp079896@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=127085

Change 127085 by thompsa@thompsa_heff on 2007/10/02 03:30:52

	- Remove dead code in ipw_newstate.
	- send disassociate to the AP when going to INIT.

Affected files ...

.. //depot/projects/wifi/sys/dev/ipw/if_ipw.c#32 edit
.. //depot/projects/wifi/sys/dev/ipw/if_ipwvar.h#11 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ipw/if_ipw.c#32 (text+ko) ====

@@ -136,9 +136,11 @@
 static int	ipw_reset(struct ipw_softc *);
 static int	ipw_load_ucode(struct ipw_softc *, const char *, int);
 static int	ipw_load_firmware(struct ipw_softc *, const char *, int);
+static int	ipw_config(struct ipw_softc *);
 static void	ipw_assoc_task(void *, int);
 static int	ipw_auth_and_assoc(struct ipw_softc *);
-static int	ipw_config(struct ipw_softc *);
+static void	ipw_disassoc_task(void *, int);
+static int	ipw_disassociate(struct ipw_softc *);
 static void	ipw_init_task(void *, int);
 static void	ipw_init(void *);
 static void	ipw_init_locked(struct ipw_softc *, int);
@@ -230,6 +232,7 @@
 	TASK_INIT(&sc->sc_init_task, 0, ipw_init_task, sc);
 	TASK_INIT(&sc->sc_scan_task, 0, ipw_scan_task, sc);
 	TASK_INIT(&sc->sc_assoc_task, 0, ipw_assoc_task, sc);
+	TASK_INIT(&sc->sc_disassoc_task, 0, ipw_disassoc_task, sc);
 	callout_init_mtx(&sc->sc_wdtimer, &sc->sc_mtx, 0);
 
 	if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
@@ -836,47 +839,26 @@
 {
 	struct ifnet *ifp = ic->ic_ifp;
 	struct ipw_softc *sc = ifp->if_softc;
-#if 0
-	struct ieee80211_node *ni;
-	uint32_t len, error;
-#endif
 
 	DPRINTF(("%s: %s -> %s flags 0x%x\n", __func__,
 		ieee80211_state_name[ic->ic_state],
 		ieee80211_state_name[nstate], sc->flags));
 
 	switch (nstate) {
+	case IEEE80211_S_SCAN:
 	case IEEE80211_S_RUN:
-#if 0
-		ni = ic->ic_bss;
-		DELAY(200); /* firmware needs a short delay here */
-
-		len = IEEE80211_ADDR_LEN;
-		ipw_read_table2(sc, IPW_INFO_CURRENT_BSSID, ni->ni_bssid, &len);
-		IEEE80211_ADDR_COPY(ni->ni_macaddr, ni->ni_bssid);
-
-		if (ic->ic_opmode != IEEE80211_M_HOSTAP) {
-			len = IEEE80211_NWID_LEN;
-			error = ipw_read_table2(sc, IPW_INFO_CURRENT_SSID,
-			    ni->ni_essid, &len);
-
-			if (error == 0) {
-				ni->ni_esslen = len;
-#ifdef IPW_DEBUG
-				if (ipw_debug > 0) {
-					printf("Associated to ");
-					ieee80211_print_essid(ni->ni_essid,
-					    ni->ni_esslen);
-					printf("\n");
-				}
-#endif
-			}
-		}
-#endif
 		return (*sc->sc_newstate)(ic, nstate, arg);
 
 	case IEEE80211_S_INIT:
-	case IEEE80211_S_SCAN:
+		/*
+		 * NB: don't try to do this if ipw_stop_master has
+		 *     shutdown the firmware and disabled interrupts.
+		 */
+		if (ic->ic_state == IEEE80211_S_RUN &&
+		    (sc->flags & IPW_FLAG_FW_INITED))
+			taskqueue_enqueue_fast(taskqueue_fast,
+			    &sc->sc_disassoc_task);
+
 		return sc->sc_newstate(ic, nstate, arg);
 
 	case IEEE80211_S_AUTH:
@@ -896,7 +878,6 @@
 	default:
 		break;
 	}
-
 	ic->ic_state = nstate;
 
 	return 0;
@@ -2368,7 +2349,8 @@
 }
 
 /*
- * Handler for sc_scan_task.  This is a simple wrapper around ipw_scan().
+ * Handler for sc_assoc_task.  This is a simple wrapper around
+ * ipw_auth_and_assoc().
  */
 static void
 ipw_assoc_task(void *context, int pending)
@@ -2452,7 +2434,21 @@
 	return ipw_enable(sc);		/* finally, enable adapter */
 }
 
-#if 0
+/*
+ * Handler for sc_disassoc_task.  This is a simple wrapper around
+ * ipw_disassociate().
+ */
+static void
+ipw_disassoc_task(void *context, int pending)
+{
+	struct ipw_softc *sc = context;
+	IPW_LOCK_DECL;
+
+	IPW_LOCK(sc);
+	ipw_disassociate(sc);
+	IPW_UNLOCK(sc);
+}
+
 static int
 ipw_disassociate(struct ipw_softc *sc)
 {
@@ -2460,6 +2456,8 @@
 	struct ieee80211_node *ni = ic->ic_bss;
 
 	DPRINTF(("Disassociate from %6D\n", ni->ni_bssid, ":"));
+
+	sc->flags &= ~IPW_FLAG_ASSOCIATED;
 	/*
 	 * NB: firmware currently ignores bssid parameter, but
 	 *     supply it in case this changes (follow linux driver).
@@ -2467,7 +2465,6 @@
 	return ipw_cmd(sc, IPW_CMD_DISASSOCIATE,
 		ni->ni_bssid, IEEE80211_ADDR_LEN);
 }
-#endif
 
 /*
  * Handler for sc_init_task.  This is a simple wrapper around ipw_init().

==== //depot/projects/wifi/sys/dev/ipw/if_ipwvar.h#11 (text+ko) ====

@@ -87,6 +87,7 @@
 	struct task			sc_init_task;
 	struct task			sc_scan_task;
 	struct task			sc_assoc_task;
+	struct task			sc_disassoc_task;
 	struct callout			sc_wdtimer;	/* watchdog timer */
 
 	uint32_t			flags;



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