Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61776C636D6 for ; Mon, 20 Feb 2023 20:15:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232559AbjBTUPV convert rfc822-to-8bit (ORCPT ); Mon, 20 Feb 2023 15:15:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232447AbjBTUPS (ORCPT ); Mon, 20 Feb 2023 15:15:18 -0500 Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB80D1EBE8; Mon, 20 Feb 2023 12:15:17 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 8192E6382EE5; Mon, 20 Feb 2023 21:15:16 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id nCMa2EWiTZK8; Mon, 20 Feb 2023 21:15:15 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 991D16382EFF; Mon, 20 Feb 2023 21:15:15 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id YFeslGAXLKQb; Mon, 20 Feb 2023 21:15:15 +0100 (CET) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id 768396382EE5; Mon, 20 Feb 2023 21:15:15 +0100 (CET) Date: Mon, 20 Feb 2023 21:15:15 +0100 (CET) From: Richard Weinberger To: wei fang Cc: netdev , linux-kernel , pabeni , kuba , edumazet , davem , linux-imx , xiaoning wang , shenwei wang Message-ID: <1448370281.155186.1676924115387.JavaMail.zimbra@nod.at> In-Reply-To: References: <20230218214037.16977-1-richard@nod.at> Subject: Re: [PATCH] [RFC] net: fec: Allow turning off IRQ coalescing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Originating-IP: [195.201.40.130] X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF97 (Linux)/8.8.12_GA_3809) Thread-Topic: Allow turning off IRQ coalescing Thread-Index: AQHZQ+Gy2VXqw+BDuEeU3ZeJCH1tfq7XFCgQXmSDC7w= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Wei Fang, ----- Ursprüngliche Mail ----- > Von: "wei fang" >> /* Set threshold for interrupt coalescing */ >> -static void fec_enet_itr_coal_set(struct net_device *ndev) >> +static int fec_enet_itr_coal_set(struct net_device *ndev) >> { >> + bool disable_rx_itr = false, disable_tx_itr = false; >> struct fec_enet_private *fep = netdev_priv(ndev); > disable_rx_itr should be defined below fep to follow the style of the reverse > Christmas tree. Of course, will fix in v2. >> - int rx_itr, tx_itr; >> + struct device *dev = &fep->pdev->dev; >> + int rx_itr = 0, tx_itr = 0; >> >> - /* Must be greater than zero to avoid unpredictable behavior */ >> - if (!fep->rx_time_itr || !fep->rx_pkts_itr || >> - !fep->tx_time_itr || !fep->tx_pkts_itr) >> - return; >> + if (!fep->rx_time_itr || !fep->rx_pkts_itr) { >> + if (fep->rx_time_itr || fep->rx_pkts_itr) { > > I think the below should be better: > if (!!fep->rx_time_itr == ! fep->rx_pkts_itr) At least it's shorter. :-) I'm not sure which variant is easier to understand, though. But in general you are fine with returning -EINVAL in this case? I'm asking because that a userspace visible change. Thanks, //richard