summaryrefslogtreecommitdiffstats
path: root/src/vnet/bonding
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/bonding')
-rw-r--r--src/vnet/bonding/bond.api122
-rw-r--r--src/vnet/bonding/bond_api.c203
-rw-r--r--src/vnet/bonding/cli.c446
-rw-r--r--src/vnet/bonding/device.c153
-rw-r--r--src/vnet/bonding/node.c92
-rw-r--r--src/vnet/bonding/node.h85
6 files changed, 684 insertions, 417 deletions
diff --git a/src/vnet/bonding/bond.api b/src/vnet/bonding/bond.api
index 865dcbe0857..682298e9084 100644
--- a/src/vnet/bonding/bond.api
+++ b/src/vnet/bonding/bond.api
@@ -19,7 +19,7 @@
the bonding device driver
*/
-option version = "2.0.0";
+option version = "2.1.0";
import "vnet/interface_types.api";
import "vnet/ethernet/ethernet_types.api";
@@ -80,7 +80,7 @@ define bond_create_reply
/** \brief Delete bond interface
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
- @param sw_if_index - interface index of slave interface
+ @param sw_if_index - interface index of member interface
*/
autoreply define bond_delete
{
@@ -99,6 +99,7 @@ autoreply define bond_delete
*/
define bond_enslave
{
+ option deprecated="20.06";
u32 client_index;
u32 context;
vl_api_interface_index_t sw_if_index;
@@ -117,13 +118,54 @@ define bond_enslave_reply
i32 retval;
};
+/** \brief Initialize a new bond interface with the given paramters
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param sw_if_index - member sw_if_index
+ @param bond_sw_if_index - bond sw_if_index
+ @param is_passive - interface does not initiate the lacp protocol, remote must be active speaker
+ @param is_long_timeout - 90 seconds vs default 3 seconds neighbor timeout
+*/
+define bond_add_member
+{
+ u32 client_index;
+ u32 context;
+ vl_api_interface_index_t sw_if_index;
+ vl_api_interface_index_t bond_sw_if_index;
+ bool is_passive;
+ bool is_long_timeout;
+};
+
+/** \brief Reply for bond add_member reply
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+*/
+define bond_add_member_reply
+{
+ u32 context;
+ i32 retval;
+};
+
/** \brief bond detach slave
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
- @param sw_if_index - interface index of slave interface
+ @param sw_if_index - interface index of member interface
*/
autoreply define bond_detach_slave
{
+ option deprecated="20.06";
+ u32 client_index;
+ u32 context;
+ vl_api_interface_index_t sw_if_index;
+};
+
+/** \brief bond detach member
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param sw_if_index - interface index of member interface
+*/
+autoreply define bond_detach_member
+{
u32 client_index;
u32 context;
vl_api_interface_index_t sw_if_index;
@@ -132,6 +174,7 @@ autoreply define bond_detach_slave
/** \brief Dump bond interfaces request */
define sw_interface_bond_dump
{
+ option deprecated="20.06";
u32 client_index;
u32 context;
};
@@ -139,12 +182,12 @@ define sw_interface_bond_dump
/** \brief Reply for bond dump request
@param sw_if_index - software index of bond interface
@param id - ID of interface
+ @param interface_name - name of interface
@param mode - bonding mode
@param lb - load balance algo
@param numa_only - enable local numa TX for lacp mode
- @param active_slaves - active slaves count
- @param slaves - config slave count
- @param interface_name - name of interface
+ @param active_slaves - active member count
+ @param slaves - config member count
*/
define sw_interface_bond_details
{
@@ -159,6 +202,37 @@ define sw_interface_bond_details
string interface_name[64];
};
+/** \brief Dump bond interfaces request */
+define sw_bond_interface_dump
+{
+ u32 client_index;
+ u32 context;
+ vl_api_interface_index_t sw_if_index [default=0xffffffff];
+};
+
+/** \brief Reply for bond dump request
+ @param sw_if_index - software index of bond interface
+ @param id - ID of interface
+ @param mode - bonding mode
+ @param lb - load balance algo
+ @param numa_only - enable local numa TX for lacp mode
+ @param active_members - active members count
+ @param members - config member count
+ @param interface_name - name of interface
+*/
+define sw_bond_interface_details
+{
+ u32 context;
+ vl_api_interface_index_t sw_if_index;
+ u32 id;
+ vl_api_bond_mode_t mode;
+ vl_api_bond_lb_algo_t lb;
+ bool numa_only;
+ u32 active_members;
+ u32 members;
+ string interface_name[64];
+};
+
/** \brief bond slave dump
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -166,6 +240,7 @@ define sw_interface_bond_details
*/
define sw_interface_slave_dump
{
+ option deprecated="20.06";
u32 client_index;
u32 context;
vl_api_interface_index_t sw_if_index;
@@ -190,11 +265,42 @@ define sw_interface_slave_details
u32 weight;
};
+/** \brief bond member dump
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param sw_if_index - interface index of bond interface
+*/
+define sw_member_interface_dump
+{
+ u32 client_index;
+ u32 context;
+ vl_api_interface_index_t sw_if_index;
+};
+
+/** \brief Reply for member dump request
+ @param sw_if_index - software index of member interface
+ @param interface_name - name of interface
+ @param is_passve - interface does not initiate the lacp protocol, remote must be active speaker
+ @param is_long_timeout - 90 seconds vs default 3 seconds neighbor timeout
+ @param is_local_numa - the member interface is local numa
+ @param weight - the weight for the member interface (active-backup mode only)
+*/
+define sw_member_interface_details
+{
+ u32 context;
+ vl_api_interface_index_t sw_if_index;
+ string interface_name[64];
+ bool is_passive;
+ bool is_long_timeout;
+ bool is_local_numa;
+ u32 weight;
+};
+
/** \brief Interface set bond weight
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
- @param sw_if_index - slave interface for which to set the weight
- @param weight - weight value to be set for the slave interface
+ @param sw_if_index - member interface for which to set the weight
+ @param weight - weight value to be set for the member interface
*/
autoreply define sw_interface_set_bond_weight
{
diff --git a/src/vnet/bonding/bond_api.c b/src/vnet/bonding/bond_api.c
index 525f058ee4c..2395a47fe7a 100644
--- a/src/vnet/bonding/bond_api.c
+++ b/src/vnet/bonding/bond_api.c
@@ -48,10 +48,14 @@
_(BOND_CREATE, bond_create) \
_(BOND_DELETE, bond_delete) \
_(BOND_ENSLAVE, bond_enslave) \
+_(BOND_ADD_MEMBER, bond_add_member) \
_(SW_INTERFACE_SET_BOND_WEIGHT, sw_interface_set_bond_weight) \
_(BOND_DETACH_SLAVE, bond_detach_slave) \
-_(SW_INTERFACE_BOND_DUMP, sw_interface_bond_dump)\
-_(SW_INTERFACE_SLAVE_DUMP, sw_interface_slave_dump)
+_(BOND_DETACH_MEMBER, bond_detach_member) \
+_(SW_INTERFACE_BOND_DUMP, sw_interface_bond_dump) \
+_(SW_BOND_INTERFACE_DUMP, sw_bond_interface_dump) \
+_(SW_INTERFACE_SLAVE_DUMP, sw_interface_slave_dump) \
+_(SW_MEMBER_INTERFACE_DUMP, sw_member_interface_dump)
static void
vl_api_bond_delete_t_handler (vl_api_bond_delete_t * mp)
@@ -99,21 +103,41 @@ vl_api_bond_create_t_handler (vl_api_bond_create_t * mp)
}
static void
+vl_api_bond_add_member_t_handler (vl_api_bond_add_member_t * mp)
+{
+ vlib_main_t *vm = vlib_get_main ();
+ vl_api_bond_add_member_reply_t *rmp;
+ bond_add_member_args_t _a, *ap = &_a;
+ int rv = 0;
+
+ clib_memset (ap, 0, sizeof (*ap));
+
+ ap->group = ntohl (mp->bond_sw_if_index);
+ ap->member = ntohl (mp->sw_if_index);
+ ap->is_passive = mp->is_passive;
+ ap->is_long_timeout = mp->is_long_timeout;
+
+ bond_add_member (vm, ap);
+
+ REPLY_MACRO (VL_API_BOND_ADD_MEMBER_REPLY);
+}
+
+static void
vl_api_bond_enslave_t_handler (vl_api_bond_enslave_t * mp)
{
vlib_main_t *vm = vlib_get_main ();
vl_api_bond_enslave_reply_t *rmp;
- bond_enslave_args_t _a, *ap = &_a;
+ bond_add_member_args_t _a, *ap = &_a;
int rv = 0;
clib_memset (ap, 0, sizeof (*ap));
ap->group = ntohl (mp->bond_sw_if_index);
- ap->slave = ntohl (mp->sw_if_index);
+ ap->member = ntohl (mp->sw_if_index);
ap->is_passive = mp->is_passive;
ap->is_long_timeout = mp->is_long_timeout;
- bond_enslave (vm, ap);
+ bond_add_member (vm, ap);
REPLY_MACRO (VL_API_BOND_ENSLAVE_REPLY);
}
@@ -142,18 +166,34 @@ vl_api_bond_detach_slave_t_handler (vl_api_bond_detach_slave_t * mp)
{
vlib_main_t *vm = vlib_get_main ();
vl_api_bond_detach_slave_reply_t *rmp;
- bond_detach_slave_args_t _a, *ap = &_a;
+ bond_detach_member_args_t _a, *ap = &_a;
int rv = 0;
clib_memset (ap, 0, sizeof (*ap));
- ap->slave = ntohl (mp->sw_if_index);
- bond_detach_slave (vm, ap);
+ ap->member = ntohl (mp->sw_if_index);
+ bond_detach_member (vm, ap);
REPLY_MACRO (VL_API_BOND_DETACH_SLAVE_REPLY);
}
static void
+vl_api_bond_detach_member_t_handler (vl_api_bond_detach_member_t * mp)
+{
+ vlib_main_t *vm = vlib_get_main ();
+ vl_api_bond_detach_member_reply_t *rmp;
+ bond_detach_member_args_t _a, *ap = &_a;
+ int rv = 0;
+
+ clib_memset (ap, 0, sizeof (*ap));
+
+ ap->member = ntohl (mp->sw_if_index);
+ bond_detach_member (vm, ap);
+
+ REPLY_MACRO (VL_API_BOND_DETACH_MEMBER_REPLY);
+}
+
+static void
bond_send_sw_interface_details (vpe_api_main_t * am,
vl_api_registration_t * reg,
bond_interface_details_t * bond_if,
@@ -172,8 +212,8 @@ bond_send_sw_interface_details (vpe_api_main_t * am,
mp->mode = htonl (bond_if->mode);
mp->lb = htonl (bond_if->lb);
mp->numa_only = bond_if->numa_only;
- mp->active_slaves = htonl (bond_if->active_slaves);
- mp->slaves = htonl (bond_if->slaves);
+ mp->active_slaves = htonl (bond_if->active_members);
+ mp->slaves = htonl (bond_if->members);
mp->context = context;
vl_api_send_msg (reg, (u8 *) mp);
@@ -205,24 +245,83 @@ vl_api_sw_interface_bond_dump_t_handler (vl_api_sw_interface_bond_dump_t * mp)
}
static void
-bond_send_sw_interface_slave_details (vpe_api_main_t * am,
- vl_api_registration_t * reg,
- slave_interface_details_t * slave_if,
- u32 context)
+bond_send_sw_bond_interface_details (vpe_api_main_t * am,
+ vl_api_registration_t * reg,
+ bond_interface_details_t * bond_if,
+ u32 context)
+{
+ vl_api_sw_bond_interface_details_t *mp;
+
+ mp = vl_msg_api_alloc (sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id = htons (VL_API_SW_BOND_INTERFACE_DETAILS);
+ mp->sw_if_index = htonl (bond_if->sw_if_index);
+ mp->id = htonl (bond_if->id);
+ clib_memcpy (mp->interface_name, bond_if->interface_name,
+ MIN (ARRAY_LEN (mp->interface_name) - 1,
+ strlen ((const char *) bond_if->interface_name)));
+ mp->mode = htonl (bond_if->mode);
+ mp->lb = htonl (bond_if->lb);
+ mp->numa_only = bond_if->numa_only;
+ mp->active_members = htonl (bond_if->active_members);
+ mp->members = htonl (bond_if->members);
+
+ mp->context = context;
+ vl_api_send_msg (reg, (u8 *) mp);
+}
+
+static void
+vl_api_sw_bond_interface_dump_t_handler (vl_api_sw_bond_interface_dump_t * mp)
+{
+ int rv;
+ vpe_api_main_t *am = &vpe_api_main;
+ vl_api_registration_t *reg;
+ bond_interface_details_t *bondifs = NULL;
+ bond_interface_details_t *bond_if = NULL;
+ u32 filter_sw_if_index;
+
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
+
+ filter_sw_if_index = htonl (mp->sw_if_index);
+ if (filter_sw_if_index != ~0)
+ VALIDATE_SW_IF_INDEX (mp);
+
+ rv = bond_dump_ifs (&bondifs);
+ if (rv)
+ return;
+
+ vec_foreach (bond_if, bondifs)
+ {
+ if ((filter_sw_if_index == ~0) ||
+ (bond_if->sw_if_index == filter_sw_if_index))
+ bond_send_sw_bond_interface_details (am, reg, bond_if, mp->context);
+ }
+
+ BAD_SW_IF_INDEX_LABEL;
+ vec_free (bondifs);
+}
+
+static void
+bond_send_sw_member_interface_details (vpe_api_main_t * am,
+ vl_api_registration_t * reg,
+ member_interface_details_t * member_if,
+ u32 context)
{
vl_api_sw_interface_slave_details_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = htons (VL_API_SW_INTERFACE_SLAVE_DETAILS);
- mp->sw_if_index = htonl (slave_if->sw_if_index);
- clib_memcpy (mp->interface_name, slave_if->interface_name,
+ mp->sw_if_index = htonl (member_if->sw_if_index);
+ clib_memcpy (mp->interface_name, member_if->interface_name,
MIN (ARRAY_LEN (mp->interface_name) - 1,
- strlen ((const char *) slave_if->interface_name)));
- mp->is_passive = slave_if->is_passive;
- mp->is_long_timeout = slave_if->is_long_timeout;
- mp->is_local_numa = slave_if->is_local_numa;
- mp->weight = htonl (slave_if->weight);
+ strlen ((const char *) member_if->interface_name)));
+ mp->is_passive = member_if->is_passive;
+ mp->is_long_timeout = member_if->is_long_timeout;
+ mp->is_local_numa = member_if->is_local_numa;
+ mp->weight = htonl (member_if->weight);
mp->context = context;
vl_api_send_msg (reg, (u8 *) mp);
@@ -235,23 +334,73 @@ vl_api_sw_interface_slave_dump_t_handler (vl_api_sw_interface_slave_dump_t *
int rv;
vpe_api_main_t *am = &vpe_api_main;
vl_api_registration_t *reg;
- slave_interface_details_t *slaveifs = NULL;
- slave_interface_details_t *slave_if = NULL;
+ member_interface_details_t *memberifs = NULL;
+ member_interface_details_t *member_if = NULL;
+
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
+
+ rv = bond_dump_member_ifs (&memberifs, ntohl (mp->sw_if_index));
+ if (rv)
+ return;
+
+ vec_foreach (member_if, memberifs)
+ {
+ bond_send_sw_member_interface_details (am, reg, member_if, mp->context);
+ }
+
+ vec_free (memberifs);
+}
+
+static void
+bond_send_member_interface_details (vpe_api_main_t * am,
+ vl_api_registration_t * reg,
+ member_interface_details_t * member_if,
+ u32 context)
+{
+ vl_api_sw_member_interface_details_t *mp;
+
+ mp = vl_msg_api_alloc (sizeof (*mp));
+ clib_memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id = htons (VL_API_SW_MEMBER_INTERFACE_DETAILS);
+ mp->sw_if_index = htonl (member_if->sw_if_index);
+ clib_memcpy (mp->interface_name, member_if->interface_name,
+ MIN (ARRAY_LEN (mp->interface_name) - 1,
+ strlen ((const char *) member_if->interface_name)));
+ mp->is_passive = member_if->is_passive;
+ mp->is_long_timeout = member_if->is_long_timeout;
+ mp->is_local_numa = member_if->is_local_numa;
+ mp->weight = htonl (member_if->weight);
+
+ mp->context = context;
+ vl_api_send_msg (reg, (u8 *) mp);
+}
+
+static void
+vl_api_sw_member_interface_dump_t_handler (vl_api_sw_member_interface_dump_t *
+ mp)
+{
+ int rv;
+ vpe_api_main_t *am = &vpe_api_main;
+ vl_api_registration_t *reg;
+ member_interface_details_t *memberifs = NULL;
+ member_interface_details_t *member_if = NULL;
reg = vl_api_client_index_to_registration (mp->client_index);
if (!reg)
return;
- rv = bond_dump_slave_ifs (&slaveifs, ntohl (mp->sw_if_index));
+ rv = bond_dump_member_ifs (&memberifs, ntohl (mp->sw_if_index));
if (rv)
return;
- vec_foreach (slave_if, slaveifs)
+ vec_foreach (member_if, memberifs)
{
- bond_send_sw_interface_slave_details (am, reg, slave_if, mp->context);
+ bond_send_member_interface_details (am, reg, member_if, mp->context);
}
- vec_free (slaveifs);
+ vec_free (memberifs);
}
#define vl_msg_name_crc_list
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);
diff --git a/src/vnet/bonding/device.c b/src/vnet/bonding/device.c
index b3069fe0f13..38759eed1ef 100644
--- a/src/vnet/bonding/device.c
+++ b/src/vnet/bonding/device.c
@@ -29,7 +29,7 @@
#define foreach_bond_tx_error \
_(NONE, "no error") \
_(IF_DOWN, "interface down") \
- _(NO_SLAVE, "no slave")
+ _(NO_MEMBER, "no member")
typedef enum
{
@@ -85,29 +85,29 @@ bond_set_l2_mode_function (vnet_main_t * vnm,
{
bond_if_t *bif;
u32 *sw_if_index;
- struct vnet_hw_interface_t *sif_hw;
+ struct vnet_hw_interface_t *mif_hw;
- bif = bond_get_master_by_sw_if_index (bif_hw->sw_if_index);
+ bif = bond_get_bond_if_by_sw_if_index (bif_hw->sw_if_index);
if (!bif)
return 0;
if ((bif_hw->l2_if_count == 1) && (l2_if_adjust == 1))
{
/* Just added first L2 interface on this port */
- vec_foreach (sw_if_index, bif->slaves)
+ vec_foreach (sw_if_index, bif->members)
{
- sif_hw = vnet_get_sup_hw_interface (vnm, *sw_if_index);
- ethernet_set_flags (vnm, sif_hw->hw_if_index,
+ mif_hw = vnet_get_sup_hw_interface (vnm, *sw_if_index);
+ ethernet_set_flags (vnm, mif_hw->hw_if_index,
ETHERNET_INTERFACE_FLAG_ACCEPT_ALL);
}
}
else if ((bif_hw->l2_if_count == 0) && (l2_if_adjust == -1))
{
/* Just removed last L2 subinterface on this port */
- vec_foreach (sw_if_index, bif->slaves)
+ vec_foreach (sw_if_index, bif->members)
{
- sif_hw = vnet_get_sup_hw_interface (vnm, *sw_if_index);
- ethernet_set_flags (vnm, sif_hw->hw_if_index,
+ mif_hw = vnet_get_sup_hw_interface (vnm, *sw_if_index);
+ ethernet_set_flags (vnm, mif_hw->hw_if_index,
/*ETHERNET_INTERFACE_FLAG_DEFAULT_L3 */ 0);
}
}
@@ -132,7 +132,7 @@ bond_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
bond_if_t *bif = pool_elt_at_index (bm->interfaces, hif->dev_instance);
bif->admin_up = is_up;
- if (is_up && vec_len (bif->active_slaves))
+ if (is_up && vec_len (bif->active_members))
vnet_hw_interface_set_flags (vnm, bif->hw_if_index,
VNET_HW_INTERFACE_FLAG_LINK_UP);
return 0;
@@ -149,17 +149,18 @@ bond_add_del_mac_address (vnet_hw_interface_t * hi, const u8 * address,
int i;
- bif = bond_get_master_by_sw_if_index (hi->sw_if_index);
+ bif = bond_get_bond_if_by_sw_if_index (hi->sw_if_index);
if (!bif)
{
- return clib_error_return (0, "No bond master found for sw_if_index %u",
+ return clib_error_return (0,
+ "No bond interface found for sw_if_index %u",
hi->sw_if_index);
}
- /* Add/del address on each slave hw intf, they control the hardware */
- vec_foreach_index (i, bif->slaves)
+ /* Add/del address on each member hw intf, they control the hardware */
+ vec_foreach_index (i, bif->members)
{
- s_hi = vnet_get_sup_hw_interface (vnm, vec_elt (bif->slaves, i));
+ s_hi = vnet_get_sup_hw_interface (vnm, vec_elt (bif->members, i));
error = vnet_hw_interface_add_del_mac_address (vnm, s_hi->hw_if_index,
address, is_add);
@@ -170,7 +171,7 @@ bond_add_del_mac_address (vnet_hw_interface_t * hi, const u8 * address,
/* undo any that were completed before the failure */
for (j = i - 1; j > -1; j--)
{
- s_hi = vnet_get_sup_hw_interface (vnm, vec_elt (bif->slaves, j));
+ s_hi = vnet_get_sup_hw_interface (vnm, vec_elt (bif->members, j));
vnet_hw_interface_add_del_mac_address (vnm, s_hi->hw_if_index,
address, !(is_add));
}
@@ -191,7 +192,7 @@ bond_tx_add_to_queue (bond_per_thread_data_t * ptd, u32 port, u32 bi)
static_always_inline u32
bond_lb_broadcast (vlib_main_t * vm,
- bond_if_t * bif, vlib_buffer_t * b0, uword n_slaves)
+ bond_if_t * bif, vlib_buffer_t * b0, uword n_members)
{
bond_main_t *bm = &bond_main;
vlib_buffer_t *c0;
@@ -201,9 +202,9 @@ bond_lb_broadcast (vlib_main_t * vm,
bond_per_thread_data_t *ptd = vec_elt_at_index (bm->per_thread_data,
thread_index);
- for (port = 1; port < n_slaves; port++)
+ for (port = 1; port < n_members; port++)
{
- sw_if_index = *vec_elt_at_index (bif->active_slaves, port);
+ sw_if_index = *vec_elt_at_index (bif->active_members, port);
c0 = vlib_buffer_copy (vm, b0);
if (PREDICT_TRUE (c0 != 0))
{
@@ -387,10 +388,10 @@ bond_lb_l34 (vlib_buffer_t * b0)
}
static_always_inline u32
-bond_lb_round_robin (bond_if_t * bif, vlib_buffer_t * b0, uword n_slaves)
+bond_lb_round_robin (bond_if_t * bif, vlib_buffer_t * b0, uword n_members)
{
bif->lb_rr_last_index++;
- if (bif->lb_rr_last_index >= n_slaves)
+ if (bif->lb_rr_last_index >= n_members)
bif->lb_rr_last_index = 0;
return bif->lb_rr_last_index;
@@ -398,7 +399,7 @@ bond_lb_round_robin (bond_if_t * bif, vlib_buffer_t * b0, uword n_slaves)
static_always_inline void
bond_tx_inline (vlib_main_t * vm, bond_if_t * bif, vlib_buffer_t ** b,
- u32 * h, u32 n_left, uword n_slaves, u32 lb_alg)
+ u32 * h, u32 n_left, uword n_members, u32 lb_alg)
{
while (n_left >= 4)
{
@@ -446,17 +447,17 @@ bond_tx_inline (vlib_main_t * vm, bond_if_t * bif, vlib_buffer_t ** b,
}
else if (lb_alg == BOND_LB_RR)
{
- h[0] = bond_lb_round_robin (bif, b[0], n_slaves);
- h[1] = bond_lb_round_robin (bif, b[1], n_slaves);
- h[2] = bond_lb_round_robin (bif, b[2], n_slaves);
- h[3] = bond_lb_round_robin (bif, b[3], n_slaves);
+ h[0] = bond_lb_round_robin (bif, b[0], n_members);
+ h[1] = bond_lb_round_robin (bif, b[1], n_members);
+ h[2] = bond_lb_round_robin (bif, b[2], n_members);
+ h[3] = bond_lb_round_robin (bif, b[3], n_members);
}
else if (lb_alg == BOND_LB_BC)
{
- h[0] = bond_lb_broadcast (vm, bif, b[0], n_slaves);
- h[1] = bond_lb_broadcast (vm, bif, b[1], n_slaves);
- h[2] = bond_lb_broadcast (vm, bif, b[2], n_slaves);
- h[3] = bond_lb_broadcast (vm, bif, b[3], n_slaves);
+ h[0] = bond_lb_broadcast (vm, bif, b[0], n_members);
+ h[1] = bond_lb_broadcast (vm, bif, b[1], n_members);
+ h[2] = bond_lb_broadcast (vm, bif, b[2], n_members);
+ h[3] = bond_lb_broadcast (vm, bif, b[3], n_members);
}
else
{
@@ -479,9 +480,9 @@ bond_tx_inline (vlib_main_t * vm, bond_if_t * bif, vlib_buffer_t ** b,
else if (bif->lb == BOND_LB_L23)
h[0] = bond_lb_l23 (b[0]);
else if (bif->lb == BOND_LB_RR)
- h[0] = bond_lb_round_robin (bif, b[0], n_slaves);
+ h[0] = bond_lb_round_robin (bif, b[0], n_members);
else if (bif->lb == BOND_LB_BC)
- h[0] = bond_lb_broadcast (vm, bif, b[0], n_slaves);
+ h[0] = bond_lb_broadcast (vm, bif, b[0], n_members);
else
{
ASSERT (0);
@@ -494,9 +495,10 @@ bond_tx_inline (vlib_main_t * vm, bond_if_t * bif, vlib_buffer_t ** b,
}
static_always_inline void
-bond_hash_to_port (u32 * h, u32 n_left, u32 n_slaves, int use_modulo_shortcut)
+bond_hash_to_port (u32 * h, u32 n_left, u32 n_members,
+ int use_modulo_shortcut)
{
- u32 mask = n_slaves - 1;
+ u32 mask = n_members - 1;
#ifdef CLIB_HAVE_VEC256
/* only lower 16 bits of hash due to single precision fp arithmetic */
@@ -510,7 +512,7 @@ bond_hash_to_port (u32 * h, u32 n_left, u32 n_slaves, int use_modulo_shortcut)
else
{
mask8 = u32x8_splat (0xffff);
- sc8u = u32x8_splat (n_slaves);
+ sc8u = u32x8_splat (n_members);
sc8f = f32x8_from_u32x8 (sc8u);
}
@@ -543,10 +545,10 @@ bond_hash_to_port (u32 * h, u32 n_left, u32 n_slaves, int use_modulo_shortcut)
}
else
{
- h[0] %= n_slaves;
- h[1] %= n_slaves;
- h[2] %= n_slaves;
- h[3] %= n_slaves;
+ h[0] %= n_members;
+ h[1] %= n_members;
+ h[2] %= n_members;
+ h[3] %= n_members;
}
n_left -= 4;
h += 4;
@@ -556,7 +558,7 @@ bond_hash_to_port (u32 * h, u32 n_left, u32 n_slaves, int use_modulo_shortcut)
if (use_modulo_shortcut)
h[0] &= mask;
else
- h[0] %= n_slaves;
+ h[0] %= n_members;
n_left -= 1;
h += 1;
}
@@ -598,10 +600,10 @@ bond_update_sw_if_index (bond_per_thread_data_t * ptd, bond_if_t * bif,
{
u32 sw_if_index[4];
- sw_if_index[0] = *vec_elt_at_index (bif->active_slaves, h[0]);
- sw_if_index[1] = *vec_elt_at_index (bif->active_slaves, h[1]);
- sw_if_index[2] = *vec_elt_at_index (bif->active_slaves, h[2]);
- sw_if_index[3] = *vec_elt_at_index (bif->active_slaves, h[3]);
+ sw_if_index[0] = *vec_elt_at_index (bif->active_members, h[0]);
+ sw_if_index[1] = *vec_elt_at_index (bif->active_members, h[1]);
+ sw_if_index[2] = *vec_elt_at_index (bif->active_members, h[2]);
+ sw_if_index[3] = *vec_elt_at_index (bif->active_members, h[3]);
vnet_buffer (b[0])->sw_if_index[VLIB_TX] = sw_if_index[0];
vnet_buffer (b[1])->sw_if_index[VLIB_TX] = sw_if_index[1];
@@ -628,7 +630,7 @@ bond_update_sw_if_index (bond_per_thread_data_t * ptd, bond_if_t * bif,
}
else
{
- u32 sw_if_index0 = *vec_elt_at_index (bif->active_slaves, h[0]);
+ u32 sw_if_index0 = *vec_elt_at_index (bif->active_members, h[0]);
vnet_buffer (b[0])->sw_if_index[VLIB_TX] = sw_if_index0;
bond_tx_add_to_queue (ptd, h[0], bi[0]);
@@ -661,11 +663,12 @@ bond_tx_trace (vlib_main_t * vm, vlib_node_runtime_t * node, bond_if_t * bif,
t0->sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
if (!h)
{
- t0->bond_sw_if_index = *vec_elt_at_index (bif->active_slaves, 0);
+ t0->bond_sw_if_index = *vec_elt_at_index (bif->active_members, 0);
}
else
{
- t0->bond_sw_if_index = *vec_elt_at_index (bif->active_slaves, h[0]);
+ t0->bond_sw_if_index =
+ *vec_elt_at_index (bif->active_members, h[0]);
h++;
}
b++;
@@ -681,7 +684,7 @@ VNET_DEVICE_CLASS_TX_FN (bond_dev_class) (vlib_main_t * vm,
bond_main_t *bm = &bond_main;
u16 thread_index = vm->thread_index;
bond_if_t *bif = pool_elt_at_index (bm->interfaces, rund->dev_instance);
- uword n_slaves;
+ uword n_members;
vlib_buffer_t *bufs[VLIB_FRAME_SIZE];
u32 *from = vlib_frame_vector_args (frame);
u32 n_left = frame->n_vectors;
@@ -703,15 +706,15 @@ VNET_DEVICE_CLASS_TX_FN (bond_dev_class) (vlib_main_t * vm,
return frame->n_vectors;
}
- n_slaves = vec_len (bif->active_slaves);
- if (PREDICT_FALSE (n_slaves == 0))
+ n_members = vec_len (bif->active_members);
+ if (PREDICT_FALSE (n_members == 0))
{
vlib_buffer_free (vm, vlib_frame_vector_args (frame), frame->n_vectors);
vlib_increment_simple_counter (vnet_main.interface_main.sw_if_counters +
VNET_INTERFACE_COUNTER_DROP,
thread_index, bif->sw_if_index,
frame->n_vectors);
- vlib_error_count (vm, node->node_index, BOND_TX_ERROR_NO_SLAVE,
+ vlib_error_count (vm, node->node_index, BOND_TX_ERROR_NO_MEMBER,
frame->n_vectors);
return frame->n_vectors;
}
@@ -719,9 +722,9 @@ VNET_DEVICE_CLASS_TX_FN (bond_dev_class) (vlib_main_t * vm,
vlib_get_buffers (vm, from, bufs, n_left);
/* active-backup mode, ship everything to first sw if index */
- if ((bif->lb == BOND_LB_AB) || PREDICT_FALSE (n_slaves == 1))
+ if ((bif->lb == BOND_LB_AB) || PREDICT_FALSE (n_members == 1))
{
- sw_if_index = *vec_elt_at_index (bif->active_slaves, 0);
+ sw_if_index = *vec_elt_at_index (bif->active_members, 0);
bond_tx_trace (vm, node, bif, bufs, frame->n_vectors, 0);
bond_update_sw_if_index (ptd, bif, from, bufs, &sw_if_index, n_left,
@@ -731,37 +734,37 @@ VNET_DEVICE_CLASS_TX_FN (bond_dev_class) (vlib_main_t * vm,
if (bif->lb == BOND_LB_BC)
{
- sw_if_index = *vec_elt_at_index (bif->active_slaves, 0);
+ sw_if_index = *vec_elt_at_index (bif->active_members, 0);
- bond_tx_inline (vm, bif, bufs, hashes, n_left, n_slaves, BOND_LB_BC);
+ bond_tx_inline (vm, bif, bufs, hashes, n_left, n_members, BOND_LB_BC);
bond_tx_trace (vm, node, bif, bufs, frame->n_vectors, 0);
bond_update_sw_if_index (ptd, bif, from, bufs, &sw_if_index, n_left,
/* single_sw_if_index */ 1);
goto done;
}
- /* if have at least one slave on local numa node, only slaves on local numa
+ /* if have at least one member on local numa node, only members on local numa
node will transmit pkts when bif->local_numa_only is enabled */
- if (bif->n_numa_slaves >= 1)
- n_slaves = bif->n_numa_slaves;
+ if (bif->n_numa_members >= 1)
+ n_members = bif->n_numa_members;
if (bif->lb == BOND_LB_L2)
- bond_tx_inline (vm, bif, bufs, hashes, n_left, n_slaves, BOND_LB_L2);
+ bond_tx_inline (vm, bif, bufs, hashes, n_left, n_members, BOND_LB_L2);
else if (bif->lb == BOND_LB_L34)
- bond_tx_inline (vm, bif, bufs, hashes, n_left, n_slaves, BOND_LB_L34);
+ bond_tx_inline (vm, bif, bufs, hashes, n_left, n_members, BOND_LB_L34);
else if (bif->lb == BOND_LB_L23)
- bond_tx_inline (vm, bif, bufs, hashes, n_left, n_slaves, BOND_LB_L23);
+ bond_tx_inline (vm, bif, bufs, hashes, n_left, n_members, BOND_LB_L23);
else if (bif->lb == BOND_LB_RR)
- bond_tx_inline (vm, bif, bufs, hashes, n_left, n_slaves, BOND_LB_RR);
+ bond_tx_inline (vm, bif, bufs, hashes, n_left, n_members, BOND_LB_RR);
else
ASSERT (0);
/* calculate port out of hash */
h = hashes;
- if (BOND_MODULO_SHORTCUT (n_slaves))
- bond_hash_to_port (h, frame->n_vectors, n_slaves, 1);
+ if (BOND_MODULO_SHORTCUT (n_members))
+ bond_hash_to_port (h, frame->n_vectors, n_members, 1);
else
- bond_hash_to_port (h, frame->n_vectors, n_slaves, 0);
+ bond_hash_to_port (h, frame->n_vectors, n_members, 0);
bond_tx_trace (vm, node, bif, bufs, frame->n_vectors, h);
@@ -769,12 +772,12 @@ VNET_DEVICE_CLASS_TX_FN (bond_dev_class) (vlib_main_t * vm,
/* single_sw_if_index */ 0);
done:
- for (p = 0; p < n_slaves; p++)
+ for (p = 0; p < n_members; p++)
{
vlib_frame_t *f;
u32 *to_next;
- sw_if_index = *vec_elt_at_index (bif->active_slaves, p);
+ sw_if_index = *vec_elt_at_index (bif->active_members, p);
if (PREDICT_TRUE (ptd->per_port_queue[p].n_buffers))
{
f = vnet_get_frame_to_sw_interface (vnm, sw_if_index);
@@ -852,23 +855,23 @@ VNET_DEVICE_CLASS (bond_dev_class) = {
/* *INDENT-ON* */
static clib_error_t *
-bond_slave_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add)
+bond_member_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add)
{
bond_main_t *bm = &bond_main;
- slave_if_t *sif;
- bond_detach_slave_args_t args = { 0 };
+ member_if_t *mif;
+ bond_detach_member_args_t args = { 0 };
if (is_add)
return 0;
- sif = bond_get_slave_by_sw_if_index (sw_if_index);
- if (!sif)
+ mif = bond_get_member_by_sw_if_index (sw_if_index);
+ if (!mif)
return 0;
- args.slave = sw_if_index;
- bond_detach_slave (bm->vlib_main, &args);
+ args.member = sw_if_index;
+ bond_detach_member (bm->vlib_main, &args);
return args.error;
}
-VNET_SW_INTERFACE_ADD_DEL_FUNCTION (bond_slave_interface_add_del);
+VNET_SW_INTERFACE_ADD_DEL_FUNCTION (bond_member_interface_add_del);
/*
* fd.io coding-style-patch-verification: ON
diff --git a/src/vnet/bonding/node.c b/src/vnet/bonding/node.c
index a606d20f19c..d49894fcb74 100644
--- a/src/vnet/bonding/node.c
+++ b/src/vnet/bonding/node.c
@@ -136,40 +136,40 @@ bond_sw_if_idx_rewrite (vlib_main_t * vm, vlib_node_runtime_t * node,
static inline void
bond_update_next (vlib_main_t * vm, vlib_node_runtime_t * node,
- u32 * last_slave_sw_if_index, u32 slave_sw_if_index,
+ u32 * last_member_sw_if_index, u32 member_sw_if_index,
u32 * bond_sw_if_index, vlib_buffer_t * b,
u32 * next_index, vlib_error_t * error)
{
- slave_if_t *sif;
+ member_if_t *mif;
bond_if_t *bif;
*next_index = BOND_INPUT_NEXT_DROP;
*error = 0;
- if (PREDICT_TRUE (*last_slave_sw_if_index == slave_sw_if_index))
+ if (PREDICT_TRUE (*last_member_sw_if_index == member_sw_if_index))
goto next;
- *last_slave_sw_if_index = slave_sw_if_index;
+ *last_member_sw_if_index = member_sw_if_index;
- sif = bond_get_slave_by_sw_if_index (slave_sw_if_index);
- ALWAYS_ASSERT (sif);
+ mif = bond_get_member_by_sw_if_index (member_sw_if_index);
+ ALWAYS_ASSERT (mif);
- bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
+ bif = bond_get_bond_if_by_dev_instance (mif->bif_dev_instance);
ALWAYS_ASSERT (bif);
- ASSERT (vec_len (bif->slaves));
+ ASSERT (vec_len (bif->members));
if (PREDICT_FALSE (bif->admin_up == 0))
{
- *bond_sw_if_index = slave_sw_if_index;
+ *bond_sw_if_index = member_sw_if_index;
*error = node->errors[BOND_INPUT_ERROR_IF_DOWN];
}
if (PREDICT_FALSE ((bif->mode == BOND_MODE_ACTIVE_BACKUP) &&
- vec_len (bif->active_slaves) &&
- (slave_sw_if_index != bif->active_slaves[0])))
+ vec_len (bif->active_members) &&
+ (member_sw_if_index != bif->active_members[0])))
{
- *bond_sw_if_index = slave_sw_if_index;
+ *bond_sw_if_index = member_sw_if_index;
*error = node->errors[BOND_INPUT_ERROR_PASSIVE_IF];
return;
}
@@ -202,7 +202,7 @@ VLIB_NODE_FN (bond_input_node) (vlib_main_t * vm,
vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b;
u32 sw_if_indices[VLIB_FRAME_SIZE], *sw_if_index;
u16 nexts[VLIB_FRAME_SIZE], *next;
- u32 last_slave_sw_if_index = ~0;
+ u32 last_member_sw_if_index = ~0;
u32 bond_sw_if_index = 0;
vlib_error_t error = 0;
u32 next_index = 0;
@@ -242,17 +242,17 @@ VLIB_NODE_FN (bond_input_node) (vlib_main_t * vm,
sw_if_index[2] = vnet_buffer (b[2])->sw_if_index[VLIB_RX];
sw_if_index[3] = vnet_buffer (b[3])->sw_if_index[VLIB_RX];
- x |= sw_if_index[0] ^ last_slave_sw_if_index;
- x |= sw_if_index[1] ^ last_slave_sw_if_index;
- x |= sw_if_index[2] ^ last_slave_sw_if_index;
- x |= sw_if_index[3] ^ last_slave_sw_if_index;
+ x |= sw_if_index[0] ^ last_member_sw_if_index;
+ x |= sw_if_index[1] ^ last_member_sw_if_index;
+ x |= sw_if_index[2] ^ last_member_sw_if_index;
+ x |= sw_if_index[3] ^ last_member_sw_if_index;
if (PREDICT_TRUE (x == 0))
{
/*
* Optimize to call update_next only if there is a feature arc
* after bond-input. Test feature count greater than 1 because
- * bond-input itself is a feature arc for this slave interface.
+ * bond-input itself is a feature arc for this member interface.
*/
ASSERT ((vnet_buffer (b[0])->feature_arc_index ==
vnet_buffer (b[1])->feature_arc_index) &&
@@ -262,7 +262,7 @@ VLIB_NODE_FN (bond_input_node) (vlib_main_t * vm,
vnet_buffer (b[3])->feature_arc_index));
if (PREDICT_FALSE (vnet_get_feature_count
(vnet_buffer (b[0])->feature_arc_index,
- last_slave_sw_if_index) > 1))
+ last_member_sw_if_index) > 1))
bond_update_next_x4 (b[0], b[1], b[2], b[3]);
next[0] = next[1] = next[2] = next[3] = next_index;
@@ -287,8 +287,9 @@ VLIB_NODE_FN (bond_input_node) (vlib_main_t * vm,
}
else
{
- bond_update_next (vm, node, &last_slave_sw_if_index, sw_if_index[0],
- &bond_sw_if_index, b[0], &next_index, &error);
+ bond_update_next (vm, node, &last_member_sw_if_index,
+ sw_if_index[0], &bond_sw_if_index, b[0],
+ &next_index, &error);
next[0] = next_index;
if (next_index == BOND_INPUT_NEXT_DROP)
b[0]->error = error;
@@ -296,8 +297,9 @@ VLIB_NODE_FN (bond_input_node) (vlib_main_t * vm,
bond_sw_if_idx_rewrite (vm, node, b[0], bond_sw_if_index,
&n_rx_packets, &n_rx_bytes);
- bond_update_next (vm, node, &last_slave_sw_if_index, sw_if_index[1],
- &bond_sw_if_index, b[1], &next_index, &error);
+ bond_update_next (vm, node, &last_member_sw_if_index,
+ sw_if_index[1], &bond_sw_if_index, b[1],
+ &next_index, &error);
next[1] = next_index;
if (next_index == BOND_INPUT_NEXT_DROP)
b[1]->error = error;
@@ -305,8 +307,9 @@ VLIB_NODE_FN (bond_input_node) (vlib_main_t * vm,
bond_sw_if_idx_rewrite (vm, node, b[1], bond_sw_if_index,
&n_rx_packets, &n_rx_bytes);
- bond_update_next (vm, node, &last_slave_sw_if_index, sw_if_index[2],
- &bond_sw_if_index, b[2], &next_index, &error);
+ bond_update_next (vm, node, &last_member_sw_if_index,
+ sw_if_index[2], &bond_sw_if_index, b[2],
+ &next_index, &error);
next[2] = next_index;
if (next_index == BOND_INPUT_NEXT_DROP)
b[2]->error = error;
@@ -314,8 +317,9 @@ VLIB_NODE_FN (bond_input_node) (vlib_main_t * vm,
bond_sw_if_idx_rewrite (vm, node, b[2], bond_sw_if_index,
&n_rx_packets, &n_rx_bytes);
- bond_update_next (vm, node, &last_slave_sw_if_index, sw_if_index[3],
- &bond_sw_if_index, b[3], &next_index, &error);
+ bond_update_next (vm, node, &last_member_sw_if_index,
+ sw_if_index[3], &bond_sw_if_index, b[3],
+ &next_index, &error);
next[3] = next_index;
if (next_index == BOND_INPUT_NEXT_DROP)
b[3]->error = error;
@@ -339,7 +343,7 @@ VLIB_NODE_FN (bond_input_node) (vlib_main_t * vm,
while (n_left)
{
sw_if_index[0] = vnet_buffer (b[0])->sw_if_index[VLIB_RX];
- bond_update_next (vm, node, &last_slave_sw_if_index, sw_if_index[0],
+ bond_update_next (vm, node, &last_member_sw_if_index, sw_if_index[0],
&bond_sw_if_index, b[0], &next_index, &error);
next[0] = next_index;
if (next_index == BOND_INPUT_NEXT_DROP)
@@ -430,22 +434,22 @@ static clib_error_t *
bond_sw_interface_up_down (vnet_main_t * vnm, u32 sw_if_index, u32 flags)
{
bond_main_t *bm = &bond_main;
- slave_if_t *sif;
+ member_if_t *mif;
vlib_main_t *vm = bm->vlib_main;
- sif = bond_get_slave_by_sw_if_index (sw_if_index);
- if (sif)
+ mif = bond_get_member_by_sw_if_index (sw_if_index);
+ if (mif)
{
- if (sif->lacp_enabled)
+ if (mif->lacp_enabled)
return 0;
/* port_enabled is both admin up and hw link up */
- sif->port_enabled = ((flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) &&
+ mif->port_enabled = ((flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) &&
vnet_sw_interface_is_link_up (vnm, sw_if_index));
- if (sif->port_enabled == 0)
- bond_disable_collecting_distributing (vm, sif);
+ if (mif->port_enabled == 0)
+ bond_disable_collecting_distributing (vm, mif);
else
- bond_enable_collecting_distributing (vm, sif);
+ bond_enable_collecting_distributing (vm, mif);
}
return 0;
@@ -457,25 +461,25 @@ static clib_error_t *
bond_hw_interface_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
bond_main_t *bm = &bond_main;
- slave_if_t *sif;
+ member_if_t *mif;
vnet_sw_interface_t *sw;
vlib_main_t *vm = bm->vlib_main;
sw = vnet_get_hw_sw_interface (vnm, hw_if_index);
- sif = bond_get_slave_by_sw_if_index (sw->sw_if_index);
- if (sif)
+ mif = bond_get_member_by_sw_if_index (sw->sw_if_index);
+ if (mif)
{
- if (sif->lacp_enabled)
+ if (mif->lacp_enabled)
return 0;
/* port_enabled is both admin up and hw link up */
- sif->port_enabled = ((flags & VNET_HW_INTERFACE_FLAG_LINK_UP) &&
+ mif->port_enabled = ((flags & VNET_HW_INTERFACE_FLAG_LINK_UP) &&
vnet_sw_interface_is_admin_up (vnm,
sw->sw_if_index));
- if (sif->port_enabled == 0)
- bond_disable_collecting_distributing (vm, sif);
+ if (mif->port_enabled == 0)
+ bond_disable_collecting_distributing (vm, mif);
else
- bond_enable_collecting_distributing (vm, sif);
+ bond_enable_collecting_distributing (vm, mif);
}
return 0;
diff --git a/src/vnet/bonding/node.h b/src/vnet/bonding/node.h
index ddd48feb1a3..843c236f123 100644
--- a/src/vnet/bonding/node.h
+++ b/src/vnet/bonding/node.h
@@ -92,8 +92,8 @@ typedef struct
typedef struct
{
- /* slave's sw_if_index */
- u32 slave;
+ /* member's sw_if_index */
+ u32 member;
/* bond's sw_if_index */
u32 group;
u8 is_passive;
@@ -101,15 +101,15 @@ typedef struct
/* return */
int rv;
clib_error_t *error;
-} bond_enslave_args_t;
+} bond_add_member_args_t;
typedef struct
{
- u32 slave;
+ u32 member;
/* return */
int rv;
clib_error_t *error;
-} bond_detach_slave_args_t;
+} bond_detach_member_args_t;
typedef struct
{
@@ -126,14 +126,14 @@ typedef struct
u32 sw_if_index;
u32 id;
u8 interface_name[64];
- u8 mode;
- u8 lb;
+ u32 mode;
+ u32 lb;
u8 numa_only;
- u32 active_slaves;
- u32 slaves;
+ u32 active_members;
+ u32 members;
} bond_interface_details_t;
-/** slave interface details struct */
+/** member interface details struct */
typedef struct
{
u32 sw_if_index;
@@ -142,8 +142,8 @@ typedef struct
u8 is_long_timeout;
u8 is_local_numa;
u32 weight;
- u32 active_slaves;
-} slave_interface_details_t;
+ u32 active_members;
+} member_interface_details_t;
typedef CLIB_PACKED (struct
{
@@ -171,7 +171,7 @@ typedef struct
u8 mode;
u8 lb;
- /* the last slave index for the rr lb */
+ /* the last member index for the rr lb */
u32 lb_rr_last_index;
/* Real device instance in interface vector */
@@ -183,24 +183,24 @@ typedef struct
u32 hw_if_index;
u32 sw_if_index;
- /* Configured slaves */
- u32 *slaves;
+ /* Configured members */
+ u32 *members;
- /* Slaves that are in DISTRIBUTING state */
- u32 *active_slaves;
+ /* Members that are in DISTRIBUTING state */
+ u32 *active_members;
lacp_port_info_t partner;
lacp_port_info_t actor;
u8 individual_aggregator;
- /* If the flag numa_only is set, it means that only slaves
+ /* If the flag numa_only is set, it means that only members
on local numa node works for lacp mode if have at least one,
otherwise it works as usual. */
u8 numa_only;
u8 gso;
- /* How many slaves on local numa node are there in lacp mode? */
- word n_numa_slaves;
+ /* How many members on local numa node are there in lacp mode? */
+ word n_numa_members;
u32 group;
uword *port_number_bitmap;
@@ -345,12 +345,12 @@ typedef struct
/* pdu sent */
u64 marker_pdu_sent;
- /* slave is numa node */
+ /* member is numa node */
u8 is_local_numa;
-} slave_if_t;
+} member_if_t;
typedef void (*lacp_enable_disable_func) (vlib_main_t * vm, bond_if_t * bif,
- slave_if_t * sif, u8 enable);
+ member_if_t * mif, u8 enable);
typedef struct
{
@@ -366,8 +366,8 @@ typedef struct
/* record used interface IDs */
uword *id_used;
- /* pool of slave interfaces */
- slave_if_t *neighbors;
+ /* pool of member interfaces */
+ member_if_t *neighbors;
/* rapidly find a bond by vlib software interface index */
uword *bond_by_sw_if_index;
@@ -381,7 +381,7 @@ typedef struct
lacp_enable_disable_func lacp_enable_disable;
- uword *slave_by_sw_if_index;
+ uword *member_by_sw_if_index;
bond_per_thread_data_t *per_thread_data;
@@ -398,7 +398,7 @@ typedef struct
typedef u32 (*load_balance_func) (vlib_main_t * vm,
vlib_node_runtime_t * node, bond_if_t * bif,
- vlib_buffer_t * b0, uword slave_count);
+ vlib_buffer_t * b0, uword member_count);
typedef struct
{
@@ -411,19 +411,20 @@ extern vnet_device_class_t bond_dev_class;
extern bond_main_t bond_main;
void bond_disable_collecting_distributing (vlib_main_t * vm,
- slave_if_t * sif);
-void bond_enable_collecting_distributing (vlib_main_t * vm, slave_if_t * sif);
+ member_if_t * mif);
+void bond_enable_collecting_distributing (vlib_main_t * vm,
+ member_if_t * mif);
u8 *format_bond_interface_name (u8 * s, va_list * args);
void bond_set_intf_weight (vlib_main_t * vm,
bond_set_intf_weight_args_t * args);
void bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args);
int bond_delete_if (vlib_main_t * vm, u32 sw_if_index);
-void bond_enslave (vlib_main_t * vm, bond_enslave_args_t * args);
-void bond_detach_slave (vlib_main_t * vm, bond_detach_slave_args_t * args);
+void bond_add_member (vlib_main_t * vm, bond_add_member_args_t * args);
+void bond_detach_member (vlib_main_t * vm, bond_detach_member_args_t * args);
int bond_dump_ifs (bond_interface_details_t ** out_bondids);
-int bond_dump_slave_ifs (slave_interface_details_t ** out_slaveids,
- u32 bond_sw_if_index);
+int bond_dump_member_ifs (member_interface_details_t ** out_memberids,
+ u32 bond_sw_if_index);
static inline uword
unformat_bond_mode (unformat_input_t * input, va_list * args)
@@ -499,7 +500,7 @@ bond_register_callback (lacp_enable_disable_func func)
}
static inline bond_if_t *
-bond_get_master_by_sw_if_index (u32 sw_if_index)
+bond_get_bond_if_by_sw_if_index (u32 sw_if_index)
{
bond_main_t *bm = &bond_main;
uword *p;
@@ -513,28 +514,28 @@ bond_get_master_by_sw_if_index (u32 sw_if_index)
}
static inline bond_if_t *
-bond_get_master_by_dev_instance (u32 dev_instance)
+bond_get_bond_if_by_dev_instance (u32 dev_instance)
{
bond_main_t *bm = &bond_main;
return pool_elt_at_index (bm->interfaces, dev_instance);
}
-static inline slave_if_t *
-bond_get_slave_by_sw_if_index (u32 sw_if_index)
+static inline member_if_t *
+bond_get_member_by_sw_if_index (u32 sw_if_index)
{
bond_main_t *bm = &bond_main;
- slave_if_t *sif = 0;
+ member_if_t *mif = 0;
uword p;
- if (sw_if_index < vec_len (bm->slave_by_sw_if_index))
+ if (sw_if_index < vec_len (bm->member_by_sw_if_index))
{
- p = bm->slave_by_sw_if_index[sw_if_index];
+ p = bm->member_by_sw_if_index[sw_if_index];
if (p)
- sif = pool_elt_at_index (bm->neighbors, p >> 1);
+ mif = pool_elt_at_index (bm->neighbors, p >> 1);
}
- return sif;
+ return mif;
}
#endif /* __included_vnet_bonding_node_h__ */