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
, u16
*action
)
72 struct host_cmd_ds_mac_control
*mac_ctrl
= &cmd
->params
.mac_ctrl
;
74 if (cmd_action
!= HostCmd_ACT_GEN_SET
) {
75 dev_err(priv
->adapter
->dev
,
76 "mac_control: only support set cmd\n");
80 cmd
->command
= cpu_to_le16(HostCmd_CMD_MAC_CONTROL
);
82 cpu_to_le16(sizeof(struct host_cmd_ds_mac_control
) + S_DS_GEN
);
83 mac_ctrl
->action
= cpu_to_le16(*action
);
89 * This function prepares command to set/get SNMP MIB.
91 * Preparation includes -
92 * - Setting command ID, action and proper size
93 * - Setting SNMP MIB OID number and value
95 * - Ensuring correct endian-ness
97 * The following SNMP MIB OIDs are supported -
98 * - FRAG_THRESH_I : Fragmentation threshold
99 * - RTS_THRESH_I : RTS threshold
100 * - SHORT_RETRY_LIM_I : Short retry limit
101 * - DOT11D_I : 11d support
103 static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private
*priv
,
104 struct host_cmd_ds_command
*cmd
,
105 u16 cmd_action
, u32 cmd_oid
,
108 struct host_cmd_ds_802_11_snmp_mib
*snmp_mib
= &cmd
->params
.smib
;
110 dev_dbg(priv
->adapter
->dev
, "cmd: SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid
);
111 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_SNMP_MIB
);
112 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_802_11_snmp_mib
)
115 snmp_mib
->oid
= cpu_to_le16((u16
)cmd_oid
);
116 if (cmd_action
== HostCmd_ACT_GEN_GET
) {
117 snmp_mib
->query_type
= cpu_to_le16(HostCmd_ACT_GEN_GET
);
118 snmp_mib
->buf_size
= cpu_to_le16(MAX_SNMP_BUF_SIZE
);
119 le16_add_cpu(&cmd
->size
, MAX_SNMP_BUF_SIZE
);
120 } else if (cmd_action
== HostCmd_ACT_GEN_SET
) {
121 snmp_mib
->query_type
= cpu_to_le16(HostCmd_ACT_GEN_SET
);
122 snmp_mib
->buf_size
= cpu_to_le16(sizeof(u16
));
123 *((__le16
*) (snmp_mib
->value
)) = cpu_to_le16(*ul_temp
);
124 le16_add_cpu(&cmd
->size
, sizeof(u16
));
127 dev_dbg(priv
->adapter
->dev
,
128 "cmd: SNMP_CMD: Action=0x%x, OID=0x%x, OIDSize=0x%x,"
130 cmd_action
, cmd_oid
, le16_to_cpu(snmp_mib
->buf_size
),
131 le16_to_cpu(*(__le16
*) snmp_mib
->value
));
136 * This function prepares command to get log.
138 * Preparation includes -
139 * - Setting command ID and proper size
140 * - Ensuring correct endian-ness
143 mwifiex_cmd_802_11_get_log(struct host_cmd_ds_command
*cmd
)
145 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_GET_LOG
);
146 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_802_11_get_log
) +
152 * This function prepares command to set/get Tx data rate configuration.
154 * Preparation includes -
155 * - Setting command ID, action and proper size
156 * - Setting configuration index, rate scope and rate drop pattern
157 * parameters (as required)
158 * - Ensuring correct endian-ness
160 static int mwifiex_cmd_tx_rate_cfg(struct mwifiex_private
*priv
,
161 struct host_cmd_ds_command
*cmd
,
162 u16 cmd_action
, u16
*pbitmap_rates
)
164 struct host_cmd_ds_tx_rate_cfg
*rate_cfg
= &cmd
->params
.tx_rate_cfg
;
165 struct mwifiex_rate_scope
*rate_scope
;
166 struct mwifiex_rate_drop_pattern
*rate_drop
;
169 cmd
->command
= cpu_to_le16(HostCmd_CMD_TX_RATE_CFG
);
171 rate_cfg
->action
= cpu_to_le16(cmd_action
);
172 rate_cfg
->cfg_index
= 0;
174 rate_scope
= (struct mwifiex_rate_scope
*) ((u8
*) rate_cfg
+
175 sizeof(struct host_cmd_ds_tx_rate_cfg
));
176 rate_scope
->type
= cpu_to_le16(TLV_TYPE_RATE_SCOPE
);
177 rate_scope
->length
= cpu_to_le16
178 (sizeof(*rate_scope
) - sizeof(struct mwifiex_ie_types_header
));
179 if (pbitmap_rates
!= NULL
) {
180 rate_scope
->hr_dsss_rate_bitmap
= cpu_to_le16(pbitmap_rates
[0]);
181 rate_scope
->ofdm_rate_bitmap
= cpu_to_le16(pbitmap_rates
[1]);
183 i
< sizeof(rate_scope
->ht_mcs_rate_bitmap
) / sizeof(u16
);
185 rate_scope
->ht_mcs_rate_bitmap
[i
] =
186 cpu_to_le16(pbitmap_rates
[2 + i
]);
188 rate_scope
->hr_dsss_rate_bitmap
=
189 cpu_to_le16(priv
->bitmap_rates
[0]);
190 rate_scope
->ofdm_rate_bitmap
=
191 cpu_to_le16(priv
->bitmap_rates
[1]);
193 i
< sizeof(rate_scope
->ht_mcs_rate_bitmap
) / sizeof(u16
);
195 rate_scope
->ht_mcs_rate_bitmap
[i
] =
196 cpu_to_le16(priv
->bitmap_rates
[2 + i
]);
199 rate_drop
= (struct mwifiex_rate_drop_pattern
*) ((u8
*) rate_scope
+
200 sizeof(struct mwifiex_rate_scope
));
201 rate_drop
->type
= cpu_to_le16(TLV_TYPE_RATE_DROP_CONTROL
);
202 rate_drop
->length
= cpu_to_le16(sizeof(rate_drop
->rate_drop_mode
));
203 rate_drop
->rate_drop_mode
= 0;
206 cpu_to_le16(S_DS_GEN
+ sizeof(struct host_cmd_ds_tx_rate_cfg
) +
207 sizeof(struct mwifiex_rate_scope
) +
208 sizeof(struct mwifiex_rate_drop_pattern
));
214 * This function prepares command to set/get Tx power configuration.
216 * Preparation includes -
217 * - Setting command ID, action and proper size
218 * - Setting Tx power mode, power group TLV
220 * - Ensuring correct endian-ness
222 static int mwifiex_cmd_tx_power_cfg(struct host_cmd_ds_command
*cmd
,
224 struct host_cmd_ds_txpwr_cfg
*txp
)
226 struct mwifiex_types_power_group
*pg_tlv
;
227 struct host_cmd_ds_txpwr_cfg
*cmd_txp_cfg
= &cmd
->params
.txp_cfg
;
229 cmd
->command
= cpu_to_le16(HostCmd_CMD_TXPWR_CFG
);
231 cpu_to_le16(S_DS_GEN
+ sizeof(struct host_cmd_ds_txpwr_cfg
));
232 switch (cmd_action
) {
233 case HostCmd_ACT_GEN_SET
:
235 pg_tlv
= (struct mwifiex_types_power_group
236 *) ((unsigned long) txp
+
237 sizeof(struct host_cmd_ds_txpwr_cfg
));
238 memmove(cmd_txp_cfg
, txp
,
239 sizeof(struct host_cmd_ds_txpwr_cfg
) +
240 sizeof(struct mwifiex_types_power_group
) +
243 pg_tlv
= (struct mwifiex_types_power_group
*) ((u8
*)
245 sizeof(struct host_cmd_ds_txpwr_cfg
));
246 cmd
->size
= cpu_to_le16(le16_to_cpu(cmd
->size
) +
247 sizeof(struct mwifiex_types_power_group
) +
250 memmove(cmd_txp_cfg
, txp
, sizeof(*txp
));
252 cmd_txp_cfg
->action
= cpu_to_le16(cmd_action
);
254 case HostCmd_ACT_GEN_GET
:
255 cmd_txp_cfg
->action
= cpu_to_le16(cmd_action
);
263 * This function prepares command to set Host Sleep configuration.
265 * Preparation includes -
266 * - Setting command ID and proper size
267 * - Setting Host Sleep action, conditions, ARP filters
269 * - Ensuring correct endian-ness
272 mwifiex_cmd_802_11_hs_cfg(struct mwifiex_private
*priv
,
273 struct host_cmd_ds_command
*cmd
,
275 struct mwifiex_hs_config_param
*hscfg_param
)
277 struct mwifiex_adapter
*adapter
= priv
->adapter
;
278 struct host_cmd_ds_802_11_hs_cfg_enh
*hs_cfg
= &cmd
->params
.opt_hs_cfg
;
279 u16 hs_activate
= false;
282 /* New Activate command */
284 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH
);
287 (hscfg_param
->conditions
!= cpu_to_le32(HOST_SLEEP_CFG_CANCEL
)) &&
288 ((adapter
->arp_filter_size
> 0) &&
289 (adapter
->arp_filter_size
<= ARP_FILTER_MAX_BUF_SIZE
))) {
290 dev_dbg(adapter
->dev
,
291 "cmd: Attach %d bytes ArpFilter to HSCfg cmd\n",
292 adapter
->arp_filter_size
);
293 memcpy(((u8
*) hs_cfg
) +
294 sizeof(struct host_cmd_ds_802_11_hs_cfg_enh
),
295 adapter
->arp_filter
, adapter
->arp_filter_size
);
296 cmd
->size
= cpu_to_le16
297 (adapter
->arp_filter_size
+
298 sizeof(struct host_cmd_ds_802_11_hs_cfg_enh
)
301 cmd
->size
= cpu_to_le16(S_DS_GEN
+ sizeof(struct
302 host_cmd_ds_802_11_hs_cfg_enh
));
305 hs_cfg
->action
= cpu_to_le16(HS_ACTIVATE
);
306 hs_cfg
->params
.hs_activate
.resp_ctrl
= RESP_NEEDED
;
308 hs_cfg
->action
= cpu_to_le16(HS_CONFIGURE
);
309 hs_cfg
->params
.hs_config
.conditions
= hscfg_param
->conditions
;
310 hs_cfg
->params
.hs_config
.gpio
= hscfg_param
->gpio
;
311 hs_cfg
->params
.hs_config
.gap
= hscfg_param
->gap
;
312 dev_dbg(adapter
->dev
,
313 "cmd: HS_CFG_CMD: condition:0x%x gpio:0x%x gap:0x%x\n",
314 hs_cfg
->params
.hs_config
.conditions
,
315 hs_cfg
->params
.hs_config
.gpio
,
316 hs_cfg
->params
.hs_config
.gap
);
323 * This function prepares command to set/get MAC address.
325 * Preparation includes -
326 * - Setting command ID, action and proper size
327 * - Setting MAC address (for SET only)
328 * - Ensuring correct endian-ness
330 static int mwifiex_cmd_802_11_mac_address(struct mwifiex_private
*priv
,
331 struct host_cmd_ds_command
*cmd
,
334 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_MAC_ADDRESS
);
335 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_802_11_mac_address
) +
339 cmd
->params
.mac_addr
.action
= cpu_to_le16(cmd_action
);
341 if (cmd_action
== HostCmd_ACT_GEN_SET
)
342 memcpy(cmd
->params
.mac_addr
.mac_addr
, priv
->curr_addr
,
348 * This function prepares command to set MAC multicast address.
350 * Preparation includes -
351 * - Setting command ID, action and proper size
352 * - Setting MAC multicast address
353 * - Ensuring correct endian-ness
356 mwifiex_cmd_mac_multicast_adr(struct host_cmd_ds_command
*cmd
,
358 struct mwifiex_multicast_list
*mcast_list
)
360 struct host_cmd_ds_mac_multicast_adr
*mcast_addr
= &cmd
->params
.mc_addr
;
362 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_mac_multicast_adr
) +
364 cmd
->command
= cpu_to_le16(HostCmd_CMD_MAC_MULTICAST_ADR
);
366 mcast_addr
->action
= cpu_to_le16(cmd_action
);
367 mcast_addr
->num_of_adrs
=
368 cpu_to_le16((u16
) mcast_list
->num_multicast_addr
);
369 memcpy(mcast_addr
->mac_list
, mcast_list
->mac_list
,
370 mcast_list
->num_multicast_addr
* ETH_ALEN
);
376 * This function prepares command to deauthenticate.
378 * Preparation includes -
379 * - Setting command ID and proper size
380 * - Setting AP MAC address and reason code
381 * - Ensuring correct endian-ness
383 static int mwifiex_cmd_802_11_deauthenticate(struct mwifiex_private
*priv
,
384 struct host_cmd_ds_command
*cmd
,
387 struct host_cmd_ds_802_11_deauthenticate
*deauth
= &cmd
->params
.deauth
;
389 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_DEAUTHENTICATE
);
390 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_802_11_deauthenticate
)
393 /* Set AP MAC address */
394 memcpy(deauth
->mac_addr
, mac
, ETH_ALEN
);
396 dev_dbg(priv
->adapter
->dev
, "cmd: Deauth: %pM\n", deauth
->mac_addr
);
398 deauth
->reason_code
= cpu_to_le16(WLAN_REASON_DEAUTH_LEAVING
);
404 * This function prepares command to stop Ad-Hoc network.
406 * Preparation includes -
407 * - Setting command ID and proper size
408 * - Ensuring correct endian-ness
410 static int mwifiex_cmd_802_11_ad_hoc_stop(struct host_cmd_ds_command
*cmd
)
412 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_AD_HOC_STOP
);
413 cmd
->size
= cpu_to_le16(S_DS_GEN
);
418 * This function sets WEP key(s) to key parameter TLV(s).
420 * Multi-key parameter TLVs are supported, so we can send multiple
421 * WEP keys in a single buffer.
424 mwifiex_set_keyparamset_wep(struct mwifiex_private
*priv
,
425 struct mwifiex_ie_type_key_param_set
*key_param_set
,
428 int cur_key_param_len
;
431 /* Multi-key_param_set TLV is supported */
432 for (i
= 0; i
< NUM_WEP_KEYS
; i
++) {
433 if ((priv
->wep_key
[i
].key_length
== WLAN_KEY_LEN_WEP40
) ||
434 (priv
->wep_key
[i
].key_length
== WLAN_KEY_LEN_WEP104
)) {
435 key_param_set
->type
=
436 cpu_to_le16(TLV_TYPE_KEY_MATERIAL
);
437 /* Key_param_set WEP fixed length */
438 #define KEYPARAMSET_WEP_FIXED_LEN 8
439 key_param_set
->length
= cpu_to_le16((u16
)
442 KEYPARAMSET_WEP_FIXED_LEN
));
443 key_param_set
->key_type_id
=
444 cpu_to_le16(KEY_TYPE_ID_WEP
);
445 key_param_set
->key_info
=
446 cpu_to_le16(KEY_ENABLED
| KEY_UNICAST
|
448 key_param_set
->key_len
=
449 cpu_to_le16(priv
->wep_key
[i
].key_length
);
450 /* Set WEP key index */
451 key_param_set
->key
[0] = i
;
452 /* Set default Tx key flag */
455 wep_key_curr_index
& HostCmd_WEP_KEY_INDEX_MASK
))
456 key_param_set
->key
[1] = 1;
458 key_param_set
->key
[1] = 0;
459 memmove(&key_param_set
->key
[2],
460 priv
->wep_key
[i
].key_material
,
461 priv
->wep_key
[i
].key_length
);
463 cur_key_param_len
= priv
->wep_key
[i
].key_length
+
464 KEYPARAMSET_WEP_FIXED_LEN
+
465 sizeof(struct mwifiex_ie_types_header
);
466 *key_param_len
+= (u16
) cur_key_param_len
;
468 (struct mwifiex_ie_type_key_param_set
*)
469 ((u8
*)key_param_set
+
471 } else if (!priv
->wep_key
[i
].key_length
) {
474 dev_err(priv
->adapter
->dev
,
475 "key%d Length = %d is incorrect\n",
476 (i
+ 1), priv
->wep_key
[i
].key_length
);
485 * This function prepares command to set/get/reset network key(s).
487 * Preparation includes -
488 * - Setting command ID, action and proper size
489 * - Setting WEP keys, WAPI keys or WPA keys along with required
490 * encryption (TKIP, AES) (as required)
491 * - Ensuring correct endian-ness
494 mwifiex_cmd_802_11_key_material(struct mwifiex_private
*priv
,
495 struct host_cmd_ds_command
*cmd
,
496 u16 cmd_action
, u32 cmd_oid
,
497 struct mwifiex_ds_encrypt_key
*enc_key
)
499 struct host_cmd_ds_802_11_key_material
*key_material
=
500 &cmd
->params
.key_material
;
501 u16 key_param_len
= 0;
503 const u8 bc_mac
[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
505 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_KEY_MATERIAL
);
506 key_material
->action
= cpu_to_le16(cmd_action
);
508 if (cmd_action
== HostCmd_ACT_GEN_GET
) {
510 cpu_to_le16(sizeof(key_material
->action
) + S_DS_GEN
);
515 memset(&key_material
->key_param_set
, 0,
517 sizeof(struct mwifiex_ie_type_key_param_set
)));
518 ret
= mwifiex_set_keyparamset_wep(priv
,
519 &key_material
->key_param_set
,
521 cmd
->size
= cpu_to_le16(key_param_len
+
522 sizeof(key_material
->action
) + S_DS_GEN
);
525 memset(&key_material
->key_param_set
, 0,
526 sizeof(struct mwifiex_ie_type_key_param_set
));
527 if (enc_key
->is_wapi_key
) {
528 dev_dbg(priv
->adapter
->dev
, "info: Set WAPI Key\n");
529 key_material
->key_param_set
.key_type_id
=
530 cpu_to_le16(KEY_TYPE_ID_WAPI
);
531 if (cmd_oid
== KEY_INFO_ENABLED
)
532 key_material
->key_param_set
.key_info
=
533 cpu_to_le16(KEY_ENABLED
);
535 key_material
->key_param_set
.key_info
=
536 cpu_to_le16(!KEY_ENABLED
);
538 key_material
->key_param_set
.key
[0] = enc_key
->key_index
;
539 if (!priv
->sec_info
.wapi_key_on
)
540 key_material
->key_param_set
.key
[1] = 1;
542 /* set 0 when re-key */
543 key_material
->key_param_set
.key
[1] = 0;
545 if (0 != memcmp(enc_key
->mac_addr
, bc_mac
, sizeof(bc_mac
))) {
546 /* WAPI pairwise key: unicast */
547 key_material
->key_param_set
.key_info
|=
548 cpu_to_le16(KEY_UNICAST
);
549 } else { /* WAPI group key: multicast */
550 key_material
->key_param_set
.key_info
|=
551 cpu_to_le16(KEY_MCAST
);
552 priv
->sec_info
.wapi_key_on
= true;
555 key_material
->key_param_set
.type
=
556 cpu_to_le16(TLV_TYPE_KEY_MATERIAL
);
557 key_material
->key_param_set
.key_len
=
558 cpu_to_le16(WAPI_KEY_LEN
);
559 memcpy(&key_material
->key_param_set
.key
[2],
560 enc_key
->key_material
, enc_key
->key_len
);
561 memcpy(&key_material
->key_param_set
.key
[2 + enc_key
->key_len
],
562 enc_key
->wapi_rxpn
, WAPI_RXPN_LEN
);
563 key_material
->key_param_set
.length
=
564 cpu_to_le16(WAPI_KEY_LEN
+ KEYPARAMSET_FIXED_LEN
);
566 key_param_len
= (WAPI_KEY_LEN
+ KEYPARAMSET_FIXED_LEN
) +
567 sizeof(struct mwifiex_ie_types_header
);
568 cmd
->size
= cpu_to_le16(sizeof(key_material
->action
)
569 + S_DS_GEN
+ key_param_len
);
572 if (enc_key
->key_len
== WLAN_KEY_LEN_CCMP
) {
573 dev_dbg(priv
->adapter
->dev
, "cmd: WPA_AES\n");
574 key_material
->key_param_set
.key_type_id
=
575 cpu_to_le16(KEY_TYPE_ID_AES
);
576 if (cmd_oid
== KEY_INFO_ENABLED
)
577 key_material
->key_param_set
.key_info
=
578 cpu_to_le16(KEY_ENABLED
);
580 key_material
->key_param_set
.key_info
=
581 cpu_to_le16(!KEY_ENABLED
);
583 if (enc_key
->key_index
& MWIFIEX_KEY_INDEX_UNICAST
)
584 /* AES pairwise key: unicast */
585 key_material
->key_param_set
.key_info
|=
586 cpu_to_le16(KEY_UNICAST
);
587 else /* AES group key: multicast */
588 key_material
->key_param_set
.key_info
|=
589 cpu_to_le16(KEY_MCAST
);
590 } else if (enc_key
->key_len
== WLAN_KEY_LEN_TKIP
) {
591 dev_dbg(priv
->adapter
->dev
, "cmd: WPA_TKIP\n");
592 key_material
->key_param_set
.key_type_id
=
593 cpu_to_le16(KEY_TYPE_ID_TKIP
);
594 key_material
->key_param_set
.key_info
=
595 cpu_to_le16(KEY_ENABLED
);
597 if (enc_key
->key_index
& MWIFIEX_KEY_INDEX_UNICAST
)
598 /* TKIP pairwise key: unicast */
599 key_material
->key_param_set
.key_info
|=
600 cpu_to_le16(KEY_UNICAST
);
601 else /* TKIP group key: multicast */
602 key_material
->key_param_set
.key_info
|=
603 cpu_to_le16(KEY_MCAST
);
606 if (key_material
->key_param_set
.key_type_id
) {
607 key_material
->key_param_set
.type
=
608 cpu_to_le16(TLV_TYPE_KEY_MATERIAL
);
609 key_material
->key_param_set
.key_len
=
610 cpu_to_le16((u16
) enc_key
->key_len
);
611 memcpy(key_material
->key_param_set
.key
, enc_key
->key_material
,
613 key_material
->key_param_set
.length
=
614 cpu_to_le16((u16
) enc_key
->key_len
+
615 KEYPARAMSET_FIXED_LEN
);
617 key_param_len
= (u16
) (enc_key
->key_len
+ KEYPARAMSET_FIXED_LEN
)
618 + sizeof(struct mwifiex_ie_types_header
);
620 cmd
->size
= cpu_to_le16(sizeof(key_material
->action
) + S_DS_GEN
628 * This function prepares command to set/get 11d domain information.
630 * Preparation includes -
631 * - Setting command ID, action and proper size
632 * - Setting domain information fields (for SET only)
633 * - Ensuring correct endian-ness
635 static int mwifiex_cmd_802_11d_domain_info(struct mwifiex_private
*priv
,
636 struct host_cmd_ds_command
*cmd
,
639 struct mwifiex_adapter
*adapter
= priv
->adapter
;
640 struct host_cmd_ds_802_11d_domain_info
*domain_info
=
641 &cmd
->params
.domain_info
;
642 struct mwifiex_ietypes_domain_param_set
*domain
=
643 &domain_info
->domain
;
644 u8 no_of_triplet
= adapter
->domain_reg
.no_of_triplet
;
646 dev_dbg(adapter
->dev
, "info: 11D: no_of_triplet=0x%x\n", no_of_triplet
);
648 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11D_DOMAIN_INFO
);
649 domain_info
->action
= cpu_to_le16(cmd_action
);
650 if (cmd_action
== HostCmd_ACT_GEN_GET
) {
651 cmd
->size
= cpu_to_le16(sizeof(domain_info
->action
) + S_DS_GEN
);
655 /* Set domain info fields */
656 domain
->header
.type
= cpu_to_le16(WLAN_EID_COUNTRY
);
657 memcpy(domain
->country_code
, adapter
->domain_reg
.country_code
,
658 sizeof(domain
->country_code
));
661 cpu_to_le16((no_of_triplet
*
662 sizeof(struct ieee80211_country_ie_triplet
))
663 + sizeof(domain
->country_code
));
666 memcpy(domain
->triplet
, adapter
->domain_reg
.triplet
,
667 no_of_triplet
* sizeof(struct
668 ieee80211_country_ie_triplet
));
670 cmd
->size
= cpu_to_le16(sizeof(domain_info
->action
) +
671 le16_to_cpu(domain
->header
.len
) +
672 sizeof(struct mwifiex_ie_types_header
)
675 cmd
->size
= cpu_to_le16(sizeof(domain_info
->action
) + S_DS_GEN
);
682 * This function prepares command to set/get RF channel.
684 * Preparation includes -
685 * - Setting command ID, action and proper size
686 * - Setting RF type and current RF channel (for SET only)
687 * - Ensuring correct endian-ness
689 static int mwifiex_cmd_802_11_rf_channel(struct mwifiex_private
*priv
,
690 struct host_cmd_ds_command
*cmd
,
691 u16 cmd_action
, u16
*channel
)
693 struct host_cmd_ds_802_11_rf_channel
*rf_chan
=
694 &cmd
->params
.rf_channel
;
695 uint16_t rf_type
= le16_to_cpu(rf_chan
->rf_type
);
697 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_RF_CHANNEL
);
698 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_802_11_rf_channel
)
701 if (cmd_action
== HostCmd_ACT_GEN_SET
) {
702 if ((priv
->adapter
->adhoc_start_band
& BAND_A
) ||
703 (priv
->adapter
->adhoc_start_band
& BAND_AN
))
705 cpu_to_le16(HostCmd_SCAN_RADIO_TYPE_A
);
707 rf_type
= le16_to_cpu(rf_chan
->rf_type
);
708 SET_SECONDARYCHAN(rf_type
, priv
->adapter
->sec_chan_offset
);
709 rf_chan
->current_channel
= cpu_to_le16(*channel
);
711 rf_chan
->action
= cpu_to_le16(cmd_action
);
716 * This function prepares command to set/get IBSS coalescing status.
718 * Preparation includes -
719 * - Setting command ID, action and proper size
720 * - Setting status to enable or disable (for SET only)
721 * - Ensuring correct endian-ness
723 static int mwifiex_cmd_ibss_coalescing_status(struct host_cmd_ds_command
*cmd
,
724 u16 cmd_action
, u16
*enable
)
726 struct host_cmd_ds_802_11_ibss_status
*ibss_coal
=
727 &(cmd
->params
.ibss_coalescing
);
729 cmd
->command
= cpu_to_le16(HostCmd_CMD_802_11_IBSS_COALESCING_STATUS
);
730 cmd
->size
= cpu_to_le16(sizeof(struct host_cmd_ds_802_11_ibss_status
) +
733 ibss_coal
->action
= cpu_to_le16(cmd_action
);
735 switch (cmd_action
) {
736 case HostCmd_ACT_GEN_SET
:
738 ibss_coal
->enable
= cpu_to_le16(*enable
);
740 ibss_coal
->enable
= 0;
743 /* In other case.. Nothing to do */
744 case HostCmd_ACT_GEN_GET
:
753 * This function prepares command to set/get register value.
755 * Preparation includes -
756 * - Setting command ID, action and proper size
757 * - Setting register offset (for both GET and SET) and
758 * register value (for SET only)
759 * - Ensuring correct endian-ness
761 * The following type of registers can be accessed with this function -
769 static int mwifiex_cmd_reg_access(struct host_cmd_ds_command
*cmd
,
770 u16 cmd_action
, void *data_buf
)
772 struct mwifiex_ds_reg_rw
*reg_rw
= data_buf
;
774 switch (le16_to_cpu(cmd
->command
)) {
775 case HostCmd_CMD_MAC_REG_ACCESS
:
777 struct host_cmd_ds_mac_reg_access
*mac_reg
;
779 cmd
->size
= cpu_to_le16(sizeof(*mac_reg
) + S_DS_GEN
);
780 mac_reg
= (struct host_cmd_ds_mac_reg_access
*) &cmd
->
782 mac_reg
->action
= cpu_to_le16(cmd_action
);
784 cpu_to_le16((u16
) le32_to_cpu(reg_rw
->offset
));
785 mac_reg
->value
= reg_rw
->value
;
788 case HostCmd_CMD_BBP_REG_ACCESS
:
790 struct host_cmd_ds_bbp_reg_access
*bbp_reg
;
792 cmd
->size
= cpu_to_le16(sizeof(*bbp_reg
) + S_DS_GEN
);
793 bbp_reg
= (struct host_cmd_ds_bbp_reg_access
*)
794 &cmd
->params
.bbp_reg
;
795 bbp_reg
->action
= cpu_to_le16(cmd_action
);
797 cpu_to_le16((u16
) le32_to_cpu(reg_rw
->offset
));
798 bbp_reg
->value
= (u8
) le32_to_cpu(reg_rw
->value
);
801 case HostCmd_CMD_RF_REG_ACCESS
:
803 struct host_cmd_ds_rf_reg_access
*rf_reg
;
805 cmd
->size
= cpu_to_le16(sizeof(*rf_reg
) + S_DS_GEN
);
806 rf_reg
= (struct host_cmd_ds_rf_reg_access
*)
808 rf_reg
->action
= cpu_to_le16(cmd_action
);
809 rf_reg
->offset
= cpu_to_le16((u16
) le32_to_cpu(reg_rw
->offset
));
810 rf_reg
->value
= (u8
) le32_to_cpu(reg_rw
->value
);
813 case HostCmd_CMD_PMIC_REG_ACCESS
:
815 struct host_cmd_ds_pmic_reg_access
*pmic_reg
;
817 cmd
->size
= cpu_to_le16(sizeof(*pmic_reg
) + S_DS_GEN
);
818 pmic_reg
= (struct host_cmd_ds_pmic_reg_access
*) &cmd
->
820 pmic_reg
->action
= cpu_to_le16(cmd_action
);
822 cpu_to_le16((u16
) le32_to_cpu(reg_rw
->offset
));
823 pmic_reg
->value
= (u8
) le32_to_cpu(reg_rw
->value
);
826 case HostCmd_CMD_CAU_REG_ACCESS
:
828 struct host_cmd_ds_rf_reg_access
*cau_reg
;
830 cmd
->size
= cpu_to_le16(sizeof(*cau_reg
) + S_DS_GEN
);
831 cau_reg
= (struct host_cmd_ds_rf_reg_access
*)
833 cau_reg
->action
= cpu_to_le16(cmd_action
);
835 cpu_to_le16((u16
) le32_to_cpu(reg_rw
->offset
));
836 cau_reg
->value
= (u8
) le32_to_cpu(reg_rw
->value
);
839 case HostCmd_CMD_802_11_EEPROM_ACCESS
:
841 struct mwifiex_ds_read_eeprom
*rd_eeprom
= data_buf
;
842 struct host_cmd_ds_802_11_eeprom_access
*cmd_eeprom
=
843 (struct host_cmd_ds_802_11_eeprom_access
*)
846 cmd
->size
= cpu_to_le16(sizeof(*cmd_eeprom
) + S_DS_GEN
);
847 cmd_eeprom
->action
= cpu_to_le16(cmd_action
);
848 cmd_eeprom
->offset
= rd_eeprom
->offset
;
849 cmd_eeprom
->byte_count
= rd_eeprom
->byte_count
;
850 cmd_eeprom
->value
= 0;
861 * This function prepares command to set PCI-Express
862 * host buffer configuration
864 * Preparation includes -
865 * - Setting command ID, action and proper size
866 * - Setting host buffer configuration
867 * - Ensuring correct endian-ness
870 mwifiex_cmd_pcie_host_spec(struct mwifiex_private
*priv
,
871 struct host_cmd_ds_command
*cmd
, u16 action
)
873 struct host_cmd_ds_pcie_details
*host_spec
=
874 &cmd
->params
.pcie_host_spec
;
875 struct pcie_service_card
*card
= priv
->adapter
->card
;
878 cmd
->command
= cpu_to_le16(HostCmd_CMD_PCIE_DESC_DETAILS
);
879 cmd
->size
= cpu_to_le16(sizeof(struct
880 host_cmd_ds_pcie_details
) + S_DS_GEN
);
883 memset(host_spec
, 0, sizeof(struct host_cmd_ds_pcie_details
));
885 if (action
!= HostCmd_ACT_GEN_SET
)
888 /* Send the ring base addresses and count to firmware */
889 host_spec
->txbd_addr_lo
= (u32
)(card
->txbd_ring_pbase
);
890 host_spec
->txbd_addr_hi
= (u32
)(((u64
)card
->txbd_ring_pbase
)>>32);
891 host_spec
->txbd_count
= MWIFIEX_MAX_TXRX_BD
;
892 host_spec
->rxbd_addr_lo
= (u32
)(card
->rxbd_ring_pbase
);
893 host_spec
->rxbd_addr_hi
= (u32
)(((u64
)card
->rxbd_ring_pbase
)>>32);
894 host_spec
->rxbd_count
= MWIFIEX_MAX_TXRX_BD
;
895 host_spec
->evtbd_addr_lo
= (u32
)(card
->evtbd_ring_pbase
);
896 host_spec
->evtbd_addr_hi
= (u32
)(((u64
)card
->evtbd_ring_pbase
)>>32);
897 host_spec
->evtbd_count
= MWIFIEX_MAX_EVT_BD
;
898 if (card
->sleep_cookie
) {
899 buf_pa
= MWIFIEX_SKB_PACB(card
->sleep_cookie
);
900 host_spec
->sleep_cookie_addr_lo
= (u32
) *buf_pa
;
901 host_spec
->sleep_cookie_addr_hi
= (u32
) (((u64
)*buf_pa
) >> 32);
902 dev_dbg(priv
->adapter
->dev
, "sleep_cook_lo phy addr: 0x%x\n",
903 host_spec
->sleep_cookie_addr_lo
);
910 * This function prepares the commands before sending them to the firmware.
912 * This is a generic function which calls specific command preparation
913 * routines based upon the command number.
915 int mwifiex_sta_prepare_cmd(struct mwifiex_private
*priv
, uint16_t cmd_no
,
916 u16 cmd_action
, u32 cmd_oid
,
917 void *data_buf
, void *cmd_buf
)
919 struct host_cmd_ds_command
*cmd_ptr
= cmd_buf
;
922 /* Prepare command */
924 case HostCmd_CMD_GET_HW_SPEC
:
925 ret
= mwifiex_cmd_get_hw_spec(priv
, cmd_ptr
);
927 case HostCmd_CMD_MAC_CONTROL
:
928 ret
= mwifiex_cmd_mac_control(priv
, cmd_ptr
, cmd_action
,
931 case HostCmd_CMD_802_11_MAC_ADDRESS
:
932 ret
= mwifiex_cmd_802_11_mac_address(priv
, cmd_ptr
,
935 case HostCmd_CMD_MAC_MULTICAST_ADR
:
936 ret
= mwifiex_cmd_mac_multicast_adr(cmd_ptr
, cmd_action
,
939 case HostCmd_CMD_TX_RATE_CFG
:
940 ret
= mwifiex_cmd_tx_rate_cfg(priv
, cmd_ptr
, cmd_action
,
943 case HostCmd_CMD_TXPWR_CFG
:
944 ret
= mwifiex_cmd_tx_power_cfg(cmd_ptr
, cmd_action
,
947 case HostCmd_CMD_802_11_PS_MODE_ENH
:
948 ret
= mwifiex_cmd_enh_power_mode(priv
, cmd_ptr
, cmd_action
,
949 (uint16_t)cmd_oid
, data_buf
);
951 case HostCmd_CMD_802_11_HS_CFG_ENH
:
952 ret
= mwifiex_cmd_802_11_hs_cfg(priv
, cmd_ptr
, cmd_action
,
953 (struct mwifiex_hs_config_param
*) data_buf
);
955 case HostCmd_CMD_802_11_SCAN
:
956 ret
= mwifiex_cmd_802_11_scan(cmd_ptr
, data_buf
);
958 case HostCmd_CMD_802_11_BG_SCAN_QUERY
:
959 ret
= mwifiex_cmd_802_11_bg_scan_query(cmd_ptr
);
961 case HostCmd_CMD_802_11_ASSOCIATE
:
962 ret
= mwifiex_cmd_802_11_associate(priv
, cmd_ptr
, data_buf
);
964 case HostCmd_CMD_802_11_DEAUTHENTICATE
:
965 ret
= mwifiex_cmd_802_11_deauthenticate(priv
, cmd_ptr
,
968 case HostCmd_CMD_802_11_AD_HOC_START
:
969 ret
= mwifiex_cmd_802_11_ad_hoc_start(priv
, cmd_ptr
,
972 case HostCmd_CMD_802_11_GET_LOG
:
973 ret
= mwifiex_cmd_802_11_get_log(cmd_ptr
);
975 case HostCmd_CMD_802_11_AD_HOC_JOIN
:
976 ret
= mwifiex_cmd_802_11_ad_hoc_join(priv
, cmd_ptr
,
979 case HostCmd_CMD_802_11_AD_HOC_STOP
:
980 ret
= mwifiex_cmd_802_11_ad_hoc_stop(cmd_ptr
);
982 case HostCmd_CMD_RSSI_INFO
:
983 ret
= mwifiex_cmd_802_11_rssi_info(priv
, cmd_ptr
, cmd_action
);
985 case HostCmd_CMD_802_11_SNMP_MIB
:
986 ret
= mwifiex_cmd_802_11_snmp_mib(priv
, cmd_ptr
, cmd_action
,
989 case HostCmd_CMD_802_11_TX_RATE_QUERY
:
991 cpu_to_le16(HostCmd_CMD_802_11_TX_RATE_QUERY
);
993 cpu_to_le16(sizeof(struct host_cmd_ds_tx_rate_query
) +
998 case HostCmd_CMD_VERSION_EXT
:
999 cmd_ptr
->command
= cpu_to_le16(cmd_no
);
1000 cmd_ptr
->params
.verext
.version_str_sel
=
1001 (u8
) (*((u32
*) data_buf
));
1002 memcpy(&cmd_ptr
->params
, data_buf
,
1003 sizeof(struct host_cmd_ds_version_ext
));
1005 cpu_to_le16(sizeof(struct host_cmd_ds_version_ext
) +
1009 case HostCmd_CMD_802_11_RF_CHANNEL
:
1010 ret
= mwifiex_cmd_802_11_rf_channel(priv
, cmd_ptr
, cmd_action
,
1013 case HostCmd_CMD_FUNC_INIT
:
1014 if (priv
->adapter
->hw_status
== MWIFIEX_HW_STATUS_RESET
)
1015 priv
->adapter
->hw_status
= MWIFIEX_HW_STATUS_READY
;
1016 cmd_ptr
->command
= cpu_to_le16(cmd_no
);
1017 cmd_ptr
->size
= cpu_to_le16(S_DS_GEN
);
1019 case HostCmd_CMD_FUNC_SHUTDOWN
:
1020 priv
->adapter
->hw_status
= MWIFIEX_HW_STATUS_RESET
;
1021 cmd_ptr
->command
= cpu_to_le16(cmd_no
);
1022 cmd_ptr
->size
= cpu_to_le16(S_DS_GEN
);
1024 case HostCmd_CMD_11N_ADDBA_REQ
:
1025 ret
= mwifiex_cmd_11n_addba_req(cmd_ptr
, data_buf
);
1027 case HostCmd_CMD_11N_DELBA
:
1028 ret
= mwifiex_cmd_11n_delba(cmd_ptr
, data_buf
);
1030 case HostCmd_CMD_11N_ADDBA_RSP
:
1031 ret
= mwifiex_cmd_11n_addba_rsp_gen(priv
, cmd_ptr
, data_buf
);
1033 case HostCmd_CMD_802_11_KEY_MATERIAL
:
1034 ret
= mwifiex_cmd_802_11_key_material(priv
, cmd_ptr
,
1035 cmd_action
, cmd_oid
,
1038 case HostCmd_CMD_802_11D_DOMAIN_INFO
:
1039 ret
= mwifiex_cmd_802_11d_domain_info(priv
, cmd_ptr
,
1042 case HostCmd_CMD_RECONFIGURE_TX_BUFF
:
1043 ret
= mwifiex_cmd_recfg_tx_buf(priv
, cmd_ptr
, cmd_action
,
1046 case HostCmd_CMD_AMSDU_AGGR_CTRL
:
1047 ret
= mwifiex_cmd_amsdu_aggr_ctrl(cmd_ptr
, cmd_action
,
1050 case HostCmd_CMD_11N_CFG
:
1051 ret
= mwifiex_cmd_11n_cfg(cmd_ptr
, cmd_action
, data_buf
);
1053 case HostCmd_CMD_WMM_GET_STATUS
:
1054 dev_dbg(priv
->adapter
->dev
,
1055 "cmd: WMM: WMM_GET_STATUS cmd sent\n");
1056 cmd_ptr
->command
= cpu_to_le16(HostCmd_CMD_WMM_GET_STATUS
);
1058 cpu_to_le16(sizeof(struct host_cmd_ds_wmm_get_status
) +
1062 case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS
:
1063 ret
= mwifiex_cmd_ibss_coalescing_status(cmd_ptr
, cmd_action
,
1066 case HostCmd_CMD_MAC_REG_ACCESS
:
1067 case HostCmd_CMD_BBP_REG_ACCESS
:
1068 case HostCmd_CMD_RF_REG_ACCESS
:
1069 case HostCmd_CMD_PMIC_REG_ACCESS
:
1070 case HostCmd_CMD_CAU_REG_ACCESS
:
1071 case HostCmd_CMD_802_11_EEPROM_ACCESS
:
1072 ret
= mwifiex_cmd_reg_access(cmd_ptr
, cmd_action
, data_buf
);
1074 case HostCmd_CMD_SET_BSS_MODE
:
1075 cmd_ptr
->command
= cpu_to_le16(cmd_no
);
1076 if (priv
->bss_mode
== NL80211_IFTYPE_ADHOC
)
1077 cmd_ptr
->params
.bss_mode
.con_type
=
1078 CONNECTION_TYPE_ADHOC
;
1079 else if (priv
->bss_mode
== NL80211_IFTYPE_STATION
)
1080 cmd_ptr
->params
.bss_mode
.con_type
=
1081 CONNECTION_TYPE_INFRA
;
1082 cmd_ptr
->size
= cpu_to_le16(sizeof(struct
1083 host_cmd_ds_set_bss_mode
) + S_DS_GEN
);
1086 case HostCmd_CMD_PCIE_DESC_DETAILS
:
1087 ret
= mwifiex_cmd_pcie_host_spec(priv
, cmd_ptr
, cmd_action
);
1090 dev_err(priv
->adapter
->dev
,
1091 "PREP_CMD: unknown cmd- %#x\n", cmd_no
);
1099 * This function issues commands to initialize firmware.
1101 * This is called after firmware download to bring the card to
1104 * The following commands are issued sequentially -
1105 * - Set PCI-Express host buffer configuration (PCIE only)
1106 * - Function init (for first interface only)
1107 * - Read MAC address (for first interface only)
1108 * - Reconfigure Tx buffer size (for first interface only)
1109 * - Enable auto deep sleep (for first interface only)
1112 * - Set IBSS coalescing status
1113 * - Set AMSDU aggregation control
1115 * - Set MAC control (this must be the last command to initialize firmware)
1117 int mwifiex_sta_init_cmd(struct mwifiex_private
*priv
, u8 first_sta
)
1121 struct mwifiex_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl
;
1122 struct mwifiex_ds_auto_ds auto_ds
;
1123 enum state_11d_t state_11d
;
1124 struct mwifiex_ds_11n_tx_cfg tx_cfg
;
1127 if (priv
->adapter
->iface_type
== MWIFIEX_PCIE
) {
1128 ret
= mwifiex_send_cmd_async(priv
,
1129 HostCmd_CMD_PCIE_DESC_DETAILS
,
1130 HostCmd_ACT_GEN_SET
, 0, NULL
);
1135 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_FUNC_INIT
,
1136 HostCmd_ACT_GEN_SET
, 0, NULL
);
1139 /* Read MAC address from HW */
1140 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_GET_HW_SPEC
,
1141 HostCmd_ACT_GEN_GET
, 0, NULL
);
1145 /* Reconfigure tx buf size */
1146 ret
= mwifiex_send_cmd_async(priv
,
1147 HostCmd_CMD_RECONFIGURE_TX_BUFF
,
1148 HostCmd_ACT_GEN_SET
, 0,
1149 &priv
->adapter
->tx_buf_size
);
1153 /* Enable IEEE PS by default */
1154 priv
->adapter
->ps_mode
= MWIFIEX_802_11_POWER_MODE_PSP
;
1155 ret
= mwifiex_send_cmd_async(priv
,
1156 HostCmd_CMD_802_11_PS_MODE_ENH
,
1157 EN_AUTO_PS
, BITMAP_STA_PS
, NULL
);
1163 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_TX_RATE_CFG
,
1164 HostCmd_ACT_GEN_GET
, 0, NULL
);
1167 priv
->data_rate
= 0;
1170 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_TXPWR_CFG
,
1171 HostCmd_ACT_GEN_GET
, 0, NULL
);
1175 /* set ibss coalescing_status */
1176 ret
= mwifiex_send_cmd_async(priv
,
1177 HostCmd_CMD_802_11_IBSS_COALESCING_STATUS
,
1178 HostCmd_ACT_GEN_SET
, 0, &enable
);
1182 memset(&amsdu_aggr_ctrl
, 0, sizeof(amsdu_aggr_ctrl
));
1183 amsdu_aggr_ctrl
.enable
= true;
1184 /* Send request to firmware */
1185 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_AMSDU_AGGR_CTRL
,
1186 HostCmd_ACT_GEN_SET
, 0,
1190 /* MAC Control must be the last command in init_fw */
1191 /* set MAC Control */
1192 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_MAC_CONTROL
,
1193 HostCmd_ACT_GEN_SET
, 0,
1194 &priv
->curr_pkt_filter
);
1199 /* Enable auto deep sleep */
1200 auto_ds
.auto_ds
= DEEP_SLEEP_ON
;
1201 auto_ds
.idle_time
= DEEP_SLEEP_IDLE_TIME
;
1202 ret
= mwifiex_send_cmd_async(priv
,
1203 HostCmd_CMD_802_11_PS_MODE_ENH
,
1204 EN_AUTO_PS
, BITMAP_AUTO_DS
,
1210 /* Send cmd to FW to enable/disable 11D function */
1211 state_11d
= ENABLE_11D
;
1212 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_802_11_SNMP_MIB
,
1213 HostCmd_ACT_GEN_SET
, DOT11D_I
, &state_11d
);
1215 dev_err(priv
->adapter
->dev
, "11D: failed to enable 11D\n");
1217 /* Send cmd to FW to configure 11n specific configuration
1218 * (Short GI, Channel BW, Green field support etc.) for transmit
1220 tx_cfg
.tx_htcap
= MWIFIEX_FW_DEF_HTTXCFG
;
1221 ret
= mwifiex_send_cmd_async(priv
, HostCmd_CMD_11N_CFG
,
1222 HostCmd_ACT_GEN_SET
, 0, &tx_cfg
);
1224 /* set last_init_cmd */
1225 priv
->adapter
->last_init_cmd
= HostCmd_CMD_11N_CFG
;