PERFORCE change 141096 for review
Sam Leffler
sam at FreeBSD.org
Sat May 3 17:40:46 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=141096
Change 141096 by sam at sam_ebb on 2008/05/03 17:40:25
o record regdomain+countrycode from eeprom for diagnosing issues
o add a sysctl to control wme+tkip mic handling
Affected files ...
.. //depot/projects/vap/sys/dev/ath/if_ath.c#68 edit
.. //depot/projects/vap/sys/dev/ath/if_athvar.h#22 edit
Differences ...
==== //depot/projects/vap/sys/dev/ath/if_ath.c#68 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.182 2008/04/30 17:00:32 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.183 2008/05/01 04:54:58 thompsa Exp $");
/*
* Driver for the Atheros Wireless LAN controller.
@@ -5941,7 +5941,6 @@
struct ifnet *ifp = sc->sc_ifp;
struct ieee80211com *ic = ifp->if_l2com;
struct ath_hal *ah = sc->sc_ah;
- u_int32_t rd, cc;
int error;
/*
@@ -5949,19 +5948,19 @@
*/
error = getchannels(sc, &ic->ic_nchans, ic->ic_channels,
CTRY_DEFAULT, AH_TRUE, AH_FALSE);
- (void) ath_hal_getregdomain(ah, &rd);
- ath_hal_getcountrycode(ah, &cc); /* NB: cannot fail */
+ (void) ath_hal_getregdomain(ah, &sc->sc_eerd);
+ ath_hal_getcountrycode(ah, &sc->sc_eecc); /* NB: cannot fail */
if (error) {
if_printf(ifp, "%s: unable to collect channel list from hal, "
"error %d\n", __func__, error);
if (error == EINVAL) {
if_printf(ifp, "%s: regdomain likely %u country code %u\n",
- __func__, rd, cc);
+ __func__, sc->sc_eerd, sc->sc_eecc);
}
return error;
}
- ic->ic_regdomain.regdomain = ath_mapregdomain(sc, rd);
- ic->ic_regdomain.country = cc;
+ ic->ic_regdomain.regdomain = ath_mapregdomain(sc, sc->sc_eerd);
+ ic->ic_regdomain.country = sc->sc_eecc;
ic->ic_regdomain.ecm = 1;
ic->ic_regdomain.location = 'I';
ic->ic_regdomain.isocc[0] = ' '; /* XXX don't know */
@@ -6578,6 +6577,30 @@
return !ath_hal_settpcts(sc->sc_ah, tpcts) ? EINVAL : 0;
}
+static int
+ath_sysctl_wmetkipmic(SYSCTL_HANDLER_ARGS)
+{
+ struct ath_softc *sc = arg1;
+ struct ieee80211com *ic = sc->sc_ifp->if_l2com;
+ int wmetkipmic, error;
+
+ wmetkipmic = sc->sc_wmetkipmic;
+ error = sysctl_handle_int(oidp, &wmetkipmic, 0, req);
+ if (error || !req->newptr)
+ return error;
+ sc->sc_wmetkipmic = (wmetkipmic != 0);
+ if (ic->ic_cryptocaps & IEEE80211_CRYPTO_TKIP) {
+ if (sc->sc_wmetkipmic) {
+ ath_hal_settkipmic(sc->sc_ah, AH_TRUE);
+ ic->ic_cryptocaps |= IEEE80211_CRYPTO_TKIPMIC;
+ } else {
+ ath_hal_settkipmic(sc->sc_ah, AH_FALSE);
+ ic->ic_cryptocaps &= ~IEEE80211_CRYPTO_TKIPMIC;
+ }
+ }
+ return 0;
+}
+
static void
ath_sysctlattach(struct ath_softc *sc)
{
@@ -6585,6 +6608,12 @@
struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
struct ath_hal *ah = sc->sc_ah;
+ SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "countrycode", CTLFLAG_RD, &sc->sc_eecc, 0,
+ "EEPROM country code");
+ SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "regdomain", CTLFLAG_RD, &sc->sc_eerd, 0,
+ "EEPROM regdomain code");
#ifdef ATH_DEBUG
sc->sc_debug = ath_debug;
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
@@ -6665,6 +6694,9 @@
SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"monpass", CTLFLAG_RW, &sc->sc_monpass, 0,
"mask of error frames to pass when monitoring");
+ SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+ "wmetkipmic", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
+ ath_sysctl_wmetkipmic, "I", "");
}
static void
==== //depot/projects/vap/sys/dev/ath/if_athvar.h#22 (text+ko) ====
@@ -246,6 +246,8 @@
sc_swbmiss : 1,/* sta mode using sw bmiss */
sc_stagbeacons:1,/* use staggered beacons */
sc_wmetkipmic:1;/* can do WME+TKIP MIC */
+ uint32_t sc_eerd; /* regdomain from EEPROM */
+ uint32_t sc_eecc; /* country code from EEPROM */
/* rate tables */
#define IEEE80211_MODE_HALF (IEEE80211_MODE_MAX+0)
#define IEEE80211_MODE_QUARTER (IEEE80211_MODE_MAX+1)
More information about the p4-projects
mailing list