Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp416258rdb; Thu, 5 Oct 2023 09:28:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJnHBoyOgInBDpPdEhTEtiW4C71GDPTzgzpI7L8uy+XeXgRVgQy1HN87wDZRAuGTaDEJm0 X-Received: by 2002:a17:902:ecc4:b0:1c5:c546:fece with SMTP id a4-20020a170902ecc400b001c5c546fecemr3112094plh.34.1696523284151; Thu, 05 Oct 2023 09:28:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696523284; cv=none; d=google.com; s=arc-20160816; b=C7GXEFORPynTTIqnkPHyDieBRana7x6TAV6TPE+JrdI4L2E5LlEN4gCI+XB7yvD6uO tEJ999DtATFqD3d5hxrozK0tsMbx9jFXPwwmL9gpP3fEhDctFNOyMY54s7NOfMI9B9sZ LoWGvsgcV8YZStXqVXeu41soPV/OOJ7Ez6cQWUpxAXSJ3hAR7Uk9O3+gqLS+6sKqzs8W fZ56r09QKkKc1DFfULzvpbQ3ZyCrl0eqikStr8HvzVet4K3amA4Wd/mI5LtgUKjKHmcN NKgq0TZiobqzTVH8Z2e5jwEv3HVpjgI22cghKTs4SckBTq/ckLfFlzGBJN91RVguinPU noJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=LaaqTDoZqbafDQ3l5zFKWxmU6cOLxM0ZIJSzVNTzttI=; fh=BrqZMW8jZrPvQPkx1Q1LARmakMyYMGjLZPpVcJ2dAQs=; b=b7nCZgl8CngH9jZs80O2fRKab+fPcwmXmOUZBCHLxFl7R55kdSEqyAgfU+u5q7aTVO HW4qNxaMe8XWNQSglBl3oAs2B4NiSeCPplFtrv3Vps3MJKkAPsNt9/sejYl5dKlwAXL5 TZKV8UooZ4me8xpUHe0sImoJDp4WXK5KhkGWzkiqvNuQTIFqkZA9JgM1lFE2PMHLe8Nr wOyCAbpUA547Sci0eMD5PnNqG4qBeSa8caIgDKLuCbW3hp5idvLY5dcsQxnO9RfrXYkK hvGv5h9KfadyJZKwcOx7GDnc6quXHOb6fcdRzC8n/MuV3nNtymutpomncSH6LDq/lWWa CZpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=pBanUm71; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id f5-20020a170902684500b001b878f9e11csi1768301pln.54.2023.10.05.09.28.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 09:28:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=pBanUm71; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 4FE59808FA54; Thu, 5 Oct 2023 09:28:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234505AbjJEQ1q (ORCPT + 52 others); Thu, 5 Oct 2023 12:27:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243479AbjJEQWy (ORCPT ); Thu, 5 Oct 2023 12:22:54 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76F623C28 for ; Thu, 5 Oct 2023 09:16:40 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-51e24210395so15996a12.0 for ; Thu, 05 Oct 2023 09:16:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696522598; x=1697127398; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LaaqTDoZqbafDQ3l5zFKWxmU6cOLxM0ZIJSzVNTzttI=; b=pBanUm71ICytkySd7ssQu81m990I3+BLnwYzRiL6TltMvvKuykTTF08MNB5w6+x1Z4 tET1HrckbF7IhqBt138j/ON0Cdqqm/yOWYnSQtXBiLQW3RRKk703v+ajvZmZFkpWXLzv 5GFaukBKBOSzg7JcaupQTAK6Kkh+8pmMxDAvJlurz9DdkMEo+1NzvnpsBk5r0c7rERYX VwEVZsACBLEN9c6CuEhEWhjaQe/eaIlbgJ0GhlUWqdpRPDPAg8EGycEvju1ld9xa6eRy Ev24pZiVRJqgtwLbJS9hHZ+3qiiisFEuurJYJzFhV5Kr/CQNBtgkQvp7J3BIYJNoKTB0 QoUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696522598; x=1697127398; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LaaqTDoZqbafDQ3l5zFKWxmU6cOLxM0ZIJSzVNTzttI=; b=k9KsrNTYKrTegCMRHh3FmBPKidDkhVMxUkcaw94la26PYXdGzN6mwFOOjgcZvRTYtD B9DKZMn+tbCwa+n50PBcNumSHUs34X5XpHKKWedraKe7OOIVg+5tC4kHQ5PPs81mOf9e ObKoNGyWiVxyuJuXpcZrWzoB28DcPqkZS41+eelx5ZwDhmi2ohoMi0Q5m7g60zK6Arzd rgAY5x2Rj8xryDo4cUXIN9jd9iu4vsWkewp8ldhhhAC4LD8lCuZAyxbWkBbEOz5snOBF qM8bfdBWamc9T4ZyZEsknJenozbn0MIhzlXKifW4aMa0qgvFs+xHCPnBqvEmgwPVzofa QHNA== X-Gm-Message-State: AOJu0Yx9q7pmvmHJHsqDE+3+JEZQIyMYTaSnAFxQITLbcEQWEg60FqgS lxQIdJLA9SOQm4a2fExGrWtF1UffvDvcZthM7sdKMw== X-Received: by 2002:a50:8d5a:0:b0:538:2941:ad10 with SMTP id t26-20020a508d5a000000b005382941ad10mr73466edt.5.1696522598066; Thu, 05 Oct 2023 09:16:38 -0700 (PDT) MIME-Version: 1.0 References: <20231003145150.2498-1-ansuelsmth@gmail.com> <20231003145150.2498-4-ansuelsmth@gmail.com> In-Reply-To: <20231003145150.2498-4-ansuelsmth@gmail.com> From: Eric Dumazet Date: Thu, 5 Oct 2023 18:16:26 +0200 Message-ID: Subject: Re: [net-next PATCH v2 4/4] netdev: use napi_schedule bool instead of napi_schedule_prep/__napi_schedule To: Christian Marangi Cc: Jason Gunthorpe , Leon Romanovsky , Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Chris Snook , Raju Rangoju , Jeroen de Borst , Praveen Kaligineedi , Shailend Chand , Douglas Miller , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Nick Child , Haren Myneni , Rick Lindsley , Dany Madden , Thomas Falcon , Tariq Toukan , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Krzysztof Halasa , Kalle Valo , Jeff Johnson , Gregory Greenman , Chandrashekar Devegowda , Intel Corporation , Chiranjeevi Rapolu , Liu Haijun , M Chetan Kumar , Ricardo Martinez , Loic Poulain , Sergey Ryazanov , Johannes Berg , Yuanjun Gong , Simon Horman , Rob Herring , Ziwei Xiao , Rushil Gupta , Coco Li , Thomas Gleixner , Junfeng Guo , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Wei Fang , Krzysztof Kozlowski , Yuri Karpov , Zhengchao Shao , Andrew Lunn , Zheng Zengkai , Lee Jones , Maximilian Luz , "Rafael J. Wysocki" , Dawei Li , Anjaneyulu , Benjamin Berg , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-can@vger.kernel.org, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, ath10k@lists.infradead.org, linux-wireless@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 05 Oct 2023 09:28:02 -0700 (PDT) On Tue, Oct 3, 2023 at 8:36=E2=80=AFPM Christian Marangi wrote: > > Replace if condition of napi_schedule_prep/__napi_schedule and use bool > from napi_schedule directly where possible. > > Signed-off-by: Christian Marangi > --- > drivers/net/ethernet/atheros/atlx/atl1.c | 4 +--- > drivers/net/ethernet/toshiba/tc35815.c | 4 +--- > drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 4 +--- > 3 files changed, 3 insertions(+), 9 deletions(-) > > diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ether= net/atheros/atlx/atl1.c > index 02aa6fd8ebc2..a9014d7932db 100644 > --- a/drivers/net/ethernet/atheros/atlx/atl1.c > +++ b/drivers/net/ethernet/atheros/atlx/atl1.c > @@ -2446,7 +2446,7 @@ static int atl1_rings_clean(struct napi_struct *nap= i, int budget) > > static inline int atl1_sched_rings_clean(struct atl1_adapter* adapter) > { > - if (!napi_schedule_prep(&adapter->napi)) > + if (!napi_schedule(&adapter->napi)) > /* It is possible in case even the RX/TX ints are disable= d via IMR > * register the ISR bits are set anyway (but do not produ= ce IRQ). > * To handle such situation the napi functions used to ch= eck is > @@ -2454,8 +2454,6 @@ static inline int atl1_sched_rings_clean(struct atl= 1_adapter* adapter) > */ > return 0; > > - __napi_schedule(&adapter->napi); > - > /* > * Disable RX/TX ints via IMR register if it is > * allowed. NAPI handler must reenable them in same > diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/etherne= t/toshiba/tc35815.c > index 14cf6ecf6d0d..a8b8a0e13f9a 100644 > --- a/drivers/net/ethernet/toshiba/tc35815.c > +++ b/drivers/net/ethernet/toshiba/tc35815.c > @@ -1436,9 +1436,7 @@ static irqreturn_t tc35815_interrupt(int irq, void = *dev_id) > if (!(dmactl & DMA_IntMask)) { > /* disable interrupts */ > tc_writel(dmactl | DMA_IntMask, &tr->DMA_Ctl); > - if (napi_schedule_prep(&lp->napi)) > - __napi_schedule(&lp->napi); > - else { > + if (!napi_schedule(&lp->napi)) { > printk(KERN_ERR "%s: interrupt taken in poll\n", > dev->name); > BUG(); Hmmm... could you also remove this BUG() ? I think this code path can be ta= ken if some applications are using busy polling. Or simply rewrite this with the traditional if (napi_schedule_prep(&lp->napi)) { /* disable interrupts */ tc_writel(dmactl | DMA_IntMask, &tr->DMA_Ctl); __napi_schedule(&lp->napi); } > diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/w= ireless/intel/iwlwifi/pcie/rx.c > index 23b5a0adcbd6..146bc7bd14fb 100644 > --- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c > +++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c > @@ -1660,9 +1660,7 @@ irqreturn_t iwl_pcie_irq_rx_msix_handler(int irq, v= oid *dev_id) > IWL_DEBUG_ISR(trans, "[%d] Got interrupt\n", entry->entry); > > local_bh_disable(); > - if (napi_schedule_prep(&rxq->napi)) > - __napi_schedule(&rxq->napi); > - else > + if (!napi_schedule(&rxq->napi)) > iwl_pcie_clear_irq(trans, entry->entry); Same remark here about twisted logic. > local_bh_enable(); > > -- > 2.40.1 >