1 /*****************************************************************************
3 * Copyright (c) 2012 - 2019 Samsung Electronics Co., Ltd. All rights reserved
5 ****************************************************************************/
7 #ifndef __SLSI_DEVICE_H__
8 #define __SLSI_DEVICE_H__
10 #include <linux/init.h>
11 #include <linux/device.h>
12 #include <linux/inetdevice.h>
13 #include <net/addrconf.h>
15 #include <linux/version.h>
16 #include <linux/module.h>
17 #include <linux/string.h>
18 #include <linux/kernel.h>
19 #include <linux/netdevice.h>
20 #include <linux/etherdevice.h>
21 #include <linux/ratelimit.h>
24 #include <linux/completion.h>
25 #include <linux/workqueue.h>
26 #include <linux/time.h>
27 #include <linux/sched.h>
29 #include <linux/nl80211.h>
30 #include <linux/wireless.h>
31 #include <linux/proc_fs.h>
32 #include <linux/ieee80211.h>
33 #include <net/cfg80211.h>
34 #include <linux/nl80211.h>
36 #include <scsc/scsc_mx.h>
42 #include "log_clients.h"
44 #include "scsc_wifi_fcq.h"
45 #include "scsc_wifi_cm_if.h"
47 #include "nl80211_vendor.h"
48 #include "traffic_monitor.h"
51 #define FAPI_MAJOR_VERSION(v) (((v) >> 8) & 0xFF)
52 #define FAPI_MINOR_VERSION(v) ((v) & 0xFF)
54 /* Modes for CMDGETBSSINFO and CMDGETSTAINFO */
55 #define SLSI_80211_MODE_11B 0
56 #define SLSI_80211_MODE_11G 1
57 #define SLSI_80211_MODE_11N 2
58 #define SLSI_80211_MODE_11A 3
59 #define SLSI_80211_MODE_11AC 4
61 #define SLSI_FW_API_RATE_HT_SELECTOR_FIELD 0xc000
62 #define SLSI_FW_API_RATE_NON_HT_SELECTED 0x4000
63 #define SLSI_FW_API_RATE_HT_SELECTED 0x8000
64 #define SLSI_FW_API_RATE_VHT_SELECTED 0xc000
66 #define SLSI_FW_API_RATE_VHT_MCS_FIELD 0x000F
67 #define SLSI_FW_API_RATE_HT_MCS_FIELD 0x003F
68 #define SLSI_FW_API_RATE_INDEX_FIELD 0x1fff
69 #define SLSI_FW_API_RATE_VHT_NSS_FIELD 0x0070
70 #define SLSI_FW_API_RATE_HT_NSS_FIELD 0x0040
72 #define SLSI_FW_API_RATE_BW_FIELD 0x0600
73 #define SLSI_FW_API_RATE_BW_40MHZ 0x0200
74 #define SLSI_FW_API_RATE_BW_20MHZ 0x0000
76 #define SLSI_FW_API_RATE_SGI 0x0100
77 #define SLSI_FW_API_RATE_GF 0x0080
79 #define SLSI_HOSTSTATE_LCD_ACTIVE 0x0001
80 #define SLSI_HOSTSTATE_CELLULAR_ACTIVE 0x0002
81 #define SLSI_HOSTSTATE_SAR_ACTIVE 0x0004
82 #define SLSI_HOSTSTATE_GRIP_ACTIVE 0x0040
83 #define SLSI_HOSTSTATE_LOW_LATENCY_ACTIVE 0x0080
85 /* indices: 3= BW20->idx_0, BW40->idx_1, BW80->idx_2.
86 * 2= noSGI->idx_0, SGI->idx_1
89 * This table for single stream Nss=1and does not include 160MHz BW and 80+80MHz BW.
91 static const u16 slsi_rates_table
[3][2][10] = {
94 65, 130, 195, 260, 390, 520, 585, 650, 780, 0
97 72, 144, 217, 289, 433, 578, 650, 722, 867, 0
102 135, 270, 405, 540, 810, 1080, 1215, 1350, 1620, 1800
105 150, 300, 450, 600, 900, 1200, 1350, 1500, 1800, 2000
110 293, 585, 878, 1170, 1755, 2340, 2633, 2925, 3510, 3900
113 325, 650, 975, 1300, 1950, 2600, 2925, 3250, 3900, 4333
117 /* MSDU subframe Header */
119 unsigned char h_dest
[ETH_ALEN
]; /* destination eth addr */
120 unsigned char h_source
[ETH_ALEN
]; /* source ether addr */
121 __be16 len
; /* MSDU Subframe length */
122 unsigned char dsap
; /* DSAP field - SNAP 0xaa */
123 unsigned char ssap
; /* SSAP field - SNAP 0xaa */
124 unsigned char ui
; /* Control field: U, func UI - 0x03 */
125 unsigned char oui
[3]; /* Organization Code - 0x000000 */
126 __be16 type
; /* Type - 0x0800 (IPv4)*/
127 } __attribute__((packed
));
129 static inline void ethr_ii_to_subframe_msdu(struct sk_buff
*skb
)
132 struct msduhdr msduh
;
135 ether_addr_copy(msduh
.h_dest
, ehdr
->h_dest
);
136 ether_addr_copy(msduh
.h_source
, ehdr
->h_source
);
137 /* adjust packet length */
138 msduh
.len
= cpu_to_be16(skb
->len
- 6);
142 memset(msduh
.oui
, 0x0, 3);
143 msduh
.type
= ehdr
->h_proto
;
144 (void)skb_push(skb
, sizeof(struct msduhdr
) - sizeof(struct ethhdr
));
145 /* update SKB mac_header to point to start of MSDU header */
146 skb
->mac_header
-= (sizeof(struct msduhdr
) - sizeof(struct ethhdr
));
147 memcpy(skb
->data
, &msduh
, sizeof(struct msduhdr
));
150 #define SLSI_TX_PROCESS_ID_MIN (0xC001)
151 #define SLSI_TX_PROCESS_ID_MAX (0xCF00)
152 #define SLSI_TX_PROCESS_ID_UDI_MIN (0xCF01)
153 #define SLSI_TX_PROCESS_ID_UDI_MAX (0xCFFE)
155 /* There are no wakelocks in kernel/supplicant/hostapd.
156 * So keep the platform active for some time after receiving any data packet.
157 * This timeout value can be fine-tuned based on the test results.
159 #define SLSI_RX_WAKELOCK_TIME (200)
160 #define MAX_BA_BUFFER_SIZE 64
161 #define NUM_BA_SESSIONS_PER_PEER 8
162 #define MAX_CHANNEL_LIST 20
163 #define SLSI_MAX_RX_BA_SESSIONS (8)
164 #define SLSI_STA_ACTION_FRAME_BITMAP (SLSI_ACTION_FRAME_PUBLIC | SLSI_ACTION_FRAME_WMM | SLSI_ACTION_FRAME_WNM |\
165 SLSI_ACTION_FRAME_QOS | SLSI_ACTION_FRAME_PROTECTED_DUAL |\
166 SLSI_ACTION_FRAME_RADIO_MEASUREMENT)
168 /* Default value for MIB SLSI_PSID_UNIFI_DISCONNECT_TIMEOUT + 1 sec*/
169 #define SLSI_DEFAULT_AP_DISCONNECT_IND_TIMEOUT 3000
171 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
172 #define WLAN_EID_VHT_CAPABILITY 191
173 #define WLAN_EID_VHT_OPERATION 192
176 #define NUM_COUNTRY (300)
178 #ifdef CONFIG_SCSC_WLAN_MUTEX_DEBUG
179 #define SLSI_MUTEX_INIT(slsi_mutex__) \
181 (slsi_mutex__).owner = NULL; \
182 mutex_init(&(slsi_mutex__).mutex); \
183 (slsi_mutex__).valid = true; \
186 #define SLSI_MUTEX_LOCK(slsi_mutex_to_lock) \
188 (slsi_mutex_to_lock).line_no_before = __LINE__; \
189 (slsi_mutex_to_lock).file_name_before = __FILE__; \
190 mutex_lock(&(slsi_mutex_to_lock).mutex); \
191 (slsi_mutex_to_lock).owner = current; \
192 (slsi_mutex_to_lock).line_no_after = __LINE__; \
193 (slsi_mutex_to_lock).file_name_after = __FILE__; \
194 (slsi_mutex_to_lock).function = __func__; \
197 #define SLSI_MUTEX_UNLOCK(slsi_mutex_to_unlock) \
199 (slsi_mutex_to_unlock).owner = NULL; \
200 mutex_unlock(&(slsi_mutex_to_unlock).mutex); \
202 #define SLSI_MUTEX_IS_LOCKED(slsi_mutex__) mutex_is_locked(&(slsi_mutex__).mutex)
207 const u8
*file_name_before
;
211 const u8
*file_name_after
;
213 struct task_struct
*owner
;
217 #define SLSI_MUTEX_INIT(mutex__) mutex_init(&(mutex__))
218 #define SLSI_MUTEX_LOCK(mutex_to_lock) mutex_lock(&(mutex_to_lock))
219 #define SLSI_MUTEX_UNLOCK(mutex_to_unlock) mutex_unlock(&(mutex_to_unlock))
220 #define SLSI_MUTEX_IS_LOCKED(mutex__) mutex_is_locked(&(mutex__))
223 #define OS_UNUSED_PARAMETER(x) ((void)(x))
225 #define SLSI_HOST_TAG_TRAFFIC_QUEUE(htag) (htag & 0x00000003)
227 /* For each mlme-req a mlme-cfm is expected to be received from the
228 * firmware. The host is not allowed to send another mlme-req until
229 * the mlme-cfm is received.
231 * However there are also instances where we need to wait for an mlme-ind
232 * following a mlme-req/cfm exchange. One example of this is the disconnect
234 * mlme-disconnect-req - host requests disconnection
235 * mlme-disconnect-cfm - firmware accepts disconnection request but hasn't
237 * mlme-disconnect-ind - firmware reports final result of disconnection
239 * Assuming that waiting for the mlme-ind following on from the mlme-req/cfm
242 struct slsi_sig_send
{
244 spinlock_t send_signal_lock
;
245 #ifdef CONFIG_SCSC_WLAN_MUTEX_DEBUG
246 struct slsi_mutex mutex
;
251 struct completion completion
;
259 struct sk_buff
*mib_error
;
262 static inline void slsi_sig_send_init(struct slsi_sig_send
*sig_send
)
264 spin_lock_init(&sig_send
->send_signal_lock
);
265 sig_send
->req_id
= 0;
266 sig_send
->cfm_id
= 0;
267 sig_send
->process_id
= SLSI_TX_PROCESS_ID_MIN
;
268 SLSI_MUTEX_INIT(sig_send
->mutex
);
269 init_completion(&sig_send
->completion
);
272 struct slsi_ba_frame_desc
{
274 struct sk_buff
*signal
;
278 struct slsi_ba_session_rx
{
282 struct slsi_ba_frame_desc buffer
[MAX_BA_BUFFER_SIZE
];
287 u16 highest_received_sn
;
288 bool trigger_ba_after_ssn
;
291 /* Aging timer parameters */
293 struct timer_list ba_age_timer
;
294 struct slsi_spinlock ba_lock
;
295 struct net_device
*dev
;
298 #define SLSI_TID_MAX (16)
299 #define SLSI_AMPDU_F_INITIATED (0x0001)
300 #define SLSI_AMPDU_F_CREATED (0x0002)
301 #define SLSI_AMPDU_F_OPERATIONAL (0x0004)
303 #define SLSI_SCAN_HW_ID 0
304 #define SLSI_SCAN_SCHED_ID 1
305 #define SLSI_SCAN_MAX 3
307 #define SLSI_SCAN_SSID_MAP_MAX 10 /* Arbitrary value */
308 #define SLSI_SCAN_SSID_MAP_EXPIRY_AGE 2 /* If hidden bss not found these many scan cycles, remove map. Arbitrary value*/
309 #define SLSI_FW_SCAN_DONE_TIMEOUT_MSEC (15 * 1000)
311 struct slsi_scan_result
{
315 struct sk_buff
*probe_resp
;
316 struct sk_buff
*beacon
;
317 struct slsi_scan_result
*next
;
321 /* Per Interface Scan Data
322 * Access protected by: cfg80211_lock
325 /* When a Scan is running this not NULL. */
326 struct cfg80211_scan_request
*scan_req
;
327 struct slsi_acs_request
*acs_request
;
328 struct cfg80211_sched_scan_request
*sched_req
;
329 bool requeue_timeout_work
;
331 /* Indicates if the scan req is blocking. i.e, waiting until scan_done_ind received */
332 bool is_blocking_scan
;
334 struct slsi_scan_result
*scan_results
; /* head for scan_results list*/
337 struct slsi_ssid_map
{
345 #ifdef CONFIG_SCSC_WLAN_STA_ENHANCED_ARP_DETECT
346 struct slsi_enhanced_arp_counters
{
347 u16 arp_req_count_from_netdev
;
348 u16 arp_req_count_to_lower_mac
;
349 u16 arp_req_rx_count_by_lower_mac
;
350 u16 arp_req_count_tx_success
;
351 u16 arp_rsp_rx_count_by_lower_mac
;
352 u16 arp_rsp_rx_count_by_upper_mac
;
353 u16 arp_rsp_count_to_netdev
;
354 u16 arp_rsp_count_out_of_order_drop
;
356 bool is_duplicate_addr_detected
;
361 /* Flag MUST be set last when creating a record and immediately when removing.
362 * Otherwise another process could test the flag and start using the data.
365 u8 address
[ETH_ALEN
];
367 /* Presently connected_state is used only for AP/GO mode*/
370 /* Presently is_wps is used only in P2P GO mode */
375 struct scsc_wifi_fcq_data_qset data_qs
;
376 struct scsc_wifi_fcq_ctrl_q ctrl_q
;
379 bool pairwise_key_set
;
381 /* Needed for STA/AP VIF */
382 struct sk_buff
*assoc_ie
;
383 struct sk_buff_head buffered_frames
;
384 /* Needed for STA VIF */
385 struct sk_buff
*assoc_resp_ie
;
387 /* bitmask that keeps the status of acm bit for each AC
388 * bit 7 6 5 4 3 2 1 0
390 * vo vo vi vi be bk bk be
393 /* bitmask that keeps the status of tspec establishment for each priority
394 * bit 7 6 5 4 3 2 1 0
396 * p7 p6 p5 p4 p3 p2 p1 p0
398 u8 tspec_established
;
402 * Q: Can we obtain stats from the firmware?
403 * Yes - then this is NOT needed and we can just get from the firmware when requested.
404 * No - How much can we get from the PSCHED?
406 struct station_info sinfo
;
407 /* rate limit for peer sinfo mib reads */
408 struct ratelimit_state sinfo_mib_get_rs
;
409 struct slsi_ba_session_rx
*ba_session_rx
[NUM_BA_SESSIONS_PER_PEER
];
411 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
412 /* qos map configured at peer end*/
414 struct cfg80211_qos_map qos_map
;
419 /* Used to update vif type on vif deactivation indicating vif is no longer available */
420 #define SLSI_VIFTYPE_UNSPECIFIED 0xFFFF
422 struct slsi_vif_mgmt_tx
{
423 u64 cookie
; /* Cookie assigned by Host for the tx mgmt frame */
424 u16 host_tag
; /* Host tag for the tx mgmt frame */
425 const u8
*buf
; /* Buffer - Mgmt frame requested for tx */
426 size_t buf_len
; /* Buffer length */
427 u8 exp_frame
; /* Next expected Public action frame subtype from peer */
436 /* struct slsi_wmm_parameter_element
438 * eid - Vendor Specific
439 * len - Remaining Length of IE
440 * oui - Microsoft OUI
442 * oui_subtype - Param IE
448 struct slsi_wmm_parameter_element
{
457 struct slsi_wmm_ac ac
[4];
460 #define SLSI_MIN_FILTER_ID 0x80 /* Start of filter range reserved for host */
463 #define SLSI_AP_ALL_IPV6_PKTS_FILTER_ID 0x80
465 /* filter IDs for filters installed by driver */
466 #ifdef CONFIG_SCSC_WLAN_BLOCK_IPV6
468 enum slsi_filter_id
{
469 SLSI_LOCAL_ARP_FILTER_ID
= SLSI_MIN_FILTER_ID
, /* 0x80 */
470 SLSI_ALL_BC_MC_FILTER_ID
, /* 0x81 */
471 SLSI_PROXY_ARP_FILTER_ID
, /* 0x82 */
472 SLSI_ALL_IPV6_PKTS_FILTER_ID
, /* 0x83 */
473 #ifndef CONFIG_SCSC_WLAN_DISABLE_NAT_KA
474 SLSI_NAT_IPSEC_FILTER_ID
, /* 0x84 */
476 #ifdef CONFIG_SCSC_WLAN_ENHANCED_PKT_FILTER
477 SLSI_OPT_OUT_ALL_FILTER_ID
, /* 0x85 */
478 SLSI_OPT_IN_TCP4_FILTER_ID
, /* 0x86 */
479 SLSI_OPT_IN_TCP6_FILTER_ID
, /* 0x87 */
481 SLSI_ABNORMAL_MULTICAST_ID
, /* 0x85 / 0x88*/
482 SLSI_ALL_ARP_FILTER_ID
, /* 0x86 / 0x89 */
483 SLSI_REGD_MC_FILTER_ID
, /* 0x87 / 0x8a */
488 enum slsi_filter_id
{
489 SLSI_LOCAL_ARP_FILTER_ID
= SLSI_MIN_FILTER_ID
, /* 0x80 */
490 SLSI_ALL_BC_MC_FILTER_ID
, /* 0x81 */
491 SLSI_PROXY_ARP_FILTER_ID
, /* 0x82 */
492 SLSI_LOCAL_NS_FILTER_ID
, /* 0x83 */
493 SLSI_PROXY_ARP_NA_FILTER_ID
, /* 0x84 */
494 #ifndef CONFIG_SCSC_WLAN_DISABLE_NAT_KA
495 SLSI_NAT_IPSEC_FILTER_ID
, /* 0x85 */
497 #ifdef CONFIG_SCSC_WLAN_ENHANCED_PKT_FILTER
498 SLSI_OPT_OUT_ALL_FILTER_ID
, /* 0x86 */
499 SLSI_OPT_IN_TCP4_FILTER_ID
, /* 0x87 */
500 SLSI_OPT_IN_TCP6_FILTER_ID
, /* 0x88 */
502 SLSI_ABNORMAL_MULTICAST_ID
, /* 0x86 / 0x89 */
503 SLSI_ALL_ARP_FILTER_ID
, /* 0x87 / 0x8a */
504 SLSI_REGD_MC_FILTER_ID
, /* 0x88 / 0x8b */
509 #define SLSI_MAX_PKT_FILTERS 16
511 #ifndef CONFIG_SCSC_WLAN_DISABLE_NAT_KA
513 #define SLSI_MC_ADDR_ENTRY_MAX (SLSI_MIN_FILTER_ID + SLSI_MAX_PKT_FILTERS - SLSI_REGD_MC_FILTER_ID)
515 #define SLSI_MC_ADDR_ENTRY_MAX (SLSI_MIN_FILTER_ID + SLSI_MAX_PKT_FILTERS - SLSI_REGD_MC_FILTER_ID + 1)
518 /* Values for vif_status field
520 * Used to indicate the status of an activated VIF, to help resolve
521 * conflicting activities with indications from the firmware eg.
522 * cfg80211 triggers a disconnection before a STA completes its
523 * connection to an AP.
525 #define SLSI_VIF_STATUS_UNSPECIFIED 0
526 #define SLSI_VIF_STATUS_CONNECTING 1
527 #define SLSI_VIF_STATUS_CONNECTED 2
528 #define SLSI_VIF_STATUS_DISCONNECTING 3
530 /*From wifi_offload.h (N_AVAIL_ID=3)*/
531 #define SLSI_MAX_KEEPALIVE_ID 3
533 struct slsi_last_connected_bss
{
534 u8 address
[ETH_ALEN
];
538 int passpoint_version
;
551 struct slsi_vif_sta
{
552 /* Only valid when the VIF is activated */
557 u16 keepalive_host_tag
[SLSI_MAX_KEEPALIVE_ID
];
559 struct sk_buff
*roam_mlme_procedure_started_ind
;
561 /* This id is used to find out which response (connect resp/roamed resp/reassoc resp)
562 * is to be sent once M4 is transmitted successfully
565 bool gratuitous_arp_needed
;
567 /* regd multicast address*/
568 u8 regd_mc_addr_count
;
569 u8 regd_mc_addr
[SLSI_MC_ADDR_ENTRY_MAX
][ETH_ALEN
];
571 struct sk_buff
*mlme_scan_ind_skb
;
572 bool roam_in_progress
;
573 int tdls_peer_sta_records
;
575 struct cfg80211_bss
*sta_bss
;
576 u8
*assoc_req_add_info_elem
;
577 u8 assoc_req_add_info_elem_len
;
579 /* List of seen ESS and Freq associated with them */
580 struct list_head network_map
;
582 struct slsi_wmm_ac wmm_ac
[4];
583 bool nd_offload_enabled
;
584 unsigned long data_rate_mbps
;
585 unsigned long max_rate_mbps
;
587 /*This structure is used to store last disconnected bss info and valid even when vif is deactivated. */
588 struct slsi_last_connected_bss last_connected_bss
;
589 struct cfg80211_crypto_settings crypto
;
591 /* Variable to indicate if roamed_ind needs to be dropped in driver, to maintain roam synchronization. */
592 atomic_t drop_roamed_ind
;
593 u8
*vendor_disconnect_ies
;
594 int vendor_disconnect_ies_len
;
597 struct slsi_vif_unsync
{
598 struct delayed_work roc_expiry_work
; /* Work on ROC duration expiry */
599 struct delayed_work del_vif_work
; /* Work on unsync vif retention timeout */
600 struct delayed_work hs2_del_vif_work
; /* Work on HS2 unsync vif retention timeout */
601 struct delayed_work unset_channel_expiry_work
; /*unset channel after a timer */
602 u64 roc_cookie
; /* Cookie id for ROC */
603 u8
*probe_rsp_ies
; /* Probe response IEs to be configured in firmware */
604 size_t probe_rsp_ies_len
; /* Probe response IE length */
605 bool ies_changed
; /* To indicate if Probe Response IEs have changed from that previously stored */
606 bool listen_offload
; /* To indicate if Listen Offload is started */
607 bool slsi_p2p_continuous_fullscan
;
610 struct slsi_last_disconnected_sta
{
611 u8 address
[ETH_ALEN
];
612 u32 rx_retry_packets
;
613 u32 rx_bc_mc_packets
;
626 struct slsi_wmm_parameter_element wmm_ie
;
627 struct slsi_last_disconnected_sta last_disconnected_sta
;
633 size_t add_info_ies_len
;
634 bool p2p_gc_keys_set
; /* Used in GO mode to identify that a CLI has connected after WPA2 handshake */
635 bool privacy
; /* Used for port enabling based on the open/secured AP configuration */
637 int beacon_interval
; /* Beacon interval in AP/GO mode */
639 bool non_ht_bss_present
; /* Non HT BSS observed in HT20 OBSS scan */
640 struct scsc_wifi_fcq_data_qset group_data_qs
;
643 u8 ssid
[IEEE80211_MAX_SSID_LEN
];
647 struct slsi_nan_ndl_info
{
648 u8 peer_nmi
[ETH_ALEN
];
652 enum ndp_slot_status
{
653 ndp_slot_status_free
,
654 ndp_slot_status_in_use
,
655 ndp_slot_status_terminating
,
658 struct slsi_vif_nan
{
659 struct slsi_hal_nan_config_req config
;
663 struct slsi_nan_ndl_info ndl_list
[SLSI_NAN_MAX_NDP_INSTANCES
];
664 u8 ndp_ndi
[SLSI_NAN_MAX_NDP_INSTANCES
][ETH_ALEN
];
665 u16 ndp_id2ndl_vif
[SLSI_NAN_MAX_NDP_INSTANCES
];
666 u16 ndp_local_ndp_id
[SLSI_NAN_MAX_NDP_INSTANCES
];
667 enum ndp_slot_status ndp_state
[SLSI_NAN_MAX_NDP_INSTANCES
];
668 u32 followup_trans_id
;
670 u8 disable_cluster_merge
;
671 u16 nan_sdf_flags
[SLSI_NAN_MAX_SERVICE_ID
+1];
672 /* fields used for nan stats/status*/
673 u8 local_nmi
[ETH_ALEN
];
674 u8 cluster_id
[ETH_ALEN
];
675 u32 operating_channel
[2];
677 u8 state
; /* 1 -> nan on; 0 -> nan off */
678 u8 master_pref_value
;
681 u32 random_mac_interval_sec
;
684 #define TCP_ACK_SUPPRESSION_RECORDS_MAX 16
685 #define TCP_ACK_SUPPRESSION_RECORD_UNUSED_TIMEOUT 10 /* in seconds */
687 #define TCP_ACK_SUPPRESSION_OPTIONS_OFFSET 20
688 #define TCP_ACK_SUPPRESSION_OPTION_EOL 0
689 #define TCP_ACK_SUPPRESSION_OPTION_NOP 1
690 #define TCP_ACK_SUPPRESSION_OPTION_MSS 2
691 #define TCP_ACK_SUPPRESSION_OPTION_WINDOW 3
692 #define TCP_ACK_SUPPRESSION_OPTION_SACK 5
694 #define SLSI_IS_VIF_CHANNEL_5G(ndev_vif) (((ndev_vif)->chan) ? ((ndev_vif)->chan->hw_value > 14) : 0)
696 struct slsi_tcp_ack_s
{
701 struct sk_buff_head list
;
702 u8 window_multiplier
;
705 u16 slow_start_count
;
709 struct timer_list timer
;
710 struct slsi_spinlock lock
;
715 /* TCP session throughput monitor */
718 ktime_t last_sample_time
;
721 #ifdef CONFIG_SCSC_WLAN_HIP4_PROFILING
727 struct slsi_tcp_ack_stats
{
744 u32 tack_searchrecord
;
749 struct slsi_dev
*sdev
;
750 struct wireless_dev wdev
;
751 atomic_t is_registered
; /* Has the net dev been registered */
752 bool is_available
; /* Has the net dev been opened AND is usable */
753 bool is_fw_test
; /* Is the device in use as a test device via UDI */
754 #ifdef CONFIG_SLSI_WLAN_STA_FWD_BEACON
755 bool is_wips_running
;
757 /* Structure can be accessed by cfg80211 ops, procfs/ioctls and as a result
758 * of receiving MLME indications e.g. MLME-CONNECT-IND that can affect the
759 * status of the interface eg. STA connect failure will delete the VIF.
761 #ifdef CONFIG_SCSC_WLAN_MUTEX_DEBUG
762 struct slsi_mutex vif_mutex
;
765 struct mutex vif_mutex
;
767 struct slsi_sig_send sig_wait
;
769 struct slsi_skb_work rx_data
;
770 struct slsi_skb_work rx_mlme
;
772 enum nl80211_iftype iftype
;
773 enum nl80211_channel_type channel_type
;
774 struct ieee80211_channel
*chan
;
776 bool drv_in_p2p_procedure
;
777 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 9))
778 struct cfg80211_chan_def
*chandef
;
781 /* NOTE: The Address is a __be32
782 * It needs converting to pass to the FW
783 * But not for the Arp or trace %pI4
787 #ifndef CONFIG_SCSC_WLAN_BLOCK_IPV6
788 struct in6_addr ipv6address
;
789 struct slsi_spinlock ipv6addr_lock
;
791 struct net_device_stats stats
;
792 u32 rx_packets
[SLSI_LLS_AC_MAX
];
793 u32 tx_packets
[SLSI_LLS_AC_MAX
];
794 u32 tx_no_ack
[SLSI_LLS_AC_MAX
];
795 #ifdef CONFIG_SCSC_WLAN_MUTEX_DEBUG
796 struct slsi_mutex scan_mutex
;
797 struct slsi_mutex scan_result_mutex
;
800 struct mutex scan_mutex
;
801 struct mutex scan_result_mutex
;
804 struct slsi_scan scan
[SLSI_SCAN_MAX
];
806 struct slsi_src_sink_params src_sink_params
;
810 bool activated
; /* VIF is created in firmware and ready to use */
812 struct slsi_spinlock peer_lock
;
813 int peer_sta_records
;
814 struct slsi_peer
*peer_sta_record
[SLSI_ADHOC_PEER_CONNECTIONS_MAX
];
816 /* Used to populate the cfg80211 station_info structure generation variable.
817 * This number should increase every time the list of stations changes
818 * i.e. when a station is added or removed, so that userspace can tell
819 * whether it got a consistent snapshot.
821 int cfg80211_sinfo_generation
;
823 /* Block Ack MPDU Re-order */
824 struct sk_buff_head ba_complete
;
827 u64 mgmt_tx_cookie
; /* Cookie id for mgmt tx */
828 struct slsi_vif_mgmt_tx mgmt_tx_data
;
829 struct delayed_work scan_timeout_work
; /* Work on scan timeout */
830 bool delete_probe_req_ies
; /* Delete probe request stored at probe_req_ies, if
831 * connected for WAP2 at mlme_del_vif or in all cases
835 size_t probe_req_ie_len
;
837 struct slsi_vif_unsync unsync
;
838 struct slsi_vif_sta sta
;
839 struct slsi_vif_ap ap
;
840 struct slsi_vif_nan nan
;
842 /* TCP ack suppression. */
843 struct slsi_tcp_ack_s
*last_tcp_ack
;
844 struct slsi_tcp_ack_s ack_suppression
[TCP_ACK_SUPPRESSION_RECORDS_MAX
];
845 struct slsi_tcp_ack_stats tcp_ack_stats
;
846 /* traffic monitor */
847 ktime_t last_timer_time
;
849 u32 num_bytes_tx_per_timer
;
850 u32 num_bytes_rx_per_timer
;
851 u32 num_bytes_tx_per_sec
;
852 u32 num_bytes_rx_per_sec
;
855 u32 throughput_tx_bps
;
856 u32 throughput_rx_bps
;
857 #ifdef CONFIG_SCSC_WLAN_STA_ENHANCED_ARP_DETECT
858 bool enhanced_arp_detect_enabled
;
859 struct slsi_enhanced_arp_counters enhanced_arp_stats
;
860 u8 target_ip_addr
[4];
861 int enhanced_arp_host_tag
[5];
863 #ifdef CONFIG_SCSC_WLAN_SILENT_RECOVERY
864 struct cfg80211_ap_settings backup_settings
;
868 struct slsi_802_11d_reg_domain
{
870 struct ieee80211_regdomain
*regdomain
;
874 struct slsi_apf_capabilities
{
879 #ifdef CONFIG_SCSC_WLAN_WES_NCHO
880 struct slsi_wes_mode_roam_scan_channels
{
882 u8 channels
[MAX_CHANNEL_LIST
];
886 struct slsi_dev_config
{
887 /* Supported Freq Band (Dynamic)
888 * Set via the freq_band procfs
890 #define SLSI_FREQ_BAND_AUTO 0
891 #define SLSI_FREQ_BAND_5GHZ 1
892 #define SLSI_FREQ_BAND_2GHZ 2
895 struct ieee80211_supported_band
*band_5G
;
896 struct ieee80211_supported_band
*band_2G
;
898 /* current user suspend mode
899 * Set via the suspend_mode procfs
903 int user_suspend_mode
;
906 * Set via the rx_filter_num procfs
907 * 0: Unicast, 1: Broadcast, 2:Multicast IPv4, 3: Multicast IPv6
911 /* Rx filter rule enabled
912 * Set via the rx_filter_start & rx_filter_stop procfs
914 bool rx_filter_rule_started
;
916 /* AP Auto channel Selection */
917 #define SLSI_NO_OF_SCAN_CHANLS_FOR_AUTO_CHAN_MAX 14
920 /*QoS capability for a non-AP Station*/
922 #ifdef CONFIG_SCSC_WLAN_WES_NCHO
931 /*WES mode roam scan channels*/
932 struct slsi_wes_mode_roam_scan_channels wes_roam_scan_list
;
934 struct slsi_802_11d_reg_domain domain_info
;
936 int ap_disconnect_ind_timeout
;
942 bool disable_ch12_ch13
;
943 bool fw_enhanced_arp_detect_supported
;
944 bool fw_apf_supported
;
945 struct slsi_apf_capabilities apf_cap
;
948 #define SLSI_DEVICE_STATE_ATTACHING 0
949 #define SLSI_DEVICE_STATE_STOPPED 1
950 #define SLSI_DEVICE_STATE_STARTING 2
951 #define SLSI_DEVICE_STATE_STARTED 3
952 #define SLSI_DEVICE_STATE_STOPPING 4
954 #define SLSI_NET_INDEX_WLAN 1
955 #define SLSI_NET_INDEX_P2P 2
956 #define SLSI_NET_INDEX_P2PX_SWLAN 3
957 #define SLSI_NET_INDEX_NAN 4
959 /* States used during P2P operations */
960 enum slsi_p2p_states
{
961 P2P_IDLE_NO_VIF
, /* Initial state - Unsync vif is not present */
962 P2P_IDLE_VIF_ACTIVE
, /* Unsync vif is present but no P2P procedure in progress */
963 P2P_SCANNING
, /* P2P SOCIAL channel (1,6,11) scan in progress. Not used for P2P full scan */
964 P2P_LISTENING
, /* P2P Listen (ROC) in progress */
965 P2P_ACTION_FRAME_TX_RX
, /* P2P Action frame Tx in progress or waiting for a peer action frame Rx (i.e. in response to the Tx frame) */
966 P2P_GROUP_FORMED_CLI
, /* P2P Group Formed - CLI role */
967 P2P_GROUP_FORMED_GO
, /* P2P Group Formed - GO role */
968 /* NOTE: In P2P_LISTENING state if frame transmission is requested to driver then a peer response is ideally NOT expected.
969 * This is an assumption based on the fact that FIND would be stopped prior to group formation/connection.
970 * If driver were to receive a peer frame in P2P_LISTENING state then it would most probably be a REQUEST frame and the supplicant would respond to it.
971 * Hence the driver should get only RESPONSE frames for transmission in P2P_LISTENING state.
975 enum slsi_wlan_state
{
976 WLAN_UNSYNC_NO_VIF
= 0, /* Initial state - Unsync vif is not present */
977 WLAN_UNSYNC_VIF_ACTIVE
, /* Unsync vif is activated but no wlan procedure in progress */
978 WLAN_UNSYNC_VIF_TX
/* Unsync vif is activated and wlan procedure in progress */
981 /* Wakelock timeouts */
982 #define SLSI_WAKELOCK_TIME_MSEC_EAPOL (1000)
984 struct slsi_chip_info_mib
{
988 struct slsi_plat_info_mib
{
992 /* P2P States in text format for debug purposes */
993 static inline char *slsi_p2p_state_text(u8 state
)
996 case P2P_IDLE_NO_VIF
:
997 return "P2P_IDLE_NO_VIF";
998 case P2P_IDLE_VIF_ACTIVE
:
999 return "P2P_IDLE_VIF_ACTIVE";
1001 return "P2P_SCANNING";
1003 return "P2P_LISTENING";
1004 case P2P_ACTION_FRAME_TX_RX
:
1005 return "P2P_ACTION_FRAME_TX_RX";
1006 case P2P_GROUP_FORMED_CLI
:
1007 return "P2P_GROUP_FORMED_CLI";
1008 case P2P_GROUP_FORMED_GO
:
1009 return "P2P_GROUP_FORMED_GO";
1015 #define SLSI_WLAN_MAX_HCF_PLATFORM_LEN (128)
1017 struct slsi_dev_mib_info
{
1018 char *mib_file_name
;
1019 unsigned int mib_hash
;
1021 /* Cached File MIB Configuration values from User Space */
1024 char platform
[SLSI_WLAN_MAX_HCF_PLATFORM_LEN
];
1027 #define SLSI_WLAN_MAX_MIB_FILE 2 /* Number of WLAN HCFs to load */
1029 #ifdef CONFIG_SCSC_LOG_COLLECTION
1030 struct slsi_dev_mib_collect_file
{
1036 struct slsi_dev_mib_collect
{
1038 /* Serialize writers/readers */
1039 spinlock_t in_collection
;
1041 /* +1 represents local_mib */
1042 struct slsi_dev_mib_collect_file file
[SLSI_WLAN_MAX_MIB_FILE
+ 1];
1050 struct wiphy
*wiphy
;
1052 struct slsi_hip hip
; /* HIP bookkeeping block */
1053 struct slsi_hip4 hip4_inst
; /* The handler to parse to HIP */
1055 struct scsc_wifi_cm_if cm_if
; /* cm_if bookkeeping block */
1056 struct scsc_mx
*maxwell_core
;
1057 struct scsc_service_client mx_wlan_client
;
1058 struct scsc_service
*service
;
1059 struct slsi_chip_info_mib chip_info_mib
;
1060 struct slsi_plat_info_mib plat_info_mib
;
1061 u16 reg_dom_version
;
1063 #ifdef CONFIG_SCSC_WLAN_MUTEX_DEBUG
1064 struct slsi_mutex netdev_add_remove_mutex
;
1067 struct mutex netdev_add_remove_mutex
;
1069 /* mutex to protect dynamic netdev removal */
1070 struct mutex netdev_remove_mutex
;
1071 int netdev_up_count
;
1072 struct net_device __rcu
*netdev
[CONFIG_SCSC_WLAN_MAX_INTERFACES
+ 1]; /* 0 is reserved */
1073 struct net_device __rcu
*netdev_ap
;
1074 u8 netdev_addresses
[CONFIG_SCSC_WLAN_MAX_INTERFACES
+ 1][ETH_ALEN
]; /* 0 is reserved */
1079 atomic_t in_pause_state
;
1080 #ifdef CONFIG_SCSC_WLAN_SILENT_RECOVERY
1081 struct work_struct recovery_work
; /* Work on subsystem_reset recovery*/
1082 struct work_struct recovery_work_on_stop
; /* Work on failure_reset recovery*/
1083 struct work_struct recovery_work_on_start
; /* Work on chip recovery*/
1085 /* Locking used to control Starting and stopping the chip */
1086 #ifdef CONFIG_SCSC_WLAN_MUTEX_DEBUG
1087 struct slsi_mutex start_stop_mutex
;
1090 struct mutex start_stop_mutex
;
1093 struct slsi_log_clients log_clients
;
1097 int procfs_instance
;
1098 struct proc_dir_entry
*procfs_dir
;
1101 u8 hw_addr
[ETH_ALEN
];
1102 struct slsi_dev_mib_info mib
[SLSI_WLAN_MAX_MIB_FILE
];
1103 struct slsi_dev_mib_info local_mib
;
1104 #ifdef CONFIG_SCSC_LOG_COLLECTION
1105 struct slsi_dev_mib_collect collect_mib
;
1107 char *maddr_file_name
;
1108 bool *term_udi_users
; /* Try to terminate UDI users during unload */
1109 int *sig_wait_cfm_timeout
;
1111 struct slsi_wake_lock wlan_wl
;
1112 struct slsi_wake_lock wlan_wl_mlme
;
1113 struct slsi_wake_lock wlan_wl_ma
;
1114 #if !defined SLSI_TEST_DEV && defined CONFIG_ANDROID
1115 struct wake_lock wlan_wl_roam
;
1117 struct slsi_sig_send sig_wait
;
1118 struct slsi_skb_work rx_dbg_sap
;
1119 atomic_t tx_host_tag
[SLSI_LLS_AC_MAX
];
1120 #ifdef CONFIG_SCSC_WLAN_MUTEX_DEBUG
1121 struct slsi_mutex device_config_mutex
;
1124 struct mutex device_config_mutex
;
1126 struct slsi_dev_config device_config
;
1128 struct notifier_block inetaddr_notifier
;
1129 #ifndef CONFIG_SCSC_WLAN_BLOCK_IPV6
1130 struct notifier_block inet6addr_notifier
;
1133 struct workqueue_struct
*device_wq
; /* Driver Workqueue */
1134 enum slsi_p2p_states p2p_state
; /* Store current P2P operation */
1136 enum slsi_wlan_state wlan_unsync_vif_state
; /* Store current sate of unsync wlan vif */
1138 int current_tspec_id
;
1139 int tspec_error_code
;
1140 u8 p2p_group_exp_frame
; /* Next expected Public action frame subtype from peer */
1143 #ifdef CONFIG_SCSC_WLAN_GSCAN_ENABLE
1144 struct slsi_gscan
*gscan
;
1145 struct slsi_gscan_result
*gscan_hash_table
[SLSI_GSCAN_HASH_TABLE_SIZE
];
1146 int num_gscan_results
;
1147 int buffer_threshold
;
1148 int buffer_consumed
;
1149 struct slsi_bucket bucket
[SLSI_GSCAN_MAX_BUCKETS
];
1150 struct list_head hotlist_results
;
1153 #ifdef CONFIG_SCSC_WLAN_ENABLE_MAC_RANDOMISATION
1154 u8 scan_mac_addr
[6];
1157 #ifdef CONFIG_SCSC_WLAN_HIP4_PROFILING
1160 struct slsi_ba_session_rx rx_ba_buffer_pool
[SLSI_MAX_RX_BA_SESSIONS
];
1161 struct slsi_spinlock rx_ba_buffer_pool_lock
;
1163 bool p2p_certif
; /* Set to true to idenitfy p2p_certification testing is going on*/
1164 bool mlme_blocked
; /* When true do not send mlme signals to FW */
1165 atomic_t debug_inds
;
1166 int recovery_next_state
;
1167 struct completion recovery_remove_completion
;
1168 struct completion recovery_stop_completion
;
1169 struct completion recovery_completed
;
1170 int recovery_status
;
1171 struct slsi_ssid_map ssid_map
[SLSI_SCAN_SSID_MAP_MAX
];
1172 bool band_5g_supported
;
1173 int supported_2g_channels
[14];
1174 int supported_5g_channels
[25];
1175 int enabled_channel_count
;
1177 u8 fw_ht_cap
[4]; /* HT capabilities is 21 bytes but host is never intersted in last 17 bytes*/
1178 bool fw_vht_enabled
;
1180 #ifdef CONFIG_SCSC_WLAN_WIFI_SHARING
1181 u8 wifi_sharing_5ghz_channel
[8];
1182 int valid_5g_freq
[25];
1183 int wifi_sharing_5g_restricted_channels
[25];
1184 int num_5g_restricted_channels
;
1186 bool fw_SoftAp_2g_40mhz_enabled
;
1188 u16 assoc_result_code
; /* Status of latest association in STA mode */
1189 bool allow_switch_40_mhz
; /* Used in AP cert to disable HT40 when not configured */
1190 bool allow_switch_80_mhz
; /* Used in AP cert to disable VHT when not configured */
1191 #ifdef CONFIG_SCSC_WLAN_AP_INFO_FILE
1192 /* Parameters in '/data/vendor/conn/.softap.info' */
1193 bool dualband_concurrency
;
1194 u32 softap_max_client
;
1199 #ifdef CONFIG_SCSC_WLAN_MUTEX_DEBUG
1200 struct slsi_mutex logger_mutex
;
1203 struct mutex logger_mutex
;
1205 struct slsi_traffic_mon_clients traffic_mon_clients
;
1206 /*Store vif index corresponding to rtt id for FTM*/
1208 bool acs_channel_switched
;
1209 int recovery_timeout
; /* ms autorecovery completion timeout */
1210 #ifdef CONFIG_SCSC_WLAN_ENABLE_MAC_RANDOMISATION
1211 bool fw_mac_randomization_enabled
;
1214 #ifdef CONFIG_SCSC_WLAN_ENHANCED_PKT_FILTER
1215 bool enhanced_pkt_filter_enabled
;
1217 struct reg_database regdb
;
1220 /* Compact representation of channels a ESS has been seen on
1221 * This is sized correctly for the Channels we currently support,
1222 * 2.4Ghz Channels 1 - 14
1223 * 5 Ghz Channels Uni1, Uni2 and Uni3
1225 struct slsi_roaming_network_map_entry
{
1226 struct list_head list
;
1227 unsigned long last_seen_jiffies
; /* Timestamp of the last time we saw this ESS */
1228 struct cfg80211_ssid ssid
; /* SSID of the ESS */
1229 u8 initial_bssid
[ETH_ALEN
]; /* Bssid of the first ap seen in this ESS */
1230 bool only_one_ap_seen
; /* Has more than one AP for this ESS been seen */
1231 u16 channels_24_ghz
; /* 2.4 Ghz Channels Bit Map */
1232 /* 5 Ghz Channels Bit Map
1233 * channels_5_ghz & 0x000000FF = 4 Uni1 Channels
1234 * channels_5_ghz & 0x00FFFF00 = 15 Uni2 Channels
1235 * channels_5_ghz & 0xFF000000 = 5 Uni3 Channels
1240 #define LLC_SNAP_HDR_LEN 8
1241 struct llc_snap_hdr
{
1249 void slsi_rx_data_deliver_skb(struct slsi_dev
*sdev
, struct net_device
*dev
, struct sk_buff
*skb
, bool from_ba_timer
);
1250 void slsi_rx_dbg_sap_work(struct work_struct
*work
);
1251 void slsi_rx_netdev_data_work(struct work_struct
*work
);
1252 void slsi_rx_netdev_mlme_work(struct work_struct
*work
);
1253 int slsi_rx_enqueue_netdev_mlme(struct slsi_dev
*sdev
, struct sk_buff
*skb
, u16 vif
);
1254 void slsi_rx_scan_pass_to_cfg80211(struct slsi_dev
*sdev
, struct net_device
*dev
, struct sk_buff
*skb
);
1255 void slsi_rx_buffered_frames(struct slsi_dev
*sdev
, struct net_device
*dev
, struct slsi_peer
*peer
);
1256 int slsi_rx_blocking_signals(struct slsi_dev
*sdev
, struct sk_buff
*skb
);
1257 void slsi_scan_complete(struct slsi_dev
*sdev
, struct net_device
*dev
, u16 scan_id
, bool aborted
);
1259 void slsi_tx_pause_queues(struct slsi_dev
*sdev
);
1260 void slsi_tx_unpause_queues(struct slsi_dev
*sdev
);
1261 int slsi_tx_control(struct slsi_dev
*sdev
, struct net_device
*dev
, struct sk_buff
*skb
);
1262 int slsi_tx_data(struct slsi_dev
*sdev
, struct net_device
*dev
, struct sk_buff
*skb
);
1263 int slsi_tx_data_lower(struct slsi_dev
*sdev
, struct sk_buff
*skb
);
1264 bool slsi_is_test_mode_enabled(void);
1265 bool slsi_is_rf_test_mode_enabled(void);
1266 int slsi_check_rf_test_mode(void);
1267 void slsi_init_netdev_mac_addr(struct slsi_dev
*sdev
);
1268 bool slsi_dev_lls_supported(void);
1269 bool slsi_dev_gscan_supported(void);
1270 bool slsi_dev_epno_supported(void);
1271 bool slsi_dev_vo_vi_block_ack(void);
1272 int slsi_dev_get_scan_result_count(void);
1273 bool slsi_dev_llslogs_supported(void);
1274 int slsi_dev_nan_supported(struct slsi_dev
*sdev
);
1275 #ifdef CONFIG_SCSC_WIFI_NAN_ENABLE
1276 bool slsi_dev_nan_is_ipv6_link_tlv_include(void);
1277 int slsi_get_nan_max_ndp_instances(void);
1278 int slsi_get_nan_max_ndi_ifaces(void);
1280 bool slsi_dev_rtt_supported(void);
1283 #ifdef CONFIG_SCSC_WLAN_ENABLE_MAC_RANDOMISATION
1284 bool slsi_dev_mac_randomisation_support(void);
1288 static inline u16
slsi_tx_host_tag(struct slsi_dev
*sdev
, enum slsi_traffic_q tq
)
1291 * bit 0,1 = trafficqueue identifier
1292 * bit 2-15 = incremental number
1293 * So increment by 4 to get bit 2-15 a incremental sequence
1295 return (u16
)atomic_add_return(4, &sdev
->tx_host_tag
[tq
]);
1298 static inline u16
slsi_tx_mgmt_host_tag(struct slsi_dev
*sdev
)
1300 /* Doesn't matter which traffic queue host tag is selected.*/
1301 return slsi_tx_host_tag(sdev
, 0);
1304 static inline struct net_device
*slsi_get_netdev_rcu(struct slsi_dev
*sdev
, u16 ifnum
)
1306 WARN_ON(!rcu_read_lock_held());
1307 if (ifnum
> CONFIG_SCSC_WLAN_MAX_INTERFACES
) {
1308 /* WARN(1, "ifnum:%d", ifnum); WARN() is used like this to avoid Coverity Error */
1311 return rcu_dereference(sdev
->netdev
[ifnum
]);
1314 static inline struct net_device
*slsi_get_netdev_locked(struct slsi_dev
*sdev
, u16 ifnum
)
1316 WARN_ON(!SLSI_MUTEX_IS_LOCKED(sdev
->netdev_add_remove_mutex
));
1317 if (ifnum
> CONFIG_SCSC_WLAN_MAX_INTERFACES
) {
1318 WARN(1, "ifnum:%d", ifnum
); /* WARN() is used like this to avoid Coverity Error */
1321 return sdev
->netdev
[ifnum
];
1324 static inline struct net_device
*slsi_get_netdev(struct slsi_dev
*sdev
, u16 ifnum
)
1326 struct net_device
*dev
;
1328 SLSI_MUTEX_LOCK(sdev
->netdev_add_remove_mutex
);
1329 dev
= slsi_get_netdev_locked(sdev
, ifnum
);
1330 SLSI_MUTEX_UNLOCK(sdev
->netdev_add_remove_mutex
);
1335 static inline struct net_device
*slsi_get_netdev_by_mac_addr(struct slsi_dev
*sdev
, u8
*mac_addr
, int start_idx
)
1341 for (i
= start_idx
; i
< CONFIG_SCSC_WLAN_MAX_INTERFACES
+ 1; i
++) {
1342 if (sdev
->netdev
[i
] && ether_addr_equal(mac_addr
, sdev
->netdev
[i
]->dev_addr
))
1343 return sdev
->netdev
[i
];
1348 static inline struct net_device
*slsi_get_netdev_by_mac_addr_lockless(struct slsi_dev
*sdev
, u8
*mac_addr
, int start_idx
)
1350 return slsi_get_netdev_by_mac_addr(sdev
, mac_addr
, start_idx
);
1353 static inline struct net_device
*slsi_get_netdev_by_mac_addr_locked(struct slsi_dev
*sdev
, u8
*mac_addr
, int start_idx
)
1355 struct net_device
*dev
;
1357 SLSI_MUTEX_LOCK(sdev
->netdev_add_remove_mutex
);
1358 dev
= slsi_get_netdev_by_mac_addr(sdev
, mac_addr
, start_idx
);
1359 SLSI_MUTEX_UNLOCK(sdev
->netdev_add_remove_mutex
);
1364 static inline struct net_device
*slsi_get_netdev_by_ifname_locked(struct slsi_dev
*sdev
, u8
*ifname
)
1368 WARN_ON(!SLSI_MUTEX_IS_LOCKED(sdev
->netdev_add_remove_mutex
));
1369 for (i
= 1; i
< CONFIG_SCSC_WLAN_MAX_INTERFACES
+ 1; i
++) {
1370 if (sdev
->netdev
[i
] && strcmp(ifname
, sdev
->netdev
[i
]->name
) == 0)
1371 return sdev
->netdev
[i
];
1376 static inline struct net_device
*slsi_get_netdev_by_ifname(struct slsi_dev
*sdev
, u8
*ifname
)
1378 struct net_device
*dev
;
1380 SLSI_MUTEX_LOCK(sdev
->netdev_add_remove_mutex
);
1381 dev
= slsi_get_netdev_by_ifname_locked(sdev
, ifname
);
1382 SLSI_MUTEX_UNLOCK(sdev
->netdev_add_remove_mutex
);
1387 static inline int slsi_get_supported_mode(const u8
*peer_ie
)
1389 const u8
*peer_ie_data
;
1394 peer_ie_len
= peer_ie
[1];
1395 peer_ie_data
= &peer_ie
[2];
1396 for (i
= 0; i
< peer_ie_len
; i
++) {
1397 supported_rate
= ((peer_ie_data
[i
] & 0x7F) / 2);
1398 if (supported_rate
> 11)
1399 return SLSI_80211_MODE_11G
;
1401 return SLSI_80211_MODE_11B
;
1404 /* Names of full mode HCF files */
1405 extern char *slsi_mib_file
;
1406 extern char *slsi_mib_file2
;