* [PATCH net-next 1/2] net: introduce NAPI_POLL_WEIGHT
@ 2013-03-06 1:57 Eric Dumazet
2013-03-06 4:59 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2013-03-06 1:57 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Eilon Greenstein
From: Eric Dumazet <edumazet@google.com>
Some drivers use a too big NAPI poll weight.
This patch adds a NAPI_POLL_WEIGHT default value
and issues an error message if a driver attempts
to use a bigger weight.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Eilon Greenstein <eilong@broadcom.com>
---
include/linux/netdevice.h | 5 +++++
net/core/dev.c | 3 +++
2 files changed, 8 insertions(+)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b3d00fa..896eb49 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1475,6 +1475,11 @@ static inline void *netdev_priv(const struct net_device *dev)
*/
#define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype))
+/* Default NAPI poll() weight
+ * Device drivers are strongly advised to not use bigger value
+ */
+#define NAPI_POLL_WEIGHT 64
+
/**
* netif_napi_add - initialize a napi context
* @dev: network device
diff --git a/net/core/dev.c b/net/core/dev.c
index a06a7a5..9610389 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4057,6 +4057,9 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
napi->gro_list = NULL;
napi->skb = NULL;
napi->poll = poll;
+ if (weight > NAPI_POLL_WEIGHT)
+ pr_err_once("netif_napi_add() called with weight %d on device %s\n",
+ weight, dev->name);
napi->weight = weight;
list_add(&napi->dev_list, &dev->napi_list);
napi->dev = dev;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next 1/2] net: introduce NAPI_POLL_WEIGHT
2013-03-06 1:57 [PATCH net-next 1/2] net: introduce NAPI_POLL_WEIGHT Eric Dumazet
@ 2013-03-06 4:59 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-03-06 4:59 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, eilong
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 05 Mar 2013 17:57:22 -0800
> From: Eric Dumazet <edumazet@google.com>
>
> Some drivers use a too big NAPI poll weight.
>
> This patch adds a NAPI_POLL_WEIGHT default value
> and issues an error message if a driver attempts
> to use a bigger weight.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Eilon Greenstein <eilong@broadcom.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-06 4:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-06 1:57 [PATCH net-next 1/2] net: introduce NAPI_POLL_WEIGHT Eric Dumazet
2013-03-06 4:59 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).