From: Reto Schneider <code@reto-schneider.ch>
To: Jes.Sorensen@gmail.com, linux-wireless@vger.kernel.org,
pkshih@realtek.com
Cc: yhchuang@realtek.com, Larry.Finger@lwfinger.net,
tehuang@realtek.com, reto.schneider@husqvarnagroup.com,
ccchiu77@gmail.com, kvalo@codeaurora.org, davem@davemloft.net,
kuba@kernel.org, Chris Chiu <chiu@endlessos.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH 7/7] rtl8xxxu: Fix ampdu_action to get block ack session work
Date: Fri, 14 May 2021 04:04:42 +0200 [thread overview]
Message-ID: <20210514020442.946-8-code@reto-schneider.ch> (raw)
In-Reply-To: <20210514020442.946-1-code@reto-schneider.ch>
From: Chris Chiu <chiu@endlessos.org>
The HAS_RATE_CONTROL hw capability needs to be unset for the mac80211
rate control to work. The mac80211 rate control will be in charge
of the TX aggregation related work so the AMPDU TX part in each
driver should be modified accordingly.
Signed-off-by: Chris Chiu <chiu@endlessos.org>
(cherry picked from commit c470f7aed67f223d941e3da6e9d2a464dd0083ee)
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
---
.../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 +
.../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 35 ++++++++++++-------
2 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
index 3d16d6c9ff39..65620ecf9ac2 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
@@ -1384,6 +1384,7 @@ struct rtl8xxxu_priv {
u8 no_pape:1;
u8 int_buf[USB_INTR_CONTENT_LENGTH];
u8 rssi_level;
+ u8 agg_state_bitmap;
/*
* Only one virtual interface permitted because only STA mode
* is supported and no iface_combinations are provided.
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 088e007e8bd0..7ce27d1bb27a 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -5030,6 +5030,8 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info);
struct rtl8xxxu_priv *priv = hw->priv;
struct device *dev = &priv->udev->dev;
+ u8 *qc = ieee80211_get_qos_ctl(hdr);
+ u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
u32 rate;
u16 rate_flags = tx_info->control.rates[0].flags;
u16 seq_number;
@@ -5053,10 +5055,12 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
tx_desc->txdw3 = cpu_to_le32((u32)seq_number << TXDESC32_SEQ_SHIFT);
- if (ampdu_enable)
+ if (ampdu_enable && (priv->agg_state_bitmap & BIT(tid)) &&
+ (tx_info->flags & IEEE80211_TX_CTL_AMPDU)) {
tx_desc->txdw1 |= cpu_to_le32(TXDESC32_AGG_ENABLE);
- else
+ } else {
tx_desc->txdw1 |= cpu_to_le32(TXDESC32_AGG_BREAK);
+ }
if (ieee80211_is_mgmt(hdr->frame_control)) {
tx_desc->txdw5 = cpu_to_le32(rate);
@@ -5101,6 +5105,8 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
struct rtl8xxxu_priv *priv = hw->priv;
struct device *dev = &priv->udev->dev;
struct rtl8xxxu_txdesc40 *tx_desc40;
+ u8 *qc = ieee80211_get_qos_ctl(hdr);
+ u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
u32 rate;
u16 rate_flags = tx_info->control.rates[0].flags;
u16 seq_number;
@@ -5127,10 +5133,13 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
tx_desc40->txdw9 = cpu_to_le32((u32)seq_number << TXDESC40_SEQ_SHIFT);
- if (ampdu_enable)
+ if (ampdu_enable && (priv->agg_state_bitmap & BIT(tid)) &&
+ (tx_info->flags & IEEE80211_TX_CTL_AMPDU)) {
tx_desc40->txdw2 |= cpu_to_le32(TXDESC40_AGG_ENABLE);
- else
+ tx_desc40->txdw3 |= cpu_to_le32(0x1f << 17);
+ } else {
tx_desc40->txdw2 |= cpu_to_le32(TXDESC40_AGG_BREAK);
+ }
if (ieee80211_is_mgmt(hdr->frame_control)) {
tx_desc40->txdw4 = cpu_to_le32(rate);
@@ -6299,6 +6308,7 @@ rtl8xxxu_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct device *dev = &priv->udev->dev;
u8 ampdu_factor, ampdu_density;
struct ieee80211_sta *sta = params->sta;
+ u16 tid = params->tid;
enum ieee80211_ampdu_mlme_action action = params->action;
switch (action) {
@@ -6311,17 +6321,19 @@ rtl8xxxu_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
dev_dbg(dev,
"Changed HT: ampdu_factor %02x, ampdu_density %02x\n",
ampdu_factor, ampdu_density);
- break;
+ return IEEE80211_AMPDU_TX_START_IMMEDIATE;
+ case IEEE80211_AMPDU_TX_STOP_CONT:
case IEEE80211_AMPDU_TX_STOP_FLUSH:
- dev_dbg(dev, "%s: IEEE80211_AMPDU_TX_STOP_FLUSH\n", __func__);
- rtl8xxxu_set_ampdu_factor(priv, 0);
- rtl8xxxu_set_ampdu_min_space(priv, 0);
- break;
case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
- dev_dbg(dev, "%s: IEEE80211_AMPDU_TX_STOP_FLUSH_CONT\n",
- __func__);
+ dev_dbg(dev, "%s: IEEE80211_AMPDU_TX_STOP\n", __func__);
rtl8xxxu_set_ampdu_factor(priv, 0);
rtl8xxxu_set_ampdu_min_space(priv, 0);
+ priv->agg_state_bitmap &= ~BIT(tid);
+ ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
+ break;
+ case IEEE80211_AMPDU_TX_OPERATIONAL:
+ dev_dbg(dev, "%s: IEEE80211_AMPDU_TX_OPERATIONAL\n", __func__);
+ priv->agg_state_bitmap |= BIT(tid);
break;
case IEEE80211_AMPDU_RX_START:
dev_dbg(dev, "%s: IEEE80211_AMPDU_RX_START\n", __func__);
@@ -6893,7 +6905,6 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
/*
* The firmware handles rate control
*/
- ieee80211_hw_set(hw, HAS_RATE_CONTROL);
ieee80211_hw_set(hw, AMPDU_AGGREGATION);
wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
--
2.29.2
prev parent reply other threads:[~2021-05-14 2:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <a31d9500-73a3-f890-bebd-d0a4014f87da@reto-schneider.ch>
2021-05-14 2:04 ` [PATCH 0/7] [RFC] rtl8xxxu/RTL8188CUS: Wi-Fi Alliance Certification Reto Schneider
2021-05-14 2:04 ` [PATCH 1/7] rtl8xxxu: add code to handle BSS_CHANGED_TXPOWER/IEEE80211_CONF_CHANGE_POWER Reto Schneider
2021-05-14 4:09 ` Joe Perches
2021-05-14 2:04 ` [PATCH 2/7] rtl8xxxu: add handle for mac80211 get_txpower Reto Schneider
2021-05-14 4:22 ` Joe Perches
2021-05-14 2:04 ` [PATCH 3/7] rtl8xxxu: Enable RX STBC by default Reto Schneider
2021-05-14 2:04 ` [PATCH 4/7] rtl8xxxu: feed antenna information for mac80211 Reto Schneider
2021-05-14 2:04 ` [PATCH 5/7] rtl8xxxu: fill up txrate info for all chips Reto Schneider
2021-05-14 2:04 ` [PATCH 6/7] rtl8xxxu: Fix the reported rx signal strength Reto Schneider
2021-05-14 2:04 ` Reto Schneider [this message]
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=20210514020442.946-8-code@reto-schneider.ch \
--to=code@reto-schneider.ch \
--cc=Jes.Sorensen@gmail.com \
--cc=Larry.Finger@lwfinger.net \
--cc=ccchiu77@gmail.com \
--cc=chiu@endlessos.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pkshih@realtek.com \
--cc=reto.schneider@husqvarnagroup.com \
--cc=tehuang@realtek.com \
--cc=yhchuang@realtek.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