mt76: connac: move mt76_connac_tx_free in shared code
Move mt76_connac_tx_free structure in mt76_connac module since it is shared by mt7615 and mt7921 drivers. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
4cb4da17fe
commit
4b3be9d840
|
@ -1638,7 +1638,8 @@ mt7615_mac_tx_free_token(struct mt7615_dev *dev, u16 token)
|
|||
|
||||
static void mt7615_mac_tx_free(struct mt7615_dev *dev, void *data, int len)
|
||||
{
|
||||
struct mt7615_tx_free *free = (struct mt7615_tx_free *)data;
|
||||
struct mt76_connac_tx_free *free = data;
|
||||
void *tx_token = data + sizeof(*free);
|
||||
void *end = data + len;
|
||||
u8 i, count;
|
||||
|
||||
|
@ -1652,7 +1653,7 @@ static void mt7615_mac_tx_free(struct mt7615_dev *dev, void *data, int len)
|
|||
|
||||
count = le16_get_bits(free->ctrl, MT_TX_FREE_MSDU_ID_CNT);
|
||||
if (is_mt7615(&dev->mt76)) {
|
||||
__le16 *token = &free->token[0];
|
||||
__le16 *token = tx_token;
|
||||
|
||||
if (WARN_ON_ONCE((void *)&token[count] > end))
|
||||
return;
|
||||
|
@ -1660,7 +1661,7 @@ static void mt7615_mac_tx_free(struct mt7615_dev *dev, void *data, int len)
|
|||
for (i = 0; i < count; i++)
|
||||
mt7615_mac_tx_free_token(dev, le16_to_cpu(token[i]));
|
||||
} else {
|
||||
__le32 *token = (__le32 *)&free->token[0];
|
||||
__le32 *token = tx_token;
|
||||
|
||||
if (WARN_ON_ONCE((void *)&token[count] > end))
|
||||
return;
|
||||
|
|
|
@ -252,14 +252,6 @@ enum tx_phy_bandwidth {
|
|||
/* mt7663 */
|
||||
#define MT_TXD_LEN_LAST BIT(15)
|
||||
|
||||
struct mt7615_tx_free {
|
||||
__le16 rx_byte_cnt;
|
||||
__le16 ctrl;
|
||||
u8 txd_cnt;
|
||||
u8 rsv[3];
|
||||
__le16 token[];
|
||||
} __packed __aligned(4);
|
||||
|
||||
#define MT_TX_FREE_MSDU_ID_CNT GENMASK(6, 0)
|
||||
|
||||
#define MT_TXS0_PID GENMASK(31, 24)
|
||||
|
|
|
@ -136,6 +136,13 @@ struct mt76_connac_txp_common {
|
|||
};
|
||||
};
|
||||
|
||||
struct mt76_connac_tx_free {
|
||||
__le16 rx_byte_cnt;
|
||||
__le16 ctrl;
|
||||
u8 txd_cnt;
|
||||
u8 rsv[3];
|
||||
} __packed __aligned(4);
|
||||
|
||||
extern const struct wiphy_wowlan_support mt76_connac_wowlan_support;
|
||||
|
||||
static inline bool is_mt7922(struct mt76_dev *dev)
|
||||
|
|
|
@ -42,14 +42,6 @@ enum tx_mcu_port_q_idx {
|
|||
MT_TX_MCU_PORT_RX_FWDL = 0x3e
|
||||
};
|
||||
|
||||
struct mt7921_tx_free {
|
||||
__le16 rx_byte_cnt;
|
||||
__le16 ctrl;
|
||||
u8 txd_cnt;
|
||||
u8 rsv[3];
|
||||
__le32 info[];
|
||||
} __packed __aligned(4);
|
||||
|
||||
#define MT_TX_FREE_MSDU_CNT GENMASK(9, 0)
|
||||
#define MT_TX_FREE_WLAN_ID GENMASK(23, 14)
|
||||
#define MT_TX_FREE_LATENCY GENMASK(12, 0)
|
||||
|
|
|
@ -150,7 +150,8 @@ out:
|
|||
static void
|
||||
mt7921e_mac_tx_free(struct mt7921_dev *dev, void *data, int len)
|
||||
{
|
||||
struct mt7921_tx_free *free = (struct mt7921_tx_free *)data;
|
||||
struct mt76_connac_tx_free *free = data;
|
||||
__le32 *tx_info = (__le32 *)(data + sizeof(*free));
|
||||
struct mt76_dev *mdev = &dev->mt76;
|
||||
struct mt76_txwi_cache *txwi;
|
||||
struct ieee80211_sta *sta = NULL;
|
||||
|
@ -165,11 +166,11 @@ mt7921e_mac_tx_free(struct mt7921_dev *dev, void *data, int len)
|
|||
mt76_queue_tx_cleanup(dev, dev->mphy.q_tx[MT_TXQ_BE], false);
|
||||
|
||||
count = le16_get_bits(free->ctrl, MT_TX_FREE_MSDU_CNT);
|
||||
if (WARN_ON_ONCE((void *)&free->info[count] > end))
|
||||
if (WARN_ON_ONCE((void *)&tx_info[count] > end))
|
||||
return;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
u32 msdu, info = le32_to_cpu(free->info[i]);
|
||||
u32 msdu, info = le32_to_cpu(tx_info[i]);
|
||||
u8 stat;
|
||||
|
||||
/* 1'b1: new wcid pair.
|
||||
|
|
Loading…
Reference in New Issue