aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_cli.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-04-13 19:43:39 +0200
committerDamjan Marion <damarion@cisco.com>2018-04-13 19:45:57 +0200
commitfe7d4a2e31529eed5416b38b520fdc84687df03c (patch)
treedd3e603fc305d486840f844d919c87f5d0b4b101 /src/vnet/interface_cli.c
parentbca9290056b1ee206a05c13bbb46b1b40a8bd804 (diff)
Revert "MTU: Setting of MTU on software interface (instead of hardware interface)"
This reverts commit 70083ee74c3141bbefb185525315f1b34497dcaa. Reverting as this patch is causing following crash: 0: /home/damarion/cisco/vpp3/build-data/../src/vnet/devices/devices.h:131 (vnet_get_device_input_thread_index) assertion `queue_id < vec_len (hw->input_node_thread_index_by_queue)' fails Aborted Change-Id: Ie2a365032110b1f67be7a9d832885b9899813d39 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/interface_cli.c')
-rw-r--r--src/vnet/interface_cli.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c
index fe17c823b36..d151335aa1f 100644
--- a/src/vnet/interface_cli.c
+++ b/src/vnet/interface_cli.c
@@ -1103,29 +1103,32 @@ static clib_error_t *
mtu_cmd (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd)
{
vnet_main_t *vnm = vnet_get_main ();
- u32 sw_if_index, mtu;
+ u32 hw_if_index, mtu;
+ ethernet_main_t *em = &ethernet_main;
- if (unformat (input, "%d %U", &mtu, unformat_vnet_sw_interface, vnm,
- &sw_if_index))
- {
- ;
- }
- else
+ if (unformat (input, "%d %U", &mtu,
+ unformat_vnet_hw_interface, vnm, &hw_if_index))
{
- return clib_error_return (0, "unknown input `%U'",
- format_unformat_error, input);
- }
+ vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
+ ethernet_interface_t *eif = ethernet_get_interface (em, hw_if_index);
- 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);
}
+ else
+ return clib_error_return (0, "unknown input `%U'",
+ format_unformat_error, input);
return 0;
}
@@ -1403,7 +1406,7 @@ set_interface_rx_mode (vlib_main_t * vm, unformat_input_t * input,
* @cliexend
?*/
/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (cmd_set_if_rx_mode, static) = {
+VLIB_CLI_COMMAND (cmd_set_if_rx_mode,static) = {
.path = "set interface rx-mode",
.short_help = "set interface rx-mode <interface> [queue <n>] [polling | interrupt | adaptive]",
.function = set_interface_rx_mode,