From patchwork Mon Oct 9 13:37:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13413755 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 C3AC72E649 for ; Mon, 9 Oct 2023 13:38:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="avFAsFmb" Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 170839C; Mon, 9 Oct 2023 06:38:08 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40651a726acso41855875e9.1; Mon, 09 Oct 2023 06:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696858686; x=1697463486; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=m01pIjBrpccmB+UTqpe3DsPW+GxNRr1hhJrCHjJ41h8=; b=avFAsFmbgFveTTnrfgsi+nEck/8J10PL0pfRcwQnG3DVD2kiO/EKenWA3UBdf2hBfx vPKxN6jBKvYpcj5aLMag18P7+bpVKzhhaOD1kaESStgIn/zCBkX7xlTWeRzp/WlE7Fux sTIIyyROpdWMkH2WaaoW7HyS2uoZnrVst+MT8VJ+B+sctuA6vZGsLzMBkWcDeGQ2rlOx 1X/11N72qwzjww6x5EtwKHdoqxjwhd2w4QmNTkmrmYsgAHl0cBuUpA+H61oI9Xyp9crN h+UD94M6tGqvPzXD5JNspTA1b0AE2uhWQc7hysmN/wl5Nuj04OrGuegGGo38oy1/Bx3g 16ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696858686; x=1697463486; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m01pIjBrpccmB+UTqpe3DsPW+GxNRr1hhJrCHjJ41h8=; b=l39lZ+qih8iH0N7zrn9Vr5Udzt4u+O5xVXrixzSHTRWF3c+RUZZ6N2RvW90HVJ/R2o XN1gDE+rfoYf2zWHJCbTNy6zuj09iKrj8ADyhG2U3AWn8FoOK2MfqMbkEDX6uZuzelgi r4SqMdsfCplqewaXpk1i6Q/qmgXM+sO4WqemzGJ1ey8oF/qaSsNeJ/nITahyrqqgdh9I CiIF85yndIhphn5sXgsOddhNZHQmGi3YRn5Il9JDpNo7R0O1ZvFS0/PbvQVPzRVBuDaq gEFr+u0wAGn3mQI42PTNZMjX03mHjUDRovxu6CU32VO1Yaa5+/5ZpmaRJkilgraTtwRq 1+rA== X-Gm-Message-State: AOJu0YyHQrf0ssQfT0zpdLUnHOwk8FKdOh2tnfcUsY23B7uygyAB2eJf 6sPiIaTXvGEgQrsKAW2Jogc= X-Google-Smtp-Source: AGHT+IEMX7bz877y1sqkSBBwiuVDPwmUPP6Boy0DbKerTwIWpVX1/W8TSbdVp2MIATN2+AWYZ0P7bg== X-Received: by 2002:a05:6000:128a:b0:31a:d9bc:47a2 with SMTP id f10-20020a056000128a00b0031ad9bc47a2mr15005335wrx.53.1696858686330; Mon, 09 Oct 2023 06:38:06 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id t4-20020a0560001a4400b0032763287473sm9746160wry.75.2023.10.09.06.38.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 06:38:06 -0700 (PDT) From: Christian Marangi To: Jason Gunthorpe , Leon Romanovsky , Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chris Snook , Raju Rangoju , Jeroen de Borst , Praveen Kaligineedi , Shailend Chand , Douglas Miller , Nick Child , Michael Ellerman , Nicholas Piggin , Christophe Leroy , 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 , Christian Marangi , Yuanjun Gong , Alex Elder , Bhupesh Sharma , Simon Horman , Rob Herring , Bailey Forrest , Junfeng Guo , "Gustavo A. R. Silva" , Ziwei Xiao , Rushil Gupta , Thomas Gleixner , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Krzysztof Kozlowski , Yuri Karpov , Andrew Lunn , Zheng Zengkai , 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 Subject: [net-next v3 2/5] netdev: make napi_schedule return bool on NAPI successful schedule Date: Mon, 9 Oct 2023 15:37:51 +0200 Message-Id: <20231009133754.9834-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231009133754.9834-1-ansuelsmth@gmail.com> References: <20231009133754.9834-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, 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 X-Patchwork-Delegate: kuba@kernel.org Change napi_schedule to return a bool on NAPI successful schedule. This might be useful for some driver to do additional steps after a NAPI has been scheduled. Suggested-by: Eric Dumazet Signed-off-by: Christian Marangi Reviewed-by: Eric Dumazet --- Changes v2: - Add Suggested-by tag - Add Reviewed-by tag --- include/linux/netdevice.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 7e520c14eb8c..2bead8e2a14d 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -490,11 +490,18 @@ bool napi_schedule_prep(struct napi_struct *n); * * Schedule NAPI poll routine to be called if it is not already * running. + * Return true if we schedule a NAPI or false if not. + * Refer to napi_schedule_prep() for additional reason on why + * a NAPI might not be scheduled. */ -static inline void napi_schedule(struct napi_struct *n) +static inline bool napi_schedule(struct napi_struct *n) { - if (napi_schedule_prep(n)) + if (napi_schedule_prep(n)) { __napi_schedule(n); + return true; + } + + return false; } /**