]> git.openfabrics.org - ~aditr/compat.git/commitdiff
compat: add br_port_exists() and ask for inclusion upstream
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Fri, 6 Aug 2010 23:03:42 +0000 (16:03 -0700)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Fri, 6 Aug 2010 23:03:42 +0000 (16:03 -0700)
The br_port_exists() call is used internally on private bridge
code on net/bridge/ to check if a netdevice is a bridge port.
The way to check if a netdevice is a bridge port has changed
for 2.6.36 from checking the netdev->br_port pointer to
checking for a IFF_BRIDGE_PORT flag on the netdev->priv_flags.

Instead of requiring backport code to ifdef the checks lets
move the private br_port_exists() to a public header accessible
by drivers and consistantly use it to check for the bridge
port.

I'll submit a patch upstream to move br_port_exists() to a public
header so that we don't have to later even require a patch on
backported code. We'll see if it gets accepted though.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
include/linux/compat-2.6.37.h [new file with mode: 0644]
include/linux/compat-2.6.h

diff --git a/include/linux/compat-2.6.37.h b/include/linux/compat-2.6.37.h
new file mode 100644 (file)
index 0000000..a33c9a2
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef LINUX_26_37_COMPAT_H
+#define LINUX_26_37_COMPAT_H
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
+
+/*
+ * This is not part of The 2.6.37 kernel yet but we
+ * we use it to optimize the backport code we
+ * need to implement. Instead of using ifdefs
+ * to check what version of the check we use
+ * we just replace all checks on current code
+ * with this. I'll submit this upstream too, that
+ * way all we'd have to do is to implement this
+ * for older kernels, then we would not have to
+ * edit the upstrema code for backport efforts.
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+#define br_port_exists(dev)    (dev->priv_flags & IFF_BRIDGE_PORT)
+#else
+#define br_port_exists(dev)    (dev->br_port)
+#endif
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */
+
+#endif /* LINUX_26_37_COMPAT_H */
index ef51195f7b9dced76793cd46344010c437fa65ff..25490f2e6dbed1fd9e0aea2b020c73158f20785c 100644 (file)
@@ -29,5 +29,6 @@
 #include <linux/compat-2.6.34.h>
 #include <linux/compat-2.6.35.h>
 #include <linux/compat-2.6.36.h>
+#include <linux/compat-2.6.37.h>
 
 #endif /* LINUX_26_COMPAT_H */