Since batman-adv is not actually depending on hardware capabilities, it has no limit on the MTU. Only the lower hard interfaces can limit it. In case these have an high enough MTU or fragmentation is enabled, a higher MTU than 1500 can be enabled.
Signed-off-by: Sven Eckelmann sven@narfation.org --- There are from time to time discussions about supporting jumbo frames with batman-adv. While the changes were known since a longe time [1], reviews/tests [2] by the interested parties would be appreciated.
[1] https://www.open-mesh.org/issues/365 [2] https://www.kernel.org/doc/html/v6.4/process/submitting-patches.html#using-r... --- Changes in v2: - rebased on current main - Link to v1: https://lore.kernel.org/r/20230727-jumbo-mtu-v1-0-036ce1a6e33c@narfation.org --- net/batman-adv/hard-interface.c | 4 +--- net/batman-adv/main.h | 2 ++ net/batman-adv/soft-interface.c | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 96a412beab2de9069c0f88e4cd844fbc0922aa18..717bfa03e03a3094a4a80ce5e86765d603eddca6 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -618,10 +618,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); }
/** diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 964f3088af5b52d3ad1d709fb964dc2c3d79d7a5..1c336814579df6d90e8c020d8e79bc294a8a3b66 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 282a8f9b144471b12f62a547b3e57666cbb22c6d..e5b99776d61b8c4c5fa143d27abcbeae795844cc 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -790,7 +790,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);
@@ -1047,6 +1047,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);
--- base-commit: dfdce35d69c55b6b5d017a7e800e553089a26eb9 change-id: 20230727-jumbo-mtu-13d736059c84
Best regards,