diff mbox series

[07/12] wifi: mt76: mt7996: set correct beamformee SS capability

Message ID 20240816094635.2391-6-shayne.chen@mediatek.com (mailing list archive)
State Accepted
Delegated to: Felix Fietkau
Headers show
Series [01/12] wifi: mt76: mt7996: use hweight16 to get correct tx antenna | expand

Commit Message

Shayne Chen Aug. 16, 2024, 9:46 a.m. UTC
From: Howard Hsu <howard-yh.hsu@mediatek.com>

According to IEEE P802.11be/D6.0 Table 9-417n, beamformee SS field stands
for the maximum number of spatial streams that the STA can receive in an
EHT sounding NDP minus 1, and the minimum value of this field is 3.

This value indicates the decoding capability of a beamformee, which is
independent of current antenna settings. Correct the value for mt7996
and mt7992 chipsets based on their HW capability.

Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
 .../net/wireless/mediatek/mt76/mt7996/init.c  | 23 ++++++++++++++-----
 1 file changed, 17 insertions(+), 6 deletions(-)

Comments

Ben Greear Aug. 19, 2024, 2:22 p.m. UTC | #1
On 8/16/24 02:46, Shayne Chen wrote:
> From: Howard Hsu <howard-yh.hsu@mediatek.com>
> 
> According to IEEE P802.11be/D6.0 Table 9-417n, beamformee SS field stands
> for the maximum number of spatial streams that the STA can receive in an
> EHT sounding NDP minus 1, and the minimum value of this field is 3.
> 
> This value indicates the decoding capability of a beamformee, which is
> independent of current antenna settings. Correct the value for mt7996
> and mt7992 chipsets based on their HW capability.

I thought that if user sets a specific number of antennas, the code should
act as if that were the number of physical antennas, so this change seems
wrong to me.

What use-case is this patch attempting to fix?

Thanks,
Ben
Shayne Chen Aug. 20, 2024, 10:23 a.m. UTC | #2
On Mon, 2024-08-19 at 07:22 -0700, Ben Greear wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  On 8/16/24 02:46, Shayne Chen wrote:
> > From: Howard Hsu <howard-yh.hsu@mediatek.com>
> > 
> > According to IEEE P802.11be/D6.0 Table 9-417n, beamformee SS field
> stands
> > for the maximum number of spatial streams that the STA can receive
> in an
> > EHT sounding NDP minus 1, and the minimum value of this field is 3.
> > 
> > This value indicates the decoding capability of a beamformee, which
> is
> > independent of current antenna settings. Correct the value for
> mt7996
> > and mt7992 chipsets based on their HW capability.
> 
> I thought that if user sets a specific number of antennas, the code
> should
> act as if that were the number of physical antennas, so this change
> seems
> wrong to me.
> 
We used to think that this field depends on the antennas. However, we
see that IEEE spec defines the minimum value of this field is 3, so we
think what the field means is the "MAX HW decoding capability", no
matter how many antennas that user currently configured.

For example, if user configures a beamformee with only 1 antenna, it is
still abled to decode a "(RX)-1x4-(TX)" matrix from a beamformer. 

> What use-case is this patch attempting to fix?
> 
We faced issues when doing some BF performance and cert tests.

Thanks,
Shayne

> Thanks,
> Ben
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/init.c b/drivers/net/wireless/mediatek/mt76/mt7996/init.c
index 7e7e42b54c2e..5e96973226bb 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/init.c
@@ -942,8 +942,12 @@  void mt7996_set_stream_vht_txbf_caps(struct mt7996_phy *phy)
 	cap = &phy->mt76->sband_5g.sband.vht_cap.cap;
 
 	*cap |= IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
-		IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE |
-		FIELD_PREP(IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK, sts - 1);
+		IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE;
+
+	if (is_mt7996(phy->mt76->dev))
+		*cap |= FIELD_PREP(IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK, 3);
+	else
+		*cap |= FIELD_PREP(IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK, 4);
 
 	*cap &= ~(IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK |
 		  IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
@@ -988,9 +992,15 @@  mt7996_set_stream_he_txbf_caps(struct mt7996_phy *phy,
 	    IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO;
 	elem->phy_cap_info[2] |= c;
 
-	c = IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE |
-	    IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4 |
-	    IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_4;
+	c = IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE;
+
+	if (is_mt7996(phy->mt76->dev))
+		c |= IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4 |
+		     IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_4;
+	else
+		c |= IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_5 |
+		     IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_5;
+
 	elem->phy_cap_info[4] |= c;
 
 	/* do not support NG16 due to spec D4.0 changes subcarrier idx */
@@ -1187,7 +1197,8 @@  mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,
 		IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMER |
 		IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMEE;
 
-	val = max_t(u8, sts - 1, 3);
+	/* Set the maximum capability regardless of the antenna configuration. */
+	val = is_mt7992(phy->mt76->dev) ? 4 : 3;
 	eht_cap_elem->phy_cap_info[0] |=
 		u8_encode_bits(u8_get_bits(val, BIT(0)),
 			       IEEE80211_EHT_PHY_CAP0_BEAMFORMEE_SS_80MHZ_MASK);