From 0edd3e2dbb21b29839ed443836ba7641cef9e9ab Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Chitrapu Date: Wed, 10 Aug 2022 23:25:48 -0700 Subject: [PATCH 09/12] ath12k: optimize rcu lock access in dp_tx In ath12k_dp_tx_complete_msdu , the pointer that is returned by rcu_dereference() is not dereferenced. so it is preferable to use rcu_access_pointer() here. Signed-off-by: Pradeep Kumar Chitrapu --- drivers/net/wireless/ath/ath12k/dp_tx.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/dp_tx.c b/drivers/net/wireless/ath/ath12k/dp_tx.c index 0490dfcfa695..c9abd3e487bd 100644 --- a/drivers/net/wireless/ath/ath12k/dp_tx.c +++ b/drivers/net/wireless/ath/ath12k/dp_tx.c @@ -686,16 +686,14 @@ static void ath12k_dp_tx_complete_msdu(struct ath12k *ar, ath12k_dp_tx_status_parse(ab, tx_status, &ts); - rcu_read_lock(); - - if (!rcu_dereference(ab->pdevs_active[ar->pdev_idx])) { + if (!rcu_access_pointer(ab->pdevs_active[ar->pdev_idx])) { dev_kfree_skb_any(msdu); - goto exit; + return; } if (!skb_cb->vif) { dev_kfree_skb_any(msdu); - goto exit; + return; } vif = skb_cb->vif; @@ -749,7 +747,7 @@ static void ath12k_dp_tx_complete_msdu(struct ath12k *ar, ts.peer_id); spin_unlock_bh(&ab->base_lock); dev_kfree_skb_any(msdu); - goto exit; + return; } arsta = (struct ath12k_sta *)peer->sta->drv_priv; @@ -764,9 +762,6 @@ static void ath12k_dp_tx_complete_msdu(struct ath12k *ar, ieee80211_tx_status_8023(ar->ah->hw, vif, msdu); else ieee80211_tx_status_ext(ar->ah->hw, &status); - -exit: - rcu_read_unlock(); } static inline bool ath12k_dp_tx_completion_valid(struct hal_wbm_release_ring *desc) -- 2.17.1