ofproto-dpif: Shortcut common case in rule_check().
[cascardo/ovs.git] / datapath / vport-netdev.c
index 05ad0b4..6c83737 100644 (file)
@@ -38,7 +38,7 @@
 static struct vport_ops ovs_netdev_vport_ops;
 static void netdev_port_receive(struct vport *vport, struct sk_buff *skb);
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
+#if defined HAVE_RX_HANDLER_PSKB  /* 2.6.39 and above or backports */
 /* Called with rcu_read_lock and bottom-halves disabled. */
 static rx_handler_result_t netdev_frame_hook(struct sk_buff **pskb)
 {
@@ -134,6 +134,7 @@ static struct vport *netdev_create(const struct vport_parms *parms)
        if (err)
                goto error_master_upper_dev_unlink;
 
+       dev_disable_lro(netdev_vport->dev);
        dev_set_promiscuity(netdev_vport->dev, 1);
        netdev_vport->dev->priv_flags |= IFF_OVS_DATAPATH;
        rtnl_unlock();
@@ -256,7 +257,7 @@ drop:
 /* Returns null if this device is not attached to a datapath. */
 struct vport *ovs_netdev_get_vport(struct net_device *dev)
 {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) || \
+#if defined HAVE_NETDEV_RX_HANDLER_REGISTER || \
     defined HAVE_RHEL_OVS_HOOK
 #ifdef HAVE_OVS_DATAPATH
        if (likely(dev->priv_flags & IFF_OVS_DATAPATH))
@@ -265,8 +266,13 @@ struct vport *ovs_netdev_get_vport(struct net_device *dev)
 #endif
 #ifdef HAVE_RHEL_OVS_HOOK
                return (struct vport *)rcu_dereference_rtnl(dev->ax25_ptr);
+#else
+#ifdef HAVE_NET_DEVICE_EXTENDED
+               return (struct vport *)
+                       rcu_dereference_rtnl(netdev_extended(dev)->rx_handler_data);
 #else
                return (struct vport *)rcu_dereference_rtnl(dev->rx_handler_data);
+#endif
 #endif
        else
                return NULL;
@@ -293,7 +299,7 @@ void ovs_netdev_exit(void)
        ovs_vport_ops_unregister(&ovs_netdev_vport_ops);
 }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) && \
+#if !defined HAVE_NETDEV_RX_HANDLER_REGISTER && \
     !defined HAVE_RHEL_OVS_HOOK
 /*
  * Enforces, mutual exclusion with the Linux bridge module, by declaring and