2 * Marvell Wireless LAN device driver: station command handling
4 * Copyright (C) 2011, Marvell International Ltd.
6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
8 * (the "License"). You may use, redistribute and/or modify this File in
9 * accordance with the terms and conditions of the License, a copy of which
10 * is available by writing to the Free Software Foundation, Inc.,
11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
12 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
14 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
16 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
17 * this warranty disclaimer.
29 * This function prepares command to set/get RSSI information.
31 * Preparation includes -
32 * - Setting command ID, action and proper size
33 * - Setting data/beacon average factors
34 * - Resetting SNR/NF/RSSI values in private structure
35 * - Ensuring correct endian-ness
38 mwifiex_cmd_802_11_rssi_info(struct mwifiex_private
*priv
,
39 struct host_cmd_ds_command
*cmd
, u16 cmd_action
)
41 cmd
->command
= cpu_to_le16(HostCmd_CMD_RSSI_INFO
);
42 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_802_11_rssi_info
) +
44 cmd
->params
.rssi_info
.action
= cpu_to_le16(cmd_action
);
45 cmd
->params
.rssi_info
.ndata
= cpu_to_le16(priv
->data_avg_factor
);
46 cmd
->params
.rssi_info
.nbcn
= cpu_to_le16(priv
->bcn_avg_factor
);
48 /* Reset SNR/NF/RSSI values in private structure */
49 priv
->data_rssi_last
= 0;
50 priv
->data_nf_last
= 0;
51 priv
->data_rssi_avg
= 0;
52 priv
->data_nf_avg
= 0;
53 priv
->bcn_rssi_last
= 0;
54 priv
->bcn_nf_last
= 0;
55 priv
->bcn_rssi_avg
= 0;
62 * This function prepares command to set MAC control.
64 * Preparation includes -
65 * - Setting command ID, action and proper size
66 * - Ensuring correct endian-ness
68 static int mwifiex_cmd_mac_control(struct mwifiex_private
*priv
,
69 struct host_cmd_ds_command
*cmd
,
70 u16 cmd_action
, void *data_buf
)
72 struct host_cmd_ds_mac_control
*mac_ctrl
= &cmd
->params
.mac_ctrl
;
73 u16 action
= *((u16
*) data_buf
);
75 if (cmd_action
!= HostCmd_ACT_GEN_SET
) {
76 dev_err(priv
->adapter
->dev
,
77 "mac_control: only support set cmd\n");
81 cmd
->command
= cpu_to_le16(HostCmd_CMD_MAC_CONTROL
);
83 cpu_to_le16(sizeof(struct host_cmd_ds_mac_control
) + S_DS_GEN
);
84 mac_ctrl
->action
= cpu_to_le16(action
);
90 * This function prepares command to set/get SNMP MIB.
92 * Preparation includes -
93 * - Setting command ID, action and proper size
94 * - Setting SNMP MIB OID number and value
96 * - Ensuring correct endian-ness
98 * The following SNMP MIB OIDs are supported -
99 * - FRAG_THRESH_I : Fragmentation threshold
100 * - RTS_THRESH_I : RTS threshold
101 * - SHORT_RETRY_LIM_I : Short retry limit
102 * - DOT11D_I : 11d support
104 static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private
*priv
,
105 struct host_cmd_ds_command
*cmd
,
106 u16 cmd_action
, u32 cmd_oid
,
109 struct host_cmd_ds_802_11_snmp_mib
*snmp_mib
= &cmd
->params
.smib
;
112 dev_dbg(priv
->adapter
->dev
, "cmd: SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid
);
113 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_SNMP_MIB
);
114 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_802_11_snmp_mib
)
117 if (cmd_action
== HostCmd_ACT_GEN_GET
) {
118 snmp_mib
->query_type
= cpu_to_le16(HostCmd_ACT_GEN_GET
);
119 snmp_mib
->buf_size
= cpu_to_le16(MAX_SNMP_BUF_SIZE
);
120 cmd
->size
= cpu_to_le16(le16_to_cpu(cmd
->size
)
121 + MAX_SNMP_BUF_SIZE
);
126 snmp_mib
->oid
= cpu_to_le16((u16
) FRAG_THRESH_I
);
127 if (cmd_action
== HostCmd_ACT_GEN_SET
) {
128 snmp_mib
->query_type
= cpu_to_le16(HostCmd_ACT_GEN_SET
);
129 snmp_mib
->buf_size
= cpu_to_le16(sizeof(u16
));
130 ul_temp
= *((u32
*) data_buf
);
131 *((__le16
*) (snmp_mib
->value
)) =
132 cpu_to_le16((u16
) ul_temp
);
133 cmd
->size
= cpu_to_le16(le16_to_cpu(cmd
->size
)
138 snmp_mib
->oid
= cpu_to_le16((u16
) RTS_THRESH_I
);
139 if (cmd_action
== HostCmd_ACT_GEN_SET
) {
140 snmp_mib
->query_type
= cpu_to_le16(HostCmd_ACT_GEN_SET
);
141 snmp_mib
->buf_size
= cpu_to_le16(sizeof(u16
));
142 ul_temp
= *((u32
*) data_buf
);
143 *(__le16
*) (snmp_mib
->value
) =
144 cpu_to_le16((u16
) ul_temp
);
145 cmd
->size
= cpu_to_le16(le16_to_cpu(cmd
->size
)
150 case SHORT_RETRY_LIM_I
:
151 snmp_mib
->oid
= cpu_to_le16((u16
) SHORT_RETRY_LIM_I
);
152 if (cmd_action
== HostCmd_ACT_GEN_SET
) {
153 snmp_mib
->query_type
= cpu_to_le16(HostCmd_ACT_GEN_SET
);
154 snmp_mib
->buf_size
= cpu_to_le16(sizeof(u16
));
155 ul_temp
= (*(u32
*) data_buf
);
156 *((__le16
*) (snmp_mib
->value
)) =
157 cpu_to_le16((u16
) ul_temp
);
158 cmd
->size
= cpu_to_le16(le16_to_cpu(cmd
->size
)
163 snmp_mib
->oid
= cpu_to_le16((u16
) DOT11D_I
);
164 if (cmd_action
== HostCmd_ACT_GEN_SET
) {
165 snmp_mib
->query_type
= cpu_to_le16(HostCmd_ACT_GEN_SET
);
166 snmp_mib
->buf_size
= cpu_to_le16(sizeof(u16
));
167 ul_temp
= *(u32
*) data_buf
;
168 *((__le16
*) (snmp_mib
->value
)) =
169 cpu_to_le16((u16
) ul_temp
);
170 cmd
->size
= cpu_to_le16(le16_to_cpu(cmd
->size
)
177 dev_dbg(priv
->adapter
->dev
,
178 "cmd: SNMP_CMD: Action=0x%x, OID=0x%x, OIDSize=0x%x,"
180 cmd_action
, cmd_oid
, le16_to_cpu(snmp_mib
->buf_size
),
181 le16_to_cpu(*(__le16
*) snmp_mib
->value
));
186 * This function prepares command to get log.
188 * Preparation includes -
189 * - Setting command ID and proper size
190 * - Ensuring correct endian-ness
193 mwifiex_cmd_802_11_get_log(struct host_cmd_ds_command
*cmd
)
195 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_GET_LOG
);
196 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_802_11_get_log
) +
202 * This function prepares command to set/get Tx data rate configuration.
204 * Preparation includes -
205 * - Setting command ID, action and proper size
206 * - Setting configuration index, rate scope and rate drop pattern
207 * parameters (as required)
208 * - Ensuring correct endian-ness
210 static int mwifiex_cmd_tx_rate_cfg(struct mwifiex_private
*priv
,
211 struct host_cmd_ds_command
*cmd
,
212 u16 cmd_action
, void *data_buf
)
214 struct host_cmd_ds_tx_rate_cfg
*rate_cfg
= &cmd
->params
.tx_rate_cfg
;
215 struct mwifiex_rate_scope
*rate_scope
;
216 struct mwifiex_rate_drop_pattern
*rate_drop
;
217 u16
*pbitmap_rates
= (u16
*) data_buf
;
221 cmd
->command
= cpu_to_le16(HostCmd_CMD_TX_RATE_CFG
);
223 rate_cfg
->action
= cpu_to_le16(cmd_action
);
224 rate_cfg
->cfg_index
= 0;
226 rate_scope
= (struct mwifiex_rate_scope
*) ((u8
*) rate_cfg
+
227 sizeof(struct host_cmd_ds_tx_rate_cfg
));
228 rate_scope
->type
= cpu_to_le16(TLV_TYPE_RATE_SCOPE
);
229 rate_scope
->length
= cpu_to_le16(sizeof(struct mwifiex_rate_scope
) -
230 sizeof(struct mwifiex_ie_types_header
));
231 if (pbitmap_rates
!= NULL
) {
232 rate_scope
->hr_dsss_rate_bitmap
= cpu_to_le16(pbitmap_rates
[0]);
233 rate_scope
->ofdm_rate_bitmap
= cpu_to_le16(pbitmap_rates
[1]);
235 i
< sizeof(rate_scope
->ht_mcs_rate_bitmap
) / sizeof(u16
);
237 rate_scope
->ht_mcs_rate_bitmap
[i
] =
238 cpu_to_le16(pbitmap_rates
[2 + i
]);
240 rate_scope
->hr_dsss_rate_bitmap
=
241 cpu_to_le16(priv
->bitmap_rates
[0]);
242 rate_scope
->ofdm_rate_bitmap
=
243 cpu_to_le16(priv
->bitmap_rates
[1]);
245 i
< sizeof(rate_scope
->ht_mcs_rate_bitmap
) / sizeof(u16
);
247 rate_scope
->ht_mcs_rate_bitmap
[i
] =
248 cpu_to_le16(priv
->bitmap_rates
[2 + i
]);
251 rate_drop
= (struct mwifiex_rate_drop_pattern
*) ((u8
*) rate_scope
+
252 sizeof(struct mwifiex_rate_scope
));
253 rate_drop
->type
= cpu_to_le16(TLV_TYPE_RATE_DROP_CONTROL
);
254 rate_drop
->length
= cpu_to_le16(sizeof(rate_drop
->rate_drop_mode
));
255 rate_drop
->rate_drop_mode
= 0;
258 cpu_to_le16(S_DS_GEN
+ sizeof(struct host_cmd_ds_tx_rate_cfg
) +
259 sizeof(struct mwifiex_rate_scope
) +
260 sizeof(struct mwifiex_rate_drop_pattern
));
266 * This function prepares command to set/get Tx power configuration.
268 * Preparation includes -
269 * - Setting command ID, action and proper size
270 * - Setting Tx power mode, power group TLV
272 * - Ensuring correct endian-ness
274 static int mwifiex_cmd_tx_power_cfg(struct host_cmd_ds_command
*cmd
,
275 u16 cmd_action
, void *data_buf
)
277 struct mwifiex_types_power_group
*pg_tlv
;
278 struct host_cmd_ds_txpwr_cfg
*txp
;
279 struct host_cmd_ds_txpwr_cfg
*cmd_txp_cfg
= &cmd
->params
.txp_cfg
;
281 cmd
->command
= cpu_to_le16(HostCmd_CMD_TXPWR_CFG
);
283 cpu_to_le16(S_DS_GEN
+ sizeof(struct host_cmd_ds_txpwr_cfg
));
284 switch (cmd_action
) {
285 case HostCmd_ACT_GEN_SET
:
286 txp
= (struct host_cmd_ds_txpwr_cfg
*) data_buf
;
288 pg_tlv
= (struct mwifiex_types_power_group
289 *) ((unsigned long) data_buf
+
290 sizeof(struct host_cmd_ds_txpwr_cfg
));
291 memmove(cmd_txp_cfg
, data_buf
,
292 sizeof(struct host_cmd_ds_txpwr_cfg
) +
293 sizeof(struct mwifiex_types_power_group
) +
296 pg_tlv
= (struct mwifiex_types_power_group
*) ((u8
*)
298 sizeof(struct host_cmd_ds_txpwr_cfg
));
299 cmd
->size
= cpu_to_le16(le16_to_cpu(cmd
->size
) +
300 sizeof(struct mwifiex_types_power_group
) +
303 memmove(cmd_txp_cfg
, data_buf
,
304 sizeof(struct host_cmd_ds_txpwr_cfg
));
306 cmd_txp_cfg
->action
= cpu_to_le16(cmd_action
);
308 case HostCmd_ACT_GEN_GET
:
309 cmd_txp_cfg
->action
= cpu_to_le16(cmd_action
);
317 * This function prepares command to set Host Sleep configuration.
319 * Preparation includes -
320 * - Setting command ID and proper size
321 * - Setting Host Sleep action, conditions, ARP filters
323 * - Ensuring correct endian-ness
325 static int mwifiex_cmd_802_11_hs_cfg(struct mwifiex_private
*priv
,
326 struct host_cmd_ds_command
*cmd
,
328 struct mwifiex_hs_config_param
*data_buf
)
330 struct mwifiex_adapter
*adapter
= priv
->adapter
;
331 struct host_cmd_ds_802_11_hs_cfg_enh
*hs_cfg
= &cmd
->params
.opt_hs_cfg
;
332 u16 hs_activate
= false;
334 if (data_buf
== NULL
)
335 /* New Activate command */
337 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH
);
340 (data_buf
->conditions
341 != cpu_to_le32(HOST_SLEEP_CFG_CANCEL
))
342 && ((adapter
->arp_filter_size
> 0)
343 && (adapter
->arp_filter_size
<= ARP_FILTER_MAX_BUF_SIZE
))) {
344 dev_dbg(adapter
->dev
,
345 "cmd: Attach %d bytes ArpFilter to HSCfg cmd\n",
346 adapter
->arp_filter_size
);
347 memcpy(((u8
*) hs_cfg
) +
348 sizeof(struct host_cmd_ds_802_11_hs_cfg_enh
),
349 adapter
->arp_filter
, adapter
->arp_filter_size
);
350 cmd
->size
= cpu_to_le16(adapter
->arp_filter_size
+
351 sizeof(struct host_cmd_ds_802_11_hs_cfg_enh
)
354 cmd
->size
= cpu_to_le16(S_DS_GEN
+ sizeof(struct
355 host_cmd_ds_802_11_hs_cfg_enh
));
358 hs_cfg
->action
= cpu_to_le16(HS_ACTIVATE
);
359 hs_cfg
->params
.hs_activate
.resp_ctrl
= RESP_NEEDED
;
361 hs_cfg
->action
= cpu_to_le16(HS_CONFIGURE
);
362 hs_cfg
->params
.hs_config
.conditions
= data_buf
->conditions
;
363 hs_cfg
->params
.hs_config
.gpio
= data_buf
->gpio
;
364 hs_cfg
->params
.hs_config
.gap
= data_buf
->gap
;
365 dev_dbg(adapter
->dev
,
366 "cmd: HS_CFG_CMD: condition:0x%x gpio:0x%x gap:0x%x\n",
367 hs_cfg
->params
.hs_config
.conditions
,
368 hs_cfg
->params
.hs_config
.gpio
,
369 hs_cfg
->params
.hs_config
.gap
);
376 * This function prepares command to set/get MAC address.
378 * Preparation includes -
379 * - Setting command ID, action and proper size
380 * - Setting MAC address (for SET only)
381 * - Ensuring correct endian-ness
383 static int mwifiex_cmd_802_11_mac_address(struct mwifiex_private
*priv
,
384 struct host_cmd_ds_command
*cmd
,
387 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_MAC_ADDRESS
);
388 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_802_11_mac_address
) +
392 cmd
->params
.mac_addr
.action
= cpu_to_le16(cmd_action
);
394 if (cmd_action
== HostCmd_ACT_GEN_SET
)
395 memcpy(cmd
->params
.mac_addr
.mac_addr
, priv
->curr_addr
,
401 * This function prepares command to set MAC multicast address.
403 * Preparation includes -
404 * - Setting command ID, action and proper size
405 * - Setting MAC multicast address
406 * - Ensuring correct endian-ness
408 static int mwifiex_cmd_mac_multicast_adr(struct host_cmd_ds_command
*cmd
,
409 u16 cmd_action
, void *data_buf
)
411 struct mwifiex_multicast_list
*mcast_list
=
412 (struct mwifiex_multicast_list
*) data_buf
;
413 struct host_cmd_ds_mac_multicast_adr
*mcast_addr
= &cmd
->params
.mc_addr
;
415 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_mac_multicast_adr
) +
417 cmd
->command
= cpu_to_le16(HostCmd_CMD_MAC_MULTICAST_ADR
);
419 mcast_addr
->action
= cpu_to_le16(cmd_action
);
420 mcast_addr
->num_of_adrs
=
421 cpu_to_le16((u16
) mcast_list
->num_multicast_addr
);
422 memcpy(mcast_addr
->mac_list
, mcast_list
->mac_list
,
423 mcast_list
->num_multicast_addr
* ETH_ALEN
);
429 * This function prepares command to deauthenticate.
431 * Preparation includes -
432 * - Setting command ID and proper size
433 * - Setting AP MAC address and reason code
434 * - Ensuring correct endian-ness
436 static int mwifiex_cmd_802_11_deauthenticate(struct mwifiex_private
*priv
,
437 struct host_cmd_ds_command
*cmd
,
440 struct host_cmd_ds_802_11_deauthenticate
*deauth
= &cmd
->params
.deauth
;
442 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_DEAUTHENTICATE
);
443 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_802_11_deauthenticate
)
446 /* Set AP MAC address */
447 memcpy(deauth
->mac_addr
, (u8
*) data_buf
, ETH_ALEN
);
449 dev_dbg(priv
->adapter
->dev
, "cmd: Deauth: %pM\n", deauth
->mac_addr
);
451 deauth
->reason_code
= cpu_to_le16(WLAN_REASON_DEAUTH_LEAVING
);
457 * This function prepares command to stop Ad-Hoc network.
459 * Preparation includes -
460 * - Setting command ID and proper size
461 * - Ensuring correct endian-ness
463 static int mwifiex_cmd_802_11_ad_hoc_stop(struct host_cmd_ds_command
*cmd
)
465 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_AD_HOC_STOP
);
466 cmd
->size
= cpu_to_le16(S_DS_GEN
);
471 * This function sets WEP key(s) to key parameter TLV(s).
473 * Multi-key parameter TLVs are supported, so we can send multiple
474 * WEP keys in a single buffer.
477 mwifiex_set_keyparamset_wep(struct mwifiex_private
*priv
,
478 struct mwifiex_ie_type_key_param_set
*key_param_set
,
481 int cur_key_param_len
;
484 /* Multi-key_param_set TLV is supported */
485 for (i
= 0; i
< NUM_WEP_KEYS
; i
++) {
486 if ((priv
->wep_key
[i
].key_length
== WLAN_KEY_LEN_WEP40
) ||
487 (priv
->wep_key
[i
].key_length
== WLAN_KEY_LEN_WEP104
)) {
488 key_param_set
->type
=
489 cpu_to_le16(TLV_TYPE_KEY_MATERIAL
);
490 /* Key_param_set WEP fixed length */
491 #define KEYPARAMSET_WEP_FIXED_LEN 8
492 key_param_set
->length
= cpu_to_le16((u16
)
495 KEYPARAMSET_WEP_FIXED_LEN
));
496 key_param_set
->key_type_id
=
497 cpu_to_le16(KEY_TYPE_ID_WEP
);
498 key_param_set
->key_info
=
499 cpu_to_le16(KEY_ENABLED
| KEY_UNICAST
|
501 key_param_set
->key_len
=
502 cpu_to_le16(priv
->wep_key
[i
].key_length
);
503 /* Set WEP key index */
504 key_param_set
->key
[0] = i
;
505 /* Set default Tx key flag */
508 wep_key_curr_index
& HostCmd_WEP_KEY_INDEX_MASK
))
509 key_param_set
->key
[1] = 1;
511 key_param_set
->key
[1] = 0;
512 memmove(&key_param_set
->key
[2],
513 priv
->wep_key
[i
].key_material
,
514 priv
->wep_key
[i
].key_length
);
516 cur_key_param_len
= priv
->wep_key
[i
].key_length
+
517 KEYPARAMSET_WEP_FIXED_LEN
+
518 sizeof(struct mwifiex_ie_types_header
);
519 *key_param_len
+= (u16
) cur_key_param_len
;
521 (struct mwifiex_ie_type_key_param_set
*)
522 ((u8
*)key_param_set
+
524 } else if (!priv
->wep_key
[i
].key_length
) {
527 dev_err(priv
->adapter
->dev
,
528 "key%d Length = %d is incorrect\n",
529 (i
+ 1), priv
->wep_key
[i
].key_length
);
538 * This function prepares command to set/get/reset network key(s).
540 * Preparation includes -
541 * - Setting command ID, action and proper size
542 * - Setting WEP keys, WAPI keys or WPA keys along with required
543 * encryption (TKIP, AES) (as required)
544 * - Ensuring correct endian-ness
546 static int mwifiex_cmd_802_11_key_material(struct mwifiex_private
*priv
,
547 struct host_cmd_ds_command
*cmd
,
549 u32 cmd_oid
, void *data_buf
)
551 struct host_cmd_ds_802_11_key_material
*key_material
=
552 &cmd
->params
.key_material
;
553 struct mwifiex_ds_encrypt_key
*enc_key
=
554 (struct mwifiex_ds_encrypt_key
*) data_buf
;
555 u16 key_param_len
= 0;
557 const u8 bc_mac
[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
559 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_KEY_MATERIAL
);
560 key_material
->action
= cpu_to_le16(cmd_action
);
562 if (cmd_action
== HostCmd_ACT_GEN_GET
) {
564 cpu_to_le16(sizeof(key_material
->action
) + S_DS_GEN
);
569 memset(&key_material
->key_param_set
, 0,
571 sizeof(struct mwifiex_ie_type_key_param_set
)));
572 ret
= mwifiex_set_keyparamset_wep(priv
,
573 &key_material
->key_param_set
,
575 cmd
->size
= cpu_to_le16(key_param_len
+
576 sizeof(key_material
->action
) + S_DS_GEN
);
579 memset(&key_material
->key_param_set
, 0,
580 sizeof(struct mwifiex_ie_type_key_param_set
));
581 if (enc_key
->is_wapi_key
) {
582 dev_dbg(priv
->adapter
->dev
, "info: Set WAPI Key\n");
583 key_material
->key_param_set
.key_type_id
=
584 cpu_to_le16(KEY_TYPE_ID_WAPI
);
585 if (cmd_oid
== KEY_INFO_ENABLED
)
586 key_material
->key_param_set
.key_info
=
587 cpu_to_le16(KEY_ENABLED
);
589 key_material
->key_param_set
.key_info
=
590 cpu_to_le16(!KEY_ENABLED
);
592 key_material
->key_param_set
.key
[0] = enc_key
->key_index
;
593 if (!priv
->sec_info
.wapi_key_on
)
594 key_material
->key_param_set
.key
[1] = 1;
596 /* set 0 when re-key */
597 key_material
->key_param_set
.key
[1] = 0;
599 if (0 != memcmp(enc_key
->mac_addr
, bc_mac
, sizeof(bc_mac
))) {
600 /* WAPI pairwise key: unicast */
601 key_material
->key_param_set
.key_info
|=
602 cpu_to_le16(KEY_UNICAST
);
603 } else { /* WAPI group key: multicast */
604 key_material
->key_param_set
.key_info
|=
605 cpu_to_le16(KEY_MCAST
);
606 priv
->sec_info
.wapi_key_on
= true;
609 key_material
->key_param_set
.type
=
610 cpu_to_le16(TLV_TYPE_KEY_MATERIAL
);
611 key_material
->key_param_set
.key_len
=
612 cpu_to_le16(WAPI_KEY_LEN
);
613 memcpy(&key_material
->key_param_set
.key
[2],
614 enc_key
->key_material
, enc_key
->key_len
);
615 memcpy(&key_material
->key_param_set
.key
[2 + enc_key
->key_len
],
616 enc_key
->wapi_rxpn
, WAPI_RXPN_LEN
);
617 key_material
->key_param_set
.length
=
618 cpu_to_le16(WAPI_KEY_LEN
+ KEYPARAMSET_FIXED_LEN
);
620 key_param_len
= (WAPI_KEY_LEN
+ KEYPARAMSET_FIXED_LEN
) +
621 sizeof(struct mwifiex_ie_types_header
);
622 cmd
->size
= cpu_to_le16(key_param_len
+
623 sizeof(key_material
->action
) + S_DS_GEN
);
626 if (enc_key
->key_len
== WLAN_KEY_LEN_CCMP
) {
627 dev_dbg(priv
->adapter
->dev
, "cmd: WPA_AES\n");
628 key_material
->key_param_set
.key_type_id
=
629 cpu_to_le16(KEY_TYPE_ID_AES
);
630 if (cmd_oid
== KEY_INFO_ENABLED
)
631 key_material
->key_param_set
.key_info
=
632 cpu_to_le16(KEY_ENABLED
);
634 key_material
->key_param_set
.key_info
=
635 cpu_to_le16(!KEY_ENABLED
);
637 if (enc_key
->key_index
& MWIFIEX_KEY_INDEX_UNICAST
)
638 /* AES pairwise key: unicast */
639 key_material
->key_param_set
.key_info
|=
640 cpu_to_le16(KEY_UNICAST
);
641 else /* AES group key: multicast */
642 key_material
->key_param_set
.key_info
|=
643 cpu_to_le16(KEY_MCAST
);
644 } else if (enc_key
->key_len
== WLAN_KEY_LEN_TKIP
) {
645 dev_dbg(priv
->adapter
->dev
, "cmd: WPA_TKIP\n");
646 key_material
->key_param_set
.key_type_id
=
647 cpu_to_le16(KEY_TYPE_ID_TKIP
);
648 key_material
->key_param_set
.key_info
=
649 cpu_to_le16(KEY_ENABLED
);
651 if (enc_key
->key_index
& MWIFIEX_KEY_INDEX_UNICAST
)
652 /* TKIP pairwise key: unicast */
653 key_material
->key_param_set
.key_info
|=
654 cpu_to_le16(KEY_UNICAST
);
655 else /* TKIP group key: multicast */
656 key_material
->key_param_set
.key_info
|=
657 cpu_to_le16(KEY_MCAST
);
660 if (key_material
->key_param_set
.key_type_id
) {
661 key_material
->key_param_set
.type
=
662 cpu_to_le16(TLV_TYPE_KEY_MATERIAL
);
663 key_material
->key_param_set
.key_len
=
664 cpu_to_le16((u16
) enc_key
->key_len
);
665 memcpy(key_material
->key_param_set
.key
, enc_key
->key_material
,
667 key_material
->key_param_set
.length
=
668 cpu_to_le16((u16
) enc_key
->key_len
+
669 KEYPARAMSET_FIXED_LEN
);
671 key_param_len
= (u16
) (enc_key
->key_len
+ KEYPARAMSET_FIXED_LEN
)
672 + sizeof(struct mwifiex_ie_types_header
);
674 cmd
->size
= cpu_to_le16(key_param_len
+
675 sizeof(key_material
->action
) + S_DS_GEN
);
682 * This function prepares command to set/get 11d domain information.
684 * Preparation includes -
685 * - Setting command ID, action and proper size
686 * - Setting domain information fields (for SET only)
687 * - Ensuring correct endian-ness
689 static int mwifiex_cmd_802_11d_domain_info(struct mwifiex_private
*priv
,
690 struct host_cmd_ds_command
*cmd
,
693 struct mwifiex_adapter
*adapter
= priv
->adapter
;
694 struct host_cmd_ds_802_11d_domain_info
*domain_info
=
695 &cmd
->params
.domain_info
;
696 struct mwifiex_ietypes_domain_param_set
*domain
=
697 &domain_info
->domain
;
698 u8 no_of_triplet
= adapter
->domain_reg
.no_of_triplet
;
700 dev_dbg(adapter
->dev
, "info: 11D: no_of_triplet=0x%x\n", no_of_triplet
);
702 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11D_DOMAIN_INFO
);
703 domain_info
->action
= cpu_to_le16(cmd_action
);
704 if (cmd_action
== HostCmd_ACT_GEN_GET
) {
705 cmd
->size
= cpu_to_le16(sizeof(domain_info
->action
) + S_DS_GEN
);
709 /* Set domain info fields */
710 domain
->header
.type
= cpu_to_le16(WLAN_EID_COUNTRY
);
711 memcpy(domain
->country_code
, adapter
->domain_reg
.country_code
,
712 sizeof(domain
->country_code
));
714 domain
->header
.len
= cpu_to_le16((no_of_triplet
*
715 sizeof(struct ieee80211_country_ie_triplet
)) +
716 sizeof(domain
->country_code
));
719 memcpy(domain
->triplet
, adapter
->domain_reg
.triplet
,
721 sizeof(struct ieee80211_country_ie_triplet
));
723 cmd
->size
= cpu_to_le16(sizeof(domain_info
->action
) +
724 le16_to_cpu(domain
->header
.len
) +
725 sizeof(struct mwifiex_ie_types_header
)
728 cmd
->size
= cpu_to_le16(sizeof(domain_info
->action
) + S_DS_GEN
);
735 * This function prepares command to set/get RF channel.
737 * Preparation includes -
738 * - Setting command ID, action and proper size
739 * - Setting RF type and current RF channel (for SET only)
740 * - Ensuring correct endian-ness
742 static int mwifiex_cmd_802_11_rf_channel(struct mwifiex_private
*priv
,
743 struct host_cmd_ds_command
*cmd
,
744 u16 cmd_action
, void *data_buf
)
746 struct host_cmd_ds_802_11_rf_channel
*rf_chan
=
747 &cmd
->params
.rf_channel
;
748 uint16_t rf_type
= le16_to_cpu(rf_chan
->rf_type
);
750 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_RF_CHANNEL
);
751 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_802_11_rf_channel
)
754 if (cmd_action
== HostCmd_ACT_GEN_SET
) {
755 if ((priv
->adapter
->adhoc_start_band
& BAND_A
)
756 || (priv
->adapter
->adhoc_start_band
& BAND_AN
))
758 cpu_to_le16(HostCmd_SCAN_RADIO_TYPE_A
);
760 rf_type
= le16_to_cpu(rf_chan
->rf_type
);
761 SET_SECONDARYCHAN(rf_type
, priv
->adapter
->chan_offset
);
762 rf_chan
->current_channel
= cpu_to_le16(*((u16
*) data_buf
));
764 rf_chan
->action
= cpu_to_le16(cmd_action
);
769 * This function prepares command to set/get IBSS coalescing status.
771 * Preparation includes -
772 * - Setting command ID, action and proper size
773 * - Setting status to enable or disable (for SET only)
774 * - Ensuring correct endian-ness
776 static int mwifiex_cmd_ibss_coalescing_status(struct host_cmd_ds_command
*cmd
,
777 u16 cmd_action
, void *data_buf
)
779 struct host_cmd_ds_802_11_ibss_status
*ibss_coal
=
780 &(cmd
->params
.ibss_coalescing
);
783 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_IBSS_COALESCING_STATUS
);
784 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_802_11_ibss_status
) +
787 ibss_coal
->action
= cpu_to_le16(cmd_action
);
789 switch (cmd_action
) {
790 case HostCmd_ACT_GEN_SET
:
791 if (data_buf
!= NULL
)
792 enable
= *(u16
*) data_buf
;
793 ibss_coal
->enable
= cpu_to_le16(enable
);
796 /* In other case.. Nothing to do */
797 case HostCmd_ACT_GEN_GET
:
806 * This function prepares command to set/get register value.
808 * Preparation includes -
809 * - Setting command ID, action and proper size
810 * - Setting register offset (for both GET and SET) and
811 * register value (for SET only)
812 * - Ensuring correct endian-ness
814 * The following type of registers can be accessed with this function -
822 static int mwifiex_cmd_reg_access(struct host_cmd_ds_command
*cmd
,
823 u16 cmd_action
, void *data_buf
)
825 struct mwifiex_ds_reg_rw
*reg_rw
;
827 reg_rw
= (struct mwifiex_ds_reg_rw
*) data_buf
;
828 switch (le16_to_cpu(cmd
->command
)) {
829 case HostCmd_CMD_MAC_REG_ACCESS
:
831 struct host_cmd_ds_mac_reg_access
*mac_reg
;
833 cmd
->size
= cpu_to_le16(sizeof(*mac_reg
) + S_DS_GEN
);
834 mac_reg
= (struct host_cmd_ds_mac_reg_access
*) &cmd
->
836 mac_reg
->action
= cpu_to_le16(cmd_action
);
838 cpu_to_le16((u16
) le32_to_cpu(reg_rw
->offset
));
839 mac_reg
->value
= reg_rw
->value
;
842 case HostCmd_CMD_BBP_REG_ACCESS
:
844 struct host_cmd_ds_bbp_reg_access
*bbp_reg
;
846 cmd
->size
= cpu_to_le16(sizeof(*bbp_reg
) + S_DS_GEN
);
847 bbp_reg
= (struct host_cmd_ds_bbp_reg_access
*) &cmd
->
849 bbp_reg
->action
= cpu_to_le16(cmd_action
);
851 cpu_to_le16((u16
) le32_to_cpu(reg_rw
->offset
));
852 bbp_reg
->value
= (u8
) le32_to_cpu(reg_rw
->value
);
855 case HostCmd_CMD_RF_REG_ACCESS
:
857 struct host_cmd_ds_rf_reg_access
*rf_reg
;
859 cmd
->size
= cpu_to_le16(sizeof(*rf_reg
) + S_DS_GEN
);
860 rf_reg
= (struct host_cmd_ds_rf_reg_access
*) &cmd
->
862 rf_reg
->action
= cpu_to_le16(cmd_action
);
864 cpu_to_le16((u16
) le32_to_cpu(reg_rw
->offset
));
865 rf_reg
->value
= (u8
) le32_to_cpu(reg_rw
->value
);
868 case HostCmd_CMD_PMIC_REG_ACCESS
:
870 struct host_cmd_ds_pmic_reg_access
*pmic_reg
;
872 cmd
->size
= cpu_to_le16(sizeof(*pmic_reg
) + S_DS_GEN
);
873 pmic_reg
= (struct host_cmd_ds_pmic_reg_access
*) &cmd
->
875 pmic_reg
->action
= cpu_to_le16(cmd_action
);
877 cpu_to_le16((u16
) le32_to_cpu(reg_rw
->offset
));
878 pmic_reg
->value
= (u8
) le32_to_cpu(reg_rw
->value
);
881 case HostCmd_CMD_CAU_REG_ACCESS
:
883 struct host_cmd_ds_rf_reg_access
*cau_reg
;
885 cmd
->size
= cpu_to_le16(sizeof(*cau_reg
) + S_DS_GEN
);
886 cau_reg
= (struct host_cmd_ds_rf_reg_access
*) &cmd
->
888 cau_reg
->action
= cpu_to_le16(cmd_action
);
890 cpu_to_le16((u16
) le32_to_cpu(reg_rw
->offset
));
891 cau_reg
->value
= (u8
) le32_to_cpu(reg_rw
->value
);
894 case HostCmd_CMD_802_11_EEPROM_ACCESS
:
896 struct mwifiex_ds_read_eeprom
*rd_eeprom
=
897 (struct mwifiex_ds_read_eeprom
*) data_buf
;
898 struct host_cmd_ds_802_11_eeprom_access
*cmd_eeprom
=
899 (struct host_cmd_ds_802_11_eeprom_access
*)
902 cmd
->size
= cpu_to_le16(sizeof(*cmd_eeprom
) + S_DS_GEN
);
903 cmd_eeprom
->action
= cpu_to_le16(cmd_action
);
904 cmd_eeprom
->offset
= rd_eeprom
->offset
;
905 cmd_eeprom
->byte_count
= rd_eeprom
->byte_count
;
906 cmd_eeprom
->value
= 0;
917 * This function prepares the commands before sending them to the firmware.
919 * This is a generic function which calls specific command preparation
920 * routines based upon the command number.
922 int mwifiex_sta_prepare_cmd(struct mwifiex_private
*priv
, uint16_t cmd_no
,
923 u16 cmd_action
, u32 cmd_oid
,
924 void *data_buf
, void *cmd_buf
)
926 struct host_cmd_ds_command
*cmd_ptr
=
927 (struct host_cmd_ds_command
*) cmd_buf
;
930 /* Prepare command */
932 case HostCmd_CMD_GET_HW_SPEC
:
933 ret
= mwifiex_cmd_get_hw_spec(priv
, cmd_ptr
);
935 case HostCmd_CMD_MAC_CONTROL
:
936 ret
= mwifiex_cmd_mac_control(priv
, cmd_ptr
, cmd_action
,
939 case HostCmd_CMD_802_11_MAC_ADDRESS
:
940 ret
= mwifiex_cmd_802_11_mac_address(priv
, cmd_ptr
,
943 case HostCmd_CMD_MAC_MULTICAST_ADR
:
944 ret
= mwifiex_cmd_mac_multicast_adr(cmd_ptr
, cmd_action
,
947 case HostCmd_CMD_TX_RATE_CFG
:
948 ret
= mwifiex_cmd_tx_rate_cfg(priv
, cmd_ptr
, cmd_action
,
951 case HostCmd_CMD_TXPWR_CFG
:
952 ret
= mwifiex_cmd_tx_power_cfg(cmd_ptr
, cmd_action
,
955 case HostCmd_CMD_802_11_PS_MODE_ENH
:
956 ret
= mwifiex_cmd_enh_power_mode(priv
, cmd_ptr
, cmd_action
,
957 (uint16_t)cmd_oid
, data_buf
);
959 case HostCmd_CMD_802_11_HS_CFG_ENH
:
960 ret
= mwifiex_cmd_802_11_hs_cfg(priv
, cmd_ptr
, cmd_action
,
961 (struct mwifiex_hs_config_param
*) data_buf
);
963 case HostCmd_CMD_802_11_SCAN
:
964 ret
= mwifiex_cmd_802_11_scan(cmd_ptr
, data_buf
);
966 case HostCmd_CMD_802_11_BG_SCAN_QUERY
:
967 ret
= mwifiex_cmd_802_11_bg_scan_query(cmd_ptr
);
969 case HostCmd_CMD_802_11_ASSOCIATE
:
970 ret
= mwifiex_cmd_802_11_associate(priv
, cmd_ptr
, data_buf
);
972 case HostCmd_CMD_802_11_DEAUTHENTICATE
:
973 ret
= mwifiex_cmd_802_11_deauthenticate(priv
, cmd_ptr
,
976 case HostCmd_CMD_802_11_AD_HOC_START
:
977 ret
= mwifiex_cmd_802_11_ad_hoc_start(priv
, cmd_ptr
,
980 case HostCmd_CMD_802_11_GET_LOG
:
981 ret
= mwifiex_cmd_802_11_get_log(cmd_ptr
);
983 case HostCmd_CMD_802_11_AD_HOC_JOIN
:
984 ret
= mwifiex_cmd_802_11_ad_hoc_join(priv
, cmd_ptr
,
987 case HostCmd_CMD_802_11_AD_HOC_STOP
:
988 ret
= mwifiex_cmd_802_11_ad_hoc_stop(cmd_ptr
);
990 case HostCmd_CMD_RSSI_INFO
:
991 ret
= mwifiex_cmd_802_11_rssi_info(priv
, cmd_ptr
, cmd_action
);
993 case HostCmd_CMD_802_11_SNMP_MIB
:
994 ret
= mwifiex_cmd_802_11_snmp_mib(priv
, cmd_ptr
, cmd_action
,
997 case HostCmd_CMD_802_11_TX_RATE_QUERY
:
999 cpu_to_le16(HostCmd_CMD_802_11_TX_RATE_QUERY
);
1001 cpu_to_le16(sizeof(struct host_cmd_ds_tx_rate_query
) +
1006 case HostCmd_CMD_VERSION_EXT
:
1007 cmd_ptr
->command
= cpu_to_le16(cmd_no
);
1008 cmd_ptr
->params
.verext
.version_str_sel
=
1009 (u8
) (*((u32
*) data_buf
));
1010 memcpy(&cmd_ptr
->params
, data_buf
,
1011 sizeof(struct host_cmd_ds_version_ext
));
1013 cpu_to_le16(sizeof(struct host_cmd_ds_version_ext
) +
1017 case HostCmd_CMD_802_11_RF_CHANNEL
:
1018 ret
= mwifiex_cmd_802_11_rf_channel(priv
, cmd_ptr
, cmd_action
,
1021 case HostCmd_CMD_FUNC_INIT
:
1022 if (priv
->adapter
->hw_status
== MWIFIEX_HW_STATUS_RESET
)
1023 priv
->adapter
->hw_status
= MWIFIEX_HW_STATUS_READY
;
1024 cmd_ptr
->command
= cpu_to_le16(cmd_no
);
1025 cmd_ptr
->size
= cpu_to_le16(S_DS_GEN
);
1027 case HostCmd_CMD_FUNC_SHUTDOWN
:
1028 priv
->adapter
->hw_status
= MWIFIEX_HW_STATUS_RESET
;
1029 cmd_ptr
->command
= cpu_to_le16(cmd_no
);
1030 cmd_ptr
->size
= cpu_to_le16(S_DS_GEN
);
1032 case HostCmd_CMD_11N_ADDBA_REQ
:
1033 ret
= mwifiex_cmd_11n_addba_req(cmd_ptr
, data_buf
);
1035 case HostCmd_CMD_11N_DELBA
:
1036 ret
= mwifiex_cmd_11n_delba(cmd_ptr
, data_buf
);
1038 case HostCmd_CMD_11N_ADDBA_RSP
:
1039 ret
= mwifiex_cmd_11n_addba_rsp_gen(priv
, cmd_ptr
, data_buf
);
1041 case HostCmd_CMD_802_11_KEY_MATERIAL
:
1042 ret
= mwifiex_cmd_802_11_key_material(priv
, cmd_ptr
,
1043 cmd_action
, cmd_oid
,
1046 case HostCmd_CMD_802_11D_DOMAIN_INFO
:
1047 ret
= mwifiex_cmd_802_11d_domain_info(priv
, cmd_ptr
,
1050 case HostCmd_CMD_RECONFIGURE_TX_BUFF
:
1051 ret
= mwifiex_cmd_recfg_tx_buf(priv
, cmd_ptr
, cmd_action
,
1054 case HostCmd_CMD_AMSDU_AGGR_CTRL
:
1055 ret
= mwifiex_cmd_amsdu_aggr_ctrl(cmd_ptr
, cmd_action
,
1058 case HostCmd_CMD_11N_CFG
:
1059 ret
= mwifiex_cmd_11n_cfg(cmd_ptr
, cmd_action
,
1062 case HostCmd_CMD_WMM_GET_STATUS
:
1063 dev_dbg(priv
->adapter
->dev
,
1064 "cmd: WMM: WMM_GET_STATUS cmd sent\n");
1065 cmd_ptr
->command
= cpu_to_le16(HostCmd_CMD_WMM_GET_STATUS
);
1067 cpu_to_le16(sizeof(struct host_cmd_ds_wmm_get_status
) +
1071 case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS
:
1072 ret
= mwifiex_cmd_ibss_coalescing_status(cmd_ptr
, cmd_action
,
1075 case HostCmd_CMD_MAC_REG_ACCESS
:
1076 case HostCmd_CMD_BBP_REG_ACCESS
:
1077 case HostCmd_CMD_RF_REG_ACCESS
:
1078 case HostCmd_CMD_PMIC_REG_ACCESS
:
1079 case HostCmd_CMD_CAU_REG_ACCESS
:
1080 case HostCmd_CMD_802_11_EEPROM_ACCESS
:
1081 ret
= mwifiex_cmd_reg_access(cmd_ptr
, cmd_action
, data_buf
);
1083 case HostCmd_CMD_SET_BSS_MODE
:
1084 cmd_ptr
->command
= cpu_to_le16(cmd_no
);
1085 if (priv
->bss_mode
== NL80211_IFTYPE_ADHOC
)
1086 cmd_ptr
->params
.bss_mode
.con_type
=
1087 CONNECTION_TYPE_ADHOC
;
1088 else if (priv
->bss_mode
== NL80211_IFTYPE_STATION
)
1089 cmd_ptr
->params
.bss_mode
.con_type
=
1090 CONNECTION_TYPE_INFRA
;
1091 cmd_ptr
->size
= cpu_to_le16(sizeof(struct
1092 host_cmd_ds_set_bss_mode
) + S_DS_GEN
);
1096 dev_err(priv
->adapter
->dev
,
1097 "PREP_CMD: unknown cmd- %#x\n", cmd_no
);
1105 * This function issues commands to initialize firmware.
1107 * This is called after firmware download to bring the card to
1110 * The following commands are issued sequentially -
1111 * - Function init (for first interface only)
1112 * - Read MAC address (for first interface only)
1113 * - Reconfigure Tx buffer size (for first interface only)
1114 * - Enable auto deep sleep (for first interface only)
1117 * - Set IBSS coalescing status
1118 * - Set AMSDU aggregation control
1120 * - Set MAC control (this must be the last command to initialize firmware)
1122 int mwifiex_sta_init_cmd(struct mwifiex_private
*priv
, u8 first_sta
)
1126 struct mwifiex_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl
;
1127 struct mwifiex_ds_auto_ds auto_ds
;
1128 enum state_11d_t state_11d
;
1132 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_FUNC_INIT
,
1133 HostCmd_ACT_GEN_SET
, 0, NULL
);
1136 /* Read MAC address from HW */
1137 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_GET_HW_SPEC
,
1138 HostCmd_ACT_GEN_GET
, 0, NULL
);
1142 /* Reconfigure tx buf size */
1143 ret
= mwifiex_send_cmd_async(priv
,
1144 HostCmd_CMD_RECONFIGURE_TX_BUFF
,
1145 HostCmd_ACT_GEN_SET
, 0,
1146 &priv
->adapter
->tx_buf_size
);
1150 /* Enable IEEE PS by default */
1151 priv
->adapter
->ps_mode
= MWIFIEX_802_11_POWER_MODE_PSP
;
1152 ret
= mwifiex_send_cmd_async(priv
,
1153 HostCmd_CMD_802_11_PS_MODE_ENH
,
1154 EN_AUTO_PS
, BITMAP_STA_PS
, NULL
);
1160 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_TX_RATE_CFG
,
1161 HostCmd_ACT_GEN_GET
, 0, NULL
);
1164 priv
->data_rate
= 0;
1167 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_TXPWR_CFG
,
1168 HostCmd_ACT_GEN_GET
, 0, NULL
);
1172 /* set ibss coalescing_status */
1173 ret
= mwifiex_send_cmd_async(priv
,
1174 HostCmd_CMD_802_11_IBSS_COALESCING_STATUS
,
1175 HostCmd_ACT_GEN_SET
, 0, &enable
);
1179 memset(&amsdu_aggr_ctrl
, 0, sizeof(amsdu_aggr_ctrl
));
1180 amsdu_aggr_ctrl
.enable
= true;
1181 /* Send request to firmware */
1182 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_AMSDU_AGGR_CTRL
,
1183 HostCmd_ACT_GEN_SET
, 0,
1184 (void *) &amsdu_aggr_ctrl
);
1187 /* MAC Control must be the last command in init_fw */
1188 /* set MAC Control */
1189 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_MAC_CONTROL
,
1190 HostCmd_ACT_GEN_SET
, 0,
1191 &priv
->curr_pkt_filter
);
1196 /* Enable auto deep sleep */
1197 auto_ds
.auto_ds
= DEEP_SLEEP_ON
;
1198 auto_ds
.idle_time
= DEEP_SLEEP_IDLE_TIME
;
1199 ret
= mwifiex_send_cmd_async(priv
,
1200 HostCmd_CMD_802_11_PS_MODE_ENH
,
1201 EN_AUTO_PS
, BITMAP_AUTO_DS
,
1207 /* Send cmd to FW to enable/disable 11D function */
1208 state_11d
= ENABLE_11D
;
1209 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_802_11_SNMP_MIB
,
1210 HostCmd_ACT_GEN_SET
, DOT11D_I
, &state_11d
);
1212 dev_err(priv
->adapter
->dev
, "11D: failed to enable 11D\n");
1214 /* set last_init_cmd */
1215 priv
->adapter
->last_init_cmd
= HostCmd_CMD_802_11_SNMP_MIB
;