Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Oct 2008 19:35:11 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 151825 for review
Message-ID:  <200810231935.m9NJZBLC087662@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <SKU_DEBUG,0> 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, &regdomain, &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",



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