Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jan 2010 19:42:38 -0500
From:      Russell Yount <russell.yount@gmail.com>
To:        freebsd-stable@freebsd.org
Subject:   ath(4) PATCH
Message-ID:  <c62ff5ca1001291642h1f0b16cne4c12d4191424add@mail.gmail.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
The attached patch for 8.0-STABLE enables multicast key search
capability for devices which support it in the ath(4) driver. This fixes
the problem of corrupted multicast traffic when more than one hostap
VAP is configured on a device.

You can tell if your ath(4) device supports this capability by looking
at the kernel log for "kernel: ath0: using multicast key search" as
the device is attached.

Please test if you are using the ath(4) driver. I only have AR5212 chipsets
to test with and would like to see this included in 8.0-STABLE and 9.

Thanks

-Russ

[-- Attachment #2 --]
--- src/sys/dev/ath/if_athvar.h.orig	2009-08-03 04:13:06.000000000 -0400
+++ src/sys/dev/ath/if_athvar.h	2010-01-24 16:31:35.000000000 -0500
@@ -580,14 +580,12 @@
 	ath_hal_setcapability(_ah, HAL_CAP_TPC, 1, _v, NULL)
 #define	ath_hal_hasbursting(_ah) \
 	(ath_hal_getcapability(_ah, HAL_CAP_BURST, 0, NULL) == HAL_OK)
-#ifdef notyet
+#define	ath_hal_setmcastkeysearch(_ah, _v) \
+	ath_hal_setcapability(_ah, HAL_CAP_MCAST_KEYSRCH, 0, _v, NULL)
 #define	ath_hal_hasmcastkeysearch(_ah) \
 	(ath_hal_getcapability(_ah, HAL_CAP_MCAST_KEYSRCH, 0, NULL) == HAL_OK)
 #define	ath_hal_getmcastkeysearch(_ah) \
 	(ath_hal_getcapability(_ah, HAL_CAP_MCAST_KEYSRCH, 1, NULL) == HAL_OK)
-#else
-#define	ath_hal_getmcastkeysearch(_ah)	0
-#endif
 #define	ath_hal_hasfastframes(_ah) \
 	(ath_hal_getcapability(_ah, HAL_CAP_FASTFRAME, 0, NULL) == HAL_OK)
 #define	ath_hal_hasbssidmask(_ah) \
--- src/sys/dev/ath/if_ath.c.orig	2009-09-07 12:41:18.000000000 -0400
+++ src/sys/dev/ath/if_ath.c	2010-01-27 20:25:28.000000000 -0500
@@ -621,6 +621,14 @@
 			sc->sc_wmetkipmic = 1;
 	}
 	sc->sc_hasclrkey = ath_hal_ciphersupported(ah, HAL_CIPHER_CLR);
+	/*
+	 * if multicast key search is supported by device enable it
+	 */
+	if (ath_hal_hasmcastkeysearch(sc->sc_ah)) {
+		if (!ath_hal_getmcastkeysearch(sc->sc_ah)) {
+			ath_hal_setmcastkeysearch(sc->sc_ah,1);
+		}
+	}
 	sc->sc_mcastkey = ath_hal_getmcastkeysearch(ah);
 	/*
 	 * Mark key cache slots associated with global keys
@@ -2219,8 +2227,10 @@
 	 * it permits us to support multiple users for adhoc and/or
 	 * multi-station operation.
 	 */
-	if (k->wk_keyix != IEEE80211_KEYIX_NONE ||	/* global key */
-	    ((k->wk_flags & IEEE80211_KEY_GROUP) && !sc->sc_mcastkey)) {
+	if (k->wk_keyix != IEEE80211_KEYIX_NONE) {
+		/*
+		 * only global keys should have key index assigned
+		 */
 		if (!(&vap->iv_nw_keys[0] <= k &&
 		      k < &vap->iv_nw_keys[IEEE80211_WEP_NKID])) {
 			/* should not happen */
@@ -2229,11 +2239,24 @@
 			return 0;
 		}
 		/*
-		 * XXX we pre-allocate the global keys so
-		 * have no way to check if they've already been allocated.
+		 * if not operating in hostap mode
+		 * or not a group key
+		 * or device does not support muiticast key search
+		 */
+		if (vap->iv_opmode != IEEE80211_M_HOSTAP
+		  || !(k->wk_flags & IEEE80211_KEY_GROUP)
+		  || !sc->sc_mcastkey) {
+			/*
+			 * XXX we pre-allocate the global keys so
+			 * have no way to check if they've already been allocated.
+			 */
+			*keyix = *rxkeyix = k - vap->iv_nw_keys;
+			return 1;
+		}
+		/*
+		 * group key and device supports multicast key search
 		 */
-		*keyix = *rxkeyix = k - vap->iv_nw_keys;
-		return 1;
+		k->wk_keyix = IEEE80211_KEYIX_NONE;
 	}
 
 	/*
@@ -6945,6 +6968,8 @@
 		if_printf(ifp, "using %u rx buffers\n", ath_rxbuf);
 	if (ath_txbuf != ATH_TXBUF)
 		if_printf(ifp, "using %u tx buffers\n", ath_txbuf);
+	if (sc->sc_mcastkey)
+		if_printf(ifp, "using multicast key search\n");
 }
 
 #ifdef IEEE80211_SUPPORT_TDMA

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