From owner-p4-projects@FreeBSD.ORG Thu Oct 23 19:35:12 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3EEDA1065679; Thu, 23 Oct 2008 19:35:12 +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 01FBB10656A6 for ; Thu, 23 Oct 2008 19:35:12 +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 E4D8F8FC26 for ; Thu, 23 Oct 2008 19:35:11 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m9NJZBOc087664 for ; Thu, 23 Oct 2008 19:35:11 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m9NJZBLC087662 for perforce@freebsd.org; Thu, 23 Oct 2008 19:35:11 GMT (envelope-from sam@freebsd.org) Date: Thu, 23 Oct 2008 19:35:11 GMT Message-Id: <200810231935.m9NJZBLC087662@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 151825 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: Thu, 23 Oct 2008 19:35:12 -0000 http://perforce.freebsd.org/chv.cgi?CH=151825 Change 151825 by sam@sam_ebb on 2008/10/23 19:34:49 cl151683 somehow broke operation on 11a channels by causing country ie to overflow the beacon frame or otherwise cause it to be malformed such that we get dma errors. Workaround this for now by redoing the mapping between Atheros sku's and net80211 regdomain codes to be more careful. Specifically only map the pair to the hal pair <0,CTRY_DEBUG> as this is the magic setup required to unlock the entire channel list (which is needed to do testing on quiet 2.4G channels like 2484). Note this does not fix the (apparent) country ie problem; still need to investigate that. Affected files ... .. //depot/projects/vap/sys/dev/ath/if_ath.c#117 edit Differences ... ==== //depot/projects/vap/sys/dev/ath/if_ath.c#117 (text+ko) ==== @@ -5974,14 +5974,22 @@ /* XXX hard to include ieee80211_regdomain.h right now */ #define SKU_DEBUG 0x1ff -static int -ath_maprd2sku(u_int32_t rd, u_int32_t cc) +static void +ath_maprd(const struct ieee80211_regdomain *rd, + u_int32_t *ath_rd, u_int32_t *ath_cc) { /* map SKU's to Atheros sku's */ - switch (rd) { - case SKU_DEBUG: return 0; + switch (rd->regdomain) { + case SKU_DEBUG: + if (rd->country == 0) { + *ath_rd = 0; + *ath_cc = CTRY_DEBUG; + return; + } + break; } - return rd; + *ath_rd = rd->regdomain; + *ath_cc = rd->country; } static int @@ -5994,18 +6002,13 @@ int error; (void) ath_hal_getregdomain(ah, &ord); - regdomain = rd->regdomain; - cc = rd->country; - if (regdomain == SKU_DEBUG && cc == 0) { - /* XXX requires special handling */ - regdomain = 0; - cc = CTRY_DEBUG; - } + ath_maprd(rd, ®domain, &cc); DPRINTF(sc, ATH_DEBUG_REGDOMAIN, "%s: rd %u cc %u location %c ecm %u (mapped rd %u cc %u)\n", __func__, rd->regdomain, rd->country, rd->location, rd->ecm, regdomain, cc); - ath_hal_setregdomain(ah, ath_maprd2sku(regdomain, cc)); + ath_hal_setregdomain(ah, regdomain); + error = getchannels(sc, &nchans, chans, cc, rd->ecm ? AH_TRUE : AH_FALSE, rd->location != 'I' ? AH_TRUE : AH_FALSE); @@ -6046,14 +6049,25 @@ ic->ic_regdomain.location != 'I' ? AH_TRUE : AH_FALSE); } -static int -ath_mapsku2rd(u_int32_t sku, u_int32_t cc) +static void +ath_mapsku(u_int32_t ath_rd, u_int32_t ath_cc, struct ieee80211_regdomain *rd) { + rd->isocc[0] = ' '; /* XXX don't know */ + rd->isocc[1] = ' '; + /* map Atheros sku's to SKU's */ - switch (sku) { - case 0: return SKU_DEBUG; + switch (ath_rd) { + case 0: + if (ath_cc == CTRY_DEBUG) { + rd->regdomain = SKU_DEBUG; + rd->country = 0; + return; + } + break; } - return sku; + /* XXX net80211 types too small */ + rd->regdomain = (uint16_t) ath_rd; + rd->country = (uint16_t) ath_cc; } static int @@ -6080,12 +6094,9 @@ } return error; } - ic->ic_regdomain.regdomain = ath_mapsku2rd(sc->sc_eerd, sc->sc_eecc); - 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 */ - ic->ic_regdomain.isocc[1] = ' '; + ath_mapsku(sc->sc_eerd, sc->sc_eecc, &ic->ic_regdomain); DPRINTF(sc, ATH_DEBUG_REGDOMAIN, "%s: eeprom rd %u cc %u (mapped rd %u cc %u) location %c ecm %u\n",