From owner-p4-projects@FreeBSD.ORG Sat May 3 17:40:46 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 09752106567D; Sat, 3 May 2008 17:40:46 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFBAD106566C for ; Sat, 3 May 2008 17:40:45 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id A2B5C8FC2F for ; Sat, 3 May 2008 17:40:45 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m43HejOx020203 for ; Sat, 3 May 2008 17:40:45 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m43HejKZ020201 for perforce@freebsd.org; Sat, 3 May 2008 17:40:45 GMT (envelope-from sam@freebsd.org) Date: Sat, 3 May 2008 17:40:45 GMT Message-Id: <200805031740.m43HejKZ020201@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 141096 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2008 17:40:46 -0000 http://perforce.freebsd.org/chv.cgi?CH=141096 Change 141096 by sam@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 -__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)