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 5D172C4345F for ; Sat, 27 Apr 2024 13:41:42 +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=mLWMQm9UTZBNclhjnaMIh13fX7PyH+HF7JHlpSINA1E=; b=qvc6ptPJXCq5rN DRE76GJoxZZK/LD9BTL2JR4Qk6cDgDPbfMQ4gyO0720ugvWYK+1W09oKzM3XHIH67HD0Q3OrFEV44 DZbicR3UWLeV6H7vVKRc84dLzVWWLRheVgV8WuxtFHUMb1o9ZWhvGKG6VkwocNXCtT5d3hUN8jNJO 8EEaVby5vOblm3Y07yhL3cExLjDdvkTu4FnsA7KVy6r08mMZRzxRSE2yruBlzelGDILXJwIaFjAU0 P04CGEWjN7gJvtD+TScVz3Z9+ZE5+VzpdPPSSFNKEsls6SuMI1W29hCOhyZyP4ek4wVRCIlxr0/Wi 3nLy524ux7XQZcfne4Ug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0iJ2-0000000Fb34-0Xje; Sat, 27 Apr 2024 13:41:32 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0iIz-0000000Fb2P-3OoM for linux-arm-kernel@lists.infradead.org; Sat, 27 Apr 2024 13:41:31 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0E05961BB2; Sat, 27 Apr 2024 13:41:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFF7AC113CE; Sat, 27 Apr 2024 13:41:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714225286; bh=ctU/LpKIKbHCskOW6XQyFcbdqyCFxcZAeTG9GtPpceo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YeqPbEqbUCCjLEc+h/fPy7aD+KWfsBgKRcI1cpk9Tokt2L2sBnmEgIcxLhtIQMbVB Ugk2jlNgFSVSD5O+s1tMLfVjoI6p/fYPuKaWDuXnGIgqbrCVqZe4iAwp/IZyTahupz +XYdvWgJqgbmKG/yQngfkHZWPmAIYKdSX9xZpFOnpi0fiJE1uKCZXUGNmsP1hmfRNf lpiPFFzIW6U6vkfjCVOIWZWnuerj2+KphWpkFnNe+BAbykDVIru8SKYW5l2hQ8iNrn s1Chs0ptP0yiNbYbtn7br6GQ56zn86LuuNrPZnQasu41z2yWejgHJkETlKoQMg8Ds7 +tElHcAEVebxw== Date: Sat, 27 Apr 2024 14:41:20 +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] net: ti: icssg_prueth: Add SW TX / RX Coalescing based on hrtimers Message-ID: <20240427134120.GJ516117@kernel.org> References: <20240424091823.1814136-1-danishanwar@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240424091823.1814136-1-danishanwar@ti.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240427_064129_976757_451639CD X-CRM114-Status: GOOD ( 18.14 ) 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 Wed, Apr 24, 2024 at 02:48:23PM +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 > 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. > > Comapared to gro_flush_timeout and napi_defer_hard_irqs this patch nit: Compared > allows to enable IRQ coalescing for RX path separately. > > Signed-off-by: MD Danish Anwar ... > @@ -190,19 +191,35 @@ 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); Please consider limiting lines to 80 columns wide in Networking code. > > 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); > + } > > return num_tx_packets; > } ... > @@ -870,7 +889,12 @@ 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]); clang-18 and gcc-13 both complain about the if/else logic above. I think it would be best to add {} to the outer if statement. > > return num_rx; > } ... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel