Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp19943lqm; Tue, 30 Apr 2024 11:22:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX7HgoGJnW3Fs5owL3arRK4cfSLdo25G+sc44jsT1chyuXfoccQ2qZpUbplBD4a484ODnkbVaByQDuEYGtfF7BYBwlvEGsbrPZQilssbw== X-Google-Smtp-Source: AGHT+IHcQ0Zp7Bkxd+Z1tPan/kZHR4R3YH8ReL/IPB/1+cIgkuxSe9JcuHhtQb/7crPYziMTWGBr X-Received: by 2002:a50:c30a:0:b0:572:7280:89d6 with SMTP id a10-20020a50c30a000000b00572728089d6mr458475edb.7.1714501326505; Tue, 30 Apr 2024 11:22:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714501326; cv=pass; d=google.com; s=arc-20160816; b=xMspINTRSr2ovZ6kXmxlxNr0Jj/9cOjqjPHWZ2IT0NFM2xlKxqM1SrJA8XZtvcQR76 boq7vavIqiMEH0GgNn8/A1sjz+O2xOk2XfqYsCl9FDyWM3vQeUEtPPOhgONqGJJfyNMl 08KPm5IycB7pmrQkbxU1MUti4Bjdr6DTsF6PFai0ClmANTSgx75Utmnw1aNY5eeDMZKt iKsl0AWi7k3MkftsbQX7RxDF9KpDOjAtufQLgMhONf5Krr9GyqRIH3QwvNwHMl2Vn2dy 6wZcFtpoJFt4RLVC4LrUTRa8EO7UPRQctMDOdbEEsaG3IBXPuVqTLzPbZzUoUq8+9vNO Q0Ig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=BAR+fc7pqS6qhfYWXMMaxF5d8xtg6EKcFEDocneK0i4=; fh=BFG6AfMfq4eBvqPhuihm2bgQ0s8ikCQDHQymnPnQ/wA=; b=pCS2xV2vFPA/dSa8JLkoru5zj6wKtXU8v7/X92ekQoEOe1MN3Pc2MncFdhfNTVUJBw p88CnHFQRFbsJULfaAsfSbpwqdN+pcP0yLD4prYs8UfUTK1OHjxelvZ/AQPu9l6QsD4i FaFXcC5/+l0djOiFMWSRfVFyLaqOMv0NmVDV6uGR82ktlW1e87HPpluSkfX8yzSoVFtu KxZ4HyYS/+s91YHGIKYztl5W1SSbyhmWL3alaNcuaQVOpq7sFdO/qgjSxL954C8CQ1qu 54fyxoySNaXsByQL6rMkOg9PDVRj3UsOuaaNNZir4XRuM+bpw2pDHw2c0wUqwWe9Xfkt xh8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uoKFBS0o; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-164581-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164581-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id q15-20020a50aa8f000000b005727b088307si3475931edc.514.2024.04.30.11.22.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 11:22:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164581-linux.lists.archive=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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uoKFBS0o; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-164581-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164581-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5639D1F24A74 for ; Tue, 30 Apr 2024 18:21:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F0961836F2; Tue, 30 Apr 2024 18:21:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uoKFBS0o" 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 81B71180A92; Tue, 30 Apr 2024 18:21:48 +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=1714501308; cv=none; b=r7c9RjhalFkgUXUbCSY0lGz2DYggp6p3GpMEK798vv/xWhu2TACtxCe+KSynDKlU6024ClnJkILrWIMZLS+mh9rSn2JeHGKmvnOOkD/zPdj16pjdWcSKnIxkM62wWV2T+9qguj1D2Q6RBRsCV5R4Hwb0nKcL2YzKOosCDy4WG9c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714501308; c=relaxed/simple; bh=e8R5pNN2IsLACAwBDVyNGSn3zTMo3zNZ2dNsVU58FAY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EAcdDQO3/Qs+TmZC7bXbHXt9LVViMtGkijQO8IiHRU8sn0+AEn0RDtzBnzhjAPpPzkjEkwfgDLOe6LKAHBKUQlzfA41FR3hnX5co3MMdn2if3wHKjLwLLs85rvirexGZVn5AnUAm/6NgQQ26Z0LyTF2YdAexuhZE9UzAf/zs7Qs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uoKFBS0o; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C8DEC2BBFC; Tue, 30 Apr 2024 18:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714501308; bh=e8R5pNN2IsLACAwBDVyNGSn3zTMo3zNZ2dNsVU58FAY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uoKFBS0oWnJcn5AdrjfuWyIkjg2MAAkA4VXWGlkuJpeO3isRw7tzGSQCr8k0jK/s/ j51yGThqNL/UTuSjLfQuERbZIA6/RR462aK9UR49PvH14iimEeBtauE97B+Rn144tA EAiYurlFqXopiuoOtIr/WqoIvx6xgAlvAwyXQMZ2KQ28kmbdzS+VpG+/c8D16SA84U Phw2RgTDYvjJWtggVTwYSUYuxKUtKuhAez8zUnAGm04qEp1b2tbX8zNIhvFkprsKnP I6ZydNCTiPdlowBbxVR8j0AXv5ugZVa2/YciVsAusdd5mKFFpEbFm/y0TZt//24ZDs 1tNh0FQNdrhDQ== Date: Tue, 30 Apr 2024 19:21:42 +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: <20240430182142.GC2575892@kernel.org> References: <20240429071501.547680-1-danishanwar@ti.com> <20240429183034.GG516117@kernel.org> <5b7cf22a-ca91-4975-bd26-c76a16781ad7@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: <5b7cf22a-ca91-4975-bd26-c76a16781ad7@ti.com> On Tue, Apr 30, 2024 at 03:12:58PM +0530, MD Danish Anwar wrote: > Simon, > > On 30/04/24 12:00 am, Simon Horman wrote: > > 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 > >> --- > > [ ... ] > >> 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. > > > > For both of these if checks, by having {} for outer if I am not seeing > the warnings anymore. The braces don't seem to be neccessary for inner if. > > For both of these ifs I'll keep both inner and outer ifs in braces as > this will help readablity as Dan pointed out. > > I will post v3 with this change. Thanks, sounds good to me.