* [PATCH] ath10k: fix napi_poll budget overflow
@ 2017-08-22 21:44 ryanhsu
2017-08-24 9:07 ` Kalle Valo
2017-08-31 12:13 ` Kalle Valo
0 siblings, 2 replies; 4+ messages in thread
From: ryanhsu @ 2017-08-22 21:44 UTC (permalink / raw)
To: ath10k, linux-wireless; +Cc: ryanhsu
From: Ryan Hsu <ryanhsu@qti.qualcomm.com>
In napi_poll, the budget number is used to control the amount of packets
we should handle per poll to balance the resource in the system.
In the list of the amsdu packets reception, we check if there is budget
count left and handle the complete list of the packets, that it will have
chances the very last list will over the budget leftover.
So adding one more parameter - budget_left, this would help while
traversing the list to avoid handling more than the budget given.
Reported-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Fix-suggested-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Ryan Hsu <ryanhsu@qti.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/htt_rx.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 0b4c156..95a5a18 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -1718,7 +1718,8 @@ static void ath10k_htt_rx_delba(struct ath10k *ar, struct htt_resp *resp)
}
static int ath10k_htt_rx_extract_amsdu(struct sk_buff_head *list,
- struct sk_buff_head *amsdu)
+ struct sk_buff_head *amsdu,
+ int budget_left)
{
struct sk_buff *msdu;
struct htt_rx_desc *rxd;
@@ -1729,8 +1730,9 @@ static int ath10k_htt_rx_extract_amsdu(struct sk_buff_head *list,
if (WARN_ON(!skb_queue_empty(amsdu)))
return -EINVAL;
- while ((msdu = __skb_dequeue(list))) {
+ while ((msdu = __skb_dequeue(list)) && budget_left) {
__skb_queue_tail(amsdu, msdu);
+ budget_left--;
rxd = (void *)msdu->data - sizeof(*rxd);
if (rxd->msdu_end.common.info0 &
@@ -1821,7 +1823,8 @@ static int ath10k_htt_rx_h_rx_offload(struct ath10k *ar,
return num_msdu;
}
-static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb)
+static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb,
+ int budget_left)
{
struct ath10k_htt *htt = &ar->htt;
struct htt_resp *resp = (void *)skb->data;
@@ -1878,9 +1881,9 @@ static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb)
if (offload)
num_msdus = ath10k_htt_rx_h_rx_offload(ar, &list);
- while (!skb_queue_empty(&list)) {
+ while (!skb_queue_empty(&list) && budget_left) {
__skb_queue_head_init(&amsdu);
- ret = ath10k_htt_rx_extract_amsdu(&list, &amsdu);
+ ret = ath10k_htt_rx_extract_amsdu(&list, &amsdu, budget_left);
switch (ret) {
case 0:
/* Note: The in-order indication may report interleaved
@@ -1890,6 +1893,7 @@ static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb)
* should still give an idea about rx rate to the user.
*/
num_msdus += skb_queue_len(&amsdu);
+ budget_left -= skb_queue_len(&amsdu);
ath10k_htt_rx_h_ppdu(ar, &amsdu, status, vdev_id);
ath10k_htt_rx_h_filter(ar, &amsdu, status);
ath10k_htt_rx_h_mpdu(ar, &amsdu, status);
@@ -2400,7 +2404,8 @@ int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget)
}
spin_lock_bh(&htt->rx_ring.lock);
- num_rx_msdus = ath10k_htt_rx_in_ord_ind(ar, skb);
+ num_rx_msdus = ath10k_htt_rx_in_ord_ind(ar, skb,
+ (budget - quota));
spin_unlock_bh(&htt->rx_ring.lock);
if (num_rx_msdus < 0) {
resched_napi = true;
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: ath10k: fix napi_poll budget overflow
2017-08-22 21:44 [PATCH] ath10k: fix napi_poll budget overflow ryanhsu
@ 2017-08-24 9:07 ` Kalle Valo
2017-08-24 14:27 ` Ryan Hsu
2017-08-31 12:13 ` Kalle Valo
1 sibling, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2017-08-24 9:07 UTC (permalink / raw)
To: ryanhsu; +Cc: ath10k, linux-wireless, ryanhsu
ryanhsu@qti.qualcomm.com wrote:
> From: Ryan Hsu <ryanhsu@qti.qualcomm.com>
>
> In napi_poll, the budget number is used to control the amount of packets
> we should handle per poll to balance the resource in the system.
>
> In the list of the amsdu packets reception, we check if there is budget
> count left and handle the complete list of the packets, that it will have
> chances the very last list will over the budget leftover.
>
> So adding one more parameter - budget_left, this would help while
> traversing the list to avoid handling more than the budget given.
>
> Reported-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Fix-suggested-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
>
> Signed-off-by: Ryan Hsu <ryanhsu@qti.qualcomm.com>
Was there a bug report about this? I can add a link to that and maybe also
include the warning.
--
https://patchwork.kernel.org/patch/9916207/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ath10k: fix napi_poll budget overflow
2017-08-24 9:07 ` Kalle Valo
@ 2017-08-24 14:27 ` Ryan Hsu
0 siblings, 0 replies; 4+ messages in thread
From: Ryan Hsu @ 2017-08-24 14:27 UTC (permalink / raw)
To: Kalle Valo; +Cc: ath10k, linux-wireless
DQpPbiAwOC8yNC8yMDE3IDAyOjA3IEFNLCBLYWxsZSBWYWxvIHdyb3RlOg0KPiByeWFuaHN1QHF0
aS5xdWFsY29tbS5jb20gd3JvdGU6DQo+DQo+PiBGcm9tOiBSeWFuIEhzdSA8cnlhbmhzdUBxdGku
cXVhbGNvbW0uY29tPg0KPj4NCj4+IEluIG5hcGlfcG9sbCwgdGhlIGJ1ZGdldCBudW1iZXIgaXMg
dXNlZCB0byBjb250cm9sIHRoZSBhbW91bnQgb2YgcGFja2V0cw0KPj4gd2Ugc2hvdWxkIGhhbmRs
ZSBwZXIgcG9sbCB0byBiYW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Q0K
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ath10k: fix napi_poll budget overflow
2017-08-22 21:44 [PATCH] ath10k: fix napi_poll budget overflow ryanhsu
2017-08-24 9:07 ` Kalle Valo
@ 2017-08-31 12:13 ` Kalle Valo
1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2017-08-31 12:13 UTC (permalink / raw)
To: ryanhsu; +Cc: ath10k, linux-wireless, ryanhsu
ryanhsu@qti.qualcomm.com wrote:
> In napi_poll, the budget number is used to control the amount of packets
> we should handle per poll to balance the resource in the system.
>
> In the list of the amsdu packets reception, we check if there is budget
> count left and handle the complete list of the packets, that it will have
> chances the very last list will over the budget leftover.
>
> So adding one more parameter - budget_left, this would help while
> traversing the list to avoid handling more than the budget given.
>
> Reported-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Fix-suggested-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
> Link: https://lkml.kernel.org/r/26670dce-4dd2-f8e4-0e14-90d74257e739@virtuozzo.com
> Signed-off-by: Ryan Hsu <ryanhsu@qti.qualcomm.com>
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Patch applied to ath-next branch of ath.git, thanks.
c9353bf483d3 ath10k: fix napi_poll budget overflow
--
https://patchwork.kernel.org/patch/9916207/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-31 12:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-22 21:44 [PATCH] ath10k: fix napi_poll budget overflow ryanhsu
2017-08-24 9:07 ` Kalle Valo
2017-08-24 14:27 ` Ryan Hsu
2017-08-31 12:13 ` Kalle Valo
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).