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
38 extern unsigned int ath11k_frame_mode
;
40 #define ATH11K_MON_TIMER_INTERVAL 10
42 enum ath11k_supported_bw
{
57 #define ATH11K_HT_MCS_MAX 7
58 #define ATH11K_VHT_MCS_MAX 9
59 #define ATH11K_HE_MCS_MAX 11
61 enum ath11k_crypt_mode
{
62 /* Only use hardware crypto engine */
64 /* Only use software crypto */
68 static inline enum wme_ac
ath11k_tid_to_ac(u32 tid
)
70 return (((tid
== 0) || (tid
== 3)) ? WME_AC_BE
:
71 ((tid
== 1) || (tid
== 2)) ? WME_AC_BK
:
72 ((tid
== 4) || (tid
== 5)) ? WME_AC_VI
:
76 enum ath11k_skb_flags
{
77 ATH11K_SKB_HW_80211_ENCAP
= BIT(0),
78 ATH11K_SKB_CIPHER_SET
= BIT(1),
81 struct ath11k_skb_cb
{
87 struct ieee80211_vif
*vif
;
90 struct ath11k_skb_rxcb
{
95 struct hal_rx_desc
*rx_desc
;
106 ATH11K_HW_QCA6390_HW20
,
107 ATH11K_HW_IPQ6018_HW10
,
110 enum ath11k_firmware_mode
{
111 /* the default mode, standard 802.11 functionality */
112 ATH11K_FIRMWARE_MODE_NORMAL
,
114 /* factory tests etc */
115 ATH11K_FIRMWARE_MODE_FTM
,
117 /* Cold boot calibration */
118 ATH11K_FIRMWARE_MODE_COLD_BOOT
= 7,
121 extern bool ath11k_cold_boot_cal
;
123 #define ATH11K_IRQ_NUM_MAX 52
124 #define ATH11K_EXT_IRQ_NUM_MAX 16
126 struct ath11k_ext_irq_grp
{
127 struct ath11k_base
*ab
;
128 u32 irqs
[ATH11K_EXT_IRQ_NUM_MAX
];
132 struct napi_struct napi
;
133 struct net_device napi_ndev
;
136 #define HEHANDLE_CAP_PHYINFO_SIZE 3
137 #define HECAP_PHYINFO_SIZE 9
138 #define HECAP_MACINFO_SIZE 5
139 #define HECAP_TXRX_MCS_NSS_SIZE 2
140 #define HECAP_PPET16_PPET8_MAX_SIZE 25
142 #define HE_PPET16_PPET8_SIZE 8
144 /* 802.11ax PPE (PPDU packet Extension) threshold */
145 struct he_ppe_threshold
{
148 u32 ppet16_ppet8_ru3_ru0
[HE_PPET16_PPET8_SIZE
];
152 u8 hecap_macinfo
[HECAP_MACINFO_SIZE
];
153 u32 hecap_rxmcsnssmap
;
154 u32 hecap_txmcsnssmap
;
155 u32 hecap_phyinfo
[HEHANDLE_CAP_PHYINFO_SIZE
];
156 struct he_ppe_threshold hecap_ppet
;
163 WMI_HOST_TP_SCALE_MAX
= 0,
164 WMI_HOST_TP_SCALE_50
= 1,
165 WMI_HOST_TP_SCALE_25
= 2,
166 WMI_HOST_TP_SCALE_12
= 3,
167 WMI_HOST_TP_SCALE_MIN
= 4,
168 WMI_HOST_TP_SCALE_SIZE
= 5,
171 enum ath11k_scan_state
{
173 ATH11K_SCAN_STARTING
,
175 ATH11K_SCAN_ABORTING
,
178 enum ath11k_dev_flags
{
180 ATH11K_FLAG_CORE_REGISTERED
,
181 ATH11K_FLAG_CRASH_FLUSH
,
182 ATH11K_FLAG_RAW_MODE
,
183 ATH11K_FLAG_HW_CRYPTO_DISABLED
,
185 ATH11K_FLAG_RECOVERY
,
186 ATH11K_FLAG_UNREGISTERING
,
187 ATH11K_FLAG_REGISTERED
,
188 ATH11K_FLAG_QMI_FAIL
,
189 ATH11K_FLAG_HTC_SUSPEND_COMPLETE
,
192 enum ath11k_monitor_flags
{
193 ATH11K_FLAG_MONITOR_ENABLED
,
198 enum wmi_vdev_type vdev_type
;
199 enum wmi_vdev_subtype vdev_subtype
;
204 u8 hal_addr_search_flags
;
208 struct ieee80211_vif
*vif
;
211 struct wmi_wmm_params_all_arg wmm_params
;
212 struct list_head list
;
218 /* 127 stations; wmi limit */
222 u8 ssid
[IEEE80211_MAX_SSID_LEN
];
224 /* P2P_IE with NoA attribute for P2P_GO case */
232 bool spectral_enabled
;
235 struct cfg80211_bitrate_mask bitrate_mask
;
236 int num_legacy_stations
;
237 int rtscts_prot_mode
;
241 struct ieee80211_chanctx_conf chanctx
;
244 struct ath11k_vif_iter
{
246 struct ath11k_vif
*arvif
;
249 struct ath11k_rx_peer_stats
{
252 u64 num_mpdu_fcs_err
;
255 u64 other_msdu_count
;
256 u64 ampdu_msdu_count
;
257 u64 non_ampdu_msdu_count
;
259 u64 beamformed_count
;
260 u64 mcs_count
[HAL_RX_MAX_MCS
+ 1];
261 u64 nss_count
[HAL_RX_MAX_NSS
];
262 u64 bw_count
[HAL_RX_BW_MAX
];
263 u64 gi_count
[HAL_RX_GI_MAX
];
264 u64 coding_count
[HAL_RX_SU_MU_CODING_MAX
];
265 u64 tid_count
[IEEE80211_NUM_TIDS
+ 1];
266 u64 pream_cnt
[HAL_RX_PREAMBLE_MAX
];
267 u64 reception_type
[HAL_RX_RECEPTION_TYPE_MAX
];
270 u64 ru_alloc_cnt
[HAL_RX_RU_ALLOC_TYPE_MAX
];
273 #define ATH11K_HE_MCS_NUM 12
274 #define ATH11K_VHT_MCS_NUM 10
275 #define ATH11K_BW_NUM 4
276 #define ATH11K_NSS_NUM 4
277 #define ATH11K_LEGACY_NUM 12
278 #define ATH11K_GI_NUM 4
279 #define ATH11K_HT_MCS_NUM 32
281 enum ath11k_pkt_rx_err
{
282 ATH11K_PKT_RX_ERR_FCS
,
283 ATH11K_PKT_RX_ERR_TKIP
,
284 ATH11K_PKT_RX_ERR_CRYPT
,
285 ATH11K_PKT_RX_ERR_PEER_IDX_INVAL
,
286 ATH11K_PKT_RX_ERR_MAX
,
289 enum ath11k_ampdu_subfrm_num
{
290 ATH11K_AMPDU_SUBFRM_NUM_10
,
291 ATH11K_AMPDU_SUBFRM_NUM_20
,
292 ATH11K_AMPDU_SUBFRM_NUM_30
,
293 ATH11K_AMPDU_SUBFRM_NUM_40
,
294 ATH11K_AMPDU_SUBFRM_NUM_50
,
295 ATH11K_AMPDU_SUBFRM_NUM_60
,
296 ATH11K_AMPDU_SUBFRM_NUM_MORE
,
297 ATH11K_AMPDU_SUBFRM_NUM_MAX
,
300 enum ath11k_amsdu_subfrm_num
{
301 ATH11K_AMSDU_SUBFRM_NUM_1
,
302 ATH11K_AMSDU_SUBFRM_NUM_2
,
303 ATH11K_AMSDU_SUBFRM_NUM_3
,
304 ATH11K_AMSDU_SUBFRM_NUM_4
,
305 ATH11K_AMSDU_SUBFRM_NUM_MORE
,
306 ATH11K_AMSDU_SUBFRM_NUM_MAX
,
309 enum ath11k_counter_type
{
310 ATH11K_COUNTER_TYPE_BYTES
,
311 ATH11K_COUNTER_TYPE_PKTS
,
312 ATH11K_COUNTER_TYPE_MAX
,
315 enum ath11k_stats_type
{
316 ATH11K_STATS_TYPE_SUCC
,
317 ATH11K_STATS_TYPE_FAIL
,
318 ATH11K_STATS_TYPE_RETRY
,
319 ATH11K_STATS_TYPE_AMPDU
,
320 ATH11K_STATS_TYPE_MAX
,
323 struct ath11k_htt_data_stats
{
324 u64 legacy
[ATH11K_COUNTER_TYPE_MAX
][ATH11K_LEGACY_NUM
];
325 u64 ht
[ATH11K_COUNTER_TYPE_MAX
][ATH11K_HT_MCS_NUM
];
326 u64 vht
[ATH11K_COUNTER_TYPE_MAX
][ATH11K_VHT_MCS_NUM
];
327 u64 he
[ATH11K_COUNTER_TYPE_MAX
][ATH11K_HE_MCS_NUM
];
328 u64 bw
[ATH11K_COUNTER_TYPE_MAX
][ATH11K_BW_NUM
];
329 u64 nss
[ATH11K_COUNTER_TYPE_MAX
][ATH11K_NSS_NUM
];
330 u64 gi
[ATH11K_COUNTER_TYPE_MAX
][ATH11K_GI_NUM
];
333 struct ath11k_htt_tx_stats
{
334 struct ath11k_htt_data_stats stats
[ATH11K_STATS_TYPE_MAX
];
340 struct ath11k_per_ppdu_tx_stats
{
350 struct ath11k_vif
*arvif
;
352 /* the following are protected by ar->data_lock */
353 u32 changed
; /* IEEE80211_RC_* */
357 enum hal_pn_type pn_type
;
359 struct work_struct update_wk
;
360 struct rate_info txrate
;
361 struct rate_info last_txrate
;
365 struct ath11k_htt_tx_stats
*tx_stats
;
366 struct ath11k_rx_peer_stats
*rx_stats
;
368 #ifdef CONFIG_MAC80211_DEBUGFS
369 /* protected by conf_mutex */
374 #define ATH11K_MIN_5G_FREQ 4150
375 #define ATH11K_MIN_6G_FREQ 5945
376 #define ATH11K_MAX_6G_FREQ 7115
377 #define ATH11K_NUM_CHANS 100
378 #define ATH11K_MAX_5G_CHAN 173
383 ATH11K_STATE_RESTARTING
,
384 ATH11K_STATE_RESTARTED
,
386 /* Add other states as required */
389 /* Antenna noise floor */
390 #define ATH11K_DEFAULT_NOISE_FLOOR -95
392 struct ath11k_fw_stats
{
393 struct dentry
*debugfs_fwstats
;
396 struct list_head pdevs
;
397 struct list_head vdevs
;
398 struct list_head bcn
;
401 struct ath11k_dbg_htt_stats
{
404 struct debug_htt_stats_req
*stats_req
;
405 /* protects shared stats req buffer */
409 struct ath11k_debug
{
410 struct dentry
*debugfs_pdev
;
411 struct ath11k_dbg_htt_stats htt_stats
;
413 struct ath11k_fw_stats fw_stats
;
414 struct completion fw_stats_complete
;
419 u32 pktlog_peer_valid
;
420 u8 pktlog_peer_addr
[ETH_ALEN
];
424 struct ath11k_per_peer_tx_stats
{
436 #define ATH11K_FLUSH_TIMEOUT (5 * HZ)
437 #define ATH11K_VDEV_DELETE_TIMEOUT_HZ (5 * HZ)
440 struct ath11k_base
*ab
;
441 struct ath11k_pdev
*pdev
;
442 struct ieee80211_hw
*hw
;
443 struct ieee80211_ops
*ops
;
444 struct ath11k_pdev_wmi
*wmi
;
445 struct ath11k_pdev_dp dp
;
446 u8 mac_addr
[ETH_ALEN
];
449 struct ath11k_he ar_he
;
450 enum ath11k_state state
;
453 struct completion started
;
454 struct completion completed
;
455 struct completion on_channel
;
456 struct delayed_work timeout
;
457 enum ath11k_scan_state state
;
465 struct ieee80211_supported_band sbands
[NUM_NL80211_BANDS
];
466 struct ieee80211_sband_iftype_data
467 iftype
[NUM_NL80211_BANDS
][NUM_NL80211_IFTYPES
];
470 unsigned long dev_flags
;
471 unsigned int filter_flags
;
472 unsigned long monitor_flags
;
475 u32 txpower_limit_2g
;
476 u32 txpower_limit_5g
;
481 u32 max_num_stations
;
482 bool monitor_present
;
483 /* To synchronize concurrent synchronous mac80211 callback operations,
484 * concurrent debugfs configuration and concurrent FW statistics events.
486 struct mutex conf_mutex
;
487 /* protects the radio specific data like debug stats, ppdu_stats_info stats,
488 * vdev_stop_status info, scan data, ath11k_sta info, ath11k_vif info,
489 * channel context data, survey info, test mode data.
491 spinlock_t data_lock
;
493 struct list_head arvifs
;
494 /* should never be NULL; needed for regular htt rx */
495 struct ieee80211_channel
*rx_channel
;
497 /* valid during scan; needed for mgmt rx during scan */
498 struct ieee80211_channel
*scan_channel
;
504 /* pdev_idx starts from 0 whereas pdev->pdev_id starts with 1 */
508 struct completion peer_assoc_done
;
509 struct completion peer_delete_done
;
511 int install_key_status
;
512 struct completion install_key_done
;
514 int last_wmi_vdev_start_status
;
515 struct completion vdev_setup_done
;
516 struct completion vdev_delete_done
;
520 u32 num_started_vdevs
;
521 u32 num_created_vdevs
;
522 unsigned long long allocated_vdev_map
;
524 struct idr txmgmt_idr
;
525 /* protects txmgmt_idr data */
526 spinlock_t txmgmt_idr_lock
;
527 atomic_t num_pending_mgmt_tx
;
529 /* cycle count is reported twice for each visited channel during scan.
530 * access protected by data_lock
532 u32 survey_last_rx_clear_count
;
533 u32 survey_last_cycle_count
;
535 /* Channel info events are expected to come in pairs without and with
536 * COMPLETE flag set respectively for each channel visit during scan.
538 * However there are deviations from this rule. This flag is used to
539 * avoid reporting garbage data.
541 bool ch_info_can_report_survey
;
542 struct survey_info survey
[ATH11K_NUM_CHANS
];
543 struct completion bss_survey_done
;
545 struct work_struct regd_update_work
;
547 struct work_struct wmi_mgmt_tx_work
;
548 struct sk_buff_head wmi_mgmt_tx_queue
;
550 struct ath11k_per_peer_tx_stats peer_tx_stats
;
551 struct list_head ppdu_stats_info
;
552 u32 ppdu_stat_list_depth
;
554 struct ath11k_per_peer_tx_stats cached_stats
;
557 #ifdef CONFIG_ATH11K_DEBUGFS
558 struct ath11k_debug debug
;
560 #ifdef CONFIG_ATH11K_SPECTRAL
561 struct ath11k_spectral spectral
;
563 bool dfs_block_radar_events
;
564 struct ath11k_thermal thermal
;
567 struct ath11k_band_cap
{
569 u32 max_bw_supported
;
573 u32 he_cap_phy_info
[PSOC_HOST_MAX_PHY_SIZE
];
574 struct ath11k_ppe_threshold he_ppet
;
578 struct ath11k_pdev_cap
{
586 u32 tx_chain_mask_shift
;
587 u32 rx_chain_mask_shift
;
588 struct ath11k_band_cap band
[NUM_NL80211_BANDS
];
594 struct ath11k_pdev_cap cap
;
595 u8 mac_addr
[ETH_ALEN
];
598 struct ath11k_board_data
{
599 const struct firmware
*fw
;
604 struct ath11k_bus_params
{
608 bool fixed_mem_region
;
611 /* IPQ8074 HW channel counters frequency value in hertz */
612 #define IPQ8074_CC_FREQ_HERTZ 320000
614 struct ath11k_bp_stats
{
615 /* Head Pointer reported by the last HTT Backpressure event for the ring */
618 /* Tail Pointer reported by the last HTT Backpressure event for the ring */
621 /* Number of Backpressure events received for the ring */
624 /* Last recorded event timestamp */
625 unsigned long jiffies
;
628 struct ath11k_dp_ring_bp_stats
{
629 struct ath11k_bp_stats umac_ring_bp_stats
[HTT_SW_UMAC_RING_IDX_MAX
];
630 struct ath11k_bp_stats lmac_ring_bp_stats
[HTT_SW_LMAC_RING_IDX_MAX
][MAX_RADIOS
];
633 struct ath11k_soc_dp_tx_err_stats
{
634 /* TCL Ring Descriptor unavailable */
635 u32 desc_na
[DP_TCL_NUM_RING_MAX
];
636 /* Other failures during dp_tx due to mem allocation failure
637 * idr unavailable etc.
642 struct ath11k_soc_dp_stats
{
645 u32 rxdma_error
[HAL_REO_ENTR_RING_RXDMA_ECODE_MAX
];
646 u32 reo_error
[HAL_REO_DEST_RING_ERROR_CODE_MAX
];
647 u32 hal_reo_error
[DP_REO_DST_RING_MAX
];
648 struct ath11k_soc_dp_tx_err_stats tx_err
;
649 struct ath11k_dp_ring_bp_stats bp_stats
;
652 /* Master structure to hold the hw data which may be used in core module */
654 enum ath11k_hw_rev hw_rev
;
655 struct platform_device
*pdev
;
657 struct ath11k_qmi qmi
;
658 struct ath11k_wmi_base wmi_ab
;
659 struct completion fw_ready
;
661 /* HW channel counters frequency value in hertz common to all MACs */
664 struct ath11k_htc htc
;
669 unsigned long mem_len
;
673 const struct ath11k_hif_ops
*ops
;
677 struct completion wakeup_completed
;
681 struct timer_list rx_replenish_retry
;
682 struct ath11k_hal hal
;
683 /* To synchronize core_start/core_stop */
684 struct mutex core_lock
;
685 /* Protects data like peers */
686 spinlock_t base_lock
;
687 struct ath11k_pdev pdevs
[MAX_RADIOS
];
688 struct ath11k_pdev __rcu
*pdevs_active
[MAX_RADIOS
];
689 struct ath11k_hal_reg_capabilities_ext hal_reg_cap
[MAX_RADIOS
];
690 unsigned long long free_vdev_map
;
691 struct list_head peers
;
692 wait_queue_head_t peer_mapping_wq
;
693 u8 mac_addr
[ETH_ALEN
];
695 u32 wlan_init_status
;
696 int irq_num
[ATH11K_IRQ_NUM_MAX
];
697 struct ath11k_ext_irq_grp ext_irq_grp
[ATH11K_EXT_IRQ_GRP_NUM_MAX
];
698 struct napi_struct
*napi
;
699 struct ath11k_targ_cap target_caps
;
700 u32 ext_service_bitmap
[WMI_SERVICE_EXT_BM_SIZE
];
701 bool pdevs_macaddr_valid
;
704 struct ath11k_hw_params hw_params
;
705 struct ath11k_bus_params bus_params
;
707 const struct firmware
*cal_file
;
709 /* Below regd's are protected by ab->data_lock */
710 /* This is the regd set for every radio
711 * by the firmware during initializatin
713 struct ieee80211_regdomain
*default_regd
[MAX_RADIOS
];
714 /* This regd is set during dynamic country setting
715 * This may or may not be used during the runtime
717 struct ieee80211_regdomain
*new_regd
[MAX_RADIOS
];
719 /* Current DFS Regulatory */
720 enum ath11k_dfs_region dfs_region
;
721 #ifdef CONFIG_ATH11K_DEBUGFS
722 struct dentry
*debugfs_soc
;
723 struct dentry
*debugfs_ath11k
;
725 struct ath11k_soc_dp_stats soc_stats
;
727 unsigned long dev_flags
;
728 struct completion driver_recovery
;
729 struct workqueue_struct
*workqueue
;
730 struct work_struct restart_work
;
732 /* protected by data_lock */
733 u32 fw_crash_counter
;
735 u32 pktlog_defs_checksum
;
737 struct ath11k_dbring_cap
*db_caps
;
740 struct timer_list mon_reap_timer
;
742 struct completion htc_suspend
;
745 u8 drv_priv
[0] __aligned(sizeof(void *));
748 struct ath11k_fw_stats_pdev
{
749 struct list_head list
;
753 /* Cycles spent transmitting frames */
755 /* Cycles spent receiving frames */
757 /* Total channel busy time, evidently */
759 /* Total on-channel time */
771 /* Num HTT cookies queued to dispatch list */
773 /* Num HTT cookies dispatched */
775 /* Num MSDU queued to WAL */
777 /* Num MPDU queue to WAL */
779 /* Num MSDUs dropped by WMM limit */
781 /* Num Local frames queued */
783 /* Num Local frames done */
785 /* Num queued to HW */
787 /* Num PPDU reaped from HW */
791 /* Num PPDUs cleaned up in TX abort */
793 /* Num MPDUs requed by SW */
795 /* excessive retries */
797 /* data hw rate code */
799 /* Scheduler self triggers */
801 /* frames dropped due to excessive sw retries */
802 u32 sw_retry_failure
;
803 /* illegal rate phy errors */
804 u32 illgl_rate_phy_err
;
805 /* wal pdev continuous xretry */
806 u32 pdev_cont_xretry
;
807 /* wal pdev tx timeouts */
809 /* wal pdev resets */
811 /* frames dropped due to non-availability of stateless TIDs */
812 u32 stateless_tid_alloc_failure
;
813 /* PhY/BB underrun */
815 /* MPDU is more than txop limit */
819 /* Cnts any change in ring routing mid-ppdu */
820 s32 mid_ppdu_route_change
;
821 /* Total number of statuses processed */
823 /* Extra frags on rings 0-3 */
828 /* MSDUs / MPDUs delivered to HTT */
831 /* MSDUs / MPDUs delivered to local stack */
834 /* AMSDUs that have more MSDUs than the status ring size */
836 /* Number of PHY errors */
838 /* Number of PHY errors drops */
840 /* Number of mpdu errors - FCS, MIC, ENC etc. */
844 struct ath11k_fw_stats_vdev
{
845 struct list_head list
;
850 u32 num_tx_frames
[WLAN_MAX_AC
];
852 u32 num_tx_frames_retries
[WLAN_MAX_AC
];
853 u32 num_tx_frames_failures
[WLAN_MAX_AC
];
858 u32 num_tx_not_acked
;
859 u32 tx_rate_history
[MAX_TX_RATE_VALUES
];
860 u32 beacon_rssi_history
[MAX_TX_RATE_VALUES
];
863 struct ath11k_fw_stats_bcn
{
864 struct list_head list
;
868 u32 tx_bcn_outage_cnt
;
871 extern const struct ce_pipe_config ath11k_target_ce_config_wlan_ipq8074
[];
872 extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq8074
[];
873 extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq6018
[];
875 extern const struct ce_pipe_config ath11k_target_ce_config_wlan_qca6390
[];
876 extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qca6390
[];
878 void ath11k_peer_unmap_event(struct ath11k_base
*ab
, u16 peer_id
);
879 void ath11k_peer_map_event(struct ath11k_base
*ab
, u8 vdev_id
, u16 peer_id
,
880 u8
*mac_addr
, u16 ast_hash
);
881 struct ath11k_peer
*ath11k_peer_find(struct ath11k_base
*ab
, int vdev_id
,
883 struct ath11k_peer
*ath11k_peer_find_by_addr(struct ath11k_base
*ab
,
885 struct ath11k_peer
*ath11k_peer_find_by_id(struct ath11k_base
*ab
, int peer_id
);
886 int ath11k_core_qmi_firmware_ready(struct ath11k_base
*ab
);
887 int ath11k_core_pre_init(struct ath11k_base
*ab
);
888 int ath11k_core_init(struct ath11k_base
*ath11k
);
889 void ath11k_core_deinit(struct ath11k_base
*ath11k
);
890 struct ath11k_base
*ath11k_core_alloc(struct device
*dev
, size_t priv_size
,
892 const struct ath11k_bus_params
*bus_params
);
893 void ath11k_core_free(struct ath11k_base
*ath11k
);
894 int ath11k_core_fetch_bdf(struct ath11k_base
*ath11k
,
895 struct ath11k_board_data
*bd
);
896 void ath11k_core_free_bdf(struct ath11k_base
*ab
, struct ath11k_board_data
*bd
);
897 int ath11k_core_check_dt(struct ath11k_base
*ath11k
);
899 void ath11k_core_halt(struct ath11k
*ar
);
900 int ath11k_core_resume(struct ath11k_base
*ab
);
901 int ath11k_core_suspend(struct ath11k_base
*ab
);
903 const struct firmware
*ath11k_core_firmware_request(struct ath11k_base
*ab
,
904 const char *filename
);
906 static inline const char *ath11k_scan_state_str(enum ath11k_scan_state state
)
909 case ATH11K_SCAN_IDLE
:
911 case ATH11K_SCAN_STARTING
:
913 case ATH11K_SCAN_RUNNING
:
915 case ATH11K_SCAN_ABORTING
:
922 static inline struct ath11k_skb_cb
*ATH11K_SKB_CB(struct sk_buff
*skb
)
924 BUILD_BUG_ON(sizeof(struct ath11k_skb_cb
) >
925 IEEE80211_TX_INFO_DRIVER_DATA_SIZE
);
926 return (struct ath11k_skb_cb
*)&IEEE80211_SKB_CB(skb
)->driver_data
;
929 static inline struct ath11k_skb_rxcb
*ATH11K_SKB_RXCB(struct sk_buff
*skb
)
931 BUILD_BUG_ON(sizeof(struct ath11k_skb_rxcb
) > sizeof(skb
->cb
));
932 return (struct ath11k_skb_rxcb
*)skb
->cb
;
935 static inline struct ath11k_vif
*ath11k_vif_to_arvif(struct ieee80211_vif
*vif
)
937 return (struct ath11k_vif
*)vif
->drv_priv
;
940 static inline struct ath11k
*ath11k_ab_to_ar(struct ath11k_base
*ab
,
943 return ab
->pdevs
[ath11k_hw_mac_id_to_pdev_id(&ab
->hw_params
, mac_id
)].ar
;
946 static inline void ath11k_core_create_firmware_path(struct ath11k_base
*ab
,
947 const char *filename
,
948 void *buf
, size_t buf_len
)
950 snprintf(buf
, buf_len
, "%s/%s/%s", ATH11K_FW_DIR
,
951 ab
->hw_params
.fw
.dir
, filename
);
954 static inline const char *ath11k_bus_str(enum ath11k_bus bus
)
966 #endif /* _CORE_H_ */