net: add busy_poll device feature
authorJiri Pirko <jiri@resnulli.us>
Wed, 2 Apr 2014 21:09:31 +0000 (23:09 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 Apr 2014 18:31:34 +0000 (14:31 -0400)
Currently there is no way how to find out if a device supports busy
polling. So add a feature and make it dependent on ndo_busy_poll
existence.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdev_features.h
net/core/dev.c
net/core/ethtool.c

index 5a09a48f2658a64f7149ecddd30abd56c65cf69f..c26d0ec2ef3a90b7a988da8c31f9667716c78392 100644 (file)
@@ -63,6 +63,7 @@ enum {
        NETIF_F_HW_VLAN_STAG_RX_BIT,    /* Receive VLAN STAG HW acceleration */
        NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
        NETIF_F_HW_L2FW_DOFFLOAD_BIT,   /* Allow L2 Forwarding in Hardware */
+       NETIF_F_BUSY_POLL_BIT,          /* Busy poll */
 
        /*
         * Add your fresh new feature above and remember to update
@@ -118,6 +119,7 @@ enum {
 #define NETIF_F_HW_VLAN_STAG_RX        __NETIF_F(HW_VLAN_STAG_RX)
 #define NETIF_F_HW_VLAN_STAG_TX        __NETIF_F(HW_VLAN_STAG_TX)
 #define NETIF_F_HW_L2FW_DOFFLOAD       __NETIF_F(HW_L2FW_DOFFLOAD)
+#define NETIF_F_BUSY_POLL      __NETIF_F(BUSY_POLL)
 
 /* Features valid for ethtool to change */
 /* = all defined minus driver/device-class-related */
index 757063420ce0f2144d90fc6eeb67f0c44ef57126..75e88e0372cbc727232d029702b2f43e8f499d4f 100644 (file)
@@ -5696,6 +5696,13 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
                }
        }
 
+#ifdef CONFIG_NET_RX_BUSY_POLL
+       if (dev->netdev_ops->ndo_busy_poll)
+               features |= NETIF_F_BUSY_POLL;
+       else
+#endif
+               features &= ~NETIF_F_BUSY_POLL;
+
        return features;
 }
 
index 30071dec287a4674b64ec4f29c158d8a0a57bf56..640ba0e5831ce0334a9cbf03983c16a022e85065 100644 (file)
@@ -97,6 +97,7 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
        [NETIF_F_RXFCS_BIT] =            "rx-fcs",
        [NETIF_F_RXALL_BIT] =            "rx-all",
        [NETIF_F_HW_L2FW_DOFFLOAD_BIT] = "l2-fwd-offload",
+       [NETIF_F_BUSY_POLL_BIT] =        "busy-poll",
 };
 
 static int ethtool_get_features(struct net_device *dev, void __user *useraddr)