* [PATCH net-next] net: ethernet: mediatek: enhance TX path with recycling more SKBs in one poll
@ 2017-04-11 8:34 sean.wang
2017-04-11 14:49 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: sean.wang @ 2017-04-11 8:34 UTC (permalink / raw)
To: john, davem
Cc: nbd, netdev, linux-kernel, linux-mediatek, keyhaede, Sean Wang
From: Sean Wang <sean.wang@mediatek.com>
The patch adds the enhancement for recycling more TX completed SKBs in
one NAPI polling handler if NAPI budgets are still available and hardware
raises status bit shown for certain SKBs are aready done.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 14e1bd1..ac8f1b9 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1074,10 +1074,13 @@ static int mtk_napi_tx(struct napi_struct *napi, int budget)
struct mtk_eth *eth = container_of(napi, struct mtk_eth, tx_napi);
u32 status, mask;
int tx_done = 0;
+ int remain_budget = budget;
mtk_handle_status_irq(eth);
+
+poll_again:
mtk_w32(eth, MTK_TX_DONE_INT, MTK_QMTK_INT_STATUS);
- tx_done = mtk_poll_tx(eth, budget);
+ tx_done = mtk_poll_tx(eth, remain_budget);
if (unlikely(netif_msg_intr(eth))) {
status = mtk_r32(eth, MTK_QMTK_INT_STATUS);
@@ -1087,17 +1090,19 @@ static int mtk_napi_tx(struct napi_struct *napi, int budget)
tx_done, status, mask);
}
- if (tx_done == budget)
+ if (tx_done == remain_budget)
return budget;
status = mtk_r32(eth, MTK_QMTK_INT_STATUS);
- if (status & MTK_TX_DONE_INT)
- return budget;
+ if (status & MTK_TX_DONE_INT) {
+ remain_budget -= tx_done;
+ goto poll_again;
+ }
napi_complete(napi);
mtk_irq_enable(eth, MTK_QDMA_INT_MASK, MTK_TX_DONE_INT);
- return tx_done;
+ return tx_done + budget - remain_budget;
}
static int mtk_napi_rx(struct napi_struct *napi, int budget)
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: ethernet: mediatek: enhance TX path with recycling more SKBs in one poll
2017-04-11 8:34 [PATCH net-next] net: ethernet: mediatek: enhance TX path with recycling more SKBs in one poll sean.wang
@ 2017-04-11 14:49 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-04-11 14:49 UTC (permalink / raw)
To: sean.wang; +Cc: john, nbd, netdev, linux-kernel, linux-mediatek, keyhaede
From: <sean.wang@mediatek.com>
Date: Tue, 11 Apr 2017 16:34:27 +0800
> From: Sean Wang <sean.wang@mediatek.com>
>
> The patch adds the enhancement for recycling more TX completed SKBs in
> one NAPI polling handler if NAPI budgets are still available and hardware
> raises status bit shown for certain SKBs are aready done.
>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
You should always, unconditionally, process all TX reclaim events
every NAPI poll, regardless of how much budget is left.
TX reclaim work is not counted against the NAPI budget, only RX work
should be.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-11 14:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-11 8:34 [PATCH net-next] net: ethernet: mediatek: enhance TX path with recycling more SKBs in one poll sean.wang
2017-04-11 14:49 ` David Miller
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).