From: Julius Bairaktaris <julius@bairaktaris.de>
To: Jeff Johnson <jjohnson@kernel.org>
Cc: ath11k@lists.infradead.org, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org,
Baochen Qiang <baochen.qiang@oss.qualcomm.com>,
Vasanthakumar Thiagarajan
<vasanthakumar.thiagarajan@oss.qualcomm.com>,
Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>,
Praneesh P <praneesh.p@oss.qualcomm.com>,
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>,
Mark Ruvald Pedersen <wabsie@gmail.com>,
Rosen Penev <rosenp@gmail.com>
Subject: [PATCH ath-next v1 07/10] wifi: ath11k: look the peer of a received MSDU up once
Date: Mon, 23 Nov 2026 14:41:34 +0100 [thread overview]
Message-ID: <20261123134137.718575-8-julius@bairaktaris.de> (raw)
In-Reply-To: <20261123134137.718575-1-julius@bairaktaris.de>
ath11k_dp_rx_h_mpdu() looks up the peer of each MSDU by its peer id in the
rhashtable, under base_lock, for the cipher, and
ath11k_dp_rx_deliver_msdu() looks it up again for the station it hands to
mac80211, under a second hold of the lock. In a profile of bridged uplink
at 900 Mbit/s (IPQ8074, one run) the lookup and its hash take 1.7 % of
all samples (ath11k_peer_find_by_id() 1.12 %, rhashtable_jhash2()
0.62 %).
Keep the station ath11k_dp_rx_h_mpdu() found in the frame's control
block, and have ath11k_dp_rx_deliver_msdu() take it from there. mac80211
then gets the station of the peer whose cipher the frame was handled
with, where two lookups could find different peers if the peer table
changed between them. The station is used after the lock and in the same
NAPI poll, as ath11k_dp_rx_deliver_msdu() used the station of its own
lookup after the lock. A frame that does not pass ath11k_dp_rx_h_mpdu(),
from the monitor and error paths, still looks its peer up; the mark is
cleared where those frames are reaped and when it is read. The debug
message prints the station's address.
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
---
drivers/net/wireless/ath/ath11k/core.h | 3 +++
drivers/net/wireless/ath/ath11k/dp_rx.c | 33 ++++++++++++++++++++-----
2 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index a0d725923ef2..4eb40e674c14 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -131,6 +131,8 @@ struct ath11k_skb_rxcb {
bool is_continuation;
bool is_mcbc;
bool is_eapol;
+ /* sta holds the station of the peer ath11k_dp_rx_h_mpdu() found */
+ bool sta_valid;
struct hal_rx_desc *rx_desc;
u8 err_rel_src;
u8 err_code;
@@ -140,6 +142,7 @@ struct ath11k_skb_rxcb {
u8 tid;
u16 peer_id;
u16 seq_no;
+ struct ieee80211_sta *sta;
};
enum ath11k_hw_rev {
diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
index e8226b2b832c..ff09463d829f 100644
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
@@ -2512,6 +2512,14 @@ static int ath11k_dp_rx_h_mpdu(struct ath11k *ar,
spin_lock_bh(&ar->ab->base_lock);
peer = ath11k_dp_rx_h_find_peer(ar->ab, msdu);
+ /*
+ * For ath11k_dp_rx_deliver_msdu(): the station of the peer whose
+ * cipher the frame is handled with, from the same hold of the lock.
+ */
+ BUILD_BUG_ON(sizeof(struct ath11k_skb_rxcb) >
+ sizeof_field(struct sk_buff, cb));
+ rxcb->sta = peer ? peer->sta : NULL;
+ rxcb->sta_valid = true;
if (peer) {
if (rxcb->is_mcbc)
enctype = peer->sec_type_grp;
@@ -2721,17 +2729,27 @@ static void ath11k_dp_rx_deliver_msdu(struct ath11k *ar, struct napi_struct *nap
if (!(status->flag & RX_FLAG_ONLY_MONITOR))
decap = ath11k_dp_rx_h_msdu_start_decap_type(ar->ab, rxcb->rx_desc);
- spin_lock_bh(&ar->ab->base_lock);
- peer = ath11k_dp_rx_h_find_peer(ar->ab, msdu);
- if (peer && peer->sta)
- pubsta = peer->sta;
- spin_unlock_bh(&ar->ab->base_lock);
+ /*
+ * The station ath11k_dp_rx_h_mpdu() found for the frame, if it ran,
+ * so that mac80211 gets the station whose cipher the frame was
+ * handled with.
+ */
+ if (rxcb->sta_valid) {
+ rxcb->sta_valid = false;
+ pubsta = rxcb->sta;
+ } else {
+ spin_lock_bh(&ar->ab->base_lock);
+ peer = ath11k_dp_rx_h_find_peer(ar->ab, msdu);
+ if (peer && peer->sta)
+ pubsta = peer->sta;
+ spin_unlock_bh(&ar->ab->base_lock);
+ }
ath11k_dbg(ar->ab, ATH11K_DBG_DATA,
"rx skb %p len %u peer %pM %d %s sn %u %s%s%s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i mic-err %i amsdu-more %i\n",
msdu,
msdu->len,
- peer ? peer->addr : NULL,
+ pubsta ? pubsta->addr : NULL,
rxcb->tid,
is_mcbc ? "mcast" : "ucast",
rxcb->seq_no,
@@ -3081,6 +3099,7 @@ int ath11k_dp_process_rx(struct ath11k_base *ab, int ring_id,
continue;
}
+ rxcb->sta_valid = false;
rxcb->is_first_msdu = !!(desc->rx_msdu_info.info0 &
RX_MSDU_DESC_INFO0_FIRST_MSDU_IN_MPDU);
rxcb->is_last_msdu = !!(desc->rx_msdu_info.info0 &
@@ -4562,6 +4581,7 @@ int ath11k_dp_rx_process_wbm_err(struct ath11k_base *ab,
continue;
}
+ rxcb->sta_valid = false;
rxcb->err_rel_src = err_info.err_rel_src;
rxcb->err_code = err_info.err_code;
rxcb->rx_desc = (struct hal_rx_desc *)msdu->data;
@@ -5471,6 +5491,7 @@ static int ath11k_dp_rx_mon_deliver(struct ath11k *ar, u32 mac_id,
rxs->flag |= RX_FLAG_ONLY_MONITOR;
ath11k_update_radiotap(ar, ppduinfo, mon_skb, rxs);
+ ATH11K_SKB_RXCB(mon_skb)->sta_valid = false;
ath11k_dp_rx_deliver_msdu(ar, napi, mon_skb, rxs);
mon_skb = skb_next;
} while (mon_skb);
--
2.53.0
next prev parent reply other threads:[~2026-11-23 13:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 13:41 [PATCH ath-next v1 00/10] wifi: ath11k: cut the per-packet cost of the RX path Julius Bairaktaris
2026-11-23 13:41 ` [PATCH ath-next v1 01/10] wifi: ath11k: use page_pool for the RX refill ring Julius Bairaktaris
2026-11-23 13:41 ` [PATCH ath-next v1 02/10] wifi: ath11k: replace the RX buffer IDR with a table Julius Bairaktaris
2026-11-23 13:41 ` [PATCH ath-next v1 03/10] wifi: ath11k: request only the PPDU stats TLVs it reads Julius Bairaktaris
2026-11-23 13:41 ` [PATCH ath-next v1 04/10] wifi: ath11k: set the skb hash of a received frame from the hardware Julius Bairaktaris
2026-11-23 13:41 ` [PATCH ath-next v1 05/10] wifi: ath11k: sync a cached ring's new entries once per head read Julius Bairaktaris
2026-11-23 13:41 ` [PATCH ath-next v1 06/10] wifi: ath11k: prefetch the buffers of the REO entries ahead of their reap Julius Bairaktaris
2026-11-23 13:41 ` Julius Bairaktaris [this message]
2026-11-23 13:41 ` [PATCH ath-next v1 08/10] wifi: ath11k: take the refill buffer lock without a second BH disable Julius Bairaktaris
2026-11-23 13:41 ` [PATCH ath-next v1 09/10] wifi: ath11k: hand the CPU only the part of a REO buffer the device wrote Julius Bairaktaris
2026-11-23 13:41 ` [PATCH ath-next v1 10/10] wifi: ath11k: give the refill buffers their ids a chunk at a time Julius Bairaktaris
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=20261123134137.718575-8-julius@bairaktaris.de \
--to=julius@bairaktaris.de \
--cc=ath11k@lists.infradead.org \
--cc=baochen.qiang@oss.qualcomm.com \
--cc=jjohnson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@oss.qualcomm.com \
--cc=praneesh.p@oss.qualcomm.com \
--cc=rameshkumar.sundaram@oss.qualcomm.com \
--cc=rosenp@gmail.com \
--cc=vasanthakumar.thiagarajan@oss.qualcomm.com \
--cc=wabsie@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
all inboxes | Powered by JetHome®