From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 CC5153128CC for ; Mon, 25 May 2026 11:53:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779710028; cv=none; b=iN4oQU7WkyCb2B7OYxi13nqMzdpNakjAXlmYwuMRI0jKHLaJP+rBrH5vxGJwBjGLi/MtaaogAHtBng36eJdf22IwrIBlMP4h8nqonTVE4irqbufGzOEQ0PxVZ24q77mtGwOozCCcLJaVR57kNMWzn3mNq52RlamcyPuVjiMKTj0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779710028; c=relaxed/simple; bh=8WpSTiwy75eJj+Yxr71TQj0YfgNEgVTpH8iSg9QPf8A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=pQSYF3v+k/iq0ns+lAemS8yIrZzpNKhf1D7Vi911RMy1oYj6kN4zEESAqQACp9HT6K4ANUZOAh8gLLQsW7UWBtH5QYiXTWAyyylcKYGb/rUttFmwkbbyKGjdffzIiZDltez6njjl/bU1xUq6D1LeRTGMU9+ZgyOXJ+1RS3Hnfns= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=R2XQuj5G; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="R2XQuj5G" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 19F621A36B5; Mon, 25 May 2026 11:53:43 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id D43E9603DC; Mon, 25 May 2026 11:53:42 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 5061010810F8B; Mon, 25 May 2026 13:53:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1779710022; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=mhOJii7SYuw+AMQe29JURQFVtzesQcEr/6Sv+5/6gXA=; b=R2XQuj5GH0+oY+cgBYrGvs4mf8Y+hw5/1fxLkDRsH6HXtM0bSonYk3aIBV2M6x4mUGbYVB vOK7DwTn9NOMoWRAYzujbAXTY0a05fVQif1B/fOglR4aX1Hg+91SHkbHB51VJ41EcX9+op fn3krBHQYWEEmWn732MeI2VZf5EUlTXPRzm69Pw04SN+ptvdcmiyC5+8B6giexqcQ/kNfq m6ySmO4s4B8vgNl2XNLgEG84ERmBGpnECJAc/vrc6/u6Ki0sgyc5x3kUOR42EyWFGp9vky euYxmlHQaGRd519dyX7MzhWEV228BAaGGCxhfpn7T8sDMVx0FWWX6hZM8oprRw== Message-ID: <771efc7b-c49b-49cc-af18-af31d6cbbf5a@bootlin.com> Date: Mon, 25 May 2026 13:53:34 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] net: stmmac: Improve Tx timer arm logic further To: muhammad.nazim.amirul.nazle.asmade@altera.com, netdev@vger.kernel.org Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, rmk+kernel@armlinux.org.uk, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20260525061653.22548-1-muhammad.nazim.amirul.nazle.asmade@altera.com> Content-Language: en-US From: Maxime Chevallier In-Reply-To: <20260525061653.22548-1-muhammad.nazim.amirul.nazle.asmade@altera.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 Hi, On 5/25/26 08:16, muhammad.nazim.amirul.nazle.asmade@altera.com wrote: > From: Nazim Amirul > > Currently hrtimer_start is called even if hrtimer is > active. This is unnecessary and expensive in some targets. > This patch avoids calling hrtimer_start unnecessarily. This description is a bit lacking on details wrt. the expensiveness and perf impacts, but I've tested with and without this patch on a cyclone V with dwmac-socfpga, and I cansee a diff when sending small UDP packets with : iperf3 -c -u -b 0 -l 64 Before this patch, around 45200 pps sent, after this patch, around 52300 pps sent ! Nice improvement :) So from my perspective, Tested-by: Maxime Chevallier Reviewed-by: Maxime Chevallier Maxime > > Signed-off-by: Rohan G Thomas > Signed-off-by: Nazim Amirul > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 3591755ea30b..35da51c26248 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -3341,12 +3341,14 @@ static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue) > * Try to cancel any timer if napi is scheduled, timer will be armed > * again in the next scheduled napi. > */ > - if (unlikely(!napi_is_scheduled(napi))) > - hrtimer_start(&tx_q->txtimer, > - STMMAC_COAL_TIMER(tx_coal_timer), > - HRTIMER_MODE_REL); > - else > + if (unlikely(!napi_is_scheduled(napi))) { > + if (unlikely(!(hrtimer_active(&tx_q->txtimer)))) > + hrtimer_start(&tx_q->txtimer, > + STMMAC_COAL_TIMER(tx_coal_timer), > + HRTIMER_MODE_REL); > + } else { > hrtimer_try_to_cancel(&tx_q->txtimer); > + } > } > > /**