From 25700afee56cfc53ffbacde06cb18014075b40e0 Mon Sep 17 00:00:00 2001 From: Alkis Georgopoulos Date: Fri, 9 Dec 2022 11:08:52 +0200 Subject: [PATCH] Correct executable bits --- clean | 0 core/mesh/rtw_mesh.c | 0 core/rtw_ap.c | 0 core/rtw_cmd.c | 0 core/rtw_debug.c | 0 core/rtw_ft.c | 0 core/rtw_ieee80211.c | 0 core/rtw_mbo.c | 0 core/rtw_mlme.c | 0 core/rtw_mlme_ext.c | 0 core/rtw_recv.c | 0 core/rtw_vht.c | 0 core/rtw_wlan_util.c | 0 core/rtw_wnm.c | 0 hal/btc/halbtc8821cwifionly.c | 0 hal/btc/halbtc8821cwifionly.h | 0 hal/hal_hci/hal_usb.c | 0 hal/rtl8821c/rtl8821c_ops.c | 0 hal/rtl8821c/usb/rtl8821cu_xmit.c | 0 include/drv_types.h | 0 include/hal_com.h | 0 include/hal_com_h2c.h | 0 include/hal_com_phycfg.h | 0 include/ieee80211.h | 0 include/ieee80211.h.orig | 1989 ----------------------------- include/osdep_service_linux.h | 0 include/rtl8723b_hal.h | 0 include/rtl8723b_led.h | 0 include/rtl8723b_recv.h | 0 include/rtl8723b_spec.h | 0 include/rtl8723b_xmit.h | 0 include/rtl8814a_cmd.h | 0 include/rtl8814a_hal.h | 0 include/rtl8814a_recv.h | 0 include/rtl8814a_spec.h | 0 include/rtl8814a_xmit.h | 0 include/rtl8814b_hal.h | 0 include/rtl8814bu_hal.h | 0 include/rtl8821ce_hal.h | 0 include/rtl8822be_hal.h | 0 include/rtl8822c_hal.h | 0 include/rtl8822ce_hal.h | 0 include/rtl8822cs_hal.h | 0 include/rtl8822cu_hal.h | 0 include/rtw_debug.h | 0 include/rtw_ft.h | 0 include/rtw_mbo.h | 0 include/rtw_mlme.h | 0 include/rtw_mlme_ext.h | 0 include/rtw_mlme_ext.h.orig | 1225 ------------------ include/rtw_vht.h | 0 include/rtw_wnm.h | 0 include/sta_info.h | 0 include/sta_info.h.orig | 781 ----------- include/wifi.h | 0 os_dep/linux/ioctl_cfg80211.c | 0 os_dep/linux/rtw_proc.c | 0 os_dep/linux/rtw_proc.h | 0 os_dep/linux/usb_ops_linux.c | 0 59 files changed, 3995 deletions(-) mode change 100644 => 100755 clean mode change 100755 => 100644 core/mesh/rtw_mesh.c mode change 100755 => 100644 core/rtw_ap.c mode change 100755 => 100644 core/rtw_cmd.c mode change 100755 => 100644 core/rtw_debug.c mode change 100755 => 100644 core/rtw_ft.c mode change 100755 => 100644 core/rtw_ieee80211.c mode change 100755 => 100644 core/rtw_mbo.c mode change 100755 => 100644 core/rtw_mlme.c mode change 100755 => 100644 core/rtw_mlme_ext.c mode change 100755 => 100644 core/rtw_recv.c mode change 100755 => 100644 core/rtw_vht.c mode change 100755 => 100644 core/rtw_wlan_util.c mode change 100755 => 100644 core/rtw_wnm.c mode change 100755 => 100644 hal/btc/halbtc8821cwifionly.c mode change 100755 => 100644 hal/btc/halbtc8821cwifionly.h mode change 100755 => 100644 hal/hal_hci/hal_usb.c mode change 100755 => 100644 hal/rtl8821c/rtl8821c_ops.c mode change 100755 => 100644 hal/rtl8821c/usb/rtl8821cu_xmit.c mode change 100755 => 100644 include/drv_types.h mode change 100755 => 100644 include/hal_com.h mode change 100755 => 100644 include/hal_com_h2c.h mode change 100755 => 100644 include/hal_com_phycfg.h mode change 100755 => 100644 include/ieee80211.h delete mode 100755 include/ieee80211.h.orig mode change 100755 => 100644 include/osdep_service_linux.h mode change 100755 => 100644 include/rtl8723b_hal.h mode change 100755 => 100644 include/rtl8723b_led.h mode change 100755 => 100644 include/rtl8723b_recv.h mode change 100755 => 100644 include/rtl8723b_spec.h mode change 100755 => 100644 include/rtl8723b_xmit.h mode change 100755 => 100644 include/rtl8814a_cmd.h mode change 100755 => 100644 include/rtl8814a_hal.h mode change 100755 => 100644 include/rtl8814a_recv.h mode change 100755 => 100644 include/rtl8814a_spec.h mode change 100755 => 100644 include/rtl8814a_xmit.h mode change 100755 => 100644 include/rtl8814b_hal.h mode change 100755 => 100644 include/rtl8814bu_hal.h mode change 100755 => 100644 include/rtl8821ce_hal.h mode change 100755 => 100644 include/rtl8822be_hal.h mode change 100755 => 100644 include/rtl8822c_hal.h mode change 100755 => 100644 include/rtl8822ce_hal.h mode change 100755 => 100644 include/rtl8822cs_hal.h mode change 100755 => 100644 include/rtl8822cu_hal.h mode change 100755 => 100644 include/rtw_debug.h mode change 100755 => 100644 include/rtw_ft.h mode change 100755 => 100644 include/rtw_mbo.h mode change 100755 => 100644 include/rtw_mlme.h mode change 100755 => 100644 include/rtw_mlme_ext.h delete mode 100755 include/rtw_mlme_ext.h.orig mode change 100755 => 100644 include/rtw_vht.h mode change 100755 => 100644 include/rtw_wnm.h mode change 100755 => 100644 include/sta_info.h delete mode 100644 include/sta_info.h.orig mode change 100755 => 100644 include/wifi.h mode change 100755 => 100644 os_dep/linux/ioctl_cfg80211.c mode change 100755 => 100644 os_dep/linux/rtw_proc.c mode change 100755 => 100644 os_dep/linux/rtw_proc.h mode change 100755 => 100644 os_dep/linux/usb_ops_linux.c diff --git a/clean b/clean old mode 100644 new mode 100755 diff --git a/core/mesh/rtw_mesh.c b/core/mesh/rtw_mesh.c old mode 100755 new mode 100644 diff --git a/core/rtw_ap.c b/core/rtw_ap.c old mode 100755 new mode 100644 diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c old mode 100755 new mode 100644 diff --git a/core/rtw_debug.c b/core/rtw_debug.c old mode 100755 new mode 100644 diff --git a/core/rtw_ft.c b/core/rtw_ft.c old mode 100755 new mode 100644 diff --git a/core/rtw_ieee80211.c b/core/rtw_ieee80211.c old mode 100755 new mode 100644 diff --git a/core/rtw_mbo.c b/core/rtw_mbo.c old mode 100755 new mode 100644 diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c old mode 100755 new mode 100644 diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c old mode 100755 new mode 100644 diff --git a/core/rtw_recv.c b/core/rtw_recv.c old mode 100755 new mode 100644 diff --git a/core/rtw_vht.c b/core/rtw_vht.c old mode 100755 new mode 100644 diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c old mode 100755 new mode 100644 diff --git a/core/rtw_wnm.c b/core/rtw_wnm.c old mode 100755 new mode 100644 diff --git a/hal/btc/halbtc8821cwifionly.c b/hal/btc/halbtc8821cwifionly.c old mode 100755 new mode 100644 diff --git a/hal/btc/halbtc8821cwifionly.h b/hal/btc/halbtc8821cwifionly.h old mode 100755 new mode 100644 diff --git a/hal/hal_hci/hal_usb.c b/hal/hal_hci/hal_usb.c old mode 100755 new mode 100644 diff --git a/hal/rtl8821c/rtl8821c_ops.c b/hal/rtl8821c/rtl8821c_ops.c old mode 100755 new mode 100644 diff --git a/hal/rtl8821c/usb/rtl8821cu_xmit.c b/hal/rtl8821c/usb/rtl8821cu_xmit.c old mode 100755 new mode 100644 diff --git a/include/drv_types.h b/include/drv_types.h old mode 100755 new mode 100644 diff --git a/include/hal_com.h b/include/hal_com.h old mode 100755 new mode 100644 diff --git a/include/hal_com_h2c.h b/include/hal_com_h2c.h old mode 100755 new mode 100644 diff --git a/include/hal_com_phycfg.h b/include/hal_com_phycfg.h old mode 100755 new mode 100644 diff --git a/include/ieee80211.h b/include/ieee80211.h old mode 100755 new mode 100644 diff --git a/include/ieee80211.h.orig b/include/ieee80211.h.orig deleted file mode 100755 index f69e72f..0000000 --- a/include/ieee80211.h.orig +++ /dev/null @@ -1,1989 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2017 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - *****************************************************************************/ -#ifndef __IEEE80211_H -#define __IEEE80211_H - -#define MGMT_QUEUE_NUM 5 - -#define ETH_ALEN 6 -#define ETH_TYPE_LEN 2 -#define PAYLOAD_TYPE_LEN 1 - -#define NET80211_TU_TO_US 1024 /* unit:us */ -#define DEFAULT_BCN_INTERVAL 100 /* 100 ms */ - -#ifdef CONFIG_AP_MODE - -#define RTL_IOCTL_HOSTAPD (SIOCDEVPRIVATE + 2) - -/* RTL871X_IOCTL_HOSTAPD ioctl() cmd: */ -enum { - RTL871X_HOSTAPD_FLUSH = 1, - RTL871X_HOSTAPD_ADD_STA = 2, - RTL871X_HOSTAPD_REMOVE_STA = 3, - RTL871X_HOSTAPD_GET_INFO_STA = 4, - /* REMOVED: PRISM2_HOSTAPD_RESET_TXEXC_STA = 5, */ - RTL871X_HOSTAPD_GET_WPAIE_STA = 5, - RTL871X_SET_ENCRYPTION = 6, - RTL871X_GET_ENCRYPTION = 7, - RTL871X_HOSTAPD_SET_FLAGS_STA = 8, - RTL871X_HOSTAPD_GET_RID = 9, - RTL871X_HOSTAPD_SET_RID = 10, - RTL871X_HOSTAPD_SET_ASSOC_AP_ADDR = 11, - RTL871X_HOSTAPD_SET_GENERIC_ELEMENT = 12, - RTL871X_HOSTAPD_MLME = 13, - RTL871X_HOSTAPD_SCAN_REQ = 14, - RTL871X_HOSTAPD_STA_CLEAR_STATS = 15, - RTL871X_HOSTAPD_SET_BEACON = 16, - RTL871X_HOSTAPD_SET_WPS_BEACON = 17, - RTL871X_HOSTAPD_SET_WPS_PROBE_RESP = 18, - RTL871X_HOSTAPD_SET_WPS_ASSOC_RESP = 19, - RTL871X_HOSTAPD_SET_HIDDEN_SSID = 20, - RTL871X_HOSTAPD_SET_MACADDR_ACL = 21, - RTL871X_HOSTAPD_ACL_ADD_STA = 22, - RTL871X_HOSTAPD_ACL_REMOVE_STA = 23, -}; -#endif /* CONFIG_AP_MODE */ - -/* STA flags */ -#define WLAN_STA_AUTH BIT(0) -#define WLAN_STA_ASSOC BIT(1) -#define WLAN_STA_PS BIT(2) -#define WLAN_STA_TIM BIT(3) -#define WLAN_STA_PERM BIT(4) -#define WLAN_STA_AUTHORIZED BIT(5) -#define WLAN_STA_PENDING_POLL BIT(6) /* pending activity poll not ACKed */ -#define WLAN_STA_SHORT_PREAMBLE BIT(7) -#define WLAN_STA_PREAUTH BIT(8) -#define WLAN_STA_WME BIT(9) -#define WLAN_STA_MFP BIT(10) -#define WLAN_STA_HT BIT(11) -#define WLAN_STA_WPS BIT(12) -#define WLAN_STA_MAYBE_WPS BIT(13) -#define WLAN_STA_VHT BIT(14) -#define WLAN_STA_WDS BIT(15) -#define WLAN_STA_MULTI_AP BIT(16) -#define WLAN_STA_NONERP BIT(31) - -#define IEEE_CMD_SET_WPA_PARAM 1 -#define IEEE_CMD_SET_WPA_IE 2 -#define IEEE_CMD_SET_ENCRYPTION 3 -#define IEEE_CMD_MLME 4 - -#define IEEE_PARAM_WPA_ENABLED 1 -#define IEEE_PARAM_TKIP_COUNTERMEASURES 2 -#define IEEE_PARAM_DROP_UNENCRYPTED 3 -#define IEEE_PARAM_PRIVACY_INVOKED 4 -#define IEEE_PARAM_AUTH_ALGS 5 -#define IEEE_PARAM_IEEE_802_1X 6 -#define IEEE_PARAM_WPAX_SELECT 7 - -#define AUTH_ALG_OPEN_SYSTEM 0x1 -#define AUTH_ALG_SHARED_KEY 0x2 -#define AUTH_ALG_LEAP 0x00000004 - -#define IEEE_MLME_STA_DEAUTH 1 -#define IEEE_MLME_STA_DISASSOC 2 - -#define IEEE_CRYPT_ERR_UNKNOWN_ALG 2 -#define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3 -#define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4 -#define IEEE_CRYPT_ERR_KEY_SET_FAILED 5 -#define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6 -#define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7 - - -#define IEEE_CRYPT_ALG_NAME_LEN 16 - -#define WPA_CIPHER_NONE BIT(0) -#define WPA_CIPHER_WEP40 BIT(1) -#define WPA_CIPHER_WEP104 BIT(2) -#define WPA_CIPHER_TKIP BIT(3) -#define WPA_CIPHER_CCMP BIT(4) -#define WPA_CIPHER_GCMP BIT(5) -#define WPA_CIPHER_GCMP_256 BIT(6) -#define WPA_CIPHER_CCMP_256 BIT(7) -#define WPA_CIPHER_BIP_CMAC_128 BIT(8) -#define WPA_CIPHER_BIP_GMAC_128 BIT(9) -#define WPA_CIPHER_BIP_GMAC_256 BIT(10) -#define WPA_CIPHER_BIP_CMAC_256 BIT(11) - - -#define WPA_SELECTOR_LEN 4 -extern u8 RTW_WPA_OUI_TYPE[] ; -extern u16 RTW_WPA_VERSION ; -extern u8 WPA_AUTH_KEY_MGMT_NONE[]; -extern u8 WPA_AUTH_KEY_MGMT_UNSPEC_802_1X[]; -extern u8 WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X[]; -extern u8 WPA_CIPHER_SUITE_NONE[]; -extern u8 WPA_CIPHER_SUITE_WEP40[]; -extern u8 WPA_CIPHER_SUITE_TKIP[]; -extern u8 WPA_CIPHER_SUITE_WRAP[]; -extern u8 WPA_CIPHER_SUITE_CCMP[]; -extern u8 RSN_CIPHER_SUITE_GCMP[]; -extern u8 RSN_CIPHER_SUITE_GCMP_256[]; -extern u8 RSN_CIPHER_SUITE_CCMP_256[]; -extern u8 WPA_CIPHER_SUITE_WEP104[]; - - -#define RSN_HEADER_LEN 4 -#define RSN_SELECTOR_LEN 4 - -extern u16 RSN_VERSION_BSD; -extern u8 RSN_CIPHER_SUITE_NONE[]; -extern u8 RSN_CIPHER_SUITE_WEP40[]; -extern u8 RSN_CIPHER_SUITE_TKIP[]; -extern u8 RSN_CIPHER_SUITE_WRAP[]; -extern u8 RSN_CIPHER_SUITE_CCMP[]; -extern u8 RSN_CIPHER_SUITE_WEP104[]; - -/* AKM suite type */ -extern u8 WLAN_AKM_8021X[]; -extern u8 WLAN_AKM_PSK[]; -extern u8 WLAN_AKM_FT_8021X[]; -extern u8 WLAN_AKM_FT_PSK[]; -extern u8 WLAN_AKM_8021X_SHA256[]; -extern u8 WLAN_AKM_PSK_SHA256[]; -extern u8 WLAN_AKM_TDLS[]; -extern u8 WLAN_AKM_SAE[]; -extern u8 WLAN_AKM_FT_OVER_SAE[]; -extern u8 WLAN_AKM_8021X_SUITE_B[]; -extern u8 WLAN_AKM_8021X_SUITE_B_192[]; -extern u8 WLAN_AKM_FILS_SHA256[]; -extern u8 WLAN_AKM_FILS_SHA384[]; -extern u8 WLAN_AKM_FT_FILS_SHA256[]; -extern u8 WLAN_AKM_FT_FILS_SHA384[]; - -#define WLAN_AKM_TYPE_8021X BIT(0) -#define WLAN_AKM_TYPE_PSK BIT(1) -#define WLAN_AKM_TYPE_FT_8021X BIT(2) -#define WLAN_AKM_TYPE_FT_PSK BIT(3) -#define WLAN_AKM_TYPE_8021X_SHA256 BIT(4) -#define WLAN_AKM_TYPE_PSK_SHA256 BIT(5) -#define WLAN_AKM_TYPE_TDLS BIT(6) -#define WLAN_AKM_TYPE_SAE BIT(7) -#define WLAN_AKM_TYPE_FT_OVER_SAE BIT(8) -#define WLAN_AKM_TYPE_8021X_SUITE_B BIT(9) -#define WLAN_AKM_TYPE_8021X_SUITE_B_192 BIT(10) -#define WLAN_AKM_TYPE_FILS_SHA256 BIT(11) -#define WLAN_AKM_TYPE_FILS_SHA384 BIT(12) -#define WLAN_AKM_TYPE_FT_FILS_SHA256 BIT(13) -#define WLAN_AKM_TYPE_FT_FILS_SHA384 BIT(14) - -/* IEEE 802.11i */ -#define PMKID_LEN 16 -#define PMK_LEN 32 -#define PMK_LEN_SUITE_B_192 48 -#define PMK_LEN_MAX 48 -#define WPA_REPLAY_COUNTER_LEN 8 -#define WPA_NONCE_LEN 32 -#define WPA_KEY_RSC_LEN 8 -#define WPA_GMK_LEN 32 -#define WPA_GTK_MAX_LEN 32 - -/* IEEE 802.11, 8.5.2 EAPOL-Key frames */ -#define WPA_KEY_INFO_TYPE_MASK ((u16) (BIT(0) | BIT(1) | BIT(2))) -#define WPA_KEY_INFO_TYPE_AKM_DEFINED 0 -#define WPA_KEY_INFO_TYPE_HMAC_MD5_RC4 BIT(0) -#define WPA_KEY_INFO_TYPE_HMAC_SHA1_AES BIT(1) -#define WPA_KEY_INFO_TYPE_AES_128_CMAC 3 -#define WPA_KEY_INFO_KEY_TYPE BIT(3) /* 1 = Pairwise, 0 = Group key */ -/* bit4..5 is used in WPA, but is reserved in IEEE 802.11i/RSN */ -#define WPA_KEY_INFO_KEY_INDEX_MASK (BIT(4) | BIT(5)) -#define WPA_KEY_INFO_KEY_INDEX_SHIFT 4 -#define WPA_KEY_INFO_INSTALL BIT(6) /* pairwise */ -#define WPA_KEY_INFO_TXRX BIT(6) /* group */ -#define WPA_KEY_INFO_ACK BIT(7) -#define WPA_KEY_INFO_MIC BIT(8) -#define WPA_KEY_INFO_SECURE BIT(9) -#define WPA_KEY_INFO_ERROR BIT(10) -#define WPA_KEY_INFO_REQUEST BIT(11) -#define WPA_KEY_INFO_ENCR_KEY_DATA BIT(12) /* IEEE 802.11i/RSN only */ -#define WPA_KEY_INFO_SMK_MESSAGE BIT(13) - -struct ieee802_1x_hdr { - u8 version; - u8 type; - u16 length; - /* followed by length octets of data */ -}; - -struct wpa_eapol_key { - u8 type; - /* Note: key_info, key_length, and key_data_length are unaligned */ - u8 key_info[2]; /* big endian */ - u8 key_length[2]; /* big endian */ - u8 replay_counter[WPA_REPLAY_COUNTER_LEN]; - u8 key_nonce[WPA_NONCE_LEN]; - u8 key_iv[16]; - u8 key_rsc[WPA_KEY_RSC_LEN]; - u8 key_id[8]; /* Reserved in IEEE 802.11i/RSN */ - u8 key_mic[16]; - u8 key_data_length[2]; /* big endian */ - /* followed by key_data_length bytes of key_data */ -}; - -typedef enum _RATEID_IDX_ { - RATEID_IDX_BGN_40M_2SS = 0, - RATEID_IDX_BGN_40M_1SS = 1, - RATEID_IDX_BGN_20M_2SS_BN = 2, - RATEID_IDX_BGN_20M_1SS_BN = 3, - RATEID_IDX_GN_N2SS = 4, - RATEID_IDX_GN_N1SS = 5, - RATEID_IDX_BG = 6, - RATEID_IDX_G = 7, - RATEID_IDX_B = 8, - RATEID_IDX_VHT_2SS = 9, - RATEID_IDX_VHT_1SS = 10, - RATEID_IDX_MIX1 = 11, - RATEID_IDX_MIX2 = 12, - RATEID_IDX_VHT_3SS = 13, - RATEID_IDX_BGN_3SS = 14, - RATEID_IDX_BGN_4SS = 15, - RATEID_IDX_VHT_4SS = 16, -} RATEID_IDX, *PRATEID_IDX; - -typedef enum _RATR_TABLE_MODE { - RATR_INX_WIRELESS_NGB = 0, /* BGN 40 Mhz 2SS 1SS */ - RATR_INX_WIRELESS_NG = 1, /* GN or N */ - RATR_INX_WIRELESS_NB = 2, /* BGN 20 Mhz 2SS 1SS or BN */ - RATR_INX_WIRELESS_N = 3, - RATR_INX_WIRELESS_GB = 4, - RATR_INX_WIRELESS_G = 5, - RATR_INX_WIRELESS_B = 6, - RATR_INX_WIRELESS_MC = 7, - RATR_INX_WIRELESS_AC_N = 8, -} RATR_TABLE_MODE, *PRATR_TABLE_MODE; - - -enum NETWORK_TYPE { - WIRELESS_INVALID = 0, - /* Sub-Element */ - WIRELESS_11B = BIT(0), /* tx: cck only , rx: cck only, hw: cck */ - WIRELESS_11G = BIT(1), /* tx: ofdm only, rx: ofdm & cck, hw: cck & ofdm */ - WIRELESS_11A = BIT(2), /* tx: ofdm only, rx: ofdm only, hw: ofdm only */ - WIRELESS_11_24N = BIT(3), /* tx: MCS only, rx: MCS & cck, hw: MCS & cck */ - WIRELESS_11_5N = BIT(4), /* tx: MCS only, rx: MCS & ofdm, hw: ofdm only */ - WIRELESS_AUTO = BIT(5), - WIRELESS_11AC = BIT(6), - - /* Combination */ - /* Type for current wireless mode */ - WIRELESS_11BG = (WIRELESS_11B | WIRELESS_11G), /* tx: cck & ofdm, rx: cck & ofdm & MCS, hw: cck & ofdm */ - WIRELESS_11G_24N = (WIRELESS_11G | WIRELESS_11_24N), /* tx: ofdm & MCS, rx: ofdm & cck & MCS, hw: cck & ofdm */ - WIRELESS_11A_5N = (WIRELESS_11A | WIRELESS_11_5N), /* tx: ofdm & MCS, rx: ofdm & MCS, hw: ofdm only */ - WIRELESS_11B_24N = (WIRELESS_11B | WIRELESS_11_24N), /* tx: ofdm & cck & MCS, rx: ofdm & cck & MCS, hw: ofdm & cck */ - WIRELESS_11BG_24N = (WIRELESS_11B | WIRELESS_11G | WIRELESS_11_24N), /* tx: ofdm & cck & MCS, rx: ofdm & cck & MCS, hw: ofdm & cck */ - WIRELESS_11_24AC = (WIRELESS_11B | WIRELESS_11G | WIRELESS_11AC), - WIRELESS_11_5AC = (WIRELESS_11A | WIRELESS_11AC), - - - /* Type for registry default wireless mode */ - WIRELESS_11AGN = (WIRELESS_11A | WIRELESS_11G | WIRELESS_11_24N | WIRELESS_11_5N), /* tx: ofdm & MCS, rx: ofdm & MCS, hw: ofdm only */ - WIRELESS_11ABGN = (WIRELESS_11A | WIRELESS_11B | WIRELESS_11G | WIRELESS_11_24N | WIRELESS_11_5N), - WIRELESS_MODE_24G = (WIRELESS_11B | WIRELESS_11G | WIRELESS_11_24N), - WIRELESS_MODE_5G = (WIRELESS_11A | WIRELESS_11_5N | WIRELESS_11AC), - WIRELESS_MODE_MAX = (WIRELESS_11A | WIRELESS_11B | WIRELESS_11G | WIRELESS_11_24N | WIRELESS_11_5N | WIRELESS_11AC), -}; - -#define SUPPORTED_24G_NETTYPE_MSK WIRELESS_MODE_24G -#define SUPPORTED_5G_NETTYPE_MSK WIRELESS_MODE_5G - -#define IsLegacyOnly(NetType) ((NetType) == ((NetType) & (WIRELESS_11BG | WIRELESS_11A))) - -#define IsSupported24G(NetType) ((NetType) & SUPPORTED_24G_NETTYPE_MSK ? _TRUE : _FALSE) -#define is_supported_5g(NetType) ((NetType) & SUPPORTED_5G_NETTYPE_MSK ? _TRUE : _FALSE) - -#define IsEnableHWCCK(NetType) IsSupported24G(NetType) -#define IsEnableHWOFDM(NetType) ((NetType) & (WIRELESS_11G | WIRELESS_11_24N | SUPPORTED_5G_NETTYPE_MSK) ? _TRUE : _FALSE) - -#define IsSupportedRxCCK(NetType) IsEnableHWCCK(NetType) -#define IsSupportedRxOFDM(NetType) IsEnableHWOFDM(NetType) -#define IsSupportedRxHT(NetType) IsEnableHWOFDM(NetType) - -#define IsSupportedTxCCK(NetType) ((NetType) & (WIRELESS_11B) ? _TRUE : _FALSE) -#define IsSupportedTxOFDM(NetType) ((NetType) & (WIRELESS_11G | WIRELESS_11A) ? _TRUE : _FALSE) -#define is_supported_ht(NetType) ((NetType) & (WIRELESS_11_24N | WIRELESS_11_5N) ? _TRUE : _FALSE) - -#define is_supported_vht(NetType) ((NetType) & (WIRELESS_11AC) ? _TRUE : _FALSE) - - - - - -typedef struct ieee_param { - u32 cmd; - u8 sta_addr[ETH_ALEN]; - union { - struct { - u8 name; - u32 value; - } wpa_param; - struct { - u32 len; - u8 reserved[32]; - u8 data[0]; - } wpa_ie; - struct { - int command; - int reason_code; - } mlme; - struct { - u8 alg[IEEE_CRYPT_ALG_NAME_LEN]; - u8 set_tx; - u32 err; - u8 idx; - u8 seq[8]; /* sequence counter (set: RX, get: TX) */ - u16 key_len; - u8 key[0]; - } crypt; -#ifdef CONFIG_AP_MODE - struct { - u16 aid; - u16 capability; - int flags; - u8 tx_supp_rates[16]; - struct rtw_ieee80211_ht_cap ht_cap; - } add_sta; - struct { - u8 reserved[2];/* for set max_num_sta */ - u8 buf[0]; - } bcn_ie; -#endif - - } u; -} ieee_param; - -#ifdef CONFIG_AP_MODE -typedef struct ieee_param_ex { - u32 cmd; - u8 sta_addr[ETH_ALEN]; - u8 data[0]; -} ieee_param_ex; - -struct sta_data { - u16 aid; - u16 capability; - int flags; - u32 sta_set; - u8 tx_supp_rates[16]; - u32 tx_supp_rates_len; - struct rtw_ieee80211_ht_cap ht_cap; - u64 rx_pkts; - u64 rx_bytes; - u64 rx_drops; - u64 tx_pkts; - u64 tx_bytes; - u64 tx_drops; -}; -#endif - - -#if WIRELESS_EXT < 17 - #define IW_QUAL_QUAL_INVALID 0x10 - #define IW_QUAL_LEVEL_INVALID 0x20 - #define IW_QUAL_NOISE_INVALID 0x40 - #define IW_QUAL_QUAL_UPDATED 0x1 - #define IW_QUAL_LEVEL_UPDATED 0x2 - #define IW_QUAL_NOISE_UPDATED 0x4 -#endif - -#define IEEE80211_DATA_LEN 2304 -/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section - 6.2.1.1.2. - - The figure in section 7.1.2 suggests a body size of up to 2312 - bytes is allowed, which is a bit confusing, I suspect this - represents the 2304 bytes of real data, plus a possible 8 bytes of - WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ - - -#define IEEE80211_HLEN 30 -#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) - - -/* this is stolen from ipw2200 driver */ -#define IEEE_IBSS_MAC_HASH_SIZE 31 - -struct ieee_ibss_seq { - u8 mac[ETH_ALEN]; - u16 seq_num; - u16 frag_num; - unsigned long packet_time; - _list list; -}; - -#if defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) - -struct rtw_ieee80211_hdr { - u16 frame_ctl; - u16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 addr3[ETH_ALEN]; - u16 seq_ctl; - u8 addr4[ETH_ALEN]; -} __attribute__((packed)); - -struct rtw_ieee80211_hdr_3addr { - u16 frame_ctl; - u16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 addr3[ETH_ALEN]; - u16 seq_ctl; -} __attribute__((packed)); - - -struct rtw_ieee80211_hdr_qos { - u16 frame_ctl; - u16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 addr3[ETH_ALEN]; - u16 seq_ctl; - u8 addr4[ETH_ALEN]; - u16 qc; -} __attribute__((packed)); - -struct rtw_ieee80211_hdr_3addr_qos { - u16 frame_ctl; - u16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 addr3[ETH_ALEN]; - u16 seq_ctl; - u16 qc; -} __attribute__((packed)); - -struct eapol { - u8 snap[6]; - u16 ethertype; - u8 version; - u8 type; - u16 length; -} __attribute__((packed)); - -struct rtw_ieee80211s_hdr { - u8 flags; - u8 ttl; - u32 seqnum; - u8 eaddr1[ETH_ALEN]; - u8 eaddr2[ETH_ALEN]; -} __attribute__((packed)); - -/** - * struct rtw_ieee80211_rann_ie - * - * This structure refers to "Root Announcement information element" - */ - struct rtw_ieee80211_rann_ie { - u8 rann_flags; - u8 rann_hopcount; - u8 rann_ttl; - u8 rann_addr[ETH_ALEN]; - u32 rann_seq; - u32 rann_interval; - u32 rann_metric; -} __attribute__((packed)); -#endif - -enum eap_type { - EAP_PACKET = 0, - EAPOL_START, - EAPOL_LOGOFF, - EAPOL_KEY, - EAPOL_ENCAP_ASF_ALERT -}; - -#define IEEE80211_3ADDR_LEN 24 -#define IEEE80211_4ADDR_LEN 30 -#define IEEE80211_FCS_LEN 4 - -#define MIN_FRAG_THRESHOLD 256U -#define MAX_FRAG_THRESHOLD 2346U - -/* Frame control field constants */ -#define RTW_IEEE80211_FCTL_VERS 0x0003 -#define RTW_IEEE80211_FCTL_FTYPE 0x000c -#define RTW_IEEE80211_FCTL_STYPE 0x00f0 -#define RTW_IEEE80211_FCTL_TODS 0x0100 -#define RTW_IEEE80211_FCTL_FROMDS 0x0200 -#define RTW_IEEE80211_FCTL_MOREFRAGS 0x0400 -#define RTW_IEEE80211_FCTL_RETRY 0x0800 -#define RTW_IEEE80211_FCTL_PM 0x1000 -#define RTW_IEEE80211_FCTL_MOREDATA 0x2000 -#define RTW_IEEE80211_FCTL_PROTECTED 0x4000 -#define RTW_IEEE80211_FCTL_ORDER 0x8000 -#define RTW_IEEE80211_FCTL_CTL_EXT 0x0f00 - -#define RTW_IEEE80211_FTYPE_MGMT 0x0000 -#define RTW_IEEE80211_FTYPE_CTL 0x0004 -#define RTW_IEEE80211_FTYPE_DATA 0x0008 -#define RTW_IEEE80211_FTYPE_EXT 0x000c - -/* management */ -#define RTW_IEEE80211_STYPE_ASSOC_REQ 0x0000 -#define RTW_IEEE80211_STYPE_ASSOC_RESP 0x0010 -#define RTW_IEEE80211_STYPE_REASSOC_REQ 0x0020 -#define RTW_IEEE80211_STYPE_REASSOC_RESP 0x0030 -#define RTW_IEEE80211_STYPE_PROBE_REQ 0x0040 -#define RTW_IEEE80211_STYPE_PROBE_RESP 0x0050 -#define RTW_IEEE80211_STYPE_BEACON 0x0080 -#define RTW_IEEE80211_STYPE_ATIM 0x0090 -#define RTW_IEEE80211_STYPE_DISASSOC 0x00A0 -#define RTW_IEEE80211_STYPE_AUTH 0x00B0 -#define RTW_IEEE80211_STYPE_DEAUTH 0x00C0 -#define RTW_IEEE80211_STYPE_ACTION 0x00D0 - -/* control */ -#define RTW_IEEE80211_STYPE_CTL_EXT 0x0060 -#define RTW_IEEE80211_STYPE_BACK_REQ 0x0080 -#define RTW_IEEE80211_STYPE_BACK 0x0090 -#define RTW_IEEE80211_STYPE_PSPOLL 0x00A0 -#define RTW_IEEE80211_STYPE_RTS 0x00B0 -#define RTW_IEEE80211_STYPE_CTS 0x00C0 -#define RTW_IEEE80211_STYPE_ACK 0x00D0 -#define RTW_IEEE80211_STYPE_CFEND 0x00E0 -#define RTW_IEEE80211_STYPE_CFENDACK 0x00F0 - -/* data */ -#define RTW_IEEE80211_STYPE_DATA 0x0000 -#define RTW_IEEE80211_STYPE_DATA_CFACK 0x0010 -#define RTW_IEEE80211_STYPE_DATA_CFPOLL 0x0020 -#define RTW_IEEE80211_STYPE_DATA_CFACKPOLL 0x0030 -#define RTW_IEEE80211_STYPE_NULLFUNC 0x0040 -#define RTW_IEEE80211_STYPE_CFACK 0x0050 -#define RTW_IEEE80211_STYPE_CFPOLL 0x0060 -#define RTW_IEEE80211_STYPE_CFACKPOLL 0x0070 -#define RTW_IEEE80211_STYPE_QOS_DATA 0x0080 -#define RTW_IEEE80211_STYPE_QOS_DATA_CFACK 0x0090 -#define RTW_IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0 -#define RTW_IEEE80211_STYPE_QOS_DATA_CFACKPOLL 0x00B0 -#define RTW_IEEE80211_STYPE_QOS_NULLFUNC 0x00C0 -#define RTW_IEEE80211_STYPE_QOS_CFACK 0x00D0 -#define RTW_IEEE80211_STYPE_QOS_CFPOLL 0x00E0 -#define RTW_IEEE80211_STYPE_QOS_CFACKPOLL 0x00F0 - -/* sequence control field */ -#define RTW_IEEE80211_SCTL_FRAG 0x000F -#define RTW_IEEE80211_SCTL_SEQ 0xFFF0 - - -#define RTW_ERP_INFO_NON_ERP_PRESENT BIT(0) -#define RTW_ERP_INFO_USE_PROTECTION BIT(1) -#define RTW_ERP_INFO_BARKER_PREAMBLE_MODE BIT(2) - -/* QoS,QOS */ -#define NORMAL_ACK 0 -#define NO_ACK 1 -#define NON_EXPLICIT_ACK 2 -#define BLOCK_ACK 3 - -#ifndef ETH_P_PAE - #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ -#endif /* ETH_P_PAE */ - -#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */ - -#define ETH_P_ECONET 0x0018 - -#ifndef ETH_P_80211_RAW - #define ETH_P_80211_RAW (ETH_P_ECONET + 1) -#endif - -/* IEEE 802.11 defines */ - -#define P80211_OUI_LEN 3 - -#if defined(PLATFORM_LINUX) || defined(PLATFORM_FREEBSD) - -struct ieee80211_snap_hdr { - - u8 dsap; /* always 0xAA */ - u8 ssap; /* always 0xAA */ - u8 ctrl; /* always 0x03 */ - u8 oui[P80211_OUI_LEN]; /* organizational universal id */ - -} __attribute__((packed)); - -#endif - -#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) - -#define WLAN_FC_GET_TYPE(fc) ((fc) & RTW_IEEE80211_FCTL_FTYPE) -#define WLAN_FC_GET_STYPE(fc) ((fc) & RTW_IEEE80211_FCTL_STYPE) - -#define WLAN_QC_GET_TID(qc) ((qc) & 0x0f) - -#define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTW_IEEE80211_SCTL_FRAG) -#define WLAN_GET_SEQ_SEQ(seq) ((seq) & RTW_IEEE80211_SCTL_SEQ) - -/* Authentication algorithms */ -#define WLAN_AUTH_OPEN 0 -#define WLAN_AUTH_SHARED_KEY 1 -#define WLAN_AUTH_SAE 3 - -#define WLAN_AUTH_CHALLENGE_LEN 128 - -#define WLAN_CAPABILITY_BSS (1<<0) -#define WLAN_CAPABILITY_IBSS (1<<1) -#define WLAN_CAPABILITY_CF_POLLABLE (1<<2) -#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) -#define WLAN_CAPABILITY_PRIVACY (1<<4) -#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) -#define WLAN_CAPABILITY_PBCC (1<<6) -#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) -#define WLAN_CAPABILITY_SHORT_SLOT (1<<10) - -/* Status codes */ -#define WLAN_STATUS_SUCCESS 0 -#define WLAN_STATUS_UNSPECIFIED_FAILURE 1 -#define WLAN_STATUS_CAPS_UNSUPPORTED 10 -#define WLAN_STATUS_REASSOC_NO_ASSOC 11 -#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12 -#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13 -#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14 -#define WLAN_STATUS_CHALLENGE_FAIL 15 -#define WLAN_STATUS_AUTH_TIMEOUT 16 -#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17 -#define WLAN_STATUS_ASSOC_DENIED_RATES 18 -/* 802.11b */ -#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19 -#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20 -#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21 - -/* Reason codes */ -#define WLAN_REASON_UNSPECIFIED 1 -#define WLAN_REASON_PREV_AUTH_NOT_VALID 2 -#define WLAN_REASON_DEAUTH_LEAVING 3 -#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4 -#define WLAN_REASON_DISASSOC_AP_BUSY 5 -#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6 -#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7 -#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8 -#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9 -#define WLAN_REASON_IEEE_802_1X_AUTH_FAILED 23 -#define WLAN_REASON_MESH_PEER_CANCELED 52 -#define WLAN_REASON_MESH_MAX_PEERS 53 -#define WLAN_REASON_MESH_CONFIG 54 -#define WLAN_REASON_MESH_CLOSE 55 -#define WLAN_REASON_MESH_MAX_RETRIES 56 -#define WLAN_REASON_MESH_CONFIRM_TIMEOUT 57 -#define WLAN_REASON_MESH_INVALID_GTK 58 -#define WLAN_REASON_MESH_INCONSISTENT_PARAM 59 -#define WLAN_REASON_MESH_INVALID_SECURITY 60 -#define WLAN_REASON_MESH_PATH_NOPROXY 61 -#define WLAN_REASON_MESH_PATH_NOFORWARD 62 -#define WLAN_REASON_MESH_PATH_DEST_UNREACHABLE 63 -#define WLAN_REASON_MAC_EXISTS_IN_MBSS 64 -#define WLAN_REASON_MESH_CHAN_REGULATORY 65 -#define WLAN_REASON_MESH_CHAN 66 -#define WLAN_REASON_SA_QUERY_TIMEOUT 65532 -#define WLAN_REASON_ACTIVE_ROAM 65533 -#define WLAN_REASON_JOIN_WRONG_CHANNEL 65534 -#define WLAN_REASON_EXPIRATION_CHK 65535 - -#define WLAN_REASON_IS_PRIVATE(reason) ( \ - reason == WLAN_REASON_EXPIRATION_CHK \ - || reason == WLAN_REASON_JOIN_WRONG_CHANNEL \ - || reason == WLAN_REASON_ACTIVE_ROAM \ - || reason == WLAN_REASON_SA_QUERY_TIMEOUT \ - ) - -/* Information Element IDs */ -#define WLAN_EID_SSID 0 -#define WLAN_EID_SUPP_RATES 1 -#define WLAN_EID_FH_PARAMS 2 -#define WLAN_EID_DS_PARAMS 3 -#define WLAN_EID_CF_PARAMS 4 -#define WLAN_EID_TIM 5 -#define WLAN_EID_IBSS_PARAMS 6 -#define WLAN_EID_CHALLENGE 16 -/* EIDs defined by IEEE 802.11h - START */ -#define WLAN_EID_PWR_CONSTRAINT 32 -#define WLAN_EID_PWR_CAPABILITY 33 -#define WLAN_EID_TPC_REQUEST 34 -#define WLAN_EID_TPC_REPORT 35 -#define WLAN_EID_SUPPORTED_CHANNELS 36 -#define WLAN_EID_CHANNEL_SWITCH 37 -#define WLAN_EID_MEASURE_REQUEST 38 -#define WLAN_EID_MEASURE_REPORT 39 -#define WLAN_EID_QUITE 40 -#define WLAN_EID_IBSS_DFS 41 -/* EIDs defined by IEEE 802.11h - END */ -#define WLAN_EID_ERP_INFO 42 -#define WLAN_EID_HT_CAP 45 -#define WLAN_EID_RSN 48 -#define WLAN_EID_EXT_SUPP_RATES 50 -#define WLAN_EID_MOBILITY_DOMAIN 54 -#define WLAN_EID_FAST_BSS_TRANSITION 55 -#define WLAN_EID_TIMEOUT_INTERVAL 56 -#define WLAN_EID_RIC_DATA 57 -#define WLAN_EID_HT_OPERATION 61 -#define WLAN_EID_SECONDARY_CHANNEL_OFFSET 62 -#define WLAN_EID_20_40_BSS_COEXISTENCE 72 -#define WLAN_EID_20_40_BSS_INTOLERANT 73 -#define WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS 74 -#define WLAN_EID_MMIE 76 -#define WLAN_EID_MESH_CONFIG 113 -#define WLAN_EID_MESH_ID 114 -#define WLAN_EID_MPM 117 -#define WLAN_EID_RANN 126 -#define WLAN_EID_PREQ 130 -#define WLAN_EID_PREP 131 -#define WLAN_EID_PERR 132 -#define WLAN_EID_AMPE 139 -#define WLAN_EID_MIC 140 -#define WLAN_EID_VENDOR_SPECIFIC 221 -#define WLAN_EID_GENERIC (WLAN_EID_VENDOR_SPECIFIC) -#define WLAN_EID_VHT_CAPABILITY 191 -#define WLAN_EID_VHT_OPERATION 192 -#define WLAN_EID_WIDE_BANDWIDTH_CHANNEL_SWITCH 194 -#define WLAN_EID_CHANNEL_SWITCH_WRAPPER 196 -#define WLAN_EID_VHT_OP_MODE_NOTIFY 199 -#define WLAN_EID_EXTENSION 255 -#define WLAN_EID_EXT_OWE_DH_PARAM 32 - -#define IEEE80211_MGMT_HDR_LEN 24 -#define IEEE80211_DATA_HDR3_LEN 24 -#define IEEE80211_DATA_HDR4_LEN 30 - - -#define IEEE80211_STATMASK_SIGNAL (1<<0) -#define IEEE80211_STATMASK_RSSI (1<<1) -#define IEEE80211_STATMASK_NOISE (1<<2) -#define IEEE80211_STATMASK_RATE (1<<3) -#define IEEE80211_STATMASK_WEMASK 0x7 - - -#define IEEE80211_CCK_MODULATION (1<<0) -#define IEEE80211_OFDM_MODULATION (1<<1) - -#define IEEE80211_24GHZ_BAND (1<<0) -#define IEEE80211_52GHZ_BAND (1<<1) - -#define IEEE80211_CCK_RATE_LEN 4 -#define IEEE80211_NUM_OFDM_RATESLEN 8 - - - -#define IEEE80211_CCK_RATE_1MB 0x02 -#define IEEE80211_CCK_RATE_2MB 0x04 -#define IEEE80211_CCK_RATE_5MB 0x0B -#define IEEE80211_CCK_RATE_11MB 0x16 -#define IEEE80211_OFDM_RATE_LEN 8 -#define IEEE80211_OFDM_RATE_6MB 0x0C -#define IEEE80211_OFDM_RATE_9MB 0x12 -#define IEEE80211_OFDM_RATE_12MB 0x18 -#define IEEE80211_OFDM_RATE_18MB 0x24 -#define IEEE80211_OFDM_RATE_24MB 0x30 -#define IEEE80211_PBCC_RATE_22MB 0x2C -#define IEEE80211_FREAK_RATE_22_5MB 0x2D -#define IEEE80211_OFDM_RATE_36MB 0x48 -#define IEEE80211_OFDM_RATE_48MB 0x60 -#define IEEE80211_OFDM_RATE_54MB 0x6C -#define IEEE80211_BASIC_RATE_MASK 0x80 - -#define IEEE80211_CCK_RATE_1MB_MASK (1<<0) -#define IEEE80211_CCK_RATE_2MB_MASK (1<<1) -#define IEEE80211_CCK_RATE_5MB_MASK (1<<2) -#define IEEE80211_CCK_RATE_11MB_MASK (1<<3) -#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4) -#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5) -#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6) -#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7) -#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8) -#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9) -#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) -#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) - -#define IEEE80211_CCK_RATES_MASK 0x0000000F -#define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ - IEEE80211_CCK_RATE_2MB_MASK) -#define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ - IEEE80211_CCK_RATE_5MB_MASK | \ - IEEE80211_CCK_RATE_11MB_MASK) - -#define IEEE80211_OFDM_RATES_MASK 0x00000FF0 -#define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ - IEEE80211_OFDM_RATE_12MB_MASK | \ - IEEE80211_OFDM_RATE_24MB_MASK) -#define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \ - IEEE80211_OFDM_RATE_9MB_MASK | \ - IEEE80211_OFDM_RATE_18MB_MASK | \ - IEEE80211_OFDM_RATE_36MB_MASK | \ - IEEE80211_OFDM_RATE_48MB_MASK | \ - IEEE80211_OFDM_RATE_54MB_MASK) -#define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ - IEEE80211_CCK_DEFAULT_RATES_MASK) - -#define IEEE80211_NUM_OFDM_RATES 8 -#define IEEE80211_NUM_CCK_RATES 4 -#define IEEE80211_OFDM_SHIFT_MASK_A 4 - - -enum MGN_RATE { - MGN_1M = 0x02, - MGN_2M = 0x04, - MGN_5_5M = 0x0B, - MGN_6M = 0x0C, - MGN_9M = 0x12, - MGN_11M = 0x16, - MGN_12M = 0x18, - MGN_18M = 0x24, - MGN_24M = 0x30, - MGN_36M = 0x48, - MGN_48M = 0x60, - MGN_54M = 0x6C, - MGN_MCS32 = 0x7F, - MGN_MCS0, - MGN_MCS1, - MGN_MCS2, - MGN_MCS3, - MGN_MCS4, - MGN_MCS5, - MGN_MCS6, - MGN_MCS7, - MGN_MCS8, - MGN_MCS9, - MGN_MCS10, - MGN_MCS11, - MGN_MCS12, - MGN_MCS13, - MGN_MCS14, - MGN_MCS15, - MGN_MCS16, - MGN_MCS17, - MGN_MCS18, - MGN_MCS19, - MGN_MCS20, - MGN_MCS21, - MGN_MCS22, - MGN_MCS23, - MGN_MCS24, - MGN_MCS25, - MGN_MCS26, - MGN_MCS27, - MGN_MCS28, - MGN_MCS29, - MGN_MCS30, - MGN_MCS31, - MGN_VHT1SS_MCS0, - MGN_VHT1SS_MCS1, - MGN_VHT1SS_MCS2, - MGN_VHT1SS_MCS3, - MGN_VHT1SS_MCS4, - MGN_VHT1SS_MCS5, - MGN_VHT1SS_MCS6, - MGN_VHT1SS_MCS7, - MGN_VHT1SS_MCS8, - MGN_VHT1SS_MCS9, - MGN_VHT2SS_MCS0, - MGN_VHT2SS_MCS1, - MGN_VHT2SS_MCS2, - MGN_VHT2SS_MCS3, - MGN_VHT2SS_MCS4, - MGN_VHT2SS_MCS5, - MGN_VHT2SS_MCS6, - MGN_VHT2SS_MCS7, - MGN_VHT2SS_MCS8, - MGN_VHT2SS_MCS9, - MGN_VHT3SS_MCS0, - MGN_VHT3SS_MCS1, - MGN_VHT3SS_MCS2, - MGN_VHT3SS_MCS3, - MGN_VHT3SS_MCS4, - MGN_VHT3SS_MCS5, - MGN_VHT3SS_MCS6, - MGN_VHT3SS_MCS7, - MGN_VHT3SS_MCS8, - MGN_VHT3SS_MCS9, - MGN_VHT4SS_MCS0, - MGN_VHT4SS_MCS1, - MGN_VHT4SS_MCS2, - MGN_VHT4SS_MCS3, - MGN_VHT4SS_MCS4, - MGN_VHT4SS_MCS5, - MGN_VHT4SS_MCS6, - MGN_VHT4SS_MCS7, - MGN_VHT4SS_MCS8, - MGN_VHT4SS_MCS9, - MGN_UNKNOWN -}; - -#define IS_HT_RATE(_rate) ((_rate) >= MGN_MCS0 && (_rate) <= MGN_MCS31) -#define IS_VHT_RATE(_rate) ((_rate) >= MGN_VHT1SS_MCS0 && (_rate) <= MGN_VHT4SS_MCS9) -#define IS_CCK_RATE(_rate) ((_rate) == MGN_1M || (_rate) == MGN_2M || (_rate) == MGN_5_5M || (_rate) == MGN_11M) -#define IS_OFDM_RATE(_rate) ((_rate) >= MGN_6M && (_rate) <= MGN_54M && (_rate) != MGN_11M) - -#define IS_HT1SS_RATE(_rate) ((_rate) >= MGN_MCS0 && (_rate) <= MGN_MCS7) -#define IS_HT2SS_RATE(_rate) ((_rate) >= MGN_MCS8 && (_rate) <= MGN_MCS15) -#define IS_HT3SS_RATE(_rate) ((_rate) >= MGN_MCS16 && (_rate) <= MGN_MCS23) -#define IS_HT4SS_RATE(_rate) ((_rate) >= MGN_MCS24 && (_rate) <= MGN_MCS31) - -#define IS_VHT1SS_RATE(_rate) ((_rate) >= MGN_VHT1SS_MCS0 && (_rate) <= MGN_VHT1SS_MCS9) -#define IS_VHT2SS_RATE(_rate) ((_rate) >= MGN_VHT2SS_MCS0 && (_rate) <= MGN_VHT2SS_MCS9) -#define IS_VHT3SS_RATE(_rate) ((_rate) >= MGN_VHT3SS_MCS0 && (_rate) <= MGN_VHT3SS_MCS9) -#define IS_VHT4SS_RATE(_rate) ((_rate) >= MGN_VHT4SS_MCS0 && (_rate) <= MGN_VHT4SS_MCS9) - -#define IS_1T_RATE(_rate) (IS_CCK_RATE((_rate)) || IS_OFDM_RATE((_rate)) || IS_HT1SS_RATE((_rate)) || IS_VHT1SS_RATE((_rate))) -#define IS_2T_RATE(_rate) (IS_HT2SS_RATE((_rate)) || IS_VHT2SS_RATE((_rate))) -#define IS_3T_RATE(_rate) (IS_HT3SS_RATE((_rate)) || IS_VHT3SS_RATE((_rate))) -#define IS_4T_RATE(_rate) (IS_HT4SS_RATE((_rate)) || IS_VHT4SS_RATE((_rate))) - -const char *MGN_RATE_STR(enum MGN_RATE rate); - -typedef enum _RATE_SECTION { - CCK = 0, - OFDM = 1, - HT_MCS0_MCS7 = 2, - HT_MCS8_MCS15 = 3, - HT_MCS16_MCS23 = 4, - HT_MCS24_MCS31 = 5, - HT_1SS = HT_MCS0_MCS7, - HT_2SS = HT_MCS8_MCS15, - HT_3SS = HT_MCS16_MCS23, - HT_4SS = HT_MCS24_MCS31, - VHT_1SSMCS0_1SSMCS9 = 6, - VHT_2SSMCS0_2SSMCS9 = 7, - VHT_3SSMCS0_3SSMCS9 = 8, - VHT_4SSMCS0_4SSMCS9 = 9, - VHT_1SS = VHT_1SSMCS0_1SSMCS9, - VHT_2SS = VHT_2SSMCS0_2SSMCS9, - VHT_3SS = VHT_3SSMCS0_3SSMCS9, - VHT_4SS = VHT_4SSMCS0_4SSMCS9, - RATE_SECTION_NUM, -} RATE_SECTION; - -RATE_SECTION mgn_rate_to_rs(enum MGN_RATE rate); - -const char *rate_section_str(u8 section); - -#define IS_CCK_RATE_SECTION(section) ((section) == CCK) -#define IS_OFDM_RATE_SECTION(section) ((section) == OFDM) -#define IS_HT_RATE_SECTION(section) ((section) >= HT_1SS && (section) <= HT_4SS) -#define IS_VHT_RATE_SECTION(section) ((section) >= VHT_1SS && (section) <= VHT_4SS) - -#define IS_1T_RATE_SECTION(section) ((section) == CCK || (section) == OFDM || (section) == HT_1SS || (section) == VHT_1SS) -#define IS_2T_RATE_SECTION(section) ((section) == HT_2SS || (section) == VHT_2SS) -#define IS_3T_RATE_SECTION(section) ((section) == HT_3SS || (section) == VHT_3SS) -#define IS_4T_RATE_SECTION(section) ((section) == HT_4SS || (section) == VHT_4SS) - -extern u8 mgn_rates_cck[]; -extern u8 mgn_rates_ofdm[]; -extern u8 mgn_rates_mcs0_7[]; -extern u8 mgn_rates_mcs8_15[]; -extern u8 mgn_rates_mcs16_23[]; -extern u8 mgn_rates_mcs24_31[]; -extern u8 mgn_rates_vht1ss[]; -extern u8 mgn_rates_vht2ss[]; -extern u8 mgn_rates_vht3ss[]; -extern u8 mgn_rates_vht4ss[]; - -struct rate_section_ent { - u8 tx_num; /* value of RF_TX_NUM */ - u8 rate_num; - u8 *rates; -}; - -extern struct rate_section_ent rates_by_sections[]; - -#define rate_section_to_tx_num(section) (rates_by_sections[(section)].tx_num) -#define rate_section_rate_num(section) (rates_by_sections[(section)].rate_num) - -/* NOTE: This data is for statistical purposes; not all hardware provides this - * information for frames received. Not setting these will not cause - * any adverse affects. */ -struct ieee80211_rx_stats { - /* u32 mac_time[2]; */ - s8 rssi; - u8 signal; - u8 noise; - u8 received_channel; - u16 rate; /* in 100 kbps */ - /* u8 control; */ - u8 mask; - u8 freq; - u16 len; -}; - -/* IEEE 802.11 requires that STA supports concurrent reception of at least - * three fragmented frames. This define can be increased to support more - * concurrent frames, but it should be noted that each entry can consume about - * 2 kB of RAM and increasing cache size will slow down frame reassembly. */ -#define IEEE80211_FRAG_CACHE_LEN 4 - -struct ieee80211_frag_entry { - u32 first_frag_time; - uint seq; - uint last_frag; - uint qos; /* jackson */ - uint tid; /* jackson */ - struct sk_buff *skb; - u8 src_addr[ETH_ALEN]; - u8 dst_addr[ETH_ALEN]; -}; - -#ifndef PLATFORM_FREEBSD /* Baron BSD has already defined */ -struct ieee80211_stats { - uint tx_unicast_frames; - uint tx_multicast_frames; - uint tx_fragments; - uint tx_unicast_octets; - uint tx_multicast_octets; - uint tx_deferred_transmissions; - uint tx_single_retry_frames; - uint tx_multiple_retry_frames; - uint tx_retry_limit_exceeded; - uint tx_discards; - uint rx_unicast_frames; - uint rx_multicast_frames; - uint rx_fragments; - uint rx_unicast_octets; - uint rx_multicast_octets; - uint rx_fcs_errors; - uint rx_discards_no_buffer; - uint tx_discards_wrong_sa; - uint rx_discards_undecryptable; - uint rx_message_in_msg_fragments; - uint rx_message_in_bad_msg_fragments; -}; -#endif /* PLATFORM_FREEBSD */ -struct ieee80211_softmac_stats { - uint rx_ass_ok; - uint rx_ass_err; - uint rx_probe_rq; - uint tx_probe_rs; - uint tx_beacons; - uint rx_auth_rq; - uint rx_auth_rs_ok; - uint rx_auth_rs_err; - uint tx_auth_rq; - uint no_auth_rs; - uint no_ass_rs; - uint tx_ass_rq; - uint rx_ass_rq; - uint tx_probe_rq; - uint reassoc; - uint swtxstop; - uint swtxawake; -}; - -#define SEC_KEY_1 (1<<0) -#define SEC_KEY_2 (1<<1) -#define SEC_KEY_3 (1<<2) -#define SEC_KEY_4 (1<<3) -#define SEC_ACTIVE_KEY (1<<4) -#define SEC_AUTH_MODE (1<<5) -#define SEC_UNICAST_GROUP (1<<6) -#define SEC_LEVEL (1<<7) -#define SEC_ENABLED (1<<8) - -#define SEC_LEVEL_0 0 /* None */ -#define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ -#define SEC_LEVEL_2 2 /* Level 1 + TKIP */ -#define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */ -#define SEC_LEVEL_3 4 /* Level 2 + CCMP */ - -#define WEP_KEYS 4 -#define WEP_KEY_LEN 13 -#define BIP_MAX_KEYID 5 -#define BIP_AAD_SIZE 20 - -#if defined(PLATFORM_LINUX) -struct ieee80211_security { - u16 active_key:2, - enabled:1, - auth_mode:2, - auth_algo:4, - unicast_uses_group:1; - u8 key_sizes[WEP_KEYS]; - u8 keys[WEP_KEYS][WEP_KEY_LEN]; - u8 level; - u16 flags; -} __attribute__((packed)); - -#endif - -/* - - 802.11 data frame from AP - - ,-------------------------------------------------------------------. -Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | - |------|------|---------|---------|---------|------|---------|------| -Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | - | | tion | (BSSID) | | | ence | data | | - `-------------------------------------------------------------------' - -Total: 28-2340 bytes - -*/ - -struct ieee80211_header_data { - u16 frame_ctl; - u16 duration_id; - u8 addr1[6]; - u8 addr2[6]; - u8 addr3[6]; - u16 seq_ctrl; -}; - -#define BEACON_PROBE_SSID_ID_POSITION 12 - -/* Management Frame Information Element Types */ -#define MFIE_TYPE_SSID 0 -#define MFIE_TYPE_RATES 1 -#define MFIE_TYPE_FH_SET 2 -#define MFIE_TYPE_DS_SET 3 -#define MFIE_TYPE_CF_SET 4 -#define MFIE_TYPE_TIM 5 -#define MFIE_TYPE_IBSS_SET 6 -#define MFIE_TYPE_CHALLENGE 16 -#define MFIE_TYPE_ERP 42 -#define MFIE_TYPE_RSN 48 -#define MFIE_TYPE_RATES_EX 50 -#define MFIE_TYPE_GENERIC 221 - -#if defined(PLATFORM_LINUX) -struct ieee80211_info_element_hdr { - u8 id; - u8 len; -} __attribute__((packed)); - -struct ieee80211_info_element { - u8 id; - u8 len; - u8 data[0]; -} __attribute__((packed)); -#endif - - -/* - * These are the data types that can make up management packets - * - u16 auth_algorithm; - u16 auth_sequence; - u16 beacon_interval; - u16 capability; - u8 current_ap[ETH_ALEN]; - u16 listen_interval; - struct { - u16 association_id:14, reserved:2; - } __attribute__ ((packed)); - u32 time_stamp[2]; - u16 reason; - u16 status; -*/ - -#define IEEE80211_DEFAULT_TX_ESSID "Penguin" -#define IEEE80211_DEFAULT_BASIC_RATE 10 - - -#if defined(PLATFORM_LINUX) -struct ieee80211_authentication { - struct ieee80211_header_data header; - u16 algorithm; - u16 transaction; - u16 status; - /* struct ieee80211_info_element_hdr info_element; */ -} __attribute__((packed)); - - -struct ieee80211_probe_response { - struct ieee80211_header_data header; - u32 time_stamp[2]; - u16 beacon_interval; - u16 capability; - struct ieee80211_info_element info_element; -} __attribute__((packed)); - -struct ieee80211_probe_request { - struct ieee80211_header_data header; - /*struct ieee80211_info_element info_element;*/ -} __attribute__((packed)); - -struct ieee80211_assoc_request_frame { - struct rtw_ieee80211_hdr_3addr header; - u16 capability; - u16 listen_interval; - /* u8 current_ap[ETH_ALEN]; */ - struct ieee80211_info_element_hdr info_element; -} __attribute__((packed)); - -struct ieee80211_assoc_response_frame { - struct rtw_ieee80211_hdr_3addr header; - u16 capability; - u16 status; - u16 aid; - /* struct ieee80211_info_element info_element; supported rates */ -} __attribute__((packed)); -#endif - -struct ieee80211_txb { - u8 nr_frags; - u8 encrypted; - u16 reserved; - u16 frag_size; - u16 payload_size; - struct sk_buff *fragments[0]; -}; - - -/* SWEEP TABLE ENTRIES NUMBER*/ -#define MAX_SWEEP_TAB_ENTRIES 42 -#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 -/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs - * only use 8, and then use extended rates for the remaining supported - * rates. Other APs, however, stick all of their supported rates on the - * main rates information element... */ -#define MAX_RATES_LENGTH ((u8)12) -#define MAX_RATES_EX_LENGTH ((u8)16) -#define MAX_NETWORK_COUNT 128 -#define IEEE80211_SOFTMAC_SCAN_TIME 400 -/* (HZ / 2) */ -#define IEEE80211_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2) - -#define CRC_LENGTH 4U - -#define MAX_WPA_IE_LEN (256) -#define MAX_WPS_IE_LEN (512) -#define MAX_OWE_IE_LEN (128) -#define MAX_P2P_IE_LEN (256) -#define MAX_WFD_IE_LEN (128) - -#define NETWORK_EMPTY_ESSID (1<<0) -#define NETWORK_HAS_OFDM (1<<1) -#define NETWORK_HAS_CCK (1<<2) - -#define IEEE80211_DTIM_MBCAST 4 -#define IEEE80211_DTIM_UCAST 2 -#define IEEE80211_DTIM_VALID 1 -#define IEEE80211_DTIM_INVALID 0 - -#define IEEE80211_PS_DISABLED 0 -#define IEEE80211_PS_UNICAST IEEE80211_DTIM_UCAST -#define IEEE80211_PS_MBCAST IEEE80211_DTIM_MBCAST -#define IW_ESSID_MAX_SIZE 32 -#if 0 -struct ieee80211_network { - /* These entries are used to identify a unique network */ - u8 bssid[ETH_ALEN]; - u8 channel; - /* Ensure null-terminated for any debug msgs */ - u8 ssid[IW_ESSID_MAX_SIZE + 1]; - u8 ssid_len; - u8 rssi; /* relative signal strength */ - u8 sq; /* signal quality */ - - /* These are network statistics */ - /* struct ieee80211_rx_stats stats; */ - u16 capability; - u16 aid; - u8 rates[MAX_RATES_LENGTH]; - u8 rates_len; - u8 rates_ex[MAX_RATES_EX_LENGTH]; - u8 rates_ex_len; - - u8 edca_parmsets[18]; - - u8 mode; - u8 flags; - u8 time_stamp[8]; - u16 beacon_interval; - u16 listen_interval; - u16 atim_window; - u8 wpa_ie[MAX_WPA_IE_LEN]; - size_t wpa_ie_len; - u8 rsn_ie[MAX_WPA_IE_LEN]; - size_t rsn_ie_len; - u8 country[6]; - u8 dtim_period; - u8 dtim_data; - u8 power_constraint; - u8 qosinfo; - u8 qbssload[5]; - u8 network_type; - int join_res; - unsigned long last_scanned; -}; -#endif -/* -join_res: --1: authentication fail --2: association fail -> 0: TID -*/ - -#ifndef PLATFORM_FREEBSD /* Baron BSD has already defined */ - -enum ieee80211_state { - - /* the card is not linked at all */ - IEEE80211_NOLINK = 0, - - /* IEEE80211_ASSOCIATING* are for BSS client mode - * the driver shall not perform RX filtering unless - * the state is LINKED. - * The driver shall just check for the state LINKED and - * defaults to NOLINK for ALL the other states (including - * LINKED_SCANNING) - */ - - /* the association procedure will start (wq scheduling)*/ - IEEE80211_ASSOCIATING, - IEEE80211_ASSOCIATING_RETRY, - - /* the association procedure is sending AUTH request*/ - IEEE80211_ASSOCIATING_AUTHENTICATING, - - /* the association procedure has successfully authentcated - * and is sending association request - */ - IEEE80211_ASSOCIATING_AUTHENTICATED, - - /* the link is ok. the card associated to a BSS or linked - * to a ibss cell or acting as an AP and creating the bss - */ - IEEE80211_LINKED, - - /* same as LINKED, but the driver shall apply RX filter - * rules as we are in NO_LINK mode. As the card is still - * logically linked, but it is doing a syncro site survey - * then it will be back to LINKED state. - */ - IEEE80211_LINKED_SCANNING, - -}; -#endif /* PLATFORM_FREEBSD */ - -#define DEFAULT_MAX_SCAN_AGE (15 * HZ) -#define DEFAULT_FTS 2346 -#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" -#define MAC_ARG(x) ((u8 *)(x))[0], ((u8 *)(x))[1], ((u8 *)(x))[2], ((u8 *)(x))[3], ((u8 *)(x))[4], ((u8 *)(x))[5] -#define MAC_SFMT "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx" -#define MAC_SARG(x) ((u8*)(x)),((u8*)(x)) + 1,((u8*)(x)) + 2,((u8*)(x)) + 3,((u8*)(x)) + 4,((u8*)(x)) + 5 -#define IP_FMT "%d.%d.%d.%d" -#define IP_ARG(x) ((u8 *)(x))[0], ((u8 *)(x))[1], ((u8 *)(x))[2], ((u8 *)(x))[3] -#define PORT_FMT "%u" -#define PORT_ARG(x) ntohs(*((u16 *)(x))) - -#define is_multicast_mac_addr(Addr) ((((Addr[0]) & 0x01) == 0x01) && ((Addr[0]) != 0xff)) -#define is_broadcast_mac_addr(Addr) ((((Addr[0]) & 0xff) == 0xff) && (((Addr[1]) & 0xff) == 0xff) && \ - (((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \ - (((Addr[5]) & 0xff) == 0xff)) -#define is_zero_mac_addr(Addr) ((Addr[0] == 0x00) && (Addr[1] == 0x00) && (Addr[2] == 0x00) && \ - (Addr[3] == 0x00) && (Addr[4] == 0x00) && (Addr[5] == 0x00)) - - -#define CFG_IEEE80211_RESERVE_FCS (1<<0) -#define CFG_IEEE80211_COMPUTE_FCS (1<<1) - -typedef struct tx_pending_t { - int frag; - struct ieee80211_txb *txb; -} tx_pending_t; - - - -#define TID_NUM 16 - -#define IEEE_A (1<<0) -#define IEEE_B (1<<1) -#define IEEE_G (1<<2) -#define IEEE_MODE_MASK (IEEE_A | IEEE_B | IEEE_G) - -/* Baron move to ieee80211.c */ -int ieee80211_is_empty_essid(const char *essid, int essid_len); -int ieee80211_get_hdrlen(u16 fc); - -#if 0 - /* Action frame categories (IEEE 802.11-2007, 7.3.1.11, Table 7-24) */ - #define WLAN_ACTION_SPECTRUM_MGMT 0 - #define WLAN_ACTION_QOS 1 - #define WLAN_ACTION_DLS 2 - #define WLAN_ACTION_BLOCK_ACK 3 - #define WLAN_ACTION_RADIO_MEASUREMENT 5 - #define WLAN_ACTION_FT 6 - #define WLAN_ACTION_SA_QUERY 8 - #define WLAN_ACTION_WMM 17 -#endif - - -/* Action category code */ -enum rtw_ieee80211_category { - RTW_WLAN_CATEGORY_SPECTRUM_MGMT = 0, - RTW_WLAN_CATEGORY_QOS = 1, - RTW_WLAN_CATEGORY_DLS = 2, - RTW_WLAN_CATEGORY_BACK = 3, - RTW_WLAN_CATEGORY_PUBLIC = 4, /* IEEE 802.11 public action frames */ - RTW_WLAN_CATEGORY_RADIO_MEAS = 5, - RTW_WLAN_CATEGORY_FT = 6, - RTW_WLAN_CATEGORY_HT = 7, - RTW_WLAN_CATEGORY_SA_QUERY = 8, - RTW_WLAN_CATEGORY_WNM = 10, - RTW_WLAN_CATEGORY_UNPROTECTED_WNM = 11, /* add for CONFIG_IEEE80211W, none 11w also can use */ - RTW_WLAN_CATEGORY_TDLS = 12, - RTW_WLAN_CATEGORY_MESH = 13, - RTW_WLAN_CATEGORY_MULTIHOP = 14, - RTW_WLAN_CATEGORY_SELF_PROTECTED = 15, - RTW_WLAN_CATEGORY_WMM = 17, - RTW_WLAN_CATEGORY_VHT = 21, -#ifdef CONFIG_RTW_TOKEN_BASED_XMIT - RTW_WLAN_CATEGORY_TBTX = 25, -#endif - RTW_WLAN_CATEGORY_P2P = 0x7f,/* P2P action frames */ -}; - -#define CATEGORY_IS_GROUP_PRIVACY(cat) \ - (cat == RTW_WLAN_CATEGORY_MESH || cat == RTW_WLAN_CATEGORY_MULTIHOP) - -#define CATEGORY_IS_NON_ROBUST(cat) \ - (cat == RTW_WLAN_CATEGORY_PUBLIC \ - || cat == RTW_WLAN_CATEGORY_HT \ - || cat == RTW_WLAN_CATEGORY_UNPROTECTED_WNM \ - || cat == RTW_WLAN_CATEGORY_SELF_PROTECTED \ - || cat == RTW_WLAN_CATEGORY_VHT \ - || cat == RTW_WLAN_CATEGORY_P2P) - -#define CATEGORY_IS_ROBUST(cat) !CATEGORY_IS_NON_ROBUST(cat) - -/* SPECTRUM_MGMT action code */ -enum rtw_ieee80211_spectrum_mgmt_actioncode { - RTW_WLAN_ACTION_SPCT_MSR_REQ = 0, - RTW_WLAN_ACTION_SPCT_MSR_RPRT = 1, - RTW_WLAN_ACTION_SPCT_TPC_REQ = 2, - RTW_WLAN_ACTION_SPCT_TPC_RPRT = 3, - RTW_WLAN_ACTION_SPCT_CHL_SWITCH = 4, - RTW_WLAN_ACTION_SPCT_EXT_CHL_SWITCH = 5, -}; - -/* SELF_PROTECTED action code */ -enum rtw_ieee80211_self_protected_actioncode { - RTW_ACT_SELF_PROTECTED_RSVD = 0, - RTW_ACT_SELF_PROTECTED_MESH_OPEN = 1, - RTW_ACT_SELF_PROTECTED_MESH_CONF = 2, - RTW_ACT_SELF_PROTECTED_MESH_CLOSE = 3, - RTW_ACT_SELF_PROTECTED_MESH_GK_INFORM = 4, - RTW_ACT_SELF_PROTECTED_MESH_GK_ACK = 5, - RTW_ACT_SELF_PROTECTED_NUM, -}; - -/* MESH action code */ -enum rtw_ieee80211_mesh_actioncode { - RTW_ACT_MESH_LINK_METRIC_REPORT, - RTW_ACT_MESH_HWMP_PATH_SELECTION, - RTW_ACT_MESH_GATE_ANNOUNCEMENT, - RTW_ACT_MESH_CONGESTION_CONTROL_NOTIFICATION, - RTW_ACT_MESH_MCCA_SETUP_REQUEST, - RTW_ACT_MESH_MCCA_SETUP_REPLY, - RTW_ACT_MESH_MCCA_ADVERTISEMENT_REQUEST, - RTW_ACT_MESH_MCCA_ADVERTISEMENT, - RTW_ACT_MESH_MCCA_TEARDOWN, - RTW_ACT_MESH_TBTT_ADJUSTMENT_REQUEST, - RTW_ACT_MESH_TBTT_ADJUSTMENT_RESPONSE, -}; - -enum _PUBLIC_ACTION { - ACT_PUBLIC_BSSCOEXIST = 0, /* 20/40 BSS Coexistence */ - ACT_PUBLIC_DSE_ENABLE = 1, - ACT_PUBLIC_DSE_DEENABLE = 2, - ACT_PUBLIC_DSE_REG_LOCATION = 3, - ACT_PUBLIC_EXT_CHL_SWITCH = 4, - ACT_PUBLIC_DSE_MSR_REQ = 5, - ACT_PUBLIC_DSE_MSR_RPRT = 6, - ACT_PUBLIC_MP = 7, /* Measurement Pilot */ - ACT_PUBLIC_DSE_PWR_CONSTRAINT = 8, - ACT_PUBLIC_VENDOR = 9, /* for WIFI_DIRECT */ - ACT_PUBLIC_GAS_INITIAL_REQ = 10, - ACT_PUBLIC_GAS_INITIAL_RSP = 11, - ACT_PUBLIC_GAS_COMEBACK_REQ = 12, - ACT_PUBLIC_GAS_COMEBACK_RSP = 13, - ACT_PUBLIC_TDLS_DISCOVERY_RSP = 14, - ACT_PUBLIC_LOCATION_TRACK = 15, - ACT_PUBLIC_QAB_REQ, - ACT_PUBLIC_QAB_RSP, - ACT_PUBLIC_QMF_POLICY, - ACT_PUBLIC_QMF_POLICY_CHANGE, - ACT_PUBLIC_QLOAD_REQ, - ACT_PUBLIC_QLOAD_REPORT, - ACT_PUBLIC_HCCA_TXOP_ADV, - ACT_PUBLIC_HCCA_TXOP_RSP, - ACT_PUBLIC_PUBLIC_KEY, - ACT_PUBLIC_CH_AVAILABILITY_QUERY, - ACT_PUBLIC_CH_SCHEDULE_MGMT, - ACT_PUBLIC_CONTACT_VERI_SIGNAL, - ACT_PUBLIC_GDD_ENABLE_REQ, - ACT_PUBLIC_GDD_ENABLE_RSP, - ACT_PUBLIC_NETWORK_CH_CONTROL, - ACT_PUBLIC_WHITE_SPACE_MAP_ANN, - ACT_PUBLIC_FTM_REQ, - ACT_PUBLIC_FTM, - ACT_PUBLIC_MAX -}; - -#ifdef CONFIG_TDLS -enum TDLS_ACTION_FIELD { - TDLS_SETUP_REQUEST = 0, - TDLS_SETUP_RESPONSE = 1, - TDLS_SETUP_CONFIRM = 2, - TDLS_TEARDOWN = 3, - TDLS_PEER_TRAFFIC_INDICATION = 4, - TDLS_CHANNEL_SWITCH_REQUEST = 5, - TDLS_CHANNEL_SWITCH_RESPONSE = 6, - TDLS_PEER_PSM_REQUEST = 7, - TDLS_PEER_PSM_RESPONSE = 8, - TDLS_PEER_TRAFFIC_RESPONSE = 9, - TDLS_DISCOVERY_REQUEST = 10, - TDLS_DISCOVERY_RESPONSE = 14, /* it's used in public action frame */ -}; - -#define TUNNELED_PROBE_REQ 15 -#define TUNNELED_PROBE_RSP 16 -#endif /* CONFIG_TDLS */ - -/* BACK action code */ -enum rtw_ieee80211_back_actioncode { - RTW_WLAN_ACTION_ADDBA_REQ = 0, - RTW_WLAN_ACTION_ADDBA_RESP = 1, - RTW_WLAN_ACTION_DELBA = 2, -}; - -/* HT features action code */ -enum rtw_ieee80211_ht_actioncode { - RTW_WLAN_ACTION_HT_NOTI_CHNL_WIDTH = 0, - RTW_WLAN_ACTION_HT_SM_PS = 1, - RTW_WLAN_ACTION_HT_PSMP = 2, - RTW_WLAN_ACTION_HT_SET_PCO_PHASE = 3, - RTW_WLAN_ACTION_HT_CSI = 4, - RTW_WLAN_ACTION_HT_NON_COMPRESS_BEAMFORMING = 5, - RTW_WLAN_ACTION_HT_COMPRESS_BEAMFORMING = 6, - RTW_WLAN_ACTION_HT_ASEL_FEEDBACK = 7, -}; - -/* BACK (block-ack) parties */ -enum rtw_ieee80211_back_parties { - RTW_WLAN_BACK_RECIPIENT = 0, - RTW_WLAN_BACK_INITIATOR = 1, - RTW_WLAN_BACK_TIMER = 2, -}; - -/*20/40 BSS Coexistence element */ -#define RTW_WLAN_20_40_BSS_COEX_INFO_REQ BIT(0) -#define RTW_WLAN_20_40_BSS_COEX_40MHZ_INTOL BIT(1) -#define RTW_WLAN_20_40_BSS_COEX_20MHZ_WIDTH_REQ BIT(2) -#define RTW_WLAN_20_40_BSS_COEX_OBSS_EXEMPT_REQ BIT(3) -#define RTW_WLAN_20_40_BSS_COEX_OBSS_EXEMPT_GRNT BIT(4) - -/* VHT features action code */ -enum rtw_ieee80211_vht_actioncode { - RTW_WLAN_ACTION_VHT_COMPRESSED_BEAMFORMING = 0, - RTW_WLAN_ACTION_VHT_GROUPID_MANAGEMENT = 1, - RTW_WLAN_ACTION_VHT_OPMODE_NOTIFICATION = 2, -}; - -#define OUI_MICROSOFT 0x0050f2 /* Microsoft (also used in Wi-Fi specs) - * 00:50:F2 */ -#ifndef PLATFORM_FREEBSD /* Baron BSD has defined */ - #define WME_OUI_TYPE 2 -#endif /* PLATFORM_FREEBSD */ -#define WME_OUI_SUBTYPE_INFORMATION_ELEMENT 0 -#define WME_OUI_SUBTYPE_PARAMETER_ELEMENT 1 -#define WME_OUI_SUBTYPE_TSPEC_ELEMENT 2 -#define WME_VERSION 1 - -#define WME_ACTION_CODE_SETUP_REQUEST 0 -#define WME_ACTION_CODE_SETUP_RESPONSE 1 -#define WME_ACTION_CODE_TEARDOWN 2 - -#define WME_SETUP_RESPONSE_STATUS_ADMISSION_ACCEPTED 0 -#define WME_SETUP_RESPONSE_STATUS_INVALID_PARAMETERS 1 -#define WME_SETUP_RESPONSE_STATUS_REFUSED 3 - -#define WME_TSPEC_DIRECTION_UPLINK 0 -#define WME_TSPEC_DIRECTION_DOWNLINK 1 -#define WME_TSPEC_DIRECTION_BI_DIRECTIONAL 3 - - -#define OUI_BROADCOM 0x00904c /* Broadcom (Epigram) */ - -#ifdef CONFIG_RTW_TOKEN_BASED_XMIT -#define OUI_REALTEK 0x00e04c /* Realtek */ -#endif -#define VENDOR_HT_CAPAB_OUI_TYPE 0x33 /* 00-90-4c:0x33 */ - -enum rtw_ieee80211_rann_flags { - RTW_RANN_FLAG_IS_GATE = 1 << 0, -}; - -/** - * enum rtw_ieee80211_preq_flags - mesh PREQ element flags - * - * @RTW_IEEE80211_PREQ_IS_GATE_FLAG: Gate Announcement subfield - * @RTW_IEEE80211_PREQ_PROACTIVE_PREP_FLAG: proactive PREP subfield - */ -enum rtw_ieee80211_preq_flags { - RTW_IEEE80211_PREQ_IS_GATE_FLAG = 1 << 0, - RTW_IEEE80211_PREQ_PROACTIVE_PREP_FLAG = 1 << 2, -}; - -/** - * enum rtw_ieee80211_preq_target_flags - mesh PREQ element per target flags - * - * @RTW_IEEE80211_PREQ_TO_FLAG: target only subfield - * @RTW_IEEE80211_PREQ_USN_FLAG: unknown target HWMP sequence number subfield - */ -enum rtw_ieee80211_preq_target_flags { - RTW_IEEE80211_PREQ_TO_FLAG = 1<<0, - RTW_IEEE80211_PREQ_USN_FLAG = 1<<2, -}; - -/** - * enum rtw_ieee80211_root_mode_identifier - root mesh STA mode identifier - * - * These attribute are used by dot11MeshHWMPRootMode to set root mesh STA mode - * - * @RTW_IEEE80211_ROOTMODE_NO_ROOT: the mesh STA is not a root mesh STA (default) - * @RTW_IEEE80211_ROOTMODE_ROOT: the mesh STA is a root mesh STA if greater than - * this value - * @RTW_IEEE80211_PROACTIVE_PREQ_NO_PREP: the mesh STA is a root mesh STA supports - * the proactive PREQ with proactive PREP subfield set to 0 - * @RTW_IEEE80211_PROACTIVE_PREQ_WITH_PREP: the mesh STA is a root mesh STA - * supports the proactive PREQ with proactive PREP subfield set to 1 - * @RTW_IEEE80211_PROACTIVE_RANN: the mesh STA is a root mesh STA supports - * the proactive RANN - */ -enum rtw_ieee80211_root_mode_identifier { - RTW_IEEE80211_ROOTMODE_NO_ROOT = 0, - RTW_IEEE80211_ROOTMODE_ROOT = 1, - RTW_IEEE80211_PROACTIVE_PREQ_NO_PREP = 2, - RTW_IEEE80211_PROACTIVE_PREQ_WITH_PREP = 3, - RTW_IEEE80211_PROACTIVE_RANN = 4, -}; - -/** - * enum rtw_ieee80211_channel_flags - channel flags - * - * Channel flags set by the regulatory control code. - * - * @RTW_IEEE80211_CHAN_DISABLED: This channel is disabled. - * @RTW_IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted - * on this channel. - * @RTW_IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel. - * @RTW_IEEE80211_CHAN_RADAR: Radar detection is required on this channel. - * @RTW_IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel - * is not permitted. - * @RTW_IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel - * is not permitted. - */ -enum rtw_ieee80211_channel_flags { - RTW_IEEE80211_CHAN_DISABLED = 1 << 0, - RTW_IEEE80211_CHAN_PASSIVE_SCAN = 1 << 1, - RTW_IEEE80211_CHAN_NO_IBSS = 1 << 2, - RTW_IEEE80211_CHAN_RADAR = 1 << 3, - RTW_IEEE80211_CHAN_NO_HT40PLUS = 1 << 4, - RTW_IEEE80211_CHAN_NO_HT40MINUS = 1 << 5, -}; - -#define RTW_IEEE80211_CHAN_NO_HT40 \ - (RTW_IEEE80211_CHAN_NO_HT40PLUS | RTW_IEEE80211_CHAN_NO_HT40MINUS) - -/* Represent channel details, subset of ieee80211_channel */ -struct rtw_ieee80211_channel { - /* enum ieee80211_band band; */ - /* u16 center_freq; */ - u16 hw_value; - u32 flags; - /* int max_antenna_gain; */ - /* int max_power; */ - /* int max_reg_power; */ - /* bool beacon_found; */ - /* u32 orig_flags; */ - /* int orig_mag; */ - /* int orig_mpwr; */ -}; - -#define CHAN_FMT \ - /*"band:%d, "*/ \ - /*"center_freq:%u, "*/ \ - "hw_value:%u, " \ - "flags:0x%08x" \ - /*"max_antenna_gain:%d\n"*/ \ - /*"max_power:%d\n"*/ \ - /*"max_reg_power:%d\n"*/ \ - /*"beacon_found:%u\n"*/ \ - /*"orig_flags:0x%08x\n"*/ \ - /*"orig_mag:%d\n"*/ \ - /*"orig_mpwr:%d\n"*/ - -#define CHAN_ARG(channel) \ - /*(channel)->band*/ \ - /*, (channel)->center_freq*/ \ - (channel)->hw_value \ - , (channel)->flags \ - /*, (channel)->max_antenna_gain*/ \ - /*, (channel)->max_power*/ \ - /*, (channel)->max_reg_power*/ \ - /*, (channel)->beacon_found*/ \ - /*, (channel)->orig_flags*/ \ - /*, (channel)->orig_mag*/ \ - /*, (channel)->orig_mpwr*/ \ - -/* Parsed Information Elements */ -struct rtw_ieee802_11_elems { - u8 *ssid; - u8 ssid_len; - u8 *supp_rates; - u8 supp_rates_len; - u8 *fh_params; - u8 fh_params_len; - u8 *ds_params; - u8 ds_params_len; - u8 *cf_params; - u8 cf_params_len; - u8 *tim; - u8 tim_len; - u8 *ibss_params; - u8 ibss_params_len; - u8 *challenge; - u8 challenge_len; - u8 *erp_info; - u8 erp_info_len; - u8 *ext_supp_rates; - u8 ext_supp_rates_len; - u8 *wpa_ie; - u8 wpa_ie_len; - u8 *rsn_ie; - u8 rsn_ie_len; - u8 *wme; - u8 wme_len; - u8 *wme_tspec; - u8 wme_tspec_len; - u8 *wps_ie; - u8 wps_ie_len; - u8 *power_cap; - u8 power_cap_len; - u8 *supp_channels; - u8 supp_channels_len; - u8 *mdie; - u8 mdie_len; - u8 *ftie; - u8 ftie_len; - u8 *timeout_int; - u8 timeout_int_len; - u8 *ht_capabilities; - u8 ht_capabilities_len; - u8 *ht_operation; - u8 ht_operation_len; - u8 *vendor_ht_cap; - u8 vendor_ht_cap_len; - u8 *vht_capabilities; - u8 vht_capabilities_len; - u8 *vht_operation; - u8 vht_operation_len; - u8 *vht_op_mode_notify; - u8 vht_op_mode_notify_len; - u8 *rm_en_cap; - u8 rm_en_cap_len; -#ifdef CONFIG_RTW_MESH - u8 *preq; - u8 preq_len; - u8 *prep; - u8 prep_len; - u8 *perr; - u8 perr_len; - u8 *rann; - u8 rann_len; -#endif -#ifdef CONFIG_RTW_TOKEN_BASED_XMIT - u8 *tbtx_cap; - u8 tbtx_cap_len; -#endif -}; - -typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes; - -ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len, - struct rtw_ieee802_11_elems *elems, - int show_errors); - -u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len, unsigned char *source, unsigned int *frlen); -u8 *rtw_set_ie(u8 *pbuf, sint index, uint len, const u8 *source, uint *frlen); - -enum secondary_ch_offset { - SCN = 0, /* no secondary channel */ - SCA = 1, /* secondary channel above */ - SCB = 3, /* secondary channel below */ -}; -u8 secondary_ch_offset_to_hal_ch_offset(u8 ch_offset); -u8 hal_ch_offset_to_secondary_ch_offset(u8 ch_offset); -u8 *rtw_set_ie_ch_switch(u8 *buf, u32 *buf_len, u8 ch_switch_mode, u8 new_ch, u8 ch_switch_cnt); -u8 *rtw_set_ie_secondary_ch_offset(u8 *buf, u32 *buf_len, u8 secondary_ch_offset); -u8 *rtw_set_ie_mesh_ch_switch_parm(u8 *buf, u32 *buf_len, u8 ttl, u8 flags, u16 reason, u16 precedence); - -u8 *rtw_get_ie(const u8 *pbuf, sint index, sint *len, sint limit); -u8 rtw_update_rate_bymode(WLAN_BSSID_EX *pbss_network, u32 mode); - -u8 *rtw_get_ie_ex(const u8 *in_ie, uint in_len, u8 eid, const u8 *oui, u8 oui_len, u8 *ie, uint *ielen); -int rtw_ies_remove_ie(u8 *ies, uint *ies_len, uint offset, u8 eid, u8 *oui, u8 oui_len); - -void rtw_set_supported_rate(u8 *SupportedRates, uint mode) ; - -#define GET_RSN_CAP_MFP_OPTION(cap) LE_BITS_TO_2BYTE(((u8 *)(cap)), 6, 2) - -#define MFP_NO 0 -#define MFP_INVALID 1 -#define MFP_OPTIONAL 2 -#define MFP_REQUIRED 3 - -struct rsne_info { - u8 *gcs; - u16 pcs_cnt; - u8 *pcs_list; - u16 akm_cnt; - u8 *akm_list; - u8 *cap; - u16 pmkid_cnt; - u8 *pmkid_list; - u8 *gmcs; - - u8 err; -}; -int rtw_rsne_info_parse(const u8 *ie, uint ie_len, struct rsne_info *info); - -unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit); -unsigned char *rtw_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len, int limit); -int rtw_get_wpa_cipher_suite(u8 *s); -int rtw_get_rsn_cipher_suite(u8 *s); -int rtw_get_wapi_ie(u8 *in_ie, uint in_len, u8 *wapi_ie, u16 *wapi_len); -int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwise_cipher, u32 *akm); -int rtw_parse_wpa2_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwise_cipher, int *gmcs, u32 *akm, u8 *mfp_opt); - -int rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 *wpa_ie, u16 *wpa_len); - -u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen); -u8 *rtw_get_wps_ie_from_scan_queue(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen, enum bss_type frame_type); -u8 *rtw_get_wps_ie(const u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen); -u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id , u8 *buf_attr, u32 *len_attr); -u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id , u8 *buf_content, uint *len_content); - -u8 *rtw_get_owe_ie(const u8 *in_ie, uint in_len, u8 *owe_ie, uint *owe_ielen); - -/** - * for_each_ie - iterate over continuous IEs - * @ie: - * @buf: - * @buf_len: - */ -#define for_each_ie(ie, buf, buf_len) \ - for (ie = (void *)buf; (((u8 *)ie) - ((u8 *)buf) + 1) < buf_len; ie = (void *)(((u8 *)ie) + *(((u8 *)ie)+1) + 2)) - -void dump_ies(void *sel, const u8 *buf, u32 buf_len); -#ifdef CONFIG_RTW_DEBUG - -#ifdef CONFIG_80211N_HT -#define HT_SC_OFFSET_MAX 4 -extern const char *const _ht_sc_offset_str[]; -#define ht_sc_offset_str(sc) (((sc) >= HT_SC_OFFSET_MAX) ? _ht_sc_offset_str[2] : _ht_sc_offset_str[(sc)]) - -void dump_ht_cap_ie_content(void *sel, const u8 *buf, u32 buf_len); -#endif - -void dump_wps_ie(void *sel, const u8 *ie, u32 ie_len); -#endif /* CONFIG_RTW_DEBUG */ - -void rtw_ies_get_chbw(u8 *ies, int ies_len, u8 *ch, u8 *bw, u8 *offset, u8 ht, u8 vht); - -void rtw_bss_get_chbw(WLAN_BSSID_EX *bss, u8 *ch, u8 *bw, u8 *offset, u8 ht, u8 vht); - -bool rtw_is_chbw_grouped(u8 ch_a, u8 bw_a, u8 offset_a - , u8 ch_b, u8 bw_b, u8 offset_b); -void rtw_sync_chbw(u8 *req_ch, u8 *req_bw, u8 *req_offset - , u8 *g_ch, u8 *g_bw, u8 *g_offset); - -#ifdef CONFIG_P2P -u32 rtw_get_p2p_merged_ies_len(u8 *in_ie, u32 in_len); -int rtw_p2p_merge_ies(u8 *in_ie, u32 in_len, u8 *merge_ie); -#ifdef CONFIG_RTW_DEBUG -void dump_p2p_ie(void *sel, const u8 *ie, u32 ie_len); -#endif -u8 *rtw_get_p2p_ie(const u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen); -u8 *rtw_get_p2p_attr(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id, u8 *buf_attr, u32 *len_attr); -u8 *rtw_get_p2p_attr_content(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id, u8 *buf_content, uint *len_content); -u32 rtw_set_p2p_attr_content(u8 *pbuf, u8 attr_id, u16 attr_len, u8 *pdata_attr); -uint rtw_del_p2p_ie(u8 *ies, uint ies_len_ori, const char *msg); -uint rtw_del_p2p_attr(u8 *ie, uint ielen_ori, u8 attr_id); -u8 *rtw_bss_ex_get_p2p_ie(WLAN_BSSID_EX *bss_ex, u8 *p2p_ie, uint *p2p_ielen); -void rtw_bss_ex_del_p2p_ie(WLAN_BSSID_EX *bss_ex); -void rtw_bss_ex_del_p2p_attr(WLAN_BSSID_EX *bss_ex, u8 attr_id); -#endif /* CONFIG_P2P */ - -uint rtw_del_wfd_ie(u8 *ies, uint ies_len_ori, const char *msg); -void rtw_bss_ex_del_wfd_ie(WLAN_BSSID_EX *bss_ex); -#ifdef CONFIG_WFD -#ifdef CONFIG_RTW_DEBUG -void dump_wfd_ie(void *sel, const u8 *ie, u32 ie_len); -#endif -u8 *rtw_get_wfd_ie(const u8 *in_ie, int in_len, u8 *wfd_ie, uint *wfd_ielen); -u8 *rtw_get_wfd_attr(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id, u8 *buf_attr, u32 *len_attr); -u8 *rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id, u8 *buf_content, uint *len_content); -uint rtw_del_wfd_attr(u8 *ie, uint ielen_ori, u8 attr_id); -u8 *rtw_bss_ex_get_wfd_ie(WLAN_BSSID_EX *bss_ex, u8 *wfd_ie, uint *wfd_ielen); -void rtw_bss_ex_del_wfd_attr(WLAN_BSSID_EX *bss_ex, u8 attr_id); -#endif - -#define MULTI_AP_SUB_ELEM_TYPE 0x06 -#define MULTI_AP_TEAR_DOWN BIT(4) -#define MULTI_AP_FRONTHAUL_BSS BIT(5) -#define MULTI_AP_BACKHAUL_BSS BIT(6) -#define MULTI_AP_BACKHAUL_STA BIT(7) -#ifdef CONFIG_RTW_MULTI_AP -void dump_multi_ap_ie(void *sel, const u8 *ie, u32 ie_len); -u8 rtw_get_multi_ap_ie_ext(const u8 *ies, int ies_len); -u8 *rtw_set_multi_ap_ie_ext(u8 *pbuf, uint *frlen, u8 val); -#endif - -uint rtw_get_rateset_len(u8 *rateset); - -struct registry_priv; -int rtw_generate_ie(struct registry_priv *pregistrypriv); - -int rtw_get_bit_value_from_ieee_value(u8 val); - -uint rtw_is_cckrates_included(u8 *rate); - -uint rtw_is_cckratesonly_included(u8 *rate); -uint rtw_get_cckrate_size(u8 *rate,u32 rate_length); -int rtw_check_network_type(unsigned char *rate, int ratelen, int channel); - -u8 rtw_check_invalid_mac_address(u8 *mac_addr, u8 check_local_bit); -void rtw_macaddr_cfg(u8 *out, const u8 *hw_mac_addr); - -u16 rtw_ht_mcs_rate(u8 bw_40MHz, u8 short_GI, unsigned char *MCS_rate); -u8 rtw_ht_mcsset_to_nss(u8 *supp_mcs_set); -u32 rtw_ht_mcs_set_to_bitmap(u8 *mcs_set, u8 nss); - -int rtw_action_frame_parse(const u8 *frame, u32 frame_len, u8 *category, u8 *action); -const char *action_public_str(u8 action); - -u8 key_2char2num(u8 hch, u8 lch); -u8 str_2char2num(u8 hch, u8 lch); -void macstr2num(u8 *dst, u8 *src); -u8 convert_ip_addr(u8 hch, u8 mch, u8 lch); -int wifirate2_ratetbl_inx(unsigned char rate); - - -#endif /* IEEE80211_H */ diff --git a/include/osdep_service_linux.h b/include/osdep_service_linux.h old mode 100755 new mode 100644 diff --git a/include/rtl8723b_hal.h b/include/rtl8723b_hal.h old mode 100755 new mode 100644 diff --git a/include/rtl8723b_led.h b/include/rtl8723b_led.h old mode 100755 new mode 100644 diff --git a/include/rtl8723b_recv.h b/include/rtl8723b_recv.h old mode 100755 new mode 100644 diff --git a/include/rtl8723b_spec.h b/include/rtl8723b_spec.h old mode 100755 new mode 100644 diff --git a/include/rtl8723b_xmit.h b/include/rtl8723b_xmit.h old mode 100755 new mode 100644 diff --git a/include/rtl8814a_cmd.h b/include/rtl8814a_cmd.h old mode 100755 new mode 100644 diff --git a/include/rtl8814a_hal.h b/include/rtl8814a_hal.h old mode 100755 new mode 100644 diff --git a/include/rtl8814a_recv.h b/include/rtl8814a_recv.h old mode 100755 new mode 100644 diff --git a/include/rtl8814a_spec.h b/include/rtl8814a_spec.h old mode 100755 new mode 100644 diff --git a/include/rtl8814a_xmit.h b/include/rtl8814a_xmit.h old mode 100755 new mode 100644 diff --git a/include/rtl8814b_hal.h b/include/rtl8814b_hal.h old mode 100755 new mode 100644 diff --git a/include/rtl8814bu_hal.h b/include/rtl8814bu_hal.h old mode 100755 new mode 100644 diff --git a/include/rtl8821ce_hal.h b/include/rtl8821ce_hal.h old mode 100755 new mode 100644 diff --git a/include/rtl8822be_hal.h b/include/rtl8822be_hal.h old mode 100755 new mode 100644 diff --git a/include/rtl8822c_hal.h b/include/rtl8822c_hal.h old mode 100755 new mode 100644 diff --git a/include/rtl8822ce_hal.h b/include/rtl8822ce_hal.h old mode 100755 new mode 100644 diff --git a/include/rtl8822cs_hal.h b/include/rtl8822cs_hal.h old mode 100755 new mode 100644 diff --git a/include/rtl8822cu_hal.h b/include/rtl8822cu_hal.h old mode 100755 new mode 100644 diff --git a/include/rtw_debug.h b/include/rtw_debug.h old mode 100755 new mode 100644 diff --git a/include/rtw_ft.h b/include/rtw_ft.h old mode 100755 new mode 100644 diff --git a/include/rtw_mbo.h b/include/rtw_mbo.h old mode 100755 new mode 100644 diff --git a/include/rtw_mlme.h b/include/rtw_mlme.h old mode 100755 new mode 100644 diff --git a/include/rtw_mlme_ext.h b/include/rtw_mlme_ext.h old mode 100755 new mode 100644 diff --git a/include/rtw_mlme_ext.h.orig b/include/rtw_mlme_ext.h.orig deleted file mode 100755 index dff0f11..0000000 --- a/include/rtw_mlme_ext.h.orig +++ /dev/null @@ -1,1225 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2019 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - *****************************************************************************/ -#ifndef __RTW_MLME_EXT_H_ -#define __RTW_MLME_EXT_H_ - - -/* Commented by Albert 20101105 - * Increase the SURVEY_TO value from 100 to 150 ( 100ms to 150ms ) - * The Realtek 8188CE SoftAP will spend around 100ms to send the probe response after receiving the probe request. - * So, this driver tried to extend the dwell time for each scanning channel. - * This will increase the chance to receive the probe response from SoftAP. */ -#define SURVEY_TO (100) - -#define REAUTH_TO (300) /* (50) */ -#define REASSOC_TO (300) /* (50) */ -/* #define DISCONNECT_TO (3000) */ -#define ADDBA_TO (2000) - -#define LINKED_TO (1) /* unit:2 sec, 1x2 = 2 sec */ - -#define REAUTH_LIMIT (4) -#define REASSOC_LIMIT (4) -#define READDBA_LIMIT (2) - -#ifdef CONFIG_GSPI_HCI - #define ROAMING_LIMIT 5 -#else - #define ROAMING_LIMIT 8 -#endif - -/*net_type, pmlmeinfo->state*/ -#define _HW_STATE_NOLINK_ 0x00 -#define _HW_STATE_ADHOC_ 0x01 -#define _HW_STATE_STATION_ 0x02 -#define _HW_STATE_AP_ 0x03 -#define _HW_STATE_MONITOR_ 0x04 - -#define WIFI_FW_NULL_STATE _HW_STATE_NOLINK_ -#define WIFI_FW_STATION_STATE _HW_STATE_STATION_ -#define WIFI_FW_AP_STATE _HW_STATE_AP_ -#define WIFI_FW_ADHOC_STATE _HW_STATE_ADHOC_ - -#define WIFI_FW_PRE_LINK 0x00000800 -#define WIFI_FW_AUTH_NULL 0x00000100 -#define WIFI_FW_AUTH_STATE 0x00000200 -#define WIFI_FW_AUTH_SUCCESS 0x00000400 - -#define WIFI_FW_ASSOC_STATE 0x00002000 -#define WIFI_FW_ASSOC_SUCCESS 0x00004000 - -#define WIFI_FW_LINKING_STATE (WIFI_FW_AUTH_NULL | WIFI_FW_AUTH_STATE | WIFI_FW_AUTH_SUCCESS | WIFI_FW_ASSOC_STATE) - - -#define _1M_RATE_ 0 -#define _2M_RATE_ 1 -#define _5M_RATE_ 2 -#define _11M_RATE_ 3 -#define _6M_RATE_ 4 -#define _9M_RATE_ 5 -#define _12M_RATE_ 6 -#define _18M_RATE_ 7 -#define _24M_RATE_ 8 -#define _36M_RATE_ 9 -#define _48M_RATE_ 10 -#define _54M_RATE_ 11 - -/******************************************************** -MCS rate definitions -*********************************************************/ -#define MCS_RATE_1R (0x000000ff) -#define MCS_RATE_2R (0x0000ffff) -#define MCS_RATE_3R (0x00ffffff) -#define MCS_RATE_4R (0xffffffff) -#define MCS_RATE_2R_13TO15_OFF (0x00001fff) - - -extern unsigned char RTW_WPA_OUI[]; -extern unsigned char WMM_OUI[]; -extern unsigned char WPS_OUI[]; -extern unsigned char WFD_OUI[]; -extern unsigned char P2P_OUI[]; -extern unsigned char MULTI_AP_OUI[]; - -extern unsigned char WMM_INFO_OUI[]; -extern unsigned char WMM_PARA_OUI[]; - -typedef struct _RT_CHANNEL_PLAN { - unsigned char Channel[MAX_CHANNEL_NUM]; - unsigned char Len; -} RT_CHANNEL_PLAN, *PRT_CHANNEL_PLAN; - -typedef enum _HT_IOT_PEER { - HT_IOT_PEER_UNKNOWN = 0, - HT_IOT_PEER_REALTEK = 1, - HT_IOT_PEER_REALTEK_92SE = 2, - HT_IOT_PEER_BROADCOM = 3, - HT_IOT_PEER_RALINK = 4, - HT_IOT_PEER_ATHEROS = 5, - HT_IOT_PEER_CISCO = 6, - HT_IOT_PEER_MERU = 7, - HT_IOT_PEER_MARVELL = 8, - HT_IOT_PEER_REALTEK_SOFTAP = 9,/* peer is RealTek SOFT_AP, by Bohn, 2009.12.17 */ - HT_IOT_PEER_SELF_SOFTAP = 10, /* Self is SoftAP */ - HT_IOT_PEER_AIRGO = 11, - HT_IOT_PEER_INTEL = 12, - HT_IOT_PEER_RTK_APCLIENT = 13, - HT_IOT_PEER_REALTEK_81XX = 14, - HT_IOT_PEER_REALTEK_WOW = 15, - HT_IOT_PEER_REALTEK_JAGUAR_BCUTAP = 16, - HT_IOT_PEER_REALTEK_JAGUAR_CCUTAP = 17, - HT_IOT_PEER_MAX = 18 -} HT_IOT_PEER_E, *PHTIOT_PEER_E; - - -typedef enum _RT_HT_INF0_CAP { - RT_HT_CAP_USE_TURBO_AGGR = 0x01, - RT_HT_CAP_USE_LONG_PREAMBLE = 0x02, - RT_HT_CAP_USE_AMPDU = 0x04, - RT_HT_CAP_USE_WOW = 0x8, - RT_HT_CAP_USE_SOFTAP = 0x10, - RT_HT_CAP_USE_92SE = 0x20, - RT_HT_CAP_USE_88C_92C = 0x40, - RT_HT_CAP_USE_AP_CLIENT_MODE = 0x80, /* AP team request to reserve this bit, by Emily */ -} RT_HT_INF0_CAPBILITY, *PRT_HT_INF0_CAPBILITY; - -typedef enum _RT_HT_INF1_CAP { - RT_HT_CAP_USE_VIDEO_CLIENT = 0x01, - RT_HT_CAP_USE_JAGUAR_BCUT = 0x02, - RT_HT_CAP_USE_JAGUAR_CCUT = 0x04, -} RT_HT_INF1_CAPBILITY, *PRT_HT_INF1_CAPBILITY; - -struct mlme_handler { - unsigned int num; - char *str; - unsigned int (*func)(_adapter *padapter, union recv_frame *precv_frame); -}; - -struct action_handler { - unsigned int num; - char *str; - unsigned int (*func)(_adapter *padapter, union recv_frame *precv_frame); -}; - -enum SCAN_STATE { - SCAN_DISABLE = 0, - SCAN_START = 1, - SCAN_PS_ANNC_WAIT = 2, - SCAN_ENTER = 3, - SCAN_PROCESS = 4, - - /* backop */ - SCAN_BACKING_OP = 5, - SCAN_BACK_OP = 6, - SCAN_LEAVING_OP = 7, - SCAN_LEAVE_OP = 8, - - /* SW antenna diversity (before linked) */ - SCAN_SW_ANTDIV_BL = 9, - - /* legacy p2p */ - SCAN_TO_P2P_LISTEN = 10, - SCAN_P2P_LISTEN = 11, - - SCAN_COMPLETE = 12, - SCAN_STATE_MAX, -}; - -const char *scan_state_str(u8 state); - -enum ss_backop_flag { - SS_BACKOP_EN = BIT0, /* backop when linked */ - SS_BACKOP_EN_NL = BIT1, /* backop even when no linked */ - - SS_BACKOP_PS_ANNC = BIT4, - SS_BACKOP_TX_RESUME = BIT5, -}; - -struct ss_res { - u8 state; - u8 next_state; /* will set to state on next cmd hdl */ - int bss_cnt; - u8 activate_ch_cnt; - int channel_idx; - u8 force_ssid_scan; - int scan_mode; - u16 scan_ch_ms; - u32 scan_timeout_ms; - u8 rx_ampdu_accept; - u8 rx_ampdu_size; - u8 igi_scan; - u8 igi_before_scan; /* used for restoring IGI value without enable DIG & FA_CNT */ -#ifdef CONFIG_SCAN_BACKOP - u8 backop_flags_sta; /* policy for station mode*/ - #ifdef CONFIG_AP_MODE - u8 backop_flags_ap; /* policy for ap mode */ - #endif - #ifdef CONFIG_RTW_MESH - u8 backop_flags_mesh; /* policy for mesh mode */ - #endif - u8 backop_flags; /* per backop runtime decision */ - u8 scan_cnt; - u8 scan_cnt_max; - systime backop_time; /* the start time of backop */ - u16 backop_ms; -#endif -#if defined(CONFIG_ANTENNA_DIVERSITY) || defined(DBG_SCAN_SW_ANTDIV_BL) - u8 is_sw_antdiv_bl_scan; -#endif - u8 ssid_num; - u8 ch_num; - NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT]; - struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT]; - - u32 token; /* 0: use to identify caller */ - u16 duration; /* 0: use default */ - u8 igi; /* 0: use defalut */ - u8 bw; /* 0: use default */ - - bool acs; /* aim to trigger channel selection when scan done */ -}; - -#ifdef CONFIG_TDLS -enum TDLS_option { - TDLS_ESTABLISHED = 1, - TDLS_ISSUE_PTI, - TDLS_CH_SW_RESP, - TDLS_CH_SW_PREPARE, - TDLS_CH_SW_START, - TDLS_CH_SW_TO_OFF_CHNL, - TDLS_CH_SW_TO_BASE_CHNL_UNSOLICITED, - TDLS_CH_SW_TO_BASE_CHNL, - TDLS_CH_SW_END_TO_BASE_CHNL, - TDLS_CH_SW_END, - TDLS_RS_RCR, - TDLS_TEARDOWN_STA, - TDLS_TEARDOWN_STA_NO_WAIT, - TDLS_TEARDOWN_STA_LOCALLY, - TDLS_TEARDOWN_STA_LOCALLY_POST, - maxTDLS, -}; - -#endif /* CONFIG_TDLS */ - -/* - * Usage: - * When one iface acted as AP mode and the other iface is STA mode and scanning, - * it should switch back to AP's operating channel periodically. - * Parameters info: - * When the driver scanned RTW_SCAN_NUM_OF_CH channels, it would switch back to AP's operating channel for - * RTW_BACK_OP_CH_MS milliseconds. - * Example: - * For chip supports 2.4G + 5GHz and AP mode is operating in channel 1, - * RTW_SCAN_NUM_OF_CH is 8, RTW_BACK_OP_CH_MS is 300 - * When it's STA mode gets set_scan command, - * it would - * 1. Doing the scan on channel 1.2.3.4.5.6.7.8 - * 2. Back to channel 1 for 300 milliseconds - * 3. Go through doing site survey on channel 9.10.11.36.40.44.48.52 - * 4. Back to channel 1 for 300 milliseconds - * 5. ... and so on, till survey done. - */ -#if defined(CONFIG_ATMEL_RC_PATCH) - #define RTW_SCAN_NUM_OF_CH 2 - #define RTW_BACK_OP_CH_MS 200 -#elseif defined(CONFIG_CUSTOMER_EZVIZ_CHIME2) - #define RTW_SCAN_NUM_OF_CH 1 - #define RTW_BACK_OP_CH_MS 200 -#else - #define RTW_SCAN_NUM_OF_CH 3 - #define RTW_BACK_OP_CH_MS 400 -#endif - -#define RTW_IP_ADDR_LEN 4 -#define RTW_IPv6_ADDR_LEN 16 - -struct mlme_ext_info { - u32 state; -#ifdef CONFIG_MI_WITH_MBSSID_CAM - u8 hw_media_state; -#endif - u32 reauth_count; - u32 reassoc_count; - u32 link_count; - u32 auth_seq; - u32 auth_algo; /* 802.11 auth, could be open, shared, auto */ - u16 auth_status; - u32 authModeToggle; - u32 enc_algo;/* encrypt algorithm; */ - u32 key_index; /* this is only valid for legendary wep, 0~3 for key id. */ - u32 iv; - u8 chg_txt[128]; - u16 aid; - u16 bcn_interval; - u16 capability; - u8 assoc_AP_vendor; - u8 slotTime; - u8 preamble_mode; - u8 WMM_enable; - u8 ERP_enable; - u8 ERP_IE; - u8 HT_enable; - u8 HT_caps_enable; - u8 HT_info_enable; - u8 HT_protection; - u8 turboMode_cts2self; - u8 turboMode_rtsen; - u8 SM_PS; - u8 agg_enable_bitmap; - u8 ADDBA_retry_count; - u8 candidate_tid_bitmap; - u8 dialogToken; - /* Accept ADDBA Request */ - BOOLEAN bAcceptAddbaReq; - u8 bwmode_updated; - u8 hidden_ssid_mode; - u8 VHT_enable; - - u8 ip_addr[RTW_IP_ADDR_LEN]; - u8 ip6_addr[RTW_IPv6_ADDR_LEN]; - - struct ADDBA_request ADDBA_req; - struct WMM_para_element WMM_param; - struct HT_caps_element HT_caps; - struct HT_info_element HT_info; - WLAN_BSSID_EX network;/* join network or bss_network, if in ap mode, it is the same to cur_network.network */ -#ifdef ROKU_PRIVATE - /*infra mode, store supported rates from AssocRsp*/ - NDIS_802_11_RATES_EX SupportedRates_infra_ap; - u8 ht_vht_received;/*ht_vht_received used to show debug msg BIT(0):HT BIT(1):VHT */ -#endif /* ROKU_PRIVATE */ -}; - -enum { - RTW_CHF_NO_IR = BIT0, - RTW_CHF_DFS = BIT1, - RTW_CHF_LONG_CAC = BIT2, - RTW_CHF_NON_OCP = BIT3, -}; - -/* The channel information about this channel including joining, scanning, and power constraints. */ -typedef struct _RT_CHANNEL_INFO { - u8 ChannelNum; /* The channel number. */ - - /* - * Bitmap and its usage: - * RTW_CHF_NO_IR, RTW_CHF_DFS: is used to check for status - * RTW_CHF_NON_OCP: is only used to record if event is reported, status check is still done using non_ocp_end_time - */ - u8 flags; - /* u16 ScanPeriod; */ /* Listen time in millisecond in this channel. */ - /* s32 MaxTxPwrDbm; */ /* Max allowed tx power. */ - /* u32 ExInfo; */ /* Extended Information for this channel. */ -#ifdef CONFIG_FIND_BEST_CHANNEL - u32 rx_count; -#endif -#if CONFIG_IEEE80211_BAND_5GHZ && CONFIG_DFS - #ifdef CONFIG_DFS_MASTER - systime non_ocp_end_time; - #endif -#endif - u8 hidden_bss_cnt; /* per scan count */ -} RT_CHANNEL_INFO, *PRT_CHANNEL_INFO; - -#define CAC_TIME_MS (60*1000) -#define CAC_TIME_CE_MS (10*60*1000) -#define NON_OCP_TIME_MS (30*60*1000) - -#if CONFIG_TXPWR_LIMIT -void rtw_txpwr_init_regd(struct rf_ctl_t *rfctl); -#endif -int rtw_rfctl_init(_adapter *adapter); -void rtw_rfctl_deinit(_adapter *adapter); -void rtw_rfctl_chplan_init(_adapter *adapter); -void rtw_rfctl_update_op_mode(struct rf_ctl_t *rfctl, u8 ifbmp_mod, u8 if_op); - -u8 rtw_rfctl_get_dfs_domain(struct rf_ctl_t *rfctl); -u8 rtw_rfctl_dfs_domain_unknown(struct rf_ctl_t *rfctl); - -#ifdef CONFIG_DFS_MASTER -struct rf_ctl_t; -#define CH_IS_NON_OCP(rt_ch_info) (rtw_time_after((rt_ch_info)->non_ocp_end_time, rtw_get_current_time())) -bool rtw_is_cac_reset_needed(struct rf_ctl_t *rfctl, u8 ch, u8 bw, u8 offset); -bool _rtw_rfctl_overlap_radar_detect_ch(struct rf_ctl_t *rfctl, u8 ch, u8 bw, u8 offset); -bool rtw_rfctl_overlap_radar_detect_ch(struct rf_ctl_t *rfctl); -bool rtw_rfctl_is_tx_blocked_by_ch_waiting(struct rf_ctl_t *rfctl); -bool rtw_chset_is_chbw_non_ocp(RT_CHANNEL_INFO *ch_set, u8 ch, u8 bw, u8 offset); -bool rtw_chset_is_ch_non_ocp(RT_CHANNEL_INFO *ch_set, u8 ch); -bool rtw_chset_update_non_ocp(RT_CHANNEL_INFO *ch_set, u8 ch, u8 bw, u8 offset); -bool rtw_chset_update_non_ocp_ms(RT_CHANNEL_INFO *ch_set, u8 ch, u8 bw, u8 offset, int ms); -void rtw_chset_chk_non_ocp_finish(struct rf_ctl_t *rfctl); -u32 rtw_get_ch_waiting_ms(struct rf_ctl_t *rfctl, u8 ch, u8 bw, u8 offset, u32 *r_non_ocp_ms, u32 *r_cac_ms); -void rtw_reset_cac(struct rf_ctl_t *rfctl, u8 ch, u8 bw, u8 offset); -u32 rtw_force_stop_cac(struct rf_ctl_t *rfctl, u32 timeout_ms); -#else -#define CH_IS_NON_OCP(rt_ch_info) 0 -#define rtw_chset_is_chbw_non_ocp(ch_set, ch, bw, offset) _FALSE -#define rtw_chset_is_ch_non_ocp(ch_set, ch) _FALSE -#define rtw_rfctl_is_tx_blocked_by_ch_waiting(rfctl) _FALSE -#endif - -bool rtw_choose_shortest_waiting_ch(struct rf_ctl_t *rfctl, u8 sel_ch, u8 max_bw - , u8 *dec_ch, u8 *dec_bw, u8 *dec_offset - , u8 e_flags, u8 d_flags, u8 cur_ch, bool by_int_info, u8 mesh_only); - -struct get_chplan_resp { - const struct country_chplan *country_ent; - u8 channel_plan; -#if CONFIG_TXPWR_LIMIT - const char *regd_name; -#endif -#ifdef CONFIG_DFS_MASTER - u8 dfs_domain; -#endif - u8 chset_num; - RT_CHANNEL_INFO chset[0]; -}; - -#ifdef CONFIG_PROC_DEBUG -void dump_chset(void *sel, RT_CHANNEL_INFO *ch_set, u8 chset_num); -void dump_cur_chset(void *sel, struct rf_ctl_t *rfctl); -#endif - -int rtw_chset_search_ch(RT_CHANNEL_INFO *ch_set, const u32 ch); -u8 rtw_chset_is_chbw_valid(RT_CHANNEL_INFO *ch_set, u8 ch, u8 bw, u8 offset - , bool allow_primary_passive, bool allow_passive); -void rtw_chset_sync_chbw(RT_CHANNEL_INFO *ch_set, u8 *req_ch, u8 *req_bw, u8 *req_offset - , u8 *g_ch, u8 *g_bw, u8 *g_offset, bool allow_primary_passive, bool allow_passive); - -bool rtw_mlme_band_check(_adapter *adapter, const u32 ch); - - -enum { - BAND_24G = BIT0, - BAND_5G = BIT1, -}; -void RTW_SET_SCAN_BAND_SKIP(_adapter *padapter, int skip_band); -void RTW_CLR_SCAN_BAND_SKIP(_adapter *padapter, int skip_band); -int RTW_GET_SCAN_BAND_SKIP(_adapter *padapter); - -bool rtw_mlme_ignore_chan(_adapter *adapter, const u32 ch); - -/* P2P_MAX_REG_CLASSES - Maximum number of regulatory classes */ -#define P2P_MAX_REG_CLASSES 10 - -/* P2P_MAX_REG_CLASS_CHANNELS - Maximum number of channels per regulatory class */ -#define P2P_MAX_REG_CLASS_CHANNELS 20 - -/* struct p2p_channels - List of supported channels */ -struct p2p_channels { - /* struct p2p_reg_class - Supported regulatory class */ - struct p2p_reg_class { - /* reg_class - Regulatory class (IEEE 802.11-2007, Annex J) */ - u8 reg_class; - - /* channel - Supported channels */ - u8 channel[P2P_MAX_REG_CLASS_CHANNELS]; - - /* channels - Number of channel entries in use */ - size_t channels; - } reg_class[P2P_MAX_REG_CLASSES]; - - /* reg_classes - Number of reg_class entries in use */ - size_t reg_classes; -}; - -struct p2p_oper_class_map { - enum hw_mode {IEEE80211G, IEEE80211A} mode; - u8 op_class; - u8 min_chan; - u8 max_chan; - u8 inc; - enum { BW20, BW40PLUS, BW40MINUS } bw; -}; - -struct mlme_ext_priv { - _adapter *padapter; - u8 mlmeext_init; - ATOMIC_T event_seq; - u16 mgnt_seq; -#ifdef CONFIG_IEEE80211W - u16 sa_query_seq; -#endif - /* struct fw_priv fwpriv; */ - - unsigned char cur_channel; - unsigned char cur_bwmode; - unsigned char cur_ch_offset;/* PRIME_CHNL_OFFSET */ - unsigned char cur_wireless_mode; /* NETWORK_TYPE */ - - unsigned char basicrate[NumRates]; - unsigned char datarate[NumRates]; -#ifdef CONFIG_80211N_HT - unsigned char default_supported_mcs_set[16]; -#endif - - struct ss_res sitesurvey_res; - struct mlme_ext_info mlmext_info;/* for sta/adhoc mode, including current scanning/connecting/connected related info. - * for ap mode, network includes ap's cap_info */ - _timer survey_timer; - _timer link_timer; - -#ifdef CONFIG_RTW_REPEATER_SON - _timer rson_scan_timer; -#endif -#ifdef CONFIG_RTW_80211R - _timer ft_link_timer; - _timer ft_roam_timer; -#endif -#ifdef CONFIG_RTW_TOKEN_BASED_XMIT - _timer tbtx_xmit_timer; - _timer tbtx_token_dispatch_timer; -#endif - - systime last_scan_time; - u8 scan_abort; - u8 join_abort; - u8 tx_rate; /* TXRATE when USERATE is set. */ - - u32 retry; /* retry for issue probereq */ - - u64 TSFValue; - u32 bcn_cnt; - u32 last_bcn_cnt; - u8 cur_bcn_cnt;/*2s*/ - u8 dtim;/*DTIM Period*/ -#ifdef DBG_RX_BCN - u8 tim[4]; -#endif -#ifdef CONFIG_BCN_RECV_TIME - u16 bcn_rx_time; -#endif -#ifdef CONFIG_AP_MODE - unsigned char bstart_bss; -#endif - -#ifdef CONFIG_80211D - u8 update_channel_plan_by_ap_done; -#endif - /* recv_decache check for Action_public frame */ - u8 action_public_dialog_token; - u16 action_public_rxseq; - - /* #ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK */ - u8 active_keep_alive_check; - /* #endif */ -#ifdef DBG_FIXED_CHAN - u8 fixed_chan; -#endif - - u8 tsf_update_required:1; - u8 en_hw_update_tsf:1; /* set hw sync bcn tsf register or not */ - systime tsf_update_pause_stime; - u8 tsf_update_pause_factor; /* num of bcn intervals to stay TSF update pause status */ - u8 tsf_update_restore_factor; /* num of bcn interval to stay TSF update restore status */ -#ifdef CONFIG_SUPPORT_STATIC_SMPS - u8 ssmps_en; - u16 ssmps_tx_tp_th;/*Mbps*/ - u16 ssmps_rx_tp_th;/*Mbps*/ - #ifdef DBG_STATIC_SMPS - u8 ssmps_test; - u8 ssmps_test_en; - #endif -#endif -#ifdef CONFIG_CTRL_TXSS_BY_TP - u8 txss_ctrl_en; - u16 txss_tp_th;/*Mbps*/ - u8 txss_tp_chk_cnt;/*unit 2s*/ - bool txss_1ss; - u8 txss_momi_type_bk; -#endif -#ifdef CONFIG_DFS - _timer csa_timer; -#endif /* CONFIG_DFS */ -}; - -struct support_rate_handler { - u8 rate; - bool basic; - bool existence; -}; - -static inline u8 check_mlmeinfo_state(struct mlme_ext_priv *plmeext, sint state) -{ - if ((plmeext->mlmext_info.state & 0x03) == state) - return _TRUE; - - return _FALSE; -} - -void sitesurvey_set_offch_state(_adapter *adapter, u8 scan_state); - -#define mlmeext_msr(mlmeext) ((mlmeext)->mlmext_info.state & 0x03) -#define mlmeext_scan_state(mlmeext) ((mlmeext)->sitesurvey_res.state) -#define mlmeext_scan_state_str(mlmeext) scan_state_str((mlmeext)->sitesurvey_res.state) -#define mlmeext_chk_scan_state(mlmeext, _state) ((mlmeext)->sitesurvey_res.state == (_state)) -#define mlmeext_set_scan_state(mlmeext, _state) \ - do { \ - ((mlmeext)->sitesurvey_res.state = (_state)); \ - ((mlmeext)->sitesurvey_res.next_state = (_state)); \ - rtw_mi_update_iface_status(&((container_of(mlmeext, _adapter, mlmeextpriv)->mlmepriv)), 0); \ - /* RTW_INFO("set_scan_state:%s\n", scan_state_str(_state)); */ \ - sitesurvey_set_offch_state(container_of(mlmeext, _adapter, mlmeextpriv), _state); \ - } while (0) - -#define mlmeext_scan_next_state(mlmeext) ((mlmeext)->sitesurvey_res.next_state) -#define mlmeext_set_scan_next_state(mlmeext, _state) \ - do { \ - ((mlmeext)->sitesurvey_res.next_state = (_state)); \ - /* RTW_INFO("set_scan_next_state:%s\n", scan_state_str(_state)); */ \ - } while (0) - -#ifdef CONFIG_SCAN_BACKOP -#define mlmeext_scan_backop_flags(mlmeext) ((mlmeext)->sitesurvey_res.backop_flags) -#define mlmeext_chk_scan_backop_flags(mlmeext, flags) ((mlmeext)->sitesurvey_res.backop_flags & (flags)) -#define mlmeext_assign_scan_backop_flags(mlmeext, flags) \ - do { \ - ((mlmeext)->sitesurvey_res.backop_flags = (flags)); \ - RTW_INFO("assign_scan_backop_flags:0x%02x\n", (mlmeext)->sitesurvey_res.backop_flags); \ - } while (0) - -#define mlmeext_scan_backop_flags_sta(mlmeext) ((mlmeext)->sitesurvey_res.backop_flags_sta) -#define mlmeext_chk_scan_backop_flags_sta(mlmeext, flags) ((mlmeext)->sitesurvey_res.backop_flags_sta & (flags)) -#define mlmeext_assign_scan_backop_flags_sta(mlmeext, flags) \ - do { \ - ((mlmeext)->sitesurvey_res.backop_flags_sta = (flags)); \ - } while (0) -#else -#define mlmeext_scan_backop_flags(mlmeext) (0) -#define mlmeext_chk_scan_backop_flags(mlmeext, flags) (0) -#define mlmeext_assign_scan_backop_flags(mlmeext, flags) do {} while (0) - -#define mlmeext_scan_backop_flags_sta(mlmeext) (0) -#define mlmeext_chk_scan_backop_flags_sta(mlmeext, flags) (0) -#define mlmeext_assign_scan_backop_flags_sta(mlmeext, flags) do {} while (0) -#endif /* CONFIG_SCAN_BACKOP */ - -#if defined(CONFIG_SCAN_BACKOP) && defined(CONFIG_AP_MODE) -#define mlmeext_scan_backop_flags_ap(mlmeext) ((mlmeext)->sitesurvey_res.backop_flags_ap) -#define mlmeext_chk_scan_backop_flags_ap(mlmeext, flags) ((mlmeext)->sitesurvey_res.backop_flags_ap & (flags)) -#define mlmeext_assign_scan_backop_flags_ap(mlmeext, flags) \ - do { \ - ((mlmeext)->sitesurvey_res.backop_flags_ap = (flags)); \ - } while (0) -#else -#define mlmeext_scan_backop_flags_ap(mlmeext) (0) -#define mlmeext_chk_scan_backop_flags_ap(mlmeext, flags) (0) -#define mlmeext_assign_scan_backop_flags_ap(mlmeext, flags) do {} while (0) -#endif /* defined(CONFIG_SCAN_BACKOP) && defined(CONFIG_AP_MODE) */ - -#if defined(CONFIG_SCAN_BACKOP) && defined(CONFIG_RTW_MESH) -#define mlmeext_scan_backop_flags_mesh(mlmeext) ((mlmeext)->sitesurvey_res.backop_flags_mesh) -#define mlmeext_chk_scan_backop_flags_mesh(mlmeext, flags) ((mlmeext)->sitesurvey_res.backop_flags_mesh & (flags)) -#define mlmeext_assign_scan_backop_flags_mesh(mlmeext, flags) \ - do { \ - ((mlmeext)->sitesurvey_res.backop_flags_mesh = (flags)); \ - } while (0) -#else -#define mlmeext_scan_backop_flags_mesh(mlmeext) (0) -#define mlmeext_chk_scan_backop_flags_mesh(mlmeext, flags) (0) -#define mlmeext_assign_scan_backop_flags_mesh(mlmeext, flags) do {} while (0) -#endif /* defined(CONFIG_SCAN_BACKOP) && defined(CONFIG_RTW_MESH) */ - -u32 rtw_scan_timeout_decision(_adapter *padapter); - -void init_mlme_default_rate_set(_adapter *padapter); -int init_mlme_ext_priv(_adapter *padapter); -int init_hw_mlme_ext(_adapter *padapter); -void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext); -extern struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv); -struct xmit_frame *alloc_mgtxmitframe_once(struct xmit_priv *pxmitpriv); - -/* void fill_fwpriv(_adapter * padapter, struct fw_priv *pfwpriv); */ -u8 judge_network_type(_adapter *padapter, unsigned char *rate, int ratelen); -void get_rate_set(_adapter *padapter, unsigned char *pbssrate, int *bssrate_len); -void set_mcs_rate_by_mask(u8 *mcs_set, u32 mask); -void UpdateBrateTbl(_adapter *padapter, u8 *mBratesOS); -void UpdateBrateTblForSoftAP(u8 *bssrateset, u32 bssratelen); -void change_band_update_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 ch); - -void Set_MSR(_adapter *padapter, u8 type); - - -void rtw_set_external_auth_status(_adapter *padapter, const void *data, int len); - -u8 rtw_get_oper_ch(_adapter *adapter); -void rtw_set_oper_ch(_adapter *adapter, u8 ch); -u8 rtw_get_oper_bw(_adapter *adapter); -void rtw_set_oper_bw(_adapter *adapter, u8 bw); -u8 rtw_get_oper_choffset(_adapter *adapter); -void rtw_set_oper_choffset(_adapter *adapter, u8 offset); -systime rtw_get_on_oper_ch_time(_adapter *adapter); -systime rtw_get_on_cur_ch_time(_adapter *adapter); - -void set_channel_bwmode(_adapter *padapter, unsigned char channel, unsigned char channel_offset, unsigned short bwmode); - -void csa_timer_hdl(void *FunctionContext); - -unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval); - -void _clear_cam_entry(_adapter *padapter, u8 entry); -void write_cam_from_cache(_adapter *adapter, u8 id); -void rtw_sec_cam_swap(_adapter *adapter, u8 cam_id_a, u8 cam_id_b); -void rtw_clean_dk_section(_adapter *adapter); -void rtw_clean_hw_dk_cam(_adapter *adapter); - -/* modify both HW and cache */ -void write_cam(_adapter *padapter, u8 id, u16 ctrl, u8 *mac, u8 *key); -void clear_cam_entry(_adapter *padapter, u8 id); - -/* modify cache only */ -void write_cam_cache(_adapter *adapter, u8 id, u16 ctrl, u8 *mac, u8 *key); -void clear_cam_cache(_adapter *adapter, u8 id); - -void invalidate_cam_all(_adapter *padapter); - -void flush_all_cam_entry(_adapter *padapter); - -BOOLEAN IsLegal5GChannel(PADAPTER Adapter, u8 channel); - -void site_survey(_adapter *padapter, u8 survey_channel, RT_SCAN_TYPE ScanType); -u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSID_EX *bssid); -void update_network(WLAN_BSSID_EX *dst, WLAN_BSSID_EX *src, _adapter *padapter, bool update_ie); - -u8 *get_my_bssid(WLAN_BSSID_EX *pnetwork); -u16 get_beacon_interval(WLAN_BSSID_EX *bss); - -int is_client_associated_to_ap(_adapter *padapter); -int is_client_associated_to_ibss(_adapter *padapter); -int is_IBSS_empty(_adapter *padapter); - -unsigned char check_assoc_AP(u8 *pframe, uint len); -void get_assoc_AP_Vendor(char *vendor, u8 assoc_AP_vendor); -#ifdef CONFIG_RTS_FULL_BW -void rtw_parse_sta_vendor_ie_8812(_adapter *adapter, struct sta_info *sta, u8 *tlv_ies, u16 tlv_ies_len); -#endif/*CONFIG_RTS_FULL_BW*/ -#ifdef CONFIG_80211AC_VHT -void get_vht_bf_cap(u8 *pframe, uint len, struct vht_bf_cap *bf_cap); -#endif - -int WMM_param_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE); -#ifdef CONFIG_WFD -void rtw_process_wfd_ie(_adapter *adapter, u8 *ie, u8 ie_len, const char *tag); -void rtw_process_wfd_ies(_adapter *adapter, u8 *ies, u8 ies_len, const char *tag); -#endif -void WMMOnAssocRsp(_adapter *padapter); -#ifdef CONFIG_RTW_TOKEN_BASED_XMIT -u8 rtw_is_tbtx_capabilty(u8 *p, u8 len); -#endif - -void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE); -#ifdef ROKU_PRIVATE -void HT_caps_handler_infra_ap(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE); -#endif -void HT_info_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE); -void HTOnAssocRsp(_adapter *padapter); - -#ifdef ROKU_PRIVATE -void Supported_rate_infra_ap(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE); -void Extended_Supported_rate_infra_ap(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE); -#endif - -void ERP_IE_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE); -void VCS_update(_adapter *padapter, struct sta_info *psta); -void update_ldpc_stbc_cap(struct sta_info *psta); - -bool rtw_validate_value(u16 EID, u8 *p, u16 len); -bool is_hidden_ssid(char *ssid, int len); -bool hidden_ssid_ap(WLAN_BSSID_EX *snetwork); -void rtw_absorb_ssid_ifneed(_adapter *padapter, WLAN_BSSID_EX *bssid, u8 *pframe); - -int rtw_get_bcn_keys(_adapter *adapter, u8 *whdr, u32 flen, struct beacon_keys *bcn_keys); -int rtw_get_bcn_keys_from_bss(WLAN_BSSID_EX *bss, struct beacon_keys *bcn_keys); -int rtw_update_bcn_keys_of_network(struct wlan_network *network); - -int validate_beacon_len(u8 *pframe, uint len); -void rtw_dump_bcn_keys(void *sel, struct beacon_keys *recv_beacon); -void rtw_bcn_key_err_fix(struct beacon_keys *cur, struct beacon_keys *recv); -bool rtw_bcn_key_compare(struct beacon_keys *cur, struct beacon_keys *recv); -int rtw_check_bcn_info(ADAPTER *Adapter, u8 *pframe, u32 packet_len); -void update_beacon_info(_adapter *padapter, u8 *pframe, uint len, struct sta_info *psta); -#if CONFIG_DFS -void process_csa_ie(_adapter *padapter, u8 *ies, uint ies_len); -#endif -void update_capinfo(PADAPTER Adapter, u16 updateCap); -void update_wireless_mode(_adapter *padapter); -void update_tx_basic_rate(_adapter *padapter, u8 modulation); -void update_sta_basic_rate(struct sta_info *psta, u8 wireless_mode); -int rtw_ies_get_supported_rate(u8 *ies, uint ies_len, u8 *rate_set, u8 *rate_num); - -/* for sta/adhoc mode */ -void update_sta_info(_adapter *padapter, struct sta_info *psta); -unsigned int update_basic_rate(unsigned char *ptn, unsigned int ptn_sz); -unsigned int update_supported_rate(unsigned char *ptn, unsigned int ptn_sz); -void Update_RA_Entry(_adapter *padapter, struct sta_info *psta); -void set_sta_rate(_adapter *padapter, struct sta_info *psta); - -unsigned int receive_disconnect(_adapter *padapter, unsigned char *MacAddr, unsigned short reason, u8 locally_generated); - -unsigned char get_highest_rate_idx(u64 mask); -unsigned char get_lowest_rate_idx_ex(u64 mask, int start_bit); -#define get_lowest_rate_idx(mask) get_lowest_rate_idx_ex(mask, 0) - -int support_short_GI(_adapter *padapter, struct HT_caps_element *pHT_caps, u8 bwmode); -unsigned int is_ap_in_tkip(_adapter *padapter); -unsigned int is_ap_in_wep(_adapter *padapter); -unsigned int should_forbid_n_rate(_adapter *padapter); - -void parsing_eapol_packet(_adapter *padapter, u8 *key_payload, struct sta_info *psta, u8 trx_type); - -bool _rtw_camctl_chk_cap(_adapter *adapter, u8 cap); -void _rtw_camctl_set_flags(_adapter *adapter, u32 flags); -void rtw_camctl_set_flags(_adapter *adapter, u32 flags); -void _rtw_camctl_clr_flags(_adapter *adapter, u32 flags); -void rtw_camctl_clr_flags(_adapter *adapter, u32 flags); -bool _rtw_camctl_chk_flags(_adapter *adapter, u32 flags); - -struct sec_cam_bmp; -void dump_sec_cam_map(void *sel, struct sec_cam_bmp *map, u8 max_num); -void rtw_sec_cam_map_set(struct sec_cam_bmp *map, u8 id); -void rtw_sec_cam_map_clr_all(struct sec_cam_bmp *map); - -bool _rtw_camid_is_gk(_adapter *adapter, u8 cam_id); -bool rtw_camid_is_gk(_adapter *adapter, u8 cam_id); -s16 rtw_camid_search(_adapter *adapter, u8 *addr, s16 kid, s8 gk); -s16 rtw_camid_alloc(_adapter *adapter, struct sta_info *sta, u8 kid, u8 gk, bool ext_sec, bool *used); -void rtw_camid_free(_adapter *adapter, u8 cam_id); -u8 rtw_get_sec_camid(_adapter *adapter, u8 max_bk_key_num, u8 *sec_key_id); - -struct macid_bmp; -struct macid_ctl_t; -bool _rtw_macid_ctl_chk_cap(_adapter *adapter, u8 cap); -void dump_macid_map(void *sel, struct macid_bmp *map, u8 max_num); -bool rtw_macid_is_set(struct macid_bmp *map, u8 id); -void rtw_macid_map_clr(struct macid_bmp *map, u8 id); -bool rtw_macid_is_used(struct macid_ctl_t *macid_ctl, u8 id); -bool rtw_macid_is_bmc(struct macid_ctl_t *macid_ctl, u8 id); -u8 rtw_macid_get_iface_bmp(struct macid_ctl_t *macid_ctl, u8 id); -bool rtw_macid_is_iface_shared(struct macid_ctl_t *macid_ctl, u8 id); -bool rtw_macid_is_iface_specific(struct macid_ctl_t *macid_ctl, u8 id, _adapter *adapter); -s8 rtw_macid_get_ch_g(struct macid_ctl_t *macid_ctl, u8 id); -void rtw_alloc_macid(_adapter *padapter, struct sta_info *psta); -void rtw_release_macid(_adapter *padapter, struct sta_info *psta); -u8 rtw_search_max_mac_id(_adapter *padapter); -u8 rtw_macid_ctl_set_h2c_msr(struct macid_ctl_t *macid_ctl, u8 id, u8 h2c_msr); -void rtw_macid_ctl_set_bw(struct macid_ctl_t *macid_ctl, u8 id, u8 bw); -void rtw_macid_ctl_set_vht_en(struct macid_ctl_t *macid_ctl, u8 id, u8 en); -void rtw_macid_ctl_set_rate_bmp0(struct macid_ctl_t *macid_ctl, u8 id, u32 bmp); -void rtw_macid_ctl_set_rate_bmp1(struct macid_ctl_t *macid_ctl, u8 id, u32 bmp); -#ifdef CONFIG_PROTSEL_MACSLEEP -void rtw_macid_ctl_init_sleep_reg(struct macid_ctl_t *macid_ctl, u16 reg_ctrl, u16 reg_info); -void rtw_macid_ctl_init_drop_reg(struct macid_ctl_t *macid_ctl, u16 reg_ctrl, u16 reg_info); -#else -void rtw_macid_ctl_init_sleep_reg(struct macid_ctl_t *macid_ctl, u16 m0, u16 m1, u16 m2, u16 m3); -void rtw_macid_ctl_init_drop_reg(struct macid_ctl_t *macid_ctl, u16 m0, u16 m1, u16 m2, u16 m3); -#endif -void rtw_macid_ctl_init(struct macid_ctl_t *macid_ctl); -void rtw_macid_ctl_deinit(struct macid_ctl_t *macid_ctl); -u8 rtw_iface_bcmc_id_get(_adapter *padapter); -void rtw_iface_bcmc_id_set(_adapter *padapter, u8 mac_id); -#if defined(DBG_CONFIG_ERROR_RESET) && defined(CONFIG_CONCURRENT_MODE) -void rtw_iface_bcmc_sec_cam_map_restore(_adapter *adapter); -#endif -bool rtw_bmp_is_set(const u8 *bmp, u8 bmp_len, u8 id); -void rtw_bmp_set(u8 *bmp, u8 bmp_len, u8 id); -void rtw_bmp_clear(u8 *bmp, u8 bmp_len, u8 id); -bool rtw_bmp_not_empty(const u8 *bmp, u8 bmp_len); -bool rtw_bmp_not_empty_exclude_bit0(const u8 *bmp, u8 bmp_len); - -#ifdef CONFIG_AP_MODE -bool rtw_tim_map_is_set(_adapter *padapter, const u8 *map, u8 id); -void rtw_tim_map_set(_adapter *padapter, u8 *map, u8 id); -void rtw_tim_map_clear(_adapter *padapter, u8 *map, u8 id); -bool rtw_tim_map_anyone_be_set(_adapter *padapter, const u8 *map); -bool rtw_tim_map_anyone_be_set_exclude_aid0(_adapter *padapter, const u8 *map); -#endif /* CONFIG_AP_MODE */ - -u32 report_join_res(_adapter *padapter, int aid_res, u16 status); -void report_survey_event(_adapter *padapter, union recv_frame *precv_frame); -void report_surveydone_event(_adapter *padapter, bool acs); -u32 report_del_sta_event(_adapter *padapter, unsigned char *MacAddr, unsigned short reason, bool enqueue, u8 locally_generated); -void report_add_sta_event(_adapter *padapter, unsigned char *MacAddr); -bool rtw_port_switch_chk(_adapter *adapter); -void report_wmm_edca_update(_adapter *padapter); - -void beacon_timing_control(_adapter *padapter); -u8 chk_bmc_sleepq_cmd(_adapter *padapter); -extern u8 set_tx_beacon_cmd(_adapter *padapter, u8 flags); -unsigned int setup_beacon_frame(_adapter *padapter, unsigned char *beacon_frame); -void update_mgnt_tx_rate(_adapter *padapter, u8 rate); -void update_monitor_frame_attrib(_adapter *padapter, struct pkt_attrib *pattrib); -#ifdef CONFIG_RTW_MGMT_QUEUE -void update_mgntframe_subtype(_adapter *padapter, struct xmit_frame *pmgntframe); -#endif -void update_mgntframe_attrib(_adapter *padapter, struct pkt_attrib *pattrib); -void update_mgntframe_attrib_addr(_adapter *padapter, struct xmit_frame *pmgntframe); -void dump_mgntframe(_adapter *padapter, struct xmit_frame *pmgntframe); -s32 dump_mgntframe_and_wait(_adapter *padapter, struct xmit_frame *pmgntframe, int timeout_ms); -s32 dump_mgntframe_and_wait_ack(_adapter *padapter, struct xmit_frame *pmgntframe); -s32 dump_mgntframe_and_wait_ack_timeout(_adapter *padapter, struct xmit_frame *pmgntframe, int timeout_ms); - -#ifdef CONFIG_P2P -int get_reg_classes_full_count(struct p2p_channels *channel_list); -void issue_probersp_p2p(_adapter *padapter, unsigned char *da); -void issue_p2p_provision_request(_adapter *padapter, u8 *pssid, u8 ussidlen, u8 *pdev_raddr); -void issue_p2p_GO_request(_adapter *padapter, u8 *raddr); -void issue_probereq_p2p(_adapter *padapter, u8 *da); -int issue_probereq_p2p_ex(_adapter *adapter, u8 *da, int try_cnt, int wait_ms); -void issue_p2p_invitation_response(_adapter *padapter, u8 *raddr, u8 dialogToken, u8 success); -void issue_p2p_invitation_request(_adapter *padapter, u8 *raddr); -#endif /* CONFIG_P2P */ -void issue_beacon(_adapter *padapter, int timeout_ms); -void issue_probersp(_adapter *padapter, unsigned char *da, u8 is_valid_p2p_probereq); -void _issue_assocreq(_adapter *padapter, u8 is_assoc); -void issue_assocreq(_adapter *padapter); -void issue_reassocreq(_adapter *padapter); -void issue_asocrsp(_adapter *padapter, unsigned short status, struct sta_info *pstat, int pkt_type); -void issue_auth(_adapter *padapter, struct sta_info *psta, unsigned short status); -void issue_probereq(_adapter *padapter, const NDIS_802_11_SSID *pssid, const u8 *da); -s32 issue_probereq_ex(_adapter *padapter, const NDIS_802_11_SSID *pssid, const u8 *da, u8 ch, bool append_wps, int try_cnt, int wait_ms); -int issue_nulldata(_adapter *padapter, unsigned char *da, unsigned int power_mode, int try_cnt, int wait_ms); -int issue_qos_nulldata(_adapter *padapter, unsigned char *da, u16 tid, u8 ps, int try_cnt, int wait_ms); -int issue_deauth(_adapter *padapter, unsigned char *da, unsigned short reason); -int issue_deauth_ex(_adapter *padapter, u8 *da, unsigned short reason, int try_cnt, int wait_ms); -void issue_action_spct_ch_switch(_adapter *padapter, u8 *ra, u8 new_ch, u8 ch_offset); -void issue_addba_req(_adapter *adapter, unsigned char *ra, u8 tid); -void issue_addba_rsp(_adapter *adapter, unsigned char *ra, u8 tid, u16 status, u8 size); -u8 issue_addba_rsp_wait_ack(_adapter *adapter, unsigned char *ra, u8 tid, u16 status, u8 size, int try_cnt, int wait_ms); -void issue_del_ba(_adapter *adapter, unsigned char *ra, u8 tid, u16 reason, u8 initiator); -int issue_del_ba_ex(_adapter *adapter, unsigned char *ra, u8 tid, u16 reason, u8 initiator, int try_cnt, int wait_ms); -void issue_action_BSSCoexistPacket(_adapter *padapter); - -#ifdef CONFIG_IEEE80211W -void issue_action_SA_Query(_adapter *padapter, unsigned char *raddr, unsigned char action, unsigned short tid, u8 key_type); -int issue_deauth_11w(_adapter *padapter, unsigned char *da, unsigned short reason, u8 key_type); -#endif /* CONFIG_IEEE80211W */ -int issue_action_SM_PS(_adapter *padapter , unsigned char *raddr , u8 NewMimoPsMode); -int issue_action_SM_PS_wait_ack(_adapter *padapter, unsigned char *raddr, u8 NewMimoPsMode, int try_cnt, int wait_ms); - -unsigned int send_delba_sta_tid(_adapter *adapter, u8 initiator, struct sta_info *sta, u8 tid, u8 force); -unsigned int send_delba_sta_tid_wait_ack(_adapter *adapter, u8 initiator, struct sta_info *sta, u8 tid, u8 force); - -unsigned int send_delba(_adapter *padapter, u8 initiator, u8 *addr); -#ifdef CONFIG_AP_MODE -unsigned int send_beacon(_adapter *padapter); -#endif -void start_clnt_assoc(_adapter *padapter); -void start_clnt_auth(_adapter *padapter); -void start_clnt_join(_adapter *padapter); -void start_create_ibss(_adapter *padapter); - -unsigned int OnAssocReq(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnAssocRsp(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnProbeReq(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnProbeRsp(_adapter *padapter, union recv_frame *precv_frame); -unsigned int DoReserved(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnBeacon(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnAtim(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnDisassoc(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnAuthClient(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnDeAuth(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnAction(_adapter *padapter, union recv_frame *precv_frame); - -unsigned int on_action_spct(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnAction_qos(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnAction_dls(_adapter *padapter, union recv_frame *precv_frame); -#ifdef CONFIG_RTW_WNM -unsigned int on_action_wnm(_adapter *adapter, union recv_frame *rframe); -#endif - -#define RX_AMPDU_ACCEPT_INVALID 0xFF -#define RX_AMPDU_SIZE_INVALID 0xFF - -enum rx_ampdu_reason { - RX_AMPDU_DRV_FIXED = 1, - RX_AMPDU_BTCOEX = 2, /* not used, because BTCOEX has its own variable management */ - RX_AMPDU_DRV_SCAN = 3, -}; -u8 rtw_rx_ampdu_size(_adapter *adapter); -bool rtw_rx_ampdu_is_accept(_adapter *adapter); -bool rtw_rx_ampdu_set_size(_adapter *adapter, u8 size, u8 reason); -bool rtw_rx_ampdu_set_accept(_adapter *adapter, u8 accept, u8 reason); -u8 rx_ampdu_apply_sta_tid(_adapter *adapter, struct sta_info *sta, u8 tid, u8 accept, u8 size); -u8 rx_ampdu_size_sta_limit(_adapter *adapter, struct sta_info *sta); -u8 rx_ampdu_apply_sta(_adapter *adapter, struct sta_info *sta, u8 accept, u8 size); -u16 rtw_rx_ampdu_apply(_adapter *adapter); - -unsigned int OnAction_back(_adapter *padapter, union recv_frame *precv_frame); -unsigned int on_action_public(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnAction_ft(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnAction_ht(_adapter *padapter, union recv_frame *precv_frame); -#ifdef CONFIG_IEEE80211W -unsigned int OnAction_sa_query(_adapter *padapter, union recv_frame *precv_frame); -#endif /* CONFIG_IEEE80211W */ -unsigned int on_action_rm(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnAction_wmm(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnAction_vht(_adapter *padapter, union recv_frame *precv_frame); -unsigned int OnAction_p2p(_adapter *padapter, union recv_frame *precv_frame); -#ifdef CONFIG_RTW_TOKEN_BASED_XMIT -unsigned int OnAction_tbtx_token(_adapter *padapter, union recv_frame *precv_frame); -#endif - -#ifdef CONFIG_RTW_TOKEN_BASED_XMIT -void rtw_issue_action_token_req(_adapter *padapter, struct sta_info *pstat); -void rtw_issue_action_token_rel(_adapter *padapter); -#endif - -void mlmeext_joinbss_event_callback(_adapter *padapter, int join_res); -void mlmeext_sta_del_event_callback(_adapter *padapter); -void mlmeext_sta_add_event_callback(_adapter *padapter, struct sta_info *psta); - -int rtw_get_rx_chk_limit(_adapter *adapter); -void rtw_set_rx_chk_limit(_adapter *adapter, int limit); -void linked_status_chk(_adapter *padapter, u8 from_timer); - -#define rtw_get_bcn_cnt(adapter) (adapter->mlmeextpriv.cur_bcn_cnt) -#define rtw_get_bcn_dtim_period(adapter) (adapter->mlmeextpriv.dtim) -void rtw_collect_bcn_info(_adapter *adapter); - -void _linked_info_dump(_adapter *padapter); - -void survey_timer_hdl(void *ctx); -#ifdef CONFIG_RTW_REPEATER_SON -void rson_timer_hdl(void *ctx); -#endif -void link_timer_hdl(void *ctx); -void addba_timer_hdl(void *ctx); -#ifdef CONFIG_RTW_TOKEN_BASED_XMIT -void rtw_tbtx_xmit_timer_hdl(void *ctx); -void rtw_tbtx_token_dispatch_timer_hdl(void *ctx); -#endif -#ifdef CONFIG_IEEE80211W -void sa_query_timer_hdl(void *ctx); -#endif /* CONFIG_IEEE80211W */ -#if 0 -void reauth_timer_hdl(_adapter *padapter); -void reassoc_timer_hdl(_adapter *padapter); -#endif - -#define set_survey_timer(mlmeext, ms) \ - do { \ - /*RTW_INFO("%s set_survey_timer(%p, %d)\n", __FUNCTION__, (mlmeext), (ms));*/ \ - _set_timer(&(mlmeext)->survey_timer, (ms)); \ - } while (0) - -#define set_link_timer(mlmeext, ms) \ - do { \ - /*RTW_INFO("%s set_link_timer(%p, %d)\n", __FUNCTION__, (mlmeext), (ms));*/ \ - _set_timer(&(mlmeext)->link_timer, (ms)); \ - } while (0) - -bool rtw_is_cck_rate(u8 rate); -bool rtw_is_ofdm_rate(u8 rate); -bool rtw_is_basic_rate_cck(u8 rate); -bool rtw_is_basic_rate_ofdm(u8 rate); -bool rtw_is_basic_rate_mix(u8 rate); - -extern int cckrates_included(unsigned char *rate, int ratelen); -extern int cckratesonly_included(unsigned char *rate, int ratelen); - -extern void process_addba_req(_adapter *padapter, u8 *paddba_req, u8 *addr); - -extern void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len); -extern void correct_TSF(_adapter *padapter, u8 mlme_state); -#ifdef CONFIG_BCN_RECV_TIME -void rtw_rx_bcn_time_update(_adapter *adapter, uint bcn_len, u8 data_rate); -#endif -extern u8 traffic_status_watchdog(_adapter *padapter, u8 from_timer); - -void rtw_process_bar_frame(_adapter *padapter, union recv_frame *precv_frame); -void rtw_join_done_chk_ch(_adapter *padapter, int join_res); - -int rtw_chk_start_clnt_join(_adapter *padapter, u8 *ch, u8 *bw, u8 *offset); - -#ifdef RTW_BUSY_DENY_SCAN -#ifndef BUSY_TRAFFIC_SCAN_DENY_PERIOD -#ifdef CONFIG_RTW_ANDROID -#ifdef CONFIG_PLATFORM_ARM_SUN8I - #define BUSY_TRAFFIC_SCAN_DENY_PERIOD 8000 -#else - #define BUSY_TRAFFIC_SCAN_DENY_PERIOD 12000 -#endif -#else /* !CONFIG_ANDROID */ -#define BUSY_TRAFFIC_SCAN_DENY_PERIOD 16000 -#endif /* !CONFIG_ANDROID */ -#endif /* !BUSY_TRAFFIC_SCAN_DENY_PERIOD */ -#endif /* RTW_BUSY_DENY_SCAN */ - -void rtw_leave_opch(_adapter *adapter); -void rtw_back_opch(_adapter *adapter); - -u8 join_cmd_hdl(_adapter *padapter, u8 *pbuf); -u8 disconnect_hdl(_adapter *padapter, u8 *pbuf); -u8 createbss_hdl(_adapter *padapter, u8 *pbuf); -#ifdef CONFIG_AP_MODE -u8 stop_ap_hdl(_adapter *adapter); -#endif -#ifdef CONFIG_RTW_TOKEN_BASED_XMIT -u8 tx_control_hdl(_adapter *adapter); -#endif -u8 setopmode_hdl(_adapter *padapter, u8 *pbuf); -u8 sitesurvey_cmd_hdl(_adapter *padapter, u8 *pbuf); -u8 setauth_hdl(_adapter *padapter, u8 *pbuf); -u8 setkey_hdl(_adapter *padapter, u8 *pbuf); -u8 set_stakey_hdl(_adapter *padapter, u8 *pbuf); -u8 set_assocsta_hdl(_adapter *padapter, u8 *pbuf); -u8 del_assocsta_hdl(_adapter *padapter, u8 *pbuf); -u8 add_ba_hdl(_adapter *padapter, unsigned char *pbuf); -u8 add_ba_rsp_hdl(_adapter *padapter, unsigned char *pbuf); - -void rtw_ap_wep_pk_setting(_adapter *adapter, struct sta_info *psta); - -u8 mlme_evt_hdl(_adapter *padapter, unsigned char *pbuf); -u8 chk_bmc_sleepq_hdl(_adapter *padapter, unsigned char *pbuf); -u8 tx_beacon_hdl(_adapter *padapter, unsigned char *pbuf); -u8 rtw_set_chbw_hdl(_adapter *padapter, u8 *pbuf); -u8 rtw_iqk_hdl(_adapter *padapter, unsigned char *pbuf); -u8 rtw_set_chplan_hdl(_adapter *padapter, unsigned char *pbuf); -u8 rtw_get_chplan_hdl(_adapter *padapter, unsigned char *pbuf); -u8 led_blink_hdl(_adapter *padapter, unsigned char *pbuf); -u8 set_csa_hdl(_adapter *padapter, unsigned char *pbuf); /* Kurt: Handling DFS channel switch announcement ie. */ -u8 tdls_hdl(_adapter *padapter, unsigned char *pbuf); -u8 run_in_thread_hdl(_adapter *padapter, u8 *pbuf); - -int rtw_sae_preprocess(_adapter *adapter, const u8 *buf, u32 len, u8 tx); - -u32 rtw_desc_rate_to_bitrate(u8 bw, u8 rate_idx, u8 sgi); - -#ifdef CONFIG_RTW_MULTI_AP -u8 rtw_get_ch_utilization(_adapter *adapter); -void rtw_ch_util_rpt(_adapter *adapter); -#endif - -#define GEN_MLME_EXT_HANDLER(cmd, callback) {cmd, callback}, - -struct rtw_cmd { - u8(*cmd_hdl)(_adapter *padapter, u8 *pbuf); - void (*callback)(_adapter *padapter, struct cmd_obj *cmd); -}; - -#ifdef _RTW_CMD_C_ -#ifdef CONFIG_RTW_MESH -extern u8 rtw_mesh_set_plink_state_cmd_hdl(_adapter *adapter, u8 *parmbuf); -#else -u8 rtw_mesh_set_plink_state_cmd_hdl(_adapter *adapter, u8 *parmbuf) { return H2C_CMD_FAIL; }; -#endif - -struct rtw_cmd wlancmds[] = { - GEN_MLME_EXT_HANDLER(join_cmd_hdl, rtw_joinbss_cmd_callback) /*CMD_JOINBSS*/ - GEN_MLME_EXT_HANDLER(disconnect_hdl, rtw_disassoc_cmd_callback) /*CMD_DISCONNECT*/ - GEN_MLME_EXT_HANDLER(createbss_hdl, NULL) /*CMD_CREATE_BSS*/ - GEN_MLME_EXT_HANDLER(setopmode_hdl, NULL) /*CMD_SET_OPMODE*/ - GEN_MLME_EXT_HANDLER(sitesurvey_cmd_hdl, rtw_survey_cmd_callback) /*CMD_SITE_SURVEY*/ - GEN_MLME_EXT_HANDLER(setauth_hdl, NULL) /*CMD_SET_AUTH*/ - GEN_MLME_EXT_HANDLER(setkey_hdl, NULL) /*CMD_SET_KEY*/ - GEN_MLME_EXT_HANDLER(set_stakey_hdl, rtw_setstaKey_cmdrsp_callback) /*CMD_SET_STAKEY*/ - GEN_MLME_EXT_HANDLER(add_ba_hdl, NULL) /*CMD_ADD_BAREQ*/ - GEN_MLME_EXT_HANDLER(rtw_set_chbw_hdl, NULL) /*CMD_SET_CHANNEL*/ - GEN_MLME_EXT_HANDLER(tx_beacon_hdl, NULL) /*CMD_TX_BEACON*/ - GEN_MLME_EXT_HANDLER(mlme_evt_hdl, NULL) /*CMD_SET_MLME_EVT*/ - GEN_MLME_EXT_HANDLER(rtw_drvextra_cmd_hdl, NULL) /*CMD_SET_DRV_EXTRA*/ - GEN_MLME_EXT_HANDLER(rtw_set_chplan_hdl, NULL) /*CMD_SET_CHANPLAN*/ - GEN_MLME_EXT_HANDLER(led_blink_hdl, NULL) /*CMD_LEDBLINK*/ - GEN_MLME_EXT_HANDLER(set_csa_hdl, NULL) /*CMD_SET_CHANSWITCH*/ - GEN_MLME_EXT_HANDLER(tdls_hdl, NULL) /*CMD_TDLS*/ - GEN_MLME_EXT_HANDLER(chk_bmc_sleepq_hdl, NULL) /*CMD_CHK_BMCSLEEPQ*/ - GEN_MLME_EXT_HANDLER(run_in_thread_hdl, NULL) /*CMD_RUN_INTHREAD*/ - GEN_MLME_EXT_HANDLER(add_ba_rsp_hdl, NULL) /*CMD_ADD_BARSP*/ - GEN_MLME_EXT_HANDLER(rm_post_event_hdl, NULL) /*CMD_RM_POST_EVENT*/ - GEN_MLME_EXT_HANDLER(rtw_mesh_set_plink_state_cmd_hdl, NULL) /*CMD_SET_MESH_PLINK_STATE*/ - GEN_MLME_EXT_HANDLER(rtw_iqk_hdl, NULL) /*CMD_DO_IQK*/ - GEN_MLME_EXT_HANDLER(rtw_get_chplan_hdl, NULL) /* CMD_GET_CHANPLAN */ -}; -#endif - -struct rtw_evt_header { - u8 id; - u8 seq; - u16 len; -}; - -enum rtw_event_id { - EVT_SURVEY, /*0*/ - EVT_SURVEY_DONE, /*1*/ - EVT_JOINBSS, /*2*/ - EVT_ADD_STA, /*3*/ - EVT_DEL_STA, /*4*/ - EVT_WMM_UPDATE, /*5*/ -#ifdef CONFIG_IEEE80211W - EVT_TIMEOUT_STA, /*6*/ -#endif /* CONFIG_IEEE80211W */ -#ifdef CONFIG_RTW_80211R - EVT_FT_REASSOC, /*7*/ -#endif - EVT_ID_MAX -}; -#ifdef _RTW_MLME_EXT_C_ -static struct rtw_event wlanevents[] = { - {sizeof(struct survey_event), &rtw_survey_event_callback}, /*EVT_SURVEY*/ - {sizeof(struct surveydone_event), &rtw_surveydone_event_callback}, /*EVT_SURVEY_DONE*/ - {sizeof(struct joinbss_event), &rtw_joinbss_event_callback}, /*EVT_JOINBSS*/ - {sizeof(struct stassoc_event), &rtw_stassoc_event_callback}, /*EVT_ADD_STA*/ - {sizeof(struct stadel_event), &rtw_stadel_event_callback}, /*EVT_DEL_STA*/ - {sizeof(struct wmm_event), &rtw_wmm_event_callback}, /*EVT_WMM_UPDATE*/ - #ifdef CONFIG_IEEE80211W - {sizeof(struct stadel_event), &rtw_sta_timeout_event_callback}, /*EVT_TIMEOUT_STA*/ - #endif /* CONFIG_IEEE80211W */ - #ifdef CONFIG_RTW_80211R - {sizeof(struct stassoc_event), &rtw_ft_reassoc_event_callback}, /*EVT_FT_REASSOC*/ - #endif -}; -#endif/* _RTW_MLME_EXT_C_ */ -#endif diff --git a/include/rtw_vht.h b/include/rtw_vht.h old mode 100755 new mode 100644 diff --git a/include/rtw_wnm.h b/include/rtw_wnm.h old mode 100755 new mode 100644 diff --git a/include/sta_info.h b/include/sta_info.h old mode 100755 new mode 100644 diff --git a/include/sta_info.h.orig b/include/sta_info.h.orig deleted file mode 100644 index 61d6d61..0000000 --- a/include/sta_info.h.orig +++ /dev/null @@ -1,781 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2019 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - *****************************************************************************/ -#ifndef __STA_INFO_H_ -#define __STA_INFO_H_ - -#include - -#define IBSS_START_MAC_ID 2 -#define NUM_STA MACID_NUM_SW_LIMIT - -#ifndef CONFIG_RTW_MACADDR_ACL - #ifdef CONFIG_AP_MODE - #define CONFIG_RTW_MACADDR_ACL 1 - #else - #define CONFIG_RTW_MACADDR_ACL 0 - #endif -#endif - -#ifndef CONFIG_RTW_PRE_LINK_STA - #define CONFIG_RTW_PRE_LINK_STA 0 -#endif - -#define NUM_ACL 16 - -#define RTW_ACL_PERIOD_DEV 0 -#define RTW_ACL_PERIOD_BSS 1 -#define RTW_ACL_PERIOD_NUM 2 - -#define RTW_ACL_MODE_DISABLED 0 -#define RTW_ACL_MODE_ACCEPT_UNLESS_LISTED 1 -#define RTW_ACL_MODE_DENY_UNLESS_LISTED 2 -#define RTW_ACL_MODE_MAX 3 - -#if CONFIG_RTW_MACADDR_ACL -extern const char *const _acl_period_str[RTW_ACL_PERIOD_NUM]; -#define acl_period_str(mode) (((mode) >= RTW_ACL_PERIOD_NUM) ? "INVALID" : _acl_period_str[(mode)]) -extern const char *const _acl_mode_str[RTW_ACL_MODE_MAX]; -#define acl_mode_str(mode) (((mode) >= RTW_ACL_MODE_MAX) ? "INVALID" : _acl_mode_str[(mode)]) -#endif - -#ifndef RTW_PRE_LINK_STA_NUM - #define RTW_PRE_LINK_STA_NUM 8 -#endif - -struct pre_link_sta_node_t { - u8 valid; - u8 addr[ETH_ALEN]; -}; - -struct pre_link_sta_ctl_t { - _lock lock; - u8 num; - struct pre_link_sta_node_t node[RTW_PRE_LINK_STA_NUM]; -}; - -#ifdef CONFIG_TDLS -#define MAX_ALLOWED_TDLS_STA_NUM 4 -#endif - -enum sta_info_update_type { - STA_INFO_UPDATE_NONE = 0, - STA_INFO_UPDATE_BW = BIT(0), - STA_INFO_UPDATE_RATE = BIT(1), - STA_INFO_UPDATE_PROTECTION_MODE = BIT(2), - STA_INFO_UPDATE_CAP = BIT(3), - STA_INFO_UPDATE_HT_CAP = BIT(4), - STA_INFO_UPDATE_VHT_CAP = BIT(5), - STA_INFO_UPDATE_ALL = STA_INFO_UPDATE_BW - | STA_INFO_UPDATE_RATE - | STA_INFO_UPDATE_PROTECTION_MODE - | STA_INFO_UPDATE_CAP - | STA_INFO_UPDATE_HT_CAP - | STA_INFO_UPDATE_VHT_CAP, - STA_INFO_UPDATE_MAX -}; - -struct rtw_wlan_acl_node { - _list list; - u8 addr[ETH_ALEN]; - u8 valid; -}; - -struct wlan_acl_pool { - int mode; - int num; - struct rtw_wlan_acl_node aclnode[NUM_ACL]; - _queue acl_node_q; -}; - -struct stainfo_stats { - systime last_rx_time; - - u64 rx_mgnt_pkts; - u64 rx_beacon_pkts; - u64 rx_probereq_pkts; - u64 rx_probersp_pkts; /* unicast to self */ - u64 rx_probersp_bm_pkts; - u64 rx_probersp_uo_pkts; /* unicast to others */ - u64 rx_ctrl_pkts; - u64 rx_data_pkts; - u64 rx_data_bc_pkts; - u64 rx_data_mc_pkts; - u64 rx_data_qos_pkts[TID_NUM]; /* unicast only */ - - u64 last_rx_mgnt_pkts; - u64 last_rx_beacon_pkts; - u64 last_rx_probereq_pkts; - u64 last_rx_probersp_pkts; /* unicast to self */ - u64 last_rx_probersp_bm_pkts; - u64 last_rx_probersp_uo_pkts; /* unicast to others */ - u64 last_rx_ctrl_pkts; - u64 last_rx_data_pkts; - u64 last_rx_data_bc_pkts; - u64 last_rx_data_mc_pkts; - u64 last_rx_data_qos_pkts[TID_NUM]; /* unicast only */ - -#ifdef CONFIG_TDLS - u64 rx_tdls_disc_rsp_pkts; - u64 last_rx_tdls_disc_rsp_pkts; -#endif - - u64 rx_bytes; - u64 rx_bc_bytes; - u64 rx_mc_bytes; - u64 last_rx_bytes; - u64 last_rx_bc_bytes; - u64 last_rx_mc_bytes; - u64 rx_drops; /* TBD */ - u32 rx_tp_kbits; - u32 smooth_rx_tp_kbits; - - u64 tx_pkts; - u64 last_tx_pkts; - - u64 tx_bytes; - u64 last_tx_bytes; - u64 tx_drops; /* TBD */ - u32 tx_tp_kbits; - u32 smooth_tx_tp_kbits; - -#ifdef CONFIG_LPS_CHK_BY_TP - u64 acc_tx_bytes; - u64 acc_rx_bytes; -#endif - - /* unicast only */ - u64 last_rx_data_uc_pkts; /* For Read & Clear requirement in proc_get_rx_stat() */ - u32 duplicate_cnt; /* Read & Clear, in proc_get_rx_stat() */ - u32 rxratecnt[128]; /* Read & Clear, in proc_get_rx_stat() */ - u32 tx_ok_cnt; /* Read & Clear, in proc_get_tx_stat() */ - u32 tx_fail_cnt; /* Read & Clear, in proc_get_tx_stat() */ - u32 tx_retry_cnt; /* Read & Clear, in proc_get_tx_stat() */ -#ifdef CONFIG_RTW_MESH - u32 rx_hwmp_pkts; - u32 last_rx_hwmp_pkts; -#endif -}; - -#ifndef DBG_SESSION_TRACKER -#define DBG_SESSION_TRACKER 0 -#endif - -/* session tracker status */ -#define ST_STATUS_NONE 0 -#define ST_STATUS_CHECK BIT0 -#define ST_STATUS_ESTABLISH BIT1 -#define ST_STATUS_EXPIRE BIT2 - -#define ST_EXPIRE_MS (10 * 1000) - -struct session_tracker { - _list list; /* session_tracker_queue */ - u32 local_naddr; - u16 local_port; - u32 remote_naddr; - u16 remote_port; - systime set_time; - u8 status; -}; - -/* session tracker cmd */ -#define ST_CMD_ADD 0 -#define ST_CMD_DEL 1 -#define ST_CMD_CHK 2 - -struct st_cmd_parm { - u8 cmd; - struct sta_info *sta; - u32 local_naddr; /* TODO: IPV6 */ - u16 local_port; - u32 remote_naddr; /* TODO: IPV6 */ - u16 remote_port; -}; - -typedef bool (*st_match_rule)(_adapter *adapter, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port); - -struct st_register { - u8 s_proto; - st_match_rule rule; -}; - -#define SESSION_TRACKER_REG_ID_WFD 0 -#define SESSION_TRACKER_REG_ID_NUM 1 - -struct st_ctl_t { - struct st_register reg[SESSION_TRACKER_REG_ID_NUM]; - _queue tracker_q; -}; - -void rtw_st_ctl_init(struct st_ctl_t *st_ctl); -void rtw_st_ctl_deinit(struct st_ctl_t *st_ctl); -void rtw_st_ctl_register(struct st_ctl_t *st_ctl, u8 st_reg_id, struct st_register *reg); -void rtw_st_ctl_unregister(struct st_ctl_t *st_ctl, u8 st_reg_id); -bool rtw_st_ctl_chk_reg_s_proto(struct st_ctl_t *st_ctl, u8 s_proto); -bool rtw_st_ctl_chk_reg_rule(struct st_ctl_t *st_ctl, _adapter *adapter, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port); -void rtw_st_ctl_rx(struct sta_info *sta, u8 *ehdr_pos); -void dump_st_ctl(void *sel, struct st_ctl_t *st_ctl); - -#ifdef CONFIG_TDLS -struct TDLS_PeerKey { - u8 kck[16]; /* TPK-KCK */ - u8 tk[16]; /* TPK-TK; only CCMP will be used */ -} ; -#endif /* CONFIG_TDLS */ - -#ifdef DBG_RX_DFRAME_RAW_DATA -struct sta_recv_dframe_info { - - u8 sta_data_rate; - u8 sta_sgi; - u8 sta_bw_mode; - s8 sta_mimo_signal_strength[4]; - s8 sta_RxPwr[4]; - u8 sta_ofdm_snr[4]; -}; -#endif - -#ifdef CONFIG_RTW_MESH -struct mesh_plink_ent; -struct rtw_ewma_err_rate { - unsigned long internal; -}; - -/* Mesh airtime link metrics parameters */ -struct rtw_atlm_param { - struct rtw_ewma_err_rate err_rate; /* Now is PACKET error rate */ - u16 data_rate; /* The unit is 100Kbps */ - u16 total_pkt; - u16 overhead; /* Channel access overhead */ -}; -#endif - -struct sta_info { - - _lock lock; - _list list; /* free_sta_queue */ - _list hash_list; /* sta_hash */ - /* _list asoc_list; */ /* 20061114 */ - /* _list sleep_list; */ /* sleep_q */ - /* _list wakeup_list; */ /* wakeup_q */ - _adapter *padapter; - struct cmn_sta_info cmn; - - struct sta_xmit_priv sta_xmitpriv; - struct sta_recv_priv sta_recvpriv; - -#ifdef DBG_RX_DFRAME_RAW_DATA - struct sta_recv_dframe_info sta_dframe_info; - struct sta_recv_dframe_info sta_dframe_info_bmc; -#endif - _queue sleep_q; - unsigned int sleepq_len; -#ifdef CONFIG_RTW_MGMT_QUEUE - _queue mgmt_sleep_q; - unsigned int mgmt_sleepq_len; -#endif - - uint state; - uint qos_option; - u16 hwseq; - -#ifdef CONFIG_RTW_80211K - u8 rm_en_cap[5]; - u8 rm_diag_token; -#endif /* CONFIG_RTW_80211K */ - - uint ieee8021x_blocked; /* 0: allowed, 1:blocked */ - uint dot118021XPrivacy; /* aes, tkip... */ - union Keytype dot11tkiptxmickey; - union Keytype dot11tkiprxmickey; - union Keytype dot118021x_UncstKey; - union pn48 dot11txpn; /* PN48 used for Unicast xmit */ - union pn48 dot11rxpn; /* PN48 used for Unicast recv. */ -#ifdef CONFIG_RTW_MESH - /* peer's GTK, RX only */ - u8 group_privacy; - u8 gtk_bmp; - union Keytype gtk; - union pn48 gtk_pn; - #ifdef CONFIG_IEEE80211W - /* peer's IGTK, RX only */ - enum security_type dot11wCipher; - u8 igtk_bmp; - u8 igtk_id; - union Keytype igtk; - union pn48 igtk_pn; - #endif /* CONFIG_IEEE80211W */ -#endif /* CONFIG_RTW_MESH */ -#ifdef CONFIG_GTK_OL - u8 kek[RTW_KEK_LEN]; - u8 kck[RTW_KCK_LEN]; - u8 replay_ctr[RTW_REPLAY_CTR_LEN]; -#endif /* CONFIG_GTK_OL */ -#ifdef CONFIG_IEEE80211W - _timer dot11w_expire_timer; -#endif /* CONFIG_IEEE80211W */ - - u8 bssrateset[16]; - u32 bssratelen; - - u8 cts2self; - u8 rtsen; - - u8 init_rate; - u8 wireless_mode; /* NETWORK_TYPE */ - - struct stainfo_stats sta_stats; - -#ifdef CONFIG_TDLS - u32 tdls_sta_state; - u8 SNonce[32]; - u8 ANonce[32]; - u32 TDLS_PeerKey_Lifetime; - u32 TPK_count; - _timer TPK_timer; - struct TDLS_PeerKey tpk; -#ifdef CONFIG_TDLS_CH_SW - u16 ch_switch_time; - u16 ch_switch_timeout; - /* u8 option; */ - _timer ch_sw_timer; - _timer delay_timer; - _timer stay_on_base_chnl_timer; - _timer ch_sw_monitor_timer; -#endif - _timer handshake_timer; - u8 alive_count; - _timer pti_timer; - u8 TDLS_RSNIE[20]; /* Save peer's RSNIE, used for sending TDLS_SETUP_RSP */ -#endif /* CONFIG_TDLS */ - - /* for A-MPDU TX, ADDBA timeout check */ - _timer addba_retry_timer; - - /* for A-MPDU Rx reordering buffer control */ - struct recv_reorder_ctrl recvreorder_ctrl[TID_NUM]; - ATOMIC_T continual_no_rx_packet[TID_NUM]; - /* for A-MPDU Tx */ - /* unsigned char ampdu_txen_bitmap; */ - u16 BA_starting_seqctrl[16]; - - -#ifdef CONFIG_80211N_HT - struct ht_priv htpriv; -#endif - -#ifdef CONFIG_80211AC_VHT - struct vht_priv vhtpriv; -#endif - - /* Notes: */ - /* STA_Mode: */ - /* curr_network(mlme_priv/security_priv/qos/ht) + sta_info: (STA & AP) CAP/INFO */ - /* scan_q: AP CAP/INFO */ - - /* AP_Mode: */ - /* curr_network(mlme_priv/security_priv/qos/ht) : AP CAP/INFO */ - /* sta_info: (AP & STA) CAP/INFO */ - - unsigned int expire_to; - - int flags; - - u8 bpairwise_key_installed; - -#ifdef CONFIG_AP_MODE - - _list asoc_list; - _list auth_list; - - unsigned int auth_seq; - unsigned int authalg; - unsigned char chg_txt[128]; - - u16 capability; - - int dot8021xalg;/* 0:disable, 1:psk, 2:802.1x */ - int wpa_psk;/* 0:disable, bit(0): WPA, bit(1):WPA2 */ - int wpa_group_cipher; - int wpa2_group_cipher; - int wpa_pairwise_cipher; - int wpa2_pairwise_cipher; - - u32 akm_suite_type; - -#ifdef CONFIG_RTW_80211R - u8 ft_pairwise_key_installed; -#endif - -#ifdef CONFIG_NATIVEAP_MLME - u8 wpa_ie[32]; - - u8 nonerp_set; - u8 no_short_slot_time_set; - u8 no_short_preamble_set; - u8 no_ht_gf_set; - u8 no_ht_set; - u8 ht_20mhz_set; - u8 ht_40mhz_intolerant; -#endif /* CONFIG_NATIVEAP_MLME */ - -#ifdef CONFIG_ATMEL_RC_PATCH - u8 flag_atmel_rc; -#endif - - u8 qos_info; - - u8 max_sp_len; - u8 uapsd_bk;/* BIT(0): Delivery enabled, BIT(1): Trigger enabled */ - u8 uapsd_be; - u8 uapsd_vi; - u8 uapsd_vo; - - u8 has_legacy_ac; - unsigned int sleepq_ac_len; - -#ifdef CONFIG_P2P - /* p2p priv data */ - u8 is_p2p_device; - u8 p2p_status_code; - - /* p2p client info */ - u8 dev_addr[ETH_ALEN]; - /* u8 iface_addr[ETH_ALEN]; */ /* = hwaddr[ETH_ALEN] */ - u8 dev_cap; - u16 config_methods; - u8 primary_dev_type[8]; - u8 num_of_secdev_type; - u8 secdev_types_list[32];/* 32/8 == 4; */ - u16 dev_name_len; - u8 dev_name[32]; -#endif /* CONFIG_P2P */ - -#ifdef CONFIG_WFD - u8 op_wfd_mode; -#endif - -#if !defined(CONFIG_ACTIVE_KEEP_ALIVE_CHECK) && defined(CONFIG_80211N_HT) - u8 under_exist_checking; -#endif - - u8 keep_alive_trycnt; - -#ifdef CONFIG_AUTO_AP_MODE - u8 isrc; /* this device is rc */ - u16 pid; /* pairing id */ -#endif - -#endif /* CONFIG_AP_MODE */ - -#ifdef CONFIG_RTW_MESH - struct mesh_plink_ent *plink; - - u8 local_mps; - u8 peer_mps; - u8 nonpeer_mps; - - struct rtw_atlm_param metrics; - /* The reference for nexthop_lookup */ - BOOLEAN alive; -#endif - -#ifdef CONFIG_IOCTL_CFG80211 - u8 *pauth_frame; - u32 auth_len; - u8 *passoc_req; - u32 assoc_req_len; -#endif - - u8 IOTPeer; /* Enum value. HT_IOT_PEER_E */ -#ifdef CONFIG_LPS_PG - u8 lps_pg_rssi_lv; -#endif - - /* To store the sequence number of received management frame */ - u16 RxMgmtFrameSeqNum; - - struct st_ctl_t st_ctl; - u8 max_agg_num_minimal_record; /*keep minimal tx desc max_agg_num setting*/ - u8 curr_rx_rate; - u8 curr_rx_rate_bmc; -#ifdef CONFIG_RTS_FULL_BW - bool vendor_8812; -#endif - -#ifdef CONFIG_RTW_TOKEN_BASED_XMIT - u8 tbtx_enable; /* Does this sta_info support & enable TBTX function? */ -// u8 tbtx_timeslot; /* This sta_info belong to which time slot. */ -#endif - - /* - * Vaiables for queuing TX pkt a short period of time - * to wait something ready. - */ - u8 tx_q_enable; - struct __queue tx_queue; - _workitem tx_q_work; -}; - -#ifdef CONFIG_RTW_MESH -#define STA_SET_MESH_PLINK(sta, link) (sta)->plink = link -#else -#define STA_SET_MESH_PLINK(sta, link) do {} while (0) -#endif - -#define sta_tx_pkts(sta) \ - (sta->sta_stats.tx_pkts) - -#define sta_last_tx_pkts(sta) \ - (sta->sta_stats.last_tx_pkts) - -#define sta_rx_pkts(sta) \ - (sta->sta_stats.rx_mgnt_pkts \ - + sta->sta_stats.rx_ctrl_pkts \ - + sta->sta_stats.rx_data_pkts) - -#define sta_last_rx_pkts(sta) \ - (sta->sta_stats.last_rx_mgnt_pkts \ - + sta->sta_stats.last_rx_ctrl_pkts \ - + sta->sta_stats.last_rx_data_pkts) - -#define sta_rx_data_pkts(sta) (sta->sta_stats.rx_data_pkts) -#define sta_last_rx_data_pkts(sta) (sta->sta_stats.last_rx_data_pkts) - -#define sta_rx_data_uc_pkts(sta) (sta->sta_stats.rx_data_pkts - sta->sta_stats.rx_data_bc_pkts - sta->sta_stats.rx_data_mc_pkts) -#define sta_last_rx_data_uc_pkts(sta) (sta->sta_stats.last_rx_data_pkts - sta->sta_stats.last_rx_data_bc_pkts - sta->sta_stats.last_rx_data_mc_pkts) - -#define sta_rx_data_qos_pkts(sta, i) \ - (sta->sta_stats.rx_data_qos_pkts[i]) - -#define sta_last_rx_data_qos_pkts(sta, i) \ - (sta->sta_stats.last_rx_data_qos_pkts[i]) - -#define sta_rx_mgnt_pkts(sta) \ - (sta->sta_stats.rx_mgnt_pkts) - -#define sta_last_rx_mgnt_pkts(sta) \ - (sta->sta_stats.last_rx_mgnt_pkts) - -#define sta_rx_beacon_pkts(sta) \ - (sta->sta_stats.rx_beacon_pkts) - -#define sta_last_rx_beacon_pkts(sta) \ - (sta->sta_stats.last_rx_beacon_pkts) - -#define sta_rx_probereq_pkts(sta) \ - (sta->sta_stats.rx_probereq_pkts) - -#define sta_last_rx_probereq_pkts(sta) \ - (sta->sta_stats.last_rx_probereq_pkts) - -#define sta_rx_probersp_pkts(sta) \ - (sta->sta_stats.rx_probersp_pkts) - -#define sta_last_rx_probersp_pkts(sta) \ - (sta->sta_stats.last_rx_probersp_pkts) - -#define sta_rx_probersp_bm_pkts(sta) \ - (sta->sta_stats.rx_probersp_bm_pkts) - -#define sta_last_rx_probersp_bm_pkts(sta) \ - (sta->sta_stats.last_rx_probersp_bm_pkts) - -#define sta_rx_probersp_uo_pkts(sta) \ - (sta->sta_stats.rx_probersp_uo_pkts) - -#define sta_last_rx_probersp_uo_pkts(sta) \ - (sta->sta_stats.last_rx_probersp_uo_pkts) - -#ifdef CONFIG_RTW_MESH -#define update_last_rx_hwmp_pkts(sta) \ - do { \ - sta->sta_stats.last_rx_hwmp_pkts = sta->sta_stats.rx_hwmp_pkts; \ - } while(0) -#else -#define update_last_rx_hwmp_pkts(sta) do {} while(0) -#endif - -#define sta_update_last_rx_pkts(sta) \ - do { \ - int __i; \ - \ - sta->sta_stats.last_rx_mgnt_pkts = sta->sta_stats.rx_mgnt_pkts; \ - sta->sta_stats.last_rx_beacon_pkts = sta->sta_stats.rx_beacon_pkts; \ - sta->sta_stats.last_rx_probereq_pkts = sta->sta_stats.rx_probereq_pkts; \ - sta->sta_stats.last_rx_probersp_pkts = sta->sta_stats.rx_probersp_pkts; \ - sta->sta_stats.last_rx_probersp_bm_pkts = sta->sta_stats.rx_probersp_bm_pkts; \ - sta->sta_stats.last_rx_probersp_uo_pkts = sta->sta_stats.rx_probersp_uo_pkts; \ - sta->sta_stats.last_rx_ctrl_pkts = sta->sta_stats.rx_ctrl_pkts; \ - update_last_rx_hwmp_pkts(sta); \ - \ - sta->sta_stats.last_rx_data_pkts = sta->sta_stats.rx_data_pkts; \ - sta->sta_stats.last_rx_data_bc_pkts = sta->sta_stats.rx_data_bc_pkts; \ - sta->sta_stats.last_rx_data_mc_pkts = sta->sta_stats.rx_data_mc_pkts; \ - for (__i = 0; __i < TID_NUM; __i++) \ - sta->sta_stats.last_rx_data_qos_pkts[__i] = sta->sta_stats.rx_data_qos_pkts[__i]; \ - } while (0) - -#define STA_RX_PKTS_ARG(sta) \ - sta->sta_stats.rx_mgnt_pkts \ - , sta->sta_stats.rx_ctrl_pkts \ - , sta->sta_stats.rx_data_pkts - -#define STA_LAST_RX_PKTS_ARG(sta) \ - sta->sta_stats.last_rx_mgnt_pkts \ - , sta->sta_stats.last_rx_ctrl_pkts \ - , sta->sta_stats.last_rx_data_pkts - -#define STA_RX_PKTS_DIFF_ARG(sta) \ - sta->sta_stats.rx_mgnt_pkts - sta->sta_stats.last_rx_mgnt_pkts \ - , sta->sta_stats.rx_ctrl_pkts - sta->sta_stats.last_rx_ctrl_pkts \ - , sta->sta_stats.rx_data_pkts - sta->sta_stats.last_rx_data_pkts - -#define STA_PKTS_FMT "(m:%llu, c:%llu, d:%llu)" - -#define sta_rx_uc_bytes(sta) (sta->sta_stats.rx_bytes - sta->sta_stats.rx_bc_bytes - sta->sta_stats.rx_mc_bytes) -#define sta_last_rx_uc_bytes(sta) (sta->sta_stats.last_rx_bytes - sta->sta_stats.last_rx_bc_bytes - sta->sta_stats.last_rx_mc_bytes) - -#ifdef CONFIG_WFD -#define STA_OP_WFD_MODE(sta) (sta)->op_wfd_mode -#define STA_SET_OP_WFD_MODE(sta, mode) (sta)->op_wfd_mode = (mode) -#else -#define STA_OP_WFD_MODE(sta) 0 -#define STA_SET_OP_WFD_MODE(sta, mode) do {} while (0) -#endif - -#define AID_BMP_LEN(max_aid) ((max_aid + 1) / 8 + (((max_aid + 1) % 8) ? 1 : 0)) - -struct sta_priv { - - u8 *pallocated_stainfo_buf; - u8 *pstainfo_buf; - _queue free_sta_queue; - - _lock sta_hash_lock; - _list sta_hash[NUM_STA]; - int asoc_sta_count; - _queue sleep_q; - _queue wakeup_q; - - _adapter *padapter; - - u32 adhoc_expire_to; - - int rx_chk_limit; - -#ifdef CONFIG_AP_MODE - _list asoc_list; - _list auth_list; - _lock asoc_list_lock; - _lock auth_list_lock; - u8 asoc_list_cnt; - u8 auth_list_cnt; - - unsigned int auth_to; /* sec, time to expire in authenticating. */ - unsigned int assoc_to; /* sec, time to expire before associating. */ - unsigned int expire_to; /* sec , time to expire after associated. */ - - /* - * pointers to STA info; based on allocated AID or NULL if AID free - * AID is in the range 1-2007, so sta_aid[0] corresponders to AID 1 - */ - struct sta_info **sta_aid; - u16 max_aid; - u16 started_aid; /* started AID for allocation search */ - bool rr_aid; /* round robin AID allocation, will modify started_aid */ - u8 aid_bmp_len; /* in byte */ - u8 *sta_dz_bitmap; - u8 *tim_bitmap; - - u16 max_num_sta; - -#if CONFIG_RTW_MACADDR_ACL - struct wlan_acl_pool acl_list[RTW_ACL_PERIOD_NUM]; -#endif - - #if CONFIG_RTW_PRE_LINK_STA - struct pre_link_sta_ctl_t pre_link_sta_ctl; - #endif -#ifdef CONFIG_RTW_TOKEN_BASED_XMIT - u8 tbtx_asoc_list_cnt; - struct sta_info *token_holder[NR_MAXSTA_INSLOT]; - struct sta_info *last_token_holder; - ATOMIC_T nr_token_keeper; -#endif -#endif /* CONFIG_AP_MODE */ - -#ifdef CONFIG_ATMEL_RC_PATCH - u8 atmel_rc_pattern[6]; -#endif - u8 c2h_sta_mac[ETH_ALEN]; - u8 c2h_adapter_id; - struct submit_ctx *gotc2h; -}; - - -__inline static u32 wifi_mac_hash(const u8 *mac) -{ - u32 x; - - x = mac[0]; - x = (x << 2) ^ mac[1]; - x = (x << 2) ^ mac[2]; - x = (x << 2) ^ mac[3]; - x = (x << 2) ^ mac[4]; - x = (x << 2) ^ mac[5]; - - x ^= x >> 8; - x = x & (NUM_STA - 1); - - return x; -} - - -extern u32 _rtw_init_sta_priv(struct sta_priv *pstapriv); -extern u32 _rtw_free_sta_priv(struct sta_priv *pstapriv); - -#define stainfo_offset_valid(offset) (offset < NUM_STA && offset >= 0) -int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta); -struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int offset); - -extern struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, const u8 *hwaddr); -extern u32 rtw_free_stainfo(_adapter *padapter , struct sta_info *psta); -extern void rtw_free_all_stainfo(_adapter *padapter); -extern struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, const u8 *hwaddr); -extern u32 rtw_init_bcmc_stainfo(_adapter *padapter); -extern struct sta_info *rtw_get_bcmc_stainfo(_adapter *padapter); - -#ifdef CONFIG_AP_MODE -u16 rtw_aid_alloc(_adapter *adapter, struct sta_info *sta); -void dump_aid_status(void *sel, _adapter *adapter); -#endif - -#if CONFIG_RTW_MACADDR_ACL -extern u8 rtw_access_ctrl(_adapter *adapter, const u8 *mac_addr); -void dump_macaddr_acl(void *sel, _adapter *adapter); -#endif - -bool rtw_is_pre_link_sta(struct sta_priv *stapriv, u8 *addr); -#if CONFIG_RTW_PRE_LINK_STA -struct sta_info *rtw_pre_link_sta_add(struct sta_priv *stapriv, u8 *hwaddr); -void rtw_pre_link_sta_del(struct sta_priv *stapriv, u8 *hwaddr); -void rtw_pre_link_sta_ctl_reset(struct sta_priv *stapriv); -void rtw_pre_link_sta_ctl_init(struct sta_priv *stapriv); -void rtw_pre_link_sta_ctl_deinit(struct sta_priv *stapriv); -void dump_pre_link_sta_ctl(void *sel, struct sta_priv *stapriv); -#endif /* CONFIG_RTW_PRE_LINK_STA */ - -#endif /* _STA_INFO_H_ */ diff --git a/include/wifi.h b/include/wifi.h old mode 100755 new mode 100644 diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c old mode 100755 new mode 100644 diff --git a/os_dep/linux/rtw_proc.c b/os_dep/linux/rtw_proc.c old mode 100755 new mode 100644 diff --git a/os_dep/linux/rtw_proc.h b/os_dep/linux/rtw_proc.h old mode 100755 new mode 100644 diff --git a/os_dep/linux/usb_ops_linux.c b/os_dep/linux/usb_ops_linux.c old mode 100755 new mode 100644