aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/bonding/cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/bonding/cli.c')
-rw-r--r--src/vnet/bonding/cli.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/vnet/bonding/cli.c b/src/vnet/bonding/cli.c
index cb344c611c2..371e3c1012c 100644
--- a/src/vnet/bonding/cli.c
+++ b/src/vnet/bonding/cli.c
@@ -47,6 +47,17 @@ bond_disable_collecting_distributing (vlib_main_t * vm, slave_if_t * sif)
}
vec_del1 (bif->active_slaves, i);
hash_unset (bif->active_slave_by_sw_if_index, sif->sw_if_index);
+ if (sif->lacp_enabled && bif->numa_only)
+ {
+ /* For lacp mode, if we check it is a slave on local numa node,
+ bif->n_numa_slaves should be decreased by 1 becasue the first
+ bif->n_numa_slaves are all slaves on local numa node */
+ if (i < bif->n_numa_slaves)
+ {
+ bif->n_numa_slaves--;
+ ASSERT (bif->n_numa_slaves >= 0);
+ }
+ }
break;
}
}
@@ -104,7 +115,18 @@ bond_enable_collecting_distributing (vlib_main_t * vm, slave_if_t * sif)
{
hash_set (bif->active_slave_by_sw_if_index, sif->sw_if_index,
sif->sw_if_index);
- vec_add1 (bif->active_slaves, sif->sw_if_index);
+
+ if ((sif->lacp_enabled && bif->numa_only)
+ && (vm->numa_node == hw->numa_node))
+ {
+ vec_insert_elts (bif->active_slaves, &sif->sw_if_index, 1,
+ bif->n_numa_slaves);
+ bif->n_numa_slaves++;
+ }
+ else
+ {
+ vec_add1 (bif->active_slaves, sif->sw_if_index);
+ }
/* First slave becomes active? */
if ((vec_len (bif->active_slaves) == 1) &&
@@ -168,6 +190,7 @@ bond_dump_ifs (bond_interface_details_t ** out_bondifs)
strlen ((const char *) hi->name)));
bondif->mode = bif->mode;
bondif->lb = bif->lb;
+ bondif->numa_only = bif->numa_only;
bondif->active_slaves = vec_len (bif->active_slaves);
bondif->slaves = vec_len (bif->slaves);
);
@@ -388,6 +411,7 @@ bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args)
sw = vnet_get_hw_sw_interface (vnm, bif->hw_if_index);
bif->sw_if_index = sw->sw_if_index;
bif->group = bif->sw_if_index;
+ bif->numa_only = args->numa_only;
if (vlib_get_thread_main ()->n_vlib_mains > 1)
clib_spinlock_init (&bif->lockp);
@@ -428,6 +452,14 @@ bond_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
args.hw_addr_set = 1;
else if (unformat (line_input, "id %u", &args.id))
;
+ else if (unformat (line_input, "numa-only"))
+ {
+ if (args.mode == BOND_MODE_LACP)
+ args.numa_only = 1;
+ else
+ return clib_error_return (0,
+ "Only lacp mode supports numa-only so far!");
+ }
else
return clib_error_return (0, "unknown input `%U'",
format_unformat_error, input);
@@ -446,7 +478,7 @@ bond_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
VLIB_CLI_COMMAND (bond_create_command, static) = {
.path = "create bond",
.short_help = "create bond mode {round-robin | active-backup | broadcast | "
- "{lacp | xor} [load-balance { l2 | l23 | l34 }]} [hw-addr <mac-address>] "
+ "{lacp | xor} [load-balance { l2 | l23 | l34 } {numa-only}]} [hw-addr <mac-address>] "
"[id <if-id>]",
.function = bond_create_command_fn,
};