linux/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h

/* SPDX-License-Identifier: ISC */
/*
 * Copyright (C) 2016 Felix Fietkau <[email protected]>
 * Copyright (C) 2018 Stanislaw Gruszka <[email protected]>
 */

#ifndef __MT76X02_MAC_H
#define __MT76X02_MAC_H

struct mt76x02_dev;

struct mt76x02_tx_status {} __packed __aligned();

#define MT_VIF_WCID(_n)
#define MT_MAX_VIFS

#define MT_PKTID_RATE
#define MT_PKTID_AC

struct mt76x02_vif {};

DECLARE_EWMA(pktlen, 8, 8);

struct mt76x02_sta {};

#define MT_RXINFO_BA
#define MT_RXINFO_DATA
#define MT_RXINFO_NULL
#define MT_RXINFO_FRAG
#define MT_RXINFO_UNICAST
#define MT_RXINFO_MULTICAST
#define MT_RXINFO_BROADCAST
#define MT_RXINFO_MYBSS
#define MT_RXINFO_CRCERR
#define MT_RXINFO_ICVERR
#define MT_RXINFO_MICERR
#define MT_RXINFO_AMSDU
#define MT_RXINFO_HTC
#define MT_RXINFO_RSSI
#define MT_RXINFO_L2PAD
#define MT_RXINFO_AMPDU
#define MT_RXINFO_DECRYPT
#define MT_RXINFO_BSSIDX3
#define MT_RXINFO_WAPI_KEY
#define MT_RXINFO_PN_LEN
#define MT_RXINFO_SW_FTYPE0
#define MT_RXINFO_SW_FTYPE1
#define MT_RXINFO_PROBE_RESP
#define MT_RXINFO_BEACON
#define MT_RXINFO_DISASSOC
#define MT_RXINFO_DEAUTH
#define MT_RXINFO_ACTION
#define MT_RXINFO_TCP_SUM_ERR
#define MT_RXINFO_IP_SUM_ERR

#define MT_RXWI_CTL_WCID
#define MT_RXWI_CTL_KEY_IDX
#define MT_RXWI_CTL_BSS_IDX
#define MT_RXWI_CTL_UDF
#define MT_RXWI_CTL_MPDU_LEN
#define MT_RXWI_CTL_EOF

#define MT_RXWI_TID
#define MT_RXWI_SN

#define MT_RXWI_RATE_INDEX
#define MT_RXWI_RATE_LDPC
#define MT_RXWI_RATE_BW
#define MT_RXWI_RATE_SGI
#define MT_RXWI_RATE_STBC
#define MT_RXWI_RATE_LDPC_EXSYM
#define MT_RXWI_RATE_PHY

#define MT_RATE_INDEX_VHT_IDX
#define MT_RATE_INDEX_VHT_NSS

struct mt76x02_rxwi {};

#define MT_TX_PWR_ADJ

enum mt76x2_phy_bandwidth {};

#define MT_TXWI_FLAGS_FRAG
#define MT_TXWI_FLAGS_MMPS
#define MT_TXWI_FLAGS_CFACK
#define MT_TXWI_FLAGS_TS
#define MT_TXWI_FLAGS_AMPDU
#define MT_TXWI_FLAGS_MPDU_DENSITY
#define MT_TXWI_FLAGS_TXOP
#define MT_TXWI_FLAGS_NDPS
#define MT_TXWI_FLAGS_RTSBWSIG
#define MT_TXWI_FLAGS_NDP_BW
#define MT_TXWI_FLAGS_SOUND
#define MT_TXWI_FLAGS_TX_RATE_LUT

#define MT_TXWI_ACK_CTL_REQ
#define MT_TXWI_ACK_CTL_NSEQ
#define MT_TXWI_ACK_CTL_BA_WINDOW

struct mt76x02_txwi {} __packed __aligned();

static inline bool mt76x02_wait_for_mac(struct mt76_dev *dev)
{}

void mt76x02_mac_reset_counters(struct mt76x02_dev *dev);
void mt76x02_mac_set_short_preamble(struct mt76x02_dev *dev, bool enable);
int mt76x02_mac_shared_key_setup(struct mt76x02_dev *dev, u8 vif_idx,
				 u8 key_idx, struct ieee80211_key_conf *key);
int mt76x02_mac_wcid_set_key(struct mt76x02_dev *dev, u8 idx,
			     struct ieee80211_key_conf *key);
void mt76x02_mac_wcid_sync_pn(struct mt76x02_dev *dev, u8 idx,
			      struct ieee80211_key_conf *key);
void mt76x02_mac_wcid_setup(struct mt76x02_dev *dev, u8 idx, u8 vif_idx,
			    u8 *mac);
void mt76x02_mac_wcid_set_drop(struct mt76x02_dev *dev, u8 idx, bool drop);
void mt76x02_mac_wcid_set_rate(struct mt76x02_dev *dev, struct mt76_wcid *wcid,
			       const struct ieee80211_tx_rate *rate);
bool mt76x02_mac_load_tx_status(struct mt76x02_dev *dev,
				struct mt76x02_tx_status *stat);
void mt76x02_send_tx_status(struct mt76x02_dev *dev,
			    struct mt76x02_tx_status *stat, u8 *update);
int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb,
			   void *rxi);
void mt76x02_mac_set_tx_protection(struct mt76x02_dev *dev, bool legacy_prot,
				   int ht_mode);
void mt76x02_mac_set_rts_thresh(struct mt76x02_dev *dev, u32 val);
void mt76x02_mac_setaddr(struct mt76x02_dev *dev, const u8 *addr);
void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
			    struct sk_buff *skb, struct mt76_wcid *wcid,
			    struct ieee80211_sta *sta, int len);
void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq);
void mt76x02_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e);
void mt76x02_update_channel(struct mt76_phy *mphy);
void mt76x02_mac_work(struct work_struct *work);

void mt76x02_mac_cc_reset(struct mt76x02_dev *dev);
void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr);
void mt76x02_mac_set_beacon(struct mt76x02_dev *dev, struct sk_buff *skb);
void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev,
				   struct ieee80211_vif *vif, bool enable);

void mt76x02_edcca_init(struct mt76x02_dev *dev);
#endif