diff mbox series

[net-next,2/4] netdev: make napi_schedule return bool on NAPI successful schedule

Message ID 20231002151023.4054-2-ansuelsmth@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next,1/4] netdev: replace simple napi_schedule_prep/__napi_schedule to napi_schedule | expand

Checks

Context Check Description
netdev/series_format warning Series does not have a cover letter
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 4136 this patch: 4151
netdev/cc_maintainers warning 3 maintainers not CCed: linux-mediatek@lists.infradead.org matthias.bgg@gmail.com angelogioacchino.delregno@collabora.com
netdev/build_clang fail Errors and warnings before: 315 this patch: 315
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 4489 this patch: 4488
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 20 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Christian Marangi Oct. 2, 2023, 3:10 p.m. UTC
Change napi_schedule to return a bool on NAPI successful schedule. This
might be useful for some driver to do additional step after a NAPI ahs
been scheduled.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 include/linux/netdevice.h | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Jeff Johnson Oct. 2, 2023, 4:08 p.m. UTC | #1
On 10/2/2023 8:10 AM, Christian Marangi wrote:
> Change napi_schedule to return a bool on NAPI successful schedule. This
> might be useful for some driver to do additional step after a NAPI ahs

nit:s/ahs/has/

> been scheduled.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
>   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;
>   }
>   
>   /**
Eric Dumazet Oct. 3, 2023, 5:21 a.m. UTC | #2
On Mon, Oct 2, 2023 at 5:10 PM Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> Change napi_schedule to return a bool on NAPI successful schedule. This
> might be useful for some driver to do additional step after a NAPI ahs

This might be useful for some drivers to do additional steps after a
NAPI has been scheduled.

> been scheduled.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>

Yeah, I guess you forgot to mention I suggested this patch ...

Reviewed-by: Eric Dumazet <edumazet@google.com>
Christian Marangi Oct. 3, 2023, 10:25 a.m. UTC | #3
On Tue, Oct 03, 2023 at 07:21:46AM +0200, Eric Dumazet wrote:
> On Mon, Oct 2, 2023 at 5:10 PM Christian Marangi <ansuelsmth@gmail.com> wrote:
> >
> > Change napi_schedule to return a bool on NAPI successful schedule. This
> > might be useful for some driver to do additional step after a NAPI ahs
> 
> This might be useful for some drivers to do additional steps after a
> NAPI has been scheduled.
> 
> > been scheduled.
> >
> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> 
> Yeah, I guess you forgot to mention I suggested this patch ...
> 
> Reviewed-by: Eric Dumazet <edumazet@google.com>

Yes sorry, totally forgot to add this here. I already have the patch for the
other driver (but it's dependant on this so I'm waiting) and I forgot to
add the tag also for this piece.
diff mbox series

Patch

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;
 }
 
 /**