aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBing Zhao <bzhao@marvell.com>2013-12-13 21:32:59 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-12-18 15:23:06 -0500
commitdd4a9ac05c8e17f40427878f379123263333bcd7 (patch)
tree4c8a2e83b47a4d3a56a7844705d0d774f08d9976
parent935d00ccf7321d704a1bf8e982dd6934165c1327 (diff)
mwifiex: send regulatory domain info to firmware only if alpha2 changed
On cfg80211 regulatory domain change, drivers gets alpha2 country code or "00" in driver's notification handler. In most cases, the pattern will be US, 00, US, 00, US, 00, US, ... There is no need to send domain info to firmware in case of "00" or with the same alpha2 country code. Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c19
-rw-r--r--drivers/net/wireless/mwifiex/sta_ioctl.c8
2 files changed, 21 insertions, 6 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 3ff28c2149ce..ae12aaa793a1 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -542,19 +542,26 @@ static void mwifiex_reg_notifier(struct wiphy *wiphy,
542 wiphy_dbg(wiphy, "info: cfg80211 regulatory domain callback for %c%c\n", 542 wiphy_dbg(wiphy, "info: cfg80211 regulatory domain callback for %c%c\n",
543 request->alpha2[0], request->alpha2[1]); 543 request->alpha2[0], request->alpha2[1]);
544 544
545 memcpy(adapter->country_code, request->alpha2, sizeof(request->alpha2));
546
547 switch (request->initiator) { 545 switch (request->initiator) {
548 case NL80211_REGDOM_SET_BY_DRIVER: 546 case NL80211_REGDOM_SET_BY_DRIVER:
549 case NL80211_REGDOM_SET_BY_CORE: 547 case NL80211_REGDOM_SET_BY_CORE:
550 case NL80211_REGDOM_SET_BY_USER: 548 case NL80211_REGDOM_SET_BY_USER:
551 break;
552 /* Todo: apply driver specific changes in channel flags based
553 on the request initiator if necessary. */
554 case NL80211_REGDOM_SET_BY_COUNTRY_IE: 549 case NL80211_REGDOM_SET_BY_COUNTRY_IE:
555 break; 550 break;
551 default:
552 wiphy_err(wiphy, "unknown regdom initiator: %d\n",
553 request->initiator);
554 return;
555 }
556
557 /* Don't send world or same regdom info to firmware */
558 if (strncmp(request->alpha2, "00", 2) &&
559 strncmp(request->alpha2, adapter->country_code,
560 sizeof(request->alpha2))) {
561 memcpy(adapter->country_code, request->alpha2,
562 sizeof(request->alpha2));
563 mwifiex_send_domain_info_cmd_fw(wiphy);
556 } 564 }
557 mwifiex_send_domain_info_cmd_fw(wiphy);
558} 565}
559 566
560/* 567/*
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index a09398fe9e2a..85f419825ecf 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -205,6 +205,14 @@ static int mwifiex_process_country_ie(struct mwifiex_private *priv,
205 return 0; 205 return 0;
206 } 206 }
207 207
208 if (!strncmp(priv->adapter->country_code, &country_ie[2], 2)) {
209 rcu_read_unlock();
210 wiphy_dbg(priv->wdev->wiphy,
211 "11D: skip setting domain info in FW\n");
212 return 0;
213 }
214 memcpy(priv->adapter->country_code, &country_ie[2], 2);
215
208 domain_info->country_code[0] = country_ie[2]; 216 domain_info->country_code[0] = country_ie[2];
209 domain_info->country_code[1] = country_ie[3]; 217 domain_info->country_code[1] = country_ie[3];
210 domain_info->country_code[2] = ' '; 218 domain_info->country_code[2] = ' ';