diff mbox

[1/8] mt76: retry rx polling as long as there is budget left

Message ID 20180124151917.70962-1-nbd@nbd.name (mailing list archive)
State Accepted
Commit 2b4307f538ab31954e9b6d4ff64b6cf5b33196e1
Delegated to: Kalle Valo
Headers show

Commit Message

Felix Fietkau Jan. 24, 2018, 3:19 p.m. UTC
Sending frames to mac80211 needs time, which could allow for more rx
packets to end up in the DMA ring. Retry polling until there are no more
frames left. Improves rx latency under load.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/dma.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Kalle Valo Jan. 26, 2018, 9:20 a.m. UTC | #1
Felix Fietkau <nbd@nbd.name> wrote:

> Sending frames to mac80211 needs time, which could allow for more rx
> packets to end up in the DMA ring. Retry polling until there are no more
> frames left. Improves rx latency under load.
> 
> Signed-off-by: Felix Fietkau <nbd@nbd.name>

7 patches applied to wireless-drivers-next.git, thanks.

2b4307f538ab mt76: retry rx polling as long as there is budget left
1342cfea315a mt76: fix TSF value in probe responses
4e34249e9565 mt76: add an intermediate struct for rx status information
9c68a57bc22d mt76: get station pointer by wcid and pass it to mac80211
aee5b8cf2477 mt76: implement A-MPDU rx reordering in the driver code
9d9d738b4b54 mt76: split mt76_rx_complete
3675302de8e9 mt76: pass the per-vif wcid to the core for multicast rx
diff mbox

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
index ecd409a4a89b..e539b3838b94 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -387,17 +387,21 @@  static int
 mt76_dma_rx_poll(struct napi_struct *napi, int budget)
 {
 	struct mt76_dev *dev;
-	int qid, done;
+	int qid, done = 0, cur;
 
 	dev = container_of(napi->dev, struct mt76_dev, napi_dev);
 	qid = napi - dev->napi;
 
-	done = mt76_dma_rx_process(dev, &dev->q_rx[qid], budget);
+	do {
+		cur = mt76_dma_rx_process(dev, &dev->q_rx[qid], budget - done);
+		mt76_rx_complete(dev, qid);
+		done += cur;
+	} while (cur && done < budget);
+
 	if (done < budget) {
 		napi_complete(napi);
 		dev->drv->rx_poll_complete(dev, qid);
 	}
-	mt76_rx_complete(dev, qid);
 
 	return done;
 }