aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAvinash Patil <patila@marvell.com>2012-05-08 21:30:23 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-05-16 12:46:35 -0400
commit9b930eaed9c7e722eb1ae4f4632ff1ab285b3c4a (patch)
treec4f9cdd92f84f81374417e9408a59b398f6d929a /drivers/net
parent4f02341ac27f70700a4fff4f3671857ca4227822 (diff)
mwifiex: common set_wiphy_params cfg80211 handler for AP and STA interface
Add support for setting fragmentation threshold, RTS threshold and retry limit. Since wiphy parameters are properties of physical device, appropriate function to set phy parameters is invoked depending upon bss_type(STA or AP) for each virtual interface. Signed-off-by: Avinash Patil <patila@marvell.com> Signed-off-by: Yogesh Ashok Powar <yogeshp@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')
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c99
-rw-r--r--drivers/net/wireless/mwifiex/decl.h1
-rw-r--r--drivers/net/wireless/mwifiex/fw.h18
-rw-r--r--drivers/net/wireless/mwifiex/ioctl.h3
-rw-r--r--drivers/net/wireless/mwifiex/main.h2
-rw-r--r--drivers/net/wireless/mwifiex/uap_cmd.c47
6 files changed, 150 insertions, 20 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index a8fa5cba2028..daa7b4b1a250 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -428,18 +428,13 @@ mwifiex_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev,
428static int 428static int
429mwifiex_set_frag(struct mwifiex_private *priv, u32 frag_thr) 429mwifiex_set_frag(struct mwifiex_private *priv, u32 frag_thr)
430{ 430{
431 int ret;
432
433 if (frag_thr < MWIFIEX_FRAG_MIN_VALUE || 431 if (frag_thr < MWIFIEX_FRAG_MIN_VALUE ||
434 frag_thr > MWIFIEX_FRAG_MAX_VALUE) 432 frag_thr > MWIFIEX_FRAG_MAX_VALUE)
435 return -EINVAL; 433 frag_thr = MWIFIEX_FRAG_MAX_VALUE;
436
437 /* Send request to firmware */
438 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
439 HostCmd_ACT_GEN_SET, FRAG_THRESH_I,
440 &frag_thr);
441 434
442 return ret; 435 return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
436 HostCmd_ACT_GEN_SET, FRAG_THRESH_I,
437 &frag_thr);
443} 438}
444 439
445/* 440/*
@@ -469,20 +464,84 @@ static int
469mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) 464mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
470{ 465{
471 struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); 466 struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
472 struct mwifiex_private *priv = mwifiex_get_priv(adapter, 467 struct mwifiex_private *priv;
473 MWIFIEX_BSS_ROLE_STA); 468 struct mwifiex_uap_bss_param *bss_cfg;
474 int ret = 0; 469 int ret, bss_started, i;
470
471 for (i = 0; i < adapter->priv_num; i++) {
472 priv = adapter->priv[i];
473
474 switch (priv->bss_role) {
475 case MWIFIEX_BSS_ROLE_UAP:
476 bss_cfg = kzalloc(sizeof(struct mwifiex_uap_bss_param),
477 GFP_KERNEL);
478 if (!bss_cfg)
479 return -ENOMEM;
480
481 mwifiex_set_sys_config_invalid_data(bss_cfg);
482
483 if (changed & WIPHY_PARAM_RTS_THRESHOLD)
484 bss_cfg->rts_threshold = wiphy->rts_threshold;
485 if (changed & WIPHY_PARAM_FRAG_THRESHOLD)
486 bss_cfg->frag_threshold = wiphy->frag_threshold;
487 if (changed & WIPHY_PARAM_RETRY_LONG)
488 bss_cfg->retry_limit = wiphy->retry_long;
489
490 bss_started = priv->bss_started;
491
492 ret = mwifiex_send_cmd_sync(priv,
493 HostCmd_CMD_UAP_BSS_STOP,
494 HostCmd_ACT_GEN_SET, 0,
495 NULL);
496 if (ret) {
497 wiphy_err(wiphy, "Failed to stop the BSS\n");
498 kfree(bss_cfg);
499 return ret;
500 }
475 501
476 if (changed & WIPHY_PARAM_RTS_THRESHOLD) { 502 ret = mwifiex_send_cmd_async(priv,
477 ret = mwifiex_set_rts(priv, wiphy->rts_threshold); 503 HostCmd_CMD_UAP_SYS_CONFIG,
478 if (ret) 504 HostCmd_ACT_GEN_SET,
479 return ret; 505 0, bss_cfg);
480 }
481 506
482 if (changed & WIPHY_PARAM_FRAG_THRESHOLD) 507 kfree(bss_cfg);
483 ret = mwifiex_set_frag(priv, wiphy->frag_threshold);
484 508
485 return ret; 509 if (ret) {
510 wiphy_err(wiphy, "Failed to set bss config\n");
511 return ret;
512 }
513
514 if (!bss_started)
515 break;
516
517 ret = mwifiex_send_cmd_async(priv,
518 HostCmd_CMD_UAP_BSS_START,
519 HostCmd_ACT_GEN_SET, 0,
520 NULL);
521 if (ret) {
522 wiphy_err(wiphy, "Failed to start BSS\n");
523 return ret;
524 }
525
526 break;
527 case MWIFIEX_BSS_ROLE_STA:
528 if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
529 ret = mwifiex_set_rts(priv,
530 wiphy->rts_threshold);
531 if (ret)
532 return ret;
533 }
534 if (changed & WIPHY_PARAM_FRAG_THRESHOLD) {
535 ret = mwifiex_set_frag(priv,
536 wiphy->frag_threshold);
537 if (ret)
538 return ret;
539 }
540 break;
541 }
542 }
543
544 return 0;
486} 545}
487 546
488/* 547/*
diff --git a/drivers/net/wireless/mwifiex/decl.h b/drivers/net/wireless/mwifiex/decl.h
index 6b8f9129b704..31dc2bada512 100644
--- a/drivers/net/wireless/mwifiex/decl.h
+++ b/drivers/net/wireless/mwifiex/decl.h
@@ -60,6 +60,7 @@
60#define MWIFIEX_FRAG_MIN_VALUE (256) 60#define MWIFIEX_FRAG_MIN_VALUE (256)
61#define MWIFIEX_FRAG_MAX_VALUE (2346) 61#define MWIFIEX_FRAG_MAX_VALUE (2346)
62 62
63#define MWIFIEX_RETRY_LIMIT 14
63#define MWIFIEX_SDIO_BLOCK_SIZE 256 64#define MWIFIEX_SDIO_BLOCK_SIZE 256
64 65
65#define MWIFIEX_BUF_FLAG_REQUEUED_PKT BIT(0) 66#define MWIFIEX_BUF_FLAG_REQUEUED_PKT BIT(0)
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h
index a3e9c28465bf..a4c2fc3e3d71 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -106,9 +106,12 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
106#define TLV_TYPE_AUTH_TYPE (PROPRIETARY_TLV_BASE_ID + 31) 106#define TLV_TYPE_AUTH_TYPE (PROPRIETARY_TLV_BASE_ID + 31)
107#define TLV_TYPE_STA_MAC_ADDR (PROPRIETARY_TLV_BASE_ID + 32) 107#define TLV_TYPE_STA_MAC_ADDR (PROPRIETARY_TLV_BASE_ID + 32)
108#define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 42) 108#define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 42)
109#define TLV_TYPE_UAP_RTS_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 51)
110#define TLV_TYPE_UAP_FRAG_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 70)
109#define TLV_TYPE_RATE_DROP_CONTROL (PROPRIETARY_TLV_BASE_ID + 82) 111#define TLV_TYPE_RATE_DROP_CONTROL (PROPRIETARY_TLV_BASE_ID + 82)
110#define TLV_TYPE_RATE_SCOPE (PROPRIETARY_TLV_BASE_ID + 83) 112#define TLV_TYPE_RATE_SCOPE (PROPRIETARY_TLV_BASE_ID + 83)
111#define TLV_TYPE_POWER_GROUP (PROPRIETARY_TLV_BASE_ID + 84) 113#define TLV_TYPE_POWER_GROUP (PROPRIETARY_TLV_BASE_ID + 84)
114#define TLV_TYPE_UAP_RETRY_LIMIT (PROPRIETARY_TLV_BASE_ID + 93)
112#define TLV_TYPE_WAPI_IE (PROPRIETARY_TLV_BASE_ID + 94) 115#define TLV_TYPE_WAPI_IE (PROPRIETARY_TLV_BASE_ID + 94)
113#define TLV_TYPE_MGMT_IE (PROPRIETARY_TLV_BASE_ID + 105) 116#define TLV_TYPE_MGMT_IE (PROPRIETARY_TLV_BASE_ID + 105)
114#define TLV_TYPE_AUTO_DS_PARAM (PROPRIETARY_TLV_BASE_ID + 113) 117#define TLV_TYPE_AUTO_DS_PARAM (PROPRIETARY_TLV_BASE_ID + 113)
@@ -1117,6 +1120,21 @@ struct host_cmd_ds_sys_config {
1117 u8 tlv[0]; 1120 u8 tlv[0];
1118}; 1121};
1119 1122
1123struct host_cmd_tlv_frag_threshold {
1124 struct host_cmd_tlv tlv;
1125 __le16 frag_thr;
1126} __packed;
1127
1128struct host_cmd_tlv_rts_threshold {
1129 struct host_cmd_tlv tlv;
1130 __le16 rts_thr;
1131} __packed;
1132
1133struct host_cmd_tlv_retry_limit {
1134 struct host_cmd_tlv tlv;
1135 u8 limit;
1136} __packed;
1137
1120struct host_cmd_tlv_mac_addr { 1138struct host_cmd_tlv_mac_addr {
1121 struct host_cmd_tlv tlv; 1139 struct host_cmd_tlv tlv;
1122 u8 mac_addr[ETH_ALEN]; 1140 u8 mac_addr[ETH_ALEN];
diff --git a/drivers/net/wireless/mwifiex/ioctl.h b/drivers/net/wireless/mwifiex/ioctl.h
index 50e9b7767da7..535a57a3f96e 100644
--- a/drivers/net/wireless/mwifiex/ioctl.h
+++ b/drivers/net/wireless/mwifiex/ioctl.h
@@ -66,6 +66,9 @@ enum {
66struct mwifiex_uap_bss_param { 66struct mwifiex_uap_bss_param {
67 u8 channel; 67 u8 channel;
68 u8 band_cfg; 68 u8 band_cfg;
69 u16 rts_threshold;
70 u16 frag_threshold;
71 u8 retry_limit;
69}; 72};
70 73
71enum { 74enum {
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 014a13f443ef..acea8d41c048 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -993,6 +993,8 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
993 u32 *flags, struct vif_params *params); 993 u32 *flags, struct vif_params *params);
994int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev); 994int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev);
995 995
996void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config);
997
996u8 *mwifiex_11d_code_2_region(u8 code); 998u8 *mwifiex_11d_code_2_region(u8 code);
997 999
998#ifdef CONFIG_DEBUG_FS 1000#ifdef CONFIG_DEBUG_FS
diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c b/drivers/net/wireless/mwifiex/uap_cmd.c
index 795a72b94465..2225baca896a 100644
--- a/drivers/net/wireless/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/mwifiex/uap_cmd.c
@@ -19,6 +19,17 @@
19 19
20#include "main.h" 20#include "main.h"
21 21
22/* This function initializes some of mwifiex_uap_bss_param variables.
23 * This helps FW in ignoring invalid values. These values may or may not
24 * be get updated to valid ones at later stage.
25 */
26void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config)
27{
28 config->rts_threshold = 0x7FFF;
29 config->frag_threshold = 0x7FFF;
30 config->retry_limit = 0x7F;
31}
32
22/* Parse AP config structure and prepare TLV based command structure 33/* Parse AP config structure and prepare TLV based command structure
23 * to be sent to FW for uAP configuration 34 * to be sent to FW for uAP configuration
24 */ 35 */
@@ -28,6 +39,9 @@ static int mwifiex_cmd_uap_sys_config(struct host_cmd_ds_command *cmd,
28 u8 *tlv; 39 u8 *tlv;
29 struct host_cmd_ds_sys_config *sys_config = &cmd->params.uap_sys_config; 40 struct host_cmd_ds_sys_config *sys_config = &cmd->params.uap_sys_config;
30 struct host_cmd_tlv_channel_band *chan_band; 41 struct host_cmd_tlv_channel_band *chan_band;
42 struct host_cmd_tlv_frag_threshold *frag_threshold;
43 struct host_cmd_tlv_rts_threshold *rts_threshold;
44 struct host_cmd_tlv_retry_limit *retry_limit;
31 struct mwifiex_uap_bss_param *bss_cfg = cmd_buf; 45 struct mwifiex_uap_bss_param *bss_cfg = cmd_buf;
32 u16 cmd_size; 46 u16 cmd_size;
33 47
@@ -49,6 +63,39 @@ static int mwifiex_cmd_uap_sys_config(struct host_cmd_ds_command *cmd,
49 cmd_size += sizeof(struct host_cmd_tlv_channel_band); 63 cmd_size += sizeof(struct host_cmd_tlv_channel_band);
50 tlv += sizeof(struct host_cmd_tlv_channel_band); 64 tlv += sizeof(struct host_cmd_tlv_channel_band);
51 } 65 }
66 if (bss_cfg->rts_threshold <= MWIFIEX_RTS_MAX_VALUE) {
67 rts_threshold = (struct host_cmd_tlv_rts_threshold *)tlv;
68 rts_threshold->tlv.type =
69 cpu_to_le16(TLV_TYPE_UAP_RTS_THRESHOLD);
70 rts_threshold->tlv.len =
71 cpu_to_le16(sizeof(struct host_cmd_tlv_rts_threshold) -
72 sizeof(struct host_cmd_tlv));
73 rts_threshold->rts_thr = cpu_to_le16(bss_cfg->rts_threshold);
74 cmd_size += sizeof(struct host_cmd_tlv_frag_threshold);
75 tlv += sizeof(struct host_cmd_tlv_frag_threshold);
76 }
77 if ((bss_cfg->frag_threshold >= MWIFIEX_FRAG_MIN_VALUE) &&
78 (bss_cfg->frag_threshold <= MWIFIEX_FRAG_MAX_VALUE)) {
79 frag_threshold = (struct host_cmd_tlv_frag_threshold *)tlv;
80 frag_threshold->tlv.type =
81 cpu_to_le16(TLV_TYPE_UAP_FRAG_THRESHOLD);
82 frag_threshold->tlv.len =
83 cpu_to_le16(sizeof(struct host_cmd_tlv_frag_threshold) -
84 sizeof(struct host_cmd_tlv));
85 frag_threshold->frag_thr = cpu_to_le16(bss_cfg->frag_threshold);
86 cmd_size += sizeof(struct host_cmd_tlv_frag_threshold);
87 tlv += sizeof(struct host_cmd_tlv_frag_threshold);
88 }
89 if (bss_cfg->retry_limit <= MWIFIEX_RETRY_LIMIT) {
90 retry_limit = (struct host_cmd_tlv_retry_limit *)tlv;
91 retry_limit->tlv.type = cpu_to_le16(TLV_TYPE_UAP_RETRY_LIMIT);
92 retry_limit->tlv.len =
93 cpu_to_le16(sizeof(struct host_cmd_tlv_retry_limit) -
94 sizeof(struct host_cmd_tlv));
95 retry_limit->limit = (u8)bss_cfg->retry_limit;
96 cmd_size += sizeof(struct host_cmd_tlv_retry_limit);
97 tlv += sizeof(struct host_cmd_tlv_retry_limit);
98 }
52 99
53 cmd->size = cpu_to_le16(cmd_size); 100 cmd->size = cpu_to_le16(cmd_size);
54 return 0; 101 return 0;