Commit 272cda71 authored by Yu-Yen Ting's avatar Yu-Yen Ting Committed by Kalle Valo

rtw88: add debugfs to force lowest basic rate

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
Signed-off-by: default avatarYu-Yen Ting <steventing@realtek.com>
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211102022454.10944-2-pkshih@realtek.com
parent 2f1367b5
...@@ -904,6 +904,39 @@ static int rtw_debugfs_get_fw_crash(struct seq_file *m, void *v) ...@@ -904,6 +904,39 @@ static int rtw_debugfs_get_fw_crash(struct seq_file *m, void *v)
return 0; 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, static ssize_t rtw_debugfs_set_dm_cap(struct file *filp,
const char __user *buffer, const char __user *buffer,
size_t count, loff_t *loff) size_t count, loff_t *loff)
...@@ -1094,6 +1127,11 @@ static struct rtw_debugfs_priv rtw_debug_priv_fw_crash = { ...@@ -1094,6 +1127,11 @@ static struct rtw_debugfs_priv rtw_debug_priv_fw_crash = {
.cb_read = rtw_debugfs_get_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 = { static struct rtw_debugfs_priv rtw_debug_priv_dm_cap = {
.cb_write = rtw_debugfs_set_dm_cap, .cb_write = rtw_debugfs_set_dm_cap,
.cb_read = rtw_debugfs_get_dm_cap, .cb_read = rtw_debugfs_get_dm_cap,
...@@ -1174,6 +1212,7 @@ void rtw_debugfs_init(struct rtw_dev *rtwdev) ...@@ -1174,6 +1212,7 @@ void rtw_debugfs_init(struct rtw_dev *rtwdev)
rtw_debugfs_add_r(tx_pwr_tbl); rtw_debugfs_add_r(tx_pwr_tbl);
rtw_debugfs_add_rw(edcca_enable); rtw_debugfs_add_rw(edcca_enable);
rtw_debugfs_add_rw(fw_crash); rtw_debugfs_add_rw(fw_crash);
rtw_debugfs_add_rw(force_lowest_basic_rate);
rtw_debugfs_add_rw(dm_cap); rtw_debugfs_add_rw(dm_cap);
} }
......
...@@ -364,6 +364,7 @@ enum rtw_flags { ...@@ -364,6 +364,7 @@ enum rtw_flags {
RTW_FLAG_WOWLAN, RTW_FLAG_WOWLAN,
RTW_FLAG_RESTARTING, RTW_FLAG_RESTARTING,
RTW_FLAG_RESTART_TRIGGERING, RTW_FLAG_RESTART_TRIGGERING,
RTW_FLAG_FORCE_LOWEST_RATE,
NUM_OF_RTW_FLAGS, NUM_OF_RTW_FLAGS,
}; };
......
...@@ -238,8 +238,9 @@ static u8 rtw_get_mgmt_rate(struct rtw_dev *rtwdev, struct sk_buff *skb, ...@@ -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_tx_info *tx_info = IEEE80211_SKB_CB(skb);
struct ieee80211_vif *vif = tx_info->control.vif; 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 lowest_rate;
return __ffs(vif->bss_conf.basic_rates) + lowest_rate; return __ffs(vif->bss_conf.basic_rates) + lowest_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