From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Chris Chiu <chris.chiu@canonical.com>,
Kalle Valo <kvalo@codeaurora.org>,
Sasha Levin <sashal@kernel.org>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.13 163/219] rtl8xxxu: Fix the handling of TX A-MPDU aggregation
Date: Thu, 9 Sep 2021 07:45:39 -0400 [thread overview]
Message-ID: <20210909114635.143983-163-sashal@kernel.org> (raw)
In-Reply-To: <20210909114635.143983-1-sashal@kernel.org>
From: Chris Chiu <chris.chiu@canonical.com>
[ Upstream commit 95a581ab3592082c60a08090aabe09ac7d0bd650 ]
The TX A-MPDU aggregation is not handled in the driver since the
ieee80211_start_tx_ba_session has never been started properly.
Start and stop the TX BA session by tracking the TX aggregation
status of each TID. Fix the ampdu_action and the tx descriptor
accordingly with the given TID.
Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210804151325.86600-1-chris.chiu@canonical.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 ++
.../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 33 ++++++++++++++-----
2 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
index 01735776345a..7ddce3c3f0c4 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
@@ -1378,6 +1378,8 @@ struct rtl8xxxu_priv {
u8 no_pape:1;
u8 int_buf[USB_INTR_CONTENT_LENGTH];
u8 rssi_level;
+ DECLARE_BITMAP(tx_aggr_started, IEEE80211_NUM_TIDS);
+ DECLARE_BITMAP(tid_tx_operational, IEEE80211_NUM_TIDS);
/*
* 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 9ff09cf7eb62..ce8e2438f86b 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -4805,6 +4805,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;
@@ -4828,7 +4830,7 @@ 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 && test_bit(tid, priv->tid_tx_operational))
tx_desc->txdw1 |= cpu_to_le32(TXDESC32_AGG_ENABLE);
else
tx_desc->txdw1 |= cpu_to_le32(TXDESC32_AGG_BREAK);
@@ -4876,6 +4878,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;
@@ -4902,7 +4906,7 @@ 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 && test_bit(tid, priv->tid_tx_operational))
tx_desc40->txdw2 |= cpu_to_le32(TXDESC40_AGG_ENABLE);
else
tx_desc40->txdw2 |= cpu_to_le32(TXDESC40_AGG_BREAK);
@@ -5015,12 +5019,19 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw,
if (ieee80211_is_data_qos(hdr->frame_control) && sta) {
if (sta->ht_cap.ht_supported) {
u32 ampdu, val32;
+ u8 *qc = ieee80211_get_qos_ctl(hdr);
+ u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
ampdu = (u32)sta->ht_cap.ampdu_density;
val32 = ampdu << TXDESC_AMPDU_DENSITY_SHIFT;
tx_desc->txdw2 |= cpu_to_le32(val32);
ampdu_enable = true;
+
+ if (!test_bit(tid, priv->tx_aggr_started) &&
+ !(skb->protocol == cpu_to_be16(ETH_P_PAE)))
+ if (!ieee80211_start_tx_ba_session(sta, tid, 0))
+ set_bit(tid, priv->tx_aggr_started);
}
}
@@ -6089,6 +6100,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) {
@@ -6101,17 +6113,20 @@ 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);
+ clear_bit(tid, priv->tx_aggr_started);
+ clear_bit(tid, priv->tid_tx_operational);
+ 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__);
+ set_bit(tid, priv->tid_tx_operational);
break;
case IEEE80211_AMPDU_RX_START:
dev_dbg(dev, "%s: IEEE80211_AMPDU_RX_START\n", __func__);
--
2.30.2
next prev parent reply other threads:[~2021-09-09 12:21 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210909114635.143983-1-sashal@kernel.org>
2021-09-09 11:43 ` [PATCH AUTOSEL 5.13 011/219] libbpf: Fix reuse of pinned map on older kernel Sasha Levin
2021-09-09 11:43 ` [PATCH AUTOSEL 5.13 016/219] tipc: keep the skb in rcv queue until the whole data is read Sasha Levin
2021-09-09 11:43 ` [PATCH AUTOSEL 5.13 017/219] net: phy: Fix data type in DP83822 dp8382x_disable_wol() Sasha Levin
2021-09-09 11:43 ` [PATCH AUTOSEL 5.13 019/219] iavf: do not override the adapter state in the watchdog task Sasha Levin
2021-09-09 11:43 ` [PATCH AUTOSEL 5.13 020/219] iavf: fix locking of critical sections Sasha Levin
2021-09-09 11:43 ` [PATCH AUTOSEL 5.13 024/219] netlink: Deal with ESRCH error in nlmsg_notify() Sasha Levin
2021-09-09 11:43 ` [PATCH AUTOSEL 5.13 025/219] net: ipa: fix IPA v4.11 interconnect data Sasha Levin
2021-09-09 11:43 ` [PATCH AUTOSEL 5.13 031/219] igc: Check if num of q_vectors is smaller than max before array access Sasha Levin
2021-09-09 11:43 ` [PATCH AUTOSEL 5.13 049/219] nfp: fix return statement in nfp_net_parse_meta() Sasha Levin
2021-09-09 11:43 ` [PATCH AUTOSEL 5.13 052/219] ethtool: improve compat ioctl handling Sasha Levin
2021-09-09 11:43 ` [PATCH AUTOSEL 5.13 055/219] bpf/tests: Fix copy-and-paste error in double word test Sasha Levin
2021-09-09 11:43 ` [PATCH AUTOSEL 5.13 056/219] bpf/tests: Do not PASS tests without actually testing the result Sasha Levin
2021-09-09 11:43 ` [PATCH AUTOSEL 5.13 062/219] net: ipa: fix ipa_cmd_table_valid() Sasha Levin
2021-09-09 11:43 ` [PATCH AUTOSEL 5.13 063/219] ipv4: ip_output.c: Fix out-of-bounds warning in ip_copy_addrs() Sasha Levin
2021-09-09 11:44 ` [PATCH AUTOSEL 5.13 064/219] flow_dissector: Fix out-of-bounds warnings Sasha Levin
2021-09-09 11:44 ` [PATCH AUTOSEL 5.13 072/219] samples: bpf: Fix tracex7 error raised on the missing argument Sasha Levin
2021-09-09 11:44 ` [PATCH AUTOSEL 5.13 073/219] libbpf: Fix race when pinning maps in parallel Sasha Levin
2021-09-09 11:44 ` [PATCH AUTOSEL 5.13 077/219] Bluetooth: skip invalid hci_sync_conn_complete_evt Sasha Levin
2021-09-09 11:44 ` [PATCH AUTOSEL 5.13 082/219] netfilter: nft_compat: use nfnetlink_unicast() Sasha Levin
2021-09-09 11:44 ` [PATCH AUTOSEL 5.13 083/219] bonding: 3ad: fix the concurrency between __bond_release_one() and bond_3ad_state_machine_handler() Sasha Levin
2021-09-09 11:44 ` [PATCH AUTOSEL 5.13 087/219] bpf: Fix off-by-one in tail call count limiting Sasha Levin
2021-09-09 11:44 ` [PATCH AUTOSEL 5.13 089/219] Bluetooth: Fix not generating RPA when required Sasha Levin
2021-09-09 11:44 ` [PATCH AUTOSEL 5.13 090/219] dpaa2-switch: do not enable the DPSW at probe time Sasha Levin
2021-09-09 11:44 ` [PATCH AUTOSEL 5.13 100/219] net: ipa: fix IPA v4.9 interconnects Sasha Levin
2021-09-09 11:44 ` [PATCH AUTOSEL 5.13 111/219] net: ethernet: stmmac: Do not use unreachable() in ipq806x_gmac_probe() Sasha Levin
2021-09-09 11:44 ` [PATCH AUTOSEL 5.13 120/219] selftests/bpf: Fix xdp_tx.c prog section name Sasha Levin
2021-09-09 11:44 ` [PATCH AUTOSEL 5.13 123/219] Bluetooth: schedule SCO timeouts with delayed_work Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 124/219] Bluetooth: avoid circular locks in sco_sock_connect Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 128/219] net/mlx5: Fix variable type to match 64bit Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 131/219] mac80211: Fix monitor MTU limit so that A-MSDUs get through Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 142/219] Bluetooth: Fix handling of LE Enhanced Connection Complete Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 146/219] tcp: enable data-less, empty-cookie SYN with TFO_SERVER_COOKIE_NOT_REQD Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 148/219] rpc: fix gss_svc_init cleanup on failure Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 149/219] iavf: use mutexes for locking of critical sections Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 150/219] selftests/bpf: Correctly display subtest skip status Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 151/219] selftests/bpf: Fix flaky send_signal test Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 154/219] selftests: nci: Fix the code for next nlattr offset Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 155/219] selftests: nci: Fix the wrong condition Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 156/219] net: Fix offloading indirect devices dependency on qdisc order creation Sasha Levin
2021-09-09 11:45 ` Sasha Levin [this message]
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 164/219] rtw88: use read_poll_timeout instead of fixed sleep Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 165/219] rtw88: wow: build wow function only if CONFIG_PM is on Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 166/219] rtw88: wow: fix size access error of probe request Sasha Levin
2021-09-09 11:45 ` [PATCH AUTOSEL 5.13 167/219] octeontx2-pf: Fix NIX1_RX interface backpressure Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 184/219] mptcp: fix ADD_ADDR and RM_ADDR maybe flush addr_signal each other Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 185/219] selftests/bpf: Enlarge select() timeout for test_maps Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 201/219] iwlwifi: pcie: free RBs during configure Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 202/219] iwlwifi: mvm: Do not use full SSIDs in 6GHz scan Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 203/219] iwlwifi: mvm: fix a memory leak in iwl_mvm_mac_ctxt_beacon_changed Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 204/219] iwlwifi: mvm: avoid static queue number aliasing Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 205/219] iwlwifi: mvm: Fix umac scan request probe parameters Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 206/219] iwlwifi: mvm: fix access to BSS elements Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 207/219] iwlwifi: fw: correctly limit to monitor dump Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 208/219] iwlwifi: mvm: Fix scan channel flags settings Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 209/219] net/mlx5: DR, fix a potential use-after-free bug Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 210/219] net/mlx5: DR, Enable QP retransmission Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 212/219] selftests/bpf: Fix potential unreleased lock Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 213/219] wcn36xx: Fix missing frame timestamp for beacon/probe-resp Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 214/219] ath9k: fix OOB read ar9300_eeprom_restore_internal Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 215/219] ath9k: fix sleeping in atomic context Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 216/219] net: fix NULL pointer reference in cipso_v4_doi_free Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 217/219] fix array-index-out-of-bounds in taprio_change Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 218/219] net: w5100: check return value after calling platform_get_resource() Sasha Levin
2021-09-09 11:46 ` [PATCH AUTOSEL 5.13 219/219] net: hns3: clean up a type mismatch warning Sasha Levin
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=20210909114635.143983-163-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=chris.chiu@canonical.com \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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).