Commit | Line | Data |
---|---|---|
533a23a1 TK |
1 | /**************************************************************************** |
2 | * | |
3 | * Copyright (c) 2012 - 2019 Samsung Electronics Co., Ltd. All rights reserved | |
4 | * | |
5 | ****************************************************************************/ | |
6 | ||
7 | #ifndef __SLSI_MLME_H__ | |
8 | #define __SLSI_MLME_H__ | |
9 | ||
10 | #include "dev.h" | |
11 | #include "mib.h" | |
12 | ||
13 | enum slsi_ac_index_wmm_pe { | |
14 | AC_BE, | |
15 | AC_BK, | |
16 | AC_VI, | |
17 | AC_VO | |
18 | }; | |
19 | ||
20 | #define SLSI_FREQ_FW_TO_HOST(f) ((f) / 2) | |
21 | #define SLSI_FREQ_HOST_TO_FW(f) ((f) * 2) | |
22 | ||
23 | #define SLSI_SINFO_MIB_ACCESS_TIMEOUT (1000) /* 1 sec timeout */ | |
24 | ||
25 | #define SLSI_WLAN_EID_VENDOR_SPECIFIC 0xdd | |
26 | #define SLSI_WLAN_EID_INTERWORKING 107 | |
27 | #define SLSI_WLAN_EID_EXTENSION 255 | |
28 | ||
29 | #define SLSI_WLAN_OUI_TYPE_WFA_HS20_IND 0x10 | |
30 | #define SLSI_WLAN_OUI_TYPE_WFA_OSEN 0x12 | |
31 | ||
32 | /*Extended capabilities bytes*/ | |
33 | #define SLSI_WLAN_EXT_CAPA2_BSS_TRANSISITION_ENABLED (1 << 3) | |
34 | #define SLSI_WLAN_EXT_CAPA3_INTERWORKING_ENABLED (1 << 7) | |
35 | #define SLSI_WLAN_EXT_CAPA4_QOS_MAP_ENABLED (1 << 0) | |
36 | #define SLSI_WLAN_EXT_CAPA5_WNM_NOTIF_ENABLED (1 << 6) | |
37 | #define SLSI_WLAN_EXT_CAPA2_QBSS_LOAD_ENABLED BIT(7) | |
38 | #define SLSI_WLAN_EXT_CAPA1_PROXY_ARP_ENABLED BIT(4) | |
39 | #define SLSI_WLAN_EXT_CAPA2_TFS_ENABLED BIT(0) | |
40 | #define SLSI_WLAN_EXT_CAPA2_WNM_SLEEP_ENABLED BIT(1) | |
41 | #define SLSI_WLAN_EXT_CAPA2_TIM_ENABLED BIT(2) | |
42 | #define SLSI_WLAN_EXT_CAPA2_DMS_ENABLED BIT(4) | |
43 | ||
44 | /*RM Enabled Capabilities Bytes*/ | |
45 | #define SLSI_WLAN_RM_CAPA0_LINK_MEASUREMENT_ENABLED BIT(0) | |
46 | #define SLSI_WLAN_RM_CAPA0_NEIGHBOR_REPORT_ENABLED BIT(1) | |
47 | #define SLSI_WLAN_RM_CAPA0_PASSIVE_MODE_ENABLED BIT(4) | |
48 | #define SLSI_WLAN_RM_CAPA0_ACTIVE_MODE_ENABLED BIT(5) | |
49 | #define SLSI_WLAN_RM_CAPA0_TABLE_MODE_ENABLED BIT(6) | |
50 | ||
51 | ||
52 | #define SLSI_AP_EXT_CAPAB_IE_LEN_MAX 12 /* EID (1) + Len (1) + Ext Capab (8) */ | |
53 | ||
54 | #define SLSI_SCAN_DONE_IND_WAIT_TIMEOUT 40000 /* 40 seconds */ | |
55 | ||
56 | /* WLAN_EID_COUNTRY available from kernel version 3.7 */ | |
57 | #ifndef WLAN_EID_COUNTRY | |
58 | #define WLAN_EID_COUNTRY 7 | |
59 | #endif | |
60 | ||
61 | /* P2P (Wi-Fi Direct) */ | |
62 | #define SLSI_P2P_WILDCARD_SSID "DIRECT-" | |
63 | #define SLSI_P2P_WILDCARD_SSID_LENGTH 7 | |
64 | #define SLSI_P2P_SOCIAL_CHAN_COUNT 3 | |
65 | ||
66 | /* A join scan with P2P GO SSID can come and hence the SSID length comparision should include >= */ | |
67 | #define SLSI_IS_P2P_SSID(ssid, ssid_len) ((ssid_len >= SLSI_P2P_WILDCARD_SSID_LENGTH) && \ | |
68 | (memcmp(ssid, SLSI_P2P_WILDCARD_SSID, SLSI_P2P_WILDCARD_SSID_LENGTH) == 0)) | |
69 | ||
70 | /* Action frame categories for registering with firmware */ | |
71 | #define SLSI_ACTION_FRAME_PUBLIC (1 << 4) | |
72 | #define SLSI_ACTION_FRAME_VENDOR_SPEC_PROTECTED (1 << 30) | |
73 | #define SLSI_ACTION_FRAME_VENDOR_SPEC (1 << 31) | |
74 | #define SLSI_ACTION_FRAME_WMM (1 << 17) | |
75 | #define SLSI_ACTION_FRAME_WNM (1 << 10) | |
76 | #define SLSI_ACTION_FRAME_QOS (1 << 1) | |
77 | #define SLSI_ACTION_FRAME_PROTECTED_DUAL BIT(9) | |
78 | #define SLSI_ACTION_FRAME_RADIO_MEASUREMENT BIT(5) | |
79 | ||
80 | /* Firmware transmit rates */ | |
81 | #define SLSI_TX_RATE_NON_HT_1MBPS 0x4001 | |
82 | #define SLSI_TX_RATE_NON_HT_6MBPS 0x4004 | |
83 | #define SLSI_ROAMING_CHANNELS_MAX 38 | |
84 | ||
85 | #define SLSI_WLAN_EID_WAPI 68 | |
86 | ||
87 | /** | |
88 | * If availability_duration is set to SLSI_FW_CHANNEL_DURATION_UNSPECIFIED | |
89 | * then the firmware autonomously decides how long to remain listening on | |
90 | * the configured channel. | |
91 | */ | |
92 | #define SLSI_FW_CHANNEL_DURATION_UNSPECIFIED (0x0000) | |
93 | extern struct ieee80211_supported_band slsi_band_2ghz; | |
94 | extern struct ieee80211_supported_band slsi_band_5ghz; | |
95 | extern struct ieee80211_sta_vht_cap slsi_vht_cap; | |
96 | ||
97 | /* Packet Filtering */ | |
98 | #define SLSI_MAX_PATTERN_DESC 4 /* We are not using more than 4 pattern descriptors in a pkt filter*/ | |
99 | #define SLSI_PKT_DESC_FIXED_LEN 2 /* offset (1) + mask length (1)*/ | |
100 | #define SLSI_PKT_FILTER_ELEM_FIXED_LEN 6 /* oui(3) + oui type(1) + filter id (1) + pkt filter mode(1)*/ | |
101 | #define SLSI_PKT_FILTER_ELEM_HDR_LEN (2 + SLSI_PKT_FILTER_ELEM_FIXED_LEN) /* element id + len + SLSI_PKT_FILTER_ELEM_FIXED_LEN*/ | |
102 | #define SLSI_MAX_PATTERN_LENGTH 6 | |
103 | ||
104 | /*Default values of MIBS params for GET_STA_INFO driver private command */ | |
105 | #define SLSI_DEFAULT_UNIFI_PEER_RX_RETRY_PACKETS 0 | |
106 | #define SLSI_DEFAULT_UNIFI_PEER_RX_BC_MC_PACKETS 0 | |
107 | #define SLSI_DEFAULT_UNIFI_PEER_BANDWIDTH -1 | |
108 | #define SLSI_DEFAULT_UNIFI_PEER_NSS 0 | |
109 | #define SLSI_DEFAULT_UNIFI_PEER_RSSI 1 | |
110 | #define SLSI_DEFAULT_UNIFI_PEER_TX_DATA_RATE 0 | |
111 | ||
112 | #define SLSI_CHECK_TYPE(sdev, recv_type, exp_type) \ | |
113 | do { \ | |
114 | int var1 = recv_type; \ | |
115 | int var2 = exp_type; \ | |
116 | if (var1 != var2) { \ | |
117 | SLSI_WARN(sdev, "Type mismatched, expected type: %d and received type %d ", var2, var1); \ | |
118 | } \ | |
119 | } while (0) | |
120 | ||
121 | ||
122 | struct slsi_mlme_pattern_desc { | |
123 | u8 offset; | |
124 | u8 mask_length; | |
125 | u8 mask[SLSI_MAX_PATTERN_LENGTH]; | |
126 | u8 pattern[SLSI_MAX_PATTERN_LENGTH]; | |
127 | }; | |
128 | ||
129 | struct slsi_mlme_pkt_filter_elem { | |
130 | u8 header[SLSI_PKT_FILTER_ELEM_HDR_LEN]; | |
131 | u8 num_pattern_desc; | |
132 | struct slsi_mlme_pattern_desc pattern_desc[SLSI_MAX_PATTERN_DESC]; | |
133 | }; | |
134 | ||
135 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 9)) | |
136 | u16 slsi_get_chann_info(struct slsi_dev *sdev, struct cfg80211_chan_def *chandef); | |
137 | int slsi_check_channelization(struct slsi_dev *sdev, struct cfg80211_chan_def *chandef, | |
138 | int wifi_sharing_channel_switched); | |
139 | #else | |
140 | u16 slsi_get_chann_info(struct slsi_dev *sdev, enum nl80211_channel_type channel_type); | |
141 | int slsi_check_channelization(struct slsi_dev *sdev, enum nl80211_channel_type channel_type); | |
142 | #endif | |
143 | ||
144 | int slsi_mlme_set_ip_address(struct slsi_dev *sdev, struct net_device *dev); | |
145 | #ifndef CONFIG_SCSC_WLAN_BLOCK_IPV6 | |
146 | int slsi_mlme_set_ipv6_address(struct slsi_dev *sdev, struct net_device *dev); | |
147 | #endif | |
148 | int slsi_mlme_set(struct slsi_dev *sdev, struct net_device *dev, u8 *req, int req_len); | |
149 | int slsi_mlme_get(struct slsi_dev *sdev, struct net_device *dev, u8 *req, int req_len, | |
150 | u8 *resp, int resp_buf_len, int *resp_len); | |
151 | ||
152 | int slsi_mlme_add_vif(struct slsi_dev *sdev, struct net_device *dev, u8 *interface_address, u8 *device_address); | |
153 | void slsi_mlme_del_vif(struct slsi_dev *sdev, struct net_device *dev); | |
154 | #ifdef CONFIG_SLSI_WLAN_STA_FWD_BEACON | |
155 | int slsi_mlme_set_forward_beacon(struct slsi_dev *sdev, struct net_device *dev, int action); | |
156 | #endif | |
157 | int slsi_mlme_set_channel(struct slsi_dev *sdev, struct net_device *dev, struct ieee80211_channel *chan, u16 duration, u16 interval, u16 count); | |
158 | void slsi_ap_obss_scan_done_ind(struct net_device *dev, struct netdev_vif *ndev_vif); | |
159 | ||
160 | int slsi_mlme_unset_channel_req(struct slsi_dev *sdev, struct net_device *dev); | |
161 | ||
162 | u16 slsi_compute_chann_info(struct slsi_dev *sdev, u16 width, u16 center_freq0, u16 channel_freq); | |
163 | /** | |
164 | * slsi_mlme_add_autonomous_scan() Returns: | |
165 | * 0 : Scan installed | |
166 | * >0 : Scan NOT installed. Not an Error | |
167 | * <0 : Scan NOT installed. Error | |
168 | */ | |
169 | int slsi_mlme_add_scan(struct slsi_dev *sdev, | |
170 | struct net_device *dev, | |
171 | u16 scan_type, | |
172 | u16 report_mode, | |
173 | u32 n_ssids, | |
174 | struct cfg80211_ssid *ssids, | |
175 | u32 n_channels, | |
176 | struct ieee80211_channel *channels[], | |
177 | void *gscan_param, | |
178 | const u8 *ies, | |
179 | u16 ies_len, | |
180 | bool wait_for_ind); | |
181 | ||
182 | int slsi_mlme_add_sched_scan(struct slsi_dev *sdev, | |
183 | struct net_device *dev, | |
184 | struct cfg80211_sched_scan_request *request, | |
185 | const u8 *ies, | |
186 | u16 ies_len); | |
187 | ||
188 | int slsi_mlme_del_scan(struct slsi_dev *sdev, struct net_device *dev, u16 scan_id, bool scan_timed_out); | |
189 | int slsi_mlme_start(struct slsi_dev *sdev, struct net_device *dev, u8 *bssid, struct cfg80211_ap_settings *settings, const u8 *wpa_ie_pos, const u8 *wmm_ie_pos, bool append_vht_ies); | |
190 | int slsi_mlme_connect(struct slsi_dev *sdev, struct net_device *dev, struct cfg80211_connect_params *sme, struct ieee80211_channel *channel, const u8 *bssid); | |
191 | int slsi_mlme_set_key(struct slsi_dev *sdev, struct net_device *dev, u16 key_id, u16 key_type, const u8 *address, struct key_params *key); | |
192 | int slsi_mlme_get_key(struct slsi_dev *sdev, struct net_device *dev, u16 key_id, u16 key_type, u8 *seq, int *seq_len); | |
193 | ||
194 | /** | |
195 | * Sends MLME-DISCONNECT-REQ and waits for the MLME-DISCONNECT-CFM | |
196 | * MLME-DISCONNECT-CFM only indicates if the firmware has accepted the request (or not) | |
197 | * the actual end of the disconnection is indicated by the firmware sending | |
198 | * MLME-DISCONNECT-IND (following a successful MLME-DISCONNECT-CFM). | |
199 | * The host has to wait for the full exchange to complete with the firmware before | |
200 | * returning to cfg80211 if it made the disconnect request. Due to this, this function | |
201 | * waits for both the MLME-DISCONNECT-CFM and the MLME-DISCONNECT-IND (if the | |
202 | * MLME-DISCONNECT-CFM was successful) | |
203 | */ | |
204 | int slsi_mlme_disconnect(struct slsi_dev *sdev, struct net_device *dev, u8 *bssid, u16 reason_code, bool wait_ind); | |
205 | ||
206 | int slsi_mlme_req(struct slsi_dev *sdev, struct net_device *dev, struct sk_buff *skb); | |
207 | struct sk_buff *slsi_mlme_req_no_cfm(struct slsi_dev *sdev, struct net_device *dev, struct sk_buff *skb); | |
208 | ||
209 | struct sk_buff *slsi_mlme_req_ind(struct slsi_dev *sdev, struct net_device *dev, struct sk_buff *skb, u16 ind_id); | |
210 | /* Reads multiple MIB data related to station info. returns 0 if success else errno*/ | |
211 | int slsi_mlme_get_sinfo_mib(struct slsi_dev *sdev, struct net_device *dev, | |
212 | struct slsi_peer *peer); | |
213 | ||
214 | int slsi_mlme_connect_scan(struct slsi_dev *sdev, struct net_device *dev, | |
215 | u32 n_ssids, struct cfg80211_ssid *ssids, struct ieee80211_channel *channel); | |
216 | int slsi_mlme_powermgt(struct slsi_dev *sdev, struct net_device *dev, u16 ps_mode); | |
217 | int slsi_mlme_powermgt_unlocked(struct slsi_dev *sdev, struct net_device *dev, u16 ps_mode); | |
218 | int slsi_mlme_register_action_frame(struct slsi_dev *sdev, struct net_device *dev, u32 af_bitmap_active, u32 af_bitmap_suspended); | |
219 | #ifdef CONFIG_SCSC_WLAN_SAE_CONFIG | |
220 | int slsi_mlme_synchronised_response(struct slsi_dev *sdev, struct net_device *dev, | |
221 | struct cfg80211_external_auth_params *params); | |
222 | #endif | |
223 | int slsi_mlme_channel_switch(struct slsi_dev *sdev, struct net_device *dev, u16 center_freq, u16 chan_info); | |
224 | int slsi_mlme_add_info_elements(struct slsi_dev *sdev, struct net_device *dev, u16 purpose, const u8 *ies, const u16 ies_len); | |
225 | int slsi_mlme_send_frame_mgmt(struct slsi_dev *sdev, struct net_device *dev, const u8 *frame, int frame_len, u16 data_desc, u16 msg_type, u16 host_tag, u16 freq, u32 dwell_time, u32 period); | |
226 | int slsi_mlme_send_frame_data(struct slsi_dev *sdev, struct net_device *dev, struct sk_buff *skb, u16 msg_type, | |
227 | u16 host_tag, u32 dwell_time, u32 period); | |
228 | int slsi_mlme_reset_dwell_time(struct slsi_dev *sdev, struct net_device *dev); | |
229 | int slsi_mlme_set_packet_filter(struct slsi_dev *sdev, struct net_device *dev, int pkt_filter_len, u8 num_filters, struct slsi_mlme_pkt_filter_elem *pkt_filter_elems); | |
230 | void slsi_mlme_connect_resp(struct slsi_dev *sdev, struct net_device *dev); | |
231 | void slsi_mlme_connected_resp(struct slsi_dev *sdev, struct net_device *dev, u16 peer_index); | |
232 | void slsi_mlme_roamed_resp(struct slsi_dev *sdev, struct net_device *dev); | |
233 | int slsi_mlme_set_pmk(struct slsi_dev *sdev, struct net_device *dev, const u8 *pmk, u16 pmklen); | |
234 | int slsi_mlme_roam(struct slsi_dev *sdev, struct net_device *dev, const u8 *bssid, u16 freq); | |
235 | int slsi_mlme_set_cached_channels(struct slsi_dev *sdev, struct net_device *dev, u32 channels_count, u8 *channels); | |
236 | int slsi_mlme_tdls_peer_resp(struct slsi_dev *sdev, struct net_device *dev, u16 pid, u16 tdls_event); | |
237 | int slsi_mlme_tdls_action(struct slsi_dev *sdev, struct net_device *dev, const u8 *peer, int action, u16 center_freq, u16 chan_info); | |
238 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 9)) | |
239 | int slsi_mlme_set_acl(struct slsi_dev *sdev, struct net_device *dev, u16 ifnum, const struct cfg80211_acl_data *params); | |
240 | #endif | |
241 | int slsi_mlme_set_traffic_parameters(struct slsi_dev *sdev, struct net_device *dev, u16 user_priority, u16 medium_time, u16 minimun_data_rate, u8 *mac); | |
242 | int slsi_mlme_del_traffic_parameters(struct slsi_dev *sdev, struct net_device *dev, u16 user_priority); | |
243 | ||
244 | #ifdef CONFIG_SCSC_WLAN_GSCAN_ENABLE | |
245 | int slsi_mlme_set_pno_list(struct slsi_dev *sdev, int count, | |
246 | struct slsi_epno_param *epno_param, struct slsi_epno_hs2_param *epno_hs2_param); | |
247 | int slsi_mlme_start_link_stats_req(struct slsi_dev *sdev, u16 mpdu_size_threshold, bool aggressive_statis_enabled); | |
248 | int slsi_mlme_stop_link_stats_req(struct slsi_dev *sdev, u16 stats_stop_mask); | |
781f598d | 249 | #ifdef CONFIG_SCSC_WIFI_NAN_ENABLE |
533a23a1 TK |
250 | int slsi_mlme_nan_enable(struct slsi_dev *sdev, struct net_device *dev, struct slsi_hal_nan_enable_req *hal_req); |
251 | int slsi_mlme_nan_publish(struct slsi_dev *sdev, struct net_device *dev, struct slsi_hal_nan_publish_req *hal_req, | |
252 | u16 publish_id); | |
253 | int slsi_mlme_nan_subscribe(struct slsi_dev *sdev, struct net_device *dev, struct slsi_hal_nan_subscribe_req *hal_req, | |
254 | u16 subscribe_id); | |
255 | int slsi_mlme_nan_tx_followup(struct slsi_dev *sdev, struct net_device *dev, | |
256 | struct slsi_hal_nan_transmit_followup_req *hal_req); | |
257 | int slsi_mlme_nan_set_config(struct slsi_dev *sdev, struct net_device *dev, struct slsi_hal_nan_config_req *hal_req); | |
781f598d TK |
258 | int slsi_mlme_ndp_request(struct slsi_dev *sdev, struct net_device *dev, |
259 | struct slsi_hal_nan_data_path_initiator_req *hal_req, u32 ndp_id, u16 ndl_vif_id); | |
260 | int slsi_mlme_ndp_response(struct slsi_dev *sdev, struct net_device *dev, | |
261 | struct slsi_hal_nan_data_path_indication_response *hal_req, u16 local_ndp_id); | |
262 | int slsi_mlme_ndp_terminate(struct slsi_dev *sdev, struct net_device *dev, u16 ndp_id); | |
263 | #endif | |
533a23a1 TK |
264 | #endif |
265 | ||
266 | int slsi_mlme_set_ext_capab(struct slsi_dev *sdev, struct net_device *dev, struct slsi_mib_value *mib_val); | |
267 | int slsi_mlme_set_hs2_ext_cap(struct slsi_dev *sdev, struct net_device *dev, const u8 *ies, int ie_len); | |
268 | int slsi_mlme_reassociate(struct slsi_dev *sdev, struct net_device *dev); | |
269 | void slsi_mlme_reassociate_resp(struct slsi_dev *sdev, struct net_device *dev); | |
270 | int slsi_modify_ies(struct net_device *dev, u8 eid, u8 *ies, int ies_len, u8 ie_index, u8 ie_value); | |
271 | int slsi_mlme_set_rssi_monitor(struct slsi_dev *sdev, struct net_device *dev, u8 enable, s8 low_rssi_threshold, s8 high_rssi_threshold); | |
272 | struct slsi_mib_value *slsi_read_mibs(struct slsi_dev *sdev, struct net_device *dev, struct slsi_mib_get_entry *mib_entries, int mib_count, struct slsi_mib_data *mibrsp); | |
273 | int slsi_mlme_set_host_state(struct slsi_dev *sdev, struct net_device *dev, u8 host_state); | |
274 | int slsi_mlme_read_apf_request(struct slsi_dev *sdev, struct net_device *dev, u8 **host_dst, int *datalen); | |
275 | int slsi_mlme_install_apf_request(struct slsi_dev *sdev, struct net_device *dev, | |
276 | u8 *program, u32 program_len); | |
277 | #ifdef CONFIG_SCSC_WLAN_STA_ENHANCED_ARP_DETECT | |
278 | int slsi_mlme_arp_detect_request(struct slsi_dev *sdev, struct net_device *dev, u16 action, u8 *ipaddr); | |
279 | #endif | |
280 | int slsi_mlme_set_ctwindow(struct slsi_dev *sdev, struct net_device *dev, unsigned int ct_param); | |
281 | int slsi_mlme_set_p2p_noa(struct slsi_dev *sdev, struct net_device *dev, unsigned int noa_count, | |
282 | unsigned int interval, unsigned int duration); | |
283 | void slsi_decode_fw_rate(u16 fw_rate, struct rate_info *rate, unsigned long *data_rate_mbps); | |
284 | int slsi_test_sap_configure_monitor_mode(struct slsi_dev *sdev, struct net_device *dev, struct cfg80211_chan_def *chandef); | |
285 | ||
286 | struct sk_buff *slsi_mlme_req_cfm(struct slsi_dev *sdev, struct net_device *dev, struct sk_buff *skb, u16 cfm_id); | |
781f598d TK |
287 | int slsi_mlme_set_country(struct slsi_dev *sdev, char *alpha2); |
288 | ||
289 | #ifdef CONFIG_SCSC_WLAN_SILENT_RECOVERY | |
290 | void slsi_mlme_set_country_for_recovery(struct slsi_dev *sdev); | |
291 | #endif | |
533a23a1 TK |
292 | |
293 | #endif /*__SLSI_MLME_H__*/ |