[RAMEN9610-20413][9610] wlbt: SCSC Driver version 10.6.1.0
[GitHub/MotorolaMobilityLLC/kernel-slsi.git] / drivers / net / wireless / scsc / mgt.h
1 /******************************************************************************
2 *
3 * Copyright (c) 2012 - 2019 Samsung Electronics Co., Ltd. All rights reserved
4 *
5 *****************************************************************************/
6
7 #ifndef __SLSI_MGT_H__
8 #define __SLSI_MGT_H__
9
10 #include <linux/mutex.h>
11
12 #include "dev.h"
13 #include "debug.h"
14
15 /* For 3.4.11 kernel support */
16 #ifndef WLAN_OUI_MICROSOFT
17 #define WLAN_OUI_MICROSOFT 0x0050f2
18 #define WLAN_OUI_TYPE_MICROSOFT_WPA 1
19 #define WLAN_OUI_TYPE_MICROSOFT_WMM 2
20 #define WLAN_OUI_TYPE_MICROSOFT_WPS 4
21 #endif
22
23 #define SLSI_COUNTRY_CODE_LEN 3
24
25 #define SLSI_EAPOL_TYPE_RSN_KEY (2)
26 #define SLSI_EAPOL_TYPE_WPA_KEY (254)
27
28 #define SLSI_IEEE8021X_TYPE_EAPOL_KEY 3
29 #define SLSI_IEEE8021X_TYPE_EAP_PACKET 0
30
31 #define SLSI_EAPOL_KEY_INFO_KEY_TYPE_BIT_IN_LOWER_BYTE BIT(3) /* Group = 0, Pairwise = 1 */
32 #define SLSI_EAPOL_KEY_INFO_ACK_BIT_IN_LOWER_BYTE BIT(7)
33 #define SLSI_EAPOL_KEY_INFO_MIC_BIT_IN_HIGHER_BYTE BIT(0)
34 #define SLSI_EAPOL_KEY_INFO_SECURE_BIT_IN_HIGHER_BYTE BIT(1)
35 /* pkt_data would start from 802.1X Authentication field (pkt_data[0] = Version).
36 * For M4 packet, it will be something as below... member(size, position)
37 * Version (1, 0) + Type (1, 1) + Length (2, 2:3) + Descriptor Type (1, 4) + Key Information (2, 5:6) +
38 * key_length(2, 7:8) + replay_counter(8, 9:16) + key_nonce(32, 17:48) + key_iv(16, 49:64) +
39 * key_rsc (8, 65:72) + key_id(16, 73:80) + key_mic (16, 81:96) + key_data_length(2, 97:98) +
40 * keydata(key_data_length, 99:99+key_data_length)
41 */
42 #define SLSI_EAPOL_IEEE8021X_TYPE_POS (1)
43 #define SLSI_EAPOL_TYPE_POS (4)
44 #define SLSI_EAPOL_KEY_INFO_HIGHER_BYTE_POS (5)
45 #define SLSI_EAPOL_KEY_INFO_LOWER_BYTE_POS (6)
46 #define SLSI_EAPOL_KEY_DATA_LENGTH_HIGHER_BYTE_POS (97)
47 #define SLSI_EAPOL_KEY_DATA_LENGTH_LOWER_BYTE_POS (98)
48
49 #define SLSI_EAP_CODE_POS (4)
50 #define SLSI_EAP_PACKET_REQUEST (1)
51 #define SLSI_EAP_PACKET_RESPONSE (2)
52 #define SLSI_EAP_PACKET_SUCCESS (3)
53 #define SLSI_EAP_PACKET_FAILURE (4)
54 #define SLSI_EAP_TYPE_POS (8)
55 #define SLSI_EAP_TYPE_EXPANDED (254)
56 #define SLSI_EAP_OPCODE_POS (16)
57 #define SLSI_EAP_OPCODE_WSC_MSG (4)
58 #define SLSI_EAP_OPCODE_WSC_START (1)
59 #define SLSI_EAP_MSGTYPE_POS (27)
60 #define SLSI_EAP_MSGTYPE_M8 (12)
61 #define SLSI_EAP_WPS_DWELL_TIME (100000) /*100 ms */
62 #define SLSI_EAP_TYPE_IDENTITY (1)
63
64 #define SLSI_80211_AC_VO 0
65 #define SLSI_80211_AC_VI 1
66 #define SLSI_80211_AC_BE 2
67 #define SLSI_80211_AC_BK 3
68
69 /* IF Number (Index) based checks */
70 #define SLSI_IS_VIF_INDEX_WLAN(ndev_vif) (ndev_vif->ifnum == SLSI_NET_INDEX_WLAN)
71 #define SLSI_IS_VIF_INDEX_P2P(ndev_vif) (ndev_vif->ifnum == SLSI_NET_INDEX_P2P)
72 #ifdef CONFIG_SCSC_WLAN_WIFI_SHARING
73 #define SLSI_IS_VIF_INDEX_P2P_GROUP(sdev, ndev_vif) ((ndev_vif->ifnum == SLSI_NET_INDEX_P2PX_SWLAN) &&\
74 (sdev->netdev_ap != sdev->netdev[SLSI_NET_INDEX_P2PX_SWLAN]))
75 #define SLSI_IS_VIF_INDEX_MHS(sdev, ndev_vif) ((ndev_vif->ifnum == SLSI_NET_INDEX_P2PX_SWLAN) &&\
76 (sdev->netdev_ap == sdev->netdev[SLSI_NET_INDEX_P2PX_SWLAN]))
77 #else
78 #define SLSI_IS_VIF_INDEX_P2P_GROUP(sdev, ndev_vif) (ndev_vif->ifnum == SLSI_NET_INDEX_P2PX_SWLAN)
79 #endif
80 #define SLSI_IS_VIF_INDEX_NAN(ndev_vif) ((ndev_vif)->ifnum == SLSI_NET_INDEX_NAN)
81
82 /* Check for P2P unsync vif type */
83 #define SLSI_IS_P2P_UNSYNC_VIF(ndev_vif) ((ndev_vif->ifnum == SLSI_NET_INDEX_P2P) && (ndev_vif->vif_type == FAPI_VIFTYPE_UNSYNCHRONISED))
84
85 /* Check for HS unsync vif type */
86 #define SLSI_IS_HS2_UNSYNC_VIF(ndev_vif) ((ndev_vif->ifnum == SLSI_NET_INDEX_WLAN) && (ndev_vif->vif_type == FAPI_VIFTYPE_UNSYNCHRONISED))
87
88 /* Check for P2P Group role */
89 #define SLSI_IS_P2P_GROUP_STATE(sdev) ((sdev->p2p_state == P2P_GROUP_FORMED_GO) || (sdev->p2p_state == P2P_GROUP_FORMED_CLI))
90
91 /* Extra delay to wait after MLME-Roam.Response before obtaining roam reports */
92 #define SLSI_STA_ROAM_REPORT_EXTRA_DELAY_MSEC 50
93
94 /* Extra duration in addition to ROC duration - For any workqueue scheduling delay */
95 #define SLSI_P2P_ROC_EXTRA_MSEC 10
96
97 /* Extra duration to retain unsync vif even after ROC/mgmt_tx completes */
98 #define SLSI_P2P_UNSYNC_VIF_EXTRA_MSEC 2000
99 /* Extra duration to retain HS2 unsync vif even after mgmt_tx completes */
100 #define SLSI_HS2_UNSYNC_VIF_EXTRA_MSEC 1000
101
102 /* Increased wait duration to retain unsync vif for GO-Negotiated to complete
103 * due to delayed response or, to allow peer to retry GO-Negotiation
104 */
105 #define SLSI_P2P_NEG_PROC_UNSYNC_VIF_RETAIN_DURATION 3000
106
107 /* Increased wait duration to send unset channel to Fw.
108 * This would increase the listen time.
109 */
110 #define SLSI_P2P_UNSET_CHANNEL_EXTRA_MSEC 600
111 /* Extra duration in addition to mgmt tx wait */
112 #define SLSI_P2P_MGMT_TX_EXTRA_MSEC 100
113
114 #define SLSI_FORCE_SCHD_ACT_FRAME_MSEC 100
115 #define SLSI_P2PGO_KEEP_ALIVE_PERIOD_SEC 10
116 #define SLSI_P2PGC_CONN_TIMEOUT_MSEC 10000
117
118 /* P2P Public Action Frames */
119 #define SLSI_P2P_PA_GO_NEG_REQ 0
120 #define SLSI_P2P_PA_GO_NEG_RSP 1
121 #define SLSI_P2P_PA_GO_NEG_CFM 2
122 #define SLSI_P2P_PA_INV_REQ 3
123 #define SLSI_P2P_PA_INV_RSP 4
124 #define SLSI_P2P_PA_DEV_DISC_REQ 5
125 #define SLSI_P2P_PA_DEV_DISC_RSP 6
126 #define SLSI_P2P_PA_PROV_DISC_REQ 7
127 #define SLSI_P2P_PA_PROV_DISC_RSP 8
128 #define SLSI_P2P_PA_INVALID 0xFF
129
130 /* Service discovery public action frame types */
131 #define SLSI_PA_GAS_INITIAL_REQ (10)
132 #define SLSI_PA_GAS_INITIAL_RSP (11)
133 #define SLSI_PA_GAS_COMEBACK_REQ (12)
134 #define SLSI_PA_GAS_COMEBACK_RSP (13)
135
136 /*Radio Measurement action frames types */
137 #define SLSI_RM_RADIO_MEASUREMENT_REQ (0)
138 #define SLSI_RM_RADIO_MEASUREMENT_REP (1)
139 #define SLSI_RM_LINK_MEASUREMENT_REQ (2)
140 #define SLSI_RM_LINK_MEASUREMENT_REP (3)
141 #define SLSI_RM_NEIGH_REP_REQ (4)
142 #define SLSI_RM_NEIGH_REP_RSP (5)
143
144 #define SLSI_WNM_ACTION_FIELD_MIN (0)
145 #define SLSI_WNM_ACTION_FIELD_MAX (27)
146
147 /* For service discovery action frames dummy subtype is used by setting the 7th bit */
148 #define SLSI_PA_GAS_DUMMY_SUBTYPE_MASK 0x80
149 #define SLSI_PA_GAS_INITIAL_REQ_SUBTYPE (SLSI_PA_GAS_INITIAL_REQ | SLSI_PA_GAS_DUMMY_SUBTYPE_MASK)
150 #define SLSI_PA_GAS_INITIAL_RSP_SUBTYPE (SLSI_PA_GAS_INITIAL_RSP | SLSI_PA_GAS_DUMMY_SUBTYPE_MASK)
151 #define SLSI_PA_GAS_COMEBACK_REQ_SUBTYPE (SLSI_PA_GAS_COMEBACK_REQ | SLSI_PA_GAS_DUMMY_SUBTYPE_MASK)
152 #define SLSI_PA_GAS_COMEBACK_RSP_SUBTYPE (SLSI_PA_GAS_COMEBACK_RSP | SLSI_PA_GAS_DUMMY_SUBTYPE_MASK)
153
154 #define SLSI_P2P_STATUS_ATTR_ID 0
155 #define SLSI_P2P_STATUS_CODE_SUCCESS 0
156
157 #define SLSI_ROAMING_CHANNEL_CACHE_TIMEOUT (5 * 60)
158
159 #define SLSI_RX_SEQ_NUM_MASK 0xFFF
160 #define SLSI_RX_VIA_TDLS_LINK 0x8000
161
162 #define SET_ETHERTYPE_PATTERN_DESC(pd, ethertype) \
163 pd.offset = 0x0C; \
164 pd.mask_length = 2; \
165 pd.mask[0] = 0xff; \
166 pd.mask[1] = 0xff; \
167 pd.pattern[0] = ethertype >> 8; \
168 pd.pattern[1] = ethertype & 0xFF
169
170 /* For checking DHCP frame */
171 #define SLSI_IP_TYPE_UDP 0x11
172 #define SLSI_IP_TYPE_OFFSET 23
173 #define SLSI_IP_SOURCE_PORT_OFFSET 34
174 #define SLSI_IP_DEST_PORT_OFFSET 36
175 #define SLSI_DHCP_SERVER_PORT 67
176 #define SLSI_DHCP_CLIENT_PORT 68
177 #define SLSI_DNS_DEST_PORT 53
178 #define SLSI_MDNS_DEST_PORT 5353
179
180 #define SLSI_DHCP_MSG_MAGIC_OFFSET 278
181 #define SLSI_DHCP_OPTION 53
182 #define SLSI_DHCP_MESSAGE_TYPE_DISCOVER 0x01
183 #define SLSI_DHCP_MESSAGE_TYPE_OFFER 0x02
184 #define SLSI_DHCP_MESSAGE_TYPE_REQUEST 0x03
185 #define SLSI_DHCP_MESSAGE_TYPE_DECLINE 0x04
186 #define SLSI_DHCP_MESSAGE_TYPE_ACK 0x05
187 #define SLSI_DHCP_MESSAGE_TYPE_NAK 0x06
188 #define SLSI_DHCP_MESSAGE_TYPE_RELEASE 0x07
189 #define SLSI_DHCP_MESSAGE_TYPE_INFORM 0x08
190 #define SLSI_DHCP_MESSAGE_TYPE_FORCERENEW 0x09
191 #define SLSI_DHCP_MESSAGE_TYPE_INVALID 0x0A
192
193 #ifdef CONFIG_SCSC_WLAN_STA_ENHANCED_ARP_DETECT
194 #define SLSI_MAX_ARP_SEND_FRAME 8
195 #endif
196 #define SLSI_ARP_SRC_IP_ADDR_OFFSET 14
197 #define SLSI_ARP_DEST_IP_ADDR_OFFSET 24
198 #define SLSI_IS_GRATUITOUS_ARP(frame) (!memcmp(&frame[SLSI_ARP_SRC_IP_ADDR_OFFSET],\
199 &frame[SLSI_ARP_DEST_IP_ADDR_OFFSET], 4))
200 #define SLSI_ARP_REPLY_OPCODE 2
201 #define SLSI_ARP_REQUEST_OPCODE 1
202 #define SLSI_ARP_OPCODE_OFFSET 6
203
204 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 4, 0))
205 #define WLAN_CATEGORY_WNM 10
206 #endif
207
208 enum slsi_dhcp_tx {
209 SLSI_TX_IS_NOT_DHCP,
210 SLSI_TX_IS_DHCP_SERVER,
211 SLSI_TX_IS_DHCP_CLIENT
212 };
213
214 enum slsi_fw_regulatory_rule_flags {
215 SLSI_REGULATORY_NO_IR = 1 << 0,
216 SLSI_REGULATORY_DFS = 1 << 1,
217 SLSI_REGULATORY_NO_OFDM = 1 << 2,
218 SLSI_REGULATORY_NO_INDOOR = 1 << 3,
219 SLSI_REGULATORY_NO_OUTDOOR = 1 << 4
220 };
221
222 enum slsi_sta_conn_state {
223 SLSI_STA_CONN_STATE_DISCONNECTED = 0,
224 SLSI_STA_CONN_STATE_CONNECTING = 1,
225 SLSI_STA_CONN_STATE_DOING_KEY_CONFIG = 2,
226 SLSI_STA_CONN_STATE_CONNECTED = 3
227 };
228
229 #if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 13, 0))
230 static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
231 {
232 return !ether_addr_equal(addr1, addr2);
233 }
234 #endif
235
236 /**
237 * Peer record handling:
238 * Records are created/destroyed by the control path eg cfg80211 connect or
239 * when handling a MLME-CONNECT-IND when the VIA is an AP.
240 *
241 * However peer records are also currently accessed from the data path in both
242 * Tx and Rx directions:
243 * Tx - to determine the queueset
244 * Rx - for routing received packets back out to peers
245 *
246 * So the interactions required for the data path:
247 * 1. can NOT block
248 * 2. needs to be as quick as possible
249 */
250 static inline struct slsi_peer *slsi_get_peer_from_mac(struct slsi_dev *sdev, struct net_device *dev, const u8 *mac)
251 {
252 struct netdev_vif *ndev_vif = netdev_priv(dev);
253
254 (void)sdev; /* unused */
255
256 /* Accesses the peer records but doesn't block as called from the data path.
257 * MUST check the valid flag on the record before accessing any other data in the record.
258 * Records are static, so having obtained a pointer the pointer will remain valid
259 * it just maybe the data that it points to gets set to ZERO.
260 */
261
262 if (ndev_vif->vif_type == FAPI_VIFTYPE_STATION) {
263 if (ndev_vif->sta.tdls_enabled) {
264 int i;
265
266 for (i = 1; i < SLSI_TDLS_PEER_INDEX_MAX; i++)
267 if (ndev_vif->peer_sta_record[i] && ndev_vif->peer_sta_record[i]->valid &&
268 compare_ether_addr(ndev_vif->peer_sta_record[i]->address, mac) == 0)
269 return ndev_vif->peer_sta_record[i];
270 }
271 if (ndev_vif->peer_sta_record[SLSI_STA_PEER_QUEUESET] && ndev_vif->peer_sta_record[SLSI_STA_PEER_QUEUESET]->valid)
272 return ndev_vif->peer_sta_record[SLSI_STA_PEER_QUEUESET];
273 } else if (ndev_vif->vif_type == FAPI_VIFTYPE_AP) {
274 int i = 0;
275
276 for (i = 0; i < SLSI_PEER_INDEX_MAX; i++)
277 if (ndev_vif->peer_sta_record[i] && ndev_vif->peer_sta_record[i]->valid &&
278 compare_ether_addr(ndev_vif->peer_sta_record[i]->address, mac) == 0)
279 return ndev_vif->peer_sta_record[i];
280 }
281 return NULL;
282 }
283
284 static inline struct slsi_peer *slsi_get_peer_from_qs(struct slsi_dev *sdev, struct net_device *dev, u16 queueset)
285 {
286 struct netdev_vif *ndev_vif = netdev_priv(dev);
287
288 (void)sdev; /* unused */
289
290 if (!ndev_vif->peer_sta_record[queueset] || !ndev_vif->peer_sta_record[queueset]->valid)
291 return NULL;
292
293 return ndev_vif->peer_sta_record[queueset];
294 }
295
296 static inline bool slsi_is_tdls_peer(struct net_device *dev, struct slsi_peer *peer)
297 {
298 struct netdev_vif *ndev_vif = netdev_priv(dev);
299
300 return (ndev_vif->vif_type == FAPI_VIFTYPE_STATION) && (peer->aid >= SLSI_TDLS_PEER_INDEX_MIN);
301 }
302
303 static inline bool slsi_is_proxy_arp_supported_on_ap(struct sk_buff *assoc_resp_ie)
304 {
305 const u8 *ie = cfg80211_find_ie(WLAN_EID_EXT_CAPABILITY, assoc_resp_ie->data, assoc_resp_ie->len);
306
307 if ((ie) && (ie[1] > 1))
308 return ie[3] & 0x10; /*0: eid, 1: len; 3: proxy arp is 12th bit*/
309
310 return 0;
311 }
312
313 static inline int slsi_cache_ies(const u8 *src_ie, size_t src_ie_len, u8 **dest_ie, size_t *dest_ie_len)
314 {
315 *dest_ie = kmalloc(src_ie_len, GFP_KERNEL);
316 if (*dest_ie == NULL)
317 return -ENOMEM;
318
319 memcpy(*dest_ie, src_ie, src_ie_len);
320 *dest_ie_len = src_ie_len;
321
322 return 0;
323 }
324
325 static inline void slsi_clear_cached_ies(u8 **ie, size_t *ie_len)
326 {
327 if (*ie_len != 0)
328 kfree(*ie);
329 *ie = NULL;
330 *ie_len = 0;
331 }
332
333 /* P2P Public Action frame subtype in text format for debug purposes */
334 static inline char *slsi_p2p_pa_subtype_text(int subtype)
335 {
336 switch (subtype) {
337 case SLSI_P2P_PA_GO_NEG_REQ:
338 return "GO_NEG_REQ";
339 case SLSI_P2P_PA_GO_NEG_RSP:
340 return "GO_NEG_RSP";
341 case SLSI_P2P_PA_GO_NEG_CFM:
342 return "GO_NEG_CFM";
343 case SLSI_P2P_PA_INV_REQ:
344 return "INV_REQ";
345 case SLSI_P2P_PA_INV_RSP:
346 return "INV_RSP";
347 case SLSI_P2P_PA_DEV_DISC_REQ:
348 return "DEV_DISC_REQ";
349 case SLSI_P2P_PA_DEV_DISC_RSP:
350 return "DEV_DISC_RSP";
351 case SLSI_P2P_PA_PROV_DISC_REQ:
352 return "PROV_DISC_REQ";
353 case SLSI_P2P_PA_PROV_DISC_RSP:
354 return "PROV_DISC_RSP";
355 case SLSI_PA_GAS_INITIAL_REQ_SUBTYPE:
356 return "GAS_INITIAL_REQUEST";
357 case SLSI_PA_GAS_INITIAL_RSP_SUBTYPE:
358 return "GAS_INITIAL_RESPONSE";
359 case SLSI_PA_GAS_COMEBACK_REQ_SUBTYPE:
360 return "GAS_COMEBACK_REQUEST";
361 case SLSI_PA_GAS_COMEBACK_RSP_SUBTYPE:
362 return "GAS_COMEBACK_RESPONSE";
363 case SLSI_P2P_PA_INVALID:
364 return "PA_INVALID";
365 default:
366 return "UNKNOWN";
367 }
368 }
369
370 /* Cookie generation and assignment for user space ROC and mgmt_tx request from supplicant */
371 static inline void slsi_assign_cookie_id(u64 *cookie, u64 *counter)
372 {
373 (*cookie) = ++(*counter);
374 if ((*cookie) == 0)
375 (*cookie) = ++(*counter);
376 }
377
378 /* Update P2P Probe Response IEs in driver */
379 static inline void slsi_unsync_vif_set_probe_rsp_ie(struct netdev_vif *ndev_vif, u8 *ies, size_t ies_len)
380 {
381 if (ndev_vif->unsync.probe_rsp_ies_len)
382 kfree(ndev_vif->unsync.probe_rsp_ies);
383 ndev_vif->unsync.probe_rsp_ies = ies;
384 ndev_vif->unsync.probe_rsp_ies_len = ies_len;
385 }
386
387 /* Set management frame tx data of vif */
388 static inline int slsi_set_mgmt_tx_data(struct netdev_vif *ndev_vif, u64 cookie, u16 host_tag, const u8 *buf, size_t buf_len)
389 {
390 u8 *tx_frame = NULL;
391
392 if (buf_len != 0) {
393 tx_frame = kmalloc(buf_len, GFP_KERNEL);
394 if (!tx_frame) {
395 SLSI_NET_ERR(ndev_vif->wdev.netdev, "FAILED to allocate memory for Tx frame\n");
396 return -ENOMEM;
397 }
398 SLSI_NET_DBG3(ndev_vif->wdev.netdev, SLSI_CFG80211, "Copy buffer for tx_status\n");
399 memcpy(tx_frame, buf, buf_len);
400 } else if (ndev_vif->mgmt_tx_data.buf) {
401 SLSI_NET_DBG3(ndev_vif->wdev.netdev, SLSI_CFG80211, "Free buffer of tx_status\n");
402 kfree(ndev_vif->mgmt_tx_data.buf);
403 }
404
405 ndev_vif->mgmt_tx_data.cookie = cookie;
406 ndev_vif->mgmt_tx_data.host_tag = host_tag;
407 ndev_vif->mgmt_tx_data.buf = tx_frame;
408 ndev_vif->mgmt_tx_data.buf_len = buf_len;
409
410 return 0;
411 }
412
413 /**
414 * Handler to queue P2P unsync vif deletion work.
415 */
416 static inline void slsi_p2p_queue_unsync_vif_del_work(struct netdev_vif *ndev_vif, unsigned int delay)
417 {
418 cancel_delayed_work(&ndev_vif->unsync.del_vif_work);
419 queue_delayed_work(ndev_vif->sdev->device_wq, &ndev_vif->unsync.del_vif_work, msecs_to_jiffies(delay));
420 }
421
422 /* Update the new state for P2P. Also log the state change for debug purpose */
423 #define SLSI_P2P_STATE_CHANGE(sdev, next_state) \
424 do { \
425 SLSI_DBG1(sdev, SLSI_CFG80211, "P2P state change: %s -> %s\n", slsi_p2p_state_text(sdev->p2p_state), slsi_p2p_state_text(next_state)); \
426 sdev->p2p_state = next_state; \
427 } while (0)
428
429 void slsi_purge_scan_results(struct netdev_vif *ndev_vif, u16 scan_id);
430 void slsi_purge_scan_results_locked(struct netdev_vif *ndev_vif, u16 scan_id);
431 struct sk_buff *slsi_dequeue_cached_scan_result(struct slsi_scan *scan, int *count);
432 void slsi_get_hw_mac_address(struct slsi_dev *sdev, u8 *addr);
433 int slsi_start(struct slsi_dev *sdev);
434 int slsi_start_monitor_mode(struct slsi_dev *sdev, struct net_device *dev);
435 void slsi_stop_net_dev(struct slsi_dev *sdev, struct net_device *dev);
436 void slsi_stop(struct slsi_dev *sdev);
437 void slsi_stop_locked(struct slsi_dev *sdev);
438 struct slsi_peer *slsi_peer_add(struct slsi_dev *sdev, struct net_device *dev, u8 *peer_address, u16 aid);
439 void slsi_peer_update_assoc_req(struct slsi_dev *sdev, struct net_device *dev, struct slsi_peer *peer, struct sk_buff *skb);
440 void slsi_peer_update_assoc_rsp(struct slsi_dev *sdev, struct net_device *dev, struct slsi_peer *peer, struct sk_buff *skb);
441 void slsi_peer_reset_stats(struct slsi_dev *sdev, struct net_device *dev, struct slsi_peer *peer);
442 int slsi_peer_remove(struct slsi_dev *sdev, struct net_device *dev, struct slsi_peer *peer);
443 int slsi_ps_port_control(struct slsi_dev *sdev, struct net_device *dev, struct slsi_peer *peer, enum slsi_sta_conn_state s);
444 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
445 int slsi_del_station(struct wiphy *wiphy, struct net_device *dev,
446 struct station_del_parameters *del_params);
447 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
448 int slsi_del_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac);
449 #else
450 int slsi_del_station(struct wiphy *wiphy, struct net_device *dev, u8 *mac);
451 #endif
452
453 int slsi_sta_ieee80211_mode(struct net_device *dev, u16 current_bss_channel_frequency);
454 int slsi_vif_activated(struct slsi_dev *sdev, struct net_device *dev);
455 void slsi_vif_deactivated(struct slsi_dev *sdev, struct net_device *dev);
456 int slsi_handle_disconnect(struct slsi_dev *sdev, struct net_device *dev, u8 *peer_address, u16 reason,
457 u8 *disassoc_rsp_ie, u32 disassoc_rsp_ie_len);
458 int slsi_band_update(struct slsi_dev *sdev, int band);
459 int slsi_ip_address_changed(struct slsi_dev *sdev, struct net_device *dev, __be32 ipaddress);
460 int slsi_send_gratuitous_arp(struct slsi_dev *sdev, struct net_device *dev);
461 struct ieee80211_channel *slsi_find_scan_channel(struct slsi_dev *sdev, struct ieee80211_mgmt *mgmt, size_t mgmt_len, u16 freq);
462 int slsi_auto_chan_select_scan(struct slsi_dev *sdev, int chan_count, struct ieee80211_channel *channels[]);
463 int slsi_set_uint_mib(struct slsi_dev *dev, struct net_device *ndev, u16 psid, int value);
464 int slsi_update_regd_rules(struct slsi_dev *sdev, bool country_check);
465 int slsi_set_boost(struct slsi_dev *sdev, struct net_device *dev);
466 int slsi_p2p_init(struct slsi_dev *sdev, struct netdev_vif *ndev_vif);
467 void slsi_p2p_deinit(struct slsi_dev *sdev, struct netdev_vif *ndev_vif);
468 int slsi_p2p_vif_activate(struct slsi_dev *sdev, struct net_device *dev, struct ieee80211_channel *chan, u16 duration, bool set_probe_rsp_ies);
469 void slsi_p2p_vif_deactivate(struct slsi_dev *sdev, struct net_device *dev, bool hw_available);
470 void slsi_p2p_group_start_remove_unsync_vif(struct slsi_dev *sdev);
471 int slsi_p2p_dev_probe_rsp_ie(struct slsi_dev *sdev, struct net_device *dev, u8 *probe_rsp_ie, size_t probe_rsp_ie_len);
472 int slsi_p2p_dev_null_ies(struct slsi_dev *sdev, struct net_device *dev);
473 int slsi_p2p_get_public_action_subtype(const struct ieee80211_mgmt *mgmt);
474 int slsi_p2p_get_go_neg_rsp_status(struct net_device *dev, const struct ieee80211_mgmt *mgmt);
475 u8 slsi_p2p_get_exp_peer_frame_subtype(u8 subtype);
476 int slsi_send_txq_params(struct slsi_dev *sdev, struct net_device *ndev);
477 void slsi_abort_sta_scan(struct slsi_dev *sdev);
478 int slsi_is_dhcp_packet(u8 *data);
479
480 #ifdef CONFIG_SCSC_WLAN_PRIORITISE_IMP_FRAMES
481 int slsi_is_dns_packet(u8 *data);
482 int slsi_is_mdns_packet(u8 *data);
483 int slsi_is_tcp_sync_packet(struct net_device *dev, struct sk_buff *skb);
484 #endif
485
486 #ifdef CONFIG_SCSC_WLAN_ENHANCED_PKT_FILTER
487 int slsi_set_enhanced_pkt_filter(struct net_device *dev, u8 pkt_filter_enable);
488 #endif
489 void slsi_set_packet_filters(struct slsi_dev *sdev, struct net_device *dev);
490 int slsi_update_packet_filters(struct slsi_dev *sdev, struct net_device *dev);
491 int slsi_clear_packet_filters(struct slsi_dev *sdev, struct net_device *dev);
492 int slsi_ap_prepare_add_info_ies(struct netdev_vif *ndev_vif, const u8 *ies, size_t ies_len);
493 int slsi_set_mib_roam(struct slsi_dev *dev, struct net_device *ndev, u16 psid, int value);
494 #ifdef CONFIG_SCSC_WLAN_SET_PREFERRED_ANTENNA
495 int slsi_set_mib_preferred_antenna(struct slsi_dev *dev, u16 value);
496 #endif
497 void slsi_reset_throughput_stats(struct net_device *dev);
498 int slsi_set_mib_rssi_boost(struct slsi_dev *sdev, struct net_device *dev, u16 psid, int index, int boost);
499 #ifdef CONFIG_SCSC_WLAN_LOW_LATENCY_MODE
500 int slsi_set_mib_soft_roaming_enabled(struct slsi_dev *sdev, struct net_device *dev, bool enable);
501 #endif
502 #ifdef CONFIG_SCSC_WLAN_STA_ENHANCED_ARP_DETECT
503 int slsi_read_enhanced_arp_rx_count_by_lower_mac(struct slsi_dev *sdev, struct net_device *dev, u16 psid);
504 void slsi_fill_enhanced_arp_out_of_order_drop_counter(struct netdev_vif *ndev_vif,
505 struct sk_buff *skb);
506 #endif
507 void slsi_modify_ies_on_channel_switch(struct net_device *dev, struct cfg80211_ap_settings *settings,
508 u8 *ds_params_ie, u8 *ht_operation_ie, struct ieee80211_mgmt *mgmt,
509 u16 beacon_ie_head_len);
510 #ifdef CONFIG_SCSC_WLAN_WIFI_SHARING
511 bool slsi_if_valid_wifi_sharing_channel(struct slsi_dev *sdev, int freq);
512 void slsi_extract_valid_wifi_sharing_channels(struct slsi_dev *sdev);
513 int slsi_check_if_non_indoor_non_dfs_channel(struct slsi_dev *sdev, int freq);
514 int slsi_select_wifi_sharing_ap_channel(struct wiphy *wiphy, struct net_device *dev,
515 struct cfg80211_ap_settings *settings, struct slsi_dev *sdev,
516 int *wifi_sharing_channel_switched);
517 int slsi_set_mib_wifi_sharing_5ghz_channel(struct slsi_dev *sdev, u16 psid, int value,
518 int offset, int readbyte, char *arg);
519 int slsi_get_byte_position(int bit);
520 int slsi_check_if_channel_restricted_already(struct slsi_dev *sdev, int channel);
521 #endif
522 struct net_device *slsi_dynamic_interface_create(struct wiphy *wiphy,
523 const char *name,
524 enum nl80211_iftype type,
525 struct vif_params *params);
526 int slsi_get_mib_roam(struct slsi_dev *sdev, u16 psid, int *mib_value);
527 void slsi_roam_channel_cache_add(struct slsi_dev *sdev, struct net_device *dev, struct sk_buff *skb);
528 void slsi_roam_channel_cache_prune(struct net_device *dev, int seconds);
529 int slsi_roaming_scan_configure_channels(struct slsi_dev *sdev, struct net_device *dev, const u8 *ssid, u8 *channels);
530 int slsi_send_max_transmit_msdu_lifetime(struct slsi_dev *dev, struct net_device *ndev, u32 msdu_lifetime);
531 int slsi_read_max_transmit_msdu_lifetime(struct slsi_dev *dev, struct net_device *ndev, u32 *msdu_lifetime);
532 int slsi_read_unifi_countrylist(struct slsi_dev *sdev, u16 psid);
533 int slsi_read_default_country(struct slsi_dev *sdev, u8 *alpha2, u16 index);
534 int slsi_read_disconnect_ind_timeout(struct slsi_dev *sdev, u16 psid);
535 int slsi_read_regulatory_rules(struct slsi_dev *sdev, struct slsi_802_11d_reg_domain *domain_info, const char *alpha2);
536 int slsi_send_acs_event(struct slsi_dev *sdev, struct slsi_acs_selected_channels acs_selected_channels);
537 #ifdef CONFIG_SCSC_WLAN_ENABLE_MAC_RANDOMISATION
538 int slsi_set_mac_randomisation_mask(struct slsi_dev *sdev, u8 *mac_address_mask);
539 #endif
540 int slsi_set_country_update_regd(struct slsi_dev *sdev, const char *alpha2_code, int size);
541 void slsi_clear_offchannel_data(struct slsi_dev *sdev, bool acquire_lock);
542 int slsi_wlan_unsync_vif_activate(struct slsi_dev *sdev, struct net_device *dev,
543 struct ieee80211_channel *chan, u16 duration);
544 void slsi_wlan_unsync_vif_deactivate(struct slsi_dev *sdev, struct net_device *devbool, bool hw_available);
545 int slsi_is_wes_action_frame(const struct ieee80211_mgmt *mgmt);
546 void slsi_scan_ind_timeout_handle(struct work_struct *work);
547 void slsi_vif_cleanup(struct slsi_dev *sdev, struct net_device *dev, bool hw_available);
548 void slsi_scan_cleanup(struct slsi_dev *sdev, struct net_device *dev);
549 void slsi_dump_stats(struct net_device *dev);
550 int slsi_send_hanged_vendor_event(struct slsi_dev *sdev, u16 scsc_panic_code);
551 void slsi_update_supported_channels_regd_flags(struct slsi_dev *sdev);
552 #ifdef CONFIG_SCSC_WLAN_HANG_TEST
553 int slsi_test_send_hanged_vendor_event(struct net_device *dev);
554 #endif
555 #ifdef CONFIG_SLSI_WLAN_STA_FWD_BEACON
556 int slsi_send_forward_beacon_vendor_event(struct slsi_dev *sdev, const u8 *ssid, const int ssid_len, const u8 *bssid,
557 u8 channel, const u16 beacon_int, const u64 timestamp, const u64 sys_time);
558 int slsi_send_forward_beacon_abort_vendor_event(struct slsi_dev *sdev, u16 reason_code);
559 #endif
560 void slsi_wlan_dump_public_action_subtype(struct slsi_dev *sdev, struct ieee80211_mgmt *mgmt, bool tx);
561 void slsi_reset_channel_flags(struct slsi_dev *sdev);
562
563 /* Sysfs based mac address override */
564 void slsi_create_sysfs_macaddr(void);
565 void slsi_destroy_sysfs_macaddr(void);
566 int slsi_find_chan_idx(u16 chan, u8 hw_mode);
567 #ifdef CONFIG_SCSC_WLAN_SET_NUM_ANTENNAS
568 int slsi_set_num_antennas(struct net_device *dev, const u16 num_of_antennas);
569 #endif
570 int slsi_set_latency_mode(struct net_device *dev, int latency_mode, int cmd_len);
571
572 #ifdef CONFIG_SCSC_WLAN_SILENT_RECOVERY
573 int slsi_start_ap(struct wiphy *wiphy, struct net_device *dev,
574 struct cfg80211_ap_settings *settings);
575 void slsi_subsystem_reset(struct work_struct *work);
576 void slsi_failure_reset(struct slsi_dev *sdev);
577 void slsi_chip_recovery(struct slsi_dev *sdev);
578 void slsi_ap_cleanup(struct slsi_dev *sdev, struct net_device *dev);
579 #endif
580
581 #endif /*__SLSI_MGT_H__*/