summaryrefslogtreecommitdiffstats
path: root/src/vnet/bonding/cli.c
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2020-07-15 08:44:54 -0700
committerDave Barach <openvpp@barachs.net>2020-07-28 12:13:49 +0000
commit4c4223edfd46841062340fe449cd97a93dccc498 (patch)
tree8daedd7264e235e273a4e23d209a2baca80781d0 /src/vnet/bonding/cli.c
parent4d1423c5ace249f6609a41fadec9e4b9c4b323de (diff)
bonding lacp: replace slave string with member
- Replace textual string slave with member except APIs. - For APIs, mark the existing APIs as deprecated and introduce new APIs - While introducing sw_bond_interface_dump, add the optional filter by sw_if_index and enhance the testcases to make use of it. Type: improvement Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ib6626c514e45350308aeeda0decb70f3aba2f63e
Diffstat (limited to 'src/vnet/bonding/cli.c')
-rw-r--r--src/vnet/bonding/cli.c446
1 files changed, 225 insertions, 221 deletions
diff --git a/src/vnet/bonding/cli.c b/src/vnet/bonding/cli.c
index 92a9ff067f6..062e3092640 100644
--- a/src/vnet/bonding/cli.c
+++ b/src/vnet/bonding/cli.c
@@ -23,7 +23,7 @@
#include <vpp/stats/stat_segment.h>
void
-bond_disable_collecting_distributing (vlib_main_t * vm, slave_if_t * sif)
+bond_disable_collecting_distributing (vlib_main_t * vm, member_if_t * mif)
{
bond_main_t *bm = &bond_main;
bond_if_t *bif;
@@ -31,34 +31,34 @@ bond_disable_collecting_distributing (vlib_main_t * vm, slave_if_t * sif)
uword p;
u8 switching_active = 0;
- bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
+ bif = bond_get_bond_if_by_dev_instance (mif->bif_dev_instance);
clib_spinlock_lock_if_init (&bif->lockp);
- vec_foreach_index (i, bif->active_slaves)
+ vec_foreach_index (i, bif->active_members)
{
- p = *vec_elt_at_index (bif->active_slaves, i);
- if (p == sif->sw_if_index)
+ p = *vec_elt_at_index (bif->active_members, i);
+ if (p == mif->sw_if_index)
{
if ((bif->mode == BOND_MODE_ACTIVE_BACKUP) && (i == 0) &&
- (vec_len (bif->active_slaves) > 1))
- /* deleting the active slave for active-backup */
+ (vec_len (bif->active_members) > 1))
+ /* deleting the active member for active-backup */
switching_active = 1;
- vec_del1 (bif->active_slaves, i);
- if (sif->lacp_enabled && bif->numa_only)
+ vec_del1 (bif->active_members, i);
+ if (mif->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)
+ /* For lacp mode, if we check it is a member on local numa node,
+ bif->n_numa_members should be decreased by 1 becasue the first
+ bif->n_numa_members are all members on local numa node */
+ if (i < bif->n_numa_members)
{
- bif->n_numa_slaves--;
- ASSERT (bif->n_numa_slaves >= 0);
+ bif->n_numa_members--;
+ ASSERT (bif->n_numa_members >= 0);
}
}
break;
}
}
- /* We get a new slave just becoming active */
+ /* We get a new member just becoming active */
if (switching_active)
vlib_process_signal_event (bm->vlib_main, bond_process_node.index,
BOND_SEND_GARP_NA, bif->hw_if_index);
@@ -70,46 +70,46 @@ bond_disable_collecting_distributing (vlib_main_t * vm, slave_if_t * sif)
* return -1 if s1 is preferred.
*/
static int
-bond_slave_sort (void *a1, void *a2)
+bond_member_sort (void *a1, void *a2)
{
u32 *s1 = a1;
u32 *s2 = a2;
- slave_if_t *sif1 = bond_get_slave_by_sw_if_index (*s1);
- slave_if_t *sif2 = bond_get_slave_by_sw_if_index (*s2);
+ member_if_t *mif1 = bond_get_member_by_sw_if_index (*s1);
+ member_if_t *mif2 = bond_get_member_by_sw_if_index (*s2);
bond_if_t *bif;
- ALWAYS_ASSERT (sif1);
- ALWAYS_ASSERT (sif2);
+ ALWAYS_ASSERT (mif1);
+ ALWAYS_ASSERT (mif2);
/*
* sort entries according to preference rules:
* 1. biggest weight
* 2. numa-node
- * 3. current active slave (to prevent churning)
+ * 3. current active member (to prevent churning)
* 4. lowest sw_if_index (for deterministic behavior)
*
*/
- if (sif2->weight > sif1->weight)
+ if (mif2->weight > mif1->weight)
return 1;
- if (sif2->weight < sif1->weight)
+ if (mif2->weight < mif1->weight)
return -1;
else
{
- if (sif2->is_local_numa > sif1->is_local_numa)
+ if (mif2->is_local_numa > mif1->is_local_numa)
return 1;
- if (sif2->is_local_numa < sif1->is_local_numa)
+ if (mif2->is_local_numa < mif1->is_local_numa)
return -1;
else
{
- bif = bond_get_master_by_dev_instance (sif1->bif_dev_instance);
- /* Favor the current active slave to avoid churning */
- if (bif->active_slaves[0] == sif2->sw_if_index)
+ bif = bond_get_bond_if_by_dev_instance (mif1->bif_dev_instance);
+ /* Favor the current active member to avoid churning */
+ if (bif->active_members[0] == mif2->sw_if_index)
return 1;
- if (bif->active_slaves[0] == sif1->sw_if_index)
+ if (bif->active_members[0] == mif1->sw_if_index)
return -1;
/* go for the tiebreaker as the last resort */
- if (sif1->sw_if_index > sif2->sw_if_index)
+ if (mif1->sw_if_index > mif2->sw_if_index)
return 1;
- if (sif1->sw_if_index < sif2->sw_if_index)
+ if (mif1->sw_if_index < mif2->sw_if_index)
return -1;
else
ASSERT (0);
@@ -119,54 +119,54 @@ bond_slave_sort (void *a1, void *a2)
}
static void
-bond_sort_slaves (bond_if_t * bif)
+bond_sort_members (bond_if_t * bif)
{
bond_main_t *bm = &bond_main;
- u32 old_active = bif->active_slaves[0];
+ u32 old_active = bif->active_members[0];
- vec_sort_with_function (bif->active_slaves, bond_slave_sort);
- if (old_active != bif->active_slaves[0])
+ vec_sort_with_function (bif->active_members, bond_member_sort);
+ if (old_active != bif->active_members[0])
vlib_process_signal_event (bm->vlib_main, bond_process_node.index,
BOND_SEND_GARP_NA, bif->hw_if_index);
}
void
-bond_enable_collecting_distributing (vlib_main_t * vm, slave_if_t * sif)
+bond_enable_collecting_distributing (vlib_main_t * vm, member_if_t * mif)
{
bond_if_t *bif;
bond_main_t *bm = &bond_main;
vnet_main_t *vnm = vnet_get_main ();
- vnet_hw_interface_t *hw = vnet_get_sup_hw_interface (vnm, sif->sw_if_index);
+ vnet_hw_interface_t *hw = vnet_get_sup_hw_interface (vnm, mif->sw_if_index);
int i;
uword p;
- bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
+ bif = bond_get_bond_if_by_dev_instance (mif->bif_dev_instance);
clib_spinlock_lock_if_init (&bif->lockp);
- vec_foreach_index (i, bif->active_slaves)
+ vec_foreach_index (i, bif->active_members)
{
- p = *vec_elt_at_index (bif->active_slaves, i);
- if (p == sif->sw_if_index)
+ p = *vec_elt_at_index (bif->active_members, i);
+ if (p == mif->sw_if_index)
goto done;
}
- if (sif->lacp_enabled && bif->numa_only && (vm->numa_node == hw->numa_node))
+ if (mif->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++;
+ vec_insert_elts (bif->active_members, &mif->sw_if_index, 1,
+ bif->n_numa_members);
+ bif->n_numa_members++;
}
else
- vec_add1 (bif->active_slaves, sif->sw_if_index);
+ vec_add1 (bif->active_members, mif->sw_if_index);
- sif->is_local_numa = (vm->numa_node == hw->numa_node) ? 1 : 0;
+ mif->is_local_numa = (vm->numa_node == hw->numa_node) ? 1 : 0;
if (bif->mode == BOND_MODE_ACTIVE_BACKUP)
{
- if (vec_len (bif->active_slaves) == 1)
- /* First slave becomes active? */
+ if (vec_len (bif->active_members) == 1)
+ /* First member becomes active? */
vlib_process_signal_event (bm->vlib_main, bond_process_node.index,
BOND_SEND_GARP_NA, bif->hw_if_index);
else
- bond_sort_slaves (bif);
+ bond_sort_members (bif);
}
done:
@@ -198,8 +198,8 @@ bond_dump_ifs (bond_interface_details_t ** out_bondifs)
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);
+ bondif->active_members = vec_len (bif->active_members);
+ bondif->members = vec_len (bif->members);
);
/* *INDENT-ON* */
@@ -209,58 +209,59 @@ bond_dump_ifs (bond_interface_details_t ** out_bondifs)
}
int
-bond_dump_slave_ifs (slave_interface_details_t ** out_slaveifs,
- u32 bond_sw_if_index)
+bond_dump_member_ifs (member_interface_details_t ** out_memberifs,
+ u32 bond_sw_if_index)
{
vnet_main_t *vnm = vnet_get_main ();
bond_if_t *bif;
vnet_hw_interface_t *hi;
vnet_sw_interface_t *sw;
- slave_interface_details_t *r_slaveifs = NULL;
- slave_interface_details_t *slaveif = NULL;
+ member_interface_details_t *r_memberifs = NULL;
+ member_interface_details_t *memberif = NULL;
u32 *sw_if_index = NULL;
- slave_if_t *sif;
+ member_if_t *mif;
- bif = bond_get_master_by_sw_if_index (bond_sw_if_index);
+ bif = bond_get_bond_if_by_sw_if_index (bond_sw_if_index);
if (!bif)
return 1;
- vec_foreach (sw_if_index, bif->slaves)
+ vec_foreach (sw_if_index, bif->members)
{
- vec_add2 (r_slaveifs, slaveif, 1);
- clib_memset (slaveif, 0, sizeof (*slaveif));
- sif = bond_get_slave_by_sw_if_index (*sw_if_index);
- if (sif)
+ vec_add2 (r_memberifs, memberif, 1);
+ clib_memset (memberif, 0, sizeof (*memberif));
+ mif = bond_get_member_by_sw_if_index (*sw_if_index);
+ if (mif)
{
- sw = vnet_get_sw_interface (vnm, sif->sw_if_index);
+ sw = vnet_get_sw_interface (vnm, mif->sw_if_index);
hi = vnet_get_hw_interface (vnm, sw->hw_if_index);
- clib_memcpy (slaveif->interface_name, hi->name,
- MIN (ARRAY_LEN (slaveif->interface_name) - 1,
+ clib_memcpy (memberif->interface_name, hi->name,
+ MIN (ARRAY_LEN (memberif->interface_name) - 1,
vec_len ((const char *) hi->name)));
/* enforce by memset() above */
ASSERT (0 ==
- slaveif->interface_name[ARRAY_LEN (slaveif->interface_name) -
- 1]);
- slaveif->sw_if_index = sif->sw_if_index;
- slaveif->is_passive = sif->is_passive;
- slaveif->is_long_timeout = sif->is_long_timeout;
- slaveif->is_local_numa = sif->is_local_numa;
- slaveif->weight = sif->weight;
+ memberif->interface_name[ARRAY_LEN (memberif->interface_name)
+ - 1]);
+ memberif->sw_if_index = mif->sw_if_index;
+ memberif->is_passive = mif->is_passive;
+ memberif->is_long_timeout = mif->is_long_timeout;
+ memberif->is_local_numa = mif->is_local_numa;
+ memberif->weight = mif->weight;
}
}
- *out_slaveifs = r_slaveifs;
+ *out_memberifs = r_memberifs;
return 0;
}
/*
- * Manage secondary mac addresses when attaching/detaching a slave.
- * If adding, copies any secondary addresses from master to slave
- * If deleting, deletes the master's secondary addresses from the slave
- *
+ * Manage secondary mac addresses when attaching/detaching a member.
+ * If adding, copy any secondary addresses from bond interface to member.
+ * If deleting, delete the bond interface's secondary addresses from the
+ * member.
*/
static void
-bond_slave_add_del_mac_addrs (bond_if_t * bif, u32 sif_sw_if_index, u8 is_add)
+bond_member_add_del_mac_addrs (bond_if_t * bif, u32 mif_sw_if_index,
+ u8 is_add)
{
vnet_main_t *vnm = vnet_get_main ();
ethernet_interface_t *b_ei;
@@ -271,7 +272,7 @@ bond_slave_add_del_mac_addrs (bond_if_t * bif, u32 sif_sw_if_index, u8 is_add)
if (!b_ei || !b_ei->secondary_addrs)
return;
- s_hwif = vnet_get_sup_hw_interface (vnm, sif_sw_if_index);
+ s_hwif = vnet_get_sup_hw_interface (vnm, mif_sw_if_index);
vec_foreach (sec_mac, b_ei->secondary_addrs)
vnet_hw_interface_add_del_mac_address (vnm, s_hwif->hw_if_index,
@@ -279,56 +280,56 @@ bond_slave_add_del_mac_addrs (bond_if_t * bif, u32 sif_sw_if_index, u8 is_add)
}
static void
-bond_delete_neighbor (vlib_main_t * vm, bond_if_t * bif, slave_if_t * sif)
+bond_delete_neighbor (vlib_main_t * vm, bond_if_t * bif, member_if_t * mif)
{
bond_main_t *bm = &bond_main;
vnet_main_t *vnm = vnet_get_main ();
int i;
- vnet_hw_interface_t *sif_hw;
+ vnet_hw_interface_t *mif_hw;
- sif_hw = vnet_get_sup_hw_interface (vnm, sif->sw_if_index);
+ mif_hw = vnet_get_sup_hw_interface (vnm, mif->sw_if_index);
bif->port_number_bitmap =
clib_bitmap_set (bif->port_number_bitmap,
- ntohs (sif->actor_admin.port_number) - 1, 0);
- bm->slave_by_sw_if_index[sif->sw_if_index] = 0;
- vec_free (sif->last_marker_pkt);
- vec_free (sif->last_rx_pkt);
- vec_foreach_index (i, bif->slaves)
+ ntohs (mif->actor_admin.port_number) - 1, 0);
+ bm->member_by_sw_if_index[mif->sw_if_index] = 0;
+ vec_free (mif->last_marker_pkt);
+ vec_free (mif->last_rx_pkt);
+ vec_foreach_index (i, bif->members)
{
- uword p = *vec_elt_at_index (bif->slaves, i);
- if (p == sif->sw_if_index)
+ uword p = *vec_elt_at_index (bif->members, i);
+ if (p == mif->sw_if_index)
{
- vec_del1 (bif->slaves, i);
+ vec_del1 (bif->members, i);
break;
}
}
- bond_disable_collecting_distributing (vm, sif);
+ bond_disable_collecting_distributing (vm, mif);
vnet_feature_enable_disable ("device-input", "bond-input",
- sif->sw_if_index, 0, 0, 0);
+ mif->sw_if_index, 0, 0, 0);
/* Put back the old mac */
- vnet_hw_interface_change_mac_address (vnm, sif_hw->hw_if_index,
- sif->persistent_hw_address);
+ vnet_hw_interface_change_mac_address (vnm, mif_hw->hw_if_index,
+ mif->persistent_hw_address);
- /* delete the bond's secondary/virtual mac addrs from the slave */
- bond_slave_add_del_mac_addrs (bif, sif->sw_if_index, 0 /* is_add */ );
+ /* delete the bond's secondary/virtual mac addrs from the member */
+ bond_member_add_del_mac_addrs (bif, mif->sw_if_index, 0 /* is_add */ );
if ((bif->mode == BOND_MODE_LACP) && bm->lacp_enable_disable)
- (*bm->lacp_enable_disable) (vm, bif, sif, 0);
+ (*bm->lacp_enable_disable) (vm, bif, mif, 0);
if (bif->mode == BOND_MODE_LACP)
{
stat_segment_deregister_state_counter
- (bm->stats[bif->sw_if_index][sif->sw_if_index].actor_state);
+ (bm->stats[bif->sw_if_index][mif->sw_if_index].actor_state);
stat_segment_deregister_state_counter
- (bm->stats[bif->sw_if_index][sif->sw_if_index].partner_state);
+ (bm->stats[bif->sw_if_index][mif->sw_if_index].partner_state);
}
- pool_put (bm->neighbors, sif);
+ pool_put (bm->neighbors, mif);
}
int
@@ -337,23 +338,23 @@ bond_delete_if (vlib_main_t * vm, u32 sw_if_index)
bond_main_t *bm = &bond_main;
vnet_main_t *vnm = vnet_get_main ();
bond_if_t *bif;
- slave_if_t *sif;
+ member_if_t *mif;
vnet_hw_interface_t *hw;
- u32 *sif_sw_if_index;
+ u32 *mif_sw_if_index;
u32 *s_list = 0;
hw = vnet_get_sup_hw_interface (vnm, sw_if_index);
if (hw == NULL || bond_dev_class.index != hw->dev_class_index)
return VNET_API_ERROR_INVALID_SW_IF_INDEX;
- bif = bond_get_master_by_dev_instance (hw->dev_instance);
+ bif = bond_get_bond_if_by_dev_instance (hw->dev_instance);
- vec_append (s_list, bif->slaves);
- vec_foreach (sif_sw_if_index, s_list)
+ vec_append (s_list, bif->members);
+ vec_foreach (mif_sw_if_index, s_list)
{
- sif = bond_get_slave_by_sw_if_index (*sif_sw_if_index);
- if (sif)
- bond_delete_neighbor (vm, bif, sif);
+ mif = bond_get_member_by_sw_if_index (*mif_sw_if_index);
+ if (mif)
+ bond_delete_neighbor (vm, bif, mif);
}
vec_free (s_list);
@@ -595,57 +596,58 @@ VLIB_CLI_COMMAND (bond_delete__command, static) =
/* *INDENT-ON* */
void
-bond_enslave (vlib_main_t * vm, bond_enslave_args_t * args)
+bond_add_member (vlib_main_t * vm, bond_add_member_args_t * args)
{
bond_main_t *bm = &bond_main;
vnet_main_t *vnm = vnet_get_main ();
bond_if_t *bif;
- slave_if_t *sif;
+ member_if_t *mif;
vnet_interface_main_t *im = &vnm->interface_main;
- vnet_hw_interface_t *bif_hw, *sif_hw;
+ vnet_hw_interface_t *bif_hw, *mif_hw;
vnet_sw_interface_t *sw;
u32 thread_index;
- u32 sif_if_index;
+ u32 mif_if_index;
- bif = bond_get_master_by_sw_if_index (args->group);
+ bif = bond_get_bond_if_by_sw_if_index (args->group);
if (!bif)
{
args->rv = VNET_API_ERROR_INVALID_INTERFACE;
args->error = clib_error_return (0, "bond interface not found");
return;
}
- // make sure the interface is not already enslaved
- if (bond_get_slave_by_sw_if_index (args->slave))
+ // make sure the interface is not already added as member
+ if (bond_get_member_by_sw_if_index (args->member))
{
args->rv = VNET_API_ERROR_VALUE_EXIST;
- args->error = clib_error_return (0, "interface was already enslaved");
+ args->error = clib_error_return
+ (0, "interface was already added as member");
return;
}
- sif_hw = vnet_get_sup_hw_interface (vnm, args->slave);
- if (sif_hw->dev_class_index == bond_dev_class.index)
+ mif_hw = vnet_get_sup_hw_interface (vnm, args->member);
+ if (mif_hw->dev_class_index == bond_dev_class.index)
{
args->rv = VNET_API_ERROR_INVALID_INTERFACE;
args->error =
- clib_error_return (0, "bond interface cannot be enslaved");
+ clib_error_return (0, "bond interface cannot be added as member");
return;
}
- if (bif->gso && !(sif_hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO))
+ if (bif->gso && !(mif_hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO))
{
args->rv = VNET_API_ERROR_INVALID_INTERFACE;
args->error =
- clib_error_return (0, "slave interface is not gso capable");
+ clib_error_return (0, "member interface is not gso capable");
return;
}
if (bif->mode == BOND_MODE_LACP)
{
u8 *name = format (0, "/if/lacp/%u/%u/state%c", bif->sw_if_index,
- args->slave, 0);
+ args->member, 0);
vec_validate (bm->stats, bif->sw_if_index);
- vec_validate (bm->stats[bif->sw_if_index], args->slave);
+ vec_validate (bm->stats[bif->sw_if_index], args->member);
args->error = stat_segment_register_state_counter
- (name, &bm->stats[bif->sw_if_index][args->slave].actor_state);
+ (name, &bm->stats[bif->sw_if_index][args->member].actor_state);
if (args->error != 0)
{
args->rv = VNET_API_ERROR_INVALID_INTERFACE;
@@ -655,9 +657,9 @@ bond_enslave (vlib_main_t * vm, bond_enslave_args_t * args)
vec_reset_length (name);
name = format (0, "/if/lacp/%u/%u/partner-state%c", bif->sw_if_index,
- args->slave, 0);
+ args->member, 0);
args->error = stat_segment_register_state_counter
- (name, &bm->stats[bif->sw_if_index][args->slave].partner_state);
+ (name, &bm->stats[bif->sw_if_index][args->member].partner_state);
vec_free (name);
if (args->error != 0)
{
@@ -666,81 +668,81 @@ bond_enslave (vlib_main_t * vm, bond_enslave_args_t * args)
}
}
- pool_get (bm->neighbors, sif);
- clib_memset (sif, 0, sizeof (*sif));
- sw = pool_elt_at_index (im->sw_interfaces, args->slave);
+ pool_get (bm->neighbors, mif);
+ clib_memset (mif, 0, sizeof (*mif));
+ sw = pool_elt_at_index (im->sw_interfaces, args->member);
/* port_enabled is both admin up and hw link up */
- sif->port_enabled = vnet_sw_interface_is_up (vnm, sw->sw_if_index);
- sif->sw_if_index = sw->sw_if_index;
- sif->hw_if_index = sw->hw_if_index;
- sif->packet_template_index = (u8) ~ 0;
- sif->is_passive = args->is_passive;
- sif->group = args->group;
- sif->bif_dev_instance = bif->dev_instance;
- sif->mode = bif->mode;
-
- sif->is_long_timeout = args->is_long_timeout;
+ mif->port_enabled = vnet_sw_interface_is_up (vnm, sw->sw_if_index);
+ mif->sw_if_index = sw->sw_if_index;
+ mif->hw_if_index = sw->hw_if_index;
+ mif->packet_template_index = (u8) ~ 0;
+ mif->is_passive = args->is_passive;
+ mif->group = args->group;
+ mif->bif_dev_instance = bif->dev_instance;
+ mif->mode = bif->mode;
+
+ mif->is_long_timeout = args->is_long_timeout;
if (args->is_long_timeout)
- sif->ttl_in_seconds = LACP_LONG_TIMOUT_TIME;
+ mif->ttl_in_seconds = LACP_LONG_TIMOUT_TIME;
else
- sif->ttl_in_seconds = LACP_SHORT_TIMOUT_TIME;
+ mif->ttl_in_seconds = LACP_SHORT_TIMOUT_TIME;
- vec_validate_aligned (bm->slave_by_sw_if_index, sif->sw_if_index,
+ vec_validate_aligned (bm->member_by_sw_if_index, mif->sw_if_index,
CLIB_CACHE_LINE_BYTES);
/*
- * sif - bm->neighbors may be 0
+ * mif - bm->neighbors may be 0
* Left shift it by 1 bit to distinguish the valid entry that we actually
* store from the null entries
*/
- bm->slave_by_sw_if_index[sif->sw_if_index] =
- (uword) (((sif - bm->neighbors) << 1) | 1);
- vec_add1 (bif->slaves, sif->sw_if_index);
+ bm->member_by_sw_if_index[mif->sw_if_index] =
+ (uword) (((mif - bm->neighbors) << 1) | 1);
+ vec_add1 (bif->members, mif->sw_if_index);
- sif_hw = vnet_get_sup_hw_interface (vnm, sif->sw_if_index);
+ mif_hw = vnet_get_sup_hw_interface (vnm, mif->sw_if_index);
/* Save the old mac */
- memcpy (sif->persistent_hw_address, sif_hw->hw_address, 6);
+ memcpy (mif->persistent_hw_address, mif_hw->hw_address, 6);
bif_hw = vnet_get_sup_hw_interface (vnm, bif->sw_if_index);
if (bif->use_custom_mac)
{
- vnet_hw_interface_change_mac_address (vnm, sif_hw->hw_if_index,
+ vnet_hw_interface_change_mac_address (vnm, mif_hw->hw_if_index,
bif->hw_address);
}
else
{
- // bond interface gets the mac address from the first slave
- if (vec_len (bif->slaves) == 1)
+ // bond interface gets the mac address from the first member
+ if (vec_len (bif->members) == 1)
{
- memcpy (bif->hw_address, sif_hw->hw_address, 6);
+ memcpy (bif->hw_address, mif_hw->hw_address, 6);
vnet_hw_interface_change_mac_address (vnm, bif_hw->hw_if_index,
- sif_hw->hw_address);
+ mif_hw->hw_address);
}
else
{
- // subsequent slaves gets the mac address of the bond interface
- vnet_hw_interface_change_mac_address (vnm, sif_hw->hw_if_index,
+ // subsequent members gets the mac address of the bond interface
+ vnet_hw_interface_change_mac_address (vnm, mif_hw->hw_if_index,
bif->hw_address);
}
}
- /* if there are secondary/virtual mac addrs, propagate to the slave */
- bond_slave_add_del_mac_addrs (bif, sif->sw_if_index, 1 /* is_add */ );
+ /* if there are secondary/virtual mac addrs, propagate to the member */
+ bond_member_add_del_mac_addrs (bif, mif->sw_if_index, 1 /* is_add */ );
if (bif_hw->l2_if_count)
- ethernet_set_flags (vnm, sif_hw->hw_if_index,
+ ethernet_set_flags (vnm, mif_hw->hw_if_index,
ETHERNET_INTERFACE_FLAG_ACCEPT_ALL);
else
- ethernet_set_flags (vnm, sif_hw->hw_if_index,
+ ethernet_set_flags (vnm, mif_hw->hw_if_index,
/*ETHERNET_INTERFACE_FLAG_DEFAULT_L3 */ 0);
if (bif->mode == BOND_MODE_LACP)
{
if (bm->lacp_enable_disable)
- (*bm->lacp_enable_disable) (vm, bif, sif, 1);
+ (*bm->lacp_enable_disable) (vm, bif, mif, 1);
}
- else if (sif->port_enabled)
+ else if (mif->port_enabled)
{
- bond_enable_collecting_distributing (vm, sif);
+ bond_enable_collecting_distributing (vm, mif);
}
vec_foreach_index (thread_index, bm->per_thread_data)
@@ -748,17 +750,17 @@ bond_enslave (vlib_main_t * vm, bond_enslave_args_t * args)
bond_per_thread_data_t *ptd = vec_elt_at_index (bm->per_thread_data,
thread_index);
- vec_validate_aligned (ptd->per_port_queue, vec_len (bif->slaves) - 1,
+ vec_validate_aligned (ptd->per_port_queue, vec_len (bif->members) - 1,
CLIB_CACHE_LINE_BYTES);
- vec_foreach_index (sif_if_index, ptd->per_port_queue)
+ vec_foreach_index (mif_if_index, ptd->per_port_queue)
{
- ptd->per_port_queue[sif_if_index].n_buffers = 0;
+ ptd->per_port_queue[mif_if_index].n_buffers = 0;
}
}
args->rv = vnet_feature_enable_disable ("device-input", "bond-input",
- sif->sw_if_index, 1, 0, 0);
+ mif->sw_if_index, 1, 0, 0);
if (args->rv)
{
@@ -769,10 +771,10 @@ bond_enslave (vlib_main_t * vm, bond_enslave_args_t * args)
}
static clib_error_t *
-enslave_interface_command_fn (vlib_main_t * vm, unformat_input_t * input,
- vlib_cli_command_t * cmd)
+add_member_interface_command_fn (vlib_main_t * vm, unformat_input_t * input,
+ vlib_cli_command_t * cmd)
{
- bond_enslave_args_t args = { 0 };
+ bond_add_member_args_t args = { 0 };
unformat_input_t _line_input, *line_input = &_line_input;
vnet_main_t *vnm = vnet_get_main ();
@@ -780,13 +782,13 @@ enslave_interface_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (!unformat_user (input, unformat_line_input, line_input))
return clib_error_return (0, "Missing required arguments.");
- args.slave = ~0;
+ args.member = ~0;
args.group = ~0;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (line_input, "%U %U",
unformat_vnet_sw_interface, vnm, &args.group,
- unformat_vnet_sw_interface, vnm, &args.slave))
+ unformat_vnet_sw_interface, vnm, &args.member))
;
else if (unformat (line_input, "passive"))
args.is_passive = 1;
@@ -805,45 +807,46 @@ enslave_interface_command_fn (vlib_main_t * vm, unformat_input_t * input,
return args.error;
if (args.group == ~0)
return clib_error_return (0, "Missing bond interface");
- if (args.slave == ~0)
- return clib_error_return (0, "please specify valid slave interface name");
+ if (args.member == ~0)
+ return clib_error_return (0,
+ "please specify valid member interface name");
- bond_enslave (vm, &args);
+ bond_add_member (vm, &args);
return args.error;
}
/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (enslave_interface_command, static) = {
+VLIB_CLI_COMMAND (add_member_interface_command, static) = {
.path = "bond add",
- .short_help = "bond add <BondEthernetx> <slave-interface> "
+ .short_help = "bond add <BondEthernetx> <member-interface> "
"[passive] [long-timeout]",
- .function = enslave_interface_command_fn,
+ .function = add_member_interface_command_fn,
};
/* *INDENT-ON* */
void
-bond_detach_slave (vlib_main_t * vm, bond_detach_slave_args_t * args)
+bond_detach_member (vlib_main_t * vm, bond_detach_member_args_t * args)
{
bond_if_t *bif;
- slave_if_t *sif;
+ member_if_t *mif;
- sif = bond_get_slave_by_sw_if_index (args->slave);
- if (!sif)
+ mif = bond_get_member_by_sw_if_index (args->member);
+ if (!mif)
{
args->rv = VNET_API_ERROR_INVALID_INTERFACE;
- args->error = clib_error_return (0, "interface was not enslaved");
+ args->error = clib_error_return (0, "interface was not a member");
return;
}
- bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
- bond_delete_neighbor (vm, bif, sif);
+ bif = bond_get_bond_if_by_dev_instance (mif->bif_dev_instance);
+ bond_delete_neighbor (vm, bif, mif);
}
static clib_error_t *
detach_interface_command_fn (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_command_t * cmd)
{
- bond_detach_slave_args_t args = { 0 };
+ bond_detach_member_args_t args = { 0 };
unformat_input_t _line_input, *line_input = &_line_input;
vnet_main_t *vnm = vnet_get_main ();
@@ -851,11 +854,11 @@ detach_interface_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (!unformat_user (input, unformat_line_input, line_input))
return clib_error_return (0, "Missing required arguments.");
- args.slave = ~0;
+ args.member = ~0;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (line_input, "%U",
- unformat_vnet_sw_interface, vnm, &args.slave))
+ unformat_vnet_sw_interface, vnm, &args.member))
;
else
{
@@ -868,10 +871,11 @@ detach_interface_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (args.error)
return args.error;
- if (args.slave == ~0)
- return clib_error_return (0, "please specify valid slave interface name");
+ if (args.member == ~0)
+ return clib_error_return (0,
+ "please specify valid member interface name");
- bond_detach_slave (vm, &args);
+ bond_detach_member (vm, &args);
return args.error;
}
@@ -879,7 +883,7 @@ detach_interface_command_fn (vlib_main_t * vm, unformat_input_t * input,
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (detach_interface_command, static) = {
.path = "bond del",
- .short_help = "bond del <slave-interface>",
+ .short_help = "bond del <member-interface>",
.function = detach_interface_command_fn,
};
/* *INDENT-ON* */
@@ -892,7 +896,7 @@ show_bond (vlib_main_t * vm)
vlib_cli_output (vm, "%-16s %-12s %-13s %-13s %-14s %s",
"interface name", "sw_if_index", "mode",
- "load balance", "active slaves", "slaves");
+ "load balance", "active members", "members");
/* *INDENT-OFF* */
pool_foreach (bif, bm->interfaces,
@@ -901,7 +905,7 @@ show_bond (vlib_main_t * vm)
format_bond_interface_name, bif->dev_instance,
bif->sw_if_index, format_bond_mode, bif->mode,
format_bond_load_balance, bif->lb,
- vec_len (bif->active_slaves), vec_len (bif->slaves));
+ vec_len (bif->active_members), vec_len (bif->members));
}));
/* *INDENT-ON* */
}
@@ -924,25 +928,25 @@ show_bond_details (vlib_main_t * vm)
if (bif->gso)
vlib_cli_output (vm, " gso enable");
if (bif->mode == BOND_MODE_ROUND_ROBIN)
- vlib_cli_output (vm, " last xmit slave index: %u",
+ vlib_cli_output (vm, " last xmit member index: %u",
bif->lb_rr_last_index);
- vlib_cli_output (vm, " number of active slaves: %d",
- vec_len (bif->active_slaves));
- vec_foreach (sw_if_index, bif->active_slaves)
+ vlib_cli_output (vm, " number of active members: %d",
+ vec_len (bif->active_members));
+ vec_foreach (sw_if_index, bif->active_members)
{
vlib_cli_output (vm, " %U", format_vnet_sw_if_index_name,
vnet_get_main (), *sw_if_index);
if (bif->mode == BOND_MODE_ACTIVE_BACKUP)
{
- slave_if_t *sif = bond_get_slave_by_sw_if_index (*sw_if_index);
- if (sif)
+ member_if_t *mif = bond_get_member_by_sw_if_index (*sw_if_index);
+ if (mif)
vlib_cli_output (vm, " weight: %u, is_local_numa: %u, "
- "sw_if_index: %u", sif->weight,
- sif->is_local_numa, sif->sw_if_index);
+ "sw_if_index: %u", mif->weight,
+ mif->is_local_numa, mif->sw_if_index);
}
}
- vlib_cli_output (vm, " number of slaves: %d", vec_len (bif->slaves));
- vec_foreach (sw_if_index, bif->slaves)
+ vlib_cli_output (vm, " number of members: %d", vec_len (bif->members));
+ vec_foreach (sw_if_index, bif->members)
{
vlib_cli_output (vm, " %U", format_vnet_sw_if_index_name,
vnet_get_main (), *sw_if_index);
@@ -991,19 +995,19 @@ VLIB_CLI_COMMAND (show_bond_command, static) = {
void
bond_set_intf_weight (vlib_main_t * vm, bond_set_intf_weight_args_t * args)
{
- slave_if_t *sif;
+ member_if_t *mif;
bond_if_t *bif;
vnet_main_t *vnm;
u32 old_weight;
- sif = bond_get_slave_by_sw_if_index (args->sw_if_index);
- if (!sif)
+ mif = bond_get_member_by_sw_if_index (args->sw_if_index);
+ if (!mif)
{
args->rv = VNET_API_ERROR_INVALID_INTERFACE;
- args->error = clib_error_return (0, "Interface not enslaved");
+ args->error = clib_error_return (0, "Interface not a member");
return;
}
- bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
+ bif = bond_get_bond_if_by_dev_instance (mif->bif_dev_instance);
if (!bif)
{
args->rv = VNET_API_ERROR_INVALID_INTERFACE;
@@ -1018,21 +1022,21 @@ bond_set_intf_weight (vlib_main_t * vm, bond_set_intf_weight_args_t * args)
return;
}
- old_weight = sif->weight;
- sif->weight = args->weight;
+ old_weight = mif->weight;
+ mif->weight = args->weight;
vnm = vnet_get_main ();
/*
- * No need to sort the list if the affected slave is not up (not in active
- * slave set), active slave count is 1, or the current slave is already the
- * primary slave and new weight > old weight.
+ * No need to sort the list if the affected member is not up (not in active
+ * member set), active member count is 1, or the current member is already the
+ * primary member and new weight > old weight.
*/
- if (!vnet_sw_interface_is_up (vnm, sif->sw_if_index) ||
- (vec_len (bif->active_slaves) == 1) ||
- ((bif->active_slaves[0] == sif->sw_if_index) &&
- (sif->weight >= old_weight)))
+ if (!vnet_sw_interface_is_up (vnm, mif->sw_if_index) ||
+ (vec_len (bif->active_members) == 1) ||
+ ((bif->active_members[0] == mif->sw_if_index) &&
+ (mif->weight >= old_weight)))
return;
- bond_sort_slaves (bif);
+ bond_sort_members (bif);
}
static clib_error_t *
@@ -1102,7 +1106,7 @@ bond_cli_init (vlib_main_t * vm)
bm->vlib_main = vm;
bm->vnet_main = vnet_get_main ();
- vec_validate_aligned (bm->slave_by_sw_if_index, 1, CLIB_CACHE_LINE_BYTES);
+ vec_validate_aligned (bm->member_by_sw_if_index, 1, CLIB_CACHE_LINE_BYTES);
vec_validate_aligned (bm->per_thread_data,
vlib_get_thread_main ()->n_vlib_mains - 1,
CLIB_CACHE_LINE_BYTES);