File Index
Files and directories
Sign in
FILE

mac.h

File preview with syntax highlighting.

linux-6.19.14/drivers/net/wireless/ath/ath12k/mac.h C
  1/* SPDX-License-Identifier: BSD-3-Clause-Clear */
  2/*
  3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
  4 * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
  5 */
  6
  7#ifndef ATH12K_MAC_H
  8#define ATH12K_MAC_H
  9
 10#include <net/mac80211.h>
 11#include <net/cfg80211.h>
 12#include "wmi.h"
 13
 14struct ath12k;
 15struct ath12k_base;
 16struct ath12k_hw;
 17struct ath12k_hw_group;
 18struct ath12k_pdev_map;
 19
 20struct ath12k_generic_iter {
 21	struct ath12k *ar;
 22	int ret;
 23};
 24
 25/* number of failed packets (20 packets with 16 sw reties each) */
 26#define ATH12K_KICKOUT_THRESHOLD		(20 * 16)
 27
 28/* Use insanely high numbers to make sure that the firmware implementation
 29 * won't start, we have the same functionality already in hostapd. Unit
 30 * is seconds.
 31 */
 32#define ATH12K_KEEPALIVE_MIN_IDLE		3747
 33#define ATH12K_KEEPALIVE_MAX_IDLE		3895
 34#define ATH12K_KEEPALIVE_MAX_UNRESPONSIVE	3900
 35
 36#define ATH12K_PDEV_TX_POWER_INVALID		((u32)-1)
 37#define ATH12K_PDEV_TX_POWER_REFRESH_TIME_MSECS	5000 /* msecs */
 38
 39/* FIXME: should these be in ieee80211.h? */
 40#define IEEE80211_VHT_MCS_SUPPORT_0_11_MASK	GENMASK(23, 16)
 41#define IEEE80211_DISABLE_VHT_MCS_SUPPORT_0_11	BIT(24)
 42
 43#define ATH12K_CHAN_WIDTH_NUM			14
 44#define ATH12K_BW_NSS_MAP_ENABLE		BIT(31)
 45#define ATH12K_PEER_RX_NSS_160MHZ		GENMASK(2, 0)
 46
 47#define ATH12K_TX_POWER_MAX_VAL	70
 48#define ATH12K_TX_POWER_MIN_VAL	0
 49
 50#define ATH12K_DEFAULT_LINK_ID	0
 51#define ATH12K_INVALID_LINK_ID	255
 52
 53/* Default link after the IEEE802.11 defined Max link id limit
 54 * for driver usage purpose.
 55 */
 56#define ATH12K_FIRST_SCAN_LINK	IEEE80211_MLD_MAX_NUM_LINKS
 57#define ATH12K_SCAN_MAX_LINKS	ATH12K_GROUP_MAX_RADIO
 58/* Define 1 scan link for each radio for parallel scan purposes */
 59#define ATH12K_NUM_MAX_LINKS (IEEE80211_MLD_MAX_NUM_LINKS + ATH12K_SCAN_MAX_LINKS)
 60#define ATH12K_SCAN_LINKS_MASK	GENMASK(ATH12K_NUM_MAX_LINKS, IEEE80211_MLD_MAX_NUM_LINKS)
 61
 62#define ATH12K_NUM_MAX_ACTIVE_LINKS_PER_DEVICE	2
 63
 64#define HECAP_PHY_SUBFMR_GET(hecap_phy) \
 65	u8_get_bits(hecap_phy[3], IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER)
 66
 67#define HECAP_PHY_SUBFME_GET(hecap_phy) \
 68	u8_get_bits(hecap_phy[4], IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE)
 69
 70#define HECAP_PHY_MUBFMR_GET(hecap_phy) \
 71	u8_get_bits(hecap_phy[4], IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER)
 72
 73#define HECAP_PHY_ULMUMIMO_GET(hecap_phy) \
 74	u8_get_bits(hecap_phy[2], IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO)
 75
 76#define HECAP_PHY_ULOFDMA_GET(hecap_phy) \
 77	u8_get_bits(hecap_phy[2], IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO)
 78
 79enum ath12k_supported_bw {
 80	ATH12K_BW_20    = 0,
 81	ATH12K_BW_40    = 1,
 82	ATH12K_BW_80    = 2,
 83	ATH12K_BW_160   = 3,
 84	ATH12K_BW_320   = 4,
 85};
 86
 87enum ath12k_gi {
 88	ATH12K_RATE_INFO_GI_0_8,
 89	ATH12K_RATE_INFO_GI_1_6,
 90	ATH12K_RATE_INFO_GI_3_2,
 91};
 92
 93enum ath12k_ltf {
 94	ATH12K_RATE_INFO_1XLTF,
 95	ATH12K_RATE_INFO_2XLTF,
 96	ATH12K_RATE_INFO_4XLTF,
 97};
 98
 99struct ath12k_mac_get_any_chanctx_conf_arg {
100	struct ath12k *ar;
101	struct ieee80211_chanctx_conf *chanctx_conf;
102};
103
104/**
105 * struct ath12k_chan_power_info - TPE containing power info per channel chunk
106 * @chan_cfreq: channel center freq (MHz)
107 * e.g.
108 * channel 37/20 MHz,  it is 6135
109 * channel 37/40 MHz,  it is 6125
110 * channel 37/80 MHz,  it is 6145
111 * channel 37/160 MHz, it is 6185
112 * @tx_power: transmit power (dBm)
113 */
114struct ath12k_chan_power_info {
115	u16 chan_cfreq;
116	s8 tx_power;
117};
118
119/* ath12k only deals with 320 MHz, so 16 subchannels */
120#define ATH12K_NUM_PWR_LEVELS  16
121
122/**
123 * struct ath12k_reg_tpc_power_info - regulatory TPC power info
124 * @is_psd_power: is PSD power or not
125 * @eirp_power: Maximum EIRP power (dBm), valid only if power is PSD
126 * @ap_power_type: type of power (SP/LPI/VLP)
127 * @num_pwr_levels: number of power levels
128 * @reg_max: Array of maximum TX power (dBm) per PSD value
129 * @ap_constraint_power: AP constraint power (dBm)
130 * @tpe: TPE values processed from TPE IE
131 * @chan_power_info: power info to send to firmware
132 */
133struct ath12k_reg_tpc_power_info {
134	bool is_psd_power;
135	u8 eirp_power;
136	enum wmi_reg_6g_ap_type ap_power_type;
137	u8 num_pwr_levels;
138	u8 reg_max[ATH12K_NUM_PWR_LEVELS];
139	u8 ap_constraint_power;
140	s8 tpe[ATH12K_NUM_PWR_LEVELS];
141	struct ath12k_chan_power_info chan_power_info[ATH12K_NUM_PWR_LEVELS];
142};
143
144extern const struct htt_rx_ring_tlv_filter ath12k_mac_mon_status_filter_default;
145
146#define ATH12K_SCAN_11D_INTERVAL		600000
147#define ATH12K_11D_INVALID_VDEV_ID		0xFFFF
148
149void ath12k_mac_11d_scan_start(struct ath12k *ar, u32 vdev_id);
150void ath12k_mac_11d_scan_stop(struct ath12k *ar);
151void ath12k_mac_11d_scan_stop_all(struct ath12k_base *ab);
152
153void ath12k_mac_destroy(struct ath12k_hw_group *ag);
154void ath12k_mac_unregister(struct ath12k_hw_group *ag);
155int ath12k_mac_register(struct ath12k_hw_group *ag);
156int ath12k_mac_allocate(struct ath12k_hw_group *ag);
157int ath12k_mac_hw_ratecode_to_legacy_rate(u8 hw_rc, u8 preamble, u8 *rateidx,
158					  u16 *rate);
159u8 ath12k_mac_bitrate_to_idx(const struct ieee80211_supported_band *sband,
160			     u32 bitrate);
161u8 ath12k_mac_hw_rate_to_idx(const struct ieee80211_supported_band *sband,
162			     u8 hw_rate, bool cck);
163
164void __ath12k_mac_scan_finish(struct ath12k *ar);
165void ath12k_mac_scan_finish(struct ath12k *ar);
166
167struct ath12k_link_vif *ath12k_mac_get_arvif(struct ath12k *ar, u32 vdev_id);
168struct ath12k_link_vif *ath12k_mac_get_arvif_by_vdev_id(struct ath12k_base *ab,
169							u32 vdev_id);
170struct ath12k *ath12k_mac_get_ar_by_vdev_id(struct ath12k_base *ab, u32 vdev_id);
171struct ath12k *ath12k_mac_get_ar_by_pdev_id(struct ath12k_base *ab, u32 pdev_id);
172
173void ath12k_mac_drain_tx(struct ath12k *ar);
174void ath12k_mac_peer_cleanup_all(struct ath12k *ar);
175int ath12k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx);
176enum rate_info_bw ath12k_mac_bw_to_mac80211_bw(enum ath12k_supported_bw bw);
177enum ath12k_supported_bw ath12k_mac_mac80211_bw_to_ath12k_bw(enum rate_info_bw bw);
178enum hal_encrypt_type ath12k_dp_tx_get_encrypt_type(u32 cipher);
179int ath12k_mac_rfkill_enable_radio(struct ath12k *ar, bool enable);
180int ath12k_mac_rfkill_config(struct ath12k *ar);
181int ath12k_mac_wait_tx_complete(struct ath12k *ar);
182void ath12k_mac_handle_beacon(struct ath12k *ar, struct sk_buff *skb);
183void ath12k_mac_handle_beacon_miss(struct ath12k *ar,
184				   struct ath12k_link_vif *arvif);
185int ath12k_mac_vif_set_keepalive(struct ath12k_link_vif *arvif,
186				 enum wmi_sta_keepalive_method method,
187				 u32 interval);
188u8 ath12k_mac_get_target_pdev_id(struct ath12k *ar);
189int ath12k_mac_mlo_setup(struct ath12k_hw_group *ag);
190int ath12k_mac_mlo_ready(struct ath12k_hw_group *ag);
191void ath12k_mac_mlo_teardown(struct ath12k_hw_group *ag);
192int ath12k_mac_vdev_stop(struct ath12k_link_vif *arvif);
193void ath12k_mac_get_any_chanctx_conf_iter(struct ieee80211_hw *hw,
194					  struct ieee80211_chanctx_conf *conf,
195					  void *data);
196u16 ath12k_mac_he_convert_tones_to_ru_tones(u16 tones);
197enum nl80211_eht_ru_alloc ath12k_mac_eht_ru_tones_to_nl80211_eht_ru_alloc(u16 ru_tones);
198enum nl80211_eht_gi ath12k_mac_eht_gi_to_nl80211_eht_gi(u8 sgi);
199struct ieee80211_bss_conf *ath12k_mac_get_link_bss_conf(struct ath12k_link_vif *arvif);
200struct ath12k *ath12k_get_ar_by_vif(struct ieee80211_hw *hw,
201				    struct ieee80211_vif *vif,
202				    u8 link_id);
203int ath12k_mac_get_fw_stats(struct ath12k *ar, struct ath12k_fw_stats_req_params *param);
204void ath12k_mac_update_freq_range(struct ath12k *ar,
205				  u32 freq_low, u32 freq_high);
206void ath12k_mac_fill_reg_tpc_info(struct ath12k *ar,
207				  struct ath12k_link_vif *arvif,
208				  struct ieee80211_chanctx_conf *ctx);
209#endif
~/ Read-only file preview.