Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * NXP Wireless LAN device driver: ioctl data structures & APIs
0004  *
0005  * Copyright 2011-2020 NXP
0006  */
0007 
0008 #ifndef _MWIFIEX_IOCTL_H_
0009 #define _MWIFIEX_IOCTL_H_
0010 
0011 #include <net/lib80211.h>
0012 
0013 enum {
0014     MWIFIEX_SCAN_TYPE_UNCHANGED = 0,
0015     MWIFIEX_SCAN_TYPE_ACTIVE,
0016     MWIFIEX_SCAN_TYPE_PASSIVE
0017 };
0018 
0019 struct mwifiex_user_scan {
0020     u32 scan_cfg_len;
0021     u8 scan_cfg_buf[1];
0022 };
0023 
0024 #define MWIFIEX_PROMISC_MODE            1
0025 #define MWIFIEX_MULTICAST_MODE      2
0026 #define MWIFIEX_ALL_MULTI_MODE      4
0027 #define MWIFIEX_MAX_MULTICAST_LIST_SIZE 32
0028 
0029 struct mwifiex_multicast_list {
0030     u32 mode;
0031     u32 num_multicast_addr;
0032     u8 mac_list[MWIFIEX_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
0033 };
0034 
0035 struct mwifiex_chan_freq {
0036     u32 channel;
0037     u32 freq;
0038 };
0039 
0040 struct mwifiex_ssid_bssid {
0041     struct cfg80211_ssid ssid;
0042     u8 bssid[ETH_ALEN];
0043 };
0044 
0045 enum {
0046     BAND_B = 1,
0047     BAND_G = 2,
0048     BAND_A = 4,
0049     BAND_GN = 8,
0050     BAND_AN = 16,
0051     BAND_AAC = 32,
0052 };
0053 
0054 #define MWIFIEX_WPA_PASSHPHRASE_LEN 64
0055 struct wpa_param {
0056     u8 pairwise_cipher_wpa;
0057     u8 pairwise_cipher_wpa2;
0058     u8 group_cipher;
0059     u32 length;
0060     u8 passphrase[MWIFIEX_WPA_PASSHPHRASE_LEN];
0061 };
0062 
0063 struct wep_key {
0064     u8 key_index;
0065     u8 is_default;
0066     u16 length;
0067     u8 key[WLAN_KEY_LEN_WEP104];
0068 };
0069 
0070 #define KEY_MGMT_ON_HOST        0x03
0071 #define MWIFIEX_AUTH_MODE_AUTO  0xFF
0072 #define BAND_CONFIG_BG          0x00
0073 #define BAND_CONFIG_A           0x01
0074 #define MWIFIEX_SEC_CHAN_BELOW  0x30
0075 #define MWIFIEX_SEC_CHAN_ABOVE  0x10
0076 #define MWIFIEX_SUPPORTED_RATES                 14
0077 #define MWIFIEX_SUPPORTED_RATES_EXT             32
0078 #define MWIFIEX_TDLS_SUPPORTED_RATES        8
0079 #define MWIFIEX_TDLS_DEF_QOS_CAPAB      0xf
0080 #define MWIFIEX_PRIO_BK             2
0081 #define MWIFIEX_PRIO_VI             5
0082 #define MWIFIEX_SUPPORTED_CHANNELS      2
0083 #define MWIFIEX_OPERATING_CLASSES       16
0084 
0085 struct mwifiex_uap_bss_param {
0086     u8 channel;
0087     u8 band_cfg;
0088     u16 rts_threshold;
0089     u16 frag_threshold;
0090     u8 retry_limit;
0091     struct mwifiex_802_11_ssid ssid;
0092     u8 bcast_ssid_ctl;
0093     u8 radio_ctl;
0094     u8 dtim_period;
0095     u16 beacon_period;
0096     u16 auth_mode;
0097     u16 protocol;
0098     u16 key_mgmt;
0099     u16 key_mgmt_operation;
0100     struct wpa_param wpa_cfg;
0101     struct wep_key wep_cfg[NUM_WEP_KEYS];
0102     struct ieee80211_ht_cap ht_cap;
0103     struct ieee80211_vht_cap vht_cap;
0104     u8 rates[MWIFIEX_SUPPORTED_RATES];
0105     u32 sta_ao_timer;
0106     u32 ps_sta_ao_timer;
0107     u8 qos_info;
0108     u8 power_constraint;
0109     struct mwifiex_types_wmm_info wmm_info;
0110 };
0111 
0112 enum {
0113     ADHOC_IDLE,
0114     ADHOC_STARTED,
0115     ADHOC_JOINED,
0116     ADHOC_COALESCED
0117 };
0118 
0119 struct mwifiex_ds_get_stats {
0120     u32 mcast_tx_frame;
0121     u32 failed;
0122     u32 retry;
0123     u32 multi_retry;
0124     u32 frame_dup;
0125     u32 rts_success;
0126     u32 rts_failure;
0127     u32 ack_failure;
0128     u32 rx_frag;
0129     u32 mcast_rx_frame;
0130     u32 fcs_error;
0131     u32 tx_frame;
0132     u32 wep_icv_error[4];
0133     u32 bcn_rcv_cnt;
0134     u32 bcn_miss_cnt;
0135 };
0136 
0137 #define MWIFIEX_MAX_VER_STR_LEN    128
0138 
0139 struct mwifiex_ver_ext {
0140     u32 version_str_sel;
0141     char version_str[MWIFIEX_MAX_VER_STR_LEN];
0142 };
0143 
0144 struct mwifiex_bss_info {
0145     u32 bss_mode;
0146     struct cfg80211_ssid ssid;
0147     u32 bss_chan;
0148     u8 country_code[3];
0149     u32 media_connected;
0150     u32 max_power_level;
0151     u32 min_power_level;
0152     u32 adhoc_state;
0153     signed int bcn_nf_last;
0154     u32 wep_status;
0155     u32 is_hs_configured;
0156     u32 is_deep_sleep;
0157     u8 bssid[ETH_ALEN];
0158 };
0159 
0160 #define MAX_NUM_TID     8
0161 
0162 #define MAX_RX_WINSIZE  64
0163 
0164 struct mwifiex_ds_rx_reorder_tbl {
0165     u16 tid;
0166     u8 ta[ETH_ALEN];
0167     u32 start_win;
0168     u32 win_size;
0169     u32 buffer[MAX_RX_WINSIZE];
0170 };
0171 
0172 struct mwifiex_ds_tx_ba_stream_tbl {
0173     u16 tid;
0174     u8 ra[ETH_ALEN];
0175     u8 amsdu;
0176 };
0177 
0178 #define DBG_CMD_NUM    5
0179 #define MWIFIEX_DBG_SDIO_MP_NUM    10
0180 
0181 struct tdls_peer_info {
0182     u8 peer_addr[ETH_ALEN];
0183 };
0184 
0185 struct mwifiex_debug_info {
0186     unsigned int debug_mask;
0187     u32 int_counter;
0188     u32 packets_out[MAX_NUM_TID];
0189     u32 tx_buf_size;
0190     u32 curr_tx_buf_size;
0191     u32 tx_tbl_num;
0192     struct mwifiex_ds_tx_ba_stream_tbl
0193         tx_tbl[MWIFIEX_MAX_TX_BASTREAM_SUPPORTED];
0194     u32 rx_tbl_num;
0195     struct mwifiex_ds_rx_reorder_tbl rx_tbl
0196         [MWIFIEX_MAX_RX_BASTREAM_SUPPORTED];
0197     u32 tdls_peer_num;
0198     struct tdls_peer_info tdls_list
0199         [MWIFIEX_MAX_TDLS_PEER_SUPPORTED];
0200     u16 ps_mode;
0201     u32 ps_state;
0202     u8 is_deep_sleep;
0203     u8 pm_wakeup_card_req;
0204     u32 pm_wakeup_fw_try;
0205     u8 is_hs_configured;
0206     u8 hs_activated;
0207     u32 num_cmd_host_to_card_failure;
0208     u32 num_cmd_sleep_cfm_host_to_card_failure;
0209     u32 num_tx_host_to_card_failure;
0210     u32 num_event_deauth;
0211     u32 num_event_disassoc;
0212     u32 num_event_link_lost;
0213     u32 num_cmd_deauth;
0214     u32 num_cmd_assoc_success;
0215     u32 num_cmd_assoc_failure;
0216     u32 num_tx_timeout;
0217     u8 is_cmd_timedout;
0218     u16 timeout_cmd_id;
0219     u16 timeout_cmd_act;
0220     u16 last_cmd_id[DBG_CMD_NUM];
0221     u16 last_cmd_act[DBG_CMD_NUM];
0222     u16 last_cmd_index;
0223     u16 last_cmd_resp_id[DBG_CMD_NUM];
0224     u16 last_cmd_resp_index;
0225     u16 last_event[DBG_CMD_NUM];
0226     u16 last_event_index;
0227     u8 data_sent;
0228     u8 cmd_sent;
0229     u8 cmd_resp_received;
0230     u8 event_received;
0231     u32 last_mp_wr_bitmap[MWIFIEX_DBG_SDIO_MP_NUM];
0232     u32 last_mp_wr_ports[MWIFIEX_DBG_SDIO_MP_NUM];
0233     u32 last_mp_wr_len[MWIFIEX_DBG_SDIO_MP_NUM];
0234     u32 last_mp_curr_wr_port[MWIFIEX_DBG_SDIO_MP_NUM];
0235     u8 last_sdio_mp_index;
0236 };
0237 
0238 #define MWIFIEX_KEY_INDEX_UNICAST   0x40000000
0239 #define PN_LEN              16
0240 
0241 struct mwifiex_ds_encrypt_key {
0242     u32 key_disable;
0243     u32 key_index;
0244     u32 key_len;
0245     u8 key_material[WLAN_MAX_KEY_LEN];
0246     u8 mac_addr[ETH_ALEN];
0247     u32 is_wapi_key;
0248     u8 pn[PN_LEN];      /* packet number */
0249     u8 pn_len;
0250     u8 is_igtk_key;
0251     u8 is_current_wep_key;
0252     u8 is_rx_seq_valid;
0253     u8 is_igtk_def_key;
0254 };
0255 
0256 struct mwifiex_power_cfg {
0257     u32 is_power_auto;
0258     u32 is_power_fixed;
0259     u32 power_level;
0260 };
0261 
0262 struct mwifiex_ds_hs_cfg {
0263     u32 is_invoke_hostcmd;
0264     /*  Bit0: non-unicast data
0265      *  Bit1: unicast data
0266      *  Bit2: mac events
0267      *  Bit3: magic packet
0268      */
0269     u32 conditions;
0270     u32 gpio;
0271     u32 gap;
0272 };
0273 
0274 struct mwifiex_ds_wakeup_reason {
0275     u16  hs_wakeup_reason;
0276 };
0277 
0278 #define DEEP_SLEEP_ON  1
0279 #define DEEP_SLEEP_OFF 0
0280 #define DEEP_SLEEP_IDLE_TIME    100
0281 #define PS_MODE_AUTO        1
0282 
0283 struct mwifiex_ds_auto_ds {
0284     u16 auto_ds;
0285     u16 idle_time;
0286 };
0287 
0288 struct mwifiex_ds_pm_cfg {
0289     union {
0290         u32 ps_mode;
0291         struct mwifiex_ds_hs_cfg hs_cfg;
0292         struct mwifiex_ds_auto_ds auto_deep_sleep;
0293         u32 sleep_period;
0294     } param;
0295 };
0296 
0297 struct mwifiex_11ac_vht_cfg {
0298     u8 band_config;
0299     u8 misc_config;
0300     u32 cap_info;
0301     u32 mcs_tx_set;
0302     u32 mcs_rx_set;
0303 };
0304 
0305 struct mwifiex_ds_11n_tx_cfg {
0306     u16 tx_htcap;
0307     u16 tx_htinfo;
0308     u16 misc_config; /* Needed for 802.11AC cards only */
0309 };
0310 
0311 struct mwifiex_ds_11n_amsdu_aggr_ctrl {
0312     u16 enable;
0313     u16 curr_buf_size;
0314 };
0315 
0316 struct mwifiex_ds_ant_cfg {
0317     u32 tx_ant;
0318     u32 rx_ant;
0319 };
0320 
0321 #define MWIFIEX_NUM_OF_CMD_BUFFER   50
0322 #define MWIFIEX_SIZE_OF_CMD_BUFFER  2048
0323 
0324 enum {
0325     MWIFIEX_IE_TYPE_GEN_IE = 0,
0326     MWIFIEX_IE_TYPE_ARP_FILTER,
0327 };
0328 
0329 enum {
0330     MWIFIEX_REG_MAC = 1,
0331     MWIFIEX_REG_BBP,
0332     MWIFIEX_REG_RF,
0333     MWIFIEX_REG_PMIC,
0334     MWIFIEX_REG_CAU,
0335 };
0336 
0337 struct mwifiex_ds_reg_rw {
0338     u32 type;
0339     u32 offset;
0340     u32 value;
0341 };
0342 
0343 #define MAX_EEPROM_DATA 256
0344 
0345 struct mwifiex_ds_read_eeprom {
0346     u16 offset;
0347     u16 byte_count;
0348     u8 value[MAX_EEPROM_DATA];
0349 };
0350 
0351 struct mwifiex_ds_mem_rw {
0352     u32 addr;
0353     u32 value;
0354 };
0355 
0356 #define IEEE_MAX_IE_SIZE        256
0357 
0358 #define MWIFIEX_IE_HDR_SIZE (sizeof(struct mwifiex_ie) - IEEE_MAX_IE_SIZE)
0359 
0360 struct mwifiex_ds_misc_gen_ie {
0361     u32 type;
0362     u32 len;
0363     u8 ie_data[IEEE_MAX_IE_SIZE];
0364 };
0365 
0366 struct mwifiex_ds_misc_cmd {
0367     u32 len;
0368     u8 cmd[MWIFIEX_SIZE_OF_CMD_BUFFER];
0369 };
0370 
0371 #define BITMASK_BCN_RSSI_LOW    BIT(0)
0372 #define BITMASK_BCN_RSSI_HIGH   BIT(4)
0373 
0374 enum subsc_evt_rssi_state {
0375     EVENT_HANDLED,
0376     RSSI_LOW_RECVD,
0377     RSSI_HIGH_RECVD
0378 };
0379 
0380 struct subsc_evt_cfg {
0381     u8 abs_value;
0382     u8 evt_freq;
0383 };
0384 
0385 struct mwifiex_ds_misc_subsc_evt {
0386     u16 action;
0387     u16 events;
0388     struct subsc_evt_cfg bcn_l_rssi_cfg;
0389     struct subsc_evt_cfg bcn_h_rssi_cfg;
0390 };
0391 
0392 #define MWIFIEX_MEF_MAX_BYTESEQ     6   /* non-adjustable */
0393 #define MWIFIEX_MEF_MAX_FILTERS     10
0394 
0395 struct mwifiex_mef_filter {
0396     u16 repeat;
0397     u16 offset;
0398     s8 byte_seq[MWIFIEX_MEF_MAX_BYTESEQ + 1];
0399     u8 filt_type;
0400     u8 filt_action;
0401 };
0402 
0403 struct mwifiex_mef_entry {
0404     u8 mode;
0405     u8 action;
0406     struct mwifiex_mef_filter filter[MWIFIEX_MEF_MAX_FILTERS];
0407 };
0408 
0409 struct mwifiex_ds_mef_cfg {
0410     u32 criteria;
0411     u16 num_entries;
0412     struct mwifiex_mef_entry *mef_entry;
0413 };
0414 
0415 #define MWIFIEX_MAX_VSIE_LEN       (256)
0416 #define MWIFIEX_MAX_VSIE_NUM       (8)
0417 #define MWIFIEX_VSIE_MASK_CLEAR    0x00
0418 #define MWIFIEX_VSIE_MASK_SCAN     0x01
0419 #define MWIFIEX_VSIE_MASK_ASSOC    0x02
0420 #define MWIFIEX_VSIE_MASK_ADHOC    0x04
0421 #define MWIFIEX_VSIE_MASK_BGSCAN   0x08
0422 
0423 enum {
0424     MWIFIEX_FUNC_INIT = 1,
0425     MWIFIEX_FUNC_SHUTDOWN,
0426 };
0427 
0428 enum COALESCE_OPERATION {
0429     RECV_FILTER_MATCH_TYPE_EQ = 0x80,
0430     RECV_FILTER_MATCH_TYPE_NE,
0431 };
0432 
0433 enum COALESCE_PACKET_TYPE {
0434     PACKET_TYPE_UNICAST = 1,
0435     PACKET_TYPE_MULTICAST = 2,
0436     PACKET_TYPE_BROADCAST = 3
0437 };
0438 
0439 #define MWIFIEX_COALESCE_MAX_RULES  8
0440 #define MWIFIEX_COALESCE_MAX_BYTESEQ    4   /* non-adjustable */
0441 #define MWIFIEX_COALESCE_MAX_FILTERS    4
0442 #define MWIFIEX_MAX_COALESCING_DELAY    100     /* in msecs */
0443 
0444 struct filt_field_param {
0445     u8 operation;
0446     u8 operand_len;
0447     u16 offset;
0448     u8 operand_byte_stream[MWIFIEX_COALESCE_MAX_BYTESEQ];
0449 };
0450 
0451 struct mwifiex_coalesce_rule {
0452     u16 max_coalescing_delay;
0453     u8 num_of_fields;
0454     u8 pkt_type;
0455     struct filt_field_param params[MWIFIEX_COALESCE_MAX_FILTERS];
0456 };
0457 
0458 struct mwifiex_ds_coalesce_cfg {
0459     u16 num_of_rules;
0460     struct mwifiex_coalesce_rule rule[MWIFIEX_COALESCE_MAX_RULES];
0461 };
0462 
0463 struct mwifiex_ds_tdls_oper {
0464     u16 tdls_action;
0465     u8 peer_mac[ETH_ALEN];
0466     u16 capability;
0467     u8 qos_info;
0468     u8 *ext_capab;
0469     u8 ext_capab_len;
0470     u8 *supp_rates;
0471     u8 supp_rates_len;
0472     u8 *ht_capab;
0473 };
0474 
0475 #endif /* !_MWIFIEX_IOCTL_H_ */