On Wed, 13 Mar 2024 15:42:27 +0100 Laurent Vivier <lvivier(a)redhat.com> wrote:On 3/13/24 12:37, Stefano Brivio wrote:Well, on Linux, virtual network interfaces such as virtio-net still have their maximum configurable MTU defined as ETH_MAX_MTU (same as the maximum IPv4 MTU, 65535), and that's a symmetric value (in standards, drivers, and elsewhere in the network stack). Side note: the TCP MSS doesn't need to be the same value for both directions, instead. But other than that, no, there are no normative references. It's an implementation "detail" if you want.On Mon, 11 Mar 2024 14:33:56 +0100 Laurent Vivier <lvivier(a)redhat.com> wrote:...> diff --git a/tcp.c b/tcp.c > index d5eedf4d0138..5c8488108ef7 100644 > --- a/tcp.c > +++ b/tcp.c > @@ -318,39 +318,7 @@...Is there a specification that limits the MSS?-#define MSS4 ROUND_DOWN(USHRT_MAX - sizeof(struct tcp4_l2_head), 4) -#define MSS6 ROUND_DOWN(USHRT_MAX - sizeof(struct tcp6_l2_head), 4) +#define MSS (USHRT_MAX - sizeof(struct tcphdr))We can't exceed USHRT_MAX at Layer-2 level, though, so the MSS for IPv4 should now be: #define MSS4 ROUND_DOWN(USHRT_MAX - sizeof(struct ethhdr) - sizeof(struct iphdr) - sizeof(struct tcphdr), 4) ...and similar for IPv6.Or is it only a compatibility problem with the network stack implementation?Kind of, yes. Except that:At headers level the only limitation we have is the length field size in the IP header that is a 16bit (it's why I put "USHRT_MAX - sizeof(struct tcphdr)")....in IPv4, that field also contains the length of the *IP header*, so, ignoring for a moment Linux and virtio-net with ETH_MAX_MTU, you would be limited to 65495 bytes (65535 minus 20 bytes of IP header, minus 20 bytes of TCP header). As RFC 791, section 3.1, states: Total Length: 16 bits Total Length is the length of the datagram, measured in octets, including internet header and data. This field allows the length of a datagram to be up to 65,535 octets. [...] ...but 65535 is the *MTU*, not MSS. And if it needs to fit ETH_MAX_MTU, you're now back to 65520 bytes of MTU (it needs to match IPv4 32-bit words, if I recall correctly), hence 65480 bytes of MSS. IPv6 is different, in that the equivalent field doesn't include the size of the IPv6 header. But the header is 40 bytes long, so the outcome is the same. Well, except that you could have jumbograms (RFC 2675) and exceed 65535 bytes of IPv6 MTU, but that won't work anyway with Ethernet-like interfaces. So, well, I haven't actually tried to send an Ethernet frame to a virtio-net interface that's bigger than 65535 bytes. As far as normative references are concerned, you could send 65549 (65535 bytes maximum IPv4 MTU, plus 14 bytes of 802.3 header on top) bytes. I guess it will be dropped by the kernel, but it's perhaps worth a try. -- Stefano