Skip to content

Commit

Permalink
netdev: make napi_schedule return bool on NAPI successful schedule
Browse files Browse the repository at this point in the history
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 <edumazet@google.com>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20231009133754.9834-2-ansuelsmth@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Christian Marangi authored and Jakub Kicinski committed Oct 12, 2023
1 parent ef72451 commit 0a77900
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 0a77900

Please sign in to comment.