Fix build error in br_if.c

net/bridge/br_if.c: In function ‘br_mtu’:
net/bridge/br_if.c:458:8: error: ‘const struct net_bridge’ has no member named 
‘vlan_enabled’
  if (br->vlan_enabled)
        ^
net/bridge/br_if.c:462:1: warning: control reaches end of non-void function 
[-Wreturn-type]
 }
 ^
Fixes: 419d14af9e07f ("bridge: Allow max MTU when multiple VLANs present")
Signed-off-by: John Fastabend <john.fastab...@gmail.com>
---
 net/bridge/br_if.c |   27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 48dc4d2..2262424 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -424,16 +424,6 @@ int br_del_bridge(struct net *net, const char *name)
        return ret;
 }
 
-static bool min_mtu(int a, int b)
-{
-       return a < b ? 1 : 0;
-}
-
-static bool max_mtu(int a, int b)
-{
-       return a > b ? 1 : 0;
-}
-
 /* MTU of the bridge pseudo-device: ETH_DATA_LEN or the minimum of the ports */
 static int __br_mtu(const struct net_bridge *br, bool (compare_fn)(int, int))
 {
@@ -453,6 +443,17 @@ static int __br_mtu(const struct net_bridge *br, bool 
(compare_fn)(int, int))
        return mtu;
 }
 
+static bool min_mtu(int a, int b)
+{
+       return a < b ? 1 : 0;
+}
+
+#ifdef CONFIG_BRIDGE_VLAN_FILTERING
+static bool max_mtu(int a, int b)
+{
+       return a > b ? 1 : 0;
+}
+
 int br_mtu(const struct net_bridge *br)
 {
        if (br->vlan_enabled)
@@ -460,6 +461,12 @@ int br_mtu(const struct net_bridge *br)
        else
                return __br_mtu(br, min_mtu);
 }
+#else
+int br_mtu(const struct net_bridge *br)
+{
+       return __br_mtu(br, min_mtu);
+}
+#endif
 
 static void br_set_gso_limits(struct net_bridge *br)
 {

Reply via email to