Skip to contentSkip to conversation

ath/regd.c: regdomain 0x8000 fails to retrieve a regulatory domain pair

DISCUSSION Joerg Albert 3 participants 9 messages May 11, 2009 – May 22, 2009 1 message not in the archive Atheros ath generic utilities

lore
Share & tools
lore
#0 lore raw

Plugging in a WNDA3100 (ar9170usb) I get the error

ath: No regulatory domain pair found, cannot continue

Seems like the EEPROM of the stick initializes regulatory.current_rd to 0x8000, current_rd_ext to 0. Is this a valid setting?

Looked into ath/regd.c, ath_regd_init():

ath_get_regpair(regdmn)

is called with regdmn == 0x8000 and returns NULL.

Shall that regdmn value be dealt with by

        if (reg->country_code == CTRY_DEFAULT &&
            regdmn == CTRY_DEFAULT)
                reg->country_code = CTRY_UNITED_STATES;

?

wireless-testing is git v2.6.30-rc4-22735-gbd48c47, I run compat-wireless with a 2.6.29.2 kernel.

#1 lore raw
Quoted 15 lines · Joerg Albert

Plugging in a WNDA3100 (ar9170usb) I get the error

ath: No regulatory domain pair found, cannot continue

Seems like the EEPROM of the stick initializes regulatory.current_rd to 0x8000, current_rd_ext to 0. Is this a valid setting?

Looked into ath/regd.c, ath_regd_init():

ath_get_regpair(regdmn)

is called with regdmn == 0x8000 and returns NULL.

Shall that regdmn value be dealt with by

Quoted 7 lines
         if (reg->country_code == CTRY_DEFAULT &&
             regdmn == CTRY_DEFAULT)
                 reg->country_code = CTRY_UNITED_STATES;

?

wireless-testing is git v2.6.30-rc4-22735-gbd48c47, I run compat-wireless with a 2.6.29.2 kernel.

Thanks for reporting this.

Stephen do ar9170 cards get sold with a regulatory domain set to 0x8000? If so we need to deal with this in the common ath.ko module and set the regulatory domain as intended.

If we are not sure we can simply default to one of the world regulatory domains for this specific case, 0x64, for example.

Thanks,

Luis

#3 lore raw
In reply to a message not in the archive
Quoted 24 lines · Joerg Albert
Quoted 15 lines

Plugging in a WNDA3100 (ar9170usb) I get the error

ath: No regulatory domain pair found, cannot continue

Seems like the EEPROM of the stick initializes regulatory.current_rd to 0x8000, current_rd_ext to 0. Is this a valid setting?

Looked into ath/regd.c, ath_regd_init():

ath_get_regpair(regdmn)

is called with regdmn == 0x8000 and returns NULL.

Shall that regdmn value be dealt with by

Quoted 7 lines
         if (reg->country_code == CTRY_DEFAULT &&
             regdmn == CTRY_DEFAULT)
                 reg->country_code = CTRY_UNITED_STATES;

?

wireless-testing is git v2.6.30-rc4-22735-gbd48c47, I run compat-wireless with a 2.6.29.2 kernel.

Quoted 8 lines

Thanks for reporting this.

Stephen do ar9170 cards get sold with a regulatory domain set to 0x8000? If so we need to deal with this in the common ath.ko module and set the regulatory domain as intended.

If we are not sure we can simply default to one of the world regulatory domains for this specific case, 0x64, for example.

Joerg, can you please try this patch, its just informative and I would like to see the output. A regulatory domain in the EEPROM set to 0x8000 should be cought, as you indicated, in this code:

        if (reg->country_code == CTRY_DEFAULT &&
            regdmn == CTRY_DEFAULT)
                reg->country_code = CTRY_UNITED_STATES;

The debug prints should help.

Luis

From: Luis R. Rodriguez <[email protected]>
Subject: [PATCH] ath: make regulatory initialization more informative

This should help debugging. This has no functional change.

---
 drivers/net/wireless/ath/regd.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/regd.c +19 -3
index 7a89f9f..556e252 100644
@@ -366,11 +366,17 @@ static bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg)
 	if (rd & COUNTRY_ERD_FLAG) {
 		/* EEPROM value is a country code */
 		u16 cc = rd & ~COUNTRY_ERD_FLAG;
+		printk(KERN_DEBUG
+		       "ath: EEPROM indicates we should expect "
+			"a country code\n");
 		for (i = 0; i < ARRAY_SIZE(allCountries); i++)
 			if (allCountries[i].countryCode == cc)
 				return true;
 	} else {
 		/* EEPROM value is a regpair value */
+		if (rd != CTRY_DEFAULT)
+			printk(KERN_DEBUG "ath: EEPROM indicates we "
+			       "should expect a direct regpair map\n");
 		for (i = 0; i < ARRAY_SIZE(regDomainPairs); i++)
 			if (regDomainPairs[i].regDmnEnum == rd)
 				return true;
@@ -486,20 +492,30 @@ ath_regd_init(struct ath_regulatory *reg,
 	reg->country_code = ath_regd_get_default_country(regdmn);
 
 	if (reg->country_code == CTRY_DEFAULT &&
-	    regdmn == CTRY_DEFAULT)
+	    regdmn == CTRY_DEFAULT) {
+		printk(KERN_DEBUG "ath: EEPROM indicates default "
+		       "country code should be used\n");
 		reg->country_code = CTRY_UNITED_STATES;
+	}
 
 	if (reg->country_code == CTRY_DEFAULT) {
 		country = NULL;
 	} else {
+		printk(KERN_DEBUG "ath: doing EEPROM country->regdmn "
+		       "map search\n");
 		country = ath_regd_find_country(reg->country_code);
 		if (country == NULL) {
 			printk(KERN_DEBUG
-				"ath: Country is NULL!!!!, cc= %d\n",
+				"ath: no valid country maps found for "
+				"country code: 0x%0x\n",
 				reg->country_code);
 			return -EINVAL;
-		} else
+		} else {
 			regdmn = country->regDmnEnum;
+			printk(KERN_DEBUG "ath: country maps to "
+			       "regdmn code: 0x%0x\n",
+			       regdmn);
+		}
 	}
 
 	reg->regpair = ath_get_regpair(regdmn);
Signature · 1 line
1.5.6.4
#4 lore raw
Quoted 12 lines · Luis R. Rodriguez
Quoted 12 lines · Joerg Albert
Quoted 11 lines

Plugging in a WNDA3100 (ar9170usb) I get the error

ath: No regulatory domain pair found, cannot continue

Seems like the EEPROM of the stick initializes regulatory.current_rd to 0x8000, current_rd_ext to 0. Is this a valid setting?

Looked into ath/regd.c, ath_regd_init():

ath_get_regpair(regdmn)

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

is called with regdmn == 0x8000 and returns NULL.

Shall that regdmn value be dealt with by

         if (reg->country_code == CTRY_DEFAULT && regdmn == CTRY_DEFAULT) reg->country_code = CTRY_UNITED_STATES; ?

Why CTRY_UNITED_STATES? Is there no CTRY_WORLD? Or is 0x8000 US-specific?

Quoted 99 lines
Quoted 4 lines
Quoted 3 lines

wireless-testing is git v2.6.30-rc4-22735-gbd48c47, I run compat-wireless with a 2.6.29.2 kernel.

Quoted 8 lines

Thanks for reporting this.

Stephen do ar9170 cards get sold with a regulatory domain set to 0x8000? If so we need to deal with this in the common ath.ko module and set the regulatory domain as intended.

If we are not sure we can simply default to one of the world regulatory domains for this specific case, 0x64, for example.

Joerg, can you please try this patch, its just informative and I would like to see the output. A regulatory domain in the EEPROM set to 0x8000 should be cought, as you indicated, in this code:

       if (reg->country_code == CTRY_DEFAULT && regdmn == CTRY_DEFAULT) reg->country_code = CTRY_UNITED_STATES;

The debug prints should help.

 Luis

From: Luis R. Rodriguez <[email protected]>
Subject: [PATCH] ath: make regulatory initialization more informative

This should help debugging. This has no functional change.

---
 drivers/net/wireless/ath/regd.c |   22 +++++++++++++++++++---

 1 files changed, 19 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/regd.c +6 -0
index 7a89f9f..556e252 100644
@@ -366,11 +366,17 @@ static bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg)
        if (rd & COUNTRY_ERD_FLAG) {
                /* EEPROM value is a country code */
                u16 cc = rd & ~COUNTRY_ERD_FLAG;
+               printk(KERN_DEBUG
+                      "ath: EEPROM indicates we should expect "
+                       "a country code\n");
                for (i = 0; i < ARRAY_SIZE(allCountries); i++)
                        if (allCountries[i].countryCode == cc)
                                return true;
        } else {
                /* EEPROM value is a regpair value */
+               if (rd != CTRY_DEFAULT)
+                       printk(KERN_DEBUG "ath: EEPROM indicates we "
+                              "should expect a direct regpair map\n");
                for (i = 0; i < ARRAY_SIZE(regDomainPairs); i++)
                        if (regDomainPairs[i].regDmnEnum == rd)
                                return true;
@@ -486,20 +492,30 @@ ath_regd_init(struct ath_regulatory *reg,
        reg->country_code = ath_regd_get_default_country(regdmn);
 

       if (reg->country_code == CTRY_DEFAULT &&
-           regdmn == CTRY_DEFAULT)
+           regdmn == CTRY_DEFAULT) {
+               printk(KERN_DEBUG "ath: EEPROM indicates default "
+                      "country code should be used\n"); reg->country_code = CTRY_UNITED_STATES;
+       }

       if (reg->country_code == CTRY_DEFAULT) {
               country = NULL;
       } else {
+               printk(KERN_DEBUG "ath: doing EEPROM country->regdmn "
+                      "map search\n");
               country = ath_regd_find_country(reg->country_code); if (country == NULL) {
                       printk(KERN_DEBUG
-                               "ath: Country is NULL!!!!, cc= %d\n",
+                               "ath: no valid country maps found for "
+                               "country code: 0x%0x\n", reg->country_code);
                       return -EINVAL;
-               } else
+               } else {
                       regdmn = country->regDmnEnum;
+                       printk(KERN_DEBUG "ath: country maps to "
+                              "regdmn code: 0x%0x\n",
+                              regdmn);
+               }
       }

       reg->regpair = ath_get_regpair(regdmn);
--
1.5.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
#5 lore raw
Quoted 16 lines · Gábor Stefanik
Quoted 14 lines · Luis R. Rodriguez
Quoted 14 lines · Joerg Albert
Quoted 13 lines

Plugging in a WNDA3100 (ar9170usb) I get the error

ath: No regulatory domain pair found, cannot continue

Seems like the EEPROM of the stick initializes regulatory.current_rd to 0x8000, current_rd_ext to 0. Is this a valid setting?

Looked into ath/regd.c, ath_regd_init():

ath_get_regpair(regdmn)

is called with regdmn == 0x8000 and returns NULL.

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Shall that regdmn value be dealt with by

         if (reg->country_code == CTRY_DEFAULT &&
             regdmn == CTRY_DEFAULT)
                 reg->country_code = CTRY_UNITED_STATES;

?

Why CTRY_UNITED_STATES?

Well, that's just the way the regulatory infrastructure is designed, I suppose that we inform vendors they can program their EEPROM with with 0x8000 as an option to use CTRY_UNITED_STATES.

Quoted 1 line

Is there no CTRY_WORLD?

If (regdm & 0x60) then you have a world regualtory domain. Atheros devices have 12 world regulatory domains today. They are all built-in to ath.ko.

Quoted 1 line

Or is 0x8000 US-specific?

That's what I believe.

Luis

#6 lore raw
In reply to Luis R. Rodriguez
Quoted 9 lines · Luis R. Rodriguez

Joerg, can you please try this patch, its just informative and I would
like to see the output. A regulatory domain in the EEPROM set to 0x8000 should be cought, as you indicated, in this code:

        if (reg->country_code == CTRY_DEFAULT &&
            regdmn == CTRY_DEFAULT)
                reg->country_code = CTRY_UNITED_STATES;

The debug prints should help.
...

With the patch I get:

usb 1-5: firmware: requesting ar9170-2.fw
ath: EEPROM indicates we should expect a country code
ath: No regulatory domain pair found, cannot continue
ar9170usb: probe of 1-5:1.0 failed with error -22

IMHO the in the above if-statement regdmn == 0x8000 (as read from the EEPROM by ath_regd_get_eepromRD), but CTRY_DEFAULT is defined as zero, so reg->country_code isn't set. Shouldn't we say "regdmn == (CTRY_DEFAULT|COUNTRY_ERD_FLAG)",because without the ERD flag set we cannot compare a regdomain with a country code?

/Joerg

#7 lore raw
Quoted 19 lines · Joerg Albert
Quoted 10 lines · Luis R. Rodriguez

Joerg, can you please try this patch, its just informative and I would like to see the output. A regulatory domain in the EEPROM set to 0x8000 should be cought, as you indicated, in this code:

        if (reg->country_code == CTRY_DEFAULT &&
            regdmn == CTRY_DEFAULT)
                reg->country_code = CTRY_UNITED_STATES;

The debug prints should help.
...

With the patch I get:

usb 1-5: firmware: requesting ar9170-2.fw
ath: EEPROM indicates we should expect a country code
ath: No regulatory domain pair found, cannot continue
ar9170usb: probe of 1-5:1.0 failed with error -22

Quoted 6 lines

IMHO the in the above if-statement regdmn == 0x8000 (as read from the EEPROM by ath_regd_get_eepromRD), but CTRY_DEFAULT is defined as zero, so reg->country_code isn't set.
Shouldn't we say "regdmn == (CTRY_DEFAULT|COUNTRY_ERD_FLAG)",because without the ERD flag set we cannot compare a regdomain with a country code?

I agree, regdmn is set from calling ath_regd_get_eepromRD() which returns:

	reg->current_rd & ~WORLDWIDE_ROAMING_FLAG

This is:

	reg->current_rd & ~0x4000

And _not_

	reg->current_rd & ~COUNTRY_ERD_FLAG

which would be:

	reg->current_rd & ~0x8000

This _does_ explain why you end up where you do, and we don't let the driver continue. However, it does seem that 0x8000 is in fact not a valid regulatory domain code which should be used. Problem with using CTRY_UNITED_STATES or 0x64 (or another custom atheros world regulatory domain) for this case is non properly calibrated data may be used, specifically for the CTL indexes. We'll check on this internally, regardless we need a solution for you.

Luis

#8 lore raw
Quoted 44 lines · Luis R. Rodriguez
Quoted 19 lines · Joerg Albert
Quoted 9 lines · Luis R. Rodriguez

Joerg, can you please try this patch, its just informative and I would like to see the output. A regulatory domain in the EEPROM set to 0x8000 should be cought, as you indicated, in this code:

        if (reg->country_code == CTRY_DEFAULT && regdmn == CTRY_DEFAULT) reg->country_code = CTRY_UNITED_STATES;

The debug prints should help.

 > ...
With the patch I get:

usb 1-5: firmware: requesting ar9170-2.fw
ath: EEPROM indicates we should expect a country code
ath: No regulatory domain pair found, cannot continue
ar9170usb: probe of 1-5:1.0 failed with error -22

Quoted 6 lines

IMHO the in the above if-statement regdmn == 0x8000 (as read from the EEPROM by ath_regd_get_eepromRD), but CTRY_DEFAULT is defined as zero, so reg->country_code isn't set.
Shouldn't we say "regdmn == (CTRY_DEFAULT|COUNTRY_ERD_FLAG)",because without the ERD flag set we cannot compare a regdomain with a country code?

I agree, regdmn is set from calling ath_regd_get_eepromRD() which returns:

       reg->current_rd & ~WORLDWIDE_ROAMING_FLAG

This is:

       reg->current_rd & ~0x4000

And _not_

       reg->current_rd & ~COUNTRY_ERD_FLAG

which would be:

       reg->current_rd & ~0x8000

Quoted 7 lines

This _does_ explain why you end up where you do, and we don't let the driver continue. However, it does seem that 0x8000 is in fact not a valid regulatory domain code which should be used. Problem with using CTRY_UNITED_STATES or 0x64 (or another custom atheros world regulatory domain) for this case is non properly calibrated data may be used, specifically for the CTL indexes. We'll check on this internally, regardless we need a solution for you.

BTW is this a dual band (2.4 GHz and 5 GHz) device or a single band (2.4 GHz) ?

Luis

#9 lore raw
Quoted 1 line · Luis R. Rodriguez

BTW is this a dual band (2.4 GHz and 5 GHz) device or a single band (2.4 GHz) ?

It's a dual band device - Netgear WNDA3100, FCC id PY307300073, S/N 1TN1824802859.