1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
9 #include <linux/types.h>
10 #include <linux/interrupt.h>
11 #include <linux/irq.h>
12 #include <linux/bitfield.h>
27 #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
29 #define ATH11K_TX_MGMT_NUM_PENDING_MAX 512
31 #define ATH11K_TX_MGMT_TARGET_MAX_SUPPORT_WMI 64
33 /* Pending management packets threshold for dropping probe responses */
34 #define ATH11K_PRB_RSP_DROP_THRESHOLD ((ATH11K_TX_MGMT_TARGET_MAX_SUPPORT_WMI * 3) / 4)
36 #define ATH11K_INVALID_HW_MAC_ID 0xFF
37 #define ATH11K_CONNECTION_LOSS_HZ (3 * HZ)
39 extern unsigned int ath11k_frame_mode;
41 #define ATH11K_SCAN_TIMEOUT_HZ (20 * HZ)
43 #define ATH11K_MON_TIMER_INTERVAL 10
45 enum ath11k_supported_bw {
52 enum ath11k_bdf_search {
53 ATH11K_BDF_SEARCH_DEFAULT,
54 ATH11K_BDF_SEARCH_BUS_AND_BOARD,
65 #define ATH11K_HT_MCS_MAX 7
66 #define ATH11K_VHT_MCS_MAX 9
67 #define ATH11K_HE_MCS_MAX 11
69 enum ath11k_crypt_mode {
70 /* Only use hardware crypto engine */
72 /* Only use software crypto */
76 static inline enum wme_ac ath11k_tid_to_ac(u32 tid)
78 return (((tid == 0) || (tid == 3)) ? WME_AC_BE :
79 ((tid == 1) || (tid == 2)) ? WME_AC_BK :
80 ((tid == 4) || (tid == 5)) ? WME_AC_VI :
84 enum ath11k_skb_flags {
85 ATH11K_SKB_HW_80211_ENCAP = BIT(0),
86 ATH11K_SKB_CIPHER_SET = BIT(1),
89 struct ath11k_skb_cb {
95 struct ieee80211_vif *vif;
98 struct ath11k_skb_rxcb {
102 bool is_continuation;
105 struct hal_rx_desc *rx_desc;
118 ATH11K_HW_QCA6390_HW20,
119 ATH11K_HW_IPQ6018_HW10,
120 ATH11K_HW_QCN9074_HW10,
121 ATH11K_HW_WCN6855_HW20,
122 ATH11K_HW_WCN6855_HW21,
125 enum ath11k_firmware_mode {
126 /* the default mode, standard 802.11 functionality */
127 ATH11K_FIRMWARE_MODE_NORMAL,
129 /* factory tests etc */
130 ATH11K_FIRMWARE_MODE_FTM,
132 /* Cold boot calibration */
133 ATH11K_FIRMWARE_MODE_COLD_BOOT = 7,
136 extern bool ath11k_cold_boot_cal;
138 #define ATH11K_IRQ_NUM_MAX 52
139 #define ATH11K_EXT_IRQ_NUM_MAX 16
141 struct ath11k_ext_irq_grp {
142 struct ath11k_base *ab;
143 u32 irqs[ATH11K_EXT_IRQ_NUM_MAX];
148 struct napi_struct napi;
149 struct net_device napi_ndev;
152 #define HEHANDLE_CAP_PHYINFO_SIZE 3
153 #define HECAP_PHYINFO_SIZE 9
154 #define HECAP_MACINFO_SIZE 5
155 #define HECAP_TXRX_MCS_NSS_SIZE 2
156 #define HECAP_PPET16_PPET8_MAX_SIZE 25
158 #define HE_PPET16_PPET8_SIZE 8
160 /* 802.11ax PPE (PPDU packet Extension) threshold */
161 struct he_ppe_threshold {
164 u32 ppet16_ppet8_ru3_ru0[HE_PPET16_PPET8_SIZE];
168 u8 hecap_macinfo[HECAP_MACINFO_SIZE];
169 u32 hecap_rxmcsnssmap;
170 u32 hecap_txmcsnssmap;
171 u32 hecap_phyinfo[HEHANDLE_CAP_PHYINFO_SIZE];
172 struct he_ppe_threshold hecap_ppet;
179 WMI_HOST_TP_SCALE_MAX = 0,
180 WMI_HOST_TP_SCALE_50 = 1,
181 WMI_HOST_TP_SCALE_25 = 2,
182 WMI_HOST_TP_SCALE_12 = 3,
183 WMI_HOST_TP_SCALE_MIN = 4,
184 WMI_HOST_TP_SCALE_SIZE = 5,
187 enum ath11k_scan_state {
189 ATH11K_SCAN_STARTING,
191 ATH11K_SCAN_ABORTING,
194 enum ath11k_11d_state {
196 ATH11K_11D_PREPARING,
200 enum ath11k_dev_flags {
202 ATH11K_FLAG_CORE_REGISTERED,
203 ATH11K_FLAG_CRASH_FLUSH,
204 ATH11K_FLAG_RAW_MODE,
205 ATH11K_FLAG_HW_CRYPTO_DISABLED,
207 ATH11K_FLAG_RECOVERY,
208 ATH11K_FLAG_UNREGISTERING,
209 ATH11K_FLAG_REGISTERED,
210 ATH11K_FLAG_QMI_FAIL,
211 ATH11K_FLAG_HTC_SUSPEND_COMPLETE,
212 ATH11K_FLAG_CE_IRQ_ENABLED,
213 ATH11K_FLAG_EXT_IRQ_ENABLED,
214 ATH11K_FLAG_FIXED_MEM_RGN,
217 enum ath11k_monitor_flags {
218 ATH11K_FLAG_MONITOR_CONF_ENABLED,
219 ATH11K_FLAG_MONITOR_STARTED,
220 ATH11K_FLAG_MONITOR_VDEV_CREATED,
225 enum wmi_vdev_type vdev_type;
226 enum wmi_vdev_subtype vdev_subtype;
232 u8 hal_addr_search_flags;
236 struct ieee80211_vif *vif;
239 struct wmi_wmm_params_all_arg wmm_params;
240 struct list_head list;
246 /* 127 stations; wmi limit */
250 u8 ssid[IEEE80211_MAX_SSID_LEN];
252 /* P2P_IE with NoA attribute for P2P_GO case */
260 bool spectral_enabled;
264 struct cfg80211_bitrate_mask bitrate_mask;
265 struct delayed_work connection_loss_work;
266 int num_legacy_stations;
267 int rtscts_prot_mode;
272 bool do_not_send_tmpl;
273 struct ieee80211_chanctx_conf chanctx;
274 #ifdef CONFIG_ATH11K_DEBUGFS
275 struct dentry *debugfs_twt;
276 #endif /* CONFIG_ATH11K_DEBUGFS */
279 struct ath11k_vif_iter {
281 struct ath11k_vif *arvif;
284 struct ath11k_rx_peer_stats {
287 u64 num_mpdu_fcs_err;
290 u64 other_msdu_count;
291 u64 ampdu_msdu_count;
292 u64 non_ampdu_msdu_count;
294 u64 beamformed_count;
295 u64 mcs_count[HAL_RX_MAX_MCS + 1];
296 u64 nss_count[HAL_RX_MAX_NSS];
297 u64 bw_count[HAL_RX_BW_MAX];
298 u64 gi_count[HAL_RX_GI_MAX];
299 u64 coding_count[HAL_RX_SU_MU_CODING_MAX];
300 u64 tid_count[IEEE80211_NUM_TIDS + 1];
301 u64 pream_cnt[HAL_RX_PREAMBLE_MAX];
302 u64 reception_type[HAL_RX_RECEPTION_TYPE_MAX];
305 u64 ru_alloc_cnt[HAL_RX_RU_ALLOC_TYPE_MAX];
308 #define ATH11K_HE_MCS_NUM 12
309 #define ATH11K_VHT_MCS_NUM 10
310 #define ATH11K_BW_NUM 4
311 #define ATH11K_NSS_NUM 4
312 #define ATH11K_LEGACY_NUM 12
313 #define ATH11K_GI_NUM 4
314 #define ATH11K_HT_MCS_NUM 32
316 enum ath11k_pkt_rx_err {
317 ATH11K_PKT_RX_ERR_FCS,
318 ATH11K_PKT_RX_ERR_TKIP,
319 ATH11K_PKT_RX_ERR_CRYPT,
320 ATH11K_PKT_RX_ERR_PEER_IDX_INVAL,
321 ATH11K_PKT_RX_ERR_MAX,
324 enum ath11k_ampdu_subfrm_num {
325 ATH11K_AMPDU_SUBFRM_NUM_10,
326 ATH11K_AMPDU_SUBFRM_NUM_20,
327 ATH11K_AMPDU_SUBFRM_NUM_30,
328 ATH11K_AMPDU_SUBFRM_NUM_40,
329 ATH11K_AMPDU_SUBFRM_NUM_50,
330 ATH11K_AMPDU_SUBFRM_NUM_60,
331 ATH11K_AMPDU_SUBFRM_NUM_MORE,
332 ATH11K_AMPDU_SUBFRM_NUM_MAX,
335 enum ath11k_amsdu_subfrm_num {
336 ATH11K_AMSDU_SUBFRM_NUM_1,
337 ATH11K_AMSDU_SUBFRM_NUM_2,
338 ATH11K_AMSDU_SUBFRM_NUM_3,
339 ATH11K_AMSDU_SUBFRM_NUM_4,
340 ATH11K_AMSDU_SUBFRM_NUM_MORE,
341 ATH11K_AMSDU_SUBFRM_NUM_MAX,
344 enum ath11k_counter_type {
345 ATH11K_COUNTER_TYPE_BYTES,
346 ATH11K_COUNTER_TYPE_PKTS,
347 ATH11K_COUNTER_TYPE_MAX,
350 enum ath11k_stats_type {
351 ATH11K_STATS_TYPE_SUCC,
352 ATH11K_STATS_TYPE_FAIL,
353 ATH11K_STATS_TYPE_RETRY,
354 ATH11K_STATS_TYPE_AMPDU,
355 ATH11K_STATS_TYPE_MAX,
358 struct ath11k_htt_data_stats {
359 u64 legacy[ATH11K_COUNTER_TYPE_MAX][ATH11K_LEGACY_NUM];
360 u64 ht[ATH11K_COUNTER_TYPE_MAX][ATH11K_HT_MCS_NUM];
361 u64 vht[ATH11K_COUNTER_TYPE_MAX][ATH11K_VHT_MCS_NUM];
362 u64 he[ATH11K_COUNTER_TYPE_MAX][ATH11K_HE_MCS_NUM];
363 u64 bw[ATH11K_COUNTER_TYPE_MAX][ATH11K_BW_NUM];
364 u64 nss[ATH11K_COUNTER_TYPE_MAX][ATH11K_NSS_NUM];
365 u64 gi[ATH11K_COUNTER_TYPE_MAX][ATH11K_GI_NUM];
368 struct ath11k_htt_tx_stats {
369 struct ath11k_htt_data_stats stats[ATH11K_STATS_TYPE_MAX];
375 struct ath11k_per_ppdu_tx_stats {
385 struct ath11k_vif *arvif;
387 /* the following are protected by ar->data_lock */
388 u32 changed; /* IEEE80211_RC_* */
392 enum hal_pn_type pn_type;
394 struct work_struct update_wk;
395 struct work_struct set_4addr_wk;
396 struct rate_info txrate;
398 struct rate_info last_txrate;
403 s8 chain_signal[IEEE80211_MAX_CHAINS];
404 struct ath11k_htt_tx_stats *tx_stats;
405 struct ath11k_rx_peer_stats *rx_stats;
407 #ifdef CONFIG_MAC80211_DEBUGFS
408 /* protected by conf_mutex */
416 #define ATH11K_MIN_5G_FREQ 4150
417 #define ATH11K_MIN_6G_FREQ 5925
418 #define ATH11K_MAX_6G_FREQ 7115
419 #define ATH11K_NUM_CHANS 101
420 #define ATH11K_MAX_5G_CHAN 173
425 ATH11K_STATE_RESTARTING,
426 ATH11K_STATE_RESTARTED,
428 /* Add other states as required */
431 /* Antenna noise floor */
432 #define ATH11K_DEFAULT_NOISE_FLOOR -95
434 #define ATH11K_INVALID_RSSI_FULL -1
436 #define ATH11K_INVALID_RSSI_EMPTY -128
438 struct ath11k_fw_stats {
439 struct dentry *debugfs_fwstats;
442 struct list_head pdevs;
443 struct list_head vdevs;
444 struct list_head bcn;
447 struct ath11k_dbg_htt_stats {
450 struct debug_htt_stats_req *stats_req;
451 /* protects shared stats req buffer */
455 #define MAX_MODULE_ID_BITMAP_WORDS 16
457 struct ath11k_debug {
458 struct dentry *debugfs_pdev;
459 struct ath11k_dbg_htt_stats htt_stats;
461 struct ath11k_fw_stats fw_stats;
462 struct completion fw_stats_complete;
467 u32 pktlog_peer_valid;
468 u8 pktlog_peer_addr[ETH_ALEN];
471 u32 module_id_bitmap[MAX_MODULE_ID_BITMAP_WORDS];
472 struct ath11k_debug_dbr *dbr_debug[WMI_DIRECT_BUF_MAX];
475 struct ath11k_per_peer_tx_stats {
487 #define ATH11K_FLUSH_TIMEOUT (5 * HZ)
488 #define ATH11K_VDEV_DELETE_TIMEOUT_HZ (5 * HZ)
491 struct ath11k_base *ab;
492 struct ath11k_pdev *pdev;
493 struct ieee80211_hw *hw;
494 struct ieee80211_ops *ops;
495 struct ath11k_pdev_wmi *wmi;
496 struct ath11k_pdev_dp dp;
497 u8 mac_addr[ETH_ALEN];
500 struct ath11k_he ar_he;
501 enum ath11k_state state;
504 struct completion started;
505 struct completion completed;
506 struct completion on_channel;
507 struct delayed_work timeout;
508 enum ath11k_scan_state state;
516 struct ieee80211_supported_band sbands[NUM_NL80211_BANDS];
517 struct ieee80211_sband_iftype_data
518 iftype[NUM_NL80211_BANDS][NUM_NL80211_IFTYPES];
521 unsigned long dev_flags;
522 unsigned int filter_flags;
523 unsigned long monitor_flags;
526 u32 txpower_limit_2g;
527 u32 txpower_limit_5g;
532 u32 max_num_stations;
533 /* To synchronize concurrent synchronous mac80211 callback operations,
534 * concurrent debugfs configuration and concurrent FW statistics events.
536 struct mutex conf_mutex;
537 /* protects the radio specific data like debug stats, ppdu_stats_info stats,
538 * vdev_stop_status info, scan data, ath11k_sta info, ath11k_vif info,
539 * channel context data, survey info, test mode data.
541 spinlock_t data_lock;
543 struct list_head arvifs;
544 /* should never be NULL; needed for regular htt rx */
545 struct ieee80211_channel *rx_channel;
547 /* valid during scan; needed for mgmt rx during scan */
548 struct ieee80211_channel *scan_channel;
554 /* pdev_idx starts from 0 whereas pdev->pdev_id starts with 1 */
558 struct completion peer_assoc_done;
559 struct completion peer_delete_done;
561 int install_key_status;
562 struct completion install_key_done;
564 int last_wmi_vdev_start_status;
565 struct completion vdev_setup_done;
566 struct completion vdev_delete_done;
570 u32 num_started_vdevs;
571 u32 num_created_vdevs;
572 unsigned long long allocated_vdev_map;
574 struct idr txmgmt_idr;
575 /* protects txmgmt_idr data */
576 spinlock_t txmgmt_idr_lock;
577 atomic_t num_pending_mgmt_tx;
578 wait_queue_head_t txmgmt_empty_waitq;
580 /* cycle count is reported twice for each visited channel during scan.
581 * access protected by data_lock
583 u32 survey_last_rx_clear_count;
584 u32 survey_last_cycle_count;
586 /* Channel info events are expected to come in pairs without and with
587 * COMPLETE flag set respectively for each channel visit during scan.
589 * However there are deviations from this rule. This flag is used to
590 * avoid reporting garbage data.
592 bool ch_info_can_report_survey;
593 struct survey_info survey[ATH11K_NUM_CHANS];
594 struct completion bss_survey_done;
596 struct work_struct regd_update_work;
598 struct work_struct wmi_mgmt_tx_work;
599 struct sk_buff_head wmi_mgmt_tx_queue;
601 struct ath11k_per_peer_tx_stats peer_tx_stats;
602 struct list_head ppdu_stats_info;
603 u32 ppdu_stat_list_depth;
605 struct ath11k_per_peer_tx_stats cached_stats;
609 #ifdef CONFIG_ATH11K_DEBUGFS
610 struct ath11k_debug debug;
612 #ifdef CONFIG_ATH11K_SPECTRAL
613 struct ath11k_spectral spectral;
615 bool dfs_block_radar_events;
616 struct ath11k_thermal thermal;
617 u32 vdev_id_11d_scan;
618 struct completion completed_11d_scan;
619 enum ath11k_11d_state state_11d;
620 bool regdom_set_by_user;
625 struct ath11k_band_cap {
627 u32 max_bw_supported;
631 u32 he_cap_phy_info[PSOC_HOST_MAX_PHY_SIZE];
632 struct ath11k_ppe_threshold he_ppet;
636 struct ath11k_pdev_cap {
644 u32 tx_chain_mask_shift;
645 u32 rx_chain_mask_shift;
646 struct ath11k_band_cap band[NUM_NL80211_BANDS];
647 bool nss_ratio_enabled;
654 struct ath11k_pdev_cap cap;
655 u8 mac_addr[ETH_ALEN];
658 struct ath11k_board_data {
659 const struct firmware *fw;
664 struct ath11k_bus_params {
668 bool fixed_mem_region;
669 bool static_window_map;
672 /* IPQ8074 HW channel counters frequency value in hertz */
673 #define IPQ8074_CC_FREQ_HERTZ 320000
675 struct ath11k_bp_stats {
676 /* Head Pointer reported by the last HTT Backpressure event for the ring */
679 /* Tail Pointer reported by the last HTT Backpressure event for the ring */
682 /* Number of Backpressure events received for the ring */
685 /* Last recorded event timestamp */
686 unsigned long jiffies;
689 struct ath11k_dp_ring_bp_stats {
690 struct ath11k_bp_stats umac_ring_bp_stats[HTT_SW_UMAC_RING_IDX_MAX];
691 struct ath11k_bp_stats lmac_ring_bp_stats[HTT_SW_LMAC_RING_IDX_MAX][MAX_RADIOS];
694 struct ath11k_soc_dp_tx_err_stats {
695 /* TCL Ring Descriptor unavailable */
696 u32 desc_na[DP_TCL_NUM_RING_MAX];
697 /* Other failures during dp_tx due to mem allocation failure
698 * idr unavailable etc.
703 struct ath11k_soc_dp_stats {
706 u32 rxdma_error[HAL_REO_ENTR_RING_RXDMA_ECODE_MAX];
707 u32 reo_error[HAL_REO_DEST_RING_ERROR_CODE_MAX];
708 u32 hal_reo_error[DP_REO_DST_RING_MAX];
709 struct ath11k_soc_dp_tx_err_stats tx_err;
710 struct ath11k_dp_ring_bp_stats bp_stats;
713 /* Master structure to hold the hw data which may be used in core module */
715 enum ath11k_hw_rev hw_rev;
716 struct platform_device *pdev;
718 struct ath11k_qmi qmi;
719 struct ath11k_wmi_base wmi_ab;
720 struct completion fw_ready;
722 /* HW channel counters frequency value in hertz common to all MACs */
725 struct ath11k_htc htc;
730 unsigned long mem_len;
734 const struct ath11k_hif_ops *ops;
738 struct completion wakeup_completed;
742 struct timer_list rx_replenish_retry;
743 struct ath11k_hal hal;
744 /* To synchronize core_start/core_stop */
745 struct mutex core_lock;
746 /* Protects data like peers */
747 spinlock_t base_lock;
748 struct ath11k_pdev pdevs[MAX_RADIOS];
750 enum WMI_HOST_WLAN_BAND supported_bands;
752 } target_pdev_ids[MAX_RADIOS];
753 u8 target_pdev_count;
754 struct ath11k_pdev __rcu *pdevs_active[MAX_RADIOS];
755 struct ath11k_hal_reg_capabilities_ext hal_reg_cap[MAX_RADIOS];
756 unsigned long long free_vdev_map;
757 struct list_head peers;
758 wait_queue_head_t peer_mapping_wq;
759 u8 mac_addr[ETH_ALEN];
761 u32 wlan_init_status;
762 int irq_num[ATH11K_IRQ_NUM_MAX];
763 struct ath11k_ext_irq_grp ext_irq_grp[ATH11K_EXT_IRQ_GRP_NUM_MAX];
764 struct ath11k_targ_cap target_caps;
765 u32 ext_service_bitmap[WMI_SERVICE_EXT_BM_SIZE];
766 bool pdevs_macaddr_valid;
769 struct ath11k_hw_params hw_params;
770 struct ath11k_bus_params bus_params;
772 const struct firmware *cal_file;
774 /* Below regd's are protected by ab->data_lock */
775 /* This is the regd set for every radio
776 * by the firmware during initializatin
778 struct ieee80211_regdomain *default_regd[MAX_RADIOS];
779 /* This regd is set during dynamic country setting
780 * This may or may not be used during the runtime
782 struct ieee80211_regdomain *new_regd[MAX_RADIOS];
784 /* Current DFS Regulatory */
785 enum ath11k_dfs_region dfs_region;
786 #ifdef CONFIG_ATH11K_DEBUGFS
787 struct dentry *debugfs_soc;
788 struct dentry *debugfs_ath11k;
790 struct ath11k_soc_dp_stats soc_stats;
792 unsigned long dev_flags;
793 struct completion driver_recovery;
794 struct workqueue_struct *workqueue;
795 struct work_struct restart_work;
796 struct work_struct update_11d_work;
799 /* protected by data_lock */
800 u32 fw_crash_counter;
802 u32 pktlog_defs_checksum;
804 struct ath11k_dbring_cap *db_caps;
806 struct work_struct rfkill_work;
808 /* true means radio is on */
809 bool rfkill_radio_on;
811 /* To synchronize 11d scan vdev id */
812 struct mutex vdev_id_11d_lock;
813 struct timer_list mon_reap_timer;
815 struct completion htc_suspend;
818 enum ath11k_bdf_search bdf_search;
821 u32 subsystem_vendor;
822 u32 subsystem_device;
826 u8 drv_priv[] __aligned(sizeof(void *));
829 struct ath11k_fw_stats_pdev {
830 struct list_head list;
834 /* Cycles spent transmitting frames */
836 /* Cycles spent receiving frames */
838 /* Total channel busy time, evidently */
840 /* Total on-channel time */
852 /* Num HTT cookies queued to dispatch list */
854 /* Num HTT cookies dispatched */
856 /* Num MSDU queued to WAL */
858 /* Num MPDU queue to WAL */
860 /* Num MSDUs dropped by WMM limit */
862 /* Num Local frames queued */
864 /* Num Local frames done */
866 /* Num queued to HW */
868 /* Num PPDU reaped from HW */
874 /* Num PPDUs cleaned up in TX abort */
876 /* Num MPDUs requeued by SW */
878 /* excessive retries */
881 /* data hw rate code */
883 /* Scheduler self triggers */
885 /* frames dropped due to excessive sw retries */
886 u32 sw_retry_failure;
887 /* illegal rate phy errors */
888 u32 illgl_rate_phy_err;
889 /* wal pdev continuous xretry */
890 u32 pdev_cont_xretry;
891 /* wal pdev tx timeouts */
893 /* wal pdev resets */
895 /* frames dropped due to non-availability of stateless TIDs */
896 u32 stateless_tid_alloc_failure;
897 /* PhY/BB underrun */
899 /* MPDU is more than txop limit */
901 /* Num sequences posted */
903 /* Num sequences failed in queueing */
904 u32 seq_failed_queueing;
905 /* Num sequences completed */
907 /* Num sequences restarted */
909 /* Num of MU sequences posted */
911 /* Num MPDUs flushed by SW, HWPAUSED, SW TXABORT
912 * (Reset,channel change)
915 /* Num MPDUs filtered by HW, all filter condition (TTL expired) */
917 /* Num MPDUs truncated by PDG (TXOP, TBTT,
918 * PPDU_duration based on rate, dyn_bw)
921 /* Num MPDUs that was tried but didn't receive ACK or BA */
922 s32 mpdus_ack_failed;
923 /* Num MPDUs that was dropped du to expiry. */
927 /* Cnts any change in ring routing mid-ppdu */
928 s32 mid_ppdu_route_change;
929 /* Total number of statuses processed */
931 /* Extra frags on rings 0-3 */
936 /* MSDUs / MPDUs delivered to HTT */
939 /* MSDUs / MPDUs delivered to local stack */
942 /* AMSDUs that have more MSDUs than the status ring size */
944 /* Number of PHY errors */
946 /* Number of PHY errors drops */
948 /* Number of mpdu errors - FCS, MIC, ENC etc. */
950 /* Num overflow errors */
954 struct ath11k_fw_stats_vdev {
955 struct list_head list;
960 u32 num_tx_frames[WLAN_MAX_AC];
962 u32 num_tx_frames_retries[WLAN_MAX_AC];
963 u32 num_tx_frames_failures[WLAN_MAX_AC];
968 u32 num_tx_not_acked;
969 u32 tx_rate_history[MAX_TX_RATE_VALUES];
970 u32 beacon_rssi_history[MAX_TX_RATE_VALUES];
973 struct ath11k_fw_stats_bcn {
974 struct list_head list;
978 u32 tx_bcn_outage_cnt;
981 extern const struct ce_pipe_config ath11k_target_ce_config_wlan_ipq8074[];
982 extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq8074[];
983 extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq6018[];
985 extern const struct ce_pipe_config ath11k_target_ce_config_wlan_qca6390[];
986 extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qca6390[];
988 extern const struct ce_pipe_config ath11k_target_ce_config_wlan_qcn9074[];
989 extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qcn9074[];
990 int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab);
991 int ath11k_core_pre_init(struct ath11k_base *ab);
992 int ath11k_core_init(struct ath11k_base *ath11k);
993 void ath11k_core_deinit(struct ath11k_base *ath11k);
994 struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
996 const struct ath11k_bus_params *bus_params);
997 void ath11k_core_free(struct ath11k_base *ath11k);
998 int ath11k_core_fetch_bdf(struct ath11k_base *ath11k,
999 struct ath11k_board_data *bd);
1000 int ath11k_core_fetch_regdb(struct ath11k_base *ab, struct ath11k_board_data *bd);
1001 int ath11k_core_fetch_board_data_api_1(struct ath11k_base *ab,
1002 struct ath11k_board_data *bd,
1004 void ath11k_core_free_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd);
1005 int ath11k_core_check_dt(struct ath11k_base *ath11k);
1007 void ath11k_core_halt(struct ath11k *ar);
1008 int ath11k_core_resume(struct ath11k_base *ab);
1009 int ath11k_core_suspend(struct ath11k_base *ab);
1011 const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab,
1012 const char *filename);
1014 static inline const char *ath11k_scan_state_str(enum ath11k_scan_state state)
1017 case ATH11K_SCAN_IDLE:
1019 case ATH11K_SCAN_STARTING:
1021 case ATH11K_SCAN_RUNNING:
1023 case ATH11K_SCAN_ABORTING:
1030 static inline struct ath11k_skb_cb *ATH11K_SKB_CB(struct sk_buff *skb)
1032 BUILD_BUG_ON(sizeof(struct ath11k_skb_cb) >
1033 IEEE80211_TX_INFO_DRIVER_DATA_SIZE);
1034 return (struct ath11k_skb_cb *)&IEEE80211_SKB_CB(skb)->driver_data;
1037 static inline struct ath11k_skb_rxcb *ATH11K_SKB_RXCB(struct sk_buff *skb)
1039 BUILD_BUG_ON(sizeof(struct ath11k_skb_rxcb) > sizeof(skb->cb));
1040 return (struct ath11k_skb_rxcb *)skb->cb;
1043 static inline struct ath11k_vif *ath11k_vif_to_arvif(struct ieee80211_vif *vif)
1045 return (struct ath11k_vif *)vif->drv_priv;
1048 static inline struct ath11k *ath11k_ab_to_ar(struct ath11k_base *ab,
1051 return ab->pdevs[ath11k_hw_mac_id_to_pdev_id(&ab->hw_params, mac_id)].ar;
1054 static inline void ath11k_core_create_firmware_path(struct ath11k_base *ab,
1055 const char *filename,
1056 void *buf, size_t buf_len)
1058 snprintf(buf, buf_len, "%s/%s/%s", ATH11K_FW_DIR,
1059 ab->hw_params.fw.dir, filename);
1062 static inline const char *ath11k_bus_str(enum ath11k_bus bus)
1065 case ATH11K_BUS_PCI:
1067 case ATH11K_BUS_AHB:
1074 #endif /* _CORE_H_ */