Subject: wireless ath driver fast channel switching
To: None <tech-net@netbsd.org>
From: Cliff Wright <cliff@snipe444.org>
List: tech-net
Date: 03/08/2005 14:14:38
The normal mode the wireless monitor program kismet operates in, uses
fast channel switching (about 5 per second). Our ath driver does not
support this. I made a simple patch which enabled this feature (patch
below). I have not checked on the affect this has on all the ENETRESET
items, but I wonder if this is something NetBSD would want as a driver
feature?

--- ath.c.orig	2004-06-06 23:42:27.000000000 -0700
+++ ath.c	2005-03-08 13:46:34.000000000 -0800
@@ -1052,6 +1052,8 @@
 	if (!ath_hal_reset(ah, ic->ic_opmode, &hchan, AH_TRUE, &status))
 		if_printf(ifp, "%s: unable to reset hardware; hal status %u\n",
 			__func__, status);
+	/* In case channel changed, save as node channel */
+	ic->ic_bss->ni_chan = ic->ic_ibss_chan;
 	ath_hal_intrset(ah, sc->sc_imask);
 	if (ath_startrecv(sc) != 0)	/* restart recv */
 		if_printf(ifp, "%s: unable to start recv logic\n", __func__);
@@ -1351,8 +1353,14 @@
 		error = ieee80211_ioctl(ifp, cmd, data);
 		if (error == ENETRESET) {
 			if ((ifp->if_flags & (IFF_RUNNING|IFF_UP)) ==
-			    (IFF_RUNNING|IFF_UP))
-				ath_init(ifp);		/* XXX lose error */
+			    (IFF_RUNNING|IFF_UP)) {
+				struct ieee80211com *ic = &sc->sc_ic;
+
+				if (ic->ic_opmode != IEEE80211_M_MONITOR)
+					ath_init(ifp);	/* XXX lose error */
+				else
+					ath_reset(sc);
+			}
 			error = 0;
 		}
 		break;