From: Luis R. Rodriguez Date: Fri, 6 Aug 2010 23:03:42 +0000 (-0700) Subject: compat: add br_port_exists() and ask for inclusion upstream X-Git-Tag: v2.6.37-rc1-1~33 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=a092b2412f79c61eddd9e892e7cc7cec2aa132ea;p=~tnikolova%2Fcompat%2F.git compat: add br_port_exists() and ask for inclusion upstream 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 --- diff --git a/include/linux/compat-2.6.37.h b/include/linux/compat-2.6.37.h new file mode 100644 index 0000000..a33c9a2 --- /dev/null +++ b/include/linux/compat-2.6.37.h @@ -0,0 +1,27 @@ +#ifndef LINUX_26_37_COMPAT_H +#define LINUX_26_37_COMPAT_H + +#include + +#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 */ diff --git a/include/linux/compat-2.6.h b/include/linux/compat-2.6.h index ef51195..25490f2 100644 --- a/include/linux/compat-2.6.h +++ b/include/linux/compat-2.6.h @@ -29,5 +29,6 @@ #include #include #include +#include #endif /* LINUX_26_COMPAT_H */