Skip to content

Commit

Permalink
net: drop the weight argument from netif_napi_add
Browse files Browse the repository at this point in the history
We tell driver developers to always pass NAPI_POLL_WEIGHT
as the weight to netif_napi_add(). This may be confusing
to newcomers, drop the weight argument, those who really
need to tweak the weight can use netif_napi_add_weight().

Acked-by: Marc Kleine-Budde <[email protected]> # for CAN
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
kuba-moo authored and praveenkaligineedi committed Mar 23, 2023
1 parent 5cfb516 commit c559dab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 1 addition & 2 deletions google/gve/gve_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,7 @@ static void gve_add_napi(struct gve_priv *priv, int ntfy_idx,
{
struct gve_notify_block *block = &priv->ntfy_blocks[ntfy_idx];

netif_napi_add(priv->dev, &block->napi, gve_poll,
NAPI_POLL_WEIGHT);
netif_napi_add(priv->dev, &block->napi, gve_poll);
}

static void gve_remove_napi(struct gve_priv *priv, int ntfy_idx)
Expand Down
9 changes: 8 additions & 1 deletion patches/netif_napi_add.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
expression dev, napi, func, weight;
@@

netif_napi_add(dev, napi, func, weight);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0)
netif_napi_add(dev, napi, func);
+#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0) */
+netif_napi_add(dev, napi, func, NAPI_POLL_WEIGHT);
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0) */

+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+napi_hash_add(napi);
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) && LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0) */


0 comments on commit c559dab

Please sign in to comment.