xref: /freebsd/sys/contrib/dev/athk/ath12k/mac.h (revision 5c1def83a4cc2eb3f828600dfd786f8c5788fb7d)
1*5c1def83SBjoern A. Zeeb /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2*5c1def83SBjoern A. Zeeb /*
3*5c1def83SBjoern A. Zeeb  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
4*5c1def83SBjoern A. Zeeb  * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
5*5c1def83SBjoern A. Zeeb  */
6*5c1def83SBjoern A. Zeeb 
7*5c1def83SBjoern A. Zeeb #ifndef ATH12K_MAC_H
8*5c1def83SBjoern A. Zeeb #define ATH12K_MAC_H
9*5c1def83SBjoern A. Zeeb 
10*5c1def83SBjoern A. Zeeb #include <net/mac80211.h>
11*5c1def83SBjoern A. Zeeb #include <net/cfg80211.h>
12*5c1def83SBjoern A. Zeeb 
13*5c1def83SBjoern A. Zeeb struct ath12k;
14*5c1def83SBjoern A. Zeeb struct ath12k_base;
15*5c1def83SBjoern A. Zeeb 
16*5c1def83SBjoern A. Zeeb struct ath12k_generic_iter {
17*5c1def83SBjoern A. Zeeb 	struct ath12k *ar;
18*5c1def83SBjoern A. Zeeb 	int ret;
19*5c1def83SBjoern A. Zeeb };
20*5c1def83SBjoern A. Zeeb 
21*5c1def83SBjoern A. Zeeb /* number of failed packets (20 packets with 16 sw reties each) */
22*5c1def83SBjoern A. Zeeb #define ATH12K_KICKOUT_THRESHOLD		(20 * 16)
23*5c1def83SBjoern A. Zeeb 
24*5c1def83SBjoern A. Zeeb /* Use insanely high numbers to make sure that the firmware implementation
25*5c1def83SBjoern A. Zeeb  * won't start, we have the same functionality already in hostapd. Unit
26*5c1def83SBjoern A. Zeeb  * is seconds.
27*5c1def83SBjoern A. Zeeb  */
28*5c1def83SBjoern A. Zeeb #define ATH12K_KEEPALIVE_MIN_IDLE		3747
29*5c1def83SBjoern A. Zeeb #define ATH12K_KEEPALIVE_MAX_IDLE		3895
30*5c1def83SBjoern A. Zeeb #define ATH12K_KEEPALIVE_MAX_UNRESPONSIVE	3900
31*5c1def83SBjoern A. Zeeb 
32*5c1def83SBjoern A. Zeeb /* FIXME: should these be in ieee80211.h? */
33*5c1def83SBjoern A. Zeeb #define IEEE80211_VHT_MCS_SUPPORT_0_11_MASK	GENMASK(23, 16)
34*5c1def83SBjoern A. Zeeb #define IEEE80211_DISABLE_VHT_MCS_SUPPORT_0_11	BIT(24)
35*5c1def83SBjoern A. Zeeb 
36*5c1def83SBjoern A. Zeeb #define ATH12K_CHAN_WIDTH_NUM			14
37*5c1def83SBjoern A. Zeeb 
38*5c1def83SBjoern A. Zeeb #define ATH12K_TX_POWER_MAX_VAL	70
39*5c1def83SBjoern A. Zeeb #define ATH12K_TX_POWER_MIN_VAL	0
40*5c1def83SBjoern A. Zeeb 
41*5c1def83SBjoern A. Zeeb enum ath12k_supported_bw {
42*5c1def83SBjoern A. Zeeb 	ATH12K_BW_20    = 0,
43*5c1def83SBjoern A. Zeeb 	ATH12K_BW_40    = 1,
44*5c1def83SBjoern A. Zeeb 	ATH12K_BW_80    = 2,
45*5c1def83SBjoern A. Zeeb 	ATH12K_BW_160   = 3,
46*5c1def83SBjoern A. Zeeb };
47*5c1def83SBjoern A. Zeeb 
48*5c1def83SBjoern A. Zeeb extern const struct htt_rx_ring_tlv_filter ath12k_mac_mon_status_filter_default;
49*5c1def83SBjoern A. Zeeb 
50*5c1def83SBjoern A. Zeeb void ath12k_mac_destroy(struct ath12k_base *ab);
51*5c1def83SBjoern A. Zeeb void ath12k_mac_unregister(struct ath12k_base *ab);
52*5c1def83SBjoern A. Zeeb int ath12k_mac_register(struct ath12k_base *ab);
53*5c1def83SBjoern A. Zeeb int ath12k_mac_allocate(struct ath12k_base *ab);
54*5c1def83SBjoern A. Zeeb int ath12k_mac_hw_ratecode_to_legacy_rate(u8 hw_rc, u8 preamble, u8 *rateidx,
55*5c1def83SBjoern A. Zeeb 					  u16 *rate);
56*5c1def83SBjoern A. Zeeb u8 ath12k_mac_bitrate_to_idx(const struct ieee80211_supported_band *sband,
57*5c1def83SBjoern A. Zeeb 			     u32 bitrate);
58*5c1def83SBjoern A. Zeeb u8 ath12k_mac_hw_rate_to_idx(const struct ieee80211_supported_band *sband,
59*5c1def83SBjoern A. Zeeb 			     u8 hw_rate, bool cck);
60*5c1def83SBjoern A. Zeeb 
61*5c1def83SBjoern A. Zeeb void __ath12k_mac_scan_finish(struct ath12k *ar);
62*5c1def83SBjoern A. Zeeb void ath12k_mac_scan_finish(struct ath12k *ar);
63*5c1def83SBjoern A. Zeeb 
64*5c1def83SBjoern A. Zeeb struct ath12k_vif *ath12k_mac_get_arvif(struct ath12k *ar, u32 vdev_id);
65*5c1def83SBjoern A. Zeeb struct ath12k_vif *ath12k_mac_get_arvif_by_vdev_id(struct ath12k_base *ab,
66*5c1def83SBjoern A. Zeeb 						   u32 vdev_id);
67*5c1def83SBjoern A. Zeeb struct ath12k *ath12k_mac_get_ar_by_vdev_id(struct ath12k_base *ab, u32 vdev_id);
68*5c1def83SBjoern A. Zeeb struct ath12k *ath12k_mac_get_ar_by_pdev_id(struct ath12k_base *ab, u32 pdev_id);
69*5c1def83SBjoern A. Zeeb 
70*5c1def83SBjoern A. Zeeb void ath12k_mac_drain_tx(struct ath12k *ar);
71*5c1def83SBjoern A. Zeeb void ath12k_mac_peer_cleanup_all(struct ath12k *ar);
72*5c1def83SBjoern A. Zeeb int ath12k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx);
73*5c1def83SBjoern A. Zeeb enum rate_info_bw ath12k_mac_bw_to_mac80211_bw(enum ath12k_supported_bw bw);
74*5c1def83SBjoern A. Zeeb enum ath12k_supported_bw ath12k_mac_mac80211_bw_to_ath12k_bw(enum rate_info_bw bw);
75*5c1def83SBjoern A. Zeeb enum hal_encrypt_type ath12k_dp_tx_get_encrypt_type(u32 cipher);
76*5c1def83SBjoern A. Zeeb #endif
77