2 * Marvell Wireless LAN device driver: functions for station ioctl
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 static int disconnect_on_suspend
= 1;
30 module_param(disconnect_on_suspend
, int, 0644);
33 * Copies the multicast address list from device to driver.
35 * This function does not validate the destination memory for
36 * size, and the calling function must ensure enough memory is
39 int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list
*mlist
,
40 struct net_device
*dev
)
43 struct netdev_hw_addr
*ha
;
45 netdev_for_each_mc_addr(ha
, dev
)
46 memcpy(&mlist
->mac_list
[i
++], ha
->addr
, ETH_ALEN
);
52 * Wait queue completion handler.
54 * This function waits on a cmd wait queue. It also cancels the pending
55 * request after waking up, in case of errors.
57 int mwifiex_wait_queue_complete(struct mwifiex_adapter
*adapter
,
58 struct cmd_ctrl_node
*cmd_queued
)
62 /* Wait for completion */
63 status
= wait_event_interruptible_timeout(adapter
->cmd_wait_q
.wait
,
64 *(cmd_queued
->condition
),
67 dev_err(adapter
->dev
, "cmd_wait_q terminated: %d\n", status
);
68 mwifiex_cancel_all_pending_cmd(adapter
);
72 status
= adapter
->cmd_wait_q
.status
;
73 adapter
->cmd_wait_q
.status
= 0;
79 * This function prepares the correct firmware command and
80 * issues it to set the multicast list.
82 * This function can be used to enable promiscuous mode, or enable all
83 * multicast packets, or to enable selective multicast.
85 int mwifiex_request_set_multicast_list(struct mwifiex_private
*priv
,
86 struct mwifiex_multicast_list
*mcast_list
)
91 old_pkt_filter
= priv
->curr_pkt_filter
;
93 if (mcast_list
->mode
== MWIFIEX_PROMISC_MODE
) {
94 dev_dbg(priv
->adapter
->dev
, "info: Enable Promiscuous mode\n");
95 priv
->curr_pkt_filter
|= HostCmd_ACT_MAC_PROMISCUOUS_ENABLE
;
96 priv
->curr_pkt_filter
&=
97 ~HostCmd_ACT_MAC_ALL_MULTICAST_ENABLE
;
100 priv
->curr_pkt_filter
&= ~HostCmd_ACT_MAC_PROMISCUOUS_ENABLE
;
101 if (mcast_list
->mode
== MWIFIEX_ALL_MULTI_MODE
) {
102 dev_dbg(priv
->adapter
->dev
,
103 "info: Enabling All Multicast!\n");
104 priv
->curr_pkt_filter
|=
105 HostCmd_ACT_MAC_ALL_MULTICAST_ENABLE
;
107 priv
->curr_pkt_filter
&=
108 ~HostCmd_ACT_MAC_ALL_MULTICAST_ENABLE
;
109 dev_dbg(priv
->adapter
->dev
,
110 "info: Set multicast list=%d\n",
111 mcast_list
->num_multicast_addr
);
112 /* Send multicast addresses to firmware */
113 ret
= mwifiex_send_cmd(priv
,
114 HostCmd_CMD_MAC_MULTICAST_ADR
,
115 HostCmd_ACT_GEN_SET
, 0,
119 dev_dbg(priv
->adapter
->dev
,
120 "info: old_pkt_filter=%#x, curr_pkt_filter=%#x\n",
121 old_pkt_filter
, priv
->curr_pkt_filter
);
122 if (old_pkt_filter
!= priv
->curr_pkt_filter
) {
123 ret
= mwifiex_send_cmd(priv
, HostCmd_CMD_MAC_CONTROL
,
125 0, &priv
->curr_pkt_filter
, false);
132 * This function fills bss descriptor structure using provided
134 * beacon_ie buffer is allocated in this function. It is caller's
135 * responsibility to free the memory.
137 int mwifiex_fill_new_bss_desc(struct mwifiex_private
*priv
,
138 struct cfg80211_bss
*bss
,
139 struct mwifiex_bssdescriptor
*bss_desc
)
142 size_t beacon_ie_len
;
143 struct mwifiex_bss_priv
*bss_priv
= (void *)bss
->priv
;
144 const struct cfg80211_bss_ies
*ies
;
147 ies
= rcu_dereference(bss
->ies
);
148 beacon_ie
= kmemdup(ies
->data
, ies
->len
, GFP_ATOMIC
);
149 beacon_ie_len
= ies
->len
;
150 bss_desc
->timestamp
= ies
->tsf
;
154 dev_err(priv
->adapter
->dev
, " failed to alloc beacon_ie\n");
158 memcpy(bss_desc
->mac_address
, bss
->bssid
, ETH_ALEN
);
159 bss_desc
->rssi
= bss
->signal
;
160 /* The caller of this function will free beacon_ie */
161 bss_desc
->beacon_buf
= beacon_ie
;
162 bss_desc
->beacon_buf_size
= beacon_ie_len
;
163 bss_desc
->beacon_period
= bss
->beacon_interval
;
164 bss_desc
->cap_info_bitmap
= bss
->capability
;
165 bss_desc
->bss_band
= bss_priv
->band
;
166 bss_desc
->fw_tsf
= bss_priv
->fw_tsf
;
167 if (bss_desc
->cap_info_bitmap
& WLAN_CAPABILITY_PRIVACY
) {
168 dev_dbg(priv
->adapter
->dev
, "info: InterpretIE: AP WEP enabled\n");
169 bss_desc
->privacy
= MWIFIEX_802_11_PRIV_FILTER_8021X_WEP
;
171 bss_desc
->privacy
= MWIFIEX_802_11_PRIV_FILTER_ACCEPT_ALL
;
173 if (bss_desc
->cap_info_bitmap
& WLAN_CAPABILITY_IBSS
)
174 bss_desc
->bss_mode
= NL80211_IFTYPE_ADHOC
;
176 bss_desc
->bss_mode
= NL80211_IFTYPE_STATION
;
178 /* Disable 11ac by default. Enable it only where there
179 * exist VHT_CAP IE in AP beacon
181 bss_desc
->disable_11ac
= true;
183 if (bss_desc
->cap_info_bitmap
& WLAN_CAPABILITY_SPECTRUM_MGMT
)
184 bss_desc
->sensed_11h
= true;
186 return mwifiex_update_bss_desc_with_ie(priv
->adapter
, bss_desc
);
189 void mwifiex_dnld_txpwr_table(struct mwifiex_private
*priv
)
191 if (priv
->adapter
->dt_node
) {
192 char txpwr
[] = {"marvell,00_txpwrlimit"};
194 memcpy(&txpwr
[8], priv
->adapter
->country_code
, 2);
195 mwifiex_dnld_dt_cfgdata(priv
, priv
->adapter
->dt_node
, txpwr
);
199 static int mwifiex_process_country_ie(struct mwifiex_private
*priv
,
200 struct cfg80211_bss
*bss
)
202 const u8
*country_ie
;
204 struct mwifiex_802_11d_domain_reg
*domain_info
=
205 &priv
->adapter
->domain_reg
;
208 country_ie
= ieee80211_bss_get_ie(bss
, WLAN_EID_COUNTRY
);
214 country_ie_len
= country_ie
[1];
215 if (country_ie_len
< IEEE80211_COUNTRY_IE_MIN_LEN
) {
220 if (!strncmp(priv
->adapter
->country_code
, &country_ie
[2], 2)) {
222 wiphy_dbg(priv
->wdev
->wiphy
,
223 "11D: skip setting domain info in FW\n");
226 memcpy(priv
->adapter
->country_code
, &country_ie
[2], 2);
228 domain_info
->country_code
[0] = country_ie
[2];
229 domain_info
->country_code
[1] = country_ie
[3];
230 domain_info
->country_code
[2] = ' ';
232 country_ie_len
-= IEEE80211_COUNTRY_STRING_LEN
;
234 domain_info
->no_of_triplet
=
235 country_ie_len
/ sizeof(struct ieee80211_country_ie_triplet
);
237 memcpy((u8
*)domain_info
->triplet
,
238 &country_ie
[2] + IEEE80211_COUNTRY_STRING_LEN
, country_ie_len
);
242 if (mwifiex_send_cmd(priv
, HostCmd_CMD_802_11D_DOMAIN_INFO
,
243 HostCmd_ACT_GEN_SET
, 0, NULL
, false)) {
244 wiphy_err(priv
->adapter
->wiphy
,
245 "11D: setting domain info in FW\n");
249 mwifiex_dnld_txpwr_table(priv
);
255 * In Ad-Hoc mode, the IBSS is created if not found in scan list.
256 * In both Ad-Hoc and infra mode, an deauthentication is performed
259 int mwifiex_bss_start(struct mwifiex_private
*priv
, struct cfg80211_bss
*bss
,
260 struct cfg80211_ssid
*req_ssid
)
263 struct mwifiex_adapter
*adapter
= priv
->adapter
;
264 struct mwifiex_bssdescriptor
*bss_desc
= NULL
;
266 priv
->scan_block
= false;
269 mwifiex_process_country_ie(priv
, bss
);
271 /* Allocate and fill new bss descriptor */
272 bss_desc
= kzalloc(sizeof(struct mwifiex_bssdescriptor
),
277 ret
= mwifiex_fill_new_bss_desc(priv
, bss
, bss_desc
);
282 if (priv
->bss_mode
== NL80211_IFTYPE_STATION
||
283 priv
->bss_mode
== NL80211_IFTYPE_P2P_CLIENT
) {
286 ret
= mwifiex_deauthenticate(priv
, NULL
);
293 if (mwifiex_band_to_radio_type(bss_desc
->bss_band
) ==
294 HostCmd_SCAN_RADIO_TYPE_BG
)
295 config_bands
= BAND_B
| BAND_G
| BAND_GN
;
297 config_bands
= BAND_A
| BAND_AN
| BAND_AAC
;
299 if (!((config_bands
| adapter
->fw_bands
) & ~adapter
->fw_bands
))
300 adapter
->config_bands
= config_bands
;
302 ret
= mwifiex_check_network_compatibility(priv
, bss_desc
);
306 if (mwifiex_11h_get_csa_closed_channel(priv
) ==
307 (u8
)bss_desc
->channel
) {
308 dev_err(adapter
->dev
,
309 "Attempt to reconnect on csa closed chan(%d)\n",
314 dev_dbg(adapter
->dev
, "info: SSID found in scan list ... "
317 mwifiex_stop_net_dev_queue(priv
->netdev
, adapter
);
318 if (netif_carrier_ok(priv
->netdev
))
319 netif_carrier_off(priv
->netdev
);
321 /* Clear any past association response stored for
322 * application retrieval */
323 priv
->assoc_rsp_size
= 0;
324 ret
= mwifiex_associate(priv
, bss_desc
);
326 /* If auth type is auto and association fails using open mode,
327 * try to connect using shared mode */
328 if (ret
== WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG
&&
329 priv
->sec_info
.is_authtype_auto
&&
330 priv
->sec_info
.wep_enabled
) {
331 priv
->sec_info
.authentication_mode
=
332 NL80211_AUTHTYPE_SHARED_KEY
;
333 ret
= mwifiex_associate(priv
, bss_desc
);
337 cfg80211_put_bss(priv
->adapter
->wiphy
, bss
);
340 /* If the requested SSID matches current SSID, return */
341 if (bss_desc
&& bss_desc
->ssid
.ssid_len
&&
342 (!mwifiex_ssid_cmp(&priv
->curr_bss_params
.bss_descriptor
.
343 ssid
, &bss_desc
->ssid
))) {
348 /* Exit Adhoc mode first */
349 dev_dbg(adapter
->dev
, "info: Sending Adhoc Stop\n");
350 ret
= mwifiex_deauthenticate(priv
, NULL
);
354 priv
->adhoc_is_link_sensed
= false;
356 ret
= mwifiex_check_network_compatibility(priv
, bss_desc
);
358 mwifiex_stop_net_dev_queue(priv
->netdev
, adapter
);
359 if (netif_carrier_ok(priv
->netdev
))
360 netif_carrier_off(priv
->netdev
);
363 dev_dbg(adapter
->dev
, "info: network found in scan"
364 " list. Joining...\n");
365 ret
= mwifiex_adhoc_join(priv
, bss_desc
);
367 cfg80211_put_bss(priv
->adapter
->wiphy
, bss
);
369 dev_dbg(adapter
->dev
, "info: Network not found in "
370 "the list, creating adhoc with ssid = %s\n",
372 ret
= mwifiex_adhoc_start(priv
, req_ssid
);
377 /* beacon_ie buffer was allocated in function
378 * mwifiex_fill_new_bss_desc(). Free it now.
381 kfree(bss_desc
->beacon_buf
);
387 * IOCTL request handler to set host sleep configuration.
389 * This function prepares the correct firmware command and
392 static int mwifiex_set_hs_params(struct mwifiex_private
*priv
, u16 action
,
393 int cmd_type
, struct mwifiex_ds_hs_cfg
*hs_cfg
)
396 struct mwifiex_adapter
*adapter
= priv
->adapter
;
404 case HostCmd_ACT_GEN_SET
:
405 if (adapter
->pps_uapsd_mode
) {
406 dev_dbg(adapter
->dev
, "info: Host Sleep IOCTL"
407 " is blocked in UAPSD/PPS mode\n");
411 if (hs_cfg
->is_invoke_hostcmd
) {
412 if (hs_cfg
->conditions
== HS_CFG_CANCEL
) {
413 if (!adapter
->is_hs_configured
)
414 /* Already cancelled */
416 /* Save previous condition */
417 prev_cond
= le32_to_cpu(adapter
->hs_cfg
419 adapter
->hs_cfg
.conditions
=
420 cpu_to_le32(hs_cfg
->conditions
);
421 } else if (hs_cfg
->conditions
) {
422 adapter
->hs_cfg
.conditions
=
423 cpu_to_le32(hs_cfg
->conditions
);
424 adapter
->hs_cfg
.gpio
= (u8
)hs_cfg
->gpio
;
426 adapter
->hs_cfg
.gap
= (u8
)hs_cfg
->gap
;
427 } else if (adapter
->hs_cfg
.conditions
==
428 cpu_to_le32(HS_CFG_CANCEL
)) {
429 /* Return failure if no parameters for HS
435 status
= mwifiex_send_cmd(priv
,
436 HostCmd_CMD_802_11_HS_CFG_ENH
,
437 HostCmd_ACT_GEN_SET
, 0,
439 cmd_type
== MWIFIEX_SYNC_CMD
);
441 if (hs_cfg
->conditions
== HS_CFG_CANCEL
)
442 /* Restore previous condition */
443 adapter
->hs_cfg
.conditions
=
444 cpu_to_le32(prev_cond
);
446 adapter
->hs_cfg
.conditions
=
447 cpu_to_le32(hs_cfg
->conditions
);
448 adapter
->hs_cfg
.gpio
= (u8
)hs_cfg
->gpio
;
449 adapter
->hs_cfg
.gap
= (u8
)hs_cfg
->gap
;
452 case HostCmd_ACT_GEN_GET
:
453 hs_cfg
->conditions
= le32_to_cpu(adapter
->hs_cfg
.conditions
);
454 hs_cfg
->gpio
= adapter
->hs_cfg
.gpio
;
455 hs_cfg
->gap
= adapter
->hs_cfg
.gap
;
466 * Sends IOCTL request to cancel the existing Host Sleep configuration.
468 * This function allocates the IOCTL request buffer, fills it
469 * with requisite parameters and calls the IOCTL handler.
471 int mwifiex_cancel_hs(struct mwifiex_private
*priv
, int cmd_type
)
473 struct mwifiex_ds_hs_cfg hscfg
;
475 hscfg
.conditions
= HS_CFG_CANCEL
;
476 hscfg
.is_invoke_hostcmd
= true;
478 return mwifiex_set_hs_params(priv
, HostCmd_ACT_GEN_SET
,
481 EXPORT_SYMBOL_GPL(mwifiex_cancel_hs
);
484 * Sends IOCTL request to cancel the existing Host Sleep configuration.
486 * This function allocates the IOCTL request buffer, fills it
487 * with requisite parameters and calls the IOCTL handler.
489 int mwifiex_enable_hs(struct mwifiex_adapter
*adapter
)
491 struct mwifiex_ds_hs_cfg hscfg
;
492 struct mwifiex_private
*priv
;
495 if (disconnect_on_suspend
) {
496 for (i
= 0; i
< adapter
->priv_num
; i
++) {
497 priv
= adapter
->priv
[i
];
499 mwifiex_deauthenticate(priv
, NULL
);
503 if (adapter
->hs_activated
) {
504 dev_dbg(adapter
->dev
, "cmd: HS Already activated\n");
508 adapter
->hs_activate_wait_q_woken
= false;
510 memset(&hscfg
, 0, sizeof(struct mwifiex_ds_hs_cfg
));
511 hscfg
.is_invoke_hostcmd
= true;
513 adapter
->hs_enabling
= true;
514 mwifiex_cancel_all_pending_cmd(adapter
);
516 if (mwifiex_set_hs_params(mwifiex_get_priv(adapter
,
517 MWIFIEX_BSS_ROLE_STA
),
518 HostCmd_ACT_GEN_SET
, MWIFIEX_SYNC_CMD
,
520 dev_err(adapter
->dev
, "IOCTL request HS enable failed\n");
524 if (wait_event_interruptible_timeout(adapter
->hs_activate_wait_q
,
525 adapter
->hs_activate_wait_q_woken
,
527 dev_err(adapter
->dev
, "hs_activate_wait_q terminated\n");
533 EXPORT_SYMBOL_GPL(mwifiex_enable_hs
);
536 * IOCTL request handler to get BSS information.
538 * This function collates the information from different driver structures
539 * to send to the user.
541 int mwifiex_get_bss_info(struct mwifiex_private
*priv
,
542 struct mwifiex_bss_info
*info
)
544 struct mwifiex_adapter
*adapter
= priv
->adapter
;
545 struct mwifiex_bssdescriptor
*bss_desc
;
550 bss_desc
= &priv
->curr_bss_params
.bss_descriptor
;
552 info
->bss_mode
= priv
->bss_mode
;
554 memcpy(&info
->ssid
, &bss_desc
->ssid
, sizeof(struct cfg80211_ssid
));
556 memcpy(&info
->bssid
, &bss_desc
->mac_address
, ETH_ALEN
);
558 info
->bss_chan
= bss_desc
->channel
;
560 memcpy(info
->country_code
, adapter
->country_code
,
561 IEEE80211_COUNTRY_STRING_LEN
);
563 info
->media_connected
= priv
->media_connected
;
565 info
->max_power_level
= priv
->max_tx_power_level
;
566 info
->min_power_level
= priv
->min_tx_power_level
;
568 info
->adhoc_state
= priv
->adhoc_state
;
570 info
->bcn_nf_last
= priv
->bcn_nf_last
;
572 if (priv
->sec_info
.wep_enabled
)
573 info
->wep_status
= true;
575 info
->wep_status
= false;
577 info
->is_hs_configured
= adapter
->is_hs_configured
;
578 info
->is_deep_sleep
= adapter
->is_deep_sleep
;
584 * The function disables auto deep sleep mode.
586 int mwifiex_disable_auto_ds(struct mwifiex_private
*priv
)
588 struct mwifiex_ds_auto_ds auto_ds
;
590 auto_ds
.auto_ds
= DEEP_SLEEP_OFF
;
592 return mwifiex_send_cmd(priv
, HostCmd_CMD_802_11_PS_MODE_ENH
,
593 DIS_AUTO_PS
, BITMAP_AUTO_DS
, &auto_ds
, true);
595 EXPORT_SYMBOL_GPL(mwifiex_disable_auto_ds
);
598 * Sends IOCTL request to get the data rate.
600 * This function allocates the IOCTL request buffer, fills it
601 * with requisite parameters and calls the IOCTL handler.
603 int mwifiex_drv_get_data_rate(struct mwifiex_private
*priv
, u32
*rate
)
607 ret
= mwifiex_send_cmd(priv
, HostCmd_CMD_802_11_TX_RATE_QUERY
,
608 HostCmd_ACT_GEN_GET
, 0, NULL
, true);
611 if (priv
->is_data_rate_auto
)
612 *rate
= mwifiex_index_to_data_rate(priv
, priv
->tx_rate
,
615 *rate
= priv
->data_rate
;
622 * IOCTL request handler to set tx power configuration.
624 * This function prepares the correct firmware command and
627 * For non-auto power mode, all the following power groups are set -
628 * - Modulation class HR/DSSS
629 * - Modulation class OFDM
630 * - Modulation class HTBW20
631 * - Modulation class HTBW40
633 int mwifiex_set_tx_power(struct mwifiex_private
*priv
,
634 struct mwifiex_power_cfg
*power_cfg
)
637 struct host_cmd_ds_txpwr_cfg
*txp_cfg
;
638 struct mwifiex_types_power_group
*pg_tlv
;
639 struct mwifiex_power_group
*pg
;
643 if (!power_cfg
->is_power_auto
) {
644 dbm
= (u16
) power_cfg
->power_level
;
645 if ((dbm
< priv
->min_tx_power_level
) ||
646 (dbm
> priv
->max_tx_power_level
)) {
647 dev_err(priv
->adapter
->dev
, "txpower value %d dBm"
648 " is out of range (%d dBm-%d dBm)\n",
649 dbm
, priv
->min_tx_power_level
,
650 priv
->max_tx_power_level
);
654 buf
= kzalloc(MWIFIEX_SIZE_OF_CMD_BUFFER
, GFP_KERNEL
);
658 txp_cfg
= (struct host_cmd_ds_txpwr_cfg
*) buf
;
659 txp_cfg
->action
= cpu_to_le16(HostCmd_ACT_GEN_SET
);
660 if (!power_cfg
->is_power_auto
) {
661 txp_cfg
->mode
= cpu_to_le32(1);
662 pg_tlv
= (struct mwifiex_types_power_group
*)
663 (buf
+ sizeof(struct host_cmd_ds_txpwr_cfg
));
664 pg_tlv
->type
= cpu_to_le16(TLV_TYPE_POWER_GROUP
);
666 cpu_to_le16(4 * sizeof(struct mwifiex_power_group
));
667 pg
= (struct mwifiex_power_group
*)
668 (buf
+ sizeof(struct host_cmd_ds_txpwr_cfg
)
669 + sizeof(struct mwifiex_types_power_group
));
670 /* Power group for modulation class HR/DSSS */
671 pg
->first_rate_code
= 0x00;
672 pg
->last_rate_code
= 0x03;
673 pg
->modulation_class
= MOD_CLASS_HR_DSSS
;
675 pg
->power_min
= (s8
) dbm
;
676 pg
->power_max
= (s8
) dbm
;
678 /* Power group for modulation class OFDM */
679 pg
->first_rate_code
= 0x00;
680 pg
->last_rate_code
= 0x07;
681 pg
->modulation_class
= MOD_CLASS_OFDM
;
683 pg
->power_min
= (s8
) dbm
;
684 pg
->power_max
= (s8
) dbm
;
686 /* Power group for modulation class HTBW20 */
687 pg
->first_rate_code
= 0x00;
688 pg
->last_rate_code
= 0x20;
689 pg
->modulation_class
= MOD_CLASS_HT
;
691 pg
->power_min
= (s8
) dbm
;
692 pg
->power_max
= (s8
) dbm
;
693 pg
->ht_bandwidth
= HT_BW_20
;
695 /* Power group for modulation class HTBW40 */
696 pg
->first_rate_code
= 0x00;
697 pg
->last_rate_code
= 0x20;
698 pg
->modulation_class
= MOD_CLASS_HT
;
700 pg
->power_min
= (s8
) dbm
;
701 pg
->power_max
= (s8
) dbm
;
702 pg
->ht_bandwidth
= HT_BW_40
;
704 ret
= mwifiex_send_cmd(priv
, HostCmd_CMD_TXPWR_CFG
,
705 HostCmd_ACT_GEN_SET
, 0, buf
, true);
712 * IOCTL request handler to get power save mode.
714 * This function prepares the correct firmware command and
717 int mwifiex_drv_set_power(struct mwifiex_private
*priv
, u32
*ps_mode
)
720 struct mwifiex_adapter
*adapter
= priv
->adapter
;
724 adapter
->ps_mode
= MWIFIEX_802_11_POWER_MODE_PSP
;
726 adapter
->ps_mode
= MWIFIEX_802_11_POWER_MODE_CAM
;
727 sub_cmd
= (*ps_mode
) ? EN_AUTO_PS
: DIS_AUTO_PS
;
728 ret
= mwifiex_send_cmd(priv
, HostCmd_CMD_802_11_PS_MODE_ENH
,
729 sub_cmd
, BITMAP_STA_PS
, NULL
, true);
730 if ((!ret
) && (sub_cmd
== DIS_AUTO_PS
))
731 ret
= mwifiex_send_cmd(priv
, HostCmd_CMD_802_11_PS_MODE_ENH
,
732 GET_PS
, 0, NULL
, false);
738 * IOCTL request handler to set/reset WPA IE.
740 * The supplied WPA IE is treated as a opaque buffer. Only the first field
741 * is checked to determine WPA version. If buffer length is zero, the existing
744 static int mwifiex_set_wpa_ie_helper(struct mwifiex_private
*priv
,
745 u8
*ie_data_ptr
, u16 ie_len
)
748 if (ie_len
> sizeof(priv
->wpa_ie
)) {
749 dev_err(priv
->adapter
->dev
,
750 "failed to copy WPA IE, too big\n");
753 memcpy(priv
->wpa_ie
, ie_data_ptr
, ie_len
);
754 priv
->wpa_ie_len
= (u8
) ie_len
;
755 dev_dbg(priv
->adapter
->dev
, "cmd: Set Wpa_ie_len=%d IE=%#x\n",
756 priv
->wpa_ie_len
, priv
->wpa_ie
[0]);
758 if (priv
->wpa_ie
[0] == WLAN_EID_VENDOR_SPECIFIC
) {
759 priv
->sec_info
.wpa_enabled
= true;
760 } else if (priv
->wpa_ie
[0] == WLAN_EID_RSN
) {
761 priv
->sec_info
.wpa2_enabled
= true;
763 priv
->sec_info
.wpa_enabled
= false;
764 priv
->sec_info
.wpa2_enabled
= false;
767 memset(priv
->wpa_ie
, 0, sizeof(priv
->wpa_ie
));
768 priv
->wpa_ie_len
= 0;
769 dev_dbg(priv
->adapter
->dev
, "info: reset wpa_ie_len=%d IE=%#x\n",
770 priv
->wpa_ie_len
, priv
->wpa_ie
[0]);
771 priv
->sec_info
.wpa_enabled
= false;
772 priv
->sec_info
.wpa2_enabled
= false;
779 * IOCTL request handler to set/reset WAPI IE.
781 * The supplied WAPI IE is treated as a opaque buffer. Only the first field
782 * is checked to internally enable WAPI. If buffer length is zero, the existing
785 static int mwifiex_set_wapi_ie(struct mwifiex_private
*priv
,
786 u8
*ie_data_ptr
, u16 ie_len
)
789 if (ie_len
> sizeof(priv
->wapi_ie
)) {
790 dev_dbg(priv
->adapter
->dev
,
791 "info: failed to copy WAPI IE, too big\n");
794 memcpy(priv
->wapi_ie
, ie_data_ptr
, ie_len
);
795 priv
->wapi_ie_len
= ie_len
;
796 dev_dbg(priv
->adapter
->dev
, "cmd: Set wapi_ie_len=%d IE=%#x\n",
797 priv
->wapi_ie_len
, priv
->wapi_ie
[0]);
799 if (priv
->wapi_ie
[0] == WLAN_EID_BSS_AC_ACCESS_DELAY
)
800 priv
->sec_info
.wapi_enabled
= true;
802 memset(priv
->wapi_ie
, 0, sizeof(priv
->wapi_ie
));
803 priv
->wapi_ie_len
= ie_len
;
804 dev_dbg(priv
->adapter
->dev
,
805 "info: Reset wapi_ie_len=%d IE=%#x\n",
806 priv
->wapi_ie_len
, priv
->wapi_ie
[0]);
807 priv
->sec_info
.wapi_enabled
= false;
813 * IOCTL request handler to set/reset WPS IE.
815 * The supplied WPS IE is treated as a opaque buffer. Only the first field
816 * is checked to internally enable WPS. If buffer length is zero, the existing
819 static int mwifiex_set_wps_ie(struct mwifiex_private
*priv
,
820 u8
*ie_data_ptr
, u16 ie_len
)
823 if (ie_len
> MWIFIEX_MAX_VSIE_LEN
) {
824 dev_dbg(priv
->adapter
->dev
,
825 "info: failed to copy WPS IE, too big\n");
829 priv
->wps_ie
= kzalloc(MWIFIEX_MAX_VSIE_LEN
, GFP_KERNEL
);
833 memcpy(priv
->wps_ie
, ie_data_ptr
, ie_len
);
834 priv
->wps_ie_len
= ie_len
;
835 dev_dbg(priv
->adapter
->dev
, "cmd: Set wps_ie_len=%d IE=%#x\n",
836 priv
->wps_ie_len
, priv
->wps_ie
[0]);
839 priv
->wps_ie_len
= ie_len
;
840 dev_dbg(priv
->adapter
->dev
,
841 "info: Reset wps_ie_len=%d\n", priv
->wps_ie_len
);
847 * IOCTL request handler to set WAPI key.
849 * This function prepares the correct firmware command and
852 static int mwifiex_sec_ioctl_set_wapi_key(struct mwifiex_private
*priv
,
853 struct mwifiex_ds_encrypt_key
*encrypt_key
)
856 return mwifiex_send_cmd(priv
, HostCmd_CMD_802_11_KEY_MATERIAL
,
857 HostCmd_ACT_GEN_SET
, KEY_INFO_ENABLED
,
862 * IOCTL request handler to set WEP network key.
864 * This function prepares the correct firmware command and
865 * issues it, after validation checks.
867 static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private
*priv
,
868 struct mwifiex_ds_encrypt_key
*encrypt_key
)
870 struct mwifiex_adapter
*adapter
= priv
->adapter
;
872 struct mwifiex_wep_key
*wep_key
;
875 if (priv
->wep_key_curr_index
>= NUM_WEP_KEYS
)
876 priv
->wep_key_curr_index
= 0;
877 wep_key
= &priv
->wep_key
[priv
->wep_key_curr_index
];
878 index
= encrypt_key
->key_index
;
879 if (encrypt_key
->key_disable
) {
880 priv
->sec_info
.wep_enabled
= 0;
881 } else if (!encrypt_key
->key_len
) {
882 /* Copy the required key as the current key */
883 wep_key
= &priv
->wep_key
[index
];
884 if (!wep_key
->key_length
) {
885 dev_err(adapter
->dev
,
886 "key not set, so cannot enable it\n");
890 if (adapter
->fw_key_api_major_ver
== FW_KEY_API_VER_MAJOR_V2
) {
891 memcpy(encrypt_key
->key_material
,
892 wep_key
->key_material
, wep_key
->key_length
);
893 encrypt_key
->key_len
= wep_key
->key_length
;
896 priv
->wep_key_curr_index
= (u16
) index
;
897 priv
->sec_info
.wep_enabled
= 1;
899 wep_key
= &priv
->wep_key
[index
];
900 memset(wep_key
, 0, sizeof(struct mwifiex_wep_key
));
901 /* Copy the key in the driver */
902 memcpy(wep_key
->key_material
,
903 encrypt_key
->key_material
,
904 encrypt_key
->key_len
);
905 wep_key
->key_index
= index
;
906 wep_key
->key_length
= encrypt_key
->key_len
;
907 priv
->sec_info
.wep_enabled
= 1;
909 if (wep_key
->key_length
) {
912 if (encrypt_key
->key_disable
)
913 memset(&priv
->wep_key
[index
], 0,
914 sizeof(struct mwifiex_wep_key
));
916 if (adapter
->fw_key_api_major_ver
== FW_KEY_API_VER_MAJOR_V2
)
917 enc_key
= encrypt_key
;
921 /* Send request to firmware */
922 ret
= mwifiex_send_cmd(priv
, HostCmd_CMD_802_11_KEY_MATERIAL
,
923 HostCmd_ACT_GEN_SET
, 0, enc_key
, false);
928 if (priv
->sec_info
.wep_enabled
)
929 priv
->curr_pkt_filter
|= HostCmd_ACT_MAC_WEP_ENABLE
;
931 priv
->curr_pkt_filter
&= ~HostCmd_ACT_MAC_WEP_ENABLE
;
933 ret
= mwifiex_send_cmd(priv
, HostCmd_CMD_MAC_CONTROL
,
934 HostCmd_ACT_GEN_SET
, 0,
935 &priv
->curr_pkt_filter
, true);
941 * IOCTL request handler to set WPA key.
943 * This function prepares the correct firmware command and
944 * issues it, after validation checks.
946 * Current driver only supports key length of up to 32 bytes.
948 * This function can also be used to disable a currently set key.
950 static int mwifiex_sec_ioctl_set_wpa_key(struct mwifiex_private
*priv
,
951 struct mwifiex_ds_encrypt_key
*encrypt_key
)
954 u8 remove_key
= false;
955 struct host_cmd_ds_802_11_key_material
*ibss_key
;
957 /* Current driver only supports key length of up to 32 bytes */
958 if (encrypt_key
->key_len
> WLAN_MAX_KEY_LEN
) {
959 dev_err(priv
->adapter
->dev
, "key length too long\n");
963 if (priv
->bss_mode
== NL80211_IFTYPE_ADHOC
) {
965 * IBSS/WPA-None uses only one key (Group) for both receiving
966 * and sending unicast and multicast packets.
968 /* Send the key as PTK to firmware */
969 encrypt_key
->key_index
= MWIFIEX_KEY_INDEX_UNICAST
;
970 ret
= mwifiex_send_cmd(priv
, HostCmd_CMD_802_11_KEY_MATERIAL
,
972 KEY_INFO_ENABLED
, encrypt_key
, false);
976 ibss_key
= &priv
->aes_key
;
978 sizeof(struct host_cmd_ds_802_11_key_material
));
979 /* Copy the key in the driver */
980 memcpy(ibss_key
->key_param_set
.key
, encrypt_key
->key_material
,
981 encrypt_key
->key_len
);
982 memcpy(&ibss_key
->key_param_set
.key_len
, &encrypt_key
->key_len
,
983 sizeof(ibss_key
->key_param_set
.key_len
));
984 ibss_key
->key_param_set
.key_type_id
985 = cpu_to_le16(KEY_TYPE_ID_TKIP
);
986 ibss_key
->key_param_set
.key_info
= cpu_to_le16(KEY_ENABLED
);
988 /* Send the key as GTK to firmware */
989 encrypt_key
->key_index
= ~MWIFIEX_KEY_INDEX_UNICAST
;
992 if (!encrypt_key
->key_index
)
993 encrypt_key
->key_index
= MWIFIEX_KEY_INDEX_UNICAST
;
996 ret
= mwifiex_send_cmd(priv
, HostCmd_CMD_802_11_KEY_MATERIAL
,
998 !KEY_INFO_ENABLED
, encrypt_key
, true);
1000 ret
= mwifiex_send_cmd(priv
, HostCmd_CMD_802_11_KEY_MATERIAL
,
1001 HostCmd_ACT_GEN_SET
,
1002 KEY_INFO_ENABLED
, encrypt_key
, true);
1008 * IOCTL request handler to set/get network keys.
1010 * This is a generic key handling function which supports WEP, WPA
1014 mwifiex_sec_ioctl_encrypt_key(struct mwifiex_private
*priv
,
1015 struct mwifiex_ds_encrypt_key
*encrypt_key
)
1019 if (encrypt_key
->is_wapi_key
)
1020 status
= mwifiex_sec_ioctl_set_wapi_key(priv
, encrypt_key
);
1021 else if (encrypt_key
->key_len
> WLAN_KEY_LEN_WEP104
)
1022 status
= mwifiex_sec_ioctl_set_wpa_key(priv
, encrypt_key
);
1024 status
= mwifiex_sec_ioctl_set_wep_key(priv
, encrypt_key
);
1029 * This function returns the driver version.
1032 mwifiex_drv_get_driver_version(struct mwifiex_adapter
*adapter
, char *version
,
1041 ver
.l
= adapter
->fw_release_number
;
1042 sprintf(fw_ver
, "%u.%u.%u.p%u", ver
.c
[2], ver
.c
[1], ver
.c
[0], ver
.c
[3]);
1044 snprintf(version
, max_len
, driver_version
, fw_ver
);
1046 dev_dbg(adapter
->dev
, "info: MWIFIEX VERSION: %s\n", version
);
1052 * Sends IOCTL request to set encoding parameters.
1054 * This function allocates the IOCTL request buffer, fills it
1055 * with requisite parameters and calls the IOCTL handler.
1057 int mwifiex_set_encode(struct mwifiex_private
*priv
, struct key_params
*kp
,
1058 const u8
*key
, int key_len
, u8 key_index
,
1059 const u8
*mac_addr
, int disable
)
1061 struct mwifiex_ds_encrypt_key encrypt_key
;
1063 memset(&encrypt_key
, 0, sizeof(struct mwifiex_ds_encrypt_key
));
1064 encrypt_key
.key_len
= key_len
;
1065 encrypt_key
.key_index
= key_index
;
1067 if (kp
&& kp
->cipher
== WLAN_CIPHER_SUITE_AES_CMAC
)
1068 encrypt_key
.is_igtk_key
= true;
1072 memcpy(encrypt_key
.key_material
, key
, key_len
);
1074 encrypt_key
.is_current_wep_key
= true;
1077 memcpy(encrypt_key
.mac_addr
, mac_addr
, ETH_ALEN
);
1078 if (kp
&& kp
->seq
&& kp
->seq_len
) {
1079 memcpy(encrypt_key
.pn
, kp
->seq
, kp
->seq_len
);
1080 encrypt_key
.pn_len
= kp
->seq_len
;
1081 encrypt_key
.is_rx_seq_valid
= true;
1084 if (GET_BSS_ROLE(priv
) == MWIFIEX_BSS_ROLE_UAP
)
1086 encrypt_key
.key_disable
= true;
1088 memcpy(encrypt_key
.mac_addr
, mac_addr
, ETH_ALEN
);
1091 return mwifiex_sec_ioctl_encrypt_key(priv
, &encrypt_key
);
1095 * Sends IOCTL request to get extended version.
1097 * This function allocates the IOCTL request buffer, fills it
1098 * with requisite parameters and calls the IOCTL handler.
1101 mwifiex_get_ver_ext(struct mwifiex_private
*priv
)
1103 struct mwifiex_ver_ext ver_ext
;
1105 memset(&ver_ext
, 0, sizeof(struct host_cmd_ds_version_ext
));
1106 if (mwifiex_send_cmd(priv
, HostCmd_CMD_VERSION_EXT
,
1107 HostCmd_ACT_GEN_GET
, 0, &ver_ext
, true))
1114 mwifiex_remain_on_chan_cfg(struct mwifiex_private
*priv
, u16 action
,
1115 struct ieee80211_channel
*chan
,
1116 unsigned int duration
)
1118 struct host_cmd_ds_remain_on_chan roc_cfg
;
1121 memset(&roc_cfg
, 0, sizeof(roc_cfg
));
1122 roc_cfg
.action
= cpu_to_le16(action
);
1123 if (action
== HostCmd_ACT_GEN_SET
) {
1124 roc_cfg
.band_cfg
= chan
->band
;
1125 sc
= mwifiex_chan_type_to_sec_chan_offset(NL80211_CHAN_NO_HT
);
1126 roc_cfg
.band_cfg
|= (sc
<< 2);
1129 ieee80211_frequency_to_channel(chan
->center_freq
);
1130 roc_cfg
.duration
= cpu_to_le32(duration
);
1132 if (mwifiex_send_cmd(priv
, HostCmd_CMD_REMAIN_ON_CHAN
,
1133 action
, 0, &roc_cfg
, true)) {
1134 dev_err(priv
->adapter
->dev
, "failed to remain on channel\n");
1138 return roc_cfg
.status
;
1142 mwifiex_set_bss_role(struct mwifiex_private
*priv
, u8 bss_role
)
1144 if (GET_BSS_ROLE(priv
) == bss_role
) {
1145 dev_dbg(priv
->adapter
->dev
,
1146 "info: already in the desired role.\n");
1150 mwifiex_free_priv(priv
);
1151 mwifiex_init_priv(priv
);
1153 priv
->bss_role
= bss_role
;
1155 case MWIFIEX_BSS_ROLE_UAP
:
1156 priv
->bss_mode
= NL80211_IFTYPE_AP
;
1158 case MWIFIEX_BSS_ROLE_STA
:
1159 case MWIFIEX_BSS_ROLE_ANY
:
1161 priv
->bss_mode
= NL80211_IFTYPE_STATION
;
1165 mwifiex_send_cmd(priv
, HostCmd_CMD_SET_BSS_MODE
,
1166 HostCmd_ACT_GEN_SET
, 0, NULL
, true);
1168 return mwifiex_sta_init_cmd(priv
, false);
1172 * Sends IOCTL request to get statistics information.
1174 * This function allocates the IOCTL request buffer, fills it
1175 * with requisite parameters and calls the IOCTL handler.
1178 mwifiex_get_stats_info(struct mwifiex_private
*priv
,
1179 struct mwifiex_ds_get_stats
*log
)
1181 return mwifiex_send_cmd(priv
, HostCmd_CMD_802_11_GET_LOG
,
1182 HostCmd_ACT_GEN_GET
, 0, log
, true);
1186 * IOCTL request handler to read/write register.
1188 * This function prepares the correct firmware command and
1191 * Access to the following registers are supported -
1198 static int mwifiex_reg_mem_ioctl_reg_rw(struct mwifiex_private
*priv
,
1199 struct mwifiex_ds_reg_rw
*reg_rw
,
1204 switch (le32_to_cpu(reg_rw
->type
)) {
1205 case MWIFIEX_REG_MAC
:
1206 cmd_no
= HostCmd_CMD_MAC_REG_ACCESS
;
1208 case MWIFIEX_REG_BBP
:
1209 cmd_no
= HostCmd_CMD_BBP_REG_ACCESS
;
1211 case MWIFIEX_REG_RF
:
1212 cmd_no
= HostCmd_CMD_RF_REG_ACCESS
;
1214 case MWIFIEX_REG_PMIC
:
1215 cmd_no
= HostCmd_CMD_PMIC_REG_ACCESS
;
1217 case MWIFIEX_REG_CAU
:
1218 cmd_no
= HostCmd_CMD_CAU_REG_ACCESS
;
1224 return mwifiex_send_cmd(priv
, cmd_no
, action
, 0, reg_rw
, true);
1228 * Sends IOCTL request to write to a register.
1230 * This function allocates the IOCTL request buffer, fills it
1231 * with requisite parameters and calls the IOCTL handler.
1234 mwifiex_reg_write(struct mwifiex_private
*priv
, u32 reg_type
,
1235 u32 reg_offset
, u32 reg_value
)
1237 struct mwifiex_ds_reg_rw reg_rw
;
1239 reg_rw
.type
= cpu_to_le32(reg_type
);
1240 reg_rw
.offset
= cpu_to_le32(reg_offset
);
1241 reg_rw
.value
= cpu_to_le32(reg_value
);
1243 return mwifiex_reg_mem_ioctl_reg_rw(priv
, ®_rw
, HostCmd_ACT_GEN_SET
);
1247 * Sends IOCTL request to read from a register.
1249 * This function allocates the IOCTL request buffer, fills it
1250 * with requisite parameters and calls the IOCTL handler.
1253 mwifiex_reg_read(struct mwifiex_private
*priv
, u32 reg_type
,
1254 u32 reg_offset
, u32
*value
)
1257 struct mwifiex_ds_reg_rw reg_rw
;
1259 reg_rw
.type
= cpu_to_le32(reg_type
);
1260 reg_rw
.offset
= cpu_to_le32(reg_offset
);
1261 ret
= mwifiex_reg_mem_ioctl_reg_rw(priv
, ®_rw
, HostCmd_ACT_GEN_GET
);
1266 *value
= le32_to_cpu(reg_rw
.value
);
1273 * Sends IOCTL request to read from EEPROM.
1275 * This function allocates the IOCTL request buffer, fills it
1276 * with requisite parameters and calls the IOCTL handler.
1279 mwifiex_eeprom_read(struct mwifiex_private
*priv
, u16 offset
, u16 bytes
,
1283 struct mwifiex_ds_read_eeprom rd_eeprom
;
1285 rd_eeprom
.offset
= cpu_to_le16((u16
) offset
);
1286 rd_eeprom
.byte_count
= cpu_to_le16((u16
) bytes
);
1288 /* Send request to firmware */
1289 ret
= mwifiex_send_cmd(priv
, HostCmd_CMD_802_11_EEPROM_ACCESS
,
1290 HostCmd_ACT_GEN_GET
, 0, &rd_eeprom
, true);
1293 memcpy(value
, rd_eeprom
.value
, MAX_EEPROM_DATA
);
1298 * This function sets a generic IE. In addition to generic IE, it can
1299 * also handle WPA, WPA2 and WAPI IEs.
1302 mwifiex_set_gen_ie_helper(struct mwifiex_private
*priv
, u8
*ie_data_ptr
,
1306 struct ieee_types_vendor_header
*pvendor_ie
;
1307 const u8 wpa_oui
[] = { 0x00, 0x50, 0xf2, 0x01 };
1308 const u8 wps_oui
[] = { 0x00, 0x50, 0xf2, 0x04 };
1310 /* If the passed length is zero, reset the buffer */
1312 priv
->gen_ie_buf_len
= 0;
1313 priv
->wps
.session_enable
= false;
1316 } else if (!ie_data_ptr
) {
1319 pvendor_ie
= (struct ieee_types_vendor_header
*) ie_data_ptr
;
1320 /* Test to see if it is a WPA IE, if not, then it is a gen IE */
1321 if (((pvendor_ie
->element_id
== WLAN_EID_VENDOR_SPECIFIC
) &&
1322 (!memcmp(pvendor_ie
->oui
, wpa_oui
, sizeof(wpa_oui
)))) ||
1323 (pvendor_ie
->element_id
== WLAN_EID_RSN
)) {
1325 /* IE is a WPA/WPA2 IE so call set_wpa function */
1326 ret
= mwifiex_set_wpa_ie_helper(priv
, ie_data_ptr
, ie_len
);
1327 priv
->wps
.session_enable
= false;
1330 } else if (pvendor_ie
->element_id
== WLAN_EID_BSS_AC_ACCESS_DELAY
) {
1331 /* IE is a WAPI IE so call set_wapi function */
1332 ret
= mwifiex_set_wapi_ie(priv
, ie_data_ptr
, ie_len
);
1337 * Verify that the passed length is not larger than the
1338 * available space remaining in the buffer
1340 if (ie_len
< (sizeof(priv
->gen_ie_buf
) - priv
->gen_ie_buf_len
)) {
1342 /* Test to see if it is a WPS IE, if so, enable
1345 pvendor_ie
= (struct ieee_types_vendor_header
*) ie_data_ptr
;
1346 if ((pvendor_ie
->element_id
== WLAN_EID_VENDOR_SPECIFIC
) &&
1347 (!memcmp(pvendor_ie
->oui
, wps_oui
, sizeof(wps_oui
)))) {
1348 priv
->wps
.session_enable
= true;
1349 dev_dbg(priv
->adapter
->dev
,
1350 "info: WPS Session Enabled.\n");
1351 ret
= mwifiex_set_wps_ie(priv
, ie_data_ptr
, ie_len
);
1354 /* Append the passed data to the end of the
1356 memcpy(priv
->gen_ie_buf
+ priv
->gen_ie_buf_len
, ie_data_ptr
,
1358 /* Increment the stored buffer length by the
1360 priv
->gen_ie_buf_len
+= ie_len
;
1362 /* Passed data does not fit in the remaining
1367 /* Return 0, or -1 for error case */
1372 * IOCTL request handler to set/get generic IE.
1374 * In addition to various generic IEs, this function can also be
1375 * used to set the ARP filter.
1377 static int mwifiex_misc_ioctl_gen_ie(struct mwifiex_private
*priv
,
1378 struct mwifiex_ds_misc_gen_ie
*gen_ie
,
1381 struct mwifiex_adapter
*adapter
= priv
->adapter
;
1383 switch (gen_ie
->type
) {
1384 case MWIFIEX_IE_TYPE_GEN_IE
:
1385 if (action
== HostCmd_ACT_GEN_GET
) {
1386 gen_ie
->len
= priv
->wpa_ie_len
;
1387 memcpy(gen_ie
->ie_data
, priv
->wpa_ie
, gen_ie
->len
);
1389 mwifiex_set_gen_ie_helper(priv
, gen_ie
->ie_data
,
1393 case MWIFIEX_IE_TYPE_ARP_FILTER
:
1394 memset(adapter
->arp_filter
, 0, sizeof(adapter
->arp_filter
));
1395 if (gen_ie
->len
> ARP_FILTER_MAX_BUF_SIZE
) {
1396 adapter
->arp_filter_size
= 0;
1397 dev_err(adapter
->dev
, "invalid ARP filter size\n");
1400 memcpy(adapter
->arp_filter
, gen_ie
->ie_data
,
1402 adapter
->arp_filter_size
= gen_ie
->len
;
1406 dev_err(adapter
->dev
, "invalid IE type\n");
1413 * Sends IOCTL request to set a generic IE.
1415 * This function allocates the IOCTL request buffer, fills it
1416 * with requisite parameters and calls the IOCTL handler.
1419 mwifiex_set_gen_ie(struct mwifiex_private
*priv
, const u8
*ie
, int ie_len
)
1421 struct mwifiex_ds_misc_gen_ie gen_ie
;
1423 if (ie_len
> IEEE_MAX_IE_SIZE
)
1426 gen_ie
.type
= MWIFIEX_IE_TYPE_GEN_IE
;
1427 gen_ie
.len
= ie_len
;
1428 memcpy(gen_ie
.ie_data
, ie
, ie_len
);
1429 if (mwifiex_misc_ioctl_gen_ie(priv
, &gen_ie
, HostCmd_ACT_GEN_SET
))