]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
net: introduce NAPI_POLL_WEIGHT
authorEric Dumazet <edumazet@google.com>
Tue, 5 Mar 2013 15:57:22 +0000 (15:57 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Mar 2013 04:40:01 +0000 (23:40 -0500)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
net/core/dev.c

index b3d00fa4b3149b614365dd215a611ed638fdb924..896eb4985f9714b644ac0dc50b2193e6ffe0b95e 100644 (file)
@@ -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
index a06a7a58dd1181b4134adf7cd95d4b1b5512cda3..96103894ad69dd86e93265305701a25e14867194 100644 (file)
@@ -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;