rtw88: follow the AP basic rates for tx mgmt frame
Ping-Ke Shih
maintainerPATCH v3 1/2 rtw88: follow the AP basic rates for tx mgmt frame
From: Yu-Yen Ting <[email protected]>
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.
---
v3: no change
v2: move debugfs as a separated patch
v1: the original patch is "[PATCH 2/7] rtw88: follow the AP basic rates for tx mgmt frame"
--- drivers/net/wireless/realtek/rtw88/tx.c | 26 ++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtw88/tx.c +21 -5
@@ -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; }
@@ -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 ;
@@ -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);
Signature · 1 line
2.25.1
Ping-Ke Shih
maintainerPATCH v3 2/2 rtw88: add debugfs to force lowest basic rate
From: Yu-Yen Ting <[email protected]>
The management frame with high rate e.g. 24M may not be transmitted smoothly in long range environment.
Add a debugfs to force to use the lowest basic rate
in order to debug the reachability of transmitting management frame.
obtain current setting
cat /sys/kernel/debug/ieee80211/phyX/rtw88/force_lowest_basic_rate
force lowest rate:
echo 1 > /sys/kernel/debug/ieee80211/phyX/rtw88/force_lowest_basic_rate
---
v3: change the name of debugfs entry to force_lowest_basic_rate
--- drivers/net/wireless/realtek/rtw88/debug.c | 39 ++++++++++++++++++++++ drivers/net/wireless/realtek/rtw88/main.h | 1 + drivers/net/wireless/realtek/rtw88/tx.c | 3 +- 3 files changed, 42 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/debug.c +39 -0
@@ -904,6 +904,39 @@ static int rtw_debugfs_get_fw_crash(struct seq_file *m, void *v)return 0 ; } +static ssize_t rtw_debugfs_set_force_lowest_basic_rate (struct file *filp, +const char __user *buffer, +size_t count,loff_t *loff) +{ +struct seq_file *seqpriv = (struct seq_file *)filp->private_data; +struct rtw_debugfs_priv *debugfs_priv = seqpriv->private; +struct rtw_dev *rtwdev = debugfs_priv->rtwdev; +bool input; +int err; + + err =kstrtobool_from_user (buffer, count, &input); +if (err) +return err; + +if (input) +set_bit (RTW_FLAG_FORCE_LOWEST_RATE , rtwdev->flags); +else +clear_bit (RTW_FLAG_FORCE_LOWEST_RATE , rtwdev->flags); + +return count; +} + +static int rtw_debugfs_get_force_lowest_basic_rate (struct seq_file *m,void *v) +{ +struct rtw_debugfs_priv *debugfs_priv = m->private; +struct rtw_dev *rtwdev = debugfs_priv->rtwdev; + +seq_printf (m,"force lowest basic rate: %d\n" , +test_bit (RTW_FLAG_FORCE_LOWEST_RATE , rtwdev->flags)); + +return 0 ; +} +static ssize_t rtw_debugfs_set_dm_cap (struct file *filp,const char __user *buffer,size_t count,loff_t *loff)
@@ -1094,6 +1127,11 @@ static struct rtw_debugfs_priv rtw_debug_priv_fw_crash = { .cb_read = rtw_debugfs_get_fw_crash, }; +static struct rtw_debugfs_priv rtw_debug_priv_force_lowest_basic_rate = { + .cb_write = rtw_debugfs_set_force_lowest_basic_rate, + .cb_read = rtw_debugfs_get_force_lowest_basic_rate, +}; +static struct rtw_debugfs_priv rtw_debug_priv_dm_cap = { .cb_write = rtw_debugfs_set_dm_cap, .cb_read = rtw_debugfs_get_dm_cap,
@@ -1174,6 +1212,7 @@ void rtw_debugfs_init(struct rtw_dev *rtwdev)rtw_debugfs_add_r (tx_pwr_tbl);rtw_debugfs_add_rw (edcca_enable);rtw_debugfs_add_rw (fw_crash); +rtw_debugfs_add_rw (force_lowest_basic_rate);rtw_debugfs_add_rw (dm_cap); }
drivers/net/wireless/realtek/rtw88/main.h +1 -0
@@ -364,6 +364,7 @@ enum rtw_flags {RTW_FLAG_WOWLAN ,RTW_FLAG_RESTARTING ,RTW_FLAG_RESTART_TRIGGERING , +RTW_FLAG_FORCE_LOWEST_RATE , NUM_OF_RTW_FLAGS, };
drivers/net/wireless/realtek/rtw88/tx.c +2 -1
@@ -238,8 +238,9 @@ static u8 rtw_get_mgmt_rate(struct rtw_dev *rtwdev, struct sk_buff *skb, {struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (skb);struct ieee80211_vif *vif = tx_info->control.vif; +bool force_lowest =test_bit (RTW_FLAG_FORCE_LOWEST_RATE , rtwdev->flags); -if (!vif || !vif->bss_conf.basic_rates || ignore_rate) +if (!vif || !vif->bss_conf.basic_rates || ignore_rate || force_lowest)return lowest_rate;return __ffs (vif->bss_conf.basic_rates) + lowest_rate;
Signature · 1 line
2.25.1
Quoted 7 lines · Ping-Ke Shih
From: Yu-Yen Ting <[email protected]>
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.
Quoted 5 lines
This commit makes the driver use the lowest basic rates to send the management frames.
Signed-off-by Yu-Yen Ting <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>
2 patches applied to wireless-drivers-next.git, thanks.
2f1367b564c1 rtw88: follow the AP basic rates for tx mgmt frame 272cda71e857 rtw88: add debugfs to force lowest basic rate
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches