Skip to contentSkip to conversation

ath11k: fix missing srng_access_end in CE

PATCH NAK Christian 'Ansuel' Marangi 3 participants 6 messages May 28, 2022 – Jun 6, 2022 Qualcomm Atheros ATH11K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ath11k: fix missing srng_access_end in CE

When a CE completed send next operation is done, the srng access end is never called. Correctly end the srng access to make sure we have the correct values in the srng struct.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1

Fixes d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
---
 drivers/net/wireless/ath/ath11k/ce.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath11k/ce.c +2 -0
index c14c51f38709..665205d2322e 100644
@@ -490,6 +490,8 @@ static struct sk_buff *ath11k_ce_completed_send_next(struct ath11k_ce_pipe *pipe
 	pipe->src_ring->sw_index = sw_index;
 
 err_unlock:
+	ath11k_hal_srng_access_end(ab, srng);
+
 	spin_unlock_bh(&srng->lock);
 
 	spin_unlock_bh(&ab->ce.ce_lock);
Signature · 7 lines
2.36.1


-- 
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#1 lore raw

PATCH 2/2 ath11k: fix missing skb drop on htc_tx_completion error

On htc_tx_completion error the skb is not dropped. This is wrong since the completion_handler logic expect the skb to be consumed anyway even when an error is triggerer. Not freeing the skb on error is a memory leak since the skb won't be freed anywere else. Correctly free the packet on eid >= ATH11K_HTC_EP_COUNT before returning.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1

Fixes f951380a6022 ("ath11k: Disabling credit flow for WMI path")
---
 drivers/net/wireless/ath/ath11k/htc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/htc.c +3 -1
index 069c29a4fac7..ca3aedc0252d 100644
@@ -258,8 +258,10 @@ void ath11k_htc_tx_completion_handler(struct ath11k_base *ab,
 	u8 eid;
 
 	eid = ATH11K_SKB_CB(skb)->eid;
-	if (eid >= ATH11K_HTC_EP_COUNT)
+	if (eid >= ATH11K_HTC_EP_COUNT) {
+		dev_kfree_skb_any(skb);
 		return;
+	}
 
 	ep = &htc->endpoint[eid];
 	spin_lock_bh(&htc->tx_lock);
Signature · 1 line
2.36.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] ath11k: fix missing skb drop on htc_tx_completion error

Quoted 3 lines · Christian 'Ansuel' Marangi

On htc_tx_completion error the skb is not dropped. This is wrong since the completion_handler logic expect the skb to be consumed anyway even when an error is triggerer. Not freeing the skb on error is a memory

nit: s/triggerer/triggered/

Kalle can fix this when he merges so no need to post a correction

Quoted 7 lines

leak since the skb won't be freed anywere else. Correctly free the packet on eid >= ATH11K_HTC_EP_COUNT before returning.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1

Fixes f951380a6022 ("ath11k: Disabling credit flow for WMI path")
Quoted 20 lines
---
  drivers/net/wireless/ath/ath11k/htc.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/htc.c +3 -1
index 069c29a4fac7..ca3aedc0252d 100644
@@ -258,8 +258,10 @@ void ath11k_htc_tx_completion_handler(struct ath11k_base *ab,
  	u8 eid;
 
  	eid = ATH11K_SKB_CB(skb)->eid;
-	if (eid >= ATH11K_HTC_EP_COUNT)
+	if (eid >= ATH11K_HTC_EP_COUNT) {
+		dev_kfree_skb_any(skb);
  		return;
+	}
 
  	ep = &htc->endpoint[eid];
  	spin_lock_bh(&htc->tx_lock);
#3 lore raw

Re: [PATCH 2/2] ath11k: fix missing skb drop on htc_tx_completion error

Quoted 8 lines · Jeff Johnson
Quoted 3 lines · Christian 'Ansuel' Marangi

On htc_tx_completion error the skb is not dropped. This is wrong since the completion_handler logic expect the skb to be consumed anyway even when an error is triggerer. Not freeing the skb on error is a memory

nit: s/triggerer/triggered/

Kalle can fix this when he merges so no need to post a correction

Yup, fixed now in the pending branch.

Signature · 8 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

-- 
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#4 lore raw

Re: [PATCH 2/2] ath11k: fix missing skb drop on htc_tx_completion error

In reply to Christian 'Ansuel' Marangi
Quoted 6 lines · Christian 'Ansuel' Marangi

On htc_tx_completion error the skb is not dropped. This is wrong since the completion_handler logic expect the skb to be consumed anyway even when an error is triggered. Not freeing the skb on error is a memory leak since the skb won't be freed anywere else. Correctly free the packet on eid >= ATH11K_HTC_EP_COUNT before returning.

Quoted 6 lines

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1

Fixes f951380a6022 ("ath11k: Disabling credit flow for WMI path")

Patch applied to ath-next branch of ath.git, thanks.

e5646fe3b7ef ath11k: fix missing skb drop on htc_tx_completion error

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#5 lore raw
In reply to Christian 'Ansuel' Marangi
Quoted 17 lines · Christian 'Ansuel' Marangi

When a CE completed send next operation is done, the srng access end is never called. Correctly end the srng access to make sure we have the correct values in the srng struct.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1

Fixes d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
---
  drivers/net/wireless/ath/ath11k/ce.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath11k/ce.c +0 -0
index c14c51f38709..665205d2322e 100644

drivers/net/wireless/ath/ath11k/ce.c static struct sk_buff *ath11k_ce_completed_send_next(struct ath11k_ce_pipe *pipe · line 497

Quoted 8 lines
drivers/net/wireless/ath/ath11k/ce.c +2 -0
@@ -490,6 +490,8 @@ static struct sk_buff *ath11k_ce_completed_send_next(struct ath11k_ce_pipe *pipe
  	pipe->src_ring->sw_index = sw_index;
 
  err_unlock:
+	ath11k_hal_srng_access_end(ab, srng);
+
  	spin_unlock_bh(&srng->lock);
 
  	spin_unlock_bh(&ab->ce.ce_lock);

NAK -- Not calling ath11k_hal_srng_access_end() is intentional.

CE_SRC ring is a special ring, we perform tx_request and tx_completion on the same ring. The completion processing frees SKBs associated to the ce_desc, this is what ath11k_ce_completed_send_next() does, it does not update the head pointer to hw because the ce_desc at hp does not have any new data, it is just available for new messages. ath11k_ce_send() retrieves a processed (processed by ath11k_ce_completed_send_next) ce_desc and sets it up for the new message. Then it updates the hw about the newly available ce_desc by calling ath11k_hal_srng_access_end().

If you want to do anything here, adding a comment based upon the above would be good.

/jeff

Signature · 3 lines
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k