- int rv = vnet_sw_interface_set_mtu (vnm, sw_if_index, mtu);
- if (rv < 0)
- {
- vnet_hw_interface_t *hi = vnet_get_sw_hw_interface (vnm, sw_if_index);
- ASSERT (hi);
- return clib_error_return (0, "Invalid mtu (%d): "
- "must be between min pkt bytes (%d) and max pkt bytes (%d)",
- mtu, hi->min_packet_bytes,
- hi->max_packet_bytes);
+ if (!eif)
+ return clib_error_return (0, "not supported");
+
+ if (mtu < hi->min_supported_packet_bytes)
+ return clib_error_return (0, "Invalid mtu (%d): "
+ "must be >= min pkt bytes (%d)", mtu,
+ hi->min_supported_packet_bytes);
+
+ if (mtu > hi->max_supported_packet_bytes)
+ return clib_error_return (0, "Invalid mtu (%d): must be <= (%d)", mtu,
+ hi->max_supported_packet_bytes);
+
+ vnet_hw_interface_set_mtu (vnm, hw_if_index, mtu);