hc
2024-05-11 297b60346df8beafee954a0fd7c2d64f33f3b9bc
kernel/drivers/net/wireless/ath/wil6210/wil6210.h
....@@ -1,18 +1,7 @@
1
+/* SPDX-License-Identifier: ISC */
12 /*
23 * Copyright (c) 2012-2017 Qualcomm Atheros, Inc.
3
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
4
- *
5
- * Permission to use, copy, modify, and/or distribute this software for any
6
- * purpose with or without fee is hereby granted, provided that the above
7
- * copyright notice and this permission notice appear in all copies.
8
- *
9
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
4
+ * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
165 */
176
187 #ifndef __WIL6210_H__
....@@ -38,6 +27,8 @@
3827 extern bool debug_fw;
3928 extern bool disable_ap_sme;
4029 extern bool ftm_mode;
30
+extern bool drop_if_ring_full;
31
+extern uint max_assoc_sta;
4132
4233 struct wil6210_priv;
4334 struct wil6210_vif;
....@@ -81,6 +72,7 @@
8172
8273 #define WIL_TX_Q_LEN_DEFAULT (4000)
8374 #define WIL_RX_RING_SIZE_ORDER_DEFAULT (10)
75
+#define WIL_RX_RING_SIZE_ORDER_TALYN_DEFAULT (11)
8476 #define WIL_TX_RING_SIZE_ORDER_DEFAULT (12)
8577 #define WIL_BCAST_RING_SIZE_ORDER_DEFAULT (7)
8678 #define WIL_BCAST_MCS0_LIMIT (1024) /* limit for MCS0 frame size */
....@@ -88,13 +80,15 @@
8880 #define WIL_RING_SIZE_ORDER_MIN (5)
8981 #define WIL_RING_SIZE_ORDER_MAX (15)
9082 #define WIL6210_MAX_TX_RINGS (24) /* HW limit */
91
-#define WIL6210_MAX_CID (8) /* HW limit */
83
+#define WIL6210_MAX_CID (20) /* max number of stations */
84
+#define WIL6210_RX_DESC_MAX_CID (8) /* HW limit */
9285 #define WIL6210_NAPI_BUDGET (16) /* arbitrary */
9386 #define WIL_MAX_AMPDU_SIZE (64 * 1024) /* FW/HW limit */
9487 #define WIL_MAX_AGG_WSIZE (32) /* FW/HW limit */
9588 #define WIL_MAX_AMPDU_SIZE_128 (128 * 1024) /* FW/HW limit */
9689 #define WIL_MAX_AGG_WSIZE_64 (64) /* FW/HW limit */
9790 #define WIL6210_MAX_STATUS_RINGS (8)
91
+#define WIL_WMI_CALL_GENERAL_TO_MS 100
9892
9993 /* Hardware offload block adds the following:
10094 * 26 bytes - 3-address QoS data header
....@@ -181,6 +175,7 @@
181175
182176 /* registers - FW addresses */
183177 #define RGF_USER_USAGE_1 (0x880004)
178
+#define RGF_USER_USAGE_2 (0x880008)
184179 #define RGF_USER_USAGE_6 (0x880018)
185180 #define BIT_USER_OOB_MODE BIT(31)
186181 #define BIT_USER_OOB_R2_MODE BIT(30)
....@@ -330,6 +325,11 @@
330325 #define BIT_BOOT_FROM_ROM BIT(31)
331326
332327 /* eDMA */
328
+#define RGF_SCM_PTRS_SUBQ_RD_PTR (0x8b4000)
329
+#define RGF_SCM_PTRS_COMPQ_RD_PTR (0x8b4100)
330
+#define RGF_DMA_SCM_SUBQ_CONS (0x8b60ec)
331
+#define RGF_DMA_SCM_COMPQ_PROD (0x8b616c)
332
+
333333 #define RGF_INT_COUNT_ON_SPECIAL_EVT (0x8b62d8)
334334
335335 #define RGF_INT_CTRL_INT_GEN_CFG_0 (0x8bc000)
....@@ -363,6 +363,7 @@
363363 #define REVISION_ID_SPARROW_D0 (0x3)
364364
365365 #define RGF_OTP_MAC_TALYN_MB (0x8a0304)
366
+#define RGF_OTP_OEM_MAC (0x8a0334)
366367 #define RGF_OTP_MAC (0x8a0620)
367368
368369 /* Talyn-MB */
....@@ -553,10 +554,11 @@
553554 bool is_rx;
554555 u8 desc_rdy_pol; /* Expected descriptor ready bit polarity */
555556 struct wil_ring_rx_data rx_data;
557
+ u32 invalid_buff_id_cnt; /* relevant only for RX */
556558 };
557559
558560 #define WIL_STA_TID_NUM (16)
559
-#define WIL_MCS_MAX (12) /* Maximum MCS supported */
561
+#define WIL_MCS_MAX (15) /* Maximum MCS supported */
560562
561563 struct wil_net_stats {
562564 unsigned long rx_packets;
....@@ -577,7 +579,9 @@
577579 unsigned long rx_amsdu_error; /* eDMA specific */
578580 unsigned long rx_csum_err;
579581 u16 last_mcs_rx;
582
+ u8 last_cb_mode_rx;
580583 u64 rx_per_mcs[WIL_MCS_MAX + 1];
584
+ u32 ft_roams; /* relevant in STA mode */
581585 };
582586
583587 /**
....@@ -600,6 +604,8 @@
600604 struct wil_ctx *ctx);
601605 int (*tx_ring_tso)(struct wil6210_priv *wil, struct wil6210_vif *vif,
602606 struct wil_ring *ring, struct sk_buff *skb);
607
+ int (*tx_ring_modify)(struct wil6210_vif *vif, int ring_id,
608
+ int cid, int tid);
603609 irqreturn_t (*irq_tx)(int irq, void *cookie);
604610 /* RX ops */
605611 int (*rx_init)(struct wil6210_priv *wil, uint ring_order);
....@@ -644,7 +650,6 @@
644650 wil_status_suspending, /* suspend in progress */
645651 wil_status_suspended, /* suspend completed, device is suspended */
646652 wil_status_resuming, /* resume in progress */
647
- wil_status_collecting_dumps, /* crashdump collection in progress */
648653 wil_status_last /* keep last */
649654 };
650655
....@@ -713,6 +718,12 @@
713718 wil_sta_unused = 0,
714719 wil_sta_conn_pending = 1,
715720 wil_sta_connected = 2,
721
+};
722
+
723
+enum wil_rekey_state {
724
+ WIL_REKEY_IDLE = 0,
725
+ WIL_REKEY_M3_RECEIVED = 1,
726
+ WIL_REKEY_WAIT_M4_SENT = 2,
716727 };
717728
718729 /**
....@@ -823,6 +834,7 @@
823834 enum wil6210_vif_status {
824835 wil_vif_fwconnecting,
825836 wil_vif_fwconnected,
837
+ wil_vif_ft_roam,
826838 wil_vif_status_last /* keep last */
827839 };
828840
....@@ -834,9 +846,18 @@
834846 DECLARE_BITMAP(status, wil_vif_status_last);
835847 u32 privacy; /* secure connection? */
836848 u16 channel; /* relevant in AP mode */
849
+ u8 wmi_edmg_channel; /* relevant in AP mode */
837850 u8 hidden_ssid; /* relevant in AP mode */
838851 u32 ap_isolate; /* no intra-BSS communication */
839852 bool pbss;
853
+ int bi;
854
+ u8 *proberesp, *proberesp_ies, *assocresp_ies;
855
+ size_t proberesp_len, proberesp_ies_len, assocresp_ies_len;
856
+ u8 ssid[IEEE80211_MAX_SSID_LEN];
857
+ size_t ssid_len;
858
+ u8 gtk_index;
859
+ u8 gtk[WMI_MAX_KEY_LEN];
860
+ size_t gtk_len;
840861 int bcast_ring;
841862 struct cfg80211_bss *bss; /* connected bss, relevant in STA mode */
842863 int locally_generated_disc; /* relevant in STA mode */
....@@ -853,6 +874,10 @@
853874 int net_queue_stopped; /* netif_tx_stop_all_queues invoked */
854875 bool fw_stats_ready; /* per-cid statistics are ready inside sta_info */
855876 u64 fw_stats_tsf; /* measurement timestamp */
877
+
878
+ /* PTK rekey race prevention, this is relevant to station mode only */
879
+ enum wil_rekey_state ptk_rekey_state;
880
+ struct work_struct enable_tx_key_worker;
856881 };
857882
858883 /**
....@@ -886,6 +911,11 @@
886911 struct wmi_link_stats_global stats;
887912 };
888913
914
+struct wil_brd_info {
915
+ u32 file_addr;
916
+ u32 file_max_size;
917
+};
918
+
889919 struct wil6210_priv {
890920 struct pci_dev *pdev;
891921 u32 bar_size;
....@@ -900,8 +930,8 @@
900930 const char *hw_name;
901931 const char *wil_fw_name;
902932 char *board_file;
903
- u32 brd_file_addr;
904
- u32 brd_file_max_size;
933
+ u32 num_of_brd_entries;
934
+ struct wil_brd_info *brd_info;
905935 DECLARE_BITMAP(hw_capa, hw_capa_last);
906936 DECLARE_BITMAP(fw_capabilities, WMI_FW_CAPABILITY_MAX);
907937 DECLARE_BITMAP(platform_capa, WIL_PLATFORM_CAPA_MAX);
....@@ -913,6 +943,8 @@
913943 struct wil6210_vif *vifs[WIL_MAX_VIFS];
914944 struct mutex vif_mutex; /* protects access to VIF entries */
915945 atomic_t connected_vifs;
946
+ u32 max_assoc_sta; /* max sta's supported by the driver and the FW */
947
+
916948 /* profile */
917949 struct cfg80211_chan_def monitor_chandef;
918950 u32 monitor_flags;
....@@ -946,6 +978,7 @@
946978 */
947979 spinlock_t wmi_ev_lock;
948980 spinlock_t net_queue_lock; /* guarding stop/wake netif queue */
981
+ spinlock_t eap_lock; /* guarding access to eap rekey fields */
949982 struct napi_struct napi_rx;
950983 struct napi_struct napi_tx;
951984 struct net_device napi_ndev; /* dummy net_device serving all VIFs */
....@@ -967,6 +1000,8 @@
9671000 struct wil_txrx_ops txrx_ops;
9681001
9691002 struct mutex mutex; /* for wil6210_priv access in wil_{up|down} */
1003
+ /* for synchronizing device memory access while reset or suspend */
1004
+ struct rw_semaphore mem_lock;
9701005 /* statistics */
9711006 atomic_t isr_count_rx, isr_count_tx;
9721007 /* debugfs */
....@@ -1024,6 +1059,8 @@
10241059
10251060 u32 max_agg_wsize;
10261061 u32 max_ampdu_size;
1062
+ u8 multicast_to_unicast;
1063
+ s32 cqm_rssi_thold;
10271064 };
10281065
10291066 #define wil_to_wiphy(i) (i->wiphy)
....@@ -1035,6 +1072,7 @@
10351072 #define vif_to_wil(v) (v->wil)
10361073 #define vif_to_ndev(v) (v->ndev)
10371074 #define vif_to_wdev(v) (&v->wdev)
1075
+#define GET_MAX_VIFS(wil) min_t(int, (wil)->max_vifs, WIL_MAX_VIFS)
10381076
10391077 static inline struct wil6210_vif *wdev_to_vif(struct wil6210_priv *wil,
10401078 struct wireless_dev *wdev)
....@@ -1107,6 +1145,14 @@
11071145 wil_w(wil, reg, wil_r(wil, reg) & ~val);
11081146 }
11091147
1148
+/**
1149
+ * wil_cid_valid - check cid is valid
1150
+ */
1151
+static inline bool wil_cid_valid(struct wil6210_priv *wil, int cid)
1152
+{
1153
+ return (cid >= 0 && cid < wil->max_assoc_sta && cid < WIL6210_MAX_CID);
1154
+}
1155
+
11101156 void wil_get_board_file(struct wil6210_priv *wil, char *buf, size_t len);
11111157
11121158 #if defined(CONFIG_DYNAMIC_DEBUG)
....@@ -1151,6 +1197,8 @@
11511197 size_t count);
11521198 void wil_memcpy_toio_32(volatile void __iomem *dst, const void *src,
11531199 size_t count);
1200
+int wil_mem_access_lock(struct wil6210_priv *wil);
1201
+void wil_mem_access_unlock(struct wil6210_priv *wil);
11541202
11551203 struct wil6210_vif *
11561204 wil_vif_alloc(struct wil6210_priv *wil, const char *name,
....@@ -1180,6 +1228,7 @@
11801228 void wil_refresh_fw_capabilities(struct wil6210_priv *wil);
11811229 void wil_mbox_ring_le2cpus(struct wil6210_mbox_ring *r);
11821230 int wil_find_cid(struct wil6210_priv *wil, u8 mid, const u8 *mac);
1231
+int wil_find_cid_by_idx(struct wil6210_priv *wil, u8 mid, int idx);
11831232 void wil_set_ethtoolops(struct net_device *ndev);
11841233
11851234 struct fw_map *wil_find_fw_mapping(const char *section);
....@@ -1206,14 +1255,18 @@
12061255 int wmi_echo(struct wil6210_priv *wil);
12071256 int wmi_set_ie(struct wil6210_vif *vif, u8 type, u16 ie_len, const void *ie);
12081257 int wmi_rx_chain_add(struct wil6210_priv *wil, struct wil_ring *vring);
1258
+int wmi_update_ft_ies(struct wil6210_vif *vif, u16 ie_len, const void *ie);
12091259 int wmi_rxon(struct wil6210_priv *wil, bool on);
12101260 int wmi_get_temperature(struct wil6210_priv *wil, u32 *t_m, u32 *t_r);
1211
-int wmi_disconnect_sta(struct wil6210_vif *vif, const u8 *mac,
1212
- u16 reason, bool full_disconnect, bool del_sta);
1261
+int wmi_get_all_temperatures(struct wil6210_priv *wil,
1262
+ struct wmi_temp_sense_all_done_event
1263
+ *sense_all_evt);
1264
+int wmi_disconnect_sta(struct wil6210_vif *vif, const u8 *mac, u16 reason,
1265
+ bool del_sta);
12131266 int wmi_addba(struct wil6210_priv *wil, u8 mid,
12141267 u8 ringid, u8 size, u16 timeout);
12151268 int wmi_delba_tx(struct wil6210_priv *wil, u8 mid, u8 ringid, u16 reason);
1216
-int wmi_delba_rx(struct wil6210_priv *wil, u8 mid, u8 cidxtid, u16 reason);
1269
+int wmi_delba_rx(struct wil6210_priv *wil, u8 mid, u8 cid, u8 tid, u16 reason);
12171270 int wmi_addba_rx_resp(struct wil6210_priv *wil,
12181271 u8 mid, u8 cid, u8 tid, u8 token,
12191272 u16 status, bool amsdu, u16 agg_wsize, u16 timeout);
....@@ -1226,8 +1279,8 @@
12261279 const u8 *mac, enum nl80211_iftype iftype);
12271280 int wmi_port_delete(struct wil6210_priv *wil, u8 mid);
12281281 int wmi_link_stats_cfg(struct wil6210_vif *vif, u32 type, u8 cid, u32 interval);
1229
-int wil_addba_rx_request(struct wil6210_priv *wil, u8 mid,
1230
- u8 cidxtid, u8 dialog_token, __le16 ba_param_set,
1282
+int wil_addba_rx_request(struct wil6210_priv *wil, u8 mid, u8 cid, u8 tid,
1283
+ u8 dialog_token, __le16 ba_param_set,
12311284 __le16 ba_timeout, __le16 ba_seq_ctrl);
12321285 int wil_addba_tx_request(struct wil6210_priv *wil, u8 ringid, u16 wsize);
12331286
....@@ -1264,6 +1317,7 @@
12641317 int wil_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
12651318 struct cfg80211_mgmt_tx_params *params,
12661319 u64 *cookie);
1320
+void wil_cfg80211_ap_recovery(struct wil6210_priv *wil);
12671321 int wil_cfg80211_iface_combinations_from_fw(
12681322 struct wil6210_priv *wil,
12691323 const struct wil_fw_record_concurrency *conc);
....@@ -1286,7 +1340,7 @@
12861340
12871341 int wmi_set_mac_address(struct wil6210_priv *wil, void *addr);
12881342 int wmi_pcp_start(struct wil6210_vif *vif, int bi, u8 wmi_nettype, u8 chan,
1289
- u8 hidden_ssid, u8 is_go);
1343
+ u8 edmg_chan, u8 hidden_ssid, u8 is_go);
12901344 int wmi_pcp_stop(struct wil6210_vif *vif);
12911345 int wmi_led_cfg(struct wil6210_priv *wil, bool enable);
12921346 int wmi_abort_scan(struct wil6210_vif *vif);
....@@ -1294,10 +1348,13 @@
12941348 void wil_abort_scan_all_vifs(struct wil6210_priv *wil, bool sync);
12951349 void wil6210_bus_request(struct wil6210_priv *wil, u32 kbps);
12961350 void wil6210_disconnect(struct wil6210_vif *vif, const u8 *bssid,
1297
- u16 reason_code, bool from_event);
1351
+ u16 reason_code);
1352
+void wil6210_disconnect_complete(struct wil6210_vif *vif, const u8 *bssid,
1353
+ u16 reason_code);
12981354 void wil_probe_client_flush(struct wil6210_vif *vif);
12991355 void wil_probe_client_worker(struct work_struct *work);
13001356 void wil_disconnect_worker(struct work_struct *work);
1357
+void wil_enable_tx_key_worker(struct work_struct *work);
13011358
13021359 void wil_init_txrx_ops(struct wil6210_priv *wil);
13031360
....@@ -1314,6 +1371,8 @@
13141371 struct wil_ring *ring, bool check_stop);
13151372 netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev);
13161373 int wil_tx_complete(struct wil6210_vif *vif, int ringid);
1374
+void wil_tx_complete_handle_eapol(struct wil6210_vif *vif,
1375
+ struct sk_buff *skb);
13171376 void wil6210_unmask_irq_tx(struct wil6210_priv *wil);
13181377 void wil6210_unmask_irq_tx_edma(struct wil6210_priv *wil);
13191378
....@@ -1321,6 +1380,9 @@
13211380 void wil_rx_handle(struct wil6210_priv *wil, int *quota);
13221381 void wil6210_unmask_irq_rx(struct wil6210_priv *wil);
13231382 void wil6210_unmask_irq_rx_edma(struct wil6210_priv *wil);
1383
+void wil_set_crypto_rx(u8 key_index, enum wmi_key_usage key_usage,
1384
+ struct wil_sta_info *cs,
1385
+ struct key_params *params);
13241386
13251387 int wil_iftype_nl2wmi(enum nl80211_iftype type);
13261388
....@@ -1356,6 +1418,11 @@
13561418 int wmi_mgmt_tx(struct wil6210_vif *vif, const u8 *buf, size_t len);
13571419 int wmi_mgmt_tx_ext(struct wil6210_vif *vif, const u8 *buf, size_t len,
13581420 u8 channel, u16 duration_ms);
1421
+int wmi_rbufcap_cfg(struct wil6210_priv *wil, bool enable, u16 threshold);
1422
+
1423
+int wil_wmi2spec_ch(u8 wmi_ch, u8 *spec_ch);
1424
+int wil_spec2wmi_ch(u8 spec_ch, u8 *wmi_ch);
1425
+void wil_update_supported_bands(struct wil6210_priv *wil);
13591426
13601427 int reverse_memcmp(const void *cs, const void *ct, size_t count);
13611428
....@@ -1372,4 +1439,9 @@
13721439 u8 tid, u8 token, u16 status, bool amsdu,
13731440 u16 agg_wsize, u16 timeout);
13741441
1442
+void update_supported_bands(struct wil6210_priv *wil);
1443
+
1444
+void wil_clear_fw_log_addr(struct wil6210_priv *wil);
1445
+int wmi_set_cqm_rssi_config(struct wil6210_priv *wil,
1446
+ s32 rssi_thold, u32 rssi_hyst);
13751447 #endif /* __WIL6210_H__ */