aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2012-07-15 18:44:58 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-07-17 15:11:36 -0400
commit20d2ebe512b9ad0f8fdd867a02d7a309344e8a6a (patch)
tree76e653b348d665145c37bd5e6943396b28f6aa25 /drivers/net/wireless/libertas
parent08a4a1ab0725d89ca1df80f2ebe8443da82cd34f (diff)
libertas: Update 11d info only when interface is active
reg_notifier can be called before the interface is up. Handle this correctly by storing the requested country code, then apply the relevant configuration when the interface is brought up. Signed-off-by: Daniel Drake <dsd@laptop.org> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r--drivers/net/wireless/libertas/cfg.c6
-rw-r--r--drivers/net/wireless/libertas/cmd.c19
-rw-r--r--drivers/net/wireless/libertas/cmd.h4
-rw-r--r--drivers/net/wireless/libertas/dev.h1
-rw-r--r--drivers/net/wireless/libertas/main.c6
5 files changed, 22 insertions, 14 deletions
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 706781316195..eb5de800ed90 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -2180,13 +2180,15 @@ int lbs_reg_notifier(struct wiphy *wiphy,
2180 struct regulatory_request *request) 2180 struct regulatory_request *request)
2181{ 2181{
2182 struct lbs_private *priv = wiphy_priv(wiphy); 2182 struct lbs_private *priv = wiphy_priv(wiphy);
2183 int ret; 2183 int ret = 0;
2184 2184
2185 lbs_deb_enter_args(LBS_DEB_CFG80211, "cfg80211 regulatory domain " 2185 lbs_deb_enter_args(LBS_DEB_CFG80211, "cfg80211 regulatory domain "
2186 "callback for domain %c%c\n", request->alpha2[0], 2186 "callback for domain %c%c\n", request->alpha2[0],
2187 request->alpha2[1]); 2187 request->alpha2[1]);
2188 2188
2189 ret = lbs_set_11d_domain_info(priv, request, wiphy->bands); 2189 memcpy(priv->country_code, request->alpha2, sizeof(request->alpha2));
2190 if (lbs_iface_active(priv))
2191 ret = lbs_set_11d_domain_info(priv);
2190 2192
2191 lbs_deb_leave(LBS_DEB_CFG80211); 2193 lbs_deb_leave(LBS_DEB_CFG80211);
2192 return ret; 2194 return ret;
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index d798bcc0d83a..dd0743c42b47 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -733,15 +733,13 @@ int lbs_get_rssi(struct lbs_private *priv, s8 *rssi, s8 *nf)
733 * to the firmware 733 * to the firmware
734 * 734 *
735 * @priv: pointer to &struct lbs_private 735 * @priv: pointer to &struct lbs_private
736 * @request: cfg80211 regulatory request structure
737 * @bands: the device's supported bands and channels
738 * 736 *
739 * returns: 0 on success, error code on failure 737 * returns: 0 on success, error code on failure
740*/ 738*/
741int lbs_set_11d_domain_info(struct lbs_private *priv, 739int lbs_set_11d_domain_info(struct lbs_private *priv)
742 struct regulatory_request *request,
743 struct ieee80211_supported_band **bands)
744{ 740{
741 struct wiphy *wiphy = priv->wdev->wiphy;
742 struct ieee80211_supported_band **bands = wiphy->bands;
745 struct cmd_ds_802_11d_domain_info cmd; 743 struct cmd_ds_802_11d_domain_info cmd;
746 struct mrvl_ie_domain_param_set *domain = &cmd.domain; 744 struct mrvl_ie_domain_param_set *domain = &cmd.domain;
747 struct ieee80211_country_ie_triplet *t; 745 struct ieee80211_country_ie_triplet *t;
@@ -752,21 +750,23 @@ int lbs_set_11d_domain_info(struct lbs_private *priv,
752 u8 first_channel = 0, next_chan = 0, max_pwr = 0; 750 u8 first_channel = 0, next_chan = 0, max_pwr = 0;
753 u8 i, flag = 0; 751 u8 i, flag = 0;
754 size_t triplet_size; 752 size_t triplet_size;
755 int ret; 753 int ret = 0;
756 754
757 lbs_deb_enter(LBS_DEB_11D); 755 lbs_deb_enter(LBS_DEB_11D);
756 if (!priv->country_code[0])
757 goto out;
758 758
759 memset(&cmd, 0, sizeof(cmd)); 759 memset(&cmd, 0, sizeof(cmd));
760 cmd.action = cpu_to_le16(CMD_ACT_SET); 760 cmd.action = cpu_to_le16(CMD_ACT_SET);
761 761
762 lbs_deb_11d("Setting country code '%c%c'\n", 762 lbs_deb_11d("Setting country code '%c%c'\n",
763 request->alpha2[0], request->alpha2[1]); 763 priv->country_code[0], priv->country_code[1]);
764 764
765 domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN); 765 domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN);
766 766
767 /* Set country code */ 767 /* Set country code */
768 domain->country_code[0] = request->alpha2[0]; 768 domain->country_code[0] = priv->country_code[0];
769 domain->country_code[1] = request->alpha2[1]; 769 domain->country_code[1] = priv->country_code[1];
770 domain->country_code[2] = ' '; 770 domain->country_code[2] = ' ';
771 771
772 /* Now set up the channel triplets; firmware is somewhat picky here 772 /* Now set up the channel triplets; firmware is somewhat picky here
@@ -848,6 +848,7 @@ int lbs_set_11d_domain_info(struct lbs_private *priv,
848 848
849 ret = lbs_cmd_with_response(priv, CMD_802_11D_DOMAIN_INFO, &cmd); 849 ret = lbs_cmd_with_response(priv, CMD_802_11D_DOMAIN_INFO, &cmd);
850 850
851out:
851 lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret); 852 lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
852 return ret; 853 return ret;
853} 854}
diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h
index b280ef7a0aea..ab07608e13d0 100644
--- a/drivers/net/wireless/libertas/cmd.h
+++ b/drivers/net/wireless/libertas/cmd.h
@@ -128,9 +128,7 @@ int lbs_set_monitor_mode(struct lbs_private *priv, int enable);
128 128
129int lbs_get_rssi(struct lbs_private *priv, s8 *snr, s8 *nf); 129int lbs_get_rssi(struct lbs_private *priv, s8 *snr, s8 *nf);
130 130
131int lbs_set_11d_domain_info(struct lbs_private *priv, 131int lbs_set_11d_domain_info(struct lbs_private *priv);
132 struct regulatory_request *request,
133 struct ieee80211_supported_band **bands);
134 132
135int lbs_get_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 *value); 133int lbs_get_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 *value);
136 134
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index 60996ce89f77..6bd1608992b0 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -49,6 +49,7 @@ struct lbs_private {
49 bool wiphy_registered; 49 bool wiphy_registered;
50 struct cfg80211_scan_request *scan_req; 50 struct cfg80211_scan_request *scan_req;
51 u8 assoc_bss[ETH_ALEN]; 51 u8 assoc_bss[ETH_ALEN];
52 u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
52 u8 disassoc_reason; 53 u8 disassoc_reason;
53 54
54 /* Mesh */ 55 /* Mesh */
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index e96ee0aa8439..58048189bd24 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -152,6 +152,12 @@ int lbs_start_iface(struct lbs_private *priv)
152 goto err; 152 goto err;
153 } 153 }
154 154
155 ret = lbs_set_11d_domain_info(priv);
156 if (ret) {
157 lbs_deb_net("set 11d domain info failed\n");
158 goto err;
159 }
160
155 lbs_update_channel(priv); 161 lbs_update_channel(priv);
156 162
157 priv->iface_running = true; 163 priv->iface_running = true;