From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4D07C4345F for ; Mon, 29 Apr 2024 18:30:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rdfe+M8RCXkby7totE4caBXi2NKjMozZIFF/xUQF+d4=; b=3lsWFMpoYJw7aK CF1PsKNMXYupG0u97kGE3tEAOf5KOHG6ZvkiSGV2vnh9pNWufjZqI/b8SB38wyINDnb/207ucg4dB IDtmOyFBiUT2Od3clsSNwt+4+P7FS1S4zl54gsKvfaGFZ5bz5NQ+t9XHZWUQui/Ggw+aBAh1e6mCs a0VNhHCgUAMHrfxB4YBtNoXfRxolgJKTVHiq9vUo82kbuovZ/VNvPLG+TR7nC0QdjfLyZOYlUQdP2 RVuEWIrnz+3Te6qzJJH/p0nWdcMX+ncIy0gMmiYJiWbfbLO+O8mTbnmpztDbOPXHeAEk6A0Q8Mzed s7YWOPIPThRum0twOw3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1Vm0-00000003sBg-1Nap; Mon, 29 Apr 2024 18:30:44 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1Vlx-00000003sAL-1iYe for linux-arm-kernel@lists.infradead.org; Mon, 29 Apr 2024 18:30:43 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 28FE560FC4; Mon, 29 Apr 2024 18:30:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D3DEC113CD; Mon, 29 Apr 2024 18:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714415439; bh=FaReNWfkCpcHh4aoUxanTbqVxVGYZtVPHbOmTpw9Lts=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F+4A0mhFdeQrbGu6U7QJo3MzgH4oVDAqzBApw0imCfDSAXhowcIuz2uW4FPcz8x8X E5sIkC+nVa3suvMOUTAkCLBo6SK9Cz21qXae+vl/xeXOnEwc6PbzeuvyRaUtlh2svF 7oEqSMezkAWzC284OLKQ6Q5YcnnQ94kOQP+6BNxlCS6SZcywAPKZzoF1VXis3KtqhN HVx3E2GOk8d4VO8BQj6Lb7tRRECIoioclQCULwVlGukzz4JJ5ihfHu2iXDObEUCep4 rSVMxMPhrkySGl7GGHO1wAtNjLs7j8bdSZAHca8E11cTaRzPQOlhCPJNyowk+jziG4 WShAN9rOo/zQg== Date: Mon, 29 Apr 2024 19:30:34 +0100 From: Simon Horman To: MD Danish Anwar Cc: Dan Carpenter , Heiner Kallweit , Andrew Lunn , Jan Kiszka , Diogo Ivo , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, srk@ti.com, Vignesh Raghavendra , r-gunasekaran@ti.com, Roger Quadros Subject: Re: [PATCH net-next v2] net: ti: icssg_prueth: Add SW TX / RX Coalescing based on hrtimers Message-ID: <20240429183034.GG516117@kernel.org> References: <20240429071501.547680-1-danishanwar@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240429071501.547680-1-danishanwar@ti.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240429_113041_570827_71403770 X-CRM114-Status: GOOD ( 21.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Apr 29, 2024 at 12:45:01PM +0530, MD Danish Anwar wrote: > Add SW IRQ coalescing based on hrtimers for RX and TX data path for ICSSG > driver, which can be enabled by ethtool commands: > > - RX coalescing > ethtool -C eth1 rx-usecs 50 > > - TX coalescing can be enabled per TX queue > > - by default enables coalesing for TX0 nit: coalescing Please consider running patches through ./checkpatch --codespell > ethtool -C eth1 tx-usecs 50 > - configure TX0 > ethtool -Q eth0 queue_mask 1 --coalesce tx-usecs 100 > - configure TX1 > ethtool -Q eth0 queue_mask 2 --coalesce tx-usecs 100 > - configure TX0 and TX1 > ethtool -Q eth0 queue_mask 3 --coalesce tx-usecs 100 --coalesce > tx-usecs 100 > > Minimum value for both rx-usecs and tx-usecs is 20us. > > Compared to gro_flush_timeout and napi_defer_hard_irqs this patch allows > to enable IRQ coalescing for RX path separately. > > Benchmarking numbers: > =============================================================== > | Method | Tput_TX | CPU_TX | Tput_RX | CPU_RX | > | ============================================================== > | Default Driver 943 Mbps 31% 517 Mbps 38% | > | IRQ Coalescing (Patch) 943 Mbps 28% 518 Mbps 25% | > =============================================================== > > Signed-off-by: MD Danish Anwar > --- > Changes from v1 [1] to v2: > *) Added Benchmarking numbers in the commit message as suggested by > Andrew Lunn . Full logs [2] > *) Addressed comments given by Simon Horman in v1. Sorry to be bothersome, but the W=1 problem isn't entirely fixed. > > [1] https://lore.kernel.org/all/20240424091823.1814136-1-danishanwar@ti.com/ > > [2] https://gist.githubusercontent.com/danish-ti/47855631be9f3635cee994693662a988/raw/94b4eb86b42fe243ab03186a88a314e0cb272fd0/gistfile1.txt ... > diff --git a/drivers/net/ethernet/ti/icssg/icssg_common.c b/drivers/net/ethernet/ti/icssg/icssg_common.c ... > @@ -190,19 +191,37 @@ int emac_tx_complete_packets(struct prueth_emac *emac, int chn, > return num_tx; > } > > +static enum hrtimer_restart emac_tx_timer_callback(struct hrtimer *timer) > +{ > + struct prueth_tx_chn *tx_chns = > + container_of(timer, struct prueth_tx_chn, tx_hrtimer); > + > + enable_irq(tx_chns->irq); > + return HRTIMER_NORESTART; > +} > + > static int emac_napi_tx_poll(struct napi_struct *napi_tx, int budget) > { > struct prueth_tx_chn *tx_chn = prueth_napi_to_tx_chn(napi_tx); > struct prueth_emac *emac = tx_chn->emac; > + bool tdown = false; > int num_tx_packets; > > - num_tx_packets = emac_tx_complete_packets(emac, tx_chn->id, budget); > + num_tx_packets = emac_tx_complete_packets(emac, tx_chn->id, budget, > + &tdown); > > if (num_tx_packets >= budget) > return budget; > > - if (napi_complete_done(napi_tx, num_tx_packets)) > - enable_irq(tx_chn->irq); > + if (napi_complete_done(napi_tx, num_tx_packets)) { > + if (unlikely(tx_chn->tx_pace_timeout_ns && !tdown)) { > + hrtimer_start(&tx_chn->tx_hrtimer, > + ns_to_ktime(tx_chn->tx_pace_timeout_ns), > + HRTIMER_MODE_REL_PINNED); > + } else { > + enable_irq(tx_chn->irq); > + } This compiles with gcc-13 and clang-18 W=1 (although the inner {} are unnecessary). > + } > > return num_tx_packets; > } ... > @@ -872,7 +894,13 @@ int emac_napi_rx_poll(struct napi_struct *napi_rx, int budget) > } > > if (num_rx < budget && napi_complete_done(napi_rx, num_rx)) > - enable_irq(emac->rx_chns.irq[rx_flow]); > + if (unlikely(emac->rx_pace_timeout_ns)) { > + hrtimer_start(&emac->rx_hrtimer, > + ns_to_ktime(emac->rx_pace_timeout_ns), > + HRTIMER_MODE_REL_PINNED); > + } else { > + enable_irq(emac->rx_chns.irq[rx_flow]); > + } But this does not; I think outer (but not inner) {} are needed. FIIIW, I believe this doesn't show-up in the netdev automated testing because this driver isn't built for x86 allmodconfig. > > return num_rx; > } ... -- pw-bot: changes-requested _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel