Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1548168lqa; Mon, 29 Apr 2024 11:31:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV/VSFz0nK0Xx8YRp4++cQpv7KWxrEzWEGUNfBhb2EDPbZd6CO/1U6A5jlCXmcpNu9mUcGvoJJgwGT0m7nV3bYwWxdM5qLmrqEvkr+a9Q== X-Google-Smtp-Source: AGHT+IHaEnfZ1ENHGPsyNcRNhbZvmZNjnxlzJyqRerjTLLFgZ1p50lxBjg1nYj7JAM3DqxQEkwkG X-Received: by 2002:a17:903:1250:b0:1e7:e7ed:cbd8 with SMTP id u16-20020a170903125000b001e7e7edcbd8mr499799plh.22.1714415473859; Mon, 29 Apr 2024 11:31:13 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b15-20020a170903228f00b001ec04925643si1051043plh.344.2024.04.29.11.31.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 11:31:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162828-linux.lists.archive=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; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=F+4A0mhF; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-162828-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162828-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 2A540B2174A for ; Mon, 29 Apr 2024 18:30:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A12412A174; Mon, 29 Apr 2024 18:30:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="F+4A0mhF" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3602E1E529; Mon, 29 Apr 2024 18:30:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714415440; cv=none; b=e1cQuPhNBCqpt/u7Rm7sCi/myxl84K+QpTKri5URIIyUTJPQDV9S+ypd9S7feM1RBkDir28fGnDS57Lb0B2InC52DepK2eUWqOs8TIkvt58d0H0o7jrh4i/7B29a7IiKy02t4+iIJyuZFclfNC2jCgYoEL4GUbOEMCjpeXGTnkk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714415440; c=relaxed/simple; bh=FaReNWfkCpcHh4aoUxanTbqVxVGYZtVPHbOmTpw9Lts=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kCT2KWIgDbxCX/UbomRNH+hN54UNvPeDTufWNuvI+F6dA+Ezx5Ueq9lj0zd1Guv3rM+R8z49zUtqnZf+mWIOcXT6ffYX7rlys066MwKJBgL6FqEnL7rMS3hfxulkllJO+Fz2G8PGknX4HuZjmsiX2eA24AVJK/GvtPTDCmvnScg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=F+4A0mhF; arc=none smtp.client-ip=10.30.226.201 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240429071501.547680-1-danishanwar@ti.com> 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