aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorAvinash Patil <patila@marvell.com>2012-05-08 21:30:27 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-05-16 12:46:36 -0400
commite76268da22f9dbe8794d68e6a504a781dfd36998 (patch)
treee633bdcca6ff46a4148ae24e0ef2f85e12e80dc8 /drivers/net/wireless
parentf752dcd52923b8de82881cf1269f0dc03dbd1088 (diff)
mwifiex: rearrange AP sys configure code
This patch takes into account AP config_type (bss config/custom ie config) while preparing AP sys_configure command buffer. Signed-off-by: Avinash Patil <patila@marvell.com> Signed-off-by: Kiran Divekar <dkiran@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c5
-rw-r--r--drivers/net/wireless/mwifiex/fw.h2
-rw-r--r--drivers/net/wireless/mwifiex/uap_cmd.c62
3 files changed, 48 insertions, 21 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 6c343218d9f0..d305b373aee0 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -502,7 +502,7 @@ mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
502 ret = mwifiex_send_cmd_async(priv, 502 ret = mwifiex_send_cmd_async(priv,
503 HostCmd_CMD_UAP_SYS_CONFIG, 503 HostCmd_CMD_UAP_SYS_CONFIG,
504 HostCmd_ACT_GEN_SET, 504 HostCmd_ACT_GEN_SET,
505 0, bss_cfg); 505 UAP_BSS_PARAMS_I, bss_cfg);
506 506
507 kfree(bss_cfg); 507 kfree(bss_cfg);
508 508
@@ -983,7 +983,8 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,
983 } 983 }
984 984
985 if (mwifiex_send_cmd_async(priv, HostCmd_CMD_UAP_SYS_CONFIG, 985 if (mwifiex_send_cmd_async(priv, HostCmd_CMD_UAP_SYS_CONFIG,
986 HostCmd_ACT_GEN_SET, 0, bss_cfg)) { 986 HostCmd_ACT_GEN_SET,
987 UAP_BSS_PARAMS_I, bss_cfg)) {
987 wiphy_err(wiphy, "Failed to set the SSID\n"); 988 wiphy_err(wiphy, "Failed to set the SSID\n");
988 kfree(bss_cfg); 989 kfree(bss_cfg);
989 return -1; 990 return -1;
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h
index 57fd0ca6e428..4fd7a05fee18 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -93,6 +93,8 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
93 93
94#define CAL_SNR(RSSI, NF) ((s16)((s16)(RSSI)-(s16)(NF))) 94#define CAL_SNR(RSSI, NF) ((s16)((s16)(RSSI)-(s16)(NF)))
95 95
96#define UAP_BSS_PARAMS_I 0
97
96#define TLV_TYPE_UAP_SSID 0x0000 98#define TLV_TYPE_UAP_SSID 0x0000
97 99
98#define PROPRIETARY_TLV_BASE_ID 0x0100 100#define PROPRIETARY_TLV_BASE_ID 0x0100
diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c b/drivers/net/wireless/mwifiex/uap_cmd.c
index 0cfe88849e94..e43bcaafa1bd 100644
--- a/drivers/net/wireless/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/mwifiex/uap_cmd.c
@@ -123,14 +123,12 @@ void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config)
123 config->retry_limit = 0x7F; 123 config->retry_limit = 0x7F;
124} 124}
125 125
126/* Parse AP config structure and prepare TLV based command structure 126/* This function parses BSS related parameters from structure
127 * to be sent to FW for uAP configuration 127 * and prepares TLVs. These TLVs are appended to command buffer.
128 */ 128*/
129static int mwifiex_cmd_uap_sys_config(struct host_cmd_ds_command *cmd, 129static int
130 u16 cmd_action, void *cmd_buf) 130mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size)
131{ 131{
132 u8 *tlv;
133 struct host_cmd_ds_sys_config *sys_config = &cmd->params.uap_sys_config;
134 struct host_cmd_tlv_dtim_period *dtim_period; 132 struct host_cmd_tlv_dtim_period *dtim_period;
135 struct host_cmd_tlv_beacon_period *beacon_period; 133 struct host_cmd_tlv_beacon_period *beacon_period;
136 struct host_cmd_tlv_ssid *ssid; 134 struct host_cmd_tlv_ssid *ssid;
@@ -145,14 +143,7 @@ static int mwifiex_cmd_uap_sys_config(struct host_cmd_ds_command *cmd,
145 struct host_cmd_tlv_passphrase *passphrase; 143 struct host_cmd_tlv_passphrase *passphrase;
146 struct host_cmd_tlv_akmp *tlv_akmp; 144 struct host_cmd_tlv_akmp *tlv_akmp;
147 struct mwifiex_uap_bss_param *bss_cfg = cmd_buf; 145 struct mwifiex_uap_bss_param *bss_cfg = cmd_buf;
148 u16 cmd_size; 146 u16 cmd_size = *param_size;
149
150 cmd->command = cpu_to_le16(HostCmd_CMD_UAP_SYS_CONFIG);
151 cmd_size = (u16)(sizeof(struct host_cmd_ds_sys_config) + S_DS_GEN);
152
153 sys_config->action = cpu_to_le16(cmd_action);
154
155 tlv = sys_config->tlv;
156 147
157 if (bss_cfg->ssid.ssid_len) { 148 if (bss_cfg->ssid.ssid_len) {
158 ssid = (struct host_cmd_tlv_ssid *)tlv; 149 ssid = (struct host_cmd_tlv_ssid *)tlv;
@@ -319,7 +310,39 @@ static int mwifiex_cmd_uap_sys_config(struct host_cmd_ds_command *cmd,
319 tlv += sizeof(struct host_cmd_tlv_encrypt_protocol); 310 tlv += sizeof(struct host_cmd_tlv_encrypt_protocol);
320 } 311 }
321 312
322 cmd->size = cpu_to_le16(cmd_size); 313 *param_size = cmd_size;
314
315 return 0;
316}
317
318/* Parse AP config structure and prepare TLV based command structure
319 * to be sent to FW for uAP configuration
320 */
321static int
322mwifiex_cmd_uap_sys_config(struct host_cmd_ds_command *cmd, u16 cmd_action,
323 u32 type, void *cmd_buf)
324{
325 u8 *tlv;
326 u16 cmd_size, param_size;
327 struct host_cmd_ds_sys_config *sys_cfg;
328
329 cmd->command = cpu_to_le16(HostCmd_CMD_UAP_SYS_CONFIG);
330 cmd_size = (u16)(sizeof(struct host_cmd_ds_sys_config) + S_DS_GEN);
331 sys_cfg = (struct host_cmd_ds_sys_config *)&cmd->params.uap_sys_config;
332 sys_cfg->action = cpu_to_le16(cmd_action);
333 tlv = sys_cfg->tlv;
334
335 switch (type) {
336 case UAP_BSS_PARAMS_I:
337 param_size = cmd_size;
338 if (mwifiex_uap_bss_param_prepare(tlv, cmd_buf, &param_size))
339 return -1;
340 cmd->size = cpu_to_le16(param_size);
341 break;
342 default:
343 return -1;
344 }
345
323 return 0; 346 return 0;
324} 347}
325 348
@@ -329,14 +352,14 @@ static int mwifiex_cmd_uap_sys_config(struct host_cmd_ds_command *cmd,
329 * routines based upon the command number. 352 * routines based upon the command number.
330 */ 353 */
331int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, u16 cmd_no, 354int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, u16 cmd_no,
332 u16 cmd_action, u32 cmd_oid, 355 u16 cmd_action, u32 type,
333 void *data_buf, void *cmd_buf) 356 void *data_buf, void *cmd_buf)
334{ 357{
335 struct host_cmd_ds_command *cmd = cmd_buf; 358 struct host_cmd_ds_command *cmd = cmd_buf;
336 359
337 switch (cmd_no) { 360 switch (cmd_no) {
338 case HostCmd_CMD_UAP_SYS_CONFIG: 361 case HostCmd_CMD_UAP_SYS_CONFIG:
339 if (mwifiex_cmd_uap_sys_config(cmd, cmd_action, data_buf)) 362 if (mwifiex_cmd_uap_sys_config(cmd, cmd_action, type, data_buf))
340 return -1; 363 return -1;
341 break; 364 break;
342 case HostCmd_CMD_UAP_BSS_START: 365 case HostCmd_CMD_UAP_BSS_START:
@@ -371,7 +394,8 @@ int mwifiex_uap_set_channel(struct mwifiex_private *priv, int channel)
371 bss_cfg->channel = channel; 394 bss_cfg->channel = channel;
372 395
373 if (mwifiex_send_cmd_async(priv, HostCmd_CMD_UAP_SYS_CONFIG, 396 if (mwifiex_send_cmd_async(priv, HostCmd_CMD_UAP_SYS_CONFIG,
374 HostCmd_ACT_GEN_SET, 0, bss_cfg)) { 397 HostCmd_ACT_GEN_SET,
398 UAP_BSS_PARAMS_I, bss_cfg)) {
375 wiphy_err(wiphy, "Failed to set the uAP channel\n"); 399 wiphy_err(wiphy, "Failed to set the uAP channel\n");
376 kfree(bss_cfg); 400 kfree(bss_cfg);
377 return -1; 401 return -1;