diff --git a/src/vnet/bonding/bond.api b/src/vnet/bonding/bond.api
index 865dcbe..682298e 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 @@
 /** \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 @@
 */
 define bond_enslave
 {
+  option deprecated="20.06";
   u32 client_index;
   u32 context;
   vl_api_interface_index_t sw_if_index;
@@ -117,13 +118,54 @@
   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 @@
 /** \brief Dump bond interfaces request */
 define sw_interface_bond_dump
 {
+  option deprecated="20.06";
   u32 client_index;
   u32 context;
 };
@@ -139,12 +182,12 @@
 /** \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 @@
   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_slave_dump
 {
+  option deprecated="20.06";
   u32 client_index;
   u32 context;
   vl_api_interface_index_t sw_if_index;
@@ -190,11 +265,42 @@
   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 525f058..2395a47 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 @@
 }
 
 static void
-vl_api_bond_enslave_t_handler (vl_api_bond_enslave_t * mp)
+vl_api_bond_add_member_t_handler (vl_api_bond_add_member_t * mp)
 {
   vlib_main_t *vm = vlib_get_main ();
-  vl_api_bond_enslave_reply_t *rmp;
-  bond_enslave_args_t _a, *ap = &_a;
+  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->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_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_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_ENSLAVE_REPLY);
 }
@@ -142,18 +166,34 @@
 {
   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 @@
   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 @@
 }
 
 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 @@
   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_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_sw_member_interface_details (am, reg, member_if, mp->context);
   }
 
-  vec_free (slaveifs);
+  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_member_ifs (&memberifs, ntohl (mp->sw_if_index));
+  if (rv)
+    return;
+
+  vec_foreach (member_if, memberifs)
+  {
+    bond_send_member_interface_details (am, reg, member_if, mp->context);
+  }
+
+  vec_free (memberifs);
 }
 
 #define vl_msg_name_crc_list
diff --git a/src/vnet/bonding/cli.c b/src/vnet/bonding/cli.c
index 92a9ff0..062e309 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 @@
   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 @@
  * 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 @@
 }
 
 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 @@
     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 @@
 }
 
 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 @@
   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 @@
 }
 
 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_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 @@
 /* *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 @@
 
       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 @@
 	}
     }
 
-  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;
+  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;
 
-  sif->is_long_timeout = args->is_long_timeout;
+  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_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 @@
 }
 
 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 @@
   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 @@
     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 @@
   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 @@
 
   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 @@
 /* *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 @@
 
   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 @@
 		     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 @@
     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 @@
 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 @@
       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 @@
 
   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 b3069fe..38759ee 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_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_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 @@
   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 @@
 	/* 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 @@
 
 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_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 @@
 }
 
 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 @@
 
 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 @@
 	}
       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 @@
       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 @@
 }
 
 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 @@
   else
     {
       mask8 = u32x8_splat (0xffff);
-      sc8u = u32x8_splat (n_slaves);
+      sc8u = u32x8_splat (n_members);
       sc8f = f32x8_from_u32x8 (sc8u);
     }
 
@@ -543,10 +545,10 @@
 	}
       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 @@
       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 @@
 	{
 	  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 @@
 	}
       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 @@
       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 @@
   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 @@
       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 @@
   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 @@
 
   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 @@
 			   /* 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 @@
 /* *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 a606d20..d49894f 100644
--- a/src/vnet/bonding/node.c
+++ b/src/vnet/bonding/node.c
@@ -136,40 +136,40 @@
 
 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_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 @@
       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 @@
 		   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 @@
 	}
       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 @@
 	    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 @@
 	    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 @@
 	    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 @@
   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 @@
 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 @@
 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 ddd48fe..843c236 100644
--- a/src/vnet/bonding/node.h
+++ b/src/vnet/bonding/node.h
@@ -92,8 +92,8 @@
 
 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 @@
   /* 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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   /* 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 @@
   /* 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 @@
 
   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 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 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 @@
 }
 
 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 @@
 }
 
 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__ */
