From c559dab81a07d021794c6a0521b42747632240b8 Mon Sep 17 00:00:00 2001 From: Jakub Kicinski Date: Tue, 27 Sep 2022 06:27:53 -0700 Subject: [PATCH] net: drop the weight argument from netif_napi_add 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 # for CAN Link: https://lore.kernel.org/r/20220927132753.750069-1-kuba@kernel.org Signed-off-by: Jakub Kicinski --- google/gve/gve_main.c | 3 +-- patches/netif_napi_add.cocci | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/google/gve/gve_main.c b/google/gve/gve_main.c index c325573..96d6f7f 100644 --- a/google/gve/gve_main.c +++ b/google/gve/gve_main.c @@ -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) diff --git a/patches/netif_napi_add.cocci b/patches/netif_napi_add.cocci index 78f33f9..e69551f 100644 --- a/patches/netif_napi_add.cocci +++ b/patches/netif_napi_add.cocci @@ -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) */ + +