From: Ming Yen Hsieh <[email protected]>
Due to information missing, the firmware may be fail on bandwidth
related settings in mt7921/mt7922. Add new cmd STA_REC_HE_V2 to apply
additional capabilities in 6GHz band.
Tested-by: Ben Greear <[email protected]>
Co-developed-by: Deren Wu <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Ming Yen Hsieh <[email protected]>
---
v2: Fix le16/cpu type problem, reported by kernel test robot <[email protected]>
---
.../wireless/mediatek/mt76/mt76_connac_mcu.c | 34 +++++++++++++++++++
.../wireless/mediatek/mt76/mt76_connac_mcu.h | 11 ++++++
2 files changed, 45 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index 011fc9729b38..9bba18d24c71 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -744,6 +744,39 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
he->pkt_ext = 2;
}
+static void
+mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
+{
+ struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap;
+ struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem;
+ struct sta_rec_he_v2 *he;
+ struct tlv *tlv;
+
+ tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE_V2, sizeof(*he));
+
+ he = (struct sta_rec_he_v2 *)tlv;
+ memcpy(he->he_phy_cap, elem->phy_cap_info, sizeof(he->he_phy_cap));
+ memcpy(he->he_mac_cap, elem->mac_cap_info, sizeof(he->he_mac_cap));
+
+ switch (sta->deflink.bandwidth) {
+ case IEEE80211_STA_RX_BW_160:
+ if (elem->phy_cap_info[0] &
+ IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
+ he->max_nss_mcs[CMD_HE_MCS_BW8080] =
+ he_cap->he_mcs_nss_supp.rx_mcs_80p80;
+
+ he->max_nss_mcs[CMD_HE_MCS_BW160] =
+ he_cap->he_mcs_nss_supp.rx_mcs_160;
+ fallthrough;
+ default:
+ he->max_nss_mcs[CMD_HE_MCS_BW80] =
+ he_cap->he_mcs_nss_supp.rx_mcs_80;
+ break;
+ }
+
+ he->pkt_ext = IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US;
+}
+
static u8
mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif,
enum nl80211_band band, struct ieee80211_sta *sta)
@@ -838,6 +871,7 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
/* starec he */
if (sta->deflink.he_cap.has_he) {
mt76_connac_mcu_sta_he_tlv(skb, sta);
+ mt76_connac_mcu_sta_he_tlv_v2(skb, sta);
if (band == NL80211_BAND_6GHZ &&
sta_state == MT76_STA_INFO_STATE_ASSOC) {
struct sta_rec_he_6g_capa *he_6g_capa;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
index cf4ce3b1fc21..8166722d4717 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
@@ -354,6 +354,16 @@ struct sta_rec_he {
u8 rsv2[2];
} __packed;
+struct sta_rec_he_v2 {
+ __le16 tag;
+ __le16 len;
+ u8 he_mac_cap[6];
+ u8 he_phy_cap[11];
+ u8 pkt_ext;
+ /* 0: BW80, 1: BW160, 2: BW8080 */
+ __le16 max_nss_mcs[CMD_HE_MCS_BW_NUM];
+} __packed;
+
struct sta_rec_amsdu {
__le16 tag;
__le16 len;
@@ -779,6 +789,7 @@ enum {
STA_REC_BFEE,
STA_REC_PHY = 0x15,
STA_REC_HE_6G = 0x17,
+ STA_REC_HE_V2 = 0x19,
STA_REC_MAX_NUM
};
--
2.18.0
> From: Ming Yen Hsieh <[email protected]>
>
> Due to information missing, the firmware may be fail on bandwidth
> related settings in mt7921/mt7922. Add new cmd STA_REC_HE_V2 to apply
> additional capabilities in 6GHz band.
>
> Tested-by: Ben Greear <[email protected]>
> Co-developed-by: Deren Wu <[email protected]>
> Signed-off-by: Deren Wu <[email protected]>
> Signed-off-by: Ming Yen Hsieh <[email protected]>
> ---
> v2: Fix le16/cpu type problem, reported by kernel test robot <[email protected]>
> ---
> .../wireless/mediatek/mt76/mt76_connac_mcu.c | 34 +++++++++++++++++++
> .../wireless/mediatek/mt76/mt76_connac_mcu.h | 11 ++++++
> 2 files changed, 45 insertions(+)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> index 011fc9729b38..9bba18d24c71 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> @@ -744,6 +744,39 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
> he->pkt_ext = 2;
> }
>
> +static void
> +mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct ieee80211_sta *sta)
Is this tlv available just for 7921 fw? If so I guess we should add it just for
it since mt76_connac_mcu_sta_tlv is used even by other chipsets.
Regards,
Lorenzo
> +{
> + struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap;
> + struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem;
> + struct sta_rec_he_v2 *he;
> + struct tlv *tlv;
> +
> + tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HE_V2, sizeof(*he));
> +
> + he = (struct sta_rec_he_v2 *)tlv;
> + memcpy(he->he_phy_cap, elem->phy_cap_info, sizeof(he->he_phy_cap));
> + memcpy(he->he_mac_cap, elem->mac_cap_info, sizeof(he->he_mac_cap));
> +
> + switch (sta->deflink.bandwidth) {
> + case IEEE80211_STA_RX_BW_160:
> + if (elem->phy_cap_info[0] &
> + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
> + he->max_nss_mcs[CMD_HE_MCS_BW8080] =
> + he_cap->he_mcs_nss_supp.rx_mcs_80p80;
> +
> + he->max_nss_mcs[CMD_HE_MCS_BW160] =
> + he_cap->he_mcs_nss_supp.rx_mcs_160;
> + fallthrough;
> + default:
> + he->max_nss_mcs[CMD_HE_MCS_BW80] =
> + he_cap->he_mcs_nss_supp.rx_mcs_80;
> + break;
> + }
> +
> + he->pkt_ext = IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US;
> +}
> +
> static u8
> mt76_connac_get_phy_mode_v2(struct mt76_phy *mphy, struct ieee80211_vif *vif,
> enum nl80211_band band, struct ieee80211_sta *sta)
> @@ -838,6 +871,7 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
> /* starec he */
> if (sta->deflink.he_cap.has_he) {
> mt76_connac_mcu_sta_he_tlv(skb, sta);
> + mt76_connac_mcu_sta_he_tlv_v2(skb, sta);
> if (band == NL80211_BAND_6GHZ &&
> sta_state == MT76_STA_INFO_STATE_ASSOC) {
> struct sta_rec_he_6g_capa *he_6g_capa;
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> index cf4ce3b1fc21..8166722d4717 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> @@ -354,6 +354,16 @@ struct sta_rec_he {
> u8 rsv2[2];
> } __packed;
>
> +struct sta_rec_he_v2 {
> + __le16 tag;
> + __le16 len;
> + u8 he_mac_cap[6];
> + u8 he_phy_cap[11];
> + u8 pkt_ext;
> + /* 0: BW80, 1: BW160, 2: BW8080 */
> + __le16 max_nss_mcs[CMD_HE_MCS_BW_NUM];
> +} __packed;
> +
> struct sta_rec_amsdu {
> __le16 tag;
> __le16 len;
> @@ -779,6 +789,7 @@ enum {
> STA_REC_BFEE,
> STA_REC_PHY = 0x15,
> STA_REC_HE_6G = 0x17,
> + STA_REC_HE_V2 = 0x19,
> STA_REC_MAX_NUM
> };
>
> --
> 2.18.0
>
Hi Lorenzo,
On Tue, 2022-10-25 at 10:33 +0200, Lorenzo Bianconi wrote:
> > From: Ming Yen Hsieh <[email protected]>
> >
> > Due to information missing, the firmware may be fail on bandwidth
> > related settings in mt7921/mt7922. Add new cmd STA_REC_HE_V2 to
> > apply
> > additional capabilities in 6GHz band.
> >
> > Tested-by: Ben Greear <[email protected]>
> > Co-developed-by: Deren Wu <[email protected]>
> > Signed-off-by: Deren Wu <[email protected]>
> > Signed-off-by: Ming Yen Hsieh <[email protected]>
> > ---
> > v2: Fix le16/cpu type problem, reported by kernel test robot <
> > [email protected]>
> > ---
> > .../wireless/mediatek/mt76/mt76_connac_mcu.c | 34
> > +++++++++++++++++++
> > .../wireless/mediatek/mt76/mt76_connac_mcu.h | 11 ++++++
> > 2 files changed, 45 insertions(+)
> >
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > index 011fc9729b38..9bba18d24c71 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > @@ -744,6 +744,39 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff
> > *skb, struct ieee80211_sta *sta)
> > he->pkt_ext = 2;
> > }
> >
> > +static void
> > +mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct
> > ieee80211_sta *sta)
>
> Is this tlv available just for 7921 fw? If so I guess we should add
> it just for
> it since mt76_connac_mcu_sta_tlv is used even by other chipsets.
>
> Regards,
> Lorenzo
>
For now, mt76_connac_mcu_sta_he_tlv_v2() would be used for mt7921 only,
not for other chips. However, it would be used for all next-generation
chipsets. I propose to put it here and we will take this API in new
chip porting.
Regards,
Deren
> Hi Lorenzo,
>
> On Tue, 2022-10-25 at 10:33 +0200, Lorenzo Bianconi wrote:
> > > From: Ming Yen Hsieh <[email protected]>
> > >
> > > Due to information missing, the firmware may be fail on bandwidth
> > > related settings in mt7921/mt7922. Add new cmd STA_REC_HE_V2 to
> > > apply
> > > additional capabilities in 6GHz band.
> > >
> > > Tested-by: Ben Greear <[email protected]>
> > > Co-developed-by: Deren Wu <[email protected]>
> > > Signed-off-by: Deren Wu <[email protected]>
> > > Signed-off-by: Ming Yen Hsieh <[email protected]>
> > > ---
> > > v2: Fix le16/cpu type problem, reported by kernel test robot <
> > > [email protected]>
> > > ---
> > > .../wireless/mediatek/mt76/mt76_connac_mcu.c | 34
> > > +++++++++++++++++++
> > > .../wireless/mediatek/mt76/mt76_connac_mcu.h | 11 ++++++
> > > 2 files changed, 45 insertions(+)
> > >
> > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > > b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > > index 011fc9729b38..9bba18d24c71 100644
> > > --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > > +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > > @@ -744,6 +744,39 @@ mt76_connac_mcu_sta_he_tlv(struct sk_buff
> > > *skb, struct ieee80211_sta *sta)
> > > he->pkt_ext = 2;
> > > }
> > >
> > > +static void
> > > +mt76_connac_mcu_sta_he_tlv_v2(struct sk_buff *skb, struct
> > > ieee80211_sta *sta)
> >
> > Is this tlv available just for 7921 fw? If so I guess we should add
> > it just for
> > it since mt76_connac_mcu_sta_tlv is used even by other chipsets.
> >
> > Regards,
> > Lorenzo
> >
>
> For now, mt76_connac_mcu_sta_he_tlv_v2() would be used for mt7921 only,
> not for other chips. However, it would be used for all next-generation
> chipsets. I propose to put it here and we will take this API in new
> chip porting.
I am fine with it, I was thinking just to not introduce regression on previous
chips.
Regards,
Lorenzo
>
> Regards,
> Deren
>
>