linux/drivers/net/wireless/ath/ath11k/mac.h

/* SPDX-License-Identifier: BSD-3-Clause-Clear */
/*
 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#ifndef ATH11K_MAC_H
#define ATH11K_MAC_H

#include <net/mac80211.h>
#include <net/cfg80211.h>
#include "wmi.h"

struct ath11k;
struct ath11k_base;

struct ath11k_generic_iter {};

/* number of failed packets (20 packets with 16 sw reties each) */
#define ATH11K_KICKOUT_THRESHOLD

/* Use insanely high numbers to make sure that the firmware implementation
 * won't start, we have the same functionality already in hostapd. Unit
 * is seconds.
 */
#define ATH11K_KEEPALIVE_MIN_IDLE
#define ATH11K_KEEPALIVE_MAX_IDLE
#define ATH11K_KEEPALIVE_MAX_UNRESPONSIVE

#define WMI_HOST_RC_DS_FLAG
#define WMI_HOST_RC_CW40_FLAG
#define WMI_HOST_RC_SGI_FLAG
#define WMI_HOST_RC_HT_FLAG
#define WMI_HOST_RC_RTSCTS_FLAG
#define WMI_HOST_RC_TX_STBC_FLAG
#define WMI_HOST_RC_RX_STBC_FLAG
#define WMI_HOST_RC_RX_STBC_FLAG_S
#define WMI_HOST_RC_WEP_TKIP_FLAG
#define WMI_HOST_RC_TS_FLAG
#define WMI_HOST_RC_UAPSD_FLAG

#define WMI_HT_CAP_ENABLED
#define WMI_HT_CAP_HT20_SGI
#define WMI_HT_CAP_DYNAMIC_SMPS
#define WMI_HT_CAP_TX_STBC
#define WMI_HT_CAP_TX_STBC_MASK_SHIFT
#define WMI_HT_CAP_RX_STBC
#define WMI_HT_CAP_RX_STBC_MASK_SHIFT
#define WMI_HT_CAP_LDPC
#define WMI_HT_CAP_L_SIG_TXOP_PROT
#define WMI_HT_CAP_MPDU_DENSITY
#define WMI_HT_CAP_MPDU_DENSITY_MASK_SHIFT
#define WMI_HT_CAP_HT40_SGI
#define WMI_HT_CAP_RX_LDPC
#define WMI_HT_CAP_TX_LDPC
#define WMI_HT_CAP_IBF_BFER

/* These macros should be used when we wish to advertise STBC support for
 * only 1SS or 2SS or 3SS.
 */
#define WMI_HT_CAP_RX_STBC_1SS
#define WMI_HT_CAP_RX_STBC_2SS
#define WMI_HT_CAP_RX_STBC_3SS

#define WMI_HT_CAP_DEFAULT_ALL

#define WMI_VHT_CAP_MAX_MPDU_LEN_MASK
#define WMI_VHT_CAP_RX_LDPC
#define WMI_VHT_CAP_SGI_80MHZ
#define WMI_VHT_CAP_SGI_160MHZ
#define WMI_VHT_CAP_TX_STBC
#define WMI_VHT_CAP_RX_STBC_MASK
#define WMI_VHT_CAP_RX_STBC_MASK_SHIFT
#define WMI_VHT_CAP_SU_BFER
#define WMI_VHT_CAP_SU_BFEE
#define WMI_VHT_CAP_MAX_CS_ANT_MASK
#define WMI_VHT_CAP_MAX_CS_ANT_MASK_SHIFT
#define WMI_VHT_CAP_MAX_SND_DIM_MASK
#define WMI_VHT_CAP_MAX_SND_DIM_MASK_SHIFT
#define WMI_VHT_CAP_MU_BFER
#define WMI_VHT_CAP_MU_BFEE
#define WMI_VHT_CAP_MAX_AMPDU_LEN_EXP
#define WMI_VHT_CAP_MAX_AMPDU_LEN_EXP_SHIT
#define WMI_VHT_CAP_RX_FIXED_ANT
#define WMI_VHT_CAP_TX_FIXED_ANT

#define WMI_VHT_CAP_MAX_MPDU_LEN_11454

/* These macros should be used when we wish to advertise STBC support for
 * only 1SS or 2SS or 3SS.
 */
#define WMI_VHT_CAP_RX_STBC_1SS
#define WMI_VHT_CAP_RX_STBC_2SS
#define WMI_VHT_CAP_RX_STBC_3SS

#define WMI_VHT_CAP_DEFAULT_ALL

/* FIXME: should these be in ieee80211.h? */
#define IEEE80211_VHT_MCS_SUPPORT_0_11_MASK
#define IEEE80211_DISABLE_VHT_MCS_SUPPORT_0_11

#define WMI_MAX_SPATIAL_STREAM

#define ATH11K_CHAN_WIDTH_NUM
#define ATH11K_BW_NSS_MAP_ENABLE
#define ATH11K_PEER_RX_NSS_160MHZ
#define ATH11K_PEER_RX_NSS_80_80MHZ

#define ATH11K_OBSS_PD_MAX_THRESHOLD
#define ATH11K_OBSS_PD_NON_SRG_MAX_THRESHOLD
#define ATH11K_OBSS_PD_THRESHOLD_IN_DBM
#define ATH11K_OBSS_PD_SRG_EN
#define ATH11K_OBSS_PD_NON_SRG_EN

extern const struct htt_rx_ring_tlv_filter ath11k_mac_mon_status_filter_default;

#define ATH11K_SCAN_11D_INTERVAL
#define ATH11K_11D_INVALID_VDEV_ID

void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id);
void ath11k_mac_11d_scan_stop(struct ath11k *ar);
void ath11k_mac_11d_scan_stop_all(struct ath11k_base *ab);

void ath11k_mac_destroy(struct ath11k_base *ab);
void ath11k_mac_unregister(struct ath11k_base *ab);
int ath11k_mac_register(struct ath11k_base *ab);
int ath11k_mac_allocate(struct ath11k_base *ab);
int ath11k_mac_hw_ratecode_to_legacy_rate(u8 hw_rc, u8 preamble, u8 *rateidx,
					  u16 *rate);
u8 ath11k_mac_bitrate_to_idx(const struct ieee80211_supported_band *sband,
			     u32 bitrate);
u8 ath11k_mac_hw_rate_to_idx(const struct ieee80211_supported_band *sband,
			     u8 hw_rate, bool cck);

void __ath11k_mac_scan_finish(struct ath11k *ar);
void ath11k_mac_scan_finish(struct ath11k *ar);

struct ath11k_vif *ath11k_mac_get_arvif(struct ath11k *ar, u32 vdev_id);
struct ath11k_vif *ath11k_mac_get_arvif_by_vdev_id(struct ath11k_base *ab,
						   u32 vdev_id);
u8 ath11k_mac_get_target_pdev_id(struct ath11k *ar);
u8 ath11k_mac_get_target_pdev_id_from_vif(struct ath11k_vif *arvif);
struct ath11k_vif *ath11k_mac_get_vif_up(struct ath11k_base *ab);

struct ath11k *ath11k_mac_get_ar_by_vdev_id(struct ath11k_base *ab, u32 vdev_id);
struct ath11k *ath11k_mac_get_ar_by_pdev_id(struct ath11k_base *ab, u32 pdev_id);

void ath11k_mac_drain_tx(struct ath11k *ar);
void ath11k_mac_peer_cleanup_all(struct ath11k *ar);
int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx);
u8 ath11k_mac_bw_to_mac80211_bw(u8 bw);
enum nl80211_he_gi ath11k_mac_he_gi_to_nl80211_he_gi(u8 sgi);
enum nl80211_he_ru_alloc ath11k_mac_phy_he_ru_to_nl80211_he_ru_alloc(u16 ru_phy);
enum nl80211_he_ru_alloc ath11k_mac_he_ru_tones_to_nl80211_he_ru_alloc(u16 ru_tones);
enum ath11k_supported_bw ath11k_mac_mac80211_bw_to_ath11k_bw(enum rate_info_bw bw);
enum hal_encrypt_type ath11k_dp_tx_get_encrypt_type(u32 cipher);
void ath11k_mac_handle_beacon(struct ath11k *ar, struct sk_buff *skb);
void ath11k_mac_handle_beacon_miss(struct ath11k *ar, u32 vdev_id);
void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif);
int ath11k_mac_wait_tx_complete(struct ath11k *ar);
int ath11k_mac_vif_set_keepalive(struct ath11k_vif *arvif,
				 enum wmi_sta_keepalive_method method,
				 u32 interval);
void ath11k_mac_fill_reg_tpc_info(struct ath11k *ar,
				  struct ieee80211_vif *vif,
				  struct ieee80211_chanctx_conf *ctx);
#endif