Message ID | 20231012100459.6158-4-ansuelsmth@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1111145vqb; Thu, 12 Oct 2023 03:09:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbdsOPANH5hPbpU7tuXOkucr44c0cD6DhjYZ5MjmrHzix1TLJHMzpdnceENdRW/sDztKsF X-Received: by 2002:a17:902:e5d2:b0:1c4:1cd3:8062 with SMTP id u18-20020a170902e5d200b001c41cd38062mr26644560plf.2.1697105380734; Thu, 12 Oct 2023 03:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697105380; cv=none; d=google.com; s=arc-20160816; b=oEn/C4mpeFibSzakVq98xl3keeUKtiDxjIjhI+Jv28YimtsHCAndMtTpz42bBjpF/T DzfijX+er02q9mr7mkZcbypm8RdvcZNQfYFYBYgXIeGAoDJVRZf35dyj2mE9rMsw7uQG CAU2dCDww9F1PiYYL1zNBgSnyNHj04N24PYF69JWk5xO8JpKMIIk4ZRt78ucV7IweVTY 7Ar0DMbgcB6d4bMbcw3rtQGOtvCDxTv/pQYInHCZjQ4xwaBMIG40vaGmrLMKlKLB98MG W+hamA0v8EgUXYLDavkQdlvm1dCFjGOg9DU/b3WEAJeQDvsMiGap4IUtdUfxCcfnoFq3 ZLdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u+fXPfuQFbOLDaAm3isa5Mto3s8GQTNxK9ZpHoavLmQ=; fh=jvZ7yAidasmFREPdFLzcn6X72yjJtrVlKHskOtM6Gso=; b=MnuLLLx24EyGkRkU85sHzt8ZupS4X4wy8pMWKVmzGZdRS6hpkYLDAbS8IRfC2NfbzD EdqOawv+H07sGFox5T7p9J07weEAw34OzaRQ2KvWPX3ktGICllUeYXumA7CsHbyNoqpU WBBG4sWFohy+MJ+nL5NSPZ1zzY6pUhUtDogoVQvWHLs+GfTDmkE9s0ZGJdRCoBy/PbBN dz+W7NyQFMnHiVHwEQOt8VDOOTkGLVFj1I3KobEByq4qBrIe39Y2mKOlsDYG6U0NRrSo +U+x8aYqJ4bSrECe9zDEF4Sny9i+H6hY3Wq/I37Miczzky34QCc9SRP+4MVoGNnLvysv Vxsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Mtoc7Xy5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id j1-20020a170902690100b001c60ecf8f7asi1841428plk.258.2023.10.12.03.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 03:09:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Mtoc7Xy5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 71723818CC9E; Thu, 12 Oct 2023 03:09:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377661AbjJLKIv (ORCPT <rfc822;rua109.linux@gmail.com> + 19 others); Thu, 12 Oct 2023 06:08:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343772AbjJLKIm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 12 Oct 2023 06:08:42 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7DF0BA; Thu, 12 Oct 2023 03:08:40 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3215f19a13aso713082f8f.3; Thu, 12 Oct 2023 03:08:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697105319; x=1697710119; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=u+fXPfuQFbOLDaAm3isa5Mto3s8GQTNxK9ZpHoavLmQ=; b=Mtoc7Xy5pMSCc5E3Za9+pYhu4jnOSxSUtDQzR6RcFVzBwJRbrv7ZbUX5gwNOfBn4KJ QP6dZSF3+j3Vt+gtZnvyVWKkHbr45hw2DxByxbMe+YTttAsc/PfIUI3mj05zYdfZY/JC ofu+n+dHqjmBntFRoy5Po5ETyUvd/bDhhfJZy0Ad+KX+NFsUjrhRM0CtAVgEpzaBG82C WsSglk+9ZtnE4Pmapj4AgJdIR3+2aO+qvfO0xzogNGWTimP9nA6K9tr05uBcBRfBR9iF Y2QpEMoNuTUlaqXS5n36snQ0roQ3+yL39KdnRtMnb6CLglm/chhz8SVYov2MBINPPdw7 Ua8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697105319; x=1697710119; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u+fXPfuQFbOLDaAm3isa5Mto3s8GQTNxK9ZpHoavLmQ=; b=hjDwh4SbpQj0cdTe3K4m+3YB0ap/TuaxFblrEIkHjhHebGa+1rx9MAvowcOv6wrneg JpQiBIVOhilJeRmXOtXSBLF1RpFxpirnwDK0Sl2uu0eftb4yoi88IHN3kAnrB3f2NF0L QM3t0fSUvjZ7aYWJfjxbpcOoqUNpTZWyNcCEw6IzFNBYCDdXb69PJV0i7N7hctMd+NJC 8ubSi46d5R1/InsTJdaeyq52FaLoAi6z5pOApt6Jd2miThV4ZqQosRzybS5jGoVzGj+c BZLXGEJl3WI4x9TGMkU+FrP36JdYOzpc/CEzHtEKKhoHEIqFzMP1rDP/RqyQZiYR7V6d xMmg== X-Gm-Message-State: AOJu0YwOCW8W7DAf1N9J85TJSyW5vX+fS0Ctl4D+W+z/op6UGVENJII/ I95bE4n/d9UebJlUFoI7qQ7Rly5QtAY= X-Received: by 2002:a5d:6e85:0:b0:323:10b8:543e with SMTP id k5-20020a5d6e85000000b0032310b8543emr19294869wrz.49.1697105319104; Thu, 12 Oct 2023 03:08:39 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id dj16-20020a0560000b1000b003198a9d758dsm922737wrb.78.2023.10.12.03.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 03:08:38 -0700 (PDT) From: Christian Marangi <ansuelsmth@gmail.com> To: Raju Rangoju <rajur@chelsio.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Jose Abreu <joabreu@synopsys.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Ping-Ke Shih <pkshih@realtek.com>, Kalle Valo <kvalo@kernel.org>, Simon Horman <horms@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Jiri Pirko <jiri@resnulli.us>, Hangbin Liu <liuhangbin@gmail.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-wireless@vger.kernel.org Cc: Christian Marangi <ansuelsmth@gmail.com> Subject: [net-next PATCH v2 3/4] net: stmmac: move TX timer arm after DMA enable Date: Thu, 12 Oct 2023 12:04:58 +0200 Message-Id: <20231012100459.6158-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231012100459.6158-1-ansuelsmth@gmail.com> References: <20231012100459.6158-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 12 Oct 2023 03:09:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779543971687040779 X-GMAIL-MSGID: 1779543971687040779 |
Series |
net: stmmac: improve tx timer logic
|
|
Commit Message
Christian Marangi
Oct. 12, 2023, 10:04 a.m. UTC
Move TX timer arm call after DMA interrupt is enabled again.
The TX timer arm function changed logic and now is skipped if a napi is
already scheduled. By moving the TX timer arm call after DMA is enabled,
we permit to correctly skip if a DMA interrupt has been fired and a napi
has been scheduled again.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
Comments
On Thu, 12 Oct 2023 12:04:58 +0200 Christian Marangi wrote:
> +static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue
missing comma at the end, does not build :(
On Fri, Oct 13, 2023 at 06:13:05PM -0700, Jakub Kicinski wrote: > On Thu, 12 Oct 2023 12:04:58 +0200 Christian Marangi wrote: > > +static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue > > missing comma at the end, does not build :( > -- > pw-bot: cr Sorry for wasting your time :( Having to port this between 6.1 and net-next and it slipped in while fixing the rebase conflict. Totally my fault.
Hi Christian, kernel test robot noticed the following build warnings: [auto build test WARNING on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/net-introduce-napi_is_scheduled-helper/20231017-104641 base: net-next/main patch link: https://lore.kernel.org/r/20231012100459.6158-4-ansuelsmth%40gmail.com patch subject: [net-next PATCH v2 3/4] net: stmmac: move TX timer arm after DMA enable config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20231017/202310171222.UN3fzVpz-lkp@intel.com/config) compiler: m68k-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231017/202310171222.UN3fzVpz-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202310171222.UN3fzVpz-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2549:28: error: expected ';', ',' or ')' before 'bool' 2549 | bool *pending_packets) | ^~~~ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: In function 'stmmac_napi_poll_tx': drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:5586:21: error: implicit declaration of function 'stmmac_tx_clean'; did you mean 'stmmac_rx_vlan'? [-Werror=implicit-function-declaration] 5586 | work_done = stmmac_tx_clean(priv, budget, chan, &pending_packets); | ^~~~~~~~~~~~~~~ | stmmac_rx_vlan drivers/net/ethernet/stmicro/stmmac/stmmac_main.c: At top level: >> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2425:13: warning: 'stmmac_xdp_xmit_zc' defined but not used [-Wunused-function] 2425 | static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) | ^~~~~~~~~~~~~~~~~~ >> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:536:13: warning: 'stmmac_get_tx_hwtstamp' defined but not used [-Wunused-function] 536 | static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv, | ^~~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +/stmmac_xdp_xmit_zc +2425 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c 47dd7a540b8a0c drivers/net/stmmac/stmmac_main.c Giuseppe Cavallaro 2009-10-14 2424 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 @2425 static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2426 { 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2427 struct netdev_queue *nq = netdev_get_tx_queue(priv->dev, queue); 8531c80800c10e drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Christian Marangi 2022-07-23 2428 struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue]; 8070274b472e2e drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Jisheng Zhang 2023-09-18 2429 struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[queue]; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2430 struct xsk_buff_pool *pool = tx_q->xsk_pool; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2431 unsigned int entry = tx_q->cur_tx; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2432 struct dma_desc *tx_desc = NULL; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2433 struct xdp_desc xdp_desc; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2434 bool work_done = true; 133466c3bbe171 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Jisheng Zhang 2023-07-18 2435 u32 tx_set_ic_bit = 0; 133466c3bbe171 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Jisheng Zhang 2023-07-18 2436 unsigned long flags; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2437 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2438 /* Avoids TX time-out as we are sharing with slow path */ e92af33e472cf3 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Alexander Lobakin 2021-11-17 2439 txq_trans_cond_update(nq); 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2440 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2441 budget = min(budget, stmmac_tx_avail(priv, queue)); 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2442 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2443 while (budget-- > 0) { 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2444 dma_addr_t dma_addr; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2445 bool set_ic; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2446 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2447 /* We are sharing with slow path and stop XSK TX desc submission when 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2448 * available TX ring is less than threshold. 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2449 */ 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2450 if (unlikely(stmmac_tx_avail(priv, queue) < STMMAC_TX_XSK_AVAIL) || 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2451 !netif_carrier_ok(priv->dev)) { 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2452 work_done = false; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2453 break; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2454 } 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2455 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2456 if (!xsk_tx_peek_desc(pool, &xdp_desc)) 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2457 break; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2458 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2459 if (likely(priv->extend_desc)) 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2460 tx_desc = (struct dma_desc *)(tx_q->dma_etx + entry); 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2461 else if (tx_q->tbs & STMMAC_TBS_AVAIL) 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2462 tx_desc = &tx_q->dma_entx[entry].basic; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2463 else 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2464 tx_desc = tx_q->dma_tx + entry; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2465 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2466 dma_addr = xsk_buff_raw_get_dma(pool, xdp_desc.addr); 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2467 xsk_buff_raw_dma_sync_for_device(pool, dma_addr, xdp_desc.len); 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2468 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2469 tx_q->tx_skbuff_dma[entry].buf_type = STMMAC_TXBUF_T_XSK_TX; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2470 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2471 /* To return XDP buffer to XSK pool, we simple call 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2472 * xsk_tx_completed(), so we don't need to fill up 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2473 * 'buf' and 'xdpf'. 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2474 */ 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2475 tx_q->tx_skbuff_dma[entry].buf = 0; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2476 tx_q->xdpf[entry] = NULL; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2477 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2478 tx_q->tx_skbuff_dma[entry].map_as_page = false; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2479 tx_q->tx_skbuff_dma[entry].len = xdp_desc.len; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2480 tx_q->tx_skbuff_dma[entry].last_segment = true; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2481 tx_q->tx_skbuff_dma[entry].is_jumbo = false; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2482 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2483 stmmac_set_desc_addr(priv, tx_desc, dma_addr); 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2484 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2485 tx_q->tx_count_frames++; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2486 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2487 if (!priv->tx_coal_frames[queue]) 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2488 set_ic = false; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2489 else if (tx_q->tx_count_frames % priv->tx_coal_frames[queue] == 0) 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2490 set_ic = true; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2491 else 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2492 set_ic = false; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2493 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2494 if (set_ic) { 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2495 tx_q->tx_count_frames = 0; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2496 stmmac_set_tx_ic(priv, tx_desc); 133466c3bbe171 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Jisheng Zhang 2023-07-18 2497 tx_set_ic_bit++; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2498 } 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2499 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2500 stmmac_prepare_tx_desc(priv, tx_desc, 1, xdp_desc.len, 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2501 true, priv->mode, true, true, 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2502 xdp_desc.len); 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2503 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2504 stmmac_enable_dma_transmission(priv, priv->ioaddr); 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2505 8531c80800c10e drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Christian Marangi 2022-07-23 2506 tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, priv->dma_conf.dma_tx_size); 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2507 entry = tx_q->cur_tx; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2508 } 8070274b472e2e drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Jisheng Zhang 2023-09-18 2509 flags = u64_stats_update_begin_irqsave(&txq_stats->syncp); 8070274b472e2e drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Jisheng Zhang 2023-09-18 2510 txq_stats->tx_set_ic_bit += tx_set_ic_bit; 8070274b472e2e drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Jisheng Zhang 2023-09-18 2511 u64_stats_update_end_irqrestore(&txq_stats->syncp, flags); 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2512 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2513 if (tx_desc) { 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2514 stmmac_flush_tx_descriptors(priv, queue); 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2515 xsk_tx_release(pool); 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2516 } 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2517 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2518 /* Return true if all of the 3 conditions are met 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2519 * a) TX Budget is still available 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2520 * b) work_done = true when XSK TX desc peek is empty (no more 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2521 * pending XSK TX for transmission) 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2522 */ 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2523 return !!budget && work_done; 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2524 } 132c32ee5bc09b drivers/net/ethernet/stmicro/stmmac/stmmac_main.c Ong Boon Leong 2021-04-13 2525
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 5124ee87286c..b2f63f12aee5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2545,7 +2545,8 @@ static void stmmac_bump_dma_threshold(struct stmmac_priv *priv, u32 chan) * @queue: TX queue index * Description: it reclaims the transmit resources after transmission completes. */ -static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue) +static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue + bool *pending_packets) { struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue]; struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[queue]; @@ -2706,7 +2707,7 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue) /* We still have pending packets, let's call for a new scheduling */ if (tx_q->dirty_tx != tx_q->cur_tx) - stmmac_tx_timer_arm(priv, queue); + *pending_packets = true; flags = u64_stats_update_begin_irqsave(&txq_stats->syncp); txq_stats->tx_packets += tx_packets; @@ -5572,6 +5573,7 @@ static int stmmac_napi_poll_tx(struct napi_struct *napi, int budget) container_of(napi, struct stmmac_channel, tx_napi); struct stmmac_priv *priv = ch->priv_data; struct stmmac_txq_stats *txq_stats; + bool pending_packets = false; u32 chan = ch->index; unsigned long flags; int work_done; @@ -5581,7 +5583,7 @@ static int stmmac_napi_poll_tx(struct napi_struct *napi, int budget) txq_stats->napi_poll++; u64_stats_update_end_irqrestore(&txq_stats->syncp, flags); - work_done = stmmac_tx_clean(priv, budget, chan); + work_done = stmmac_tx_clean(priv, budget, chan, &pending_packets); work_done = min(work_done, budget); if (work_done < budget && napi_complete_done(napi, work_done)) { @@ -5592,6 +5594,10 @@ static int stmmac_napi_poll_tx(struct napi_struct *napi, int budget) spin_unlock_irqrestore(&ch->lock, flags); } + /* TX still have packet to handle, check if we need to arm tx timer */ + if (pending_packets) + stmmac_tx_timer_arm(priv, chan); + return work_done; } @@ -5600,6 +5606,7 @@ static int stmmac_napi_poll_rxtx(struct napi_struct *napi, int budget) struct stmmac_channel *ch = container_of(napi, struct stmmac_channel, rxtx_napi); struct stmmac_priv *priv = ch->priv_data; + bool tx_pending_packets = false; int rx_done, tx_done, rxtx_done; struct stmmac_rxq_stats *rxq_stats; struct stmmac_txq_stats *txq_stats; @@ -5616,7 +5623,7 @@ static int stmmac_napi_poll_rxtx(struct napi_struct *napi, int budget) txq_stats->napi_poll++; u64_stats_update_end_irqrestore(&txq_stats->syncp, flags); - tx_done = stmmac_tx_clean(priv, budget, chan); + tx_done = stmmac_tx_clean(priv, budget, chan, &tx_pending_packets); tx_done = min(tx_done, budget); rx_done = stmmac_rx_zc(priv, budget, chan); @@ -5641,6 +5648,10 @@ static int stmmac_napi_poll_rxtx(struct napi_struct *napi, int budget) spin_unlock_irqrestore(&ch->lock, flags); } + /* TX still have packet to handle, check if we need to arm tx timer */ + if (tx_pending_packets) + stmmac_tx_timer_arm(priv, chan); + return min(rxtx_done, budget - 1); }