aboutsummaryrefslogtreecommitdiffstats
path: root/vnet/vnet/interface_cli.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-11-28 11:41:35 -0500
committerDave Wallace <dwallacelf@gmail.com>2016-12-01 22:27:31 +0000
commit7be864ad0d8e3b139a277fb4a0234480f0cc3daa (patch)
tree75e69823c8cca3b780f27b54f2753f4ba7a987a5 /vnet/vnet/interface_cli.c
parente245d5ecef9a7b0969d160943b0a817c46e09f71 (diff)
Add a 64-byte interface "tag" for vhost and tap interfaces
This patch should dispose of spurious objections around interface tag requirements, currently in use as excuses not to support the vpp ML2 plugin. Add "u8 tag[64];" to the sw_interface_details message sent by vpp to control-plane clients. Add u8 tag[64] to the create_vhost_user_if and tap_connect APIs. Added debug CLI to set/show/clear the interface tag on any vnet sw interface. Added the sw_interface_tag_add_del API to set/clear tags on any vnet sw interface. There can be no expectation of "tag atomicity" with respect to physical hardware. Vpp discovers devices before establishing a control-plane connection. This patch upload verifies using the csit oper-161128 branch Change-Id: If8520119e7a586c5ccf0fdda82484ac205622855 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vnet/vnet/interface_cli.c')
-rw-r--r--vnet/vnet/interface_cli.c67
1 files changed, 66 insertions, 1 deletions
diff --git a/vnet/vnet/interface_cli.c b/vnet/vnet/interface_cli.c
index 1c15eb18028..7dbee867ded 100644
--- a/vnet/vnet/interface_cli.c
+++ b/vnet/vnet/interface_cli.c
@@ -228,6 +228,7 @@ show_sw_interfaces (vlib_main_t * vm,
u32 sw_if_index = ~(u32) 0;
u8 show_addresses = 0;
u8 show_features = 0;
+ u8 show_tag = 0;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
@@ -242,6 +243,8 @@ show_sw_interfaces (vlib_main_t * vm,
show_addresses = 1;
else if (unformat (input, "features") || unformat (input, "feat"))
show_features = 1;
+ else if (unformat (input, "tag"))
+ show_tag = 1;
else
{
error = clib_error_return (0, "unknown input `%U'",
@@ -250,14 +253,26 @@ show_sw_interfaces (vlib_main_t * vm,
}
}
- if (show_features)
+ if (show_features || show_tag)
{
if (sw_if_index == ~(u32) 0)
return clib_error_return (0, "Interface not specified...");
+ }
+ if (show_features)
+ {
vnet_interface_features_show (vm, sw_if_index);
return 0;
}
+ if (show_tag)
+ {
+ u8 *tag;
+ tag = vnet_get_sw_interface_tag (vnm, sw_if_index);
+ vlib_cli_output (vm, "%U: %s",
+ format_vnet_sw_if_index_name, vnm, sw_if_index,
+ tag ? (char *) tag : "(none)");
+ return 0;
+ }
if (!show_addresses)
vlib_cli_output (vm, "%U\n", format_vnet_sw_interface, vnm, 0);
@@ -1091,6 +1106,56 @@ VLIB_CLI_COMMAND (set_interface_mac_address_cmd, static) = {
};
/* *INDENT-ON* */
+static clib_error_t *
+set_tag (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd)
+{
+ vnet_main_t *vnm = vnet_get_main ();
+ u32 sw_if_index = ~0;
+ u8 *tag = 0;
+
+ if (!unformat (input, "%U %s", unformat_vnet_sw_interface,
+ vnm, &sw_if_index, &tag))
+ return clib_error_return (0, "unknown input `%U'",
+ format_unformat_error, input);
+
+ vnet_set_sw_interface_tag (vnm, tag, sw_if_index);
+
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (set_tag_command, static) = {
+ .path = "set interface tag",
+ .short_help = "set interface tag <intfc> <tag>",
+ .function = set_tag,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+clear_tag (vlib_main_t * vm, unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ vnet_main_t *vnm = vnet_get_main ();
+ u32 sw_if_index = ~0;
+
+ if (!unformat (input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
+ return clib_error_return (0, "unknown input `%U'",
+ format_unformat_error, input);
+
+ vnet_clear_sw_interface_tag (vnm, sw_if_index);
+
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (clear_tag_command, static) = {
+ .path = "clear interface tag",
+ .short_help = "clear interface tag <intfc>",
+ .function = clear_tag,
+};
+/* *INDENT-ON* */
+
+
/*
* fd.io coding-style-patch-verification: ON
*