summaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_api.c
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-03-27 14:48:39 +0200
committerNeale Ranns <nranns@cisco.com>2018-04-13 13:27:44 +0000
commit70083ee74c3141bbefb185525315f1b34497dcaa (patch)
tree2b93f23b853239152864ad5ee0db073d37c341ea /src/vnet/interface_api.c
parent25b049484fcf9161edb2c19250066b893c38c264 (diff)
MTU: Setting of MTU on software interface (instead of hardware interface)
Change-Id: I98bd454a761a1032738a21edeb0fe847e801f901 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vnet/interface_api.c')
-rw-r--r--src/vnet/interface_api.c33
1 files changed, 2 insertions, 31 deletions
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index 8d982e36b73..116ee63bdba 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -102,40 +102,11 @@ vl_api_sw_interface_set_mtu_t_handler (vl_api_sw_interface_set_mtu_t * mp)
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 = &ethernet_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);
+ rv = vnet_sw_interface_set_mtu (vnm, sw_if_index, mtu);
BAD_SW_IF_INDEX_LABEL;
REPLY_MACRO (VL_API_SW_INTERFACE_SET_MTU_REPLY);
@@ -161,7 +132,7 @@ send_sw_interface_details (vpe_api_main_t * am,
VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT);
mp->link_speed = ((hi->flags & VNET_HW_INTERFACE_FLAG_SPEED_MASK) >>
VNET_HW_INTERFACE_FLAG_SPEED_SHIFT);
- mp->link_mtu = ntohs (hi->max_packet_bytes);
+ mp->mtu = ntohs (swif->max_l3_packet_bytes[VLIB_TX]);
mp->context = context;
strncpy ((char *) mp->interface_name,