From: Ping-Ke Shih <pkshih@realtek.com>
To: <tony0620emma@gmail.com>, <kvalo@codeaurora.org>
Cc: <linux-wireless@vger.kernel.org>, <ku920601@realtek.com>,
<phhuang@realtek.com>, <shaofu@realtek.com>,
<steventing@realtek.com>, <kevin_yang@realtek.com>
Subject: [PATCH 2/7] rtw88: follow the AP basic rates for tx mgmt frame
Date: Fri, 19 Mar 2021 13:42:13 +0800 [thread overview]
Message-ID: <20210319054218.3319-3-pkshih@realtek.com> (raw)
In-Reply-To: <20210319054218.3319-1-pkshih@realtek.com>
From: Shao-Fu Cheng <shaofu@realtek.com>
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 the
basic rates.
This commit makes the driver use the lowest basic rates to send
the management frames and a debufs entry to enable/disable force to use
the lowest rate 1M/6M for 2.4G/5G bands.
obtain current setting
cat /sys/kernel/debug/ieee80211/phyX/rtw88/basic_rates
force lowest rate:
echo 1 > /sys/kernel/debug/ieee80211/phyX/rtw88/basic_rates
Signed-off-by: Shao-Fu Cheng <shaofu@realtek.com>
Signed-off-by: Yu-Yen Ting <steventing@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtw88/debug.c | 39 ++++++++++++++++++++++
drivers/net/wireless/realtek/rtw88/main.h | 1 +
drivers/net/wireless/realtek/rtw88/tx.c | 27 ++++++++++++---
3 files changed, 62 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c
index 4539b673f6fd..067ce361e4fb 100644
--- a/drivers/net/wireless/realtek/rtw88/debug.c
+++ b/drivers/net/wireless/realtek/rtw88/debug.c
@@ -853,6 +853,39 @@ static int rtw_debugfs_get_fw_crash(struct seq_file *m, void *v)
return 0;
}
+static ssize_t rtw_debugfs_set_basic_rates(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_USE_LOWEST_RATE, rtwdev->flags);
+ else
+ clear_bit(RTW_FLAG_USE_LOWEST_RATE, rtwdev->flags);
+
+ return count;
+}
+
+static int rtw_debugfs_get_basic_rates(struct seq_file *m, void *v)
+{
+ struct rtw_debugfs_priv *debugfs_priv = m->private;
+ struct rtw_dev *rtwdev = debugfs_priv->rtwdev;
+
+ seq_printf(m, "use lowest: %d\n",
+ test_bit(RTW_FLAG_USE_LOWEST_RATE, rtwdev->flags));
+
+ return 0;
+}
+
#define rtw_debug_impl_mac(page, addr) \
static struct rtw_debugfs_priv rtw_debug_priv_mac_ ##page = { \
.cb_read = rtw_debug_get_mac_page, \
@@ -961,6 +994,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_basic_rates = {
+ .cb_write = rtw_debugfs_set_basic_rates,
+ .cb_read = rtw_debugfs_get_basic_rates,
+};
+
#define rtw_debugfs_add_core(name, mode, fopname, parent) \
do { \
rtw_debug_priv_ ##name.rtwdev = rtwdev; \
@@ -1035,6 +1073,7 @@ void rtw_debugfs_init(struct rtw_dev *rtwdev)
rtw_debugfs_add_r(rf_dump);
rtw_debugfs_add_r(tx_pwr_tbl);
rtw_debugfs_add_rw(fw_crash);
+ rtw_debugfs_add_rw(basic_rates);
}
#endif /* CONFIG_RTW88_DEBUGFS */
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index d185209ee3cc..e01eb7feed4e 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -362,6 +362,7 @@ enum rtw_flags {
RTW_FLAG_BUSY_TRAFFIC,
RTW_FLAG_WOWLAN,
RTW_FLAG_RESTARTING,
+ RTW_FLAG_USE_LOWEST_RATE,
NUM_OF_RTW_FLAGS,
};
diff --git a/drivers/net/wireless/realtek/rtw88/tx.c b/drivers/net/wireless/realtek/rtw88/tx.c
index 0193708fc013..0aeed15736c8 100644
--- a/drivers/net/wireless/realtek/rtw88/tx.c
+++ b/drivers/net/wireless/realtek/rtw88/tx.c
@@ -233,17 +233,34 @@ 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;
+ bool use_lowest = test_bit(RTW_FLAG_USE_LOWEST_RATE, rtwdev->flags);
+
+ if (!vif || !vif->bss_conf.basic_rates || ignore_rate || use_lowest)
+ 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 +297,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 +421,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);
--
2.21.0
next prev parent reply other threads:[~2021-03-19 5:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-19 5:42 [PATCH 0/7] rtw88: add some fixes and 8822c features Ping-Ke Shih
2021-03-19 5:42 ` [PATCH 1/7] rtw88: add flush hci support Ping-Ke Shih
2021-04-11 9:24 ` Kalle Valo
2021-03-19 5:42 ` Ping-Ke Shih [this message]
2021-04-11 9:21 ` [PATCH 2/7] rtw88: follow the AP basic rates for tx mgmt frame Kalle Valo
2021-04-12 8:11 ` Pkshih
2021-04-12 11:46 ` Kalle Valo
2021-04-15 4:05 ` Pkshih
2021-04-22 3:27 ` Pkshih
2021-05-19 5:59 ` Pkshih
2021-03-19 5:42 ` [PATCH 3/7] rtw88: fix DIG min setting Ping-Ke Shih
2021-03-19 5:42 ` [PATCH 4/7] rtw88: 8822c: update tx power limit table to RF v40.1 Ping-Ke Shih
2021-04-11 9:25 ` Kalle Valo
2021-03-19 5:42 ` [PATCH 5/7] rtw88: 8822c: add LC calibration for RTL8822C Ping-Ke Shih
2021-04-11 9:27 ` Kalle Valo
2021-03-19 5:42 ` [PATCH 6/7] rtw88: 8822c: add CFO tracking Ping-Ke Shih
2021-04-11 9:19 ` Kalle Valo
2021-04-12 8:11 ` Pkshih
2021-04-12 11:47 ` Kalle Valo
2021-04-15 5:02 ` Pkshih
2021-03-19 5:42 ` [PATCH 7/7] rtw88: coex: fix A2DP stutters while WL busy + WL scan Ping-Ke Shih
2021-04-11 9:28 ` Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210319054218.3319-3-pkshih@realtek.com \
--to=pkshih@realtek.com \
--cc=kevin_yang@realtek.com \
--cc=ku920601@realtek.com \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=phhuang@realtek.com \
--cc=shaofu@realtek.com \
--cc=steventing@realtek.com \
--cc=tony0620emma@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).