summaryrefslogtreecommitdiffstats
path: root/src/vnet/l2/l2_bd.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-09-29 15:38:51 +0000
committerDamjan Marion <dmarion@me.com>2020-10-08 08:51:59 +0000
commit47a3d9975fa3af7a7537b565d6511dadc0df61fb (patch)
treefa33e3360af84239615f48b164b239ee3b660ee6 /src/vnet/l2/l2_bd.c
parent83143710e80c8df703fe1ebc0e513aa37971d295 (diff)
l2: input performance
Type: improvement - cache the values form the BD on the input config to avoid loading - avoid the short write long read on the sequence number - use vlib_buffer_enqueue_to_next Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: I33442b9104b457e4c638d26e9ad3bc965687a0bc
Diffstat (limited to 'src/vnet/l2/l2_bd.c')
-rw-r--r--src/vnet/l2/l2_bd.c48
1 files changed, 45 insertions, 3 deletions
diff --git a/src/vnet/l2/l2_bd.c b/src/vnet/l2/l2_bd.c
index 94852c90769..a3acc4b6d7e 100644
--- a/src/vnet/l2/l2_bd.c
+++ b/src/vnet/l2/l2_bd.c
@@ -243,6 +243,43 @@ l2bd_init (vlib_main_t * vm)
VLIB_INIT_FUNCTION (l2bd_init);
+l2_bridge_domain_t *
+bd_get (u32 bd_index)
+{
+ if (bd_index < vec_len (l2input_main.bd_configs))
+ return (vec_elt_at_index (l2input_main.bd_configs, bd_index));
+ return (NULL);
+}
+
+u32
+bd_input_walk (u32 bd_index, bd_input_walk_fn_t fn, void *data)
+{
+ l2_flood_member_t *member;
+ l2_bridge_domain_t *bd;
+ u32 sw_if_index;
+
+ sw_if_index = ~0;
+ bd = bd_get (bd_index);
+
+ ASSERT (bd);
+
+ vec_foreach (member, bd->members)
+ {
+ if (WALK_STOP == fn (bd_index, member->sw_if_index))
+ {
+ sw_if_index = member->sw_if_index;
+ break;
+ }
+ }
+
+ return (sw_if_index);
+}
+
+static void
+b2_input_recache (u32 bd_index)
+{
+ bd_input_walk (bd_index, l2input_recache, NULL);
+}
/**
Set the learn/forward/flood flags for the bridge domain.
@@ -290,6 +327,8 @@ bd_set_flags (vlib_main_t * vm, u32 bd_index, bd_flags_t flags, u32 enable)
bd_config->feature_bitmap &= ~feature_bitmap;
}
+ b2_input_recache (bd_index);
+
return bd_config->feature_bitmap;
}
@@ -305,6 +344,7 @@ bd_set_mac_age (vlib_main_t * vm, u32 bd_index, u8 age)
vec_validate (l2input_main.bd_configs, bd_index);
bd_config = vec_elt_at_index (l2input_main.bd_configs, bd_index);
bd_config->mac_age = age;
+ b2_input_recache (bd_index);
/* check if there is at least one bd with mac aging enabled */
vec_foreach (bd_config, l2input_main.bd_configs)
@@ -1093,8 +1133,8 @@ bd_show (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd)
else
as = format (as, "off");
vlib_cli_output (vm,
- "%=8d %=7d %=4d %=9v %=9s %=9s %=11U %=9s %=9s %=9s %=11U",
- bd_config->bd_id, bd_index, bd_config->seq_num, as,
+ "%=8d %=7d %=9v %=9s %=9s %=11U %=9s %=9s %=9s %=11U",
+ bd_config->bd_id, bd_index, as,
bd_config->feature_bitmap & L2INPUT_FEAT_LEARN ?
"on" : "off",
bd_config->feature_bitmap & L2INPUT_FEAT_FWD ?
@@ -1108,6 +1148,8 @@ bd_show (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd)
"on" : "off",
format_vnet_sw_if_index_name_with_NA,
vnm, bd_config->bvi_sw_if_index);
+ vlib_cli_output (vm, "%U", format_l2_input_feature_bitmap,
+ bd_config->feature_bitmap);
vec_reset_length (as);
if (detail || intf)
@@ -1118,7 +1160,7 @@ bd_show (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd)
{
l2_flood_member_t *member =
vec_elt_at_index (bd_config->members, i);
- u8 swif_seq_num = *l2fib_swif_seq_num (member->sw_if_index);
+ u8 swif_seq_num = l2_input_seq_num (member->sw_if_index);
u32 vtr_opr, dot1q, tag1, tag2;
if (i == 0)
{