aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet/interface_cli.c42
-rw-r--r--src/vnet/l2/l2_bd.h2
-rw-r--r--src/vnet/l2/l2_input.c23
-rw-r--r--src/vnet/l2/l2_input.h2
-rw-r--r--src/vnet/l2/l2_output.c23
-rw-r--r--src/vnet/l2/l2_output.h2
6 files changed, 79 insertions, 15 deletions
diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c
index fe7ae38f7cd..a8aa3056572 100644
--- a/src/vnet/interface_cli.c
+++ b/src/vnet/interface_cli.c
@@ -47,6 +47,8 @@
#include <vppinfra/bitmap.h>
#include <vnet/fib/ip4_fib.h>
#include <vnet/fib/ip6_fib.h>
+#include <vnet/l2/l2_output.h>
+#include <vnet/l2/l2_input.h>
static int
compare_interface_names (void *a1, void *a2)
@@ -262,6 +264,20 @@ show_sw_interfaces (vlib_main_t * vm,
if (show_features)
{
vnet_interface_features_show (vm, sw_if_index);
+
+ l2_input_config_t *l2_input = l2input_intf_config (sw_if_index);
+ u32 fb = l2_input->feature_bitmap;
+ /* intf input features are masked by bridge domain */
+ if (l2_input->bridge)
+ fb &= l2input_bd_config (l2_input->bd_index)->feature_bitmap;
+ vlib_cli_output (vm, "\nl2-input:\n%U", format_l2_input_features, fb);
+
+ l2_output_config_t *l2_output = l2output_intf_config (sw_if_index);
+ vlib_cli_output (vm, "\nl2-output:");
+ if (l2_output->out_vtr_flag)
+ vlib_cli_output (vm, "%10s (%s)", "VTR", "--internal--");
+ vlib_cli_output (vm, "%U", format_l2_output_features,
+ l2_output->feature_bitmap);
return 0;
}
if (show_tag)
@@ -285,9 +301,10 @@ show_sw_interfaces (vlib_main_t * vm,
_vec_len (sorted_sis) = 0;
pool_foreach (si, im->sw_interfaces, (
{
- if (vnet_swif_is_api_visible
- (si)) vec_add1 (sorted_sis,
- si[0]);}
+ int visible =
+ vnet_swif_is_api_visible (si);
+ if (visible)
+ vec_add1 (sorted_sis, si[0]);}
));
/* Sort by name. */
@@ -298,7 +315,6 @@ show_sw_interfaces (vlib_main_t * vm,
{
vec_foreach (si, sorted_sis)
{
- l2input_main_t *l2m = &l2input_main;
ip4_main_t *im4 = &ip4_main;
ip6_main_t *im6 = &ip6_main;
ip_lookup_main_t *lm4 = &im4->lookup_main;
@@ -309,7 +325,6 @@ show_sw_interfaces (vlib_main_t * vm,
u32 fib_index4 = 0, fib_index6 = 0;
ip4_fib_t *fib4;
ip6_fib_t *fib6;
- l2_input_config_t *config;
if (vec_len (im4->fib_index_by_sw_if_index) > si->sw_if_index)
fib_index4 = vec_elt (im4->fib_index_by_sw_if_index,
@@ -339,21 +354,20 @@ show_sw_interfaces (vlib_main_t * vm,
? "up" : "dn");
}
- /* Display any L2 addressing info */
- vec_validate (l2m->configs, si->sw_if_index);
- config = vec_elt_at_index (l2m->configs, si->sw_if_index);
- if (config->bridge)
+ /* Display any L2 info */
+ l2_input_config_t *l2_input = l2input_intf_config (si->sw_if_index);
+ if (l2_input->bridge)
{
- u32 bd_id = l2input_main.bd_configs[config->bd_index].bd_id;
+ u32 bd_id = l2input_main.bd_configs[l2_input->bd_index].bd_id;
vlib_cli_output (vm, " l2 bridge bd_id %d%s%d", bd_id,
- config->bvi ? " bvi shg " : " shg ",
- config->shg);
+ l2_input->bvi ? " bvi shg " : " shg ",
+ l2_input->shg);
}
- else if (config->xconnect)
+ else if (l2_input->xconnect)
{
vlib_cli_output (vm, " l2 xconnect %U",
format_vnet_sw_if_index_name,
- vnm, config->output_sw_if_index);
+ vnm, l2_input->output_sw_if_index);
}
/* Display any IP4 addressing info */
diff --git a/src/vnet/l2/l2_bd.h b/src/vnet/l2/l2_bd.h
index 93ed1a8532a..0e070651859 100644
--- a/src/vnet/l2/l2_bd.h
+++ b/src/vnet/l2/l2_bd.h
@@ -34,7 +34,7 @@ typedef struct
vnet_main_t *vnet_main;
} bd_main_t;
-bd_main_t bd_main;
+extern bd_main_t bd_main;
/* Bridge domain member */
diff --git a/src/vnet/l2/l2_input.c b/src/vnet/l2/l2_input.c
index 26c832adfb1..faed7c7fd76 100644
--- a/src/vnet/l2/l2_input.c
+++ b/src/vnet/l2/l2_input.c
@@ -60,6 +60,29 @@ l2input_get_feat_names (void)
return l2input_feat_names;
}
+u8 *
+format_l2_input_features (u8 * s, va_list * args)
+{
+ static char *display_names[] = {
+#define _(sym,name) #sym,
+ foreach_l2input_feat
+#undef _
+ };
+ u32 feature_bitmap = va_arg (*args, u32);
+
+ if (feature_bitmap == 0)
+ {
+ s = format (s, " none configured");
+ return s;
+ }
+
+ feature_bitmap &= ~L2INPUT_FEAT_DROP; /* Not a feature */
+ int i;
+ for (i = L2INPUT_N_FEAT; i >= 0; i--)
+ if (feature_bitmap & (1 << i))
+ s = format (s, "%10s (%s)\n", display_names[i], l2input_feat_names[i]);
+ return s;
+}
typedef struct
{
diff --git a/src/vnet/l2/l2_input.h b/src/vnet/l2/l2_input.h
index e6b3bc7f9cd..e8a6c776cef 100644
--- a/src/vnet/l2/l2_input.h
+++ b/src/vnet/l2/l2_input.h
@@ -148,6 +148,8 @@ STATIC_ASSERT ((u64) L2INPUT_VALID_MASK == (1ull << L2INPUT_N_FEAT) - 1, "");
/** Return an array of strings containing graph node names of each feature */
char **l2input_get_feat_names (void);
+/* arg0 - u32 feature_bitmap */
+u8 *format_l2_input_features (u8 * s, va_list * args);
static_always_inline u8
bd_feature_flood (l2_bridge_domain_t * bd_config)
diff --git a/src/vnet/l2/l2_output.c b/src/vnet/l2/l2_output.c
index fbee590c944..500fc5d0e95 100644
--- a/src/vnet/l2/l2_output.c
+++ b/src/vnet/l2/l2_output.c
@@ -40,6 +40,29 @@ l2output_get_feat_names (void)
return l2output_feat_names;
}
+u8 *
+format_l2_output_features (u8 * s, va_list * args)
+{
+ static char *display_names[] = {
+#define _(sym,name) #sym,
+ foreach_l2output_feat
+#undef _
+ };
+ u32 feature_bitmap = va_arg (*args, u32);
+
+ if (feature_bitmap == 0)
+ {
+ s = format (s, " none configured");
+ return s;
+ }
+
+ int i;
+ for (i = L2OUTPUT_N_FEAT - 1; i >= 0; i--)
+ if (feature_bitmap & (1 << i))
+ s = format (s, "%10s (%s)\n", display_names[i], l2output_feat_names[i]);
+ return s;
+}
+
l2output_main_t l2output_main;
typedef struct
diff --git a/src/vnet/l2/l2_output.h b/src/vnet/l2/l2_output.h
index a54b8d67c93..1a73fdf9790 100644
--- a/src/vnet/l2/l2_output.h
+++ b/src/vnet/l2/l2_output.h
@@ -141,6 +141,8 @@ typedef enum
/* Return an array of strings containing graph node names of each feature */
char **l2output_get_feat_names (void);
+/* arg0 - u32 feature_bitmap */
+u8 *format_l2_output_features (u8 * s, va_list * args);
/**
* The next set of functions is for use by output feature graph nodes.