+static void
+vl_api_hw_interface_set_mtu_t_handler (vl_api_hw_interface_set_mtu_t * mp)
+{
+ vl_api_hw_interface_set_mtu_reply_t *rmp;
+ vnet_main_t *vnm = vnet_get_main ();
+ u32 sw_if_index = ntohl (mp->sw_if_index);
+ u16 mtu = ntohs (mp->mtu);
+ ethernet_main_t *em = ðernet_main;
+ int rv = 0;
+
+ VALIDATE_SW_IF_INDEX (mp);
+
+ vnet_sw_interface_t *si = vnet_get_sw_interface (vnm, sw_if_index);
+ if (si->type != VNET_SW_INTERFACE_TYPE_HARDWARE)
+ {
+ rv = VNET_API_ERROR_INVALID_VALUE;
+ goto bad_sw_if_index;
+ }
+
+ vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, si->hw_if_index);
+ ethernet_interface_t *eif = ethernet_get_interface (em, si->hw_if_index);
+
+ if (!eif)
+ {
+ rv = VNET_API_ERROR_FEATURE_DISABLED;
+ goto bad_sw_if_index;
+ }
+
+ if (mtu < hi->min_supported_packet_bytes)
+ {
+ rv = VNET_API_ERROR_INVALID_VALUE;
+ goto bad_sw_if_index;
+ }
+
+ if (mtu > hi->max_supported_packet_bytes)
+ {
+ rv = VNET_API_ERROR_INVALID_VALUE;
+ goto bad_sw_if_index;
+ }
+
+ vnet_hw_interface_set_mtu (vnm, si->hw_if_index, mtu);
+
+ BAD_SW_IF_INDEX_LABEL;
+ REPLY_MACRO (VL_API_HW_INTERFACE_SET_MTU_REPLY);
+}
+