diff options
author | Damjan Marion <damarion@cisco.com> | 2022-01-06 21:14:08 +0100 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2022-01-17 12:41:24 +0100 |
commit | 88a9c0e02ab919cadd4e035133995a6afb4d1c32 (patch) | |
tree | 15741e8bbe6c9d7077fa2a62b6ac369a17836cfb /src/vnet/interface.c | |
parent | 81bb6fc611d321a92ad2218e1b852db67980768a (diff) |
interface: improve MTU handling
- per hw-interface-class handlers
- ethernet set_mtu callback
- driver can now refuse MTU change
Type: improvement
Change-Id: I3d37c9129930ebec7bb70caf4263025413873048
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/interface.c')
-rw-r--r-- | src/vnet/interface.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/vnet/interface.c b/src/vnet/interface.c index 05a1c7c34a9..a1493c66c23 100644 --- a/src/vnet/interface.c +++ b/src/vnet/interface.c @@ -772,6 +772,9 @@ clib_error_t * vnet_hw_interface_set_mtu (vnet_main_t *vnm, u32 hw_if_index, u32 mtu) { vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index); + vnet_hw_interface_class_t *hw_if_class = + vnet_get_hw_interface_class (vnm, hi->hw_class_index); + clib_error_t *err = 0; if (hi->max_packet_bytes != mtu) { @@ -781,8 +784,10 @@ vnet_hw_interface_set_mtu (vnet_main_t *vnm, u32 hw_if_index, u32 mtu) "requested mtu must be in the %u to %u range", hi->min_supported_packet_bytes, hi->max_supported_packet_bytes); + if (hw_if_class->set_mtu) + if ((err = hw_if_class->set_mtu (vnm, hi, mtu))) + return err; hi->max_packet_bytes = mtu; - ethernet_set_flags (vnm, hw_if_index, ETHERNET_INTERFACE_FLAG_MTU); vnet_hw_interface_walk_sw (vnm, hw_if_index, sw_interface_walk_callback, &mtu); } |