diff options
author | Avinash Patil <patila@marvell.com> | 2012-05-08 21:30:20 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-05-16 12:46:35 -0400 |
commit | 4db16a18c25394348f821f0a1b4a7caa8567e071 (patch) | |
tree | 576422b497e10558ee0c13228c545e6b4735384d | |
parent | 40d07030625840156bffe2da3e9f14f87d7a4a99 (diff) |
mwifiex: add AP command sys_config and set channel
1. support for AP sys_config command and added parsing of channel
information.
2. support for setting AP channel from cfg80211 set_channel handler
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>
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/fw.h | 12 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/ioctl.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/uap_cmd.c | 67 |
5 files changed, 90 insertions, 1 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index e09f0c2e46ab..f3465fc89b40 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -387,7 +387,10 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv, | |||
387 | if (mwifiex_bss_set_channel(priv, &cfp)) | 387 | if (mwifiex_bss_set_channel(priv, &cfp)) |
388 | return -EFAULT; | 388 | return -EFAULT; |
389 | 389 | ||
390 | return mwifiex_drv_change_adhoc_chan(priv, cfp.channel); | 390 | if (priv->bss_type == MWIFIEX_BSS_TYPE_STA) |
391 | return mwifiex_drv_change_adhoc_chan(priv, cfp.channel); | ||
392 | else | ||
393 | return mwifiex_uap_set_channel(priv, cfp.channel); | ||
391 | } | 394 | } |
392 | 395 | ||
393 | /* | 396 | /* |
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h index 5caa826a4371..a3e9c28465bf 100644 --- a/drivers/net/wireless/mwifiex/fw.h +++ b/drivers/net/wireless/mwifiex/fw.h | |||
@@ -1112,11 +1112,22 @@ struct host_cmd_tlv { | |||
1112 | __le16 len; | 1112 | __le16 len; |
1113 | } __packed; | 1113 | } __packed; |
1114 | 1114 | ||
1115 | struct host_cmd_ds_sys_config { | ||
1116 | __le16 action; | ||
1117 | u8 tlv[0]; | ||
1118 | }; | ||
1119 | |||
1115 | struct host_cmd_tlv_mac_addr { | 1120 | struct host_cmd_tlv_mac_addr { |
1116 | struct host_cmd_tlv tlv; | 1121 | struct host_cmd_tlv tlv; |
1117 | u8 mac_addr[ETH_ALEN]; | 1122 | u8 mac_addr[ETH_ALEN]; |
1118 | } __packed; | 1123 | } __packed; |
1119 | 1124 | ||
1125 | struct host_cmd_tlv_channel_band { | ||
1126 | struct host_cmd_tlv tlv; | ||
1127 | u8 band_config; | ||
1128 | u8 channel; | ||
1129 | } __packed; | ||
1130 | |||
1120 | struct host_cmd_ds_802_11_rf_channel { | 1131 | struct host_cmd_ds_802_11_rf_channel { |
1121 | __le16 action; | 1132 | __le16 action; |
1122 | __le16 current_channel; | 1133 | __le16 current_channel; |
@@ -1231,6 +1242,7 @@ struct host_cmd_ds_command { | |||
1231 | struct host_cmd_ds_pcie_details pcie_host_spec; | 1242 | struct host_cmd_ds_pcie_details pcie_host_spec; |
1232 | struct host_cmd_ds_802_11_eeprom_access eeprom; | 1243 | struct host_cmd_ds_802_11_eeprom_access eeprom; |
1233 | struct host_cmd_ds_802_11_subsc_evt subsc_evt; | 1244 | struct host_cmd_ds_802_11_subsc_evt subsc_evt; |
1245 | struct host_cmd_ds_sys_config uap_sys_config; | ||
1234 | } params; | 1246 | } params; |
1235 | } __packed; | 1247 | } __packed; |
1236 | 1248 | ||
diff --git a/drivers/net/wireless/mwifiex/ioctl.h b/drivers/net/wireless/mwifiex/ioctl.h index f0f95524e96b..50e9b7767da7 100644 --- a/drivers/net/wireless/mwifiex/ioctl.h +++ b/drivers/net/wireless/mwifiex/ioctl.h | |||
@@ -62,6 +62,12 @@ enum { | |||
62 | BAND_AN = 16, | 62 | BAND_AN = 16, |
63 | }; | 63 | }; |
64 | 64 | ||
65 | #define BAND_CONFIG_MANUAL 0x00 | ||
66 | struct mwifiex_uap_bss_param { | ||
67 | u8 channel; | ||
68 | u8 band_cfg; | ||
69 | }; | ||
70 | |||
65 | enum { | 71 | enum { |
66 | ADHOC_IDLE, | 72 | ADHOC_IDLE, |
67 | ADHOC_STARTED, | 73 | ADHOC_STARTED, |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 24db86fb44ce..014a13f443ef 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -975,6 +975,7 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, | |||
975 | 975 | ||
976 | int mwifiex_main_process(struct mwifiex_adapter *); | 976 | int mwifiex_main_process(struct mwifiex_adapter *); |
977 | 977 | ||
978 | int mwifiex_uap_set_channel(struct mwifiex_private *priv, int channel); | ||
978 | int mwifiex_bss_set_channel(struct mwifiex_private *, | 979 | int mwifiex_bss_set_channel(struct mwifiex_private *, |
979 | struct mwifiex_chan_freq_power *cfp); | 980 | struct mwifiex_chan_freq_power *cfp); |
980 | int mwifiex_get_bss_info(struct mwifiex_private *, | 981 | int mwifiex_get_bss_info(struct mwifiex_private *, |
diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c b/drivers/net/wireless/mwifiex/uap_cmd.c index 97002a40d1c1..795a72b94465 100644 --- a/drivers/net/wireless/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/mwifiex/uap_cmd.c | |||
@@ -19,6 +19,41 @@ | |||
19 | 19 | ||
20 | #include "main.h" | 20 | #include "main.h" |
21 | 21 | ||
22 | /* Parse AP config structure and prepare TLV based command structure | ||
23 | * to be sent to FW for uAP configuration | ||
24 | */ | ||
25 | static int mwifiex_cmd_uap_sys_config(struct host_cmd_ds_command *cmd, | ||
26 | u16 cmd_action, void *cmd_buf) | ||
27 | { | ||
28 | u8 *tlv; | ||
29 | struct host_cmd_ds_sys_config *sys_config = &cmd->params.uap_sys_config; | ||
30 | struct host_cmd_tlv_channel_band *chan_band; | ||
31 | struct mwifiex_uap_bss_param *bss_cfg = cmd_buf; | ||
32 | u16 cmd_size; | ||
33 | |||
34 | cmd->command = cpu_to_le16(HostCmd_CMD_UAP_SYS_CONFIG); | ||
35 | cmd_size = (u16)(sizeof(struct host_cmd_ds_sys_config) + S_DS_GEN); | ||
36 | |||
37 | sys_config->action = cpu_to_le16(cmd_action); | ||
38 | |||
39 | tlv = sys_config->tlv; | ||
40 | |||
41 | if (bss_cfg->channel && bss_cfg->channel <= MAX_CHANNEL_BAND_BG) { | ||
42 | chan_band = (struct host_cmd_tlv_channel_band *)tlv; | ||
43 | chan_band->tlv.type = cpu_to_le16(TLV_TYPE_CHANNELBANDLIST); | ||
44 | chan_band->tlv.len = | ||
45 | cpu_to_le16(sizeof(struct host_cmd_tlv_channel_band) - | ||
46 | sizeof(struct host_cmd_tlv)); | ||
47 | chan_band->band_config = bss_cfg->band_cfg; | ||
48 | chan_band->channel = bss_cfg->channel; | ||
49 | cmd_size += sizeof(struct host_cmd_tlv_channel_band); | ||
50 | tlv += sizeof(struct host_cmd_tlv_channel_band); | ||
51 | } | ||
52 | |||
53 | cmd->size = cpu_to_le16(cmd_size); | ||
54 | return 0; | ||
55 | } | ||
56 | |||
22 | /* This function prepares the AP specific commands before sending them | 57 | /* This function prepares the AP specific commands before sending them |
23 | * to the firmware. | 58 | * to the firmware. |
24 | * This is a generic function which calls specific command preparation | 59 | * This is a generic function which calls specific command preparation |
@@ -31,6 +66,10 @@ int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, u16 cmd_no, | |||
31 | struct host_cmd_ds_command *cmd = cmd_buf; | 66 | struct host_cmd_ds_command *cmd = cmd_buf; |
32 | 67 | ||
33 | switch (cmd_no) { | 68 | switch (cmd_no) { |
69 | case HostCmd_CMD_UAP_SYS_CONFIG: | ||
70 | if (mwifiex_cmd_uap_sys_config(cmd, cmd_action, data_buf)) | ||
71 | return -1; | ||
72 | break; | ||
34 | case HostCmd_CMD_UAP_BSS_START: | 73 | case HostCmd_CMD_UAP_BSS_START: |
35 | case HostCmd_CMD_UAP_BSS_STOP: | 74 | case HostCmd_CMD_UAP_BSS_STOP: |
36 | cmd->command = cpu_to_le16(cmd_no); | 75 | cmd->command = cpu_to_le16(cmd_no); |
@@ -44,3 +83,31 @@ int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, u16 cmd_no, | |||
44 | 83 | ||
45 | return 0; | 84 | return 0; |
46 | } | 85 | } |
86 | |||
87 | /* This function sets the RF channel for AP. | ||
88 | * | ||
89 | * This function populates channel information in AP config structure | ||
90 | * and sends command to configure channel information in AP. | ||
91 | */ | ||
92 | int mwifiex_uap_set_channel(struct mwifiex_private *priv, int channel) | ||
93 | { | ||
94 | struct mwifiex_uap_bss_param *bss_cfg; | ||
95 | struct wiphy *wiphy = priv->wdev->wiphy; | ||
96 | |||
97 | bss_cfg = kzalloc(sizeof(struct mwifiex_uap_bss_param), GFP_KERNEL); | ||
98 | if (!bss_cfg) | ||
99 | return -ENOMEM; | ||
100 | |||
101 | bss_cfg->band_cfg = BAND_CONFIG_MANUAL; | ||
102 | bss_cfg->channel = channel; | ||
103 | |||
104 | if (mwifiex_send_cmd_async(priv, HostCmd_CMD_UAP_SYS_CONFIG, | ||
105 | HostCmd_ACT_GEN_SET, 0, bss_cfg)) { | ||
106 | wiphy_err(wiphy, "Failed to set the uAP channel\n"); | ||
107 | kfree(bss_cfg); | ||
108 | return -1; | ||
109 | } | ||
110 | |||
111 | kfree(bss_cfg); | ||
112 | return 0; | ||
113 | } | ||