aboutsummaryrefslogtreecommitdiffstats
path: root/vnet/vnet/interface_cli.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-04-15 14:26:00 +0200
committerKeith Burns <alagalah@gmail.com>2016-04-20 03:21:51 +0000
commit8358ff95ee55d0256d60dc1d65cc6639c4243b33 (patch)
treee65719b325478735a0d06d0da792ade7f06e1d7a /vnet/vnet/interface_cli.c
parentec177abc1aa2811c1c69f9b37b76efb66a427ad2 (diff)
Move "ethernet" debug cli commands to "set interface"
Following two commands are changed: ethernet mtu -> set interface mtu ethernet promiscuous -> set inteface promiscuous Change-Id: I5037e021933156c06044fb723a05ad330f8162b7 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet/vnet/interface_cli.c')
-rw-r--r--vnet/vnet/interface_cli.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/vnet/vnet/interface_cli.c b/vnet/vnet/interface_cli.c
index 3b3da9b5b61..31fc9c31ba9 100644
--- a/vnet/vnet/interface_cli.c
+++ b/vnet/vnet/interface_cli.c
@@ -799,3 +799,81 @@ VLIB_CLI_COMMAND (renumber_interface_command, static) = {
.function = renumber_interface_command_fn,
};
+static clib_error_t *
+promiscuous_cmd (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ vnet_main_t * vnm = vnet_get_main();
+ u32 hw_if_index;
+ u32 flags = ETHERNET_INTERFACE_FLAG_ACCEPT_ALL;
+ ethernet_main_t * em = &ethernet_main;
+ ethernet_interface_t * eif;
+
+ if (unformat (input, "on %U",
+ unformat_vnet_hw_interface, vnm, &hw_if_index))
+ ;
+ else if (unformat (input, "off %U",
+ unformat_ethernet_interface, vnm, &hw_if_index))
+ flags = 0;
+ else
+ return clib_error_return (0, "unknown input `%U'",
+ format_unformat_error, input);
+
+ eif = ethernet_get_interface (em, hw_if_index);
+ if (!eif)
+ return clib_error_return (0, "not supported");
+
+ ethernet_set_flags (vnm, hw_if_index, flags);
+ return 0;
+}
+
+VLIB_CLI_COMMAND (set_interface_promiscuous_cmd, static) = {
+ .path = "set interface promiscuous",
+ .short_help = "set interface promiscuous [on | off] <intfc>",
+ .function = promiscuous_cmd,
+};
+
+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 hw_if_index, mtu;
+ u32 flags = ETHERNET_INTERFACE_FLAG_MTU;
+ ethernet_main_t * em = &ethernet_main;
+
+ if (unformat (input, "%d %U", &mtu,
+ unformat_vnet_hw_interface, vnm, &hw_if_index))
+ {
+ vnet_hw_interface_t * hi = vnet_get_hw_interface (vnm, hw_if_index);
+ ethernet_interface_t * eif = ethernet_get_interface (em, hw_if_index);
+
+ if (!eif)
+ return clib_error_return (0, "not supported");
+
+ if (mtu < ETHERNET_MIN_PACKET_BYTES)
+ return clib_error_return (0, "Invalid mtu (%d): "
+ "must be >= min pkt bytes (%d)", mtu,
+ hi->min_packet_bytes);
+
+ if (mtu > ETHERNET_MAX_PACKET_BYTES)
+ return clib_error_return (0, "Invalid mtu (%d): must be <= 9216", mtu);
+
+ if (hi->max_packet_bytes != mtu)
+ {
+ hi->max_packet_bytes = mtu;
+ ethernet_set_flags (vnm, hw_if_index, flags);
+ }
+ }
+ else
+ return clib_error_return (0, "unknown input `%U'",
+ format_unformat_error, input);
+ return 0;
+}
+
+VLIB_CLI_COMMAND (set_interface_mtu_cmd, static) = {
+ .path = "set interface mtu",
+ .short_help = "set interface mtu <64-9216> <intfc>",
+ .function = mtu_cmd,
+};
+