Skip to contentSkip to conversation

mt7915: add MU-MIMO support

PATCH In review Ryder Lee 2 participants 7 messages Jun 14, 2020 – Jun 15, 2020

Subsystems (2)
lore
Share & tools
lore

Ryder Lee

author maintainer
#0 lore raw

v3 cover mt7915: add MU-MIMO support

This series adds MU-MIMO support.

changes since v3:
- add patch 1/4 to avoid open coded and fix a wrong WMM parameter assignment.
- cleanup unused sta_rec_mu_edca_tlv.
- fix a wrong enum number "MT_LMAC_BMC0 = 0x10",

changes since v2:
- move CONFIG_MAC80211_DEBUGFS fixup into patch 1/3

Ryder Lee (4):
mt76: mt7915: add missing CONFIG_MAC80211_DEBUGFS
mt76: mt7915: add a fixed AC queue mapping
mt76: mt7915: add MU-MIMO support
mt76: mt7915: use ieee80211_tx_queue_params to avoid open coded

 .../wireless/mediatek/mt76/mt7915/debugfs.c   | 11 ++-
 .../net/wireless/mediatek/mt76/mt7915/mac.c   |  2 +-
 .../net/wireless/mediatek/mt76/mt7915/mac.h   | 10 --
 .../net/wireless/mediatek/mt76/mt7915/main.c  |  7 +-
 .../net/wireless/mediatek/mt76/mt7915/mcu.c   | 91 ++++++++++++++++---
 .../net/wireless/mediatek/mt76/mt7915/mcu.h   |  6 +-
 .../wireless/mediatek/mt76/mt7915/mt7915.h    | 34 +++++--
 .../net/wireless/mediatek/mt76/mt7915/regs.h  |  5 +
 8 files changed, 127 insertions(+), 39 deletions(-)
Signature · 1 line
2.18.0
author maintainer
#1 lore raw

PATCH v3 1/4 mt76: mt7915: add missing CONFIG_MAC80211_DEBUGFS

Add CONFIG_MAC80211_DEBUGFS to fix a reported warning.

Fixes ec9742a ("mt76: mt7915: add .sta_add_debugfs support")
---
 drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +2 -0
index 5278bee812f1..7e48f56b5b08 100644
@@ -384,6 +384,7 @@ int mt7915_init_debugfs(struct mt7915_dev *dev)
 	return 0;
 }
 
+#ifdef CONFIG_MAC80211_DEBUGFS
 /** per-station debugfs **/
 
 /* usage: <tx mode> <ldpc> <stbc> <bw> <gi> <nss> <mcs> */
@@ -461,3 +462,4 @@ void mt7915_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	debugfs_create_file("fixed_rate", 0600, dir, sta, &fops_fixed_rate);
 	debugfs_create_file("stats", 0400, dir, sta, &fops_sta_stats);
 }
+#endif
Signature · 1 line
2.18.0
#2 lore raw

Re: [PATCH v3 1/4] mt76: mt7915: add missing CONFIG_MAC80211_DEBUGFS

Quoted 5 lines · Ryder Lee

Add CONFIG_MAC80211_DEBUGFS to fix a reported warning.

Fixes ec9742a ("mt76: mt7915: add .sta_add_debugfs support")

Same comments as in v2:

Fixes ec9742a8f38e ("mt76: mt7915: add .sta_add_debugfs support")

Should this go to v5.8?

Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
author maintainer
#3 lore raw

Re: [PATCH v3 1/4] mt76: mt7915: add missing CONFIG_MAC80211_DEBUGFS

Quoted 8 lines · Kalle Valo
Quoted 5 lines · Ryder Lee

Add CONFIG_MAC80211_DEBUGFS to fix a reported warning.

Fixes ec9742a ("mt76: mt7915: add .sta_add_debugfs support")
Quoted 6 lines

Same comments as in v2:

Fixes ec9742a8f38e ("mt76: mt7915: add .sta_add_debugfs support")

Should this go to v5.8?

Yep:)

Ryder

author maintainer
#4 lore raw

PATCH v3 2/4 mt76: mt7915: add a fixed AC queue mapping

In reply to Ryder Lee

In MT7915, hardware queue map is flexible. However, certain firmware modules like MU and U-APSD presume a fixed queue order to adapt some devices that have DMA scheduler with a strict order, so this patch can help in the long run.

---
 .../net/wireless/mediatek/mt76/mt7915/mac.c   |  2 +-
 .../net/wireless/mediatek/mt76/mt7915/mac.h   | 10 --------
 .../net/wireless/mediatek/mt76/mt7915/main.c  |  3 +++
 .../wireless/mediatek/mt76/mt7915/mt7915.h    | 25 +++++++++++++++++++
 4 files changed, 29 insertions(+), 11 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +1 -1
index a264e304a3df..660e1820cccf 100644
@@ -593,7 +593,7 @@ void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi,
 
 	if (ieee80211_is_data(fc) || ieee80211_is_bufferable_mmpdu(fc)) {
 		q_idx = wmm_idx * MT7915_MAX_WMM_SETS +
-			skb_get_queue_mapping(skb);
+			mt7915_lmac_mapping(dev, skb_get_queue_mapping(skb));
 		p_fmt = MT_TX_TYPE_CT;
 	} else if (beacon) {
 		q_idx = MT_LMAC_BCN0;
drivers/net/wireless/mediatek/mt76/mt7915/mac.h +0 -10
index b9bc8b25b031..4b0871ab2414 100644
@@ -149,16 +149,6 @@ enum tx_pkt_type {
 	MT_TX_TYPE_FW,
 };
 
-enum tx_pkt_queue_idx {
-	MT_LMAC_AC00,
-	MT_LMAC_AC01,
-	MT_LMAC_AC02,
-	MT_LMAC_AC03,
-	MT_LMAC_ALTX0 = 0x10,
-	MT_LMAC_BMC0 = 0x10,
-	MT_LMAC_BCN0 = 0x12,
-};
-
 enum tx_port_idx {
 	MT_TX_PORT_IDX_LMAC,
 	MT_TX_PORT_IDX_MCU
drivers/net/wireless/mediatek/mt76/mt7915/main.c +3 -0
index 05b5650c56c8..e09899748c9b 100644
@@ -350,9 +350,12 @@ static int
 mt7915_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue,
 	       const struct ieee80211_tx_queue_params *params)
 {
+	struct mt7915_dev *dev = mt7915_hw_dev(hw);
 	struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
 
 	/* no need to update right away, we'll get BSS_CHANGED_QOS */
+	queue = mt7915_lmac_mapping(dev, queue);
+
 	mvif->wmm[queue].cw_min = params->cw_min;
 	mvif->wmm[queue].cw_max = params->cw_max;
 	mvif->wmm[queue].aifs = params->aifs;
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +25 -0
index 85d74ecd0351..b3b00d099236 100644
@@ -199,6 +199,16 @@ enum {
 	EXT_BSSID_END
 };
 
+enum {
+	MT_LMAC_AC00,
+	MT_LMAC_AC01,
+	MT_LMAC_AC02,
+	MT_LMAC_AC03,
+	MT_LMAC_ALTX0 = 0x10,
+	MT_LMAC_BMC0,
+	MT_LMAC_BCN0,
+};
+
 enum {
 	MT_RX_SEL0,
 	MT_RX_SEL1,
@@ -254,6 +264,21 @@ mt7915_ext_phy(struct mt7915_dev *dev)
 	return phy->priv;
 }
 
+static inline u8 mt7915_lmac_mapping(struct mt7915_dev *dev, u8 ac)
+{
+	static const u8 lmac_queue_map[] = {
+		[IEEE80211_AC_BK] = MT_LMAC_AC00,
+		[IEEE80211_AC_BE] = MT_LMAC_AC01,
+		[IEEE80211_AC_VI] = MT_LMAC_AC02,
+		[IEEE80211_AC_VO] = MT_LMAC_AC03,
+	};
+
+	if (WARN_ON_ONCE(ac >= ARRAY_SIZE(lmac_queue_map)))
+		return MT_LMAC_AC01; /* BE */
+
+	return lmac_queue_map[ac];
+}
+
 static inline void
 mt7915_set_aggr_state(struct mt7915_sta *msta, u8 tid,
 		      enum mt7915_ampdu_state state)
Signature · 1 line
2.18.0
author maintainer
#5 lore raw

PATCH v3 3/4 mt76: mt7915: add MU-MIMO support

In reply to Ryder Lee

Enable MU-MIMO DL/UL and add relative counters in debugfs.

Currently MU modules read WTBL first to notify BA changes to other cross modules, so adjust mt7915_mcu_sta_ba() accordingly.

---
 .../wireless/mediatek/mt76/mt7915/debugfs.c   |  9 ++-
 .../net/wireless/mediatek/mt76/mt7915/mcu.c   | 77 +++++++++++++++++--
 .../net/wireless/mediatek/mt76/mt7915/mcu.h   |  6 +-
 .../net/wireless/mediatek/mt76/mt7915/regs.h  |  5 ++
 4 files changed, 87 insertions(+), 10 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +8 -1
index 7e48f56b5b08..38f473d587c9 100644
@@ -178,7 +178,14 @@ mt7915_txbf_stat_read_phy(struct mt7915_phy *phy, struct seq_file *s)
 	seq_printf(s, "Tx Beamformee feedback triggered counts: %ld\n",
 		   FIELD_GET(MT_ETBF_TX_FB_TRI, cnt));
 
-	/* Tx SU counters */
+	/* Tx SU & MU counters */
+	cnt = mt76_rr(dev, MT_MIB_SDR34(ext_phy));
+	seq_printf(s, "Tx multi-user Beamforming counts: %ld\n",
+		   FIELD_GET(MT_MIB_MU_BF_TX_CNT, cnt));
+	cnt = mt76_rr(dev, MT_MIB_DR8(ext_phy));
+	seq_printf(s, "Tx multi-user MPDU counts: %d\n", cnt);
+	cnt = mt76_rr(dev, MT_MIB_DR9(ext_phy));
+	seq_printf(s, "Tx multi-user successful MPDU counts: %d\n", cnt);
 	cnt = mt76_rr(dev, MT_MIB_DR11(ext_phy));
 	seq_printf(s, "Tx single-user successful MPDU counts: %d\n", cnt);
 
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +71 -6

132 lines not on this page · raw message

drivers/net/wireless/mediatek/mt76/mt7915/mcu.h +3 -3
index c241dd7c4c36..cb35e718409a 100644
@@ -201,6 +201,7 @@ enum {
 	MCU_EXT_CMD_EDCA_UPDATE = 0x27,
 	MCU_EXT_CMD_DEV_INFO_UPDATE = 0x2A,
 	MCU_EXT_CMD_THERMAL_CTRL = 0x2c,
+	MCU_EXT_CMD_SET_DRR_CTRL = 0x36,
 	MCU_EXT_CMD_SET_RDD_CTRL = 0x3a,
 	MCU_EXT_CMD_PROTECT_CTRL = 0x3e,
 	MCU_EXT_CMD_MAC_INIT_CTRL = 0x46,
@@ -653,7 +654,7 @@ struct sta_rec_muru {
 		bool ofdma_ul_en;
 		bool mimo_dl_en;
 		bool mimo_ul_en;
-		bool rsv[4];
+		u8 rsv[4];
 	} cfg;
 
 	struct {
@@ -664,7 +665,7 @@ struct sta_rec_muru {
 		bool lt16_sigb;
 		bool rx_su_comp_sigb;
 		bool rx_su_non_comp_sigb;
-		bool rsv;
+		u8 rsv;
 	} ofdma_dl;
 
 	struct {
@@ -951,7 +952,6 @@ enum {
 					 sizeof(struct sta_rec_ba) +	\
 					 sizeof(struct sta_rec_vht) +	\
 					 sizeof(struct tlv) +		\
-					 sizeof(struct sta_rec_muru) +	\
 					 MT7915_WTBL_UPDATE_MAX_SIZE)
 
 #define MT7915_WTBL_UPDATE_BA_SIZE	(sizeof(struct wtbl_req_hdr) +	\
drivers/net/wireless/mediatek/mt76/mt7915/regs.h +5 -0
index c121715f8bff..e0989141d9da 100644
@@ -117,11 +117,16 @@
 #define MT_MIB_SDR16(_band)		MT_WF_MIB(_band, 0x048)
 #define MT_MIB_SDR16_BUSY_MASK		GENMASK(23, 0)
 
+#define MT_MIB_SDR34(_band)		MT_WF_MIB(_band, 0x090)
+#define MT_MIB_MU_BF_TX_CNT		GENMASK(15, 0)
+
 #define MT_MIB_SDR36(_band)		MT_WF_MIB(_band, 0x098)
 #define MT_MIB_SDR36_TXTIME_MASK	GENMASK(23, 0)
 #define MT_MIB_SDR37(_band)		MT_WF_MIB(_band, 0x09c)
 #define MT_MIB_SDR37_RXTIME_MASK	GENMASK(23, 0)
 
+#define MT_MIB_DR8(_band)		MT_WF_MIB(_band, 0x0c0)
+#define MT_MIB_DR9(_band)		MT_WF_MIB(_band, 0x0c4)
 #define MT_MIB_DR11(_band)		MT_WF_MIB(_band, 0x0cc)
 
 #define MT_MIB_MB_SDR0(_band, n)	MT_WF_MIB(_band, 0x100 + ((n) << 4))
Signature · 1 line
2.18.0
author maintainer
#6 lore raw

PATCH v3 4/4 mt76: mt7915: use ieee80211_tx_queue_params to avoid open coded

In reply to Ryder Lee

This is easy to add MU EDCA parameters in the future. This patch also fixes a wrong cw_min assignment.

---
 drivers/net/wireless/mediatek/mt76/mt7915/main.c   |  6 +-----
 drivers/net/wireless/mediatek/mt76/mt7915/mcu.c    | 14 +++++++-------
 drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h |  9 ++-------
 3 files changed, 10 insertions(+), 19 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/main.c +1 -5
index e09899748c9b..0c1217d3acd8 100644
@@ -355,11 +355,7 @@ mt7915_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue,
 
 	/* no need to update right away, we'll get BSS_CHANGED_QOS */
 	queue = mt7915_lmac_mapping(dev, queue);
-
-	mvif->wmm[queue].cw_min = params->cw_min;
-	mvif->wmm[queue].cw_max = params->cw_max;
-	mvif->wmm[queue].aifs = params->aifs;
-	mvif->wmm[queue].txop = params->txop;
+	mvif->queue_params[queue] = *params;
 
 	return 0;
 }
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +7 -7
index ca3e700425b6..fa9f32fa9f2e 100644
@@ -2888,23 +2888,23 @@ int mt7915_mcu_set_tx(struct mt7915_dev *dev, struct ieee80211_vif *vif)
 	int ac;
 
 	for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
+		struct ieee80211_tx_queue_params *q = &mvif->queue_params[ac];
 		struct edca *e = &req.edca[ac];
 
 		e->queue = ac + mvif->wmm_idx * MT7915_MAX_WMM_SETS;
-		e->aifs = mvif->wmm[ac].aifs;
-		e->txop = cpu_to_le16(mvif->wmm[ac].txop);
+		e->aifs = q->aifs;
+		e->txop = cpu_to_le16(q->txop);
 
-		if (mvif->wmm[ac].cw_min)
-			e->cw_min = fls(mvif->wmm[ac].cw_max);
+		if (q->cw_min)
+			e->cw_min = fls(q->cw_min);
 		else
 			e->cw_min = 5;
 
-		if (mvif->wmm[ac].cw_max)
-			e->cw_max = cpu_to_le16(fls(mvif->wmm[ac].cw_max));
+		if (q->cw_max)
+			e->cw_max = cpu_to_le16(fls(q->cw_max));
 		else
 			e->cw_max = cpu_to_le16(10);
 	}
-
 	return __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_EDCA_UPDATE,
 				  &req, sizeof(req), true);
 }
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +2 -7
index b3b00d099236..4a063c1e5ea2 100644
@@ -99,15 +99,10 @@ struct mt7915_vif {
 	u8 band_idx;
 	u8 wmm_idx;
 
-	struct {
-		u16 cw_min;
-		u16 cw_max;
-		u16 txop;
-		u8 aifs;
-	} wmm[IEEE80211_NUM_ACS];
-
 	struct mt7915_sta sta;
 	struct mt7915_dev *dev;
+
+	struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
 };
 
 struct mib_stats {
Signature · 1 line
2.18.0