Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754081AbdDKIeh (ORCPT ); Tue, 11 Apr 2017 04:34:37 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:39429 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752117AbdDKIef (ORCPT ); Tue, 11 Apr 2017 04:34:35 -0400 From: To: , CC: , , , , , Sean Wang Subject: [PATCH net-next] net: ethernet: mediatek: enhance TX path with recycling more SKBs in one poll Date: Tue, 11 Apr 2017 16:34:27 +0800 Message-ID: <1491899667-19596-1-git-send-email-sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1749 Lines: 56 From: Sean Wang 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 --- 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