Skip to content

Commit

Permalink
rtw88: follow the AP basic rates for tx mgmt frame
Browse files Browse the repository at this point in the history
By default the driver uses the 1M and 6M rate for managemnt frames
in 2G and 5G bands respectively. But when the basic rates is
configured from the mac80211, we need to send the management frames
according to the basic rates.

This commit makes the driver use the lowest basic rates to send
the management frames.

Signed-off-by: Yu-Yen Ting <steventing@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211102022454.10944-1-pkshih@realtek.com
  • Loading branch information
Yu-Yen Ting authored and Kalle Valo committed Nov 26, 2021
1 parent 5da7075 commit 2f1367b
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions drivers/net/wireless/realtek/rtw88/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,33 @@ void rtw_tx_report_handle(struct rtw_dev *rtwdev, struct sk_buff *skb, int src)
spin_unlock_irqrestore(&tx_report->q_lock, flags);
}

static u8 rtw_get_mgmt_rate(struct rtw_dev *rtwdev, struct sk_buff *skb,
u8 lowest_rate, bool ignore_rate)
{
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
struct ieee80211_vif *vif = tx_info->control.vif;

if (!vif || !vif->bss_conf.basic_rates || ignore_rate)
return lowest_rate;

return __ffs(vif->bss_conf.basic_rates) + lowest_rate;
}

static void rtw_tx_pkt_info_update_rate(struct rtw_dev *rtwdev,
struct rtw_tx_pkt_info *pkt_info,
struct sk_buff *skb)
struct sk_buff *skb,
bool ignore_rate)
{
if (rtwdev->hal.current_band_type == RTW_BAND_2G) {
pkt_info->rate_id = RTW_RATEID_B_20M;
pkt_info->rate = DESC_RATE1M;
pkt_info->rate = rtw_get_mgmt_rate(rtwdev, skb, DESC_RATE1M,
ignore_rate);
} else {
pkt_info->rate_id = RTW_RATEID_G;
pkt_info->rate = DESC_RATE6M;
pkt_info->rate = rtw_get_mgmt_rate(rtwdev, skb, DESC_RATE6M,
ignore_rate);
}

pkt_info->use_rate = true;
pkt_info->dis_rate_fallback = true;
}
Expand Down Expand Up @@ -280,7 +296,7 @@ static void rtw_tx_mgmt_pkt_info_update(struct rtw_dev *rtwdev,
struct ieee80211_sta *sta,
struct sk_buff *skb)
{
rtw_tx_pkt_info_update_rate(rtwdev, pkt_info, skb);
rtw_tx_pkt_info_update_rate(rtwdev, pkt_info, skb, false);
pkt_info->dis_qselseq = true;
pkt_info->en_hwseq = true;
pkt_info->hw_ssn_sel = 0;
Expand Down Expand Up @@ -404,7 +420,7 @@ void rtw_tx_rsvd_page_pkt_info_update(struct rtw_dev *rtwdev,
if (type != RSVD_BEACON && type != RSVD_DUMMY)
pkt_info->qsel = TX_DESC_QSEL_MGMT;

rtw_tx_pkt_info_update_rate(rtwdev, pkt_info, skb);
rtw_tx_pkt_info_update_rate(rtwdev, pkt_info, skb, true);

bmc = is_broadcast_ether_addr(hdr->addr1) ||
is_multicast_ether_addr(hdr->addr1);
Expand Down

0 comments on commit 2f1367b

Please sign in to comment.