Project

General

Profile

Actions

Feature #365

open

Support Jumbo frames via batman-adv

Added by Sven Eckelmann over 5 years ago. Updated 9 months ago.

Status:
New
Priority:
Normal
Target version:
-
Start date:
11/17/2018
Due date:
% Done:

0%

Estimated time:

Description

The batadv interface is currently limited to 1500 bytes. There are two reasons why this happens:

It has to be checked why this limit was added in the first place, checked whether it can be removed now and then these two functions have to be modified. For kernels < 4.10, an appropriate compat helper has to be added to compat.h.


Files

Actions #1

Updated by Sven Eckelmann over 5 years ago

  • Description updated (diff)
Actions #2

Updated by Sven Eckelmann almost 4 years ago

  • Description updated (diff)
Actions #3

Updated by Sven Eckelmann over 3 years ago

  • Description updated (diff)
Actions #4

Updated by Marek Küthe 9 months ago

Hello,

since I was not aware of this issue, I reported it as a bug in OpenWrt: https://github.com/openwrt/routing/issues/991

Are there any updates for this FR in the meantime?

Actions #5

Updated by Sven Eckelmann 9 months ago

No. Somebody has to add following patch and then figure out whether their are any limitations, problems, .... - and then of course fix them

From: Sven Eckelmann <sven@narfation.org>
Date: Tue, 18 Jul 2023 11:09:18 +0200
Subject: batman-adv: Add support for jumbo frames

TODO: write a commit message

Signed-off-by: Sven Eckelmann <sven@narfation.org>

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index a0c7fabd0b31d0c2e59dfdee0a703debc90bffe2..67bca22e62602f8f012984cb3fa3cb69140f26c0 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -613,10 +613,8 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)

     /* the real soft-interface MTU is computed by removing the payload
      * overhead from the maximum amount of bytes that was just computed.
-     *
-     * However batman-adv does not support MTUs bigger than ETH_DATA_LEN
      */
-    return min_t(int, min_mtu - batadv_max_header_len(), ETH_DATA_LEN);
+    return min_t(int, min_mtu - batadv_max_header_len(), BATADV_MAX_MTU);
 }

 /**
@@ -742,18 +740,18 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
             hard_iface->net_dev->name);

     if (atomic_read(&bat_priv->fragmentation) &&
-        hard_iface->net_dev->mtu < ETH_DATA_LEN + max_header_len)
+        hard_iface->net_dev->mtu < BATADV_MAX_MTU + max_header_len)
         batadv_info(hard_iface->soft_iface,
                 "The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to %i would solve the problem.\n",
                 hard_iface->net_dev->name, hard_iface->net_dev->mtu,
-                ETH_DATA_LEN + max_header_len);
+                BATADV_MAX_MTU + max_header_len);

     if (!atomic_read(&bat_priv->fragmentation) &&
-        hard_iface->net_dev->mtu < ETH_DATA_LEN + max_header_len)
+        hard_iface->net_dev->mtu < BATADV_MAX_MTU + max_header_len)
         batadv_info(hard_iface->soft_iface,
                 "The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. If you experience problems getting traffic through try increasing the MTU to %i.\n",
                 hard_iface->net_dev->name, hard_iface->net_dev->mtu,
-                ETH_DATA_LEN + max_header_len);
+                BATADV_MAX_MTU + max_header_len);

     if (batadv_hardif_is_iface_up(hard_iface))
         batadv_hardif_activate_interface(hard_iface);
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 494d1ebecac2b6d4649ff28e10b5c53183cc0fde..68fa46105e5a18bec3554ffed7fa5d0e711229b4 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -22,6 +22,8 @@
 #define BATADV_THROUGHPUT_MAX_VALUE 0xFFFFFFFF
 #define BATADV_JITTER 20

+#define BATADV_MAX_MTU (ETH_MAX_MTU - batadv_max_header_len())
+
 /* Time To Live of broadcast messages */
 #define BATADV_TTL 50

diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index fd0a3a48626af3830f83967f3b028495e49e4172..4e4d744f4eb446d0d1728041d698290c0aa753b4 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -157,7 +157,7 @@ static int batadv_interface_change_mtu(struct net_device *dev, int new_mtu)
     struct batadv_priv *bat_priv = netdev_priv(dev);

     /* check ranges */
-    if (new_mtu < 68 || new_mtu > batadv_hardif_min_mtu(dev))
+    if (new_mtu < ETH_MIN_MTU || new_mtu > batadv_hardif_min_mtu(dev))
         return -EINVAL;

     dev->mtu = new_mtu;
@@ -774,7 +774,7 @@ static int batadv_softif_init_late(struct net_device *dev)
     atomic_set(&bat_priv->log_level, 0);
 #endif
     atomic_set(&bat_priv->fragmentation, 1);
-    atomic_set(&bat_priv->packet_size_max, ETH_DATA_LEN);
+    atomic_set(&bat_priv->packet_size_max, BATADV_MAX_MTU);
     atomic_set(&bat_priv->bcast_queue_left, BATADV_BCAST_QUEUE_LEN);
     atomic_set(&bat_priv->batman_queue_left, BATADV_BATMAN_QUEUE_LEN);

@@ -1014,6 +1014,7 @@ static void batadv_softif_init_early(struct net_device *dev)
      * have not been initialized yet
      */
     dev->mtu = ETH_DATA_LEN;
+    dev->max_mtu = BATADV_MAX_MTU;

     /* generate random address */
     eth_hw_addr_random(dev);


Especially for broadcast, multicast (optimization), TT, network coding, OGMs, ELPs, ...

And definitely open questions are:

  • what to do with the "The MTU of interface XXX" is too small messages? Because it will now warn all the time because no(?) interface will be able to transport 2**16-1 bytes. Maybe we should leave the checks to ETH_DATA_LEN in batadv_hardif_enable_interface?
Actions

Also available in: Atom PDF