This adds compatibility with kernel changeset
"bridge: use rx_handler_data pointer to store net_bridge_port pointer"
which was added between 2.6.35 and 2.6.35-rc1.

Signed-off-by: Simon Horman <horms@verge.net.au>

--- 

Compile tested only

This still conflicts with the bridge module due to the use of IFF_VPORT.
This should be solvable after merging the code into the kernel tree
by adding IFF_NETDEV_PORT (or any other unique name) and using it.

Index: openvswitch/datapath/vport-netdev.c
===================================================================
--- openvswitch.orig/datapath/vport-netdev.c	2010-08-06 23:31:52.000000000 +0900
+++ openvswitch/datapath/vport-netdev.c	2010-08-06 23:52:52.000000000 +0900
@@ -22,6 +22,15 @@
 
 #include "compat.h"
 
+#ifndef HAVE_BR_PORT
+#define vport_get_rcu(dev) \
+        ((struct vport *) rcu_dereference(dev->rx_handler_data))
+#define vort_get(dev) ((struct vport *) dev->rx_handler_data)
+/* XXX: Add IFF_OVS_DATAPATH to include/linux/if.h and use it
+ *	in place of IFF_VPORT in this file. */
+#define vport_exists(dev) (dev->priv_flags & IFF_BRIDGE_PORT)
+#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))
 
@@ -75,7 +84,7 @@ static struct sk_buff *netdev_frame_hook
 	if (skb->pkt_type == PACKET_LOOPBACK)
 		return skb;
 
-	vport = (struct vport *)rcu_dereference(skb->dev->br_port);
+	vport = (struct vport *)vport_get_rcu(skb->dev);
 
 	netdev_port_receive(vport, skb);
 
@@ -113,7 +122,12 @@ static struct vport *netdev_create(const
 		goto error_put;
 	}
 
-	if (netdev_vport->dev->br_port) {
+#ifdef HAVE_BR_PORT
+	if (netdev_vport->dev->br_port)
+#else
+	if (netdev_vport->dev->priv_flags & IFF_BRIDGE_PORT)
+#endif
+	{
 		err = -EBUSY;
 		goto error_put;
 	}
@@ -151,27 +165,40 @@ static int netdev_destroy(struct vport *
 static int netdev_attach(struct vport *vport)
 {
 	struct netdev_vport *netdev_vport = netdev_vport_priv(vport);
-	int err = 0;
+	int err;
 
 	dev_set_promiscuity(netdev_vport->dev, 1);
 	dev_disable_lro(netdev_vport->dev);
+#ifdef HAVE_BR_PORT
 	rcu_assign_pointer(netdev_vport->dev->br_port,
 			   (struct net_bridge_port *)vport);
+	vport = NULL;
+#endif
 #ifndef HAVE_BR_HANDLE_FRAME_HOOK
 	err = netdev_rx_handler_register(netdev_vport->dev,
-					 netdev_frame_hook, NULL);
+					 netdev_frame_hook, vport);
+	if (err)
+		return err;
 #endif
-	return err;
+#ifndef HAVE_BR_PORT
+	netdev_vport->dev->priv_flags |= IFF_BRIDGE_PORT;
+#endif
+	return 0;
 }
 
 static int netdev_detach(struct vport *vport)
 {
 	struct netdev_vport *netdev_vport = netdev_vport_priv(vport);
 
+#ifndef HAVE_BR_PORT
+	netdev_vport->dev->priv_flags &= ~IFF_BRIDGE_PORT;
+#endif
 #ifndef HAVE_BR_HANDLE_FRAME_HOOK
 	netdev_rx_handler_unregister(netdev_vport->dev);
 #endif
+#ifdef HAVE_BR_PORT
 	rcu_assign_pointer(netdev_vport->dev->br_port, NULL);
+#endif
 	dev_set_promiscuity(netdev_vport->dev, -1);
 
 	return 0;
@@ -307,7 +334,11 @@ static int netdev_send(struct vport *vpo
 /* Returns null if this device is not attached to a datapath. */
 struct vport *netdev_get_vport(struct net_device *dev)
 {
+#ifdef HAVE_BR_PORT
 	return (struct vport *)dev->br_port;
+#else
+	return vport_get_rcu(dev);
+#endif
 }
 
 struct vport_ops netdev_vport_ops = {
Index: openvswitch/acinclude.m4
===================================================================
--- openvswitch.orig/acinclude.m4	2010-08-06 23:31:30.000000000 +0900
+++ openvswitch/acinclude.m4	2010-08-06 23:48:41.000000000 +0900
@@ -165,6 +165,8 @@ AC_DEFUN([OVS_CHECK_LINUX26_COMPAT], [
                   [OVS_DEFINE([HAVE_DEV_DISABLE_LRO])])
   OVS_GREP_IFELSE([$KSRC26/include/linux/netdevice.h], [dev_get_stats],
                   [OVS_DEFINE([HAVE_DEV_GET_STATS])])
+  OVS_GREP_IFELSE([$KSRC26/include/linux/netdevice.h], [br_port],
+                  [OVS_DEFINE([HAVE_BR_PORT])])
 
   # Check for the proto_data_valid member in struct sk_buff.  The [^@]
   # is necessary because some versions of this header remove the



