From patchwork Wed Jan 31 17:05:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 194881 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2050520dyb; Wed, 31 Jan 2024 09:39:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFalW5PCJl55gWCDRjakIF4HRSbG0ziMGZteoYsO04A2fbnyn2VS/ccxwQ/fxFCFqVTSNcc X-Received: by 2002:aa7:9851:0:b0:6db:afd4:f54c with SMTP id n17-20020aa79851000000b006dbafd4f54cmr2530266pfq.0.1706722777272; Wed, 31 Jan 2024 09:39:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706722777; cv=pass; d=google.com; s=arc-20160816; b=WnfCUTdx8QkGU9PGDKeFerMZfvvLWHw2RqC//We5n5wfUqYtqHimxEBhQTjqvxaLB/ 7leTz4TfrsJbAe4JESzfG5QVPKYOkQZorC2aU93YKD8Vevqm4myaBX6DiKhVGf6xUHud vIdCQXOvKaTVg/4Re7zt3Vjrcj5x9mfBzbZFMbCaT3oU9u4C1NlGsbKT+sHVlBssmHYV jLcfeKClZdJ5HjP5aotnXNSmWr8kIdV5aFMcnyL8yb5bhVZDSBrLR77QJqtwqN6N+mfR 4O04cJidQB55nAre2eYj1dKEn/+UeaCgKyZtP1T04BGxDRweBnn2ngCQciCtPDCv0LmN PBNQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=U9xIfP68l1vhQsfAETMkRUwX65ZfvcXPsH7Y7a0qEg8=; fh=/YieQlk81Dk8f06LbLApraeOLw/JAA6qzajpNW9j73E=; b=th41fg7pjpPtvaJqmsCQq7pfriysj1KhNIbzN/UgnPShawQZfFFb+3vrZ5GwZByIrI Vd2F8AlzPWd6+1W2q5BkwULB73jhdomrPswzqOIpPiYPfYPA8gkoE1jB8EvF0RKTo+O3 LSylScJh8PcX8qG9FqeKFKqkk8VyMts6UXLjPdwkglCbky8Zhgeh+/cievOw+p3GyplR Ek/OhAISQts4BO/0f9At6P4Cbm1j02JEHD2AIcFqxE5R8IunLTQ1m2TAPq7FjlzJtF4I RVTycwnkPXsLn1lbEUB0Sy57RKwtWyOUlUowt3SAaA86b6tEQyDoF8RuiKa1H2AHaPhB HYMg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46863-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46863-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com X-Forwarded-Encrypted: i=1; AJvYcCWyV5ks0EaSFO9+7M5Sp2cvB33L1XG0J9pbOuK6cRrERtiT2lGVtA8mEy3yXqomOIFow+VMWqpjJ4q80GRm8F0TrDy0bg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id m26-20020aa78a1a000000b006de04df03e3si9348420pfa.114.2024.01.31.09.39.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 09:39:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46863-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46863-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46863-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id DF1A6B315B1 for ; Wed, 31 Jan 2024 17:06:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9723112DDA9; Wed, 31 Jan 2024 17:06:00 +0000 (UTC) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF1A412C54B; Wed, 31 Jan 2024 17:05:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720758; cv=none; b=Ad1q3MpM4XBptrUPj2FzQZLaOXndOozMIKULN4oI0Z+SJ3FTJm8tE2pD9CvHvs4/HufjO8ksV0uoCipk9XGM0ksv6voY3PwP7cEnW/IuXBRKubBeZP0bP3zUL6aj3EEWrX+U86Ck7vQ77COtHzSVIZ1sshVEUVKSpRrxPL3H7oc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720758; c=relaxed/simple; bh=O3JgQWQjXJLciyc2HaqxwHx7NmFu6s1KXH6/DXjbg0U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qURtoawAvZAw4fKgMA+2hbR/wWjIjp/pR195HNvaiAEJPSdmVYgiIUE7vHzFDCv4M5iJoLIhdzgOtuWR6KUXZKHYPUZCKer+okS41/fWbPHAYg8SWBGTSvTb/FyH6NIX6daT9sE7d2IVcfakH5oToUYsnYfSPjxSGLC8m4g/RgE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.05,231,1701097200"; d="scan'208";a="196315518" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Feb 2024 02:05:50 +0900 Received: from GBR-5CG2373LKG.adwin.renesas.com (unknown [10.226.92.158]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id EA4CB40344F5; Thu, 1 Feb 2024 02:05:46 +0900 (JST) From: Paul Barker To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Paul Barker , Yoshihiro Shimoda , Wolfram Sang , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/8] net: ravb: Split R-Car & GbEth poll functions Date: Wed, 31 Jan 2024 17:05:15 +0000 Message-Id: <20240131170523.30048-2-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> References: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789628543137686117 X-GMAIL-MSGID: 1789628543137686117 This allows us to optimise polling and receive processing for the GbEth IP used in the RZ/G2L Soc family, without affecting the wider family of R-Car based devices. Signed-off-by: Paul Barker --- drivers/net/ethernet/renesas/ravb.h | 2 +- drivers/net/ethernet/renesas/ravb_main.c | 74 ++++++++++++++++++------ 2 files changed, 58 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h index 3cf869fb9a68..9e9cf0d36d72 100644 --- a/drivers/net/ethernet/renesas/ravb.h +++ b/drivers/net/ethernet/renesas/ravb.h @@ -1050,7 +1050,7 @@ struct ravb_hw_info { void (*rx_ring_free)(struct net_device *ndev, int q); void (*rx_ring_format)(struct net_device *ndev, int q); void *(*alloc_rx_desc)(struct net_device *ndev, int q); - bool (*receive)(struct net_device *ndev, int *quota, int q); + int (*poll)(struct napi_struct *napi, int budget); void (*set_rate)(struct net_device *ndev); int (*set_feature)(struct net_device *ndev, netdev_features_t features); int (*dmac_init)(struct net_device *ndev); diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 4976ecc91cde..c9464c1731b4 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1069,15 +1069,6 @@ static bool ravb_rx_rcar(struct net_device *ndev, int *quota, int q) return boguscnt <= 0; } -/* Packet receive function for Ethernet AVB */ -static bool ravb_rx(struct net_device *ndev, int *quota, int q) -{ - struct ravb_private *priv = netdev_priv(ndev); - const struct ravb_hw_info *info = priv->info; - - return info->receive(ndev, quota, q); -} - static void ravb_rcv_snd_disable(struct net_device *ndev) { /* Disable TX and RX */ @@ -1345,7 +1336,56 @@ static irqreturn_t ravb_nc_interrupt(int irq, void *dev_id) return ravb_dma_interrupt(irq, dev_id, RAVB_NC); } -static int ravb_poll(struct napi_struct *napi, int budget) +static int ravb_poll_gbeth(struct napi_struct *napi, int budget) +{ + struct net_device *ndev = napi->dev; + struct ravb_private *priv = netdev_priv(ndev); + const struct ravb_hw_info *info = priv->info; + unsigned long flags; + int q = napi - priv->napi; + int mask = BIT(q); + int quota = budget; + + /* Processing RX Descriptor Ring */ + /* Clear RX interrupt */ + ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0); + if (ravb_rx_gbeth(ndev, "a, q)) + goto out; + + /* Processing TX Descriptor Ring */ + spin_lock_irqsave(&priv->lock, flags); + /* Clear TX interrupt */ + ravb_write(ndev, ~(mask | TIS_RESERVED), TIS); + ravb_tx_free(ndev, q, true); + netif_wake_subqueue(ndev, q); + spin_unlock_irqrestore(&priv->lock, flags); + + napi_complete(napi); + + /* Re-enable RX/TX interrupts */ + spin_lock_irqsave(&priv->lock, flags); + if (!info->irq_en_dis) { + ravb_modify(ndev, RIC0, mask, mask); + ravb_modify(ndev, TIC, mask, mask); + } else { + ravb_write(ndev, mask, RIE0); + ravb_write(ndev, mask, TIE); + } + spin_unlock_irqrestore(&priv->lock, flags); + + /* Receive error message handling */ + priv->rx_over_errors = priv->stats[RAVB_BE].rx_over_errors; + if (info->nc_queues) + priv->rx_over_errors += priv->stats[RAVB_NC].rx_over_errors; + if (priv->rx_over_errors != ndev->stats.rx_over_errors) + ndev->stats.rx_over_errors = priv->rx_over_errors; + if (priv->rx_fifo_errors != ndev->stats.rx_fifo_errors) + ndev->stats.rx_fifo_errors = priv->rx_fifo_errors; +out: + return budget - quota; +} + +static int ravb_poll_rcar(struct napi_struct *napi, int budget) { struct net_device *ndev = napi->dev; struct ravb_private *priv = netdev_priv(ndev); @@ -1358,7 +1398,7 @@ static int ravb_poll(struct napi_struct *napi, int budget) /* Processing RX Descriptor Ring */ /* Clear RX interrupt */ ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0); - if (ravb_rx(ndev, "a, q)) + if (ravb_rx_rcar(ndev, "a, q)) goto out; /* Processing TX Descriptor Ring */ @@ -2559,7 +2599,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = { .rx_ring_free = ravb_rx_ring_free_rcar, .rx_ring_format = ravb_rx_ring_format_rcar, .alloc_rx_desc = ravb_alloc_rx_desc_rcar, - .receive = ravb_rx_rcar, + .poll = ravb_poll_rcar, .set_rate = ravb_set_rate_rcar, .set_feature = ravb_set_features_rcar, .dmac_init = ravb_dmac_init_rcar, @@ -2585,7 +2625,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = { .rx_ring_free = ravb_rx_ring_free_rcar, .rx_ring_format = ravb_rx_ring_format_rcar, .alloc_rx_desc = ravb_alloc_rx_desc_rcar, - .receive = ravb_rx_rcar, + .poll = ravb_poll_rcar, .set_rate = ravb_set_rate_rcar, .set_feature = ravb_set_features_rcar, .dmac_init = ravb_dmac_init_rcar, @@ -2608,7 +2648,7 @@ static const struct ravb_hw_info ravb_rzv2m_hw_info = { .rx_ring_free = ravb_rx_ring_free_rcar, .rx_ring_format = ravb_rx_ring_format_rcar, .alloc_rx_desc = ravb_alloc_rx_desc_rcar, - .receive = ravb_rx_rcar, + .poll = ravb_poll_rcar, .set_rate = ravb_set_rate_rcar, .set_feature = ravb_set_features_rcar, .dmac_init = ravb_dmac_init_rcar, @@ -2633,7 +2673,7 @@ static const struct ravb_hw_info gbeth_hw_info = { .rx_ring_free = ravb_rx_ring_free_gbeth, .rx_ring_format = ravb_rx_ring_format_gbeth, .alloc_rx_desc = ravb_alloc_rx_desc_gbeth, - .receive = ravb_rx_gbeth, + .poll = ravb_poll_gbeth, .set_rate = ravb_set_rate_gbeth, .set_feature = ravb_set_features_gbeth, .dmac_init = ravb_dmac_init_gbeth, @@ -2990,9 +3030,9 @@ static int ravb_probe(struct platform_device *pdev) goto out_dma_free; } - netif_napi_add(ndev, &priv->napi[RAVB_BE], ravb_poll); + netif_napi_add(ndev, &priv->napi[RAVB_BE], info->poll); if (info->nc_queues) - netif_napi_add(ndev, &priv->napi[RAVB_NC], ravb_poll); + netif_napi_add(ndev, &priv->napi[RAVB_NC], info->poll); /* Network device register */ error = register_netdev(ndev); From patchwork Wed Jan 31 17:05:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 194867 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2032092dyb; Wed, 31 Jan 2024 09:10:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/jNAY5I/HWzlnY3DIiitv9V1EgvorYN4YvVgVNZLgcwYglVQfsYaa+SbyRxYuXMjYM6In X-Received: by 2002:a17:903:41cd:b0:1d9:3e29:88ab with SMTP id u13-20020a17090341cd00b001d93e2988abmr1146443ple.65.1706721025422; Wed, 31 Jan 2024 09:10:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706721025; cv=pass; d=google.com; s=arc-20160816; b=pxcrFrk15yGN0gg7CI/xGmWjL45ShXCQrQTe+q9XY+AyXAgAKxevCWkB9qbW2gEhuT beGv+qAC2y17qKMk4rVFk0ktF2jc0YnBLozJ/rNCKAMzyMG/6CJJoGzJT8GvnrpPMR8s Y22VAOUnLtsCdejvunxmcdA8rt5y92UmX+gC7aAWcf6ql5JUgSid0j6Nnm5wspwvPnFz 0M4F7WEBGckGr+uGdQTy20rq/ikHw6eGkNsh2jZX69xvGRm8oc1Ejb1mTv6X1if0Guhy 5Z9vArqgww8atR3luB/Ww/y6A3biDoDshBpa0qoetVlCpNrgfB8p9eEVlMAda/gna/Gc zvqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=/iqI9wL6i9DIQFLXtAcQwNLXGMipzpGUwqLijhchvCo=; fh=UzOyRbaVRBu/HNDsl4Bnx+Fh2RjENVr7fXCgtmMw3YI=; b=QU2QG7G/zOTED528gjPy2ruBUYxAnyimjd6+UYscnNASsY9+bbwMC8N1oPe7SEtyxC DXsnd77K7TFDcI6T99HgZKFxg65RbMKvq20IKzI7Ub4LRe6sQpaF/b2rNTNjj2T2jmLH CADmqRRUemF5daVF3duRhZprbmJDunsdfLe/Rw/Eq/Q6wMP0KaA5gC3ljke9a2jPEv6b oXnV8pNWHD3/lK1IlhnO1t3PBqQGPItn31VHe7mhpJ9Odt6aZhsvGXz6g7fXmlqmaxVB toHdMZZtFv+YHeieRqU7qyzD1bFiTxrHDZnrAFBZTsEfhL3kWFTgTRXNgY/k/HeCzdff ZLJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46865-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46865-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com X-Forwarded-Encrypted: i=1; AJvYcCV19HFY2SbqVIxrqQ8Zvxo2qlqG/QvmIrCqGiKmZ14By6u0DtI3Uv3mLSXkhG6hwOtVaMl/ZSaF7OzxCFZlzwTI92119w== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 1-20020a170902ee4100b001d8a93ed93esi9021762plo.55.2024.01.31.09.10.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 09:10:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46865-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46865-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46865-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 249D728787B for ; Wed, 31 Jan 2024 17:07:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1286712FF6E; Wed, 31 Jan 2024 17:06:05 +0000 (UTC) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 45F2212C54B; Wed, 31 Jan 2024 17:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720763; cv=none; b=AtufSdndp6l9i5r5gQavEKklXszUJ7oidqFxo/CtlnOMWk3y/0QWZZhDH/CJ0TKsPr/jFV3DSjp5UO4GQo7cWbt0xaZNr/cHq8Kup0nfktEPChFJj9yiW7EwA/wlskcrTcFkw9ryv6eUHAIJG2LcHwNuXaaPuiBoBobzGrA11rc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720763; c=relaxed/simple; bh=Xm80ToVUWKO7Ssi3UnhJlGbnKtKdlIZTdxjYk0JSBdo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ktrq3fxNTzsJ2/lH4HXCc6PUNP0XH4v4bh5z2VxPmaFsbtj8rPBhKQPQ4K79wsyms6JbDgA0vCZAEipS1MWEH7gFn2DV+WnwFl+cR0fD3dyLUFBMWXK5fNpDFhIXI0JuqrtUmR/2UrThLlkgnkk/4ckKhDmEVWuay6AmwmW9Zcs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.05,231,1701097200"; d="scan'208";a="192404880" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 01 Feb 2024 02:05:54 +0900 Received: from GBR-5CG2373LKG.adwin.renesas.com (unknown [10.226.92.158]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 1F16940344F5; Thu, 1 Feb 2024 02:05:50 +0900 (JST) From: Paul Barker To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Paul Barker , Yoshihiro Shimoda , Wolfram Sang , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/8] net: ravb: Simplify GbEth poll & receive functions Date: Wed, 31 Jan 2024 17:05:16 +0000 Message-Id: <20240131170523.30048-3-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> References: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789626705721633353 X-GMAIL-MSGID: 1789626705721633353 We don't need to pass the work budget to ravb_rx_gbeth() by reference, it's cleaner to pass this by value and return the amount of work done. This allows us to simplify the ravb_poll_gbeth() function and use the common `work_done` variable name seen in other network drivers for consistency and ease of understanding. In ravb_rx_gbeth(), we can also drop the confusingly named `boguscnt` variable and use a for loop to iterate through descriptors. This is a pure refactor and should not affect behaviour. Signed-off-by: Paul Barker --- drivers/net/ethernet/renesas/ravb_main.c | 25 ++++++++++-------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index c9464c1731b4..5a6a2a7a9e7a 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -822,7 +822,7 @@ static struct sk_buff *ravb_get_skb_gbeth(struct net_device *ndev, int entry, } /* Packet receive function for Gigabit Ethernet */ -static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q) +static int ravb_rx_gbeth(struct net_device *ndev, int budget, int q) { struct ravb_private *priv = netdev_priv(ndev); const struct ravb_hw_info *info = priv->info; @@ -831,28 +831,24 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q) struct sk_buff *skb; dma_addr_t dma_addr; u8 desc_status; - int boguscnt; u16 pkt_len; u8 die_dt; int entry; int limit; + int i; entry = priv->cur_rx[q] % priv->num_rx_ring[q]; - boguscnt = priv->dirty_rx[q] + priv->num_rx_ring[q] - priv->cur_rx[q]; + limit = priv->dirty_rx[q] + priv->num_rx_ring[q] - priv->cur_rx[q]; stats = &priv->stats[q]; - boguscnt = min(boguscnt, *quota); - limit = boguscnt; + limit = min(limit, budget); desc = &priv->gbeth_rx_ring[entry]; - while (desc->die_dt != DT_FEMPTY) { + for (i = 0; i < limit && desc->die_dt != DT_FEMPTY; i++) { /* Descriptor type must be checked before all other reads */ dma_rmb(); desc_status = desc->msc; pkt_len = le16_to_cpu(desc->ds_cc) & RX_DS; - if (--boguscnt < 0) - break; - /* We use 0-byte descriptors to mark the DMA mapping errors */ if (!pkt_len) continue; @@ -949,9 +945,7 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q) desc->die_dt = DT_FEMPTY; } - *quota -= limit - (++boguscnt); - - return boguscnt <= 0; + return i; } /* Packet receive function for Ethernet AVB */ @@ -1344,12 +1338,13 @@ static int ravb_poll_gbeth(struct napi_struct *napi, int budget) unsigned long flags; int q = napi - priv->napi; int mask = BIT(q); - int quota = budget; + int work_done; /* Processing RX Descriptor Ring */ /* Clear RX interrupt */ ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0); - if (ravb_rx_gbeth(ndev, "a, q)) + work_done = ravb_rx_gbeth(ndev, budget, q); + if (work_done == budget) goto out; /* Processing TX Descriptor Ring */ @@ -1382,7 +1377,7 @@ static int ravb_poll_gbeth(struct napi_struct *napi, int budget) if (priv->rx_fifo_errors != ndev->stats.rx_fifo_errors) ndev->stats.rx_fifo_errors = priv->rx_fifo_errors; out: - return budget - quota; + return work_done; } static int ravb_poll_rcar(struct napi_struct *napi, int budget) From patchwork Wed Jan 31 17:05:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 194864 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2030711dyb; Wed, 31 Jan 2024 09:08:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpA5XNAm9/8Z+p5ItSPkpuvnDSZuxe30AEbqm1wq+9q24ZUgp/Oeq9OsJd0lXxvjHbi+0R X-Received: by 2002:a05:6214:1c0d:b0:686:ad1a:ecb7 with SMTP id u13-20020a0562141c0d00b00686ad1aecb7mr2914522qvc.42.1706720915351; Wed, 31 Jan 2024 09:08:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706720915; cv=pass; d=google.com; s=arc-20160816; b=egx+De7Ywawgi5dyc29uGq0CcddN7zsC61g7T+eul7h1lUKC0H3uO60jxExScGf5VP Db9GnOvfUwQmNSbYgfV6VRqqhnea2Y1MyzrQf4KAW6ivcn73ZW3xA7BO2l3Npi39mT+Z Q/GM73qq7YRpW7BioGU/d2adr22PRXfRNFRt+CFG9HPYCfbAwfplGVDZLEFiOCNlWpt6 1UAOY/6cNlOZuI8s5Lkx1cv1up16Gb4NOfxRsUGMuFukkq8xUS5/yPB7g0iZ8IU5U3w+ 7T46oixpKtqWesO39vH7rRjdL89P1Gjkyt7uz6tyjsHKkNpn59UL1MDHoF45n2wwOk2V L2gA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=IkvhI6vtPfiPln4tUcqH80fwSanMFUL9bEC5Xw22hss=; fh=0YgRbyAws+XycBLlV0kAqAVxxVGMZC6xr8Y0JMYfbK0=; b=cYUR3IjOidNwD5Cq21m1YGeNMQiLf45LhzeOsctXOfsOky0Tu6XCUtkwPRX4rMjfqH HjYQtlZyGF+BtKd3zWmLmCQ0pggjFpRi7VmeaMwhrNCzgPhvPaYjyXGyE4wACT3Y25nM l+GW1H7DQQwueWO2mvFGbwqs79IOumhe/dT+l6gAazuhDEVKdRk710y1wkzIHLlIsWgm jDd56eTBYV+v2+t5MYgJ4ff+xZaMefW/le7z/fccR64sB2/zMBa/lkqDMGbUz8+Ez1z6 Zrkd7qpt0qB7qSC0APEgPUgyoLWN7KTX8lFyy8rT6qM3Ygv2lHhAxLAPLn4sq33t0bXq p1fQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46864-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46864-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com X-Forwarded-Encrypted: i=1; AJvYcCWAklA/WALTm5hF7/1QFPPKOVlmYz0jxTEa/bX+CsHycfM1R5b04VXkdQ0chUcy3FCePa3aU11Rz1KzPaDh6U6MLMS6EQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id z19-20020a0cf013000000b0068c71536ed4si501924qvk.41.2024.01.31.09.08.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 09:08:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46864-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46864-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46864-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 77A0D1C260B1 for ; Wed, 31 Jan 2024 17:07:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B0F7012F5A3; Wed, 31 Jan 2024 17:06:03 +0000 (UTC) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D72112DD9A; Wed, 31 Jan 2024 17:05:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720762; cv=none; b=RGWi46HY2bdvT9Xlcwa81JwBuMTN5mr9dP8vUhm8+1X0ZTwV2GoN5F2iYrnQ/p+XagR5lTkygfWMKCJC13iWI/ffTs8nszesvich38nPrJYoscHC/jKNNuNisRdQnzI4CeZW1FHgcdfie/2eTdYDV37sHvnOUaCT0Z+/d3vN0e0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720762; c=relaxed/simple; bh=jP6QldFPdAD5uJhr8/CvILmn76QiLrkdjUHamTufTEg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=u44YTGBxqAosyROGTUnaPO8YXTuK4jRv/OCXiJ2oerhq8PMs19TNnpJf7NACUypBlHngEmIfzRejiMk5eWiUhbPPMGHfeRxN7yMHZDJL/0IinglrU8xAatUqCxzkFH2Ar5JrqfLwND7gitD6euAhN6/Lmzben62w1EsJ6T7NUuY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.05,231,1701097200"; d="scan'208";a="196315527" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Feb 2024 02:05:58 +0900 Received: from GBR-5CG2373LKG.adwin.renesas.com (unknown [10.226.92.158]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 4A7EE40344F5; Thu, 1 Feb 2024 02:05:55 +0900 (JST) From: Paul Barker To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Paul Barker , Yoshihiro Shimoda , Wolfram Sang , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/8] net: ravb: Count packets in GbEth RX (not descriptors) Date: Wed, 31 Jan 2024 17:05:17 +0000 Message-Id: <20240131170523.30048-4-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> References: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789626590515673349 X-GMAIL-MSGID: 1789626590515673349 The units of "work done" in the RX path should be packets instead of descriptors, as large packets can be spread over multiple descriptors. Signed-off-by: Paul Barker --- drivers/net/ethernet/renesas/ravb_main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 5a6a2a7a9e7a..077c189bcc6f 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -830,6 +830,7 @@ static int ravb_rx_gbeth(struct net_device *ndev, int budget, int q) struct ravb_rx_desc *desc; struct sk_buff *skb; dma_addr_t dma_addr; + int rx_packets = 0; u8 desc_status; u16 pkt_len; u8 die_dt; @@ -841,9 +842,8 @@ static int ravb_rx_gbeth(struct net_device *ndev, int budget, int q) limit = priv->dirty_rx[q] + priv->num_rx_ring[q] - priv->cur_rx[q]; stats = &priv->stats[q]; - limit = min(limit, budget); desc = &priv->gbeth_rx_ring[entry]; - for (i = 0; i < limit && desc->die_dt != DT_FEMPTY; i++) { + for (i = 0; i < limit && rx_packets < budget && desc->die_dt != DT_FEMPTY; i++) { /* Descriptor type must be checked before all other reads */ dma_rmb(); desc_status = desc->msc; @@ -876,7 +876,7 @@ static int ravb_rx_gbeth(struct net_device *ndev, int budget, int q) if (ndev->features & NETIF_F_RXCSUM) ravb_rx_csum_gbeth(skb); napi_gro_receive(&priv->napi[q], skb); - stats->rx_packets++; + rx_packets++; stats->rx_bytes += pkt_len; break; case DT_FSTART: @@ -906,7 +906,7 @@ static int ravb_rx_gbeth(struct net_device *ndev, int budget, int q) ravb_rx_csum_gbeth(skb); napi_gro_receive(&priv->napi[q], priv->rx_1st_skb); - stats->rx_packets++; + rx_packets++; stats->rx_bytes += pkt_len; break; } @@ -945,7 +945,8 @@ static int ravb_rx_gbeth(struct net_device *ndev, int budget, int q) desc->die_dt = DT_FEMPTY; } - return i; + stats->rx_packets += rx_packets; + return rx_packets; } /* Packet receive function for Ethernet AVB */ From patchwork Wed Jan 31 17:05:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 194868 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2032281dyb; Wed, 31 Jan 2024 09:10:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhxuZ43XtPfJAXjr932JLLXtjfeCGh8NhVnKxKEGmIxqaGCOsYIQmRV/LppFuvfDLodhkM X-Received: by 2002:a05:6a20:5182:b0:19c:9a9a:2a7e with SMTP id j2-20020a056a20518200b0019c9a9a2a7emr1716175pzf.61.1706721039343; Wed, 31 Jan 2024 09:10:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706721039; cv=pass; d=google.com; s=arc-20160816; b=fvAeNk/+jIci1FjF8mJ+MKij3wqqwfMCvbt0jyAPd0tCEvbNyvTiybOsSdCmdk05v+ cFApc96X7aRsuTKkFEpUjUv+Is+QA/ZMkPsBLNish8s3tw+5HksZpGYhlXydAw7zkyJo 5vrrsrANBU9mkKDYHVlyvyY7Je/8nRP0Gp118hHDU6cyXhJQQjUrqX+/pgytuuZa8WP7 xz7ZkYo+vIocD8vrBLFVUzYN5ulcWxQtqAhYc7b6Lq7YtKkIslWvrwpok6gl6YNa16jO m3Zdeq2TOfbQ+Ar6V7dRr6C1XegZP20ZsseRIH+KM0YCNIRcCSOkxs3MxX3KpT2pnsQ7 1IBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=IHPM0PqTvzRWPqX9nw1RspBAUOZ1xC22nMm5upmOPMs=; fh=iqAajZ2+e8Qeao00JZcayMij89nrO0sjLG5z027KPQw=; b=idjpp5vPSO2tzQIzduaEg3wXCuEwyOWap9FZf3dGQuUM391j7MaP2ZJIFPu4X/XCgo oqDI/RtKl5wZj7mZPh3+edO+9mMXfTaBr5679ab0VJL5gX/wP/lKXQwNvaJbhrLk/YgB cDSHZTe9sPf8psiEfWOHbQyE/DHXotHEhSGmso2UClFZFAUGZzB4SPunDjfuC86FrB0O uMWI5NQnwBuCXfTo03lG5poln0f8AKun6Enw/lgh9CsIRC16w+Tl1zfiwSI6s05M4CYK uy6aA4XFAtqxt7S27tWlL6eFOR9YcM2OmbJAA2hc7Z+8ng7GdDio7XuAUPM39OdQ+w/H Lbmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46866-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46866-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com X-Forwarded-Encrypted: i=1; AJvYcCWtBo1EgRW12vjPuUNf4Zv/+p3Wxd5Tc2Bp8jIZ5eXAhoBB4fBNJMCq6nUBWRyCmDXnoz+hU9nA3sc5w/89pJ0jlSxSLw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x20-20020a17090aa39400b00290a6a5dd08si1603659pjp.144.2024.01.31.09.10.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 09:10:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46866-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46866-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46866-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AD6CF28A9C1 for ; Wed, 31 Jan 2024 17:07:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB806131E49; Wed, 31 Jan 2024 17:06:06 +0000 (UTC) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C8FD12C539; Wed, 31 Jan 2024 17:06:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720765; cv=none; b=iOtmyN/0tHfJRBFDCcQYC59Ei4E5pzwLujs381fTRpnubc3pyhuc/8kNsFivWbMNnpydy1ypMFNVwbaj6LmD9HGwNkE+e0QefBm1x9mjbl+VR6PTxW7YEL6Swm0IKZPF6ZbJZlK4KZWLtjCjxrTr3YCB2CO/xSpt/VosaZTCyys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720765; c=relaxed/simple; bh=mvngnWhUGFgDKAimI+Ks/pS3pEFP764zRzb5IWxzsLU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XO+6qYdeew1F24THDOJuzp84Xr1HlaLzHQy5+WshAMjEolSPKBshv3LV6hcGYTS6v+3Ophnd+dhi9meUNvV1ZRsqDi3uFqZRW2lrBJuQ4h2qds7dHXym7dyRumRCcQqENNjXN5Mz37qKPJR+tB3UOw+ftLMuJtMcRThuEUBEM8A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.05,231,1701097200"; d="scan'208";a="196315533" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Feb 2024 02:06:03 +0900 Received: from GBR-5CG2373LKG.adwin.renesas.com (unknown [10.226.92.158]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 760E440344FE; Thu, 1 Feb 2024 02:05:59 +0900 (JST) From: Paul Barker To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Paul Barker , Yoshihiro Shimoda , Wolfram Sang , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/8] net: ravb: Always process TX descriptor ring in GbEth poll Date: Wed, 31 Jan 2024 17:05:18 +0000 Message-Id: <20240131170523.30048-5-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> References: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789626720280218500 X-GMAIL-MSGID: 1789626720280218500 The TX queue should be serviced each time the poll function is called, even if the full RX work budget has been consumed. This prevents starvation of the TX queue when RX bandwidth usage is high. Signed-off-by: Paul Barker --- drivers/net/ethernet/renesas/ravb_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 077c189bcc6f..9b0ed269e69b 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1345,8 +1345,6 @@ static int ravb_poll_gbeth(struct napi_struct *napi, int budget) /* Clear RX interrupt */ ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0); work_done = ravb_rx_gbeth(ndev, budget, q); - if (work_done == budget) - goto out; /* Processing TX Descriptor Ring */ spin_lock_irqsave(&priv->lock, flags); @@ -1356,6 +1354,9 @@ static int ravb_poll_gbeth(struct napi_struct *napi, int budget) netif_wake_subqueue(ndev, q); spin_unlock_irqrestore(&priv->lock, flags); + if (work_done == budget) + goto out; + napi_complete(napi); /* Re-enable RX/TX interrupts */ From patchwork Wed Jan 31 17:05:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 194882 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2051071dyb; Wed, 31 Jan 2024 09:40:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IGiPJf2dK50F5VOcppojLyR62NJvuezIaROMFlvrlJcYuumQrDQRzL2F3kx79wpQH9cR6nM X-Received: by 2002:a05:6830:194:b0:6e1:3a8a:2bfd with SMTP id q20-20020a056830019400b006e13a8a2bfdmr2286943ota.41.1706722838139; Wed, 31 Jan 2024 09:40:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706722838; cv=pass; d=google.com; s=arc-20160816; b=cTz/rUiqlUI1SA0MJlKNIm/q7msHVTajqftfl7hOYUEZp1xo1APtUtIHvr17JOcD+S 8mD3aBW7RbMQSXzATI8VpKIUiMfQjJZqhrfTaqyOPhxIWfGXaCcjIrX6jFU70gAAH7AU dTOm6pwltKu81g1jDNHnbpjNldNaIUuRt+ZWxnjdWvlS12tH8BMFEUMMMGH5V+caQaV3 Ph9WyrfwZwbdWumnyvkjhxAqYCOKCzm3lZ/kZHi7Ulo4evZBFjmMOx+wfDpZl8RD15xM cbpU739WDdO94RvOk6lXgrDoPVuGQVRqH/H0chjRAmkVfqFt8psU7t8XJ5blf91fgC4k Uu/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=n/9orxaBsjBurGM1KlERWMW0UeB72CWDLR6d+4npC6s=; fh=YyZIDkBHNu6ovRgIzM9cNJ5VQJM0Fz//juTv22VcN2A=; b=yHpu4esR4AUbcSZRRMQR5IQk/dbxG4/4xzBPTEC/Q2FwURxw4x+U+Vb8c7mN2021wa jlR9m2iEbHIRYc9axnPBKVLS0lRukR83bitbPhpI0Dt8PCmYR2CwJKC9QTF3NsMwkqJN IOMGwt4KzMyis8z9uPuf4DvsKtMkQyGHWirQcMhQA93+kFUStHhr+2IsipQgOFEGxJm6 Qm/5aGOcHxo4S4VKurL316wuLRWCMQFpOVZ5R7LFHnOZRUEp2MXVK4tCeTefVgAUv8bL 4oJE4UHlQuT1BYc0pKN/5cOXjrGNzr+jFo+EknZUglC+1GH0jDJ+hn4UwX1lXUH3fMbi ++Dg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46867-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46867-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com X-Forwarded-Encrypted: i=1; AJvYcCWnhSJTYXCr+JmRRGM/NNXNkK4BLopgvlrTWNFjbNN+lcvhA+C5wYoz4UvUe+r3d7JVXAiAXM4snHyC2tPb359RSH7ruA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l2-20020a656802000000b005cd89d9fb14si3456122pgt.357.2024.01.31.09.40.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 09:40:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46867-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46867-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46867-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 02517B2D58C for ; Wed, 31 Jan 2024 17:08:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B186136666; Wed, 31 Jan 2024 17:06:11 +0000 (UTC) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CF3812C539; Wed, 31 Jan 2024 17:06:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720769; cv=none; b=RDjnVz2Wp9veKKl4VKxk2stvSAZZvTeUH0LZ4/T7GtsLw5Ac8aC7AsvW6yXYqVEnS/ka4dmwNwHT5bsadEBou4H7royPkzfk1AclZyHhsIK5OoX0kwKvVbZCHgMViIMp2spLfPnqlRRLfK4loOqynktoW/dFfNaIYsPmlmTs/9U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720769; c=relaxed/simple; bh=jDaoRchUeMb3jhh/QTDuC4oc5ie9+ahUDA1P+pGYTO4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ev/IOwYXBWa8RCPTcDXaiHxVuQoTTuBka22JMTiHtAHCM+PEM5rKwK92tfoTY1xcpvFLMeLF4VFJD5BeQxq9STvxUrQCYX0ajLc8WSPvbaYLidRl9oHwmvl1waVxfYBEFD1jcUvZyTpe4DkhnUaM0Hjl/bTCpSdfWpUcZE8Dtt8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.05,231,1701097200"; d="scan'208";a="192404892" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 01 Feb 2024 02:06:07 +0900 Received: from GBR-5CG2373LKG.adwin.renesas.com (unknown [10.226.92.158]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id A1E50403490C; Thu, 1 Feb 2024 02:06:03 +0900 (JST) From: Paul Barker To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Paul Barker , Yoshihiro Shimoda , Wolfram Sang , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/8] net: ravb: Always update error counters Date: Wed, 31 Jan 2024 17:05:19 +0000 Message-Id: <20240131170523.30048-6-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> References: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789628607086426329 X-GMAIL-MSGID: 1789628607086426329 The error statistics should be updated each time the poll function is called, even if the full RX work budget has been consumed. This prevents the counts from becoming stuck when RX bandwidth usage is high. This also ensures that error counters are not updated after we've re-enabled interrupts as that could result in a race condition. Also drop an unnecessary space. Signed-off-by: Paul Barker --- drivers/net/ethernet/renesas/ravb_main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 9b0ed269e69b..a90e70b25875 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1354,6 +1354,15 @@ static int ravb_poll_gbeth(struct napi_struct *napi, int budget) netif_wake_subqueue(ndev, q); spin_unlock_irqrestore(&priv->lock, flags); + /* Receive error message handling */ + priv->rx_over_errors = priv->stats[RAVB_BE].rx_over_errors; + if (info->nc_queues) + priv->rx_over_errors += priv->stats[RAVB_NC].rx_over_errors; + if (priv->rx_over_errors != ndev->stats.rx_over_errors) + ndev->stats.rx_over_errors = priv->rx_over_errors; + if (priv->rx_fifo_errors != ndev->stats.rx_fifo_errors) + ndev->stats.rx_fifo_errors = priv->rx_fifo_errors; + if (work_done == budget) goto out; @@ -1370,14 +1379,6 @@ static int ravb_poll_gbeth(struct napi_struct *napi, int budget) } spin_unlock_irqrestore(&priv->lock, flags); - /* Receive error message handling */ - priv->rx_over_errors = priv->stats[RAVB_BE].rx_over_errors; - if (info->nc_queues) - priv->rx_over_errors += priv->stats[RAVB_NC].rx_over_errors; - if (priv->rx_over_errors != ndev->stats.rx_over_errors) - ndev->stats.rx_over_errors = priv->rx_over_errors; - if (priv->rx_fifo_errors != ndev->stats.rx_fifo_errors) - ndev->stats.rx_fifo_errors = priv->rx_fifo_errors; out: return work_done; } From patchwork Wed Jan 31 17:05:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 194865 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2030998dyb; Wed, 31 Jan 2024 09:08:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IH4jQteOMfNFh8A8d0KiqdOprXtj3+NzyWn4bpk/9eR0FcYZbrnIYCoG27OF/uaJSWD6poF X-Received: by 2002:a17:906:4f0a:b0:a35:de06:23f1 with SMTP id t10-20020a1709064f0a00b00a35de0623f1mr1516824eju.0.1706720939471; Wed, 31 Jan 2024 09:08:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706720939; cv=pass; d=google.com; s=arc-20160816; b=bfGghb/HqQdtXOETW2j1cqREQG9yHDAxYPartWTV7mP9qbtY0OwnP3a6/NFLNqLoME B4jiTPagCICxMSebvdVqD7q1FY3dTftxUeQbi8SEnQiYsSJ1eEF99CMzC3Lfxh5KXb/g uI18/d4Pk0yJgJ5E8PFdSvDEJWGpN28eklUm55gxmkbnWiKaM4iV5NavFdLEbv0IKhME eE1AdXbFJGO3BfZAh0Vopzz9NoNiAH1Y0L5MOskWpt5TdzR9V2BLSFOksdl1C5wZXOZ7 xVYUzM1LdRqx6+cVvCf36pMChFK3vnWHTXZM/zdgFrNiuOr9JwaLrZ8SdJ7+vkFABYkf gv8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=f5TyMU74VJHcMlxN6wPFUQAAvDmFWv443Th+PifQ9nM=; fh=nwi+t7QQfTtXe4vzvfV2yvk2qlH+37kE6rjzauuINDU=; b=vuwzLCFCio8A+NkFHv3wEflwf12WRuQ49IETO4YJs/bIfA3htQA5m8BrHj5xeN1cTU q3i4fbimQzv9kf0f1hDQEGLKvlCDCzBZk0CetN9PSVno9F2APMwo2wEj8B3zCmf0amU/ AHn4EjZpSXGUmlNN2wRS+KFjlCuGg5p38kyZkdgkr6Co8QvWiP9wU3ui7WXlD8BwDOVM Y9PLk7yG24DiLL+LajcDIvmDQl++ot2NWfEw1DtYuG1leE/xHkfOuXEjsRyzCQyGlExM xutHucmMJlW4oSqYOdY9uMxdjgPFgIVaJXtDCPpFNIMlQj7nLO0J00Ffi/C9Fxnws/P7 fVCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46869-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46869-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com X-Forwarded-Encrypted: i=1; AJvYcCVjzIXHY1M98NP84lX4Msxl0+kNfIMDlCscCA+vdEYpf86KWPcFMftJ/EZBxsGP37y5MsC2vHSncHXZ9B1hJEUloig/Zw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gf14-20020a170906e20e00b00a352afb106bsi4972113ejb.239.2024.01.31.09.08.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 09:08:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46869-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46869-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46869-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 195191F22B06 for ; Wed, 31 Jan 2024 17:08:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C972013AA53; Wed, 31 Jan 2024 17:06:15 +0000 (UTC) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69F33137C5B; Wed, 31 Jan 2024 17:06:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720774; cv=none; b=uoX33JkQQyLKUQTcfBuKYfAT/wC3gr1Npf+gly5z+9CHkxQ7/txQDPPKcBjYFnYCtj2dvw6UtoSyuKp7X47fVsIJme6Ec9C8HgO2eYg0cLyiwVu302fN4McgV0XahjMSUgawLlEzU3ZxsJTJkoDmcIYWYKdDrSOyT+g1tgEWDc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720774; c=relaxed/simple; bh=Xmw9KV3Egdvfg0TUeQfDphSDxUXsZykmY75UH/aGsXc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Zg7AKqvopXKiqghYFlym6RmRWJDczcXfvCZHTUb6lelnxKIGamCl9kGhWxml7+UKIriyi0X/9vhBcSxUHRCKfknNfyP9a+2vFWrPm3IA4hm5U4rpvSzXUOgUViumKoY5tFzwFZNtJApmYYZ7uUOIflRBEYMNRU7WssDzHyAr2j8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.05,231,1701097200"; d="scan'208";a="196315544" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Feb 2024 02:06:11 +0900 Received: from GBR-5CG2373LKG.adwin.renesas.com (unknown [10.226.92.158]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id D134440344FE; Thu, 1 Feb 2024 02:06:07 +0900 (JST) From: Paul Barker To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Paul Barker , Yoshihiro Shimoda , Wolfram Sang , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 6/8] net: ravb: Align GbEth poll function with NAPI docs Date: Wed, 31 Jan 2024 17:05:20 +0000 Message-Id: <20240131170523.30048-7-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> References: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789626615395886930 X-GMAIL-MSGID: 1789626615395886930 Call napi_complete_done() in accordance with the documentation in `Documentation/networking/napi.rst`. Signed-off-by: Paul Barker --- drivers/net/ethernet/renesas/ravb_main.c | 26 ++++++++++-------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index a90e70b25875..c3a5e4bb61f9 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1363,23 +1363,19 @@ static int ravb_poll_gbeth(struct napi_struct *napi, int budget) if (priv->rx_fifo_errors != ndev->stats.rx_fifo_errors) ndev->stats.rx_fifo_errors = priv->rx_fifo_errors; - if (work_done == budget) - goto out; - - napi_complete(napi); - - /* Re-enable RX/TX interrupts */ - spin_lock_irqsave(&priv->lock, flags); - if (!info->irq_en_dis) { - ravb_modify(ndev, RIC0, mask, mask); - ravb_modify(ndev, TIC, mask, mask); - } else { - ravb_write(ndev, mask, RIE0); - ravb_write(ndev, mask, TIE); + if (work_done < budget && napi_complete_done(napi, work_done)) { + /* Re-enable RX/TX interrupts */ + spin_lock_irqsave(&priv->lock, flags); + if (!info->irq_en_dis) { + ravb_modify(ndev, RIC0, mask, mask); + ravb_modify(ndev, TIC, mask, mask); + } else { + ravb_write(ndev, mask, RIE0); + ravb_write(ndev, mask, TIE); + } + spin_unlock_irqrestore(&priv->lock, flags); } - spin_unlock_irqrestore(&priv->lock, flags); -out: return work_done; } From patchwork Wed Jan 31 17:05:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 194871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2033010dyb; Wed, 31 Jan 2024 09:11:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhRufSwj4miB2lcaXv8jSMvPvV7hy4cRArbrSGBcSbE20TggkI2+8afqySNY1eiZAcL1uy X-Received: by 2002:a05:6358:15ce:b0:178:9cd1:daa0 with SMTP id t14-20020a05635815ce00b001789cd1daa0mr2432649rwh.4.1706721095246; Wed, 31 Jan 2024 09:11:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706721095; cv=pass; d=google.com; s=arc-20160816; b=rG3dqV3j4aQpfGaszEZTUzS9vURsEgjfiNwvN5PwwD2uOAWr+gXEvMEVVwSrPaRpM/ T6vp80vdn0S/R7iHYUzCqFBB7ladgKqB9U+nfDusLk+d+PL1Q6N26UEx8fC2Migv6wc9 +i72Bq4CfS838GQv/pXS4ArGyZp7aX721Q8J0uDSVnv+buYaFAEg2sa5dMqAMAtWeq37 abAukPfgePaNJHROGd+Rr/tDZ6Np65iBdESCU4qyCHfX79jc/x5EAi1kjOUvhlIfdUei eVoWErrlNcBTzxA0y0Tki3UuVS1A8qUsOzeZQoHusjG70V6jrfRHP3O3o94exZxbuOm6 LmrA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=I4QjJJS90tiunJGtZ79WmudbdYSCoxP0UsrJqwugfcU=; fh=uHrGeOdetHdsKln0mAqMRyEaecJBod3mLbR9q2tpjqI=; b=ZakW/ZO8y22N0bLzk+CrFnmggR4HStePdb9wQg5GtuWC/HWYW0QLt1M1zCHUkYO+N2 TNqqVvHS+ibFevXj+tD967JXKg9/uK8nFQBRMEPCMDsMOXCZ43MiLjivmcrAF60KtyQj 2qkFvq9STq63eFL0Yp2PjWu2cZ/aZlOUsOcNqLVJSbSyWippcy2MnKnjjJ/nTUoK8DYT S3xLBZ/lQKvKtFKVKvk6RffShMbbHuC7wV96BACCy6/TgtSexuhuxOiGNZ+524Ewr4WQ kdktVro5L62MLb4TODz1WQGjdhf5VrgluQpbq6rPTkamWCuXFSGHVk7J8ZSo275p61xr pg3w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46870-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46870-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com X-Forwarded-Encrypted: i=1; AJvYcCUWeWaa0QF/VEKSRqGbB277eHQirnV7vNzjAKVMecPrazujla3BI7yBYsdtH2ryS0gVlZWPO6LHr71QPkAPierSHrXJkg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q18-20020a656852000000b005d8c55c031dsi6698406pgt.345.2024.01.31.09.11.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 09:11:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46870-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46870-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46870-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0C5D8294FF3 for ; Wed, 31 Jan 2024 17:09:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A871313BE8A; Wed, 31 Jan 2024 17:06:19 +0000 (UTC) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 048C413AA57; Wed, 31 Jan 2024 17:06:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720778; cv=none; b=a74aVr7naPU6y1ByxqrB6cqNGV6aEAbeGsGW9mE95Y/e/nJmo+Y7CxAg/PLrxo2lBeR/M/FaMh8oGZehDnHrmMgM04fwVWHmp9vQF9wjqUvjx8RwyVJZFt42dvvutGUCRNlRJ5D+WtKgWvGpfX56EeYwzweFAJzbSiYLd74/2GU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720778; c=relaxed/simple; bh=+zP2Yfb+XDrqENpMYSAPO48dniuvwW7PYMvOK0s1V/Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WVesUzeCeuIlCLiHxTd4pLBANfXDFi53Jq0NlH/0rfDCZQ/22C4rWtpaHFJ/lPh4nNRIgCTJ6pWoq8fnRIKq9X0raywry/2d2FSoOfSYTTEqElFZiZf/f9cBSKOw82+J3tNZcwbfjvqTTXHvNvo/u0VHGSstw/MT9A3pN/xR19w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.05,231,1701097200"; d="scan'208";a="196315550" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Feb 2024 02:06:15 +0900 Received: from GBR-5CG2373LKG.adwin.renesas.com (unknown [10.226.92.158]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 0D61440344FE; Thu, 1 Feb 2024 02:06:11 +0900 (JST) From: Paul Barker To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Paul Barker , Yoshihiro Shimoda , Wolfram Sang , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 7/8] net: ravb: Enable SW IRQ Coalescing for GbEth Date: Wed, 31 Jan 2024 17:05:21 +0000 Message-Id: <20240131170523.30048-8-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> References: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789626779132900195 X-GMAIL-MSGID: 1789626779132900195 Software IRQ Coalescing is required to improve network stack performance in the RZ/G2L SoC family and the RZ/G3S SoC, i.e. the SoCs which use the GbEth IP. For the RZ/G2L, network throughput is comparable before and after this change. CPU usage during TCP RX testing dropped by 6.5% and during UDP RX testing dropped by 10%. For the RZ/G2UL, network throughput is generally increased by this change (results obtained with iperf3): * TCP TX: 2.9% more throughput * TCP RX: 1.1% more throughput * UDP TX: similar throughput * UDP RX: 41500% more throughput For the RZ/G3S we see improvements in network throughput similar to the RZ/G2UL. The improvement of UDP RX bandwidth for the single core SoCs (RZ/G2UL & RZ/G3S) is particularly critical. Signed-off-by: Paul Barker --- drivers/net/ethernet/renesas/ravb.h | 1 + drivers/net/ethernet/renesas/ravb_main.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h index 9e9cf0d36d72..da2c09b14389 100644 --- a/drivers/net/ethernet/renesas/ravb.h +++ b/drivers/net/ethernet/renesas/ravb.h @@ -1078,6 +1078,7 @@ struct ravb_hw_info { unsigned nc_queues:1; /* AVB-DMAC has RX and TX NC queues */ unsigned magic_pkt:1; /* E-MAC supports magic packet detection */ unsigned half_duplex:1; /* E-MAC supports half duplex mode */ + unsigned needs_irq_coalesce:1; /* Requires SW IRQ Coalescing to achieve best performance */ }; struct ravb_private { diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index c3a5e4bb61f9..483993ec25ba 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2684,6 +2684,7 @@ static const struct ravb_hw_info gbeth_hw_info = { .tx_counters = 1, .carrier_counters = 1, .half_duplex = 1, + .needs_irq_coalesce = 1, }; static const struct of_device_id ravb_match_table[] = { @@ -3028,6 +3029,9 @@ static int ravb_probe(struct platform_device *pdev) if (info->nc_queues) netif_napi_add(ndev, &priv->napi[RAVB_NC], info->poll); + if (info->needs_irq_coalesce) + netdev_sw_irq_coalesce_default_on(ndev); + /* Network device register */ error = register_netdev(ndev); if (error) From patchwork Wed Jan 31 17:05:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 194873 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2033205dyb; Wed, 31 Jan 2024 09:11:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGAkQKWxKJ3jWCArwNGakPu0ANqpaH+mRRmWcTxtQbcOUfm2Z6nEVTIMJIUQhFlr6VJRkj2 X-Received: by 2002:a05:6830:2056:b0:6e0:efa7:8066 with SMTP id f22-20020a056830205600b006e0efa78066mr2135935otp.45.1706721110619; Wed, 31 Jan 2024 09:11:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706721110; cv=pass; d=google.com; s=arc-20160816; b=PyHvlAXalR7kedQJEfaXWY+85AH8lg+LqSB6sxMrLVwdqzNaduJHnLzO2vovlYLz6h +/Zapz271Hj9VifgdfDpKkUr+Qjx0sqpHfsIyYhdgf1Ww+Ph4K2HOpJ/UaHR37pFln7/ fGMddFpuYBYLCQEDIrfG6A+ezJESmBGt25iJioI/UJEKCUn8eCYn/27A/OTisS205trG P3k2SX5lYwRuD0Y8tWO/wIyJq6a7OIgojl7my+2jcR7DjtIqoyzdvwo9J8UD48sBUwvX 7zSRmtY06eUcTgru4Qt8CXyUE9XpEePgIeqGoitIKspkTzLb4mLoZVELMa58Gh228XEN HBwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=HO00wyyC5NX6XMCQeBKV1qKVzgaiUJJr6XlRbWnm6r0=; fh=91BCUBzkkv//MRFIRqCS1mvUaTmKVNEWY8k2Bez40RA=; b=MMpV7HqAZr5qWVswIX7typ8U3/uXfwpahLuBrHbjtuCPAFhcaPTDc/AvxgrkVJsfGB 126ABYTCLeo1exTfp/fYrXYZfEFJ04+vSGlBUnj2DDjlQAa9iiH6DdqTAUDG+82UVDpo c+Gp/64KDwHWXDl9SWpY03wEwgQVTIxuIXuptepjdwsXkbgcWB9jm6cY71b7X7dui9H5 +9vKswDlf8UjIHstcYcp8H5n0dXrDVNDRpP5MxpuFPEFqxkOyIdBLT7miUJUdi9tPrFx J4Er16OrzHtOWTlyut6r1DK3t9YaOHaRrFBNARZ9NObpI3Txair/NP1fehA4xggbFuem iwgQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46871-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46871-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com X-Forwarded-Encrypted: i=1; AJvYcCWrnGirWyaDkVBvz9pUYryvMsBSflgjJIk5GLLhjYO5DG3/Iwrlvw8zFcufq+N11z4A+BHMEamp1ZRPxluOt35qvzfqpg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id w128-20020a636286000000b005cdffe22101si7882203pgb.444.2024.01.31.09.11.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 09:11:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46871-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=bp.renesas.com dmarc=pass fromdomain=bp.renesas.com); spf=pass (google.com: domain of linux-kernel+bounces-46871-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46871-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8A7162951AB for ; Wed, 31 Jan 2024 17:09:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E31213BEB9; Wed, 31 Jan 2024 17:06:23 +0000 (UTC) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 099C013BE92; Wed, 31 Jan 2024 17:06:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720781; cv=none; b=iTzETLdQ/DH/g/VF4PAZkUJfaS1HtnZdkIAN1r1bSSHfIVuxRBBXuBuYwSdKyt9RFXARqHauDwuOp8KYMniILK68XC2GSxnslkdedflZxP4C+4rKI7aDHfN/xuLK5zq3kyno2clctrE82iJf15XTif4sRtPyb4pdh3QFk3BagSk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706720781; c=relaxed/simple; bh=jF6SdlyJoM2o9TxNb9B6clYF182hsq5bd4yumWvNwvw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LbhEm78opwQpGpZj49Jv96yUOOyGMCfmrSYEers7/x9dMWXXOPo6PFV2TapYoUXmH7dcJ1YGytU786kirGlu7FEbW3Vm+US0jdB7U8CgEd7WQqQy7P1T33P+DSNUxaDmfZaJrsgJd7fHYv2HgqUo1OPbiOcAdvvlMep3xO+lPHk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.05,231,1701097200"; d="scan'208";a="196315555" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Feb 2024 02:06:19 +0900 Received: from GBR-5CG2373LKG.adwin.renesas.com (unknown [10.226.92.158]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 34ED640344FE; Thu, 1 Feb 2024 02:06:15 +0900 (JST) From: Paul Barker To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Paul Barker , Yoshihiro Shimoda , Wolfram Sang , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 8/8] net: ravb: Use NAPI threaded mode on 1-core CPUs with GbEth IP Date: Wed, 31 Jan 2024 17:05:22 +0000 Message-Id: <20240131170523.30048-9-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> References: <20240131170523.30048-1-paul.barker.ct@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789626795485130798 X-GMAIL-MSGID: 1789626795485130798 NAPI Threaded mode (along with the previously enabled SW IRQ Coalescing) is required to improve network stack performance for single core SoCs using the GbEth IP (currently the RZ/G2L SoC family and the RZ/G3S SoC). For the RZ/G2UL, network throughput is increased by this change for all test cases except UDP TX (results obtained with iperf3): * TCP TX: 30% more throughput * TCP RX: 9.8% more throughput * UDP TX: 9.7% less throughput * UDP RX: 89% more throughput For the RZ/G3S we see improvements in network throughput similar to the RZ/G2UL. The improvement of UDP RX bandwidth for the single core SoCs (RZ/G2UL & RZ/G3S) is particularly critical. NAPI Threaded mode can be disabled at runtime via sysfs for applications where UDP TX performance is a priority. Signed-off-by: Paul Barker --- drivers/net/ethernet/renesas/ravb_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 483993ec25ba..202a3229d436 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -3029,8 +3029,11 @@ static int ravb_probe(struct platform_device *pdev) if (info->nc_queues) netif_napi_add(ndev, &priv->napi[RAVB_NC], info->poll); - if (info->needs_irq_coalesce) + if (info->needs_irq_coalesce) { netdev_sw_irq_coalesce_default_on(ndev); + if (num_present_cpus() == 1) + dev_set_threaded(ndev, true); + } /* Network device register */ error = register_netdev(ndev);