linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] rtl8xxxu: Use lower tx rates for the ack packet
@ 2021-10-01  4:00 Chris Chiu
  2021-10-01  5:37 ` Jes Sorensen
  2021-10-05  5:33 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Chiu @ 2021-10-01  4:00 UTC (permalink / raw)
  To: Jes.Sorensen, kvalo, davem, kuba
  Cc: code, linux-wireless, netdev, linux-kernel, Chris Chiu

According to the Realtek propritary driver and the rtw88 driver, the
tx rates of the ack (includes block ack) are initialized with lower
tx rates (no HT rates) which is set by the RRSR register value. In
real cases, ack rate higher than current tx rate could lead to
difficulty for the receiving end to receive management/control frames.
The retransmission rate would be higher then expected when the driver
is acting as receiver and the RSSI is not good.

Cross out higer rates for ack packet before implementing dynamic rrsr
configuration like the commit 4830872685f8 ("rtw88: add dynamic rrsr
configuration").

Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
---

Changelog:
  v2:
   - Specify the dynamic rrsr commit for reference
   - Remove the unintentional twice reading of REG_RESPONSE_RATE_SET

 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 6 +++++-
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 774341b0005a..a42e2081b75f 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -4460,13 +4460,17 @@ void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv)
 
 static void rtl8xxxu_set_basic_rates(struct rtl8xxxu_priv *priv, u32 rate_cfg)
 {
+	struct ieee80211_hw *hw = priv->hw;
 	u32 val32;
 	u8 rate_idx = 0;
 
 	rate_cfg &= RESPONSE_RATE_BITMAP_ALL;
 
 	val32 = rtl8xxxu_read32(priv, REG_RESPONSE_RATE_SET);
-	val32 &= ~RESPONSE_RATE_BITMAP_ALL;
+	if (hw->conf.chandef.chan->band == NL80211_BAND_5GHZ)
+		val32 &= RESPONSE_RATE_RRSR_INIT_5G;
+	else
+		val32 &= RESPONSE_RATE_RRSR_INIT_2G;
 	val32 |= rate_cfg;
 	rtl8xxxu_write32(priv, REG_RESPONSE_RATE_SET, val32);
 
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h
index a2a31f374a82..438b65ba9640 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h
@@ -516,6 +516,8 @@
 #define REG_RESPONSE_RATE_SET		0x0440
 #define  RESPONSE_RATE_BITMAP_ALL	0xfffff
 #define  RESPONSE_RATE_RRSR_CCK_ONLY_1M	0xffff1
+#define  RESPONSE_RATE_RRSR_INIT_2G	0x15f
+#define  RESPONSE_RATE_RRSR_INIT_5G	0x150
 #define  RSR_1M				BIT(0)
 #define  RSR_2M				BIT(1)
 #define  RSR_5_5M			BIT(2)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] rtl8xxxu: Use lower tx rates for the ack packet
  2021-10-01  4:00 [PATCH v2] rtl8xxxu: Use lower tx rates for the ack packet Chris Chiu
@ 2021-10-01  5:37 ` Jes Sorensen
  2021-10-05  5:33 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Jes Sorensen @ 2021-10-01  5:37 UTC (permalink / raw)
  To: Chris Chiu, kvalo, davem, kuba; +Cc: code, linux-wireless, netdev, linux-kernel

On 10/1/21 12:00 AM, Chris Chiu wrote:
> According to the Realtek propritary driver and the rtw88 driver, the
> tx rates of the ack (includes block ack) are initialized with lower
> tx rates (no HT rates) which is set by the RRSR register value. In
> real cases, ack rate higher than current tx rate could lead to
> difficulty for the receiving end to receive management/control frames.
> The retransmission rate would be higher then expected when the driver
> is acting as receiver and the RSSI is not good.
> 
> Cross out higer rates for ack packet before implementing dynamic rrsr
> configuration like the commit 4830872685f8 ("rtw88: add dynamic rrsr
> configuration").
> 
> Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
> ---
> 
> Changelog:
>   v2:
>    - Specify the dynamic rrsr commit for reference
>    - Remove the unintentional twice reading of REG_RESPONSE_RATE_SET
> 
>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 6 +++++-
>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 2 ++
>  2 files changed, 7 insertions(+), 1 deletion(-)

Acked-by: Jes Sorensen <Jes.Sorensen@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] rtl8xxxu: Use lower tx rates for the ack packet
  2021-10-01  4:00 [PATCH v2] rtl8xxxu: Use lower tx rates for the ack packet Chris Chiu
  2021-10-01  5:37 ` Jes Sorensen
@ 2021-10-05  5:33 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2021-10-05  5:33 UTC (permalink / raw)
  To: Chris Chiu
  Cc: Jes.Sorensen, davem, kuba, code, linux-wireless, netdev,
	linux-kernel, Chris Chiu

Chris Chiu <chris.chiu@canonical.com> wrote:

> According to the Realtek propritary driver and the rtw88 driver, the
> tx rates of the ack (includes block ack) are initialized with lower
> tx rates (no HT rates) which is set by the RRSR register value. In
> real cases, ack rate higher than current tx rate could lead to
> difficulty for the receiving end to receive management/control frames.
> The retransmission rate would be higher then expected when the driver
> is acting as receiver and the RSSI is not good.
> 
> Cross out higer rates for ack packet before implementing dynamic rrsr
> configuration like the commit 4830872685f8 ("rtw88: add dynamic rrsr
> configuration").
> 
> Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
> Acked-by: Jes Sorensen <Jes.Sorensen@gmail.com>

Patch applied to wireless-drivers-next.git, thanks.

7acd723c30c0 rtl8xxxu: Use lower tx rates for the ack packet

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20211001040044.1028708-1-chris.chiu@canonical.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-05  5:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01  4:00 [PATCH v2] rtl8xxxu: Use lower tx rates for the ack packet Chris Chiu
2021-10-01  5:37 ` Jes Sorensen
2021-10-05  5:33 ` Kalle Valo

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).