Skip to content

net: centralize net_device MTU bounds checking

Jarod Wilson lkml netdev 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 10 repliesIn review
  2. v2 posting 2/22 patches 3 repliesSuperseded
  3. v2 posting 1/22 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches1 replySuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2net: centralize net_device min/max MTU checkinginclude/linux/netdevice.h net/core/dev.c+15 -20 replies
2/2net: deprecate eth_change_mtu, remove usagearch/m68k/emu/nfeth.c drivers/isdn/hysdn/hysdn_net.c drivers/media/dvb-core/dvb_net.c +140 more+16 -1569 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 net-next 0/2] net: centralize net_device MTU bounds checking

Jarod Wilson (2):
net: centralize net_device min/max MTU checking
net: deprecate eth_change_mtu, remove usage

While looking into an MTU issue with sfc, I started noticing that almost every NIC driver with an ndo_change_mtu function implemented almost exactly the same range checks, and in many cases, that was the only practical thing their ndo_change_mtu function was doing. Quite a few drivers have either 68, 64, 60 or 46 as their minimum MTU value checked, and then various sizes from 1500 to 65535 for their maximum MTU value. We can remove a whole lot of redundant code here if we simple store min_mtu and max_mtu in net_device, and check against those in net/core/dev.c's dev_set_mtu().

This pair of patches looks to introduce centralized MTU range checking infrastructure, while maintaining compatibility with all existing drivers, and start to make use of it, converting all eth_change_mtu/ether_setup users over to this new infra.

Assuming these pass review muster, I've got a ton of follow-on patches to clean up MTU settings for everything in the kernel with an ndo_change_mtu.

This work is all staged in a (rebasing) git tree here:

https://github.com/jarodwilson/linux-muck

The master branch is based on net-next from Oct 7, and carries these two patches, plus a ton of follow-on patches to eliminate MTU range checks and change_mtu functions where possible. All patches were successfully built across 160 various arch and config combos by the 0-day folks. (Thanks to Andrew Lunn for the suggestion to get that going).

Jarod Wilson (2):
net: centralize net_device min/max MTU checking
net: deprecate eth_change_mtu, remove usage

Signature · 1 line
2.10.0