Skip to content

usbnet: limit max_mtu based on device's hard_mtu#7203

Closed
dilyanpalauzov wants to merge 1 commit intoraspberrypi:rpi-6.12.yfrom
dilyanpalauzov:usbnet_qemu
Closed

usbnet: limit max_mtu based on device's hard_mtu#7203
dilyanpalauzov wants to merge 1 commit intoraspberrypi:rpi-6.12.yfrom
dilyanpalauzov:usbnet_qemu

Conversation

@dilyanpalauzov
Copy link

This backport of https://git.kernel.org/netdev/net/c/c7159e960f14 will allow running Raspberry Pi OS kernel in QEMU using passt usb networking, without requiring throttling.

The initial problem is described at https://gitlab.com/qemu-project/qemu/-/issues/3268 and https://bugs.passt.top/attachment.cgi?bugid=189.


From: Laurent Vivier <lvivier working in redhat.com>
Date: Mon, 19 Jan 2026 08:55:18 +0100

The usbnet driver initializes net->max_mtu to ETH_MAX_MTU before calling the device's bind() callback. When the bind() callback sets dev->hard_mtu based the device's actual capability (from CDC Ethernet's wMaxSegmentSize descriptor), max_mtu is never updated to reflect this hardware limitation).

This allows userspace (DHCP or IPv6 RA) to configure MTU larger than the device can handle, leading to silent packet drops when the backend sends packet exceeding the device's buffer size.

Fix this by limiting net->max_mtu to the device's hard_mtu after the bind callback returns.

See https://gitlab.com/qemu-project/qemu/-/issues/3268 and
https://bugs.passt.top/attachment.cgi?bugid=189

Fixes: f77f0ae ("net: use core MTU range checking in USB NIC drivers")

Link: https://bugs.passt.top/show_bug.cgi?id=189
Reviewed-by: Stefano Brivio <sbrivio working in redhat.com>
Link: https://patch.msgid.link/20260119075518.2774373-1-lvivier@redhat.com

This backport of https://git.kernel.org/netdev/net/c/c7159e960f14
will allow running Raspberry Pi OS kernel in QEMU using passt usb
networking, without requiring throttling.

The initial problem is described at
https://gitlab.com/qemu-project/qemu/-/issues/3268
and https://bugs.passt.top/attachment.cgi?bugid=189.

-----

From: Laurent Vivier <lvivier@redhat.com>
Date: Mon, 19 Jan 2026 08:55:18 +0100

The usbnet driver initializes net->max_mtu to ETH_MAX_MTU before calling
the device's bind() callback. When the bind() callback sets
dev->hard_mtu based the device's actual capability (from CDC Ethernet's
wMaxSegmentSize descriptor), max_mtu is never updated to reflect this
hardware limitation).

This allows userspace (DHCP or IPv6 RA) to configure MTU larger than the
device can handle, leading to silent packet drops when the backend sends
packet exceeding the device's buffer size.

Fix this by limiting net->max_mtu to the device's hard_mtu after the
bind callback returns.

See https://gitlab.com/qemu-project/qemu/-/issues/3268 and
    https://bugs.passt.top/attachment.cgi?bugid=189

Fixes: f77f0ae ("net: use core MTU range checking in USB NIC drivers")
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Link: https://bugs.passt.top/show_bug.cgi?id=189
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Link: https://patch.msgid.link/20260119075518.2774373-1-lvivier@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
@pelwell
Copy link
Contributor

pelwell commented Jan 21, 2026

You're keen - this commit hasn't even hit linux-next yet. Fortunately for you it has a Fixes tag, so I expect it to be automatically back-ported to the LTS branches, including 6.12. If nothing has appeared after a week or two, feel free to add a comment.

@dilyanpalauzov dilyanpalauzov deleted the usbnet_qemu branch February 7, 2026 11:31
@dilyanpalauzov
Copy link
Author

dilyanpalauzov commented Feb 13, 2026

The patch is included in Linux 6.12.68.

When can I expect that an image is released at https://www.raspberrypi.org/software/operating-systems/, which contains at least kernel 6.12.68?

@dilyanpalauzov
Copy link
Author

i meant 6.12.58

@dilyanpalauzov
Copy link
Author

Arr, I meant 6.12.68

@dilyanpalauzov
Copy link
Author

Totay is "Friday 13”, which explains the typos with the version.

@popcornmix
Copy link
Collaborator

You can get 6.12.70 from rpi-update (read the caveats before updating).
apt kernel will be updated at some point (but there is no release date currently).

@dilyanpalauzov
Copy link
Author

I do not want to get 6.12.70 with rpi-update. I want to download an image from https://www.raspberrypi.org/software/operating-systems/, then start it under QEMU, and finally do some configuration (over ssh to QEMU). Currently the network has to be explicitly throttled in QEMU:

  • for SLIRP and scp I have to use -Xbuffer=10240
  • for PASST and scp — qemu-system-aarch64 -M raspi3b -netdev passt — I have to pass -l 10 -Xbuffer=1024 to sftp.

So it only makes sense if this patch is included in the image, before QEMU loads the image, not installing it afterwards.

@pelwell
Copy link
Contributor

pelwell commented Feb 13, 2026

Already addressed:

apt kernel will be updated at some point (but there is no release date currently).

@pelwell
Copy link
Contributor

pelwell commented Feb 13, 2026

And your URL is out of date - it should be a dotcom address: https://www.raspberrypi.com/software/operating-systems/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants