Commit 5c0bed88 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

mt76: connac: move mt76_connac_fw_txp in common module



Since mt76_connac_fw_txp struct is shared between mt7615e, mt7915e and
mt7921e, move it in mt76_connac module.

Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 6d6796db
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -877,7 +877,7 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
EXPORT_SYMBOL_GPL(mt7615_mac_write_txwi);

static void
mt7615_txp_skb_unmap_fw(struct mt76_dev *dev, struct mt7615_fw_txp *txp)
mt7615_txp_skb_unmap_fw(struct mt76_dev *dev, struct mt76_connac_fw_txp *txp)
{
	int i;

@@ -922,7 +922,7 @@ void mt7615_txp_skb_unmap(struct mt76_dev *dev,
{
	struct mt7615_txp_common *txp;

	txp = mt7615_txwi_to_txp(dev, t);
	txp = mt76_connac_txwi_to_txp(dev, t);
	if (is_mt7615(dev))
		mt7615_txp_skb_unmap_fw(dev, &txp->fw);
	else
+1 −32
Original line number Diff line number Diff line
@@ -165,12 +165,6 @@ enum tx_phy_bandwidth {
#define MT_CT_INFO_NONE_CIPHER_FRAME	BIT(3)
#define MT_CT_INFO_HSR2_TX		BIT(4)

#define MT_TXD_SIZE			(8 * 4)

#define MT_USB_TXD_SIZE			(MT_TXD_SIZE + 8 * 4)
#define MT_USB_HDR_SIZE			4
#define MT_USB_TAIL_SIZE		4

#define MT_TXD0_P_IDX			BIT(31)
#define MT_TXD0_Q_IDX			GENMASK(30, 26)
#define MT_TXD0_UDP_TCP_SUM		BIT(24)
@@ -250,7 +244,6 @@ enum tx_phy_bandwidth {
#define MT_TX_RATE_MODE			GENMASK(8, 6)
#define MT_TX_RATE_IDX			GENMASK(5, 0)

#define MT_TXP_MAX_BUF_NUM		6
#define MT_HW_TXP_MAX_MSDU_NUM		4
#define MT_HW_TXP_MAX_BUF_NUM		4

@@ -274,20 +267,9 @@ struct mt7615_hw_txp {
	struct mt7615_txp_ptr ptr[MT_HW_TXP_MAX_BUF_NUM / 2];
} __packed __aligned(4);

struct mt7615_fw_txp {
	__le16 flags;
	__le16 token;
	u8 bss_idx;
	u8 rept_wds_wcid;
	u8 rsv;
	u8 nbuf;
	__le32 buf[MT_TXP_MAX_BUF_NUM];
	__le16 len[MT_TXP_MAX_BUF_NUM];
} __packed __aligned(4);

struct mt7615_txp_common {
	union {
		struct mt7615_fw_txp fw;
		struct mt76_connac_fw_txp fw;
		struct mt7615_hw_txp hw;
	};
};
@@ -385,19 +367,6 @@ struct mt7615_dfs_radar_spec {
	struct mt7615_dfs_pattern radar_pattern[16];
};

static inline struct mt7615_txp_common *
mt7615_txwi_to_txp(struct mt76_dev *dev, struct mt76_txwi_cache *t)
{
	u8 *txwi;

	if (!t)
		return NULL;

	txwi = mt76_get_txwi_ptr(dev, t);

	return (struct mt7615_txp_common *)(txwi + MT_TXD_SIZE);
}

static inline u32 mt7615_mac_wtbl_addr(struct mt7615_dev *dev, int wcid)
{
	return MT_WTBL_BASE(dev) + wcid * MT_WTBL_ENTRY_SIZE;
+4 −3
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ void mt7615_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e)
		u16 token;

		dev = container_of(mdev, struct mt7615_dev, mt76);
		txp = mt7615_txwi_to_txp(mdev, e->txwi);
		txp = mt76_connac_txwi_to_txp(mdev, e->txwi);

		if (is_mt7615(&dev->mt76))
			token = le16_to_cpu(txp->fw.token);
@@ -91,7 +91,8 @@ mt7615_write_fw_txp(struct mt7615_dev *dev, struct mt76_tx_info *tx_info,
	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_info->skb);
	struct ieee80211_key_conf *key = info->control.hw_key;
	struct ieee80211_vif *vif = info->control.vif;
	struct mt7615_fw_txp *txp = txp_ptr;
	struct mt76_connac_fw_txp *txp = txp_ptr;
	u8 *rept_wds_wcid = (u8 *)&txp->rept_wds_wcid;
	int nbuf = tx_info->nbuf - 1;
	int i;

@@ -122,7 +123,7 @@ mt7615_write_fw_txp(struct mt7615_dev *dev, struct mt76_tx_info *tx_info,
	}

	txp->token = cpu_to_le16(id);
	txp->rept_wds_wcid = 0xff;
	*rept_wds_wcid = 0xff;
}

int mt7615_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+35 −0
Original line number Diff line number Diff line
@@ -17,6 +17,16 @@
#define MT76_CONNAC_COREDUMP_TIMEOUT		(HZ / 20)
#define MT76_CONNAC_COREDUMP_SZ			(1300 * 1024)

#define MT_TXD_SIZE				(8 * 4)

#define MT_USB_TXD_SIZE				(MT_TXD_SIZE + 8 * 4)
#define MT_USB_HDR_SIZE				4
#define MT_USB_TAIL_SIZE			4

#define MT_SDIO_TXD_SIZE			(MT_TXD_SIZE + 8 * 4)
#define MT_SDIO_TAIL_SIZE			8
#define MT_SDIO_HDR_SIZE			4

enum {
	CMD_CBW_20MHZ = IEEE80211_STA_RX_BW_20,
	CMD_CBW_40MHZ = IEEE80211_STA_RX_BW_40,
@@ -92,6 +102,18 @@ struct mt76_connac_sta_key_conf {
	u8 key[16];
};

#define MT_TXP_MAX_BUF_NUM		6

struct mt76_connac_fw_txp {
	__le16 flags;
	__le16 token;
	u8 bss_idx;
	__le16 rept_wds_wcid;
	u8 nbuf;
	__le32 buf[MT_TXP_MAX_BUF_NUM];
	__le16 len[MT_TXP_MAX_BUF_NUM];
} __packed __aligned(4);

extern const struct wiphy_wowlan_support mt76_connac_wowlan_support;

static inline bool is_mt7922(struct mt76_dev *dev)
@@ -172,6 +194,19 @@ static inline u8 mt76_connac_lmac_mapping(u8 ac)
	return 3 - ac;
}

static inline void *
mt76_connac_txwi_to_txp(struct mt76_dev *dev, struct mt76_txwi_cache *t)
{
	u8 *txwi;

	if (!t)
		return NULL;

	txwi = mt76_get_txwi_ptr(dev, t);

	return (void *)(txwi + MT_TXD_SIZE);
}

int mt76_connac_pm_wake(struct mt76_phy *phy, struct mt76_connac_pm *pm);
void mt76_connac_power_save_sched(struct mt76_phy *phy,
				  struct mt76_connac_pm *pm);
+7 −6
Original line number Diff line number Diff line
@@ -32,12 +32,6 @@ enum {
	MT_LMAC_PSMP0,
};

#define MT_TXD_SIZE			(8 * 4)
#define MT_SDIO_TXD_SIZE		(MT_TXD_SIZE + 8 * 4)
#define MT_SDIO_TAIL_SIZE		8
#define MT_SDIO_HDR_SIZE		4
#define MT_USB_TAIL_SIZE		4

#define MT_TXD0_Q_IDX			GENMASK(31, 25)
#define MT_TXD0_PKT_FMT			GENMASK(24, 23)
#define MT_TXD0_ETH_TYPE_OFFSET		GENMASK(22, 16)
@@ -306,4 +300,11 @@ enum {
#define MT_CRXV_FOE_HI		GENMASK(6, 0)
#define MT_CRXV_FOE_SHIFT	13

#define MT_CT_INFO_APPLY_TXD		BIT(0)
#define MT_CT_INFO_COPY_HOST_TXD_ALL	BIT(1)
#define MT_CT_INFO_MGMT_FRAME		BIT(2)
#define MT_CT_INFO_NONE_CIPHER_FRAME	BIT(3)
#define MT_CT_INFO_HSR2_TX		BIT(4)
#define MT_CT_INFO_FROM_HOST		BIT(7)

#endif /* __MT76_CONNAC2_MAC_H */
Loading