Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b4307f5 authored by Felix Fietkau's avatar Felix Fietkau Committed by Kalle Valo
Browse files

mt76: retry rx polling as long as there is budget left



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: default avatarFelix Fietkau <nbd@nbd.name>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent f7a61170
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -387,17 +387,21 @@ static int
mt76_dma_rx_poll(struct napi_struct *napi, int budget)
mt76_dma_rx_poll(struct napi_struct *napi, int budget)
{
{
	struct mt76_dev *dev;
	struct mt76_dev *dev;
	int qid, done;
	int qid, done = 0, cur;


	dev = container_of(napi->dev, struct mt76_dev, napi_dev);
	dev = container_of(napi->dev, struct mt76_dev, napi_dev);
	qid = napi - dev->napi;
	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) {
	if (done < budget) {
		napi_complete(napi);
		napi_complete(napi);
		dev->drv->rx_poll_complete(dev, qid);
		dev->drv->rx_poll_complete(dev, qid);
	}
	}
	mt76_rx_complete(dev, qid);


	return done;
	return done;
}
}