diff mbox series

mt76: mt7921: introduce 160 MHz channel bandwidth support

Message ID d4e93e0ffa11d7126b2ab48a34d0b4a4a17f2134.1636207928.git.deren.wu@mediatek.com (mailing list archive)
State Superseded
Delegated to: Felix Fietkau
Headers show
Series mt76: mt7921: introduce 160 MHz channel bandwidth support | expand

Commit Message

Deren Wu Nov. 6, 2021, 2:35 p.m. UTC
From: Deren Wu <deren.wu@mediatek.com>

Introduce the basic configuration for chips with BW160 capability

Signed-off-by: Deren Wu <deren.wu@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt76.h            |  1 +
 drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c |  1 +
 drivers/net/wireless/mediatek/mt76/mt7921/init.c     |  4 ++++
 drivers/net/wireless/mediatek/mt76/mt7921/main.c     | 12 ++++++++++++
 4 files changed, 18 insertions(+)

Comments

Lorenzo Bianconi Nov. 7, 2021, 10:45 a.m. UTC | #1
> From: Deren Wu <deren.wu@mediatek.com>
> 
> Introduce the basic configuration for chips with BW160 capability
> 
> Signed-off-by: Deren Wu <deren.wu@mediatek.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt76.h            |  1 +
>  drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c |  1 +
>  drivers/net/wireless/mediatek/mt76/mt7921/init.c     |  4 ++++
>  drivers/net/wireless/mediatek/mt76/mt7921/main.c     | 12 ++++++++++++
>  4 files changed, 18 insertions(+)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
> index e2da720a91b6..babca8086027 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt76.h
> @@ -346,6 +346,7 @@ struct mt76_hw_cap {
>  	bool has_2ghz;
>  	bool has_5ghz;
>  	bool has_6ghz;
> +	bool has_bw160;
>  };
>  
>  #define MT_DRV_TXWI_NO_FREE		BIT(0)
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> index 26b4b875dcc0..4da20537aaf9 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> @@ -1775,6 +1775,7 @@ static void mt76_connac_mcu_parse_phy_cap(struct mt76_dev *dev,
>  	dev->phy.chainmask = dev->phy.antenna_mask;
>  	dev->phy.cap.has_2ghz = cap->hw_path & BIT(WF0_24G);
>  	dev->phy.cap.has_5ghz = cap->hw_path & BIT(WF0_5G);
> +	dev->phy.cap.has_bw160 = (cap->max_bw >= IEEE80211_STA_RX_BW_160);

Hi Deren,

just out of my curiosity, what are the possible values of cap->max_bw here?

Regards,
Lorenzo

>  }
>  
>  int mt76_connac_mcu_get_nic_capability(struct mt76_phy *phy)
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> index 210998f086ab..30c0246fba3a 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> @@ -264,6 +264,10 @@ int mt7921_register_device(struct mt7921_dev *dev)
>  			IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
>  			IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE |
>  			(3 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT);
> +	if (dev->mt76.phy.cap.has_bw160)
> +		dev->mphy.sband_5g.sband.vht_cap.cap |=
> +			IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ |
> +			IEEE80211_VHT_CAP_SHORT_GI_160;
>  
>  	dev->mphy.hw->wiphy->available_antennas_rx = dev->mphy.chainmask;
>  	dev->mphy.hw->wiphy->available_antennas_tx = dev->mphy.chainmask;
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> index 633c6d2a57ac..af8c675f909f 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> @@ -128,11 +128,23 @@ mt7921_init_he_caps(struct mt7921_phy *phy, enum nl80211_band band,
>  				IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU |
>  				IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB |
>  				IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB;
> +
> +			if (phy->mt76->cap.has_bw160) {
> +				he_cap_elem->phy_cap_info[0] |=
> +					IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G;
> +				he_cap_elem->phy_cap_info[8] |=
> +					IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU |
> +					IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU;
> +			}
>  			break;
>  		}
>  
>  		he_mcs->rx_mcs_80 = cpu_to_le16(mcs_map);
>  		he_mcs->tx_mcs_80 = cpu_to_le16(mcs_map);
> +		if (phy->mt76->cap.has_bw160) {
> +			he_mcs->rx_mcs_160 = cpu_to_le16(mcs_map);
> +			he_mcs->tx_mcs_160 = cpu_to_le16(mcs_map);
> +		}
>  
>  		memset(he_cap->ppe_thres, 0, sizeof(he_cap->ppe_thres));
>  		if (he_cap_elem->phy_cap_info[6] &
> -- 
> 2.18.0
>
Deren Wu Nov. 8, 2021, 5:58 a.m. UTC | #2
Hi Lore,

The definition of cap->max_bw is identical to
ieee80211_sta_rx_bandwidth. For now, the value would be 
IEEE80211_STA_RX_BW_160 if the chip supports bw160.


Regards,
Deren

On Sun, 2021-11-07 at 11:45 +0100, Lorenzo Bianconi wrote:
> > From: Deren Wu <deren.wu@mediatek.com>
> > 
> > Introduce the basic configuration for chips with BW160 capability
> > 
> > Signed-off-by: Deren Wu <deren.wu@mediatek.com>
> > ---
> >  drivers/net/wireless/mediatek/mt76/mt76.h            |  1 +
> >  drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c |  1 +
> >  drivers/net/wireless/mediatek/mt76/mt7921/init.c     |  4 ++++
> >  drivers/net/wireless/mediatek/mt76/mt7921/main.c     | 12
> > ++++++++++++
> >  4 files changed, 18 insertions(+)
> > 
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h
> > b/drivers/net/wireless/mediatek/mt76/mt76.h
> > index e2da720a91b6..babca8086027 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt76.h
> > +++ b/drivers/net/wireless/mediatek/mt76/mt76.h
> > @@ -346,6 +346,7 @@ struct mt76_hw_cap {
> >  	bool has_2ghz;
> >  	bool has_5ghz;
> >  	bool has_6ghz;
> > +	bool has_bw160;
> >  };
> >  
> >  #define MT_DRV_TXWI_NO_FREE		BIT(0)
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > index 26b4b875dcc0..4da20537aaf9 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > @@ -1775,6 +1775,7 @@ static void
> > mt76_connac_mcu_parse_phy_cap(struct mt76_dev *dev,
> >  	dev->phy.chainmask = dev->phy.antenna_mask;
> >  	dev->phy.cap.has_2ghz = cap->hw_path & BIT(WF0_24G);
> >  	dev->phy.cap.has_5ghz = cap->hw_path & BIT(WF0_5G);
> > +	dev->phy.cap.has_bw160 = (cap->max_bw >=
> > IEEE80211_STA_RX_BW_160);
> 
> Hi Deren,
> 
> just out of my curiosity, what are the possible values of cap->max_bw 
> here?
> 
> Regards,
> Lorenzo
> 
> >  }
> >  
> >  int mt76_connac_mcu_get_nic_capability(struct mt76_phy *phy)
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> > b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> > index 210998f086ab..30c0246fba3a 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> > @@ -264,6 +264,10 @@ int mt7921_register_device(struct mt7921_dev
> > *dev)
> >  			IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
> >  			IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE |
> >  			(3 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT);
> > +	if (dev->mt76.phy.cap.has_bw160)
> > +		dev->mphy.sband_5g.sband.vht_cap.cap |=
> > +			IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ |
> > +			IEEE80211_VHT_CAP_SHORT_GI_160;
> >  
> >  	dev->mphy.hw->wiphy->available_antennas_rx = dev-
> > >mphy.chainmask;
> >  	dev->mphy.hw->wiphy->available_antennas_tx = dev-
> > >mphy.chainmask;
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > index 633c6d2a57ac..af8c675f909f 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > @@ -128,11 +128,23 @@ mt7921_init_he_caps(struct mt7921_phy *phy,
> > enum nl80211_band band,
> >  				IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_
> > THAN_242_TONE_RU |
> >  				IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USI
> > NG_MU_WITH_COMP_SIGB |
> >  				IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USI
> > NG_MU_WITH_NON_COMP_SIGB;
> > +
> > +			if (phy->mt76->cap.has_bw160) {
> > +				he_cap_elem->phy_cap_info[0] |=
> > +					IEEE80211_HE_PHY_CAP0_CHANNEL_W
> > IDTH_SET_160MHZ_IN_5G;
> > +				he_cap_elem->phy_cap_info[8] |=
> > +					IEEE80211_HE_PHY_CAP8_20MHZ_IN_
> > 160MHZ_HE_PPDU |
> > +					IEEE80211_HE_PHY_CAP8_80MHZ_IN_
> > 160MHZ_HE_PPDU;
> > +			}
> >  			break;
> >  		}
> >  
> >  		he_mcs->rx_mcs_80 = cpu_to_le16(mcs_map);
> >  		he_mcs->tx_mcs_80 = cpu_to_le16(mcs_map);
> > +		if (phy->mt76->cap.has_bw160) {
> > +			he_mcs->rx_mcs_160 = cpu_to_le16(mcs_map);
> > +			he_mcs->tx_mcs_160 = cpu_to_le16(mcs_map);
> > +		}
> >  
> >  		memset(he_cap->ppe_thres, 0, sizeof(he_cap-
> > >ppe_thres));
> >  		if (he_cap_elem->phy_cap_info[6] &
> > -- 
> > 2.18.0
> > 
> 
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
Lorenzo Bianconi Nov. 8, 2021, 10:10 a.m. UTC | #3
> Hi Lore,
> 
> The definition of cap->max_bw is identical to
> ieee80211_sta_rx_bandwidth. For now, the value would be 
> IEEE80211_STA_RX_BW_160 if the chip supports bw160.

ok, so why not something like:

dev->phy.cap.has_bw160 = cap->max_bw == IEEE80211_STA_RX_BW_160;

Regards,
Lorenzo

> 
> 
> Regards,
> Deren
> 
> On Sun, 2021-11-07 at 11:45 +0100, Lorenzo Bianconi wrote:
> > > From: Deren Wu <deren.wu@mediatek.com>
> > > 
> > > Introduce the basic configuration for chips with BW160 capability
> > > 
> > > Signed-off-by: Deren Wu <deren.wu@mediatek.com>
> > > ---
> > >  drivers/net/wireless/mediatek/mt76/mt76.h            |  1 +
> > >  drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c |  1 +
> > >  drivers/net/wireless/mediatek/mt76/mt7921/init.c     |  4 ++++
> > >  drivers/net/wireless/mediatek/mt76/mt7921/main.c     | 12
> > > ++++++++++++
> > >  4 files changed, 18 insertions(+)
> > > 
> > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h
> > > b/drivers/net/wireless/mediatek/mt76/mt76.h
> > > index e2da720a91b6..babca8086027 100644
> > > --- a/drivers/net/wireless/mediatek/mt76/mt76.h
> > > +++ b/drivers/net/wireless/mediatek/mt76/mt76.h
> > > @@ -346,6 +346,7 @@ struct mt76_hw_cap {
> > >  	bool has_2ghz;
> > >  	bool has_5ghz;
> > >  	bool has_6ghz;
> > > +	bool has_bw160;
> > >  };
> > >  
> > >  #define MT_DRV_TXWI_NO_FREE		BIT(0)
> > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > > b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > > index 26b4b875dcc0..4da20537aaf9 100644
> > > --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > > +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > > @@ -1775,6 +1775,7 @@ static void
> > > mt76_connac_mcu_parse_phy_cap(struct mt76_dev *dev,
> > >  	dev->phy.chainmask = dev->phy.antenna_mask;
> > >  	dev->phy.cap.has_2ghz = cap->hw_path & BIT(WF0_24G);
> > >  	dev->phy.cap.has_5ghz = cap->hw_path & BIT(WF0_5G);
> > > +	dev->phy.cap.has_bw160 = (cap->max_bw >=
> > > IEEE80211_STA_RX_BW_160);
> > 
> > Hi Deren,
> > 
> > just out of my curiosity, what are the possible values of cap->max_bw 
> > here?
> > 
> > Regards,
> > Lorenzo
> > 
> > >  }
> > >  
> > >  int mt76_connac_mcu_get_nic_capability(struct mt76_phy *phy)
> > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> > > b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> > > index 210998f086ab..30c0246fba3a 100644
> > > --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> > > +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> > > @@ -264,6 +264,10 @@ int mt7921_register_device(struct mt7921_dev
> > > *dev)
> > >  			IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
> > >  			IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE |
> > >  			(3 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT);
> > > +	if (dev->mt76.phy.cap.has_bw160)
> > > +		dev->mphy.sband_5g.sband.vht_cap.cap |=
> > > +			IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ |
> > > +			IEEE80211_VHT_CAP_SHORT_GI_160;
> > >  
> > >  	dev->mphy.hw->wiphy->available_antennas_rx = dev-
> > > >mphy.chainmask;
> > >  	dev->mphy.hw->wiphy->available_antennas_tx = dev-
> > > >mphy.chainmask;
> > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > > b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > > index 633c6d2a57ac..af8c675f909f 100644
> > > --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > > +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > > @@ -128,11 +128,23 @@ mt7921_init_he_caps(struct mt7921_phy *phy,
> > > enum nl80211_band band,
> > >  				IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_
> > > THAN_242_TONE_RU |
> > >  				IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USI
> > > NG_MU_WITH_COMP_SIGB |
> > >  				IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USI
> > > NG_MU_WITH_NON_COMP_SIGB;
> > > +
> > > +			if (phy->mt76->cap.has_bw160) {
> > > +				he_cap_elem->phy_cap_info[0] |=
> > > +					IEEE80211_HE_PHY_CAP0_CHANNEL_W
> > > IDTH_SET_160MHZ_IN_5G;
> > > +				he_cap_elem->phy_cap_info[8] |=
> > > +					IEEE80211_HE_PHY_CAP8_20MHZ_IN_
> > > 160MHZ_HE_PPDU |
> > > +					IEEE80211_HE_PHY_CAP8_80MHZ_IN_
> > > 160MHZ_HE_PPDU;
> > > +			}
> > >  			break;
> > >  		}
> > >  
> > >  		he_mcs->rx_mcs_80 = cpu_to_le16(mcs_map);
> > >  		he_mcs->tx_mcs_80 = cpu_to_le16(mcs_map);
> > > +		if (phy->mt76->cap.has_bw160) {
> > > +			he_mcs->rx_mcs_160 = cpu_to_le16(mcs_map);
> > > +			he_mcs->tx_mcs_160 = cpu_to_le16(mcs_map);
> > > +		}
> > >  
> > >  		memset(he_cap->ppe_thres, 0, sizeof(he_cap-
> > > >ppe_thres));
> > >  		if (he_cap_elem->phy_cap_info[6] &
> > > -- 
> > > 2.18.0
> > > 
> > 
> > _______________________________________________
> > Linux-mediatek mailing list
> > Linux-mediatek@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-mediatek
>
Deren Wu Nov. 8, 2021, 10:50 a.m. UTC | #4
On Mon, 2021-11-08 at 11:10 +0100, Lorenzo Bianconi wrote:
> > Hi Lore,
> > 
> > The definition of cap->max_bw is identical to
> > ieee80211_sta_rx_bandwidth. For now, the value would be 
> > IEEE80211_STA_RX_BW_160 if the chip supports bw160.
> 
> ok, so why not something like:
> 
> dev->phy.cap.has_bw160 = cap->max_bw == IEEE80211_STA_RX_BW_160;
> 
> Regards,
> Lorenzo

Hi Lore,

Sure, we should do the assignment preciesly. I will update next
version.


Regards,
Deren

> 
> > 
> > 
> > Regards,
> > Deren
> > 
> > On Sun, 2021-11-07 at 11:45 +0100, Lorenzo Bianconi wrote:
> > > > From: Deren Wu <deren.wu@mediatek.com>
> > > > 
> > > > Introduce the basic configuration for chips with BW160
> > > > capability
> > > > 
> > > > Signed-off-by: Deren Wu <deren.wu@mediatek.com>
> > > > ---
> > > >  drivers/net/wireless/mediatek/mt76/mt76.h            |  1 +
> > > >  drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c |  1 +
> > > >  drivers/net/wireless/mediatek/mt76/mt7921/init.c     |  4 ++++
> > > >  drivers/net/wireless/mediatek/mt76/mt7921/main.c     | 12
> > > > ++++++++++++
> > > >  4 files changed, 18 insertions(+)
> > > > 
> > > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h
> > > > b/drivers/net/wireless/mediatek/mt76/mt76.h
> > > > index e2da720a91b6..babca8086027 100644
> > > > --- a/drivers/net/wireless/mediatek/mt76/mt76.h
> > > > +++ b/drivers/net/wireless/mediatek/mt76/mt76.h
> > > > @@ -346,6 +346,7 @@ struct mt76_hw_cap {
> > > >  	bool has_2ghz;
> > > >  	bool has_5ghz;
> > > >  	bool has_6ghz;
> > > > +	bool has_bw160;
> > > >  };
> > > >  
> > > >  #define MT_DRV_TXWI_NO_FREE		BIT(0)
> > > > diff --git
> > > > a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > > > b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > > > index 26b4b875dcc0..4da20537aaf9 100644
> > > > --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > > > +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > > > @@ -1775,6 +1775,7 @@ static void
> > > > mt76_connac_mcu_parse_phy_cap(struct mt76_dev *dev,
> > > >  	dev->phy.chainmask = dev->phy.antenna_mask;
> > > >  	dev->phy.cap.has_2ghz = cap->hw_path & BIT(WF0_24G);
> > > >  	dev->phy.cap.has_5ghz = cap->hw_path & BIT(WF0_5G);
> > > > +	dev->phy.cap.has_bw160 = (cap->max_bw >=
> > > > IEEE80211_STA_RX_BW_160);
> > > 
> > > Hi Deren,
> > > 
> > > just out of my curiosity, what are the possible values of cap-
> > > >max_bw 
> > > here?
> > > 
> > > Regards,
> > > Lorenzo
> > > 
> > > >  }
> > > >  
> > > >  int mt76_connac_mcu_get_nic_capability(struct mt76_phy *phy)
> > > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> > > > b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> > > > index 210998f086ab..30c0246fba3a 100644
> > > > --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> > > > +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
> > > > @@ -264,6 +264,10 @@ int mt7921_register_device(struct
> > > > mt7921_dev
> > > > *dev)
> > > >  			IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE
> > > > |
> > > >  			IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE
> > > > |
> > > >  			(3 <<
> > > > IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT);
> > > > +	if (dev->mt76.phy.cap.has_bw160)
> > > > +		dev->mphy.sband_5g.sband.vht_cap.cap |=
> > > > +			IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MH
> > > > Z |
> > > > +			IEEE80211_VHT_CAP_SHORT_GI_160;
> > > >  
> > > >  	dev->mphy.hw->wiphy->available_antennas_rx = dev-
> > > > > mphy.chainmask;
> > > > 
> > > >  	dev->mphy.hw->wiphy->available_antennas_tx = dev-
> > > > > mphy.chainmask;
> > > > 
> > > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > > > b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > > > index 633c6d2a57ac..af8c675f909f 100644
> > > > --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > > > +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> > > > @@ -128,11 +128,23 @@ mt7921_init_he_caps(struct mt7921_phy
> > > > *phy,
> > > > enum nl80211_band band,
> > > >  				IEEE80211_HE_PHY_CAP9_RX_1024_Q
> > > > AM_LESS_
> > > > THAN_242_TONE_RU |
> > > >  				IEEE80211_HE_PHY_CAP9_RX_FULL_B
> > > > W_SU_USI
> > > > NG_MU_WITH_COMP_SIGB |
> > > >  				IEEE80211_HE_PHY_CAP9_RX_FULL_B
> > > > W_SU_USI
> > > > NG_MU_WITH_NON_COMP_SIGB;
> > > > +
> > > > +			if (phy->mt76->cap.has_bw160) {
> > > > +				he_cap_elem->phy_cap_info[0] |=
> > > > +					IEEE80211_HE_PHY_CAP0_C
> > > > HANNEL_W
> > > > IDTH_SET_160MHZ_IN_5G;
> > > > +				he_cap_elem->phy_cap_info[8] |=
> > > > +					IEEE80211_HE_PHY_CAP8_2
> > > > 0MHZ_IN_
> > > > 160MHZ_HE_PPDU |
> > > > +					IEEE80211_HE_PHY_CAP8_8
> > > > 0MHZ_IN_
> > > > 160MHZ_HE_PPDU;
> > > > +			}
> > > >  			break;
> > > >  		}
> > > >  
> > > >  		he_mcs->rx_mcs_80 = cpu_to_le16(mcs_map);
> > > >  		he_mcs->tx_mcs_80 = cpu_to_le16(mcs_map);
> > > > +		if (phy->mt76->cap.has_bw160) {
> > > > +			he_mcs->rx_mcs_160 =
> > > > cpu_to_le16(mcs_map);
> > > > +			he_mcs->tx_mcs_160 =
> > > > cpu_to_le16(mcs_map);
> > > > +		}
> > > >  
> > > >  		memset(he_cap->ppe_thres, 0, sizeof(he_cap-
> > > > > ppe_thres));
> > > > 
> > > >  		if (he_cap_elem->phy_cap_info[6] &
> > > > -- 
> > > > 2.18.0
> > > > 
> > > 
> > > _______________________________________________
> > > Linux-mediatek mailing list
> > > Linux-mediatek@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/linux-mediatek
> 
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index e2da720a91b6..babca8086027 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -346,6 +346,7 @@  struct mt76_hw_cap {
 	bool has_2ghz;
 	bool has_5ghz;
 	bool has_6ghz;
+	bool has_bw160;
 };
 
 #define MT_DRV_TXWI_NO_FREE		BIT(0)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index 26b4b875dcc0..4da20537aaf9 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -1775,6 +1775,7 @@  static void mt76_connac_mcu_parse_phy_cap(struct mt76_dev *dev,
 	dev->phy.chainmask = dev->phy.antenna_mask;
 	dev->phy.cap.has_2ghz = cap->hw_path & BIT(WF0_24G);
 	dev->phy.cap.has_5ghz = cap->hw_path & BIT(WF0_5G);
+	dev->phy.cap.has_bw160 = (cap->max_bw >= IEEE80211_STA_RX_BW_160);
 }
 
 int mt76_connac_mcu_get_nic_capability(struct mt76_phy *phy)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
index 210998f086ab..30c0246fba3a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c
@@ -264,6 +264,10 @@  int mt7921_register_device(struct mt7921_dev *dev)
 			IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
 			IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE |
 			(3 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT);
+	if (dev->mt76.phy.cap.has_bw160)
+		dev->mphy.sband_5g.sband.vht_cap.cap |=
+			IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ |
+			IEEE80211_VHT_CAP_SHORT_GI_160;
 
 	dev->mphy.hw->wiphy->available_antennas_rx = dev->mphy.chainmask;
 	dev->mphy.hw->wiphy->available_antennas_tx = dev->mphy.chainmask;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
index 633c6d2a57ac..af8c675f909f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
@@ -128,11 +128,23 @@  mt7921_init_he_caps(struct mt7921_phy *phy, enum nl80211_band band,
 				IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU |
 				IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB |
 				IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB;
+
+			if (phy->mt76->cap.has_bw160) {
+				he_cap_elem->phy_cap_info[0] |=
+					IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G;
+				he_cap_elem->phy_cap_info[8] |=
+					IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU |
+					IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU;
+			}
 			break;
 		}
 
 		he_mcs->rx_mcs_80 = cpu_to_le16(mcs_map);
 		he_mcs->tx_mcs_80 = cpu_to_le16(mcs_map);
+		if (phy->mt76->cap.has_bw160) {
+			he_mcs->rx_mcs_160 = cpu_to_le16(mcs_map);
+			he_mcs->tx_mcs_160 = cpu_to_le16(mcs_map);
+		}
 
 		memset(he_cap->ppe_thres, 0, sizeof(he_cap->ppe_thres));
 		if (he_cap_elem->phy_cap_info[6] &