Message ID | 20221205204604.869853-1-linux@rasmusvillemoes.dk |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2468055wrr; Mon, 5 Dec 2022 12:54:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf6KTMab7ZJn/AHd04TZER9UZEd5aA58wLeS4MBNsZUaX8QuzeefbNRhPHu3BxDpZiwCbFHI X-Received: by 2002:a17:906:258d:b0:7c0:aea3:a9a8 with SMTP id m13-20020a170906258d00b007c0aea3a9a8mr17443735ejb.718.1670273698819; Mon, 05 Dec 2022 12:54:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670273698; cv=none; d=google.com; s=arc-20160816; b=IveGxtzXWElgsfEqYsoZwNm9KxHuAGlNplfibgr9eWzOv8PTqz8Ml7HJFxoU3Ov/MT MAJXc+mKqRzA3YQcD1c237+2YbILeXx+0k/nk3VBlbUCviFGcogiERSrG6GgSeiareuX pU5k9RIu6GJONNKDj6y6I++xG1gU77JhR4uEYLaiQsr5fnY3n+MvNcsJ6M1RHUopF2tk Lj630f7aqrAedNK8iW57Y3nWxa3w8UOmHMc4J9+7WoxF5hyEkx76TKH5XcIiwi1+CcKE 8dgvd9uc4Cxo5GBUwssUSwNsgYM9U/7K3N79Nl9TFSh8JqUmRggdxEpDK2AQ7lQH2WBZ WFVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=WuFAQ0v5aLWdC7HoyL7gWW2N4Fcoas9srNPvbE2PlSI=; b=qoCSCbAgJS0pWJK3vgESH1+xu+J3B763V2rS2v4My2zMt2Jr7M2ATi16CZjG5wnXi+ nWfmlHqfbPzY6Ax3VgjzgBA0z0NQa/hrN4SiRmlzM1+Nv95zj+he/2q1toSrhQoEnO7p fZHi2CHXUf9ZS+v3+kTrhptRpOXiUPvTL9XeB+/KCX6L797gHlXI7SXMFJfSIeafhOVZ GB+plfQuiBoVc+WQuVp79ZXlf6HUykdjEUp5Tmiy0G2xbqIJm7i/yoOG9NKHdPXDLtCY cvDy/pAKsFRMWpx3Fsbv9/Jug6hcH4iTMkIUVC+dBONou7mFKpcdKLWbHMoHxYGBm3eC 08UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=Kh9022fo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f30-20020a170906739e00b007c0b71dfd96si8190768ejl.734.2022.12.05.12.54.35; Mon, 05 Dec 2022 12:54:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=Kh9022fo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233522AbiLEUqR (ORCPT <rfc822;jaysivo@gmail.com> + 99 others); Mon, 5 Dec 2022 15:46:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233552AbiLEUqL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 5 Dec 2022 15:46:11 -0500 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C7C92A95A for <linux-kernel@vger.kernel.org>; Mon, 5 Dec 2022 12:46:08 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id qk9so1421325ejc.3 for <linux-kernel@vger.kernel.org>; Mon, 05 Dec 2022 12:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=WuFAQ0v5aLWdC7HoyL7gWW2N4Fcoas9srNPvbE2PlSI=; b=Kh9022foKHxv2IuneGH3KcskvUGhatfsHW9pjdrTewUvyQ4ouVTRQf63B9VThbyG/V lgH7Qp+FZwJq5DuniTFh7ihD5jt2Q+AKlAcKHKrf7mSZuibkbFf8fspeBx7/hBAs1r/1 KYBCp9EFJL7YgVR956qPSVu+aWeRzUFJctbxY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WuFAQ0v5aLWdC7HoyL7gWW2N4Fcoas9srNPvbE2PlSI=; b=vMLMIf41MigaJuvuStlEOy9Cl72dMS64vfryDTDv1ASHh+p09t3BMt/i3CzHGngzSZ K8fqqprupW6otnQtJ3A+tNYnJzsziIXIYZ/572Ja8+KbSo7iYKDp78oyIm4gIlvHljns oe78R6pJmSpbGZc1HDXi/3Mx3tKXmoO+z2Wj85j3D/O05n/gVXgQzuAw8eEhxgYMsdtd SofAaAEwGXb3mYdJKw6BRNAqeXDsAqVgYWSEZTQu28tndPKP3GhR8AtiHuV7Tel1S8gk fIeSiEmXvJr72OYqcE9JQmioI7IIBs1G2ZtxRsZ9Th+q0jrTwbpirxeOftwIG8PkmXFC tn4w== X-Gm-Message-State: ANoB5pk7RuFsGwz3KQml4Z6RWG1muY4raiSsti2CE+eSHjggFIrdNcMK awOmtAReszPSQ92yYgUeXTbyHA== X-Received: by 2002:a17:906:7f90:b0:7c0:ba2c:a4e8 with SMTP id f16-20020a1709067f9000b007c0ba2ca4e8mr15296522ejr.642.1670273166741; Mon, 05 Dec 2022 12:46:06 -0800 (PST) Received: from localhost.localdomain ([80.208.71.65]) by smtp.gmail.com with ESMTPSA id d21-20020a170906305500b007838e332d78sm6584829ejd.128.2022.12.05.12.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 12:46:06 -0800 (PST) From: Rasmus Villemoes <linux@rasmusvillemoes.dk> To: Joakim Zhang <qiangqing.zhang@nxp.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Rasmus Villemoes <linux@rasmusvillemoes.dk>, Andrew Lunn <andrew@lunn.ch> Cc: Greg Ungerer <gregungerer@westnet.com.au>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: fec: properly guard irq coalesce setup Date: Mon, 5 Dec 2022 21:46:04 +0100 Message-Id: <20221205204604.869853-1-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751408913720055177?= X-GMAIL-MSGID: =?utf-8?q?1751408913720055177?= |
Series |
net: fec: properly guard irq coalesce setup
|
|
Commit Message
Rasmus Villemoes
Dec. 5, 2022, 8:46 p.m. UTC
Prior to the Fixes: commit, the initialization code went through the
same fec_enet_set_coalesce() function as used by ethtool, and that
function correctly checks whether the current variant has support for
irq coalescing.
Now that the initialization code instead calls fec_enet_itr_coal_set()
directly, that call needs to be guarded by a check for the
FEC_QUIRK_HAS_COALESCE bit.
Fixes: df727d4547de (net: fec: don't reset irq coalesce settings to defaults on "ip link up")
Reported-by: Greg Ungerer <gregungerer@westnet.com.au>
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/net/ethernet/freescale/fec_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On 12/5/22 12:46, Rasmus Villemoes wrote: > Prior to the Fixes: commit, the initialization code went through the > same fec_enet_set_coalesce() function as used by ethtool, and that > function correctly checks whether the current variant has support for > irq coalescing. > > Now that the initialization code instead calls fec_enet_itr_coal_set() > directly, that call needs to be guarded by a check for the > FEC_QUIRK_HAS_COALESCE bit. > > Fixes: df727d4547de (net: fec: don't reset irq coalesce settings to defaults on "ip link up") > Reported-by: Greg Ungerer <gregungerer@westnet.com.au> > Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> > --- > drivers/net/ethernet/freescale/fec_main.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c > index 2ca2b61b451f..23e1a94b9ce4 100644 > --- a/drivers/net/ethernet/freescale/fec_main.c > +++ b/drivers/net/ethernet/freescale/fec_main.c > @@ -1220,7 +1220,8 @@ fec_restart(struct net_device *ndev) > writel(0, fep->hwp + FEC_IMASK); > > /* Init the interrupt coalescing */ > - fec_enet_itr_coal_set(ndev); > + if (fep->quirks & FEC_QUIRK_HAS_COALESCE) > + fec_enet_itr_coal_set(ndev); There is already a guard in fec_enet_set_coalesce() so this makes sense, thanks!
Am Montag, 5. Dezember 2022, 21:46:04 CET schrieb Rasmus Villemoes: > Prior to the Fixes: commit, the initialization code went through the > same fec_enet_set_coalesce() function as used by ethtool, and that > function correctly checks whether the current variant has support for > irq coalescing. > > Now that the initialization code instead calls fec_enet_itr_coal_set() > directly, that call needs to be guarded by a check for the > FEC_QUIRK_HAS_COALESCE bit. > > Fixes: df727d4547de (net: fec: don't reset irq coalesce settings to defaults > on "ip link up") Reported-by: Greg Ungerer <gregungerer@westnet.com.au> > Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> > --- > drivers/net/ethernet/freescale/fec_main.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/freescale/fec_main.c > b/drivers/net/ethernet/freescale/fec_main.c index > 2ca2b61b451f..23e1a94b9ce4 100644 > --- a/drivers/net/ethernet/freescale/fec_main.c > +++ b/drivers/net/ethernet/freescale/fec_main.c > @@ -1220,7 +1220,8 @@ fec_restart(struct net_device *ndev) > writel(0, fep->hwp + FEC_IMASK); > > /* Init the interrupt coalescing */ > - fec_enet_itr_coal_set(ndev); > + if (fep->quirks & FEC_QUIRK_HAS_COALESCE) > + fec_enet_itr_coal_set(ndev); > } > > static int fec_enet_ipc_handle_init(struct fec_enet_private *fep) I'm wondering if this check should be added to fec_enet_itr_coal_set() instead. Right now any additional caller has to do it's own check for FEC_QUIRK_HAS_COALESCE, so why not do check in fec_enet_itr_coal_set? But I'm okay with this change as well. Best regards, Alexander
On 06/12/2022 07.16, Alexander Stein wrote: > Am Montag, 5. Dezember 2022, 21:46:04 CET schrieb Rasmus Villemoes: >> Prior to the Fixes: commit, the initialization code went through the >> same fec_enet_set_coalesce() function as used by ethtool, and that >> function correctly checks whether the current variant has support for >> irq coalescing. >> >> Now that the initialization code instead calls fec_enet_itr_coal_set() >> directly, that call needs to be guarded by a check for the >> FEC_QUIRK_HAS_COALESCE bit. >> >> Fixes: df727d4547de (net: fec: don't reset irq coalesce settings to defaults >> on "ip link up") Reported-by: Greg Ungerer <gregungerer@westnet.com.au> >> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> >> --- >> drivers/net/ethernet/freescale/fec_main.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/ethernet/freescale/fec_main.c >> b/drivers/net/ethernet/freescale/fec_main.c index >> 2ca2b61b451f..23e1a94b9ce4 100644 >> --- a/drivers/net/ethernet/freescale/fec_main.c >> +++ b/drivers/net/ethernet/freescale/fec_main.c >> @@ -1220,7 +1220,8 @@ fec_restart(struct net_device *ndev) >> writel(0, fep->hwp + FEC_IMASK); >> >> /* Init the interrupt coalescing */ >> - fec_enet_itr_coal_set(ndev); >> + if (fep->quirks & FEC_QUIRK_HAS_COALESCE) >> + fec_enet_itr_coal_set(ndev); >> } >> >> static int fec_enet_ipc_handle_init(struct fec_enet_private *fep) > > I'm wondering if this check should be added to fec_enet_itr_coal_set() > instead. Right now any additional caller has to do it's own check for > FEC_QUIRK_HAS_COALESCE, so why not do check in fec_enet_itr_coal_set? Yeah, I did consider that (see https://lore.kernel.org/netdev/72eb4e63-10a8-702b-1113-7588fcade9fc@rasmusvillemoes.dk/). But in the end I decided against it, for various small reasons. Primarily my thinking was that while this caller is obviously ok with fec_enet_itr_coal_set() just silently being a no-op, it's not clear that some future caller wouldn't have to check the bit themselves and return -EOPNOTSUPP or some other error just like the ethtool method does. Of course we could also make fec_enet_itr_coal_set() not return void, but then it's a whole different refactoring and definitely not for post-rc8. But also, the above was what I had sent out as a "something like this?" and tested on my own hardware before heading home, and due to the imminent release, I wanted to send out the patch ASAP. Rasmus
Hello: This patch was applied to netdev/net.git (master) by Jakub Kicinski <kuba@kernel.org>: On Mon, 5 Dec 2022 21:46:04 +0100 you wrote: > Prior to the Fixes: commit, the initialization code went through the > same fec_enet_set_coalesce() function as used by ethtool, and that > function correctly checks whether the current variant has support for > irq coalescing. > > Now that the initialization code instead calls fec_enet_itr_coal_set() > directly, that call needs to be guarded by a check for the > FEC_QUIRK_HAS_COALESCE bit. > > [...] Here is the summary with links: - net: fec: properly guard irq coalesce setup https://git.kernel.org/netdev/net/c/7e6303567ce3 You are awesome, thank you!
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 2ca2b61b451f..23e1a94b9ce4 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1220,7 +1220,8 @@ fec_restart(struct net_device *ndev) writel(0, fep->hwp + FEC_IMASK); /* Init the interrupt coalescing */ - fec_enet_itr_coal_set(ndev); + if (fep->quirks & FEC_QUIRK_HAS_COALESCE) + fec_enet_itr_coal_set(ndev); } static int fec_enet_ipc_handle_init(struct fec_enet_private *fep)