rtw89: convert rtw89_band to nl80211_band precisely
Before 6 GHz band was supported, i.e. only 2 GHz and 5 GHz, they were the same from the numerical point of view. However, after 6 GHz band support, we need to do this conversion logically. Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220516005215.5878-6-pkshih@realtek.com
This commit is contained in:
parent
aebc048d10
commit
a06d2dd7e2
|
@ -1608,10 +1608,13 @@ static void rtw89_core_update_rx_status(struct rtw89_dev *rtwdev,
|
|||
|
||||
if (rtwdev->scanning &&
|
||||
RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD, &rtwdev->fw)) {
|
||||
rx_status->freq =
|
||||
ieee80211_channel_to_frequency(hal->current_channel,
|
||||
hal->current_band_type);
|
||||
rx_status->band = rtwdev->hal.current_band_type;
|
||||
u8 chan = hal->current_channel;
|
||||
u8 band = hal->current_band_type;
|
||||
enum nl80211_band nl_band;
|
||||
|
||||
nl_band = rtw89_hw_to_nl80211_band(band);
|
||||
rx_status->freq = ieee80211_channel_to_frequency(chan, nl_band);
|
||||
rx_status->band = nl_band;
|
||||
}
|
||||
|
||||
if (desc_info->icv_err || desc_info->crc32_err)
|
||||
|
|
|
@ -3480,6 +3480,20 @@ static inline u8 rtw89_hw_to_rate_info_bw(enum rtw89_bandwidth hw_bw)
|
|||
return RATE_INFO_BW_20;
|
||||
}
|
||||
|
||||
static inline
|
||||
enum nl80211_band rtw89_hw_to_nl80211_band(enum rtw89_band hw_band)
|
||||
{
|
||||
switch (hw_band) {
|
||||
default:
|
||||
case RTW89_BAND_2G:
|
||||
return NL80211_BAND_2GHZ;
|
||||
case RTW89_BAND_5G:
|
||||
return NL80211_BAND_5GHZ;
|
||||
case RTW89_BAND_6G:
|
||||
return NL80211_BAND_6GHZ;
|
||||
}
|
||||
}
|
||||
|
||||
static inline
|
||||
enum rtw89_bandwidth nl_to_rtw89_bandwidth(enum nl80211_chan_width width)
|
||||
{
|
||||
|
|
|
@ -2068,7 +2068,7 @@ static void rtw89_release_pkt_list(struct rtw89_dev *rtwdev)
|
|||
struct rtw89_pktofld_info *info, *tmp;
|
||||
u8 idx;
|
||||
|
||||
for (idx = RTW89_BAND_2G; idx < NUM_NL80211_BANDS; idx++) {
|
||||
for (idx = NL80211_BAND_2GHZ; idx < NUM_NL80211_BANDS; idx++) {
|
||||
if (!(rtwdev->chip->support_bands & BIT(idx)))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -429,27 +429,28 @@ void rtw89_phy_rate_pattern_vif(struct rtw89_dev *rtwdev,
|
|||
RTW89_HW_RATE_MCS16,
|
||||
RTW89_HW_RATE_MCS24};
|
||||
u8 band = rtwdev->hal.current_band_type;
|
||||
enum nl80211_band nl_band = rtw89_hw_to_nl80211_band(band);
|
||||
u8 tx_nss = rtwdev->hal.tx_nss;
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < tx_nss; i++)
|
||||
if (!__check_rate_pattern(&next_pattern, hw_rate_he[i],
|
||||
RA_MASK_HE_RATES, RTW89_RA_MODE_HE,
|
||||
mask->control[band].he_mcs[i],
|
||||
mask->control[nl_band].he_mcs[i],
|
||||
0, true))
|
||||
goto out;
|
||||
|
||||
for (i = 0; i < tx_nss; i++)
|
||||
if (!__check_rate_pattern(&next_pattern, hw_rate_vht[i],
|
||||
RA_MASK_VHT_RATES, RTW89_RA_MODE_VHT,
|
||||
mask->control[band].vht_mcs[i],
|
||||
mask->control[nl_band].vht_mcs[i],
|
||||
0, true))
|
||||
goto out;
|
||||
|
||||
for (i = 0; i < tx_nss; i++)
|
||||
if (!__check_rate_pattern(&next_pattern, hw_rate_ht[i],
|
||||
RA_MASK_HT_RATES, RTW89_RA_MODE_HT,
|
||||
mask->control[band].ht_mcs[i],
|
||||
mask->control[nl_band].ht_mcs[i],
|
||||
0, true))
|
||||
goto out;
|
||||
|
||||
|
@ -457,18 +458,18 @@ void rtw89_phy_rate_pattern_vif(struct rtw89_dev *rtwdev,
|
|||
* require at least one basic rate for ieee80211_set_bitrate_mask,
|
||||
* so the decision just depends on if all bitrates are set or not.
|
||||
*/
|
||||
sband = rtwdev->hw->wiphy->bands[band];
|
||||
sband = rtwdev->hw->wiphy->bands[nl_band];
|
||||
if (band == RTW89_BAND_2G) {
|
||||
if (!__check_rate_pattern(&next_pattern, RTW89_HW_RATE_CCK1,
|
||||
RA_MASK_CCK_RATES | RA_MASK_OFDM_RATES,
|
||||
RTW89_RA_MODE_CCK | RTW89_RA_MODE_OFDM,
|
||||
mask->control[band].legacy,
|
||||
mask->control[nl_band].legacy,
|
||||
BIT(sband->n_bitrates) - 1, false))
|
||||
goto out;
|
||||
} else {
|
||||
if (!__check_rate_pattern(&next_pattern, RTW89_HW_RATE_OFDM6,
|
||||
RA_MASK_OFDM_RATES, RTW89_RA_MODE_OFDM,
|
||||
mask->control[band].legacy,
|
||||
mask->control[nl_band].legacy,
|
||||
BIT(sband->n_bitrates) - 1, false))
|
||||
goto out;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue