the subject says it all really. this is necessary if you want to stack vlans on trunks, and have trunk with a lower mtu than the vlans on top of it.
eg, here i have a setup where most of the hosts connectivity is on a trunk interface, but i want to talk iscsi on a subnet using jumbos: bge0: flags=8b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500 lladdr 00:14:4f:a9:34:90 priority: 0 trunk: trunkdev trunk45 media: Ethernet autoselect (1000baseT full-duplex) status: active bge1: flags=8b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500 lladdr 00:14:4f:a9:34:90 priority: 0 trunk: trunkdev trunk45 media: Ethernet autoselect (none) status: no carrier trunk45: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 lladdr 00:14:4f:a9:34:90 priority: 0 trunk: trunkproto lacp trunk id: [(8000,00:14:4f:a9:34:90,404C,0000,0000), (8000,00:21:55:b1:2d:80,002D,0000,0000)] trunkport bge1 trunkport bge0 active,collecting,distributing groups: trunk egress media: Ethernet autoselect status: active inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255 vlan384: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 9000 lladdr 00:14:4f:a9:34:90 priority: 0 vlan: 384 parent interface: trunk45 groups: vlan status: active inet 172.23.94.7 netmask 0xffffffc0 broadcast 172.23.94.63 without this diff i cant raise the mtu on the vlan interface without raising it on the trunk first. the caveat with this is trunk doesnt know if a sub interface (eg, vlan) is using a jumbo mtu, so cant/wont check if adding a trunk port will lower the hardmtu and upset things. thoughts? Index: if_trunk.c =================================================================== RCS file: /cvs/src/sys/net/if_trunk.c,v retrieving revision 1.99 diff -u -p -r1.99 if_trunk.c --- if_trunk.c 15 May 2015 10:15:13 -0000 1.99 +++ if_trunk.c 26 May 2015 03:02:09 -0000 @@ -315,11 +315,18 @@ trunk_port_create(struct trunk_softc *tr printf("%s: first port, setting trunk mtu %u\n", tr->tr_ifname, ifp->if_mtu); tr->tr_ac.ac_if.if_mtu = ifp->if_mtu; - tr->tr_ac.ac_if.if_hardmtu = ifp->if_mtu; - } else if (tr->tr_ac.ac_if.if_mtu != ifp->if_mtu) { - printf("%s: adding %s failed, MTU %u != %u\n", tr->tr_ifname, - ifp->if_xname, ifp->if_mtu, tr->tr_ac.ac_if.if_mtu); - return (EINVAL); + tr->tr_ac.ac_if.if_hardmtu = ifp->if_hardmtu; + } else { + u_int hardmtu = MIN(ifp->if_hardmtu, + tr->tr_ac.ac_if.if_hardmtu); + + if (tr->tr_ac.ac_if.if_mtu > hardmtu) { + printf("%s: adding %s failed, MTU %u > hard MTU%u\n", + tr->tr_ifname, ifp->if_xname, + tr->tr_ac.ac_if.if_mtu, ifp->if_hardmtu); + return (EINVAL); + } + tr->tr_ac.ac_if.if_hardmtu = hardmtu; } if ((error = ifpromisc(ifp, 1)) != 0)