diff mbox series

[01/11] rtw88: fix rate mask for 1SS chip

Message ID 20191220092156.13443-2-yhchuang@realtek.com (mailing list archive)
State Accepted
Commit 35a68fa5f96a80797e11b6952a47c5a84939a7bf
Delegated to: Kalle Valo
Headers show
Series rtw88: some driver fixes | expand

Commit Message

Tony Chuang Dec. 20, 2019, 9:21 a.m. UTC
From: Ping-Ke Shih <pkshih@realtek.com>

The rate mask is used to tell firmware the supported rate depends on
negotiation. We loop 2 times for all VHT/HT 2SS rate mask first, and then
only keep the part according to chip's NSS.

This commit fixes the logic error of '&' operations for VHT/HT rate, and
we should run this logic before adding legacy rate.

To access HT MCS map, index 0/1 represent MCS 0-7/8-15 respectively. Use
NL80211_BAND_xxx is incorrect, so fix it as well.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/main.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Comments

Chris Chiu Dec. 24, 2019, 7:10 a.m. UTC | #1
On Fri, Dec 20, 2019 at 5:22 PM <yhchuang@realtek.com> wrote:
>
> From: Ping-Ke Shih <pkshih@realtek.com>
>
> The rate mask is used to tell firmware the supported rate depends on
> negotiation. We loop 2 times for all VHT/HT 2SS rate mask first, and then
> only keep the part according to chip's NSS.
>
> This commit fixes the logic error of '&' operations for VHT/HT rate, and
> we should run this logic before adding legacy rate.
>
> To access HT MCS map, index 0/1 represent MCS 0-7/8-15 respectively. Use
> NL80211_BAND_xxx is incorrect, so fix it as well.
>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
> ---
Reviewed-by: Chris Chiu <chiu@endlessm.com>

>  drivers/net/wireless/realtek/rtw88/main.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
> index ae61415e1665..f369ddca953a 100644
> --- a/drivers/net/wireless/realtek/rtw88/main.c
> +++ b/drivers/net/wireless/realtek/rtw88/main.c
> @@ -706,8 +706,8 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si)
>                 if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
>                         is_support_sgi = true;
>         } else if (sta->ht_cap.ht_supported) {
> -               ra_mask |= (sta->ht_cap.mcs.rx_mask[NL80211_BAND_5GHZ] << 20) |
> -                          (sta->ht_cap.mcs.rx_mask[NL80211_BAND_2GHZ] << 12);
> +               ra_mask |= (sta->ht_cap.mcs.rx_mask[1] << 20) |
> +                          (sta->ht_cap.mcs.rx_mask[0] << 12);
>                 if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
>                         stbc_en = HT_STBC_EN;
>                 if (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING)
> @@ -717,6 +717,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si)
>                         is_support_sgi = true;
>         }
>
> +       if (efuse->hw_cap.nss == 1)
> +               ra_mask &= RA_MASK_VHT_RATES_1SS | RA_MASK_HT_RATES_1SS;
> +
>         if (hal->current_band_type == RTW_BAND_5G) {
>                 ra_mask |= (u64)sta->supp_rates[NL80211_BAND_5GHZ] << 4;
>                 if (sta->vht_cap.vht_supported) {
> @@ -750,11 +753,6 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si)
>                 wireless_set = 0;
>         }
>
> -       if (efuse->hw_cap.nss == 1) {
> -               ra_mask &= RA_MASK_VHT_RATES_1SS;
> -               ra_mask &= RA_MASK_HT_RATES_1SS;
> -       }
> -
>         switch (sta->bandwidth) {
>         case IEEE80211_STA_RX_BW_80:
>                 bw_mode = RTW_CHANNEL_WIDTH_80;
> --
> 2.17.1
>
Kalle Valo Jan. 26, 2020, 3:38 p.m. UTC | #2
<yhchuang@realtek.com> wrote:

> From: Ping-Ke Shih <pkshih@realtek.com>
> 
> The rate mask is used to tell firmware the supported rate depends on
> negotiation. We loop 2 times for all VHT/HT 2SS rate mask first, and then
> only keep the part according to chip's NSS.
> 
> This commit fixes the logic error of '&' operations for VHT/HT rate, and
> we should run this logic before adding legacy rate.
> 
> To access HT MCS map, index 0/1 represent MCS 0-7/8-15 respectively. Use
> NL80211_BAND_xxx is incorrect, so fix it as well.
> 
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
> Reviewed-by: Chris Chiu <chiu@endlessm.com>

9 patches applied to wireless-drivers-next.git, thanks.

35a68fa5f96a rtw88: fix rate mask for 1SS chip
73a2d0b83424 rtw88: fix TX secondary channel offset of 40M if current bw is 20M or 40M
e339b6493524 rtw88: 8822c: update power sequence to v15
3f43f10bd619 rtw88: remove unused spinlock
962562cde154 rtw88: remove unused variable 'in_lps'
65ae64d37575 rtw88: remove unused vif pointer in struct rtw_vif
fc83c616d4d9 rtw88: use rtw_hci_stop() instead of rtwdev->hci.ops->stop()
f48abf064ade rtw88: assign NULL to skb after being kfree()'ed
bbdd1d854e0a rtw88: change max_num_of_tx_queue() definition to inline in pci.h
Kalle Valo Jan. 26, 2020, 3:39 p.m. UTC | #3
Kalle Valo <kvalo@codeaurora.org> writes:

> <yhchuang@realtek.com> wrote:
>
>> From: Ping-Ke Shih <pkshih@realtek.com>
>> 
>> The rate mask is used to tell firmware the supported rate depends on
>> negotiation. We loop 2 times for all VHT/HT 2SS rate mask first, and then
>> only keep the part according to chip's NSS.
>> 
>> This commit fixes the logic error of '&' operations for VHT/HT rate, and
>> we should run this logic before adding legacy rate.
>> 
>> To access HT MCS map, index 0/1 represent MCS 0-7/8-15 respectively. Use
>> NL80211_BAND_xxx is incorrect, so fix it as well.
>> 
>> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
>> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
>> Reviewed-by: Chris Chiu <chiu@endlessm.com>
>
> 9 patches applied to wireless-drivers-next.git, thanks.
>
> 35a68fa5f96a rtw88: fix rate mask for 1SS chip
> 73a2d0b83424 rtw88: fix TX secondary channel offset of 40M if current bw is 20M or 40M
> e339b6493524 rtw88: 8822c: update power sequence to v15
> 3f43f10bd619 rtw88: remove unused spinlock
> 962562cde154 rtw88: remove unused variable 'in_lps'
> 65ae64d37575 rtw88: remove unused vif pointer in struct rtw_vif
> fc83c616d4d9 rtw88: use rtw_hci_stop() instead of rtwdev->hci.ops->stop()
> f48abf064ade rtw88: assign NULL to skb after being kfree()'ed
> bbdd1d854e0a rtw88: change max_num_of_tx_queue() definition to inline in pci.h

I dropped patches 3 and 5 as they had comments.
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index ae61415e1665..f369ddca953a 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -706,8 +706,8 @@  void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si)
 		if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
 			is_support_sgi = true;
 	} else if (sta->ht_cap.ht_supported) {
-		ra_mask |= (sta->ht_cap.mcs.rx_mask[NL80211_BAND_5GHZ] << 20) |
-			   (sta->ht_cap.mcs.rx_mask[NL80211_BAND_2GHZ] << 12);
+		ra_mask |= (sta->ht_cap.mcs.rx_mask[1] << 20) |
+			   (sta->ht_cap.mcs.rx_mask[0] << 12);
 		if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
 			stbc_en = HT_STBC_EN;
 		if (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING)
@@ -717,6 +717,9 @@  void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si)
 			is_support_sgi = true;
 	}
 
+	if (efuse->hw_cap.nss == 1)
+		ra_mask &= RA_MASK_VHT_RATES_1SS | RA_MASK_HT_RATES_1SS;
+
 	if (hal->current_band_type == RTW_BAND_5G) {
 		ra_mask |= (u64)sta->supp_rates[NL80211_BAND_5GHZ] << 4;
 		if (sta->vht_cap.vht_supported) {
@@ -750,11 +753,6 @@  void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si)
 		wireless_set = 0;
 	}
 
-	if (efuse->hw_cap.nss == 1) {
-		ra_mask &= RA_MASK_VHT_RATES_1SS;
-		ra_mask &= RA_MASK_HT_RATES_1SS;
-	}
-
 	switch (sta->bandwidth) {
 	case IEEE80211_STA_RX_BW_80:
 		bw_mode = RTW_CHANNEL_WIDTH_80;