Re: [PATCH v2 07/12] ath11k: add branch predictors in process_rx
From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Date: 2021-08-25 22:48:40
Also in:
ath11k
On Wed, Aug 25, 2021 at 12:39 PM P Praneesh [off-list ref] wrote:
quoted hunk ↗ jump to hunk
In datapath, add branch predictors where required in the process rx(). This protects high value rx path without having performance overhead. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1.r2-00012-QCAHKSWPL_SILICONZ-1 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01695-QCAHKSWPL_SILICONZ-1 Co-developed-by: Sriram R <redacted> Signed-off-by: Sriram R <redacted> Signed-off-by: Jouni Malinen <redacted> Signed-off-by: P Praneesh <redacted> --- drivers/net/wireless/ath/ath11k/dp_rx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index e105bdc..5d805881 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c@@ -2535,13 +2535,13 @@ static void ath11k_dp_rx_process_received_packets(struct ath11k_base *ab, rcu_read_lock(); ar = ab->pdevs[mac_id].ar; - if (!rcu_dereference(ab->pdevs_active[mac_id])) { + if (unlikely(!rcu_dereference(ab->pdevs_active[mac_id]))) { __skb_queue_purge(msdu_list); rcu_read_unlock(); return; }
The pointer that is returned by the rcu_dereference() is not dereferenced, so it is preferable to use rcu_access_pointer() here. And since rcu_access_pointer() did not require the RCU protection, the whole block with check and list purging could be moved before the rcu_read_lock() call. -- Sergey