linux/drivers/net/wireless/mediatek/mt7601u/mac.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (C) 2014 Felix Fietkau <[email protected]>
 * Copyright (C) 2015 Jakub Kicinski <[email protected]>
 */

#ifndef __MT76_MAC_H
#define __MT76_MAC_H

struct mt76_tx_status {} __packed __aligned();

/* Note: values in original "RSSI" and "SNR" fields are not actually what they
 *	 are called for MT7601U, names used by this driver are educated guesses
 *	 (see vendor mac/ral_omac.c).
 */
struct mt7601u_rxwi {} __packed __aligned();

#define MT_RXINFO_BA
#define MT_RXINFO_DATA
#define MT_RXINFO_NULL
#define MT_RXINFO_FRAG
#define MT_RXINFO_U2M
#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_PKT_80211
#define MT_RXINFO_TCP_SUM_BYPASS
#define MT_RXINFO_IP_SUM_BYPASS
#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_TID

#define MT_RXWI_FRAG
#define MT_RXWI_SN

#define MT_RXWI_RATE_MCS
#define MT_RXWI_RATE_BW
#define MT_RXWI_RATE_SGI
#define MT_RXWI_RATE_STBC
#define MT_RXWI_RATE_ETXBF
#define MT_RXWI_RATE_SND
#define MT_RXWI_RATE_ITXBF
#define MT_RXWI_RATE_PHY

#define MT_RXWI_GAIN_RSSI_VAL
#define MT_RXWI_GAIN_RSSI_LNA_ID
#define MT_RXWI_ANT_AUX_LNA

#define MT_RXWI_EANT_ENC_ANT_ID

enum mt76_phy_type {};

enum mt76_phy_bandwidth {};

struct mt76_txwi {} __packed __aligned();

#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_CWMIN
#define MT_TXWI_FLAGS_NO_RATE_FALLBACK
#define MT_TXWI_FLAGS_TX_RPT
#define MT_TXWI_FLAGS_TX_RATE_LUT

#define MT_TXWI_RATE_MCS
#define MT_TXWI_RATE_BW
#define MT_TXWI_RATE_SGI
#define MT_TXWI_RATE_STBC
#define MT_TXWI_RATE_PHY_MODE

#define MT_TXWI_ACK_CTL_REQ
#define MT_TXWI_ACK_CTL_NSEQ
#define MT_TXWI_ACK_CTL_BA_WINDOW

#define MT_TXWI_LEN_BYTE_CNT
#define MT_TXWI_LEN_PKTID

#define MT_TXWI_CTL_TX_POWER_ADJ
#define MT_TXWI_CTL_CHAN_CHECK_PKT
#define MT_TXWI_CTL_PIFS_REV

u32 mt76_mac_process_rx(struct mt7601u_dev *dev, struct sk_buff *skb,
			u8 *data, void *rxi);
int mt76_mac_wcid_set_key(struct mt7601u_dev *dev, u8 idx,
			  struct ieee80211_key_conf *key);
void mt76_mac_wcid_set_rate(struct mt7601u_dev *dev, struct mt76_wcid *wcid,
			    const struct ieee80211_tx_rate *rate);

int mt76_mac_shared_key_setup(struct mt7601u_dev *dev, u8 vif_idx, u8 key_idx,
			      struct ieee80211_key_conf *key);
u16 mt76_mac_tx_rate_val(struct mt7601u_dev *dev,
			 const struct ieee80211_tx_rate *rate, u8 *nss_val);
struct mt76_tx_status
mt7601u_mac_fetch_tx_status(struct mt7601u_dev *dev);
void mt76_send_tx_status(struct mt7601u_dev *dev, struct mt76_tx_status *stat);
void mt7601u_set_macaddr(struct mt7601u_dev *dev, const u8 *addr);

#endif