debian: Strip epoch from version number used in directory names.
[openvswitch] / datapath / vport-netdev.c
index 7cd6c6b3b79ceb103c188ba951b9a79378776f8b..a9d923865e9a466536bc29dc12ebf0e22482f226 100644 (file)
 #include "vport-netdev.h"
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37) && \
-    !defined(HAVE_VLAN_BUG_WORKAROUND)
+       !defined(HAVE_VLAN_BUG_WORKAROUND)
 #include <linux/module.h>
 
-static int vlan_tso __read_mostly = 0;
+static int vlan_tso __read_mostly;
 module_param(vlan_tso, int, 0644);
 MODULE_PARM_DESC(vlan_tso, "Enable TSO for VLAN packets");
 #else
 #define vlan_tso true
 #endif
 
-/* If the native device stats aren't 64 bit use the vport stats tracking instead. */
-#define USE_VPORT_STATS (sizeof(((struct net_device_stats *)0)->rx_bytes) < sizeof(u64))
-
 static void netdev_port_receive(struct vport *vport, struct sk_buff *skb);
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
@@ -123,7 +120,8 @@ static struct vport *netdev_create(const struct vport_parms *parms)
        struct netdev_vport *netdev_vport;
        int err;
 
-       vport = vport_alloc(sizeof(struct netdev_vport), &netdev_vport_ops, parms);
+       vport = vport_alloc(sizeof(struct netdev_vport),
+                           &netdev_vport_ops, parms);
        if (IS_ERR(vport)) {
                err = PTR_ERR(vport);
                goto error;
@@ -144,16 +142,6 @@ static struct vport *netdev_create(const struct vport_parms *parms)
                goto error_put;
        }
 
-       /* If we are using the vport stats layer initialize it to the current
-        * values so we are roughly consistent with the device stats. */
-       if (USE_VPORT_STATS) {
-               struct rtnl_link_stats64 stats;
-
-               err = netdev_get_stats(vport, &stats);
-               if (!err)
-                       vport_set_stats(vport, &stats);
-       }
-
        err = netdev_rx_handler_register(netdev_vport->dev, netdev_frame_hook,
                                         vport);
        if (err)
@@ -218,13 +206,6 @@ struct kobject *netdev_get_kobj(const struct vport *vport)
        return &netdev_vport->dev->NETDEV_DEV_MEMBER.kobj;
 }
 
-int netdev_get_stats(const struct vport *vport, struct rtnl_link_stats64 *stats)
-{
-       const struct netdev_vport *netdev_vport = netdev_vport_priv(vport);
-       dev_get_stats(netdev_vport->dev, stats);
-       return 0;
-}
-
 unsigned netdev_get_dev_flags(const struct vport *vport)
 {
        const struct netdev_vport *netdev_vport = netdev_vport_priv(vport);
@@ -282,7 +263,7 @@ static void netdev_port_receive(struct vport *vport, struct sk_buff *skb)
        vport_receive(vport, skb);
 }
 
-static inline unsigned packet_length(const struct sk_buff *skb)
+static unsigned packet_length(const struct sk_buff *skb)
 {
        unsigned length = skb->len - ETH_HLEN;
 
@@ -394,11 +375,11 @@ error:
 /* Returns null if this device is not attached to a datapath. */
 struct vport *netdev_get_vport(struct net_device *dev)
 {
-#ifdef IFF_BRIDGE_PORT
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
 #if IFF_BRIDGE_PORT != IFF_OVS_DATAPATH
        if (likely(dev->priv_flags & IFF_OVS_DATAPATH))
 #else
-       if (likely(rcu_access_pointer(dev->rx_handler) == netdev_frame_hook))   
+       if (likely(rcu_access_pointer(dev->rx_handler) == netdev_frame_hook))
 #endif
                return (struct vport *)rcu_dereference_rtnl(dev->rx_handler_data);
        else
@@ -410,8 +391,7 @@ struct vport *netdev_get_vport(struct net_device *dev)
 
 const struct vport_ops netdev_vport_ops = {
        .type           = OVS_VPORT_TYPE_NETDEV,
-       .flags          = (VPORT_F_REQUIRED |
-                         (USE_VPORT_STATS ? VPORT_F_GEN_STATS : 0)),
+       .flags          = VPORT_F_REQUIRED,
        .init           = netdev_init,
        .exit           = netdev_exit,
        .create         = netdev_create,
@@ -420,7 +400,6 @@ const struct vport_ops netdev_vport_ops = {
        .get_name       = netdev_get_name,
        .get_addr       = netdev_get_addr,
        .get_kobj       = netdev_get_kobj,
-       .get_stats      = netdev_get_stats,
        .get_dev_flags  = netdev_get_dev_flags,
        .is_running     = netdev_is_running,
        .get_operstate  = netdev_get_operstate,