From patchwork Tue Oct 3 14:51:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13407896 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 9E21DE7545E for ; Tue, 3 Oct 2023 18:36:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240817AbjJCSgq (ORCPT ); Tue, 3 Oct 2023 14:36:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240793AbjJCSgo (ORCPT ); Tue, 3 Oct 2023 14:36:44 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6321990; Tue, 3 Oct 2023 11:36:41 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-32329d935d4so1266786f8f.2; Tue, 03 Oct 2023 11:36:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696358200; x=1696963000; 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=SxE+o65eENt7g12p7C53Itt1rvKBW8FBbfbXZ6zTc5NlnADtq5qCAjboIOeUyu2q2e DPPKrAuxLHYLepTv46AKx9NffKQvjRvDcHRNnDRnrAuGYalBZNdbHlOdEtHJiJisPWEc ijCbEWKx41GjxEkJiDVaOCdkL7vZGbvqvoL/8HqX14kiFZxH7k+G0zDLgOYlYqA5JbhI B8P7UZQ4pO9RV8CFDe8aqiFXInfdvMFqeHekiU+qESNAPyoyQNpTfQ3Xlzg6EHlo1k6T YBIekghBDb5ZCmXJMajcPh99pFqWg/miaYW3mn1Aq3w7/3TbiiFHqHyHoOjrdgQLka5+ jU1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696358200; x=1696963000; 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=eF/qmhkvi1op3kqg0N3wP5WIjQSK9Cj+AuHwIblG2nYzQOC/vGP3+pF4cJnt7dP66o MwDZ7BicfbjFtrVmPT8cTPJV7QqrUiYWBG5rACDy4oO330hEikWJfKIQSj8iBhhV5op1 Ar1ijmOZ6fc3ozxVFxf0nkNN/2skcG742AuF+wNrsLaMZ4rXlE5n4oP86nzz6+ocjPG2 5wgb/8xHyEdewdiLSDbf6C5HloQSHKHweQVWZQenFzC/2EgGslemcUwJDohJ5Yz8dS+4 9AmlZQu4qRhWgfXC6grhOibn5QilyKS93JJd74NBo+zGkOtehL82Li7+nC+wffjLU8jj v0Jg== X-Gm-Message-State: AOJu0YxElTF83sPrv4hRLI3WRAtYziToMw3egqb9KgtTvz+lkU54O7IG E9BLHb3HRzDL8BhPYjb/Vec= X-Google-Smtp-Source: AGHT+IFujSOcsXudCvocPk/iZUw+s3sjadA+Lbuh1dKD9fGAxnHqk/kWYlUE+iYoiRJHe7APaefnLg== X-Received: by 2002:a5d:5908:0:b0:317:6c19:6445 with SMTP id v8-20020a5d5908000000b003176c196445mr63201wrd.39.1696358199537; Tue, 03 Oct 2023 11:36:39 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id k15-20020a7bc40f000000b004013797efb6sm10147400wmi.9.2023.10.03.11.36.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 11:36:39 -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 , 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 , Christian Marangi , Yuanjun Gong , Simon Horman , Rob Herring , Ziwei Xiao , Rushil Gupta , Coco Li , Thomas Gleixner , Junfeng Guo , =?utf-8?q?Uwe_Kleine-K=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 Subject: [net-next PATCH v2 2/4] netdev: make napi_schedule return bool on NAPI successful schedule Date: Tue, 3 Oct 2023 16:51:48 +0200 Message-Id: <20231003145150.2498-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231003145150.2498-1-ansuelsmth@gmail.com> References: <20231003145150.2498-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.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; } /**