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