Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7151212rwb; Tue, 6 Dec 2022 01:44:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf709jzA/AzQbE8pXvxZeRKsxMNDAzbFMG8SG3ttCbu3kvA/a4o8/+/tanG/uPFcETNRuNGP X-Received: by 2002:a05:6402:5305:b0:467:69e3:c25b with SMTP id eo5-20020a056402530500b0046769e3c25bmr75859552edb.3.1670319870107; Tue, 06 Dec 2022 01:44:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670319870; cv=none; d=google.com; s=arc-20160816; b=oNBgOH2PtYaw8zDcFxp9g/BHUArOOEdle3Maq9JtTlbiVOU/ql5sLdGFUg5+rU9u8A RHBh7kPImOcaoNQNHIsOsl5IxZIXPvCsSwGrmv/wguOBoPhxzrCn83c/lE69RSI1Q0Uo TrvsaKbVzZ8CNiospsdr13HEXVl2320HR5zfsHyUjNl/5fcKyU6ZF5VrjXlR//Kesry1 YK6YeJK0fkki85t8Jy92POktq7OaHtItw+YzM+biG8JEI3CieWrUMOOTpRBZ/cgVLit5 7G/kAwvA1CVUFw68ABw9o4RbEmlGv6uaNSQy9+HpsxDnoi7prZOe0k1+ic6rQ/zUXeCm 96qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=prCQtfkXiXUFthb6LYkJWfY3HXStmoXr0+/HjWbCyz0=; b=yFHHx8TBTnsYJ2VbJyfd7uzIQ9aMSsPZs5UtvS8xkazy+wIOUo2FuOtZzXb4LmLr+1 3JyTdRo7TVYpbDE9mncVLlkAEjmlotH4bB3id2mTShweq0uuoOsKcYIqQCvsDUyooUJR m48cy04/u31AZ8RDChLmCRC2/KKu/X/vVgvYpWoN3pPFJyYGPH82DVwYSzdawuwVFKy+ 72QeDFpM/Jp1c2dyUOmCrDD5thPAT+4zFxs3ftHnnFAkCmpDL+KRaj5zt8/SaljoqseD Wdz5FMpM3W2c/n+0vgeF7cMYhngaw4hyHT9jk9Yx2VH1cGywF+vwayrPk+Q/1EW1dcAu C47Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=JrVx3iPy; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di10-20020a170906730a00b007aea0bbe2e2si16110567ejc.394.2022.12.06.01.44.11; Tue, 06 Dec 2022 01:44:30 -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=JrVx3iPy; 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 S233398AbiLFIXl (ORCPT + 79 others); Tue, 6 Dec 2022 03:23:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232165AbiLFIXc (ORCPT ); Tue, 6 Dec 2022 03:23:32 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C174E0CA for ; Tue, 6 Dec 2022 00:23:31 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id m18so2798587eji.5 for ; Tue, 06 Dec 2022 00:23:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=prCQtfkXiXUFthb6LYkJWfY3HXStmoXr0+/HjWbCyz0=; b=JrVx3iPysg800oCJWLVYcDNz7hkKSNtuDJftJPjm6/k3iZm+sz4Yf/1Zwp5cUqGGn4 wJA6bNv/vNcBBVcjE2dyq+UptgTgCv4CBiNFOuJUv6q6yGjUt3F+doWeG/JmHgVJV1Sd VVivSjDMRmrO2YKHj9Ziz0/fr1rWuNdBeJHoQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=prCQtfkXiXUFthb6LYkJWfY3HXStmoXr0+/HjWbCyz0=; b=RlfeJQmoCn6Ww8WCTXhazytfdcbKIPtHOdmdkj/aqh/aBkgMVT0a6v32RXEolXxZbZ dkA5S2oVxjgCIt3awlNVpHlXSwufKYIMow2esUxBkdYZyuxB4orfDEGFN0uthCLPhdXy c+VLJjr2xxRWGVoKHgVDgfPPQmpxWakNkGbBipBKKEos1ETlfysV48CtWc601hGd9JK8 VGwZBDNmslm1CTzRfkTVvTDO2Kzx7It2FMEHI8zdNkoGXc8iy0H4NjXh7wLk5u7d52Wg yrqS23+zViSmtH7mMIwpsKZrpIZd7ai83siiVlYAfGJG/rfH8snqihvJtzpBh7mYz2sF l/Rw== X-Gm-Message-State: ANoB5pknaKLW5sMRkjmEWIJIDsRdufjaCY9m7ln0RbBih/Lijr174XoP VnryjA7+ov0iWO6Kwshlx9HfmA== X-Received: by 2002:a17:906:8d7:b0:7c0:efba:b39c with SMTP id o23-20020a17090608d700b007c0efbab39cmr7708644eje.209.1670315009696; Tue, 06 Dec 2022 00:23:29 -0800 (PST) Received: from [172.16.11.74] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id cb26-20020a0564020b7a00b0046ba536ce52sm685803edb.95.2022.12.06.00.23.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Dec 2022 00:23:29 -0800 (PST) Message-ID: <9b773679-7995-7260-a54f-74f12e09d3d6@rasmusvillemoes.dk> Date: Tue, 6 Dec 2022 09:23:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH] net: fec: properly guard irq coalesce setup Content-Language: en-US, da To: Alexander Stein Cc: Joakim Zhang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Greg Ungerer , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221205204604.869853-1-linux@rasmusvillemoes.dk> <2661485.mvXUDI8C0e@steina-w> From: Rasmus Villemoes In-Reply-To: <2661485.mvXUDI8C0e@steina-w> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> Signed-off-by: Rasmus Villemoes >> --- >> 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