Path: blob/main/sys/contrib/dev/athk/ath12k/core.h
48378 views
/* SPDX-License-Identifier: BSD-3-Clause-Clear */1/*2* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.3* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.4*/56#ifndef ATH12K_CORE_H7#define ATH12K_CORE_H89#include <linux/types.h>10#include <linux/interrupt.h>11#include <linux/irq.h>12#include <linux/bitfield.h>13#if defined(__FreeBSD__)14#include <linux/wait.h>15#endif16#include "qmi.h"17#include "htc.h"18#include "wmi.h"19#include "hal.h"20#include "dp.h"21#include "ce.h"22#include "mac.h"23#include "hw.h"24#include "hal_rx.h"25#include "reg.h"26#include "dbring.h"2728#define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)2930#define ATH12K_TX_MGMT_NUM_PENDING_MAX 5123132#define ATH12K_TX_MGMT_TARGET_MAX_SUPPORT_WMI 643334/* Pending management packets threshold for dropping probe responses */35#define ATH12K_PRB_RSP_DROP_THRESHOLD ((ATH12K_TX_MGMT_TARGET_MAX_SUPPORT_WMI * 3) / 4)3637#define ATH12K_INVALID_HW_MAC_ID 0xFF38#define ATH12K_RX_RATE_TABLE_NUM 32039#define ATH12K_RX_RATE_TABLE_11AX_NUM 5764041#define ATH12K_MON_TIMER_INTERVAL 1042#define ATH12K_RESET_TIMEOUT_HZ (20 * HZ)43#define ATH12K_RESET_MAX_FAIL_COUNT_FIRST 344#define ATH12K_RESET_MAX_FAIL_COUNT_FINAL 545#define ATH12K_RESET_FAIL_TIMEOUT_HZ (20 * HZ)46#define ATH12K_RECONFIGURE_TIMEOUT_HZ (10 * HZ)47#define ATH12K_RECOVER_START_TIMEOUT_HZ (20 * HZ)4849#if defined(__FreeBSD__)50#ifdef WME_AC_BE51#undef WME_AC_BE52#endif53#ifdef WME_AC_BK54#undef WME_AC_BK55#endif56#ifdef WME_AC_VI57#undef WME_AC_VI58#endif59#ifdef WME_AC_VO60#undef WME_AC_VO61#endif62#ifdef WME_NUM_AC63#undef WME_NUM_AC64#endif65#endif6667enum wme_ac {68WME_AC_BE,69WME_AC_BK,70WME_AC_VI,71WME_AC_VO,72WME_NUM_AC73};7475#define ATH12K_HT_MCS_MAX 776#define ATH12K_VHT_MCS_MAX 977#define ATH12K_HE_MCS_MAX 117879enum ath12k_crypt_mode {80/* Only use hardware crypto engine */81ATH12K_CRYPT_MODE_HW,82/* Only use software crypto */83ATH12K_CRYPT_MODE_SW,84};8586static inline enum wme_ac ath12k_tid_to_ac(u32 tid)87{88return (((tid == 0) || (tid == 3)) ? WME_AC_BE :89((tid == 1) || (tid == 2)) ? WME_AC_BK :90((tid == 4) || (tid == 5)) ? WME_AC_VI :91WME_AC_VO);92}9394enum ath12k_skb_flags {95ATH12K_SKB_HW_80211_ENCAP = BIT(0),96ATH12K_SKB_CIPHER_SET = BIT(1),97};9899struct ath12k_skb_cb {100dma_addr_t paddr;101struct ath12k *ar;102struct ieee80211_vif *vif;103dma_addr_t paddr_ext_desc;104u32 cipher;105u8 flags;106};107108struct ath12k_skb_rxcb {109dma_addr_t paddr;110bool is_first_msdu;111bool is_last_msdu;112bool is_continuation;113bool is_mcbc;114bool is_eapol;115struct hal_rx_desc *rx_desc;116u8 err_rel_src;117u8 err_code;118u8 mac_id;119u8 unmapped;120u8 is_frag;121u8 tid;122u16 peer_id;123};124125enum ath12k_hw_rev {126ATH12K_HW_QCN9274_HW10,127ATH12K_HW_QCN9274_HW20,128ATH12K_HW_WCN7850_HW20129};130131enum ath12k_firmware_mode {132/* the default mode, standard 802.11 functionality */133ATH12K_FIRMWARE_MODE_NORMAL,134135/* factory tests etc */136ATH12K_FIRMWARE_MODE_FTM,137};138139#define ATH12K_IRQ_NUM_MAX 57140#define ATH12K_EXT_IRQ_NUM_MAX 16141142struct ath12k_ext_irq_grp {143struct ath12k_base *ab;144u32 irqs[ATH12K_EXT_IRQ_NUM_MAX];145u32 num_irq;146u32 grp_id;147u64 timestamp;148struct napi_struct napi;149struct net_device napi_ndev;150};151152#define HEHANDLE_CAP_PHYINFO_SIZE 3153#define HECAP_PHYINFO_SIZE 9154#define HECAP_MACINFO_SIZE 5155#define HECAP_TXRX_MCS_NSS_SIZE 2156#define HECAP_PPET16_PPET8_MAX_SIZE 25157158#define HE_PPET16_PPET8_SIZE 8159160/* 802.11ax PPE (PPDU packet Extension) threshold */161struct he_ppe_threshold {162u32 numss_m1;163u32 ru_mask;164u32 ppet16_ppet8_ru3_ru0[HE_PPET16_PPET8_SIZE];165};166167struct ath12k_he {168u8 hecap_macinfo[HECAP_MACINFO_SIZE];169u32 hecap_rxmcsnssmap;170u32 hecap_txmcsnssmap;171u32 hecap_phyinfo[HEHANDLE_CAP_PHYINFO_SIZE];172struct he_ppe_threshold hecap_ppet;173u32 heop_param;174};175176#define MAX_RADIOS 3177178enum {179WMI_HOST_TP_SCALE_MAX = 0,180WMI_HOST_TP_SCALE_50 = 1,181WMI_HOST_TP_SCALE_25 = 2,182WMI_HOST_TP_SCALE_12 = 3,183WMI_HOST_TP_SCALE_MIN = 4,184WMI_HOST_TP_SCALE_SIZE = 5,185};186187enum ath12k_scan_state {188ATH12K_SCAN_IDLE,189ATH12K_SCAN_STARTING,190ATH12K_SCAN_RUNNING,191ATH12K_SCAN_ABORTING,192};193194enum ath12k_dev_flags {195ATH12K_CAC_RUNNING,196ATH12K_FLAG_CRASH_FLUSH,197ATH12K_FLAG_RAW_MODE,198ATH12K_FLAG_HW_CRYPTO_DISABLED,199ATH12K_FLAG_RECOVERY,200ATH12K_FLAG_UNREGISTERING,201ATH12K_FLAG_REGISTERED,202ATH12K_FLAG_QMI_FAIL,203ATH12K_FLAG_HTC_SUSPEND_COMPLETE,204};205206enum ath12k_monitor_flags {207ATH12K_FLAG_MONITOR_ENABLED,208};209210struct ath12k_vif {211u32 vdev_id;212enum wmi_vdev_type vdev_type;213enum wmi_vdev_subtype vdev_subtype;214u32 beacon_interval;215u32 dtim_period;216u16 ast_hash;217u16 ast_idx;218u16 tcl_metadata;219u8 hal_addr_search_flags;220u8 search_type;221222struct ath12k *ar;223struct ieee80211_vif *vif;224225int bank_id;226u8 vdev_id_check_en;227228struct wmi_wmm_params_all_arg wmm_params;229struct list_head list;230union {231struct {232u32 uapsd;233} sta;234struct {235/* 127 stations; wmi limit */236u8 tim_bitmap[16];237u8 tim_len;238u32 ssid_len;239u8 ssid[IEEE80211_MAX_SSID_LEN];240bool hidden_ssid;241/* P2P_IE with NoA attribute for P2P_GO case */242u32 noa_len;243u8 *noa_data;244} ap;245} u;246247bool is_started;248bool is_up;249u32 aid;250u8 bssid[ETH_ALEN];251struct cfg80211_bitrate_mask bitrate_mask;252int num_legacy_stations;253int rtscts_prot_mode;254int txpower;255bool rsnie_present;256bool wpaie_present;257struct ieee80211_chanctx_conf chanctx;258u32 key_cipher;259u8 tx_encap_type;260u8 vdev_stats_id;261u32 punct_bitmap;262};263264struct ath12k_vif_iter {265u32 vdev_id;266struct ath12k_vif *arvif;267};268269#define HAL_AST_IDX_INVALID 0xFFFF270#define HAL_RX_MAX_MCS 12271#define HAL_RX_MAX_MCS_HT 31272#define HAL_RX_MAX_MCS_VHT 9273#define HAL_RX_MAX_MCS_HE 11274#define HAL_RX_MAX_NSS 8275#define HAL_RX_MAX_NUM_LEGACY_RATES 12276#define ATH12K_RX_RATE_TABLE_11AX_NUM 576277#define ATH12K_RX_RATE_TABLE_NUM 320278279struct ath12k_rx_peer_rate_stats {280u64 ht_mcs_count[HAL_RX_MAX_MCS_HT + 1];281u64 vht_mcs_count[HAL_RX_MAX_MCS_VHT + 1];282u64 he_mcs_count[HAL_RX_MAX_MCS_HE + 1];283u64 nss_count[HAL_RX_MAX_NSS];284u64 bw_count[HAL_RX_BW_MAX];285u64 gi_count[HAL_RX_GI_MAX];286u64 legacy_count[HAL_RX_MAX_NUM_LEGACY_RATES];287u64 rx_rate[ATH12K_RX_RATE_TABLE_11AX_NUM];288};289290struct ath12k_rx_peer_stats {291u64 num_msdu;292u64 num_mpdu_fcs_ok;293u64 num_mpdu_fcs_err;294u64 tcp_msdu_count;295u64 udp_msdu_count;296u64 other_msdu_count;297u64 ampdu_msdu_count;298u64 non_ampdu_msdu_count;299u64 stbc_count;300u64 beamformed_count;301u64 mcs_count[HAL_RX_MAX_MCS + 1];302u64 nss_count[HAL_RX_MAX_NSS];303u64 bw_count[HAL_RX_BW_MAX];304u64 gi_count[HAL_RX_GI_MAX];305u64 coding_count[HAL_RX_SU_MU_CODING_MAX];306u64 tid_count[IEEE80211_NUM_TIDS + 1];307u64 pream_cnt[HAL_RX_PREAMBLE_MAX];308u64 reception_type[HAL_RX_RECEPTION_TYPE_MAX];309u64 rx_duration;310u64 dcm_count;311u64 ru_alloc_cnt[HAL_RX_RU_ALLOC_TYPE_MAX];312struct ath12k_rx_peer_rate_stats pkt_stats;313struct ath12k_rx_peer_rate_stats byte_stats;314};315316#define ATH12K_HE_MCS_NUM 12317#define ATH12K_VHT_MCS_NUM 10318#define ATH12K_BW_NUM 5319#define ATH12K_NSS_NUM 4320#define ATH12K_LEGACY_NUM 12321#define ATH12K_GI_NUM 4322#define ATH12K_HT_MCS_NUM 32323324enum ath12k_pkt_rx_err {325ATH12K_PKT_RX_ERR_FCS,326ATH12K_PKT_RX_ERR_TKIP,327ATH12K_PKT_RX_ERR_CRYPT,328ATH12K_PKT_RX_ERR_PEER_IDX_INVAL,329ATH12K_PKT_RX_ERR_MAX,330};331332enum ath12k_ampdu_subfrm_num {333ATH12K_AMPDU_SUBFRM_NUM_10,334ATH12K_AMPDU_SUBFRM_NUM_20,335ATH12K_AMPDU_SUBFRM_NUM_30,336ATH12K_AMPDU_SUBFRM_NUM_40,337ATH12K_AMPDU_SUBFRM_NUM_50,338ATH12K_AMPDU_SUBFRM_NUM_60,339ATH12K_AMPDU_SUBFRM_NUM_MORE,340ATH12K_AMPDU_SUBFRM_NUM_MAX,341};342343enum ath12k_amsdu_subfrm_num {344ATH12K_AMSDU_SUBFRM_NUM_1,345ATH12K_AMSDU_SUBFRM_NUM_2,346ATH12K_AMSDU_SUBFRM_NUM_3,347ATH12K_AMSDU_SUBFRM_NUM_4,348ATH12K_AMSDU_SUBFRM_NUM_MORE,349ATH12K_AMSDU_SUBFRM_NUM_MAX,350};351352enum ath12k_counter_type {353ATH12K_COUNTER_TYPE_BYTES,354ATH12K_COUNTER_TYPE_PKTS,355ATH12K_COUNTER_TYPE_MAX,356};357358enum ath12k_stats_type {359ATH12K_STATS_TYPE_SUCC,360ATH12K_STATS_TYPE_FAIL,361ATH12K_STATS_TYPE_RETRY,362ATH12K_STATS_TYPE_AMPDU,363ATH12K_STATS_TYPE_MAX,364};365366struct ath12k_htt_data_stats {367u64 legacy[ATH12K_COUNTER_TYPE_MAX][ATH12K_LEGACY_NUM];368u64 ht[ATH12K_COUNTER_TYPE_MAX][ATH12K_HT_MCS_NUM];369u64 vht[ATH12K_COUNTER_TYPE_MAX][ATH12K_VHT_MCS_NUM];370u64 he[ATH12K_COUNTER_TYPE_MAX][ATH12K_HE_MCS_NUM];371u64 bw[ATH12K_COUNTER_TYPE_MAX][ATH12K_BW_NUM];372u64 nss[ATH12K_COUNTER_TYPE_MAX][ATH12K_NSS_NUM];373u64 gi[ATH12K_COUNTER_TYPE_MAX][ATH12K_GI_NUM];374u64 transmit_type[ATH12K_COUNTER_TYPE_MAX][HAL_RX_RECEPTION_TYPE_MAX];375u64 ru_loc[ATH12K_COUNTER_TYPE_MAX][HAL_RX_RU_ALLOC_TYPE_MAX];376};377378struct ath12k_htt_tx_stats {379struct ath12k_htt_data_stats stats[ATH12K_STATS_TYPE_MAX];380u64 tx_duration;381u64 ba_fails;382u64 ack_fails;383u16 ru_start;384u16 ru_tones;385u32 mu_group[MAX_MU_GROUP_ID];386};387388struct ath12k_per_ppdu_tx_stats {389u16 succ_pkts;390u16 failed_pkts;391u16 retry_pkts;392u32 succ_bytes;393u32 failed_bytes;394u32 retry_bytes;395};396397struct ath12k_wbm_tx_stats {398u64 wbm_tx_comp_stats[HAL_WBM_REL_HTT_TX_COMP_STATUS_MAX];399};400401struct ath12k_sta {402struct ath12k_vif *arvif;403404/* the following are protected by ar->data_lock */405u32 changed; /* IEEE80211_RC_* */406u32 bw;407u32 nss;408u32 smps;409enum hal_pn_type pn_type;410411struct work_struct update_wk;412struct rate_info txrate;413struct rate_info last_txrate;414u64 rx_duration;415u64 tx_duration;416u8 rssi_comb;417struct ath12k_rx_peer_stats *rx_stats;418struct ath12k_wbm_tx_stats *wbm_tx_stats;419u32 bw_prev;420};421422#define ATH12K_MIN_5G_FREQ 4150423#define ATH12K_MIN_6G_FREQ 5945424#define ATH12K_MAX_6G_FREQ 7115425#define ATH12K_NUM_CHANS 100426#define ATH12K_MAX_5G_CHAN 173427428enum ath12k_state {429ATH12K_STATE_OFF,430ATH12K_STATE_ON,431ATH12K_STATE_RESTARTING,432ATH12K_STATE_RESTARTED,433ATH12K_STATE_WEDGED,434/* Add other states as required */435};436437/* Antenna noise floor */438#define ATH12K_DEFAULT_NOISE_FLOOR -95439440struct ath12k_fw_stats {441u32 pdev_id;442u32 stats_id;443struct list_head pdevs;444struct list_head vdevs;445struct list_head bcn;446};447448struct ath12k_per_peer_tx_stats {449u32 succ_bytes;450u32 retry_bytes;451u32 failed_bytes;452u32 duration;453u16 succ_pkts;454u16 retry_pkts;455u16 failed_pkts;456u16 ru_start;457u16 ru_tones;458u8 ba_fails;459u8 ppdu_type;460u32 mu_grpid;461u32 mu_pos;462bool is_ampdu;463};464465#define ATH12K_FLUSH_TIMEOUT (5 * HZ)466#define ATH12K_VDEV_DELETE_TIMEOUT_HZ (5 * HZ)467468struct ath12k {469struct ath12k_base *ab;470struct ath12k_pdev *pdev;471struct ieee80211_hw *hw;472struct ieee80211_ops *ops;473struct ath12k_wmi_pdev *wmi;474struct ath12k_pdev_dp dp;475u8 mac_addr[ETH_ALEN];476u32 ht_cap_info;477u32 vht_cap_info;478struct ath12k_he ar_he;479enum ath12k_state state;480bool supports_6ghz;481struct {482struct completion started;483struct completion completed;484struct completion on_channel;485struct delayed_work timeout;486enum ath12k_scan_state state;487bool is_roc;488int vdev_id;489int roc_freq;490bool roc_notify;491} scan;492493struct {494struct ieee80211_supported_band sbands[NUM_NL80211_BANDS];495struct ieee80211_sband_iftype_data496iftype[NUM_NL80211_BANDS][NUM_NL80211_IFTYPES];497} mac;498499unsigned long dev_flags;500unsigned int filter_flags;501unsigned long monitor_flags;502u32 min_tx_power;503u32 max_tx_power;504u32 txpower_limit_2g;505u32 txpower_limit_5g;506u32 txpower_scale;507u32 power_scale;508u32 chan_tx_pwr;509u32 num_stations;510u32 max_num_stations;511bool monitor_present;512/* To synchronize concurrent synchronous mac80211 callback operations,513* concurrent debugfs configuration and concurrent FW statistics events.514*/515struct mutex conf_mutex;516/* protects the radio specific data like debug stats, ppdu_stats_info stats,517* vdev_stop_status info, scan data, ath12k_sta info, ath12k_vif info,518* channel context data, survey info, test mode data.519*/520spinlock_t data_lock;521522struct list_head arvifs;523/* should never be NULL; needed for regular htt rx */524struct ieee80211_channel *rx_channel;525526/* valid during scan; needed for mgmt rx during scan */527struct ieee80211_channel *scan_channel;528529u8 cfg_tx_chainmask;530u8 cfg_rx_chainmask;531u8 num_rx_chains;532u8 num_tx_chains;533/* pdev_idx starts from 0 whereas pdev->pdev_id starts with 1 */534u8 pdev_idx;535u8 lmac_id;536537struct completion peer_assoc_done;538struct completion peer_delete_done;539540int install_key_status;541struct completion install_key_done;542543int last_wmi_vdev_start_status;544struct completion vdev_setup_done;545struct completion vdev_delete_done;546547int num_peers;548int max_num_peers;549u32 num_started_vdevs;550u32 num_created_vdevs;551unsigned long long allocated_vdev_map;552553struct idr txmgmt_idr;554/* protects txmgmt_idr data */555spinlock_t txmgmt_idr_lock;556atomic_t num_pending_mgmt_tx;557wait_queue_head_t txmgmt_empty_waitq;558559/* cycle count is reported twice for each visited channel during scan.560* access protected by data_lock561*/562u32 survey_last_rx_clear_count;563u32 survey_last_cycle_count;564565/* Channel info events are expected to come in pairs without and with566* COMPLETE flag set respectively for each channel visit during scan.567*568* However there are deviations from this rule. This flag is used to569* avoid reporting garbage data.570*/571bool ch_info_can_report_survey;572struct survey_info survey[ATH12K_NUM_CHANS];573struct completion bss_survey_done;574575struct work_struct regd_update_work;576577struct work_struct wmi_mgmt_tx_work;578struct sk_buff_head wmi_mgmt_tx_queue;579580struct ath12k_per_peer_tx_stats peer_tx_stats;581struct list_head ppdu_stats_info;582u32 ppdu_stat_list_depth;583584struct ath12k_per_peer_tx_stats cached_stats;585u32 last_ppdu_id;586u32 cached_ppdu_id;587588bool dfs_block_radar_events;589bool monitor_conf_enabled;590bool monitor_vdev_created;591bool monitor_started;592int monitor_vdev_id;593};594595struct ath12k_band_cap {596u32 phy_id;597u32 max_bw_supported;598u32 ht_cap_info;599u32 he_cap_info[2];600u32 he_mcs;601u32 he_cap_phy_info[PSOC_HOST_MAX_PHY_SIZE];602struct ath12k_wmi_ppe_threshold_arg he_ppet;603u16 he_6ghz_capa;604u32 eht_cap_mac_info[WMI_MAX_EHTCAP_MAC_SIZE];605u32 eht_cap_phy_info[WMI_MAX_EHTCAP_PHY_SIZE];606u32 eht_mcs_20_only;607u32 eht_mcs_80;608u32 eht_mcs_160;609u32 eht_mcs_320;610struct ath12k_wmi_ppe_threshold_arg eht_ppet;611u32 eht_cap_info_internal;612};613614struct ath12k_pdev_cap {615u32 supported_bands;616u32 ampdu_density;617u32 vht_cap;618u32 vht_mcs;619u32 he_mcs;620u32 tx_chain_mask;621u32 rx_chain_mask;622u32 tx_chain_mask_shift;623u32 rx_chain_mask_shift;624struct ath12k_band_cap band[NUM_NL80211_BANDS];625};626627struct mlo_timestamp {628u32 info;629u32 sync_timestamp_lo_us;630u32 sync_timestamp_hi_us;631u32 mlo_offset_lo;632u32 mlo_offset_hi;633u32 mlo_offset_clks;634u32 mlo_comp_clks;635u32 mlo_comp_timer;636};637638struct ath12k_pdev {639struct ath12k *ar;640u32 pdev_id;641struct ath12k_pdev_cap cap;642u8 mac_addr[ETH_ALEN];643struct mlo_timestamp timestamp;644};645646struct ath12k_fw_pdev {647u32 pdev_id;648u32 phy_id;649u32 supported_bands;650};651652struct ath12k_board_data {653const struct firmware *fw;654const void *data;655size_t len;656};657658struct ath12k_soc_dp_tx_err_stats {659/* TCL Ring Descriptor unavailable */660u32 desc_na[DP_TCL_NUM_RING_MAX];661/* Other failures during dp_tx due to mem allocation failure662* idr unavailable etc.663*/664atomic_t misc_fail;665};666667struct ath12k_soc_dp_stats {668u32 err_ring_pkts;669u32 invalid_rbm;670u32 rxdma_error[HAL_REO_ENTR_RING_RXDMA_ECODE_MAX];671u32 reo_error[HAL_REO_DEST_RING_ERROR_CODE_MAX];672u32 hal_reo_error[DP_REO_DST_RING_MAX];673struct ath12k_soc_dp_tx_err_stats tx_err;674};675676/* Master structure to hold the hw data which may be used in core module */677struct ath12k_base {678enum ath12k_hw_rev hw_rev;679struct platform_device *pdev;680struct device *dev;681struct ath12k_qmi qmi;682struct ath12k_wmi_base wmi_ab;683struct completion fw_ready;684int num_radios;685/* HW channel counters frequency value in hertz common to all MACs */686u32 cc_freq_hz;687688struct ath12k_htc htc;689690struct ath12k_dp dp;691692void __iomem *mem;693unsigned long mem_len;694695struct {696enum ath12k_bus bus;697const struct ath12k_hif_ops *ops;698} hif;699700struct ath12k_ce ce;701struct timer_list rx_replenish_retry;702struct ath12k_hal hal;703/* To synchronize core_start/core_stop */704struct mutex core_lock;705/* Protects data like peers */706spinlock_t base_lock;707708/* Single pdev device (struct ath12k_hw_params::single_pdev_only):709*710* Firmware maintains data for all bands but advertises a single711* phy to the host which is stored as a single element in this712* array.713*714* Other devices:715*716* This array will contain as many elements as the number of717* radios.718*/719struct ath12k_pdev pdevs[MAX_RADIOS];720721/* struct ath12k_hw_params::single_pdev_only devices use this to722* store phy specific data723*/724struct ath12k_fw_pdev fw_pdev[MAX_RADIOS];725u8 fw_pdev_count;726727struct ath12k_pdev __rcu *pdevs_active[MAX_RADIOS];728struct ath12k_wmi_hal_reg_capabilities_ext_arg hal_reg_cap[MAX_RADIOS];729unsigned long long free_vdev_map;730unsigned long long free_vdev_stats_id_map;731struct list_head peers;732wait_queue_head_t peer_mapping_wq;733u8 mac_addr[ETH_ALEN];734bool wmi_ready;735u32 wlan_init_status;736int irq_num[ATH12K_IRQ_NUM_MAX];737struct ath12k_ext_irq_grp ext_irq_grp[ATH12K_EXT_IRQ_GRP_NUM_MAX];738struct napi_struct *napi;739struct ath12k_wmi_target_cap_arg target_caps;740u32 ext_service_bitmap[WMI_SERVICE_EXT_BM_SIZE];741bool pdevs_macaddr_valid;742int bd_api;743744const struct ath12k_hw_params *hw_params;745746const struct firmware *cal_file;747748/* Below regd's are protected by ab->data_lock */749/* This is the regd set for every radio750* by the firmware during initialization751*/752struct ieee80211_regdomain *default_regd[MAX_RADIOS];753/* This regd is set during dynamic country setting754* This may or may not be used during the runtime755*/756struct ieee80211_regdomain *new_regd[MAX_RADIOS];757758/* Current DFS Regulatory */759enum ath12k_dfs_region dfs_region;760struct ath12k_soc_dp_stats soc_stats;761762unsigned long dev_flags;763struct completion driver_recovery;764struct workqueue_struct *workqueue;765struct work_struct restart_work;766struct workqueue_struct *workqueue_aux;767struct work_struct reset_work;768atomic_t reset_count;769atomic_t recovery_count;770atomic_t recovery_start_count;771bool is_reset;772struct completion reset_complete;773struct completion reconfigure_complete;774struct completion recovery_start;775/* continuous recovery fail count */776atomic_t fail_cont_count;777unsigned long reset_fail_timeout;778struct {779/* protected by data_lock */780u32 fw_crash_counter;781} stats;782u32 pktlog_defs_checksum;783784struct ath12k_dbring_cap *db_caps;785u32 num_db_cap;786787struct timer_list mon_reap_timer;788789struct completion htc_suspend;790791u64 fw_soc_drop_count;792bool static_window_map;793794/* must be last */795u8 drv_priv[] __aligned(sizeof(void *));796};797798int ath12k_core_qmi_firmware_ready(struct ath12k_base *ab);799int ath12k_core_pre_init(struct ath12k_base *ab);800int ath12k_core_init(struct ath12k_base *ath12k);801void ath12k_core_deinit(struct ath12k_base *ath12k);802struct ath12k_base *ath12k_core_alloc(struct device *dev, size_t priv_size,803enum ath12k_bus bus);804void ath12k_core_free(struct ath12k_base *ath12k);805int ath12k_core_fetch_board_data_api_1(struct ath12k_base *ab,806struct ath12k_board_data *bd,807char *filename);808int ath12k_core_fetch_bdf(struct ath12k_base *ath12k,809struct ath12k_board_data *bd);810void ath12k_core_free_bdf(struct ath12k_base *ab, struct ath12k_board_data *bd);811int ath12k_core_check_dt(struct ath12k_base *ath12k);812813void ath12k_core_halt(struct ath12k *ar);814int ath12k_core_resume(struct ath12k_base *ab);815int ath12k_core_suspend(struct ath12k_base *ab);816817const struct firmware *ath12k_core_firmware_request(struct ath12k_base *ab,818const char *filename);819820static inline const char *ath12k_scan_state_str(enum ath12k_scan_state state)821{822switch (state) {823case ATH12K_SCAN_IDLE:824return "idle";825case ATH12K_SCAN_STARTING:826return "starting";827case ATH12K_SCAN_RUNNING:828return "running";829case ATH12K_SCAN_ABORTING:830return "aborting";831}832833return "unknown";834}835836static inline struct ath12k_skb_cb *ATH12K_SKB_CB(struct sk_buff *skb)837{838BUILD_BUG_ON(sizeof(struct ath12k_skb_cb) >839IEEE80211_TX_INFO_DRIVER_DATA_SIZE);840return (struct ath12k_skb_cb *)&IEEE80211_SKB_CB(skb)->driver_data;841}842843static inline struct ath12k_skb_rxcb *ATH12K_SKB_RXCB(struct sk_buff *skb)844{845BUILD_BUG_ON(sizeof(struct ath12k_skb_rxcb) > sizeof(skb->cb));846return (struct ath12k_skb_rxcb *)skb->cb;847}848849static inline struct ath12k_vif *ath12k_vif_to_arvif(struct ieee80211_vif *vif)850{851return (struct ath12k_vif *)vif->drv_priv;852}853854static inline struct ath12k *ath12k_ab_to_ar(struct ath12k_base *ab,855int mac_id)856{857return ab->pdevs[ath12k_hw_mac_id_to_pdev_id(ab->hw_params, mac_id)].ar;858}859860static inline void ath12k_core_create_firmware_path(struct ath12k_base *ab,861const char *filename,862void *buf, size_t buf_len)863{864snprintf(buf, buf_len, "%s/%s/%s", ATH12K_FW_DIR,865ab->hw_params->fw.dir, filename);866}867868static inline const char *ath12k_bus_str(enum ath12k_bus bus)869{870switch (bus) {871case ATH12K_BUS_PCI:872return "pci";873}874875return "unknown";876}877878#endif /* _CORE_H_ */879880881