// SPDX-License-Identifier: GPL-2.0-only /* * NXP Wireless LAN device driver: functions for station ioctl * * Copyright 2011-2020 NXP */ #include "decl.h" #include "ioctl.h" #include "util.h" #include "fw.h" #include "main.h" #include "wmm.h" #include "11n.h" #include "cfg80211.h" static int disconnect_on_suspend; module_param(disconnect_on_suspend, int, 0644); /* * Copies the multicast address list from device to driver. * * This function does not validate the destination memory for * size, and the calling function must ensure enough memory is * available. */ int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, struct net_device *dev) { … } /* * Wait queue completion handler. * * This function waits on a cmd wait queue. It also cancels the pending * request after waking up, in case of errors. */ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter, struct cmd_ctrl_node *cmd_queued) { … } /* * This function prepares the correct firmware command and * issues it to set the multicast list. * * This function can be used to enable promiscuous mode, or enable all * multicast packets, or to enable selective multicast. */ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv, struct mwifiex_multicast_list *mcast_list) { … } /* * This function fills bss descriptor structure using provided * information. * beacon_ie buffer is allocated in this function. It is caller's * responsibility to free the memory. */ int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, struct cfg80211_bss *bss, struct mwifiex_bssdescriptor *bss_desc) { … } void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv) { … } static int mwifiex_process_country_ie(struct mwifiex_private *priv, struct cfg80211_bss *bss) { … } /* * In Ad-Hoc mode, the IBSS is created if not found in scan list. * In both Ad-Hoc and infra mode, an deauthentication is performed * first. */ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, struct cfg80211_ssid *req_ssid) { … } /* * IOCTL request handler to set host sleep configuration. * * This function prepares the correct firmware command and * issues it. */ int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action, int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg) { … } /* * Sends IOCTL request to cancel the existing Host Sleep configuration. * * This function allocates the IOCTL request buffer, fills it * with requisite parameters and calls the IOCTL handler. */ int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type) { … } EXPORT_SYMBOL_GPL(…); /* * Sends IOCTL request to cancel the existing Host Sleep configuration. * * This function allocates the IOCTL request buffer, fills it * with requisite parameters and calls the IOCTL handler. */ int mwifiex_enable_hs(struct mwifiex_adapter *adapter) { … } EXPORT_SYMBOL_GPL(…); /* * IOCTL request handler to get BSS information. * * This function collates the information from different driver structures * to send to the user. */ int mwifiex_get_bss_info(struct mwifiex_private *priv, struct mwifiex_bss_info *info) { … } /* * The function disables auto deep sleep mode. */ int mwifiex_disable_auto_ds(struct mwifiex_private *priv) { … } EXPORT_SYMBOL_GPL(…); /* * Sends IOCTL request to get the data rate. * * This function allocates the IOCTL request buffer, fills it * with requisite parameters and calls the IOCTL handler. */ int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, u32 *rate) { … } /* * IOCTL request handler to set tx power configuration. * * This function prepares the correct firmware command and * issues it. * * For non-auto power mode, all the following power groups are set - * - Modulation class HR/DSSS * - Modulation class OFDM * - Modulation class HTBW20 * - Modulation class HTBW40 */ int mwifiex_set_tx_power(struct mwifiex_private *priv, struct mwifiex_power_cfg *power_cfg) { … } /* * IOCTL request handler to get power save mode. * * This function prepares the correct firmware command and * issues it. */ int mwifiex_drv_set_power(struct mwifiex_private *priv, u32 *ps_mode) { … } /* * IOCTL request handler to set/reset WPA IE. * * The supplied WPA IE is treated as a opaque buffer. Only the first field * is checked to determine WPA version. If buffer length is zero, the existing * WPA IE is reset. */ static int mwifiex_set_wpa_ie(struct mwifiex_private *priv, u8 *ie_data_ptr, u16 ie_len) { … } /* * IOCTL request handler to set/reset WAPI IE. * * The supplied WAPI IE is treated as a opaque buffer. Only the first field * is checked to internally enable WAPI. If buffer length is zero, the existing * WAPI IE is reset. */ static int mwifiex_set_wapi_ie(struct mwifiex_private *priv, u8 *ie_data_ptr, u16 ie_len) { … } /* * IOCTL request handler to set/reset WPS IE. * * The supplied WPS IE is treated as a opaque buffer. Only the first field * is checked to internally enable WPS. If buffer length is zero, the existing * WPS IE is reset. */ static int mwifiex_set_wps_ie(struct mwifiex_private *priv, u8 *ie_data_ptr, u16 ie_len) { … } /* * IOCTL request handler to set WAPI key. * * This function prepares the correct firmware command and * issues it. */ static int mwifiex_sec_ioctl_set_wapi_key(struct mwifiex_private *priv, struct mwifiex_ds_encrypt_key *encrypt_key) { … } /* * IOCTL request handler to set WEP network key. * * This function prepares the correct firmware command and * issues it, after validation checks. */ static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private *priv, struct mwifiex_ds_encrypt_key *encrypt_key) { … } /* * IOCTL request handler to set WPA key. * * This function prepares the correct firmware command and * issues it, after validation checks. * * Current driver only supports key length of up to 32 bytes. * * This function can also be used to disable a currently set key. */ static int mwifiex_sec_ioctl_set_wpa_key(struct mwifiex_private *priv, struct mwifiex_ds_encrypt_key *encrypt_key) { … } /* * IOCTL request handler to set/get network keys. * * This is a generic key handling function which supports WEP, WPA * and WAPI. */ static int mwifiex_sec_ioctl_encrypt_key(struct mwifiex_private *priv, struct mwifiex_ds_encrypt_key *encrypt_key) { … } /* * This function returns the driver version. */ int mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter, char *version, int max_len) { … } /* * Sends IOCTL request to set encoding parameters. * * This function allocates the IOCTL request buffer, fills it * with requisite parameters and calls the IOCTL handler. */ int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp, const u8 *key, int key_len, u8 key_index, const u8 *mac_addr, int disable) { … } /* * Sends IOCTL request to get extended version. * * This function allocates the IOCTL request buffer, fills it * with requisite parameters and calls the IOCTL handler. */ int mwifiex_get_ver_ext(struct mwifiex_private *priv, u32 version_str_sel) { … } int mwifiex_remain_on_chan_cfg(struct mwifiex_private *priv, u16 action, struct ieee80211_channel *chan, unsigned int duration) { … } /* * Sends IOCTL request to get statistics information. * * This function allocates the IOCTL request buffer, fills it * with requisite parameters and calls the IOCTL handler. */ int mwifiex_get_stats_info(struct mwifiex_private *priv, struct mwifiex_ds_get_stats *log) { … } /* * IOCTL request handler to read/write register. * * This function prepares the correct firmware command and * issues it. * * Access to the following registers are supported - * - MAC * - BBP * - RF * - PMIC * - CAU */ static int mwifiex_reg_mem_ioctl_reg_rw(struct mwifiex_private *priv, struct mwifiex_ds_reg_rw *reg_rw, u16 action) { … } /* * Sends IOCTL request to write to a register. * * This function allocates the IOCTL request buffer, fills it * with requisite parameters and calls the IOCTL handler. */ int mwifiex_reg_write(struct mwifiex_private *priv, u32 reg_type, u32 reg_offset, u32 reg_value) { … } /* * Sends IOCTL request to read from a register. * * This function allocates the IOCTL request buffer, fills it * with requisite parameters and calls the IOCTL handler. */ int mwifiex_reg_read(struct mwifiex_private *priv, u32 reg_type, u32 reg_offset, u32 *value) { … } /* * Sends IOCTL request to read from EEPROM. * * This function allocates the IOCTL request buffer, fills it * with requisite parameters and calls the IOCTL handler. */ int mwifiex_eeprom_read(struct mwifiex_private *priv, u16 offset, u16 bytes, u8 *value) { … } /* * This function sets a generic IE. In addition to generic IE, it can * also handle WPA, WPA2 and WAPI IEs. */ static int mwifiex_set_gen_ie_helper(struct mwifiex_private *priv, u8 *ie_data_ptr, u16 ie_len) { … } /* * IOCTL request handler to set/get generic IE. * * In addition to various generic IEs, this function can also be * used to set the ARP filter. */ static int mwifiex_misc_ioctl_gen_ie(struct mwifiex_private *priv, struct mwifiex_ds_misc_gen_ie *gen_ie, u16 action) { … } /* * Sends IOCTL request to set a generic IE. * * This function allocates the IOCTL request buffer, fills it * with requisite parameters and calls the IOCTL handler. */ int mwifiex_set_gen_ie(struct mwifiex_private *priv, const u8 *ie, int ie_len) { … } /* This function get Host Sleep wake up reason. * */ int mwifiex_get_wakeup_reason(struct mwifiex_private *priv, u16 action, int cmd_type, struct mwifiex_ds_wakeup_reason *wakeup_reason) { … } int mwifiex_get_chan_info(struct mwifiex_private *priv, struct mwifiex_channel_band *channel_band) { … }