Commit 167044af authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

rtw89: handle TX/RX 160M bandwidth

Apply 160M bandwidth to RA (rate adaptive) mechanism, so it can transmit
packets with this bandwidth. On the other hand, convert 160M bandwidth
from RX desc to rx_info_bw.
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220211075953.40421-7-pkshih@realtek.com
parent d221270a
...@@ -1165,13 +1165,7 @@ static bool rtw89_core_rx_ppdu_match(struct rtw89_dev *rtwdev, ...@@ -1165,13 +1165,7 @@ static bool rtw89_core_rx_ppdu_match(struct rtw89_dev *rtwdev,
rtw89_warn(rtwdev, "invalid RX rate mode %d\n", data_rate_mode); rtw89_warn(rtwdev, "invalid RX rate mode %d\n", data_rate_mode);
} }
if (desc_info->bw == RTW89_CHANNEL_WIDTH_80) bw = rtw89_hw_to_rate_info_bw(desc_info->bw);
bw = RATE_INFO_BW_80;
else if (desc_info->bw == RTW89_CHANNEL_WIDTH_40)
bw = RATE_INFO_BW_40;
else
bw = RATE_INFO_BW_20;
gi_ltf = rtw89_rxdesc_to_nl_he_gi(rtwdev, desc_info, false); gi_ltf = rtw89_rxdesc_to_nl_he_gi(rtwdev, desc_info, false);
ret = rtwdev->ppdu_sts.curr_rx_ppdu_cnt[band] == desc_info->ppdu_cnt && ret = rtwdev->ppdu_sts.curr_rx_ppdu_cnt[band] == desc_info->ppdu_cnt &&
status->rate_idx == rate_idx && status->rate_idx == rate_idx &&
...@@ -1442,12 +1436,7 @@ static void rtw89_core_update_rx_status(struct rtw89_dev *rtwdev, ...@@ -1442,12 +1436,7 @@ static void rtw89_core_update_rx_status(struct rtw89_dev *rtwdev,
!(desc_info->sw_dec || desc_info->icv_err)) !(desc_info->sw_dec || desc_info->icv_err))
rx_status->flag |= RX_FLAG_DECRYPTED; rx_status->flag |= RX_FLAG_DECRYPTED;
if (desc_info->bw == RTW89_CHANNEL_WIDTH_80) rx_status->bw = rtw89_hw_to_rate_info_bw(desc_info->bw);
rx_status->bw = RATE_INFO_BW_80;
else if (desc_info->bw == RTW89_CHANNEL_WIDTH_40)
rx_status->bw = RATE_INFO_BW_40;
else
rx_status->bw = RATE_INFO_BW_20;
data_rate = desc_info->data_rate; data_rate = desc_info->data_rate;
data_rate_mode = GET_DATA_RATE_MODE(data_rate); data_rate_mode = GET_DATA_RATE_MODE(data_rate);
......
...@@ -3160,6 +3160,18 @@ static inline struct rtw89_sta *sta_to_rtwsta_safe(struct ieee80211_sta *sta) ...@@ -3160,6 +3160,18 @@ static inline struct rtw89_sta *sta_to_rtwsta_safe(struct ieee80211_sta *sta)
return sta ? (struct rtw89_sta *)sta->drv_priv : NULL; return sta ? (struct rtw89_sta *)sta->drv_priv : NULL;
} }
static inline u8 rtw89_hw_to_rate_info_bw(enum rtw89_bandwidth hw_bw)
{
if (hw_bw == RTW89_CHANNEL_WIDTH_160)
return RATE_INFO_BW_160;
else if (hw_bw == RTW89_CHANNEL_WIDTH_80)
return RATE_INFO_BW_80;
else if (hw_bw == RTW89_CHANNEL_WIDTH_40)
return RATE_INFO_BW_40;
else
return RATE_INFO_BW_20;
}
static inline static inline
struct rtw89_addr_cam_entry *rtw89_get_addr_cam_of(struct rtw89_vif *rtwvif, struct rtw89_addr_cam_entry *rtw89_get_addr_cam_of(struct rtw89_vif *rtwvif,
struct rtw89_sta *rtwsta) struct rtw89_sta *rtwsta)
......
...@@ -302,6 +302,11 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev, ...@@ -302,6 +302,11 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev,
ra_mask &= rtw89_phy_ra_mask_cfg(rtwdev, rtwsta); ra_mask &= rtw89_phy_ra_mask_cfg(rtwdev, rtwsta);
switch (sta->bandwidth) { switch (sta->bandwidth) {
case IEEE80211_STA_RX_BW_160:
bw_mode = RTW89_CHANNEL_WIDTH_160;
sgi = sta->vht_cap.vht_supported &&
(sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_160);
break;
case IEEE80211_STA_RX_BW_80: case IEEE80211_STA_RX_BW_80:
bw_mode = RTW89_CHANNEL_WIDTH_80; bw_mode = RTW89_CHANNEL_WIDTH_80;
sgi = sta->vht_cap.vht_supported && sgi = sta->vht_cap.vht_supported &&
...@@ -1439,13 +1444,7 @@ static void rtw89_phy_c2h_ra_rpt_iter(void *data, struct ieee80211_sta *sta) ...@@ -1439,13 +1444,7 @@ static void rtw89_phy_c2h_ra_rpt_iter(void *data, struct ieee80211_sta *sta)
break; break;
} }
if (bw == RTW89_CHANNEL_WIDTH_80) ra_report->txrate.bw = rtw89_hw_to_rate_info_bw(bw);
ra_report->txrate.bw = RATE_INFO_BW_80;
else if (bw == RTW89_CHANNEL_WIDTH_40)
ra_report->txrate.bw = RATE_INFO_BW_40;
else
ra_report->txrate.bw = RATE_INFO_BW_20;
ra_report->bit_rate = cfg80211_calculate_bitrate(&ra_report->txrate); ra_report->bit_rate = cfg80211_calculate_bitrate(&ra_report->txrate);
ra_report->hw_rate = FIELD_PREP(RTW89_HW_RATE_MASK_MOD, mode) | ra_report->hw_rate = FIELD_PREP(RTW89_HW_RATE_MASK_MOD, mode) |
FIELD_PREP(RTW89_HW_RATE_MASK_VAL, rate); FIELD_PREP(RTW89_HW_RATE_MASK_VAL, rate);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment