Skip to contentSkip to conversation

rt2x00: Provide regulatory hint with rt2500pci/usb

PATCH In review Ivo van Doorn 3 participants 23 messages Jan 4, 2009 – Jan 13, 2009 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rt2x00: Provide regulatory hint with rt2500pci/usb

rt2500pci and rt2500usb contain a special field in the EEPROM which indicates which regulatory domain the card belongs to. This code can easily be translated into a country code which we can send as alpha2 hint for CRDA.

Please note that most cards will have 0xffff as EEPROM value, and thus do not provide a regulatory hint through the EEPROM.

---

drivers/net/wireless/rt2x00/rt2500pci.c +21 -0
index 76f016d..98d3c6c 100644
@@ -1512,6 +1512,17 @@ static int rt2500pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
 	return 0;
 }
 
+static const char* reg_domain_map[] = {
+	"US",	/* REGION_FCC: 1-11 */
+	"CA",	/* REGION_IC: 1-11 */
+	"DE",	/* REGION_ETSI: 1-13 */
+	"ES",	/* REGION_SPAIN: 10-11 */
+	"FR",	/* REGION_FRANCE: 10-13 */
+	"JP",	/* REGION_MKK: 14 */
+	"JP",	/* REGION_MKK1: 1-14 */
+	"IL",	/* REGION_ISRAEL: 3-9 */
+};
+
 static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
 {
 	u32 reg;
@@ -1577,6 +1588,16 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
 		__set_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags);
 
 	/*
+	 * Read Geography information, if it contains valid data we should
+	 * send the regulatory hint as alpha2 value to cfg80211.
+	 */
+	rt2x00_eeprom_read(rt2x00dev, EEPROM_GEOGRAPHY, &eeprom);
+	if (eeprom != 0xffff) {
+		value = rt2x00_get_field16(eeprom, EEPROM_GEOGRAPHY_GEO);
+		regulatory_hint(rt2x00dev->hw->wiphy, reg_domain_map[value]);
+	}
+
+	/*
 	 * Read the RSSI <-> dBm offset information.
 	 */
 	rt2x00_eeprom_read(rt2x00dev, EEPROM_CALIBRATE_OFFSET, &eeprom);
drivers/net/wireless/rt2x00/rt2500usb.c +21 -0
index 2bc4e46..7f364dd 100644
@@ -1546,6 +1546,17 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
 	return 0;
 }
 
+static const char* reg_domain_map[] = {
+	"US",	/* REGION_FCC: 1-11 */
+	"CA",	/* REGION_IC: 1-11 */
+	"DE",	/* REGION_ETSI: 1-13 */
+	"ES",	/* REGION_SPAIN: 10-11 */
+	"FR",	/* REGION_FRANCE: 10-13 */
+	"JP",	/* REGION_MKK: 14 */
+	"JP",	/* REGION_MKK1: 1-14 */
+	"IL",	/* REGION_ISRAEL: 3-9 */
+};
+
 static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
 {
 	u16 reg;
@@ -1626,6 +1637,16 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
 		__set_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags);
 
 	/*
+	 * Read Geography information, if it contains valid data we should
+	 * send the regulatory hint as alpha2 value to cfg80211.
+	 */
+	rt2x00_eeprom_read(rt2x00dev, EEPROM_GEOGRAPHY, &eeprom);
+	if (eeprom != 0xffff) {
+		value = rt2x00_get_field16(eeprom, EEPROM_GEOGRAPHY_GEO);
+		regulatory_hint(rt2x00dev->hw->wiphy, reg_domain_map[value]);
+	}
+
+	/*
 	 * Read the RSSI <-> dBm offset information.
 	 */
 	rt2x00_eeprom_read(rt2x00dev, EEPROM_CALIBRATE_OFFSET, &eeprom);
#1 lore raw
Quoted 9 lines · Ivo van Doorn

rt2500pci and rt2500usb contain a special field in the EEPROM which indicates which regulatory domain the card belongs to. This code can easily be translated into a country code which we can send as alpha2 hint for CRDA.

Please note that most cards will have 0xffff as EEPROM value, and thus do not provide a regulatory hint through the EEPROM.

I believe regulatory_hint() is being called before the ieee80211_register_hw() call. This is not a requirement right now but I believe this should be the case in the future as we want cfg80211 to keep track a few things for the driver, like the regulatory domain it wants in case of conflicts with other drivers. I'm working on this right now so just wanted to throw that out there.

Is it possible to move the regulatory_hint() to be used after ieee80211_register_hw() is called?

Luis

#2 lore raw
Quoted 13 lines · Luis R. Rodriguez
Quoted 10 lines · Ivo van Doorn

rt2500pci and rt2500usb contain a special field in the EEPROM which indicates which regulatory domain the card belongs to. This code can easily be translated into a country code which we can send as alpha2 hint for CRDA.

Please note that most cards will have 0xffff as EEPROM value, and thus do not provide a regulatory hint through the EEPROM.

Quoted 8 lines

I believe regulatory_hint() is being called before the ieee80211_register_hw() call. This is not a requirement right now but I believe this should be the case in the future as we want cfg80211 to keep track a few things for the driver, like the regulatory domain it wants in case of conflicts with other drivers. I'm working on this right now so just wanted to throw that out there.

Is it possible to move the regulatory_hint() to be used after ieee80211_register_hw() is called?

Luis, Ivo,

I do have an RFC patch that handles things in the way that Luis describes, and applies to all the rt2x00 drivers. Find it attached (sorry for attaching; I still haven't found a way to properly inline a patch with Thunderbird).

The things that kept me from submitting it so far are:
1. The conversion to a country code for the a-band EEPROM values is not complete / correct. So far I've been unable to map the possible code described in the EEPROM spec to real country codes.
2. I'm still puzzled how to handle the two different values that the EEPROM has, namely one for the bg band and one for the a band. I've handled it by registering the one associated with the configured band, but that seems to be unlikely to be correct. I still haven't found a better way to handle this.

Especially for 2 I haven't been able to determine how to handle that. The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

---
Gertjan

Quoted 1 line

From 23b99c8769ad8451368a2e95eabe1beb7fbd2200 Mon Sep 17 00:00:00 2001

From: Gertjan van Wingerde <[email protected]>
Date: Mon, 5 Jan 2009 22:12:25 +0100
Subject: [PATCH] rt2x00: Provide regulatory hint.

Properly register the EEPROM region information with the mac80211 regulatory framework.

---
 drivers/net/wireless/rt2x00/rt2400pci.c |    6 +++
 drivers/net/wireless/rt2x00/rt2400pci.h |    7 ++++
 drivers/net/wireless/rt2x00/rt2500pci.c |    6 +++
 drivers/net/wireless/rt2x00/rt2500pci.h |    2 +-
 drivers/net/wireless/rt2x00/rt2500usb.c |    6 +++
 drivers/net/wireless/rt2x00/rt2500usb.h |    2 +-
 drivers/net/wireless/rt2x00/rt2800pci.c |    8 ++++
 drivers/net/wireless/rt2x00/rt2800pci.h |    9 +++++
 drivers/net/wireless/rt2x00/rt2800usb.c |    8 ++++
 drivers/net/wireless/rt2x00/rt2800usb.h |    9 +++++
 drivers/net/wireless/rt2x00/rt2x00.h    |    6 +++
 drivers/net/wireless/rt2x00/rt2x00dev.c |   60 +++++++++++++++++++++++++++++++
 drivers/net/wireless/rt2x00/rt61pci.c   |    8 ++++
 drivers/net/wireless/rt2x00/rt73usb.c   |    8 ++++
 14 files changed, 143 insertions(+), 2 deletions(-)
drivers/net/wireless/rt2x00/rt2400pci.c +6 -0
index 9c02231..fa98932 100644
@@ -1416,6 +1416,12 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	if (!rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_AGCVGC_TUNING))
 		__set_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags);
 
+	/*
+	 * Read the region information.
+	 */
+	rt2x00_eeprom_read(rt2x00dev, EEPROM_GEOGRAPHY, &eeprom);
+	rt2x00dev->region_bg = rt2x00_get_field16(eeprom, EEPROM_GEOGRAPHY_GEO);
+
 	return 0;
 }
 
drivers/net/wireless/rt2x00/rt2400pci.h +7 -0
index 9aefda4..986e428 100644
@@ -806,6 +806,13 @@
 #define EEPROM_TXPOWER_2		FIELD16(0xff00)
 
 /*
+ * EEPROM geography.
+ * GEO: Default geography setting for device.
+ */
+#define EEPROM_GEOGRAPHY		0x17
+#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)
+
+/*
  * DMA descriptor defines.
  */
 #define TXD_DESC_SIZE			( 8 * sizeof(__le32) )
drivers/net/wireless/rt2x00/rt2500pci.c +6 -0
index 76f016d..bf6624b 100644
@@ -1577,6 +1577,12 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
 		__set_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags);
 
 	/*
+	 * Read the region information.
+	 */
+	rt2x00_eeprom_read(rt2x00dev, EEPROM_GEOGRAPHY, &eeprom);
+	rt2x00dev->region_bg = rt2x00_get_field16(eeprom, EEPROM_GEOGRAPHY_GEO);
+
+	/*
 	 * Read the RSSI <-> dBm offset information.
 	 */
 	rt2x00_eeprom_read(rt2x00dev, EEPROM_CALIBRATE_OFFSET, &eeprom);
drivers/net/wireless/rt2x00/rt2500pci.h +1 -1
index e135247..8a69af3 100644
@@ -1060,7 +1060,7 @@
  * GEO: Default geography setting for device.
  */
 #define EEPROM_GEOGRAPHY		0x12
-#define EEPROM_GEOGRAPHY_GEO		FIELD16(0x0f00)
+#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)
 
 /*
  * EEPROM BBP.
drivers/net/wireless/rt2x00/rt2500usb.c +6 -0
index 81400ea..99ba43e 100644
@@ -1633,6 +1633,12 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
 		__set_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags);
 
 	/*
+	 * Read the region information.
+	 */
+	rt2x00_eeprom_read(rt2x00dev, EEPROM_GEOGRAPHY, &eeprom);
+	rt2x00dev->region_bg = rt2x00_get_field16(eeprom, EEPROM_GEOGRAPHY_GEO);
+
+	/*
 	 * Read the RSSI <-> dBm offset information.
 	 */
 	rt2x00_eeprom_read(rt2x00dev, EEPROM_CALIBRATE_OFFSET, &eeprom);
drivers/net/wireless/rt2x00/rt2500usb.h +1 -1
index e1f714e..634fb32 100644
@@ -680,7 +680,7 @@
  * GEO: Default geography setting for device.
  */
 #define EEPROM_GEOGRAPHY		0x000d
-#define EEPROM_GEOGRAPHY_GEO		FIELD16(0x0f00)
+#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)
 
 /*
  * EEPROM BBP.
drivers/net/wireless/rt2x00/rt2800pci.c +8 -0
index 1e21d5d..dab08a3 100644
@@ -2227,6 +2227,14 @@ static int rt2800pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
 		__set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
 
 	/*
+	 * Read region information.
+	 */
+	rt2x00_eeprom_read(rt2x00dev, EEPROM_GEOGRAPHY, &eeprom);
+
+	rt2x00dev->region_bg = rt2x00_get_field16(eeprom, EEPROM_GEOGRAPHY_GEO);
+	rt2x00dev->region_a = rt2x00_get_field16(eeprom, EEPROM_GEOGRAPHY_GEO_A);
+
+	/*
 	 * Detect if this device has an hardware controlled radio.
 	 */
 #ifdef CONFIG_RT2X00_LIB_RFKILL
drivers/net/wireless/rt2x00/rt2800pci.h +9 -0
index b19d019..31b0459 100644
@@ -1551,6 +1551,15 @@ struct hw_key_entry {
 #define EEPROM_NIC_BW40M_A		FIELD16(0x0200)
 
 /*
+ * EEPROM geography.
+ * GEO_A: Default geographical setting for 5GHz band
+ * GEO: Default geographical setting.
+ */
+#define EEPROM_GEOGRAPHY		0x001c
+#define EEPROM_GEOGRAPHY_GEO_A		FIELD16(0x00ff)
+#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)
+
+/*
  * EEPROM frequency
  */
 #define	EEPROM_FREQ			0x001d
drivers/net/wireless/rt2x00/rt2800usb.c +8 -0
index 6bd252f..e365af2 100644
@@ -2014,6 +2014,14 @@ static int rt2800usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
 		__set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
 
 	/*
+	 * Read region information.
+	 */
+	rt2x00_eeprom_read(rt2x00dev, EEPROM_GEOGRAPHY, &eeprom);
+
+	rt2x00dev->region_bg = rt2x00_get_field16(eeprom, EEPROM_GEOGRAPHY_GEO);
+	rt2x00dev->region_a = rt2x00_get_field16(eeprom, EEPROM_GEOGRAPHY_GEO_A);
+
+	/*
 	 * Detect if this device has an hardware controlled radio.
 	 */
 #ifdef CONFIG_RT2X00_LIB_RFKILL
drivers/net/wireless/rt2x00/rt2800usb.h +9 -0
index c4c195a..d10d15a 100644
@@ -1554,6 +1554,15 @@ struct hw_key_entry {
 #define EEPROM_NIC_BW40M_A		FIELD16(0x0200)
 
 /*
+ * EEPROM geography.
+ * GEO_A: Default geographical setting for 5GHz band
+ * GEO: Default geographical setting.
+ */
+#define EEPROM_GEOGRAPHY		0x001c
+#define EEPROM_GEOGRAPHY_GEO_A		FIELD16(0x00ff)
+#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)
+
+/*
  * EEPROM frequency
  */
 #define	EEPROM_FREQ			0x001d
drivers/net/wireless/rt2x00/rt2x00.h +6 -0
index 60a0e9e..36e4923 100644
@@ -695,6 +695,12 @@ struct rt2x00_dev {
 	struct antenna_setup default_ant;
 
 	/*
+	 * EEPROM region information;
+	 */
+	u16 region_bg;
+	u16 region_a;
+
+	/*
 	 * Register pointers
 	 * csr.base: CSR base register address. (PCI)
 	 * csr.cache: CSR cache for usb_control_msg. (USB)
drivers/net/wireless/rt2x00/rt2x00dev.c +60 -0

78 lines not on this page · raw message

drivers/net/wireless/rt2x00/rt61pci.c +8 -0
index f1150a7..b770ee2 100644
@@ -2371,6 +2371,14 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
 		__set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags);
 
 	/*
+	 * Read region information.
+	 */
+	rt2x00_eeprom_read(rt2x00dev, EEPROM_GEOGRAPHY, &eeprom);
+
+	rt2x00dev->region_bg = rt2x00_get_field16(eeprom, EEPROM_GEOGRAPHY_GEO);
+	rt2x00dev->region_a = rt2x00_get_field16(eeprom, EEPROM_GEOGRAPHY_GEO_A);
+
+	/*
 	 * When working with a RF2529 chip without double antenna
 	 * the antenna settings should be gathered from the NIC
 	 * eeprom word.
drivers/net/wireless/rt2x00/rt73usb.c +8 -0
index 891554e..10c8613 100644
@@ -1891,6 +1891,14 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	}
 
 	/*
+	 * Read region information.
+	 */
+	rt2x00_eeprom_read(rt2x00dev, EEPROM_GEOGRAPHY, &eeprom);
+
+	rt2x00dev->region_bg = rt2x00_get_field16(eeprom, EEPROM_GEOGRAPHY_GEO);
+	rt2x00dev->region_a = rt2x00_get_field16(eeprom, EEPROM_GEOGRAPHY_GEO_A);
+
+	/*
 	 * Store led settings, for correct led behaviour.
 	 */
 #ifdef CONFIG_RT2X00_LIB_LEDS
Signature · 1 line
1.6.1
#3 lore raw
Quoted 8 lines · Gertjan van Wingerde
Quoted 7 lines · Luis R. Rodriguez
Quoted 5 lines · Ivo van Doorn

rt2500pci and rt2500usb contain a special field in the EEPROM which indicates which regulatory domain the card belongs to. This code can easily be translated into a country code which we can send as alpha2 hint for CRDA.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Please note that most cards will have 0xffff as EEPROM value, and thus do not provide a regulatory hint through the EEPROM.

John: Please drop this patch, a more correct patch should be merged later which is based on the code from Gertjan.

Quoted 8 lines
Quoted 8 lines

I believe regulatory_hint() is being called before the ieee80211_register_hw() call. This is not a requirement right now but I believe this should be the case in the future as we want cfg80211 to keep track a few things for the driver, like the regulatory domain it wants in case of conflicts with other drivers. I'm working on this right now so just wanted to throw that out there.

Is it possible to move the regulatory_hint() to be used after ieee80211_register_hw() is called?

Sure, I was a bit doubting about the timing of the call, I noticed that zd1211rw called it during the start() callback function. Would that be the best location? Or right after ieee80211_register_hw()?

Quoted 2 lines

The things that kept me from submitting it so far are:
1. The conversion to a country code for the a-band EEPROM values is not complete / correct. So far I've been unable to map the possible code described in the EEPROM spec to real country codes.

I recall there would be a possibility to provide a custom definition for the domain, not sure if that ever went in.

Quoted 1 line

2. I'm still puzzled how to handle the two different values that the EEPROM has, namely one for the bg band and one for the a band. I've handled it by registering the one associated with the configured band, but that seems to be unlikely to be correct. I still haven't found a better way to handle this.

Because of this I hadn't looked very deep into rt61 and rt73 yet.

Quoted 1 line

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

GertJan, some comments about your patch:

drivers/net/wireless/rt2x00/rt2400pci.h line 813

Quoted 13 lines
drivers/net/wireless/rt2x00/rt2400pci.h +5 -0
index 9aefda4..986e428 100644
@@ -806,6 +806,13 @@
 #define EEPROM_TXPOWER_2		FIELD16(0xff00)
 
 /*
+ * EEPROM geography.
+ * GEO: Default geography setting for device.
+ */
+#define EEPROM_GEOGRAPHY		0x17
+#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)

Where did you find this definition? I couldn't find it in the legacy driver or the specsheets.

drivers/net/wireless/rt2x00/rt2500pci.h line 1063

Quoted 10 lines
drivers/net/wireless/rt2x00/rt2500pci.h +1 -1
index e135247..8a69af3 100644
@@ -1060,7 +1060,7 @@
  * GEO: Default geography setting for device.
  */
 #define EEPROM_GEOGRAPHY		0x12
-#define EEPROM_GEOGRAPHY_GEO		FIELD16(0x0f00)
+#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)

Legacy driver uses 0x0f00, and the definition indicates the max value is 7, so extending the definition doesn't seem correct.

drivers/net/wireless/rt2x00/rt2500pci.h

Quoted 10 lines
drivers/net/wireless/rt2x00/rt2500pci.h +10 -0
+enum {
+	RT2X00_REGION_FCC = 0,
+	RT2X00_REGION_IC = 1,
+	RT2X00_REGION_ETSI = 2,
+	RT2X00_REGION_SPAIN = 3,
+	RT2X00_REGION_FRANCE = 4,
+	RT2X00_REGION_MKK = 5,
+	RT2X00_REGION_MKK1 = 6,
+	RT2X00_REGION_ISRAEL = 7,
+};

This belongs in rt2x00reg.h with comments (also please give the enum a name, so it can be used as type).

Quoted 26 lines
drivers/net/wireless/rt2x00/rt2500pci.h +26 -0
+static inline char *rt2x00_region2alpha(u16 region)
+{
+	char *alpha2;
+
+	switch (region) {
+	case RT2X00_REGION_FCC:
+		alpha2 = "US";
+		break;
+	case RT2X00_REGION_IC:
+		alpha2 = "CA";
+		break;
+	case RT2X00_REGION_ETSI:
+		alpha2 = "DE";
+		break;
+	case RT2X00_REGION_SPAIN:
+		alpha2 = "ES";
+		break;
+	case RT2X00_REGION_FRANCE:
+		alpha2 = "FR";
+		break;
+	case RT2X00_REGION_MKK:
+		alpha2 = "JP";
+		break;
+	case RT2X00_REGION_MKK1:
+		alpha2 = "JP";
+		break;

drivers/net/wireless/rt2x00/rt2500pci.h

Quoted 10 lines
drivers/net/wireless/rt2x00/rt2500pci.h +10 -0
+	case RT2X00_REGION_ISRAEL:
+		alpha2 = "IL";
+		break;
+	default:
+		alpha2 = NULL;
+		break;
+	}
+
+	return alpha2;
+}

This would look nicer if all the alpha2 codes where either in an array:

static const char* alpha2_map[] = {
	"US",
	"CA",
	...
};

So we can simply translate the enum value to alpha2 by doing:

	alpha2_map[RT2X00_REGION_ETSI]

Or do somthing similar as zd1211rw, with the structure:

struct alpha2_entry {
	enum reg_domain;
	char alpha2[2];
}
static const char* alpha2_map[] = {
	{RT2X00_REGION_FCC, "US"},
	{RT2X00_REGION_IC, "CA"},
	...
};

and a for loop to find the correct alpha2 code.

Thanks

Ivo

#4 lore raw
Quoted 23 lines · Ivo van Doorn
Quoted 8 lines · Gertjan van Wingerde
Quoted 7 lines · Luis R. Rodriguez
Quoted 5 lines · Ivo van Doorn

rt2500pci and rt2500usb contain a special field in the EEPROM which indicates which regulatory domain the card belongs to. This code can easily be translated into a country code which we can send as alpha2 hint for CRDA.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Please note that most cards will have 0xffff as EEPROM value, and thus do not provide a regulatory hint through the EEPROM.

John: Please drop this patch, a more correct patch should be merged later which is based on the code from Gertjan.

Quoted 6 lines
Quoted 6 lines

I believe regulatory_hint() is being called before the ieee80211_register_hw() call. This is not a requirement right now but I believe this should be the case in the future as we want cfg80211 to keep track a few things for the driver, like the regulatory domain it wants in case of conflicts with other drivers. I'm working on this right now so just wanted to throw that out there.

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Is it possible to move the regulatory_hint() to be used after ieee80211_register_hw() is called?

Sure, I was a bit doubting about the timing of the call, I noticed that zd1211rw called it during the start() callback function. Would that be the best location? Or right after ieee80211_register_hw()?

Doesn't really matter, so long as its after ieee80211_register_hw() has been called would be nice.

Quoted 4 lines
Quoted 2 lines

The things that kept me from submitting it so far are:
1. The conversion to a country code for the a-band EEPROM values is not complete / correct. So far I've been unable to map the possible code described in the EEPROM spec to real country codes.

I recall there would be a possibility to provide a custom definition for the domain, not sure if that ever went in.

Nope, we determined its not necessary because it was only required for Intel driver and we found a better solution for them.

Quoted 8 lines
Quoted 1 line

2. I'm still puzzled how to handle the two different values that the EEPROM has, namely one for the bg band and one for the a band. I've handled it by registering the one associated with the configured band, but that seems to be unlikely to be correct. I still haven't found a better way to handle this.

Because of this I hadn't looked very deep into rt61 and rt73 yet.

Quoted 1 line

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

Based on the documentation from the EEPROM for all devices I read that its recommended that the EEPROM *not be relied on for the regulatory domain*, instead it recommends the windows registry be used.

Based on tests for the devices with only one band, do are you seeing an actual regulatory domain in the EEPROM?

To deal with the issue of having two separate EEPROM values for a regulatory domain and since the documentation indicates to not rely on it I would advise to allow users to be compliant by selecting the country they are in. wpa_supplicant has support for selecting country now, and so does iw. Eventually I see Network Manager letting users select the country. But you guys are the maintainers and developers so you will know better.

Luis

#5 lore raw
Quoted 5 lines
Quoted 2 lines

Sure, I was a bit doubting about the timing of the call, I noticed that zd1211rw called it during the start() callback function. Would that be the best location? Or right after ieee80211_register_hw()?

Doesn't really matter, so long as its after ieee80211_register_hw() has been called would be nice.

Ok.

Quoted 9 lines
Quoted 8 lines
Quoted 1 line

2. I'm still puzzled how to handle the two different values that the EEPROM has, namely one for the bg band and one for the a band. I've handled it by registering the one associated with the configured band, but that seems to be unlikely to be correct. I still haven't found a better way to handle this.

Because of this I hadn't looked very deep into rt61 and rt73 yet.

Quoted 1 line

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

Quoted 6 lines

Based on the documentation from the EEPROM for all devices I read that its recommended that the EEPROM *not be relied on for the regulatory domain*, instead it recommends the windows registry be used.

Based on tests for the devices with only one band, do are you seeing an actual regulatory domain in the EEPROM?

I have to check, but I don't think I have any hardware with valid domain values.

Quoted 6 lines

To deal with the issue of having two separate EEPROM values for a regulatory domain and since the documentation indicates to not rely on it I would advise to allow users to be compliant by selecting the country they are in. wpa_supplicant has support for selecting country now, and so does iw. Eventually I see Network Manager letting users select the country. But you guys are the maintainers and developers so you will know better.

Well it is fine with me, understood from earlier discussion that it was advised that drivers attempted to set the domain if they could. Hence the reason I had added reading the EEPROM for domain values to the TODO list. But it is true that it is quite rare that there are valid values for it. So it would be fine with me by letting the user handle it completely.

Ivo

#6 lore raw
Quoted 33 lines · Ivo van Doorn
Quoted 5 lines
Quoted 2 lines

Sure, I was a bit doubting about the timing of the call, I noticed that zd1211rw called it during the start() callback function. Would that be the best location? Or right after ieee80211_register_hw()?

Doesn't really matter, so long as its after ieee80211_register_hw() has been called would be nice.

Ok.

Quoted 9 lines
Quoted 8 lines
Quoted 1 line

2. I'm still puzzled how to handle the two different values that the EEPROM has, namely one for the bg band and one for the a band. I've handled it by registering the one associated with the configured band, but that seems to be unlikely to be correct. I still haven't found a better way to handle this.

Because of this I hadn't looked very deep into rt61 and rt73 yet.

Quoted 1 line

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

Quoted 6 lines

Based on the documentation from the EEPROM for all devices I read that its recommended that the EEPROM *not be relied on for the regulatory domain*, instead it recommends the windows registry be used.

Based on tests for the devices with only one band, do are you seeing an actual regulatory domain in the EEPROM?

I have to check, but I don't think I have any hardware with valid domain values.

Quoted 6 lines

To deal with the issue of having two separate EEPROM values for a regulatory domain and since the documentation indicates to not rely on it I would advise to allow users to be compliant by selecting the country they are in. wpa_supplicant has support for selecting country now, and so does iw. Eventually I see Network Manager letting users select the country. But you guys are the maintainers and developers so you will know better.

Quoted 4 lines

Well it is fine with me, understood from earlier discussion that it was advised that drivers attempted to set the domain if they could. Hence the reason I had added reading the EEPROM for domain values to the TODO list. But it is true that it is quite rare that there are valid values for it. So it would be fine with me by letting the user handle it completely.

I see -- well if there are *some* cards that do have valid EEPROM values then it seems worth it to do the actual regulatory_hint(), for dual band cards you can probably just not support it. But its up to you guys. Just my advice based on the documentation I have read so far.

Luis

#7 lore raw
Quoted 34 lines · Luis R. Rodriguez
Quoted 33 lines · Ivo van Doorn
Quoted 5 lines
Quoted 2 lines

Sure, I was a bit doubting about the timing of the call, I noticed that zd1211rw called it during the start() callback function. Would that be the best location? Or right after ieee80211_register_hw()?

Doesn't really matter, so long as its after ieee80211_register_hw() has been called would be nice.

Ok.

Quoted 9 lines
Quoted 8 lines
Quoted 1 line

2. I'm still puzzled how to handle the two different values that the EEPROM has, namely one for the bg band and one for the a band. I've handled it by registering the one associated with the configured band, but that seems to be unlikely to be correct. I still haven't found a better way to handle this.

Because of this I hadn't looked very deep into rt61 and rt73 yet.

Quoted 1 line

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

Quoted 6 lines

Based on the documentation from the EEPROM for all devices I read that its recommended that the EEPROM *not be relied on for the regulatory domain*, instead it recommends the windows registry be used.

Based on tests for the devices with only one band, do are you seeing an actual regulatory domain in the EEPROM?

I have to check, but I don't think I have any hardware with valid domain values.

Quoted 6 lines

To deal with the issue of having two separate EEPROM values for a regulatory domain and since the documentation indicates to not rely on it I would advise to allow users to be compliant by selecting the country they are in. wpa_supplicant has support for selecting country now, and so does iw. Eventually I see Network Manager letting users select the country. But you guys are the maintainers and developers so you will know better.

Quoted 8 lines
Quoted 4 lines

Well it is fine with me, understood from earlier discussion that it was advised that drivers attempted to set the domain if they could. Hence the reason I had added reading the EEPROM for domain values to the TODO list. But it is true that it is quite rare that there are valid values for it. So it would be fine with me by letting the user handle it completely.

I see -- well if there are *some* cards that do have valid EEPROM values then it seems worth it to do the actual regulatory_hint(), for dual band cards you can probably just not support it. But its up to you guys. Just my advice based on the documentation I have read so far.

Ok.

Gertjan, do you know if there is any hardware with valid GEO data in the EEPROM?

Ivo

#18 lore raw
In reply to Ivo van Doorn
Quoted 36 lines · Ivo van Doorn
Quoted 10 lines · Gertjan van Wingerde
Quoted 8 lines · Luis R. Rodriguez
Quoted 5 lines · Ivo van Doorn

rt2500pci and rt2500usb contain a special field in the EEPROM which indicates which regulatory domain the card belongs to. This code can easily be translated into a country code which we can send as alpha2 hint for CRDA.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Please note that most cards will have 0xffff as EEPROM value, and thus do not provide a regulatory hint through the EEPROM.

John: Please drop this patch, a more correct patch should be merged later which is based on the code from Gertjan.

Quoted 9 lines
Quoted 9 lines

I believe regulatory_hint() is being called before the ieee80211_register_hw() call. This is not a requirement right now but I believe this should be the case in the future as we want cfg80211 to keep track a few things for the driver, like the regulatory domain it wants in case of conflicts with other drivers. I'm working on this right now so just wanted to throw that out there.

Is it possible to move the regulatory_hint() to be used after ieee80211_register_hw() is called?

Sure, I was a bit doubting about the timing of the call, I noticed that zd1211rw called it during the start() callback function. Would that be the best location? Or right after ieee80211_register_hw()?

Quoted 6 lines
Quoted 3 lines

The things that kept me from submitting it so far are:
1. The conversion to a country code for the a-band EEPROM values is not complete / correct. So far I've been unable to map the possible code described in the EEPROM spec to real country codes.

I recall there would be a possibility to provide a custom definition for the domain, not sure if that ever went in.

That possibility has been removed AFAIK.

Quoted 5 lines
Quoted 2 lines

2. I'm still puzzled how to handle the two different values that the EEPROM has, namely one for the bg band and one for the a band. I've handled it by registering the one associated with the configured band, but that seems to be unlikely to be correct. I still haven't found a better way to handle this.

Because of this I hadn't looked very deep into rt61 and rt73 yet.

;-)

Quoted 7 lines
Quoted 3 lines

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

OK. But the EEPROM definitions I got from Ralink on the Country information indicate that there is only a single indication in the EEPROM.

Quoted 10 lines

GertJan, some comments about your patch:

Quoted 7 lines
drivers/net/wireless/rt2x00/rt2400pci.h +0 -0
index 9aefda4..986e428 100644
@@ -806,6 +806,13 @@
  #define EEPROM_TXPOWER_2		FIELD16(0xff00)
 
Quoted 10 lines

drivers/net/wireless/rt2x00/rt2400pci.h

Quoted 7 lines
drivers/net/wireless/rt2x00/rt2400pci.h +5 -0
  /*
+ * EEPROM geography.
+ * GEO: Default geography setting for device.
+ */
+#define EEPROM_GEOGRAPHY		0x17
+#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)
 

Where did you find this definition? I couldn't find it in the legacy driver or the specsheets.

I got an excerpt from the EEPROM definition for the rt2460 chip (which I received with the help of Luis). It's defined in there.

Quoted 16 lines

drivers/net/wireless/rt2x00/rt2500pci.h line 1064

Quoted 12 lines
drivers/net/wireless/rt2x00/rt2500pci.h +1 -1
index e135247..8a69af3 100644
@@ -1060,7 +1060,7 @@
   * GEO: Default geography setting for device.
   */
  #define EEPROM_GEOGRAPHY		0x12
-#define EEPROM_GEOGRAPHY_GEO		FIELD16(0x0f00)
+#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)
 

Legacy driver uses 0x0f00, and the definition indicates the max value is 7, so extending the definition doesn't seem correct.

Well, the EEPROM definition indicates that this is an 8-bit field, so updating it looked appropriate, although the max value indeed is 7.

Quoted 16 lines

drivers/net/wireless/rt2x00/rt2500pci.h

Quoted 12 lines
drivers/net/wireless/rt2x00/rt2500pci.h +10 -0
+enum {
+	RT2X00_REGION_FCC = 0,
+	RT2X00_REGION_IC = 1,
+	RT2X00_REGION_ETSI = 2,
+	RT2X00_REGION_SPAIN = 3,
+	RT2X00_REGION_FRANCE = 4,
+	RT2X00_REGION_MKK = 5,
+	RT2X00_REGION_MKK1 = 6,
+	RT2X00_REGION_ISRAEL = 7,
+};

This belongs in rt2x00reg.h with comments (also please give the enum a name, so it can be used as type).

OK.

Quoted 57 lines
Quoted 28 lines
drivers/net/wireless/rt2x00/rt2500pci.h +26 -0
+static inline char *rt2x00_region2alpha(u16 region)
+{
+	char *alpha2;
+
+	switch (region) {
+	case RT2X00_REGION_FCC:
+		alpha2 = "US";
+		break;
+	case RT2X00_REGION_IC:
+		alpha2 = "CA";
+		break;
+	case RT2X00_REGION_ETSI:
+		alpha2 = "DE";
+		break;
+	case RT2X00_REGION_SPAIN:
+		alpha2 = "ES";
+		break;
+	case RT2X00_REGION_FRANCE:
+		alpha2 = "FR";
+		break;
+	case RT2X00_REGION_MKK:
+		alpha2 = "JP";
+		break;
+	case RT2X00_REGION_MKK1:
+		alpha2 = "JP";
+		break;

drivers/net/wireless/rt2x00/rt2500pci.h

Quoted 10 lines
drivers/net/wireless/rt2x00/rt2500pci.h +10 -0
+	case RT2X00_REGION_ISRAEL:
+		alpha2 = "IL";
+		break;
+	default:
+		alpha2 = NULL;
+		break;
+	}
+
+	return alpha2;
+}

This would look nicer if all the alpha2 codes where either in an array:

static const char* alpha2_map[] = {
	"US",
	"CA",
	...
};

So we can simply translate the enum value to alpha2 by doing:

	alpha2_map[RT2X00_REGION_ETSI]

Or do somthing similar as zd1211rw, with the structure:

struct alpha2_entry {
	enum reg_domain;
	char alpha2[2];
}
Quoted 8 lines
static const char* alpha2_map[] = {
	{RT2X00_REGION_FCC, "US"},
	{RT2X00_REGION_IC, "CA"},
	...
};

and a for loop to find the correct alpha2 code.

OK. I'll work on that when we decide to move ahead with this code.

---
Gertjan.

#13 lore raw
In reply to Luis R. Rodriguez
Quoted 19 lines · Luis R. Rodriguez
Quoted 9 lines · Ivo van Doorn
Quoted 4 lines · Gertjan van Wingerde

On 01/05/09 21:08, Luis R. Rodriguez wrote:

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

Based on the documentation from the EEPROM for all devices I read that its recommended that the EEPROM *not be relied on for the regulatory domain*, instead it recommends the windows registry be used.

Based on tests for the devices with only one band, do are you seeing an actual regulatory domain in the EEPROM?

Quoted 7 lines

To deal with the issue of having two separate EEPROM values for a regulatory domain and since the documentation indicates to not rely on it I would advise to allow users to be compliant by selecting the country they are in. wpa_supplicant has support for selecting country now, and so does iw. Eventually I see Network Manager letting users select the country. But you guys are the maintainers and developers so you will know better.

My tests indicate that there are devices out there that have this information set in the EEPROM. Based on tests with my own patch, and my own devices, I have been able to determine the following:

1. rt2400pci --> don't know, don't own a rt2400pci device.
2. rt2500pci --> don't know, don't own a rt2500pci device anymore.
3. rt2500usb --> my e-tech device (not sure which type; the device doesn't say it) has an actual domain set for the bg band.
4. rt61pci --> my Sitecom WL151 device does not contain actual domain information.
5. rt73usb --> my Sitecom WL113-002 device does contain actual domain information, and the codes for the bg band and a band are the same.
6. rt2800pci --> my Sitecom WL182 device does contain actual domain information, and the codes for the bg band and a band are the same.
7. rt2800usb --> my Sitecom WL181 device does contain actual domain information, and the codes for the bg band and a band are the same.

So, there are devices out there that do contain "meaningful" regulatory information.

Luis, the definitions for the a-band EEPROM codes only give the channel numbers, it doesn't indicate a real "country". Is there any way we can check whether these sets of channels are actually consistent with the regulations of specific countries?

---
Gertjan.

#8 lore raw
In reply to Ivo van Doorn
Quoted 36 lines · Ivo van Doorn
Quoted 34 lines · Luis R. Rodriguez
Quoted 32 lines · Ivo van Doorn
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines

2. I'm still puzzled how to handle the two different values that the EEPROM has, namely one for the bg band and one for the a band. I've handled it by registering the one associated with the configured band, but that seems to be unlikely to be correct. I still haven't found a better way to handle this.

Because of this I hadn't looked very deep into rt61 and rt73 yet.

Quoted 2 lines

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

Quoted 7 lines

Based on the documentation from the EEPROM for all devices I read that its recommended that the EEPROM *not be relied on for the regulatory domain*, instead it recommends the windows registry be used.

Based on tests for the devices with only one band, do are you seeing an actual regulatory domain in the EEPROM?

I have to check, but I don't think I have any hardware with valid domain values.

Quoted 7 lines

To deal with the issue of having two separate EEPROM values for a regulatory domain and since the documentation indicates to not rely on it I would advise to allow users to be compliant by selecting the country they are in. wpa_supplicant has support for selecting country now, and so does iw. Eventually I see Network Manager letting users select the country. But you guys are the maintainers and developers so you will know better.

Well it is fine with me, understood from earlier discussion that it was advised that drivers attempted to set the domain if they could. Hence the reason I had added reading the EEPROM for domain values to the TODO list. But it is true that it is quite rare that there are valid values for it. So it would be fine with me by letting the user handle it completely.

Quoted 9 lines
Quoted 4 lines

I see -- well if there are *some* cards that do have valid EEPROM values then it seems worth it to do the actual regulatory_hint(), for dual band cards you can probably just not support it. But its up to you guys. Just my advice based on the documentation I have read so far.

Ok.

Gertjan, do you know if there is any hardware with valid GEO data in the EEPROM?

As mentioned in my previous email, I do have devices that have valid GEO data in the EEPROM. So, we should be able to use that.
Also, for the dual band cards, it does seem that at least the numerical values are similar for both bands (although I'm not sure that same numerical values means same regulatory domain). This is at least the case on all the cards that I own.

FYI: The legacy drivers do use the information in the EEPROM to initialize the internal administration of regulatory information, but allow the end-user to override that via config-file or via private wext call. It would be good to have a similar possibility for rt2x00.

---
Gertjan.

#14 lore raw
In reply to Gertjan van Wingerde
Quoted 45 lines · Gertjan van Wingerde
Quoted 19 lines · Luis R. Rodriguez
Quoted 9 lines · Ivo van Doorn
Quoted 4 lines · Gertjan van Wingerde

On 01/05/09 21:08, Luis R. Rodriguez wrote:

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

Based on the documentation from the EEPROM for all devices I read that its recommended that the EEPROM *not be relied on for the regulatory domain*, instead it recommends the windows registry be used.

Based on tests for the devices with only one band, do are you seeing an actual regulatory domain in the EEPROM?

Quoted 7 lines

To deal with the issue of having two separate EEPROM values for a regulatory domain and since the documentation indicates to not rely on it I would advise to allow users to be compliant by selecting the country they are in. wpa_supplicant has support for selecting country now, and so does iw. Eventually I see Network Manager letting users select the country. But you guys are the maintainers and developers so you will know better.

My tests indicate that there are devices out there that have this information set in the EEPROM. Based on tests with my own patch, and my own devices, I have been able to determine the following:

1. rt2400pci --> don't know, don't own a rt2400pci device.
2. rt2500pci --> don't know, don't own a rt2500pci device anymore.
3. rt2500usb --> my e-tech device (not sure which type; the device doesn't say it) has an actual domain set for the bg band.
4. rt61pci --> my Sitecom WL151 device does not contain actual domain information.
5. rt73usb --> my Sitecom WL113-002 device does contain actual domain information, and the codes for the bg band and a band are the same.
6. rt2800pci --> my Sitecom WL182 device does contain actual domain information, and the codes for the bg band and a band are the same.
7. rt2800usb --> my Sitecom WL181 device does contain actual domain information, and the codes for the bg band and a band are the same.

Quoted 7 lines

So, there are devices out there that do contain "meaningful" regulatory information.

Luis, the definitions for the a-band EEPROM codes only give the channel numbers, it doesn't indicate a real "country". Is there any way we can check whether these sets of channels are actually consistent with the regulations of specific countries?

You can help contribute to the wireless-regdb and check that the valid channels apply there.

Luis

#9 lore raw
In reply to Gertjan van Wingerde
Quoted 47 lines · Gertjan van Wingerde
Quoted 36 lines · Ivo van Doorn
Quoted 34 lines · Luis R. Rodriguez
Quoted 32 lines · Ivo van Doorn
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines

2. I'm still puzzled how to handle the two different values that the EEPROM has, namely one for the bg band and one for the a band. I've handled it by registering the one associated with the configured band, but that seems to be unlikely to be correct. I still haven't found a better way to handle this.

Because of this I hadn't looked very deep into rt61 and rt73 yet.

Quoted 2 lines

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

Quoted 7 lines

Based on the documentation from the EEPROM for all devices I read that its recommended that the EEPROM *not be relied on for the regulatory domain*, instead it recommends the windows registry be used.

Based on tests for the devices with only one band, do are you seeing an actual regulatory domain in the EEPROM?

I have to check, but I don't think I have any hardware with valid domain values.

Quoted 7 lines

To deal with the issue of having two separate EEPROM values for a regulatory domain and since the documentation indicates to not rely on it I would advise to allow users to be compliant by selecting the country they are in. wpa_supplicant has support for selecting country now, and so does iw. Eventually I see Network Manager letting users select the country. But you guys are the maintainers and developers so you will know better.

Well it is fine with me, understood from earlier discussion that it was advised that drivers attempted to set the domain if they could. Hence the reason I had added reading the EEPROM for domain values to the TODO list. But it is true that it is quite rare that there are valid values for it. So it would be fine with me by letting the user handle it completely.

Quoted 9 lines
Quoted 4 lines

I see -- well if there are *some* cards that do have valid EEPROM values then it seems worth it to do the actual regulatory_hint(), for dual band cards you can probably just not support it. But its up to you guys. Just my advice based on the documentation I have read so far.

Ok.

Gertjan, do you know if there is any hardware with valid GEO data in the EEPROM?

Quoted 6 lines

As mentioned in my previous email, I do have devices that have valid GEO data in the EEPROM. So, we should be able to use that.
Also, for the dual band cards, it does seem that at least the numerical values are similar for both bands (although I'm not sure that same numerical values means same regulatory domain). This is at least the case on all the cards that I own.

If that's the case and since dual band cards will most likely have 2ghz support why not just provide regulatory_hint() based on the 2ghz band all the time?

Quoted 4 lines

FYI: The legacy drivers do use the information in the EEPROM to initialize the internal administration of regulatory information, but allow the end-user to override that via config-file or via private wext call. It would be good to have a similar possibility for rt2x00.

We allow users to change regulatory domain, please see:

http://wireless.kernel.org/en/developers/Regulatory/CRDA#Changingregulatorydomains

Luis

#10 lore raw
Quoted 55 lines · Luis R. Rodriguez
Quoted 47 lines · Gertjan van Wingerde
Quoted 36 lines · Ivo van Doorn
Quoted 34 lines · Luis R. Rodriguez
Quoted 32 lines · Ivo van Doorn
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines

2. I'm still puzzled how to handle the two different values that the EEPROM has, namely one for the bg band and one for the a band. I've handled it by registering the one associated with the configured band, but that seems to be unlikely to be correct. I still haven't found a better way to handle this.

Because of this I hadn't looked very deep into rt61 and rt73 yet.

Quoted 2 lines

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

Quoted 7 lines

Based on the documentation from the EEPROM for all devices I read that its recommended that the EEPROM *not be relied on for the regulatory domain*, instead it recommends the windows registry be used.

Based on tests for the devices with only one band, do are you seeing an actual regulatory domain in the EEPROM?

I have to check, but I don't think I have any hardware with valid domain values.

Quoted 7 lines

To deal with the issue of having two separate EEPROM values for a regulatory domain and since the documentation indicates to not rely on it I would advise to allow users to be compliant by selecting the country they are in. wpa_supplicant has support for selecting country now, and so does iw. Eventually I see Network Manager letting users select the country. But you guys are the maintainers and developers so you will know better.

Well it is fine with me, understood from earlier discussion that it was advised that drivers attempted to set the domain if they could. Hence the reason I had added reading the EEPROM for domain values to the TODO list. But it is true that it is quite rare that there are valid values for it. So it would be fine with me by letting the user handle it completely.

Quoted 9 lines
Quoted 4 lines

I see -- well if there are *some* cards that do have valid EEPROM values then it seems worth it to do the actual regulatory_hint(), for dual band cards you can probably just not support it. But its up to you guys. Just my advice based on the documentation I have read so far.

Ok.

Gertjan, do you know if there is any hardware with valid GEO data in the EEPROM?

Quoted 6 lines

As mentioned in my previous email, I do have devices that have valid GEO data in the EEPROM. So, we should be able to use that.
Also, for the dual band cards, it does seem that at least the numerical values are similar for both bands (although I'm not sure that same numerical values means same regulatory domain). This is at least the case on all the cards that I own.

Quoted 2 lines

If that's the case and since dual band cards will most likely have 2ghz support why not just provide regulatory_hint() based on the 2ghz band all the time?

Sounds like the most reasonable solution to me as well.

Ivo

#19 lore raw
In reply to Gertjan van Wingerde
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

OK. But the EEPROM definitions I got from Ralink on the Country information indicate that there is only a single indication in the EEPROM.

That is right, like I said the comments already indicates there the legacy code didn't contain the definitions (yet). ;)

Quoted 21 lines
Quoted 10 lines

GertJan, some comments about your patch:

Quoted 7 lines
drivers/net/wireless/rt2x00/rt2400pci.h +0 -0
index 9aefda4..986e428 100644
@@ -806,6 +806,13 @@
  #define EEPROM_TXPOWER_2		FIELD16(0xff00)
 
Quoted 10 lines

drivers/net/wireless/rt2x00/rt2400pci.h

Quoted 7 lines
drivers/net/wireless/rt2x00/rt2400pci.h +5 -0
  /*
+ * EEPROM geography.
+ * GEO: Default geography setting for device.
+ */
+#define EEPROM_GEOGRAPHY		0x17
+#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)
 

Where did you find this definition? I couldn't find it in the legacy driver or the specsheets.

Quoted 2 lines

I got an excerpt from the EEPROM definition for the rt2460 chip (which I received with the help of Luis). It's defined in there.

I assume you mean the file RT2460_DS_P1.3.pdf, could you point me to the right pagenumber?

Quoted 16 lines
Quoted 6 lines
Quoted 6 lines
drivers/net/wireless/rt2x00/rt2500pci.h +0 -0
index e135247..8a69af3 100644
@@ -1060,7 +1060,7 @@
   * GEO: Default geography setting for device.
Quoted 9 lines

drivers/net/wireless/rt2x00/rt2500pci.h line 1064

Quoted 5 lines
drivers/net/wireless/rt2x00/rt2500pci.h +1 -1
   */
  #define EEPROM_GEOGRAPHY		0x12
-#define EEPROM_GEOGRAPHY_GEO		FIELD16(0x0f00)
+#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)
 

Legacy driver uses 0x0f00, and the definition indicates the max value is 7, so extending the definition doesn't seem correct.

Quoted 2 lines

Well, the EEPROM definition indicates that this is an 8-bit field, so updating it looked appropriate, although the max value indeed is 7.

Ok, apparently I messed up the code interpretation. :S, the change from 0xf to 0xff is fine.

Ivo

#20 lore raw
Quoted 39 lines · Ivo van Doorn
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

Quoted 7 lines
Quoted 4 lines

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

OK. But the EEPROM definitions I got from Ralink on the Country information indicate that there is only a single indication in the EEPROM.

That is right, like I said the comments already indicates there the legacy code didn't contain the definitions (yet). ;)

Quoted 22 lines
Quoted 22 lines

GertJan, some comments about your patch:

Quoted 5 lines
drivers/net/wireless/rt2x00/rt2400pci.h +0 -0
index 9aefda4..986e428 100644

drivers/net/wireless/rt2x00/rt2400pci.h line 815

Quoted 10 lines
drivers/net/wireless/rt2x00/rt2400pci.h +5 -0
@@ -806,6 +806,13 @@
   #define EEPROM_TXPOWER_2		FIELD16(0xff00)
 
   /*
+ * EEPROM geography.
+ * GEO: Default geography setting for device.
+ */
+#define EEPROM_GEOGRAPHY		0x17
+#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)
 
 

Where did you find this definition? I couldn't find it in the legacy driver or the specsheets.

Quoted 7 lines
Quoted 3 lines

I got an excerpt from the EEPROM definition for the rt2460 chip (which I received with the help of Luis). It's defined in there.

I assume you mean the file RT2460_DS_P1.3.pdf, could you point me to the right pagenumber?

No, I meant RT2460_EEPROM_Channels.pdf, which was sent by Ralink a couple of months ago. You were copied on the email; let me know if you can't find them. Note that these were only small excerpts from the entire EEPROM definitions, only the parts on geography information.

---
Gertjan.

#21 lore raw
Quoted 44 lines · Gertjan van Wingerde
Quoted 43 lines · Ivo van Doorn
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

Quoted 7 lines
Quoted 4 lines

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

OK. But the EEPROM definitions I got from Ralink on the Country information indicate that there is only a single indication in the EEPROM.

That is right, like I said the comments already indicates there the legacy code didn't contain the definitions (yet). ;)

Quoted 25 lines
Quoted 11 lines

GertJan, some comments about your patch:

Quoted 7 lines
drivers/net/wireless/rt2x00/rt2400pci.h +0 -0
index 9aefda4..986e428 100644
@@ -806,6 +806,13 @@
   #define EEPROM_TXPOWER_2		FIELD16(0xff00)
 
Quoted 11 lines

drivers/net/wireless/rt2x00/rt2400pci.h

Quoted 8 lines
drivers/net/wireless/rt2x00/rt2400pci.h +5 -0
   /*
+ * EEPROM geography.
+ * GEO: Default geography setting for device.
+ */
+#define EEPROM_GEOGRAPHY		0x17
+#define EEPROM_GEOGRAPHY_GEO		FIELD16(0xff00)
 
 

Where did you find this definition? I couldn't find it in the legacy driver or the specsheets.

I got an excerpt from the EEPROM definition for the rt2460 chip (which I received with the help of Luis). It's defined in there.

Quoted 7 lines
Quoted 3 lines

I assume you mean the file RT2460_DS_P1.3.pdf, could you point me to the right pagenumber?

No, I meant RT2460_EEPROM_Channels.pdf, which was sent by Ralink a couple of months ago. You were copied on the email; let me know if you can't find them. Note that these were only small excerpts from the entire EEPROM definitions, only the parts on geography information.

ah those, I thought they only contained the valid values. :S well ok, that means that this part of the patch is correct as well. :)

Ivo

#15 lore raw
In reply to Luis R. Rodriguez
Quoted 54 lines · Luis R. Rodriguez
Quoted 52 lines · Gertjan van Wingerde
Quoted 22 lines · Luis R. Rodriguez
Quoted 12 lines · Ivo van Doorn
Quoted 5 lines · Gertjan van Wingerde

On 01/05/09 21:08, Luis R. Rodriguez wrote:

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

Based on the documentation from the EEPROM for all devices I read that its recommended that the EEPROM *not be relied on for the regulatory domain*, instead it recommends the windows registry be used.

Based on tests for the devices with only one band, do are you seeing an actual regulatory domain in the EEPROM?

Quoted 8 lines

To deal with the issue of having two separate EEPROM values for a regulatory domain and since the documentation indicates to not rely on it I would advise to allow users to be compliant by selecting the country they are in. wpa_supplicant has support for selecting country now, and so does iw. Eventually I see Network Manager letting users select the country. But you guys are the maintainers and developers so you will know better.

My tests indicate that there are devices out there that have this information set in the EEPROM. Based on tests with my own patch, and my own devices, I have been able to determine the following:

1. rt2400pci -->  don't know, don't own a rt2400pci device.
2. rt2500pci -->  don't know, don't own a rt2500pci device anymore.
3. rt2500usb -->  my e-tech device (not sure which type; the device

doesn't say it) has an actual domain set for the bg band.
4. rt61pci --> my Sitecom WL151 device does not contain actual domain information.
5. rt73usb --> my Sitecom WL113-002 device does contain actual domain information, and the codes for the bg band and a band are the same.
6. rt2800pci --> my Sitecom WL182 device does contain actual domain information, and the codes for the bg band and a band are the same.
7. rt2800usb --> my Sitecom WL181 device does contain actual domain information, and the codes for the bg band and a band are the same.

So, there are devices out there that do contain "meaningful" regulatory information.

Quoted 9 lines
Quoted 5 lines

Luis, the definitions for the a-band EEPROM codes only give the channel numbers, it doesn't indicate a real "country". Is there any way we can check whether these sets of channels are actually consistent with the regulations of specific countries?

You can help contribute to the wireless-regdb and check that the valid channels apply there.

Well, the trouble I'm having is to match the allowed values and channels against the regdb, to see to which countries each of the values map, if any. I'm a bit illiterate on channel assignments etc., so I don't know how to do the math from channel number to frequency, and all the other stuff that is in the regdb.

---
Gertjan.

#22 lore raw
In reply to Gertjan van Wingerde
Quoted 63 lines · Gertjan van Wingerde
Quoted 53 lines · Ivo van Doorn
Quoted 15 lines
Quoted 8 lines
Quoted 7 lines

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

Quoted 6 lines

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist),
comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

Quoted 4 lines

OK. But the EEPROM definitions I got from Ralink on the Country information indicate that there is only a single indication in the EEPROM.

That is right, like I said the comments already indicates there the legacy code didn't contain the
definitions (yet). ;)

Quoted 28 lines
Quoted 27 lines

GertJan, some comments about your patch:

Quoted 7 lines
drivers/net/wireless/rt2x00/rt2400pci.h +0 -0
index 9aefda4..986e428 100644

drivers/net/wireless/rt2x00/rt2400pci.h line 815

Quoted 10 lines
drivers/net/wireless/rt2x00/rt2400pci.h +5 -0
@@ -806,6 +806,13 @@
  #define EEPROM_TXPOWER_2             FIELD16(0xff00)
 
  /*
+ * EEPROM geography.
+ * GEO: Default geography setting for device.
+ */
+#define EEPROM_GEOGRAPHY               0x17
+#define EEPROM_GEOGRAPHY_GEO           FIELD16(0xff00)
 
 

Where did you find this definition? I couldn't find it in the legacy driver or the specsheets.

Quoted 8 lines
Quoted 3 lines

I got an excerpt from the EEPROM definition for the rt2460 chip (which I received with the help of Luis). It's defined in there.

I assume you mean the file RT2460_DS_P1.3.pdf, could you point me to the right pagenumber?

Quoted 4 lines

No, I meant RT2460_EEPROM_Channels.pdf, which was sent by Ralink a couple of months ago. You were copied on the email; let me know if you can't find them. Note that these were only small excerpts from the entire EEPROM definitions, only the parts on geography information.

BTW we received permission from Ralink to put these up so they are also here:

http://wireless.kernel.org/en/developers/Documentation/specs#Ralinkdocumentation

Luis

#16 lore raw
In reply to Gertjan van Wingerde
Quoted 84 lines · Gertjan van Wingerde
Quoted 73 lines · Luis R. Rodriguez
Quoted 70 lines · Gertjan van Wingerde
Quoted 33 lines · Luis R. Rodriguez
Quoted 12 lines · Ivo van Doorn
Quoted 7 lines · Gertjan van Wingerde

On 01/05/09 21:08, Luis R. Rodriguez wrote:

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

Quoted 6 lines

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist),
comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

Based on the documentation from the EEPROM for all devices I read that its recommended
that the EEPROM *not be relied on for the regulatory domain*, instead it recommends the
windows registry be used.

Based on tests for the devices with only one band, do are you seeing an actual regulatory
domain in the EEPROM?

Quoted 13 lines

To deal with the issue of having two separate EEPROM values for a regulatory domain
and since the documentation indicates to not rely on it I would advise to allow users
to be compliant by selecting the country they are in. wpa_supplicant has support for
selecting country now, and so does iw. Eventually I see Network Manager letting users
select the country. But you guys are the maintainers and developers so you will know
better.

My tests indicate that there are devices out there that have this information set in the EEPROM. Based on tests with my own patch, and my own devices, I have been able to determine the following:

1. rt2400pci -->  don't know, don't own a rt2400pci device.
2. rt2500pci -->  don't know, don't own a rt2500pci device anymore.
3. rt2500usb -->  my e-tech device (not sure which type; the device

doesn't say it) has an actual domain set for the bg band.
4. rt61pci --> my Sitecom WL151 device does not contain actual domain information.
5. rt73usb --> my Sitecom WL113-002 device does contain actual domain information, and the codes for the bg band and a band are the same.
6. rt2800pci --> my Sitecom WL182 device does contain actual domain information, and the codes for the bg band and a band are the same.
7. rt2800usb --> my Sitecom WL181 device does contain actual domain information, and the codes for the bg band and a band are the same.

So, there are devices out there that do contain "meaningful" regulatory information.

Quoted 9 lines
Quoted 5 lines

Luis, the definitions for the a-band EEPROM codes only give the channel numbers, it doesn't indicate a real "country". Is there any way we can check whether these sets of channels are actually consistent with the regulations of specific countries?

You can help contribute to the wireless-regdb and check that the valid channels apply there.

Quoted 5 lines

Well, the trouble I'm having is to match the allowed values and channels against the regdb, to see to which countries each of the values map, if any. I'm a bit illiterate on channel assignments etc., so I don't know how to do the math from channel number to frequency, and all the other stuff that is in the regdb.

Look at net/wireless/util.c ieee80211_channel_to_frequency() for how to do this. If all you have is channel maps then just focus on that then.

Luis

#11 lore raw
In reply to Ivo van Doorn
Quoted 69 lines · Ivo van Doorn
Quoted 67 lines · Luis R. Rodriguez
Quoted 65 lines · Gertjan van Wingerde
Quoted 46 lines · Ivo van Doorn
Quoted 43 lines · Luis R. Rodriguez
Quoted 40 lines · Ivo van Doorn
Quoted 14 lines
Quoted 7 lines
Quoted 3 lines

2. I'm still puzzled how to handle the two different values that the EEPROM has, namely one for the bg band and one for the a band. I've handled it by registering the one associated with the configured band, but that seems to be unlikely to be correct. I still haven't found a better way to handle this.

Because of this I hadn't looked very deep into rt61 and rt73 yet.

Quoted 7 lines
Quoted 3 lines

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist), comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

Quoted 8 lines

Based on the documentation from the EEPROM for all devices I read that its recommended that the EEPROM *not be relied on for the regulatory domain*, instead it recommends the windows registry be used.

Based on tests for the devices with only one band, do are you seeing an actual regulatory domain in the EEPROM?

I have to check, but I don't think I have any hardware with valid domain values.

Quoted 8 lines

To deal with the issue of having two separate EEPROM values for a regulatory domain and since the documentation indicates to not rely on it I would advise to allow users to be compliant by selecting the country they are in. wpa_supplicant has support for selecting country now, and so does iw. Eventually I see Network Manager letting users select the country. But you guys are the maintainers and developers so you will know better.

Well it is fine with me, understood from earlier discussion that it was advised that drivers attempted to set the domain if they could. Hence the reason I had added reading the EEPROM for domain values to the TODO list. But it is true that it is quite rare that there are valid values for it. So it would be fine with me by letting the user handle it completely.

Quoted 10 lines
Quoted 5 lines

I see -- well if there are *some* cards that do have valid EEPROM values then it seems worth it to do the actual regulatory_hint(), for dual band cards you can probably just not support it. But its up to you guys. Just my advice based on the documentation I have read so far.

Ok.

Gertjan, do you know if there is any hardware with valid GEO data in the EEPROM?

As mentioned in my previous email, I do have devices that have valid GEO data in the EEPROM. So, we should be able to use that.
Also, for the dual band cards, it does seem that at least the numerical values are similar for both bands (although I'm not sure that same numerical values means same regulatory domain). This is at least the case on all the cards that I own.

Quoted 5 lines
Quoted 3 lines

If that's the case and since dual band cards will most likely have 2ghz support why not just provide regulatory_hint() based on the 2ghz band all the time?

Sounds like the most reasonable solution to me as well.

I had a *slightly* more sophisticated model in mind: Check for dual-band devices whether the EEPROM values match. If they do, provide the regulatory_hint(), if they don't then just log an error, stating that the EEPROM cannot make up its mind in which geography it belongs. Just to prevent some unexpected behavior for devices that don't have sane EEPROM values.

However, that is all based on the assumption that we can match the numerical values of the two band geography domains. So far I haven't been able to establish that, and, moreover, the a-band field allows for values 0-10 where the bg-band field allows for values 0-7. So, we have to start matching these values against their defined allowed channels, and against the regulatory definitions, to see if we can actually match the values.

---
Gertjan

#17 lore raw
In reply to Luis R. Rodriguez
Quoted 94 lines · Luis R. Rodriguez
Quoted 84 lines · Gertjan van Wingerde
Quoted 72 lines · Luis R. Rodriguez
Quoted 69 lines · Gertjan van Wingerde
Quoted 32 lines · Luis R. Rodriguez
Quoted 11 lines · Ivo van Doorn
Quoted 7 lines · Gertjan van Wingerde

On 01/05/09 21:08, Luis R. Rodriguez wrote:

The problem isn't there for the bits that Ivo sent, as the rt2500 devices don't support the a band.

Quoted 7 lines

For rt2500pci and rt2500usb there are chipsets which support 5GHz (they are rare, but they do exist),
comments for the Ralink drivers indicate they simply didn't add the regulatory domain definitions yet.

Based on the documentation from the EEPROM for all devices I read that its recommended
that the EEPROM *not be relied on for the regulatory domain*, instead it recommends the
windows registry be used.

Based on tests for the devices with only one band, do are you seeing an actual regulatory
domain in the EEPROM?

Quoted 14 lines

To deal with the issue of having two separate EEPROM values for a regulatory domain
and since the documentation indicates to not rely on it I would advise to allow users
to be compliant by selecting the country they are in. wpa_supplicant has support for
selecting country now, and so does iw. Eventually I see Network Manager letting users
select the country. But you guys are the maintainers and developers so you will know
better.

My tests indicate that there are devices out there that have this information set in the EEPROM. Based on tests with my own patch, and my own devices, I have been able to determine the following:

1. rt2400pci -->   don't know, don't own a rt2400pci device.
2. rt2500pci -->   don't know, don't own a rt2500pci device anymore.
3. rt2500usb -->   my e-tech device (not sure which type; the device

doesn't say it) has an actual domain set for the bg band.
4. rt61pci --> my Sitecom WL151 device does not contain actual domain
information.
5. rt73usb --> my Sitecom WL113-002 device does contain actual domain
information, and the codes for the bg band and a band are the same.
6. rt2800pci --> my Sitecom WL182 device does contain actual domain
information, and the codes for the bg band and a band are the same.
7. rt2800usb --> my Sitecom WL181 device does contain actual domain
information, and the codes for the bg band and a band are the same.

So, there are devices out there that do contain "meaningful" regulatory information.

Quoted 10 lines
Quoted 6 lines

Luis, the definitions for the a-band EEPROM codes only give the channel numbers, it doesn't indicate a real "country". Is there any way we can check whether these sets of channels are actually consistent with the regulations of specific countries?

You can help contribute to the wireless-regdb and check that the valid channels apply there.

Quoted 6 lines

Well, the trouble I'm having is to match the allowed values and channels against the regdb, to see to which countries each of the values map, if any. I'm a bit illiterate on channel assignments etc., so I don't know how to do the math from channel number to frequency, and all the other stuff that is in the regdb.

Quoted 4 lines

Look at net/wireless/util.c ieee80211_channel_to_frequency() for how to do this. If all you have is channel maps then just focus on that then.

OK. Will have a look at that. This will have to wait until the weekend tho (need to travel for work for the rest of the week).

---
Gertjan.

#12 lore raw
In reply to Gertjan van Wingerde
Quoted 17 lines · Gertjan van Wingerde
Quoted 16 lines · Ivo van Doorn
Quoted 14 lines · Luis R. Rodriguez
Quoted 11 lines
Quoted 4 lines

Gertjan, do you know if there is any hardware with valid GEO data in the EEPROM?

As mentioned in my previous email, I do have devices that have valid GEO data in the EEPROM. So, we should be able to use that.
Also, for the dual band cards, it does seem that at least the numerical values are similar for both bands (although I'm not sure that same numerical values means same regulatory domain). This is at least the case on all the cards that I own.

If that's the case and since dual band cards will most likely have 2ghz support why not just provide regulatory_hint() based on the 2ghz band all the time?

Quoted 8 lines
Quoted 1 line

Sounds like the most reasonable solution to me as well.

I had a *slightly* more sophisticated model in mind: Check for dual-band devices whether the EEPROM values match. If they do, provide the regulatory_hint(), if they don't then just log an error, stating that the EEPROM cannot make up its mind in which geography it belongs. Just to prevent some unexpected behavior for devices that don't have sane EEPROM values.

The documentation advises for the EEPROM to not be relied on though so if you expect the EEPROM regulatory domain code to be valid you are going against the documentation.

Quoted 7 lines

However, that is all based on the assumption that we can match the numerical values of the two band geography domains. So far I haven't been able to establish that, and, moreover, the a-band field allows for values 0-10 where the bg-band field allows for values 0-7. So, we have to start matching these values against their defined allowed channels, and against the regulatory definitions, to see if we can actually match the values.

Yeah -- pretty messy...

BTW you may want to look at the patch:

[PATCH 05/12] cfg80211: add regulatory_set_custom_rd()

Which you can also use if you have very custom regulatory domains which you must follow. We are using that for world regulatory domains which are custom, for example. I would advise against using this for a country regulatory hint but if you have no other option then that can be used.

I'm still inclined to believe the documentation though -- again you may want to check with the vendor.

Luis