compat-wireless: use new br_port_exists() from compat.git
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Fri, 6 Aug 2010 23:15:57 +0000 (16:15 -0700)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Fri, 6 Aug 2010 23:16:26 +0000 (16:16 -0700)
This lets us simplify the way we backport the new bridge port
changes on the bridge code. We can nuke this new patch file
if we later get br_port_exists() accepted to be used on drivers.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
patches/30-br-port-backport.patch [deleted file]
patches/30-bridge-port.patch [new file with mode: 0644]

diff --git a/patches/30-br-port-backport.patch b/patches/30-br-port-backport.patch
deleted file mode 100644 (file)
index 67f86eb..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-In commit f350a0a87374418635689471606454abc7beaa3a the br_port
-attribute was replaced with a private flag.
-
---- a/net/wireless/nl80211.c
-+++ b/net/wireless/nl80211.c
-@@ -1140,7 +1140,11 @@ static int nl80211_valid_4addr(struct cf
-                              enum nl80211_iftype iftype)
- {
-       if (!use_4addr) {
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-               if (netdev && (netdev->priv_flags & IFF_BRIDGE_PORT))
-+#else
-+              if (netdev && netdev->br_port)
-+#endif
-                       return -EBUSY;
-               return 0;
-       }
---- a/net/wireless/util.c
-+++ b/net/wireless/util.c
-@@ -770,7 +770,11 @@ int cfg80211_change_iface(struct cfg8021
-               return -EOPNOTSUPP;
-       /* if it's part of a bridge, reject changing type to station/ibss */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-       if ((dev->priv_flags & IFF_BRIDGE_PORT) &&
-+#else
-+      if (dev->br_port &&
-+#endif
-           (ntype == NL80211_IFTYPE_ADHOC || ntype == NL80211_IFTYPE_STATION))
-               return -EBUSY;
diff --git a/patches/30-bridge-port.patch b/patches/30-bridge-port.patch
new file mode 100644 (file)
index 0000000..1ee4661
--- /dev/null
@@ -0,0 +1,45 @@
+The patch titled:
+
+    bridge: use rx_handler_data pointer to store net_bridge_port pointer
+   
+by Jiri Pirko <jpirko@redhat.com> moved the br_ports pointer
+out of the netdev which older kernels relied on and then added
+a flag to the netdev to check for it as follows:
+
+-                               dev->br_port) {
++                   (dev->priv_flags & IFF_BRIDGE_PORT)) {
+
+So to backport this we instead rely on a br_port_exists() call
+which compat.git provides and depending on the kernel it will either
+check for the dev->br_port or the IFF_BRIDGE_PORT flag. A patch
+to get the blow code merged upstream and to use br_port_exists()
+everywhere else will be submitted but not sure if it will be
+accepted.
+
+This patch can be removed once we get br_port_exists() accessible
+to drivers and not just private bridge code. If that patch doesn't
+get accepted upstream we'l have to carry this patch around for
+compat-wireless.
+
+--- a/net/wireless/util.c
++++ b/net/wireless/util.c
+@@ -770,7 +770,7 @@ int cfg80211_change_iface(struct cfg8021
+               return -EOPNOTSUPP;
+       /* if it's part of a bridge, reject changing type to station/ibss */
+-      if ((dev->priv_flags & IFF_BRIDGE_PORT) &&
++      if (br_port_exists(dev) &&
+           (ntype == NL80211_IFTYPE_ADHOC || ntype == NL80211_IFTYPE_STATION))
+               return -EBUSY;
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -1140,7 +1140,7 @@ static int nl80211_valid_4addr(struct cf
+                              enum nl80211_iftype iftype)
+ {
+       if (!use_4addr) {
+-              if (netdev && (netdev->priv_flags & IFF_BRIDGE_PORT))
++              if (netdev && br_port_exists(netdev))
+                       return -EBUSY;
+               return 0;
+       }