1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /****************************************************************************** 3 * 4 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 5 * 6 ******************************************************************************/ 7 #ifndef __WLAN_BSSDEF_H__ 8 #define __WLAN_BSSDEF_H__ 9 10 11 #define MAX_IE_SZ 768 12 13 14 #define NDIS_802_11_LENGTH_SSID 32 15 #define NDIS_802_11_LENGTH_RATES 8 16 #define NDIS_802_11_LENGTH_RATES_EX 16 17 18 typedef unsigned char NDIS_802_11_MAC_ADDRESS[6]; 19 typedef unsigned char NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; /* Set of 8 data rates */ 20 typedef unsigned char NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; /* Set of 16 data rates */ 21 22 struct ndis_802_11_ssid { 23 u32 SsidLength; 24 u8 Ssid[32]; 25 }; 26 27 enum ndis_802_11_network_type { 28 Ndis802_11FH, 29 Ndis802_11DS, 30 Ndis802_11OFDM5, 31 Ndis802_11OFDM24, 32 Ndis802_11NetworkTypeMax /* not a real type, defined as an upper bound */ 33 }; 34 35 struct ndis_802_11_conf_fh { 36 u32 Length; /* Length of structure */ 37 u32 HopPattern; /* As defined by 802.11, MSB set */ 38 u32 HopSet; /* to one if non-802.11 */ 39 u32 DwellTime; /* units are Kusec */ 40 }; 41 42 /* 43 FW will only save the channel number in DSConfig. 44 ODI Handler will convert the channel number to freq. number. 45 */ 46 struct ndis_802_11_conf { 47 u32 Length; /* Length of structure */ 48 u32 BeaconPeriod; /* units are Kusec */ 49 u32 ATIMWindow; /* units are Kusec */ 50 u32 DSConfig; /* Frequency, units are kHz */ 51 struct ndis_802_11_conf_fh FHConfig; 52 }; 53 54 enum ndis_802_11_network_infrastructure { 55 Ndis802_11IBSS, 56 Ndis802_11Infrastructure, 57 Ndis802_11AutoUnknown, 58 Ndis802_11InfrastructureMax, /* Not a real value, defined as upper bound */ 59 Ndis802_11APMode, 60 }; 61 62 struct ndis_802_11_fix_ie { 63 u8 Timestamp[8]; 64 u16 BeaconInterval; 65 u16 Capabilities; 66 }; 67 68 struct ndis_80211_var_ie { 69 u8 ElementID; 70 u8 Length; 71 u8 data[]; 72 }; 73 74 /* Length is the 4 bytes multiples of the sum of 75 * sizeof (NDIS_802_11_MAC_ADDRESS) + 2 + 76 * sizeof (struct ndis_802_11_ssid) + sizeof (u32) + 77 * sizeof (long) + sizeof (enum ndis_802_11_network_type) + 78 * sizeof (struct ndis_802_11_conf) + sizeof (NDIS_802_11_RATES_EX) + IELength 79 * 80 * Except for IELength, all other fields are fixed length. Therefore, we can 81 * define a macro to present the partial sum. 82 */ 83 enum ndis_802_11_authentication_mode { 84 Ndis802_11AuthModeOpen, 85 Ndis802_11AuthModeShared, 86 Ndis802_11AuthModeAutoSwitch, 87 Ndis802_11AuthModeWPA, 88 Ndis802_11AuthModeWPAPSK, 89 Ndis802_11AuthModeWPANone, 90 Ndis802_11AuthModeWAPI, 91 Ndis802_11AuthModeMax /* Not a real mode, defined as upper bound */ 92 }; 93 94 enum { 95 Ndis802_11WEPEnabled, 96 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, 97 Ndis802_11WEPDisabled, 98 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled, 99 Ndis802_11WEPKeyAbsent, 100 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent, 101 Ndis802_11WEPNotSupported, 102 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported, 103 Ndis802_11Encryption2Enabled, 104 Ndis802_11Encryption2KeyAbsent, 105 Ndis802_11Encryption3Enabled, 106 Ndis802_11Encryption3KeyAbsent, 107 Ndis802_11_EncrypteionWAPI 108 }; 109 110 #define NDIS_802_11_AI_REQFI_CAPABILITIES 1 111 #define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2 112 #define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4 113 114 #define NDIS_802_11_AI_RESFI_CAPABILITIES 1 115 #define NDIS_802_11_AI_RESFI_STATUSCODE 2 116 #define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4 117 118 struct ndis_802_11_ai_reqfi { 119 u16 Capabilities; 120 u16 ListenInterval; 121 NDIS_802_11_MAC_ADDRESS CurrentAPAddress; 122 }; 123 124 struct ndis_801_11_ai_resfi { 125 u16 Capabilities; 126 u16 StatusCode; 127 u16 AssociationId; 128 }; 129 130 /* Key mapping keys require a BSSID */ 131 132 struct ndis_802_11_wep { 133 u32 Length; /* Length of this structure */ 134 u32 KeyIndex; /* 0 is the per-client key, 1-N are the global keys */ 135 u32 KeyLength; /* length of key in bytes */ 136 u8 KeyMaterial[16];/* variable length depending on above field */ 137 }; 138 139 /* mask for authentication/integrity fields */ 140 #define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f 141 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01 142 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02 143 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06 144 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E 145 146 /* MIC check time, 60 seconds. */ 147 #define MIC_CHECK_TIME 60000000 148 149 #ifndef Ndis802_11APMode 150 #define Ndis802_11APMode (Ndis802_11InfrastructureMax + 1) 151 #endif 152 153 struct wlan_phy_info { 154 u8 SignalStrength;/* in percentage) */ 155 u8 SignalQuality;/* in percentage) */ 156 u8 Optimum_antenna; /* for Antenna diversity */ 157 u8 Reserved_0; 158 }; 159 160 struct wlan_bcn_info { 161 /* these infor get from rtw_get_encrypt_info when 162 * * translate scan to UI */ 163 u8 encryp_protocol;/* ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI */ 164 int group_cipher; /* WPA/WPA2 group cipher */ 165 int pairwise_cipher;/* WPA/WPA2/WEP pairwise cipher */ 166 int is_8021x; 167 168 /* bwmode 20/40 and ch_offset UP/LOW */ 169 unsigned short ht_cap_info; 170 unsigned char ht_info_infos_0; 171 }; 172 173 /* temporally add #pragma pack for structure alignment issue of 174 * struct wlan_bssid_ex and get_wlan_bssid_ex_sz() 175 */ 176 struct wlan_bssid_ex { 177 u32 Length; 178 NDIS_802_11_MAC_ADDRESS MacAddress; 179 u8 Reserved[2];/* 0]: IS beacon frame */ 180 struct ndis_802_11_ssid Ssid; 181 u32 Privacy; 182 long Rssi;/* in dBM, raw data , get from PHY) */ 183 enum ndis_802_11_network_type NetworkTypeInUse; 184 struct ndis_802_11_conf Configuration; 185 enum ndis_802_11_network_infrastructure InfrastructureMode; 186 NDIS_802_11_RATES_EX SupportedRates; 187 struct wlan_phy_info PhyInfo; 188 u32 IELength; 189 u8 IEs[MAX_IE_SZ]; /* timestamp, beacon interval, and capability information) */ 190 } __packed; 191 192 static inline uint get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss) 193 { 194 return (sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + bss->IELength); 195 } 196 197 struct wlan_network { 198 struct list_head list; 199 int network_type; /* refer to ieee80211.h for WIRELESS_11A/B/G */ 200 int fixed; /* set to fixed when not to be removed as site-surveying */ 201 unsigned long last_scanned; /* timestamp for the network */ 202 int aid; /* will only be valid when a BSS is joinned. */ 203 int join_res; 204 struct wlan_bssid_ex network; /* must be the last item */ 205 struct wlan_bcn_info BcnInfo; 206 }; 207 208 enum { 209 DISABLE_VCS, 210 ENABLE_VCS, 211 AUTO_VCS 212 }; 213 214 enum { 215 NONE_VCS, 216 RTS_CTS, 217 CTS_TO_SELF 218 }; 219 220 #define PWR_CAM 0 221 #define PWR_MINPS 1 222 #define PWR_MAXPS 2 223 #define PWR_UAPSD 3 224 #define PWR_VOIP 4 225 226 enum { 227 NO_LIMIT, 228 TWO_MSDU, 229 FOUR_MSDU, 230 SIX_MSDU 231 }; 232 233 #define NUM_PRE_AUTH_KEY 16 234 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY 235 236 #endif /* ifndef WLAN_BSSDEF_H_ */ 237