aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/lacp/cli.c239
-rw-r--r--src/plugins/lacp/input.c112
-rw-r--r--src/plugins/lacp/lacp.api4
-rw-r--r--src/plugins/lacp/lacp.c234
-rw-r--r--src/plugins/lacp/machine.h4
-rw-r--r--src/plugins/lacp/mux_machine.c122
-rw-r--r--src/plugins/lacp/mux_machine.h6
-rw-r--r--src/plugins/lacp/node.h16
-rw-r--r--src/plugins/lacp/ptx_machine.c90
-rw-r--r--src/plugins/lacp/ptx_machine.h30
-rw-r--r--src/plugins/lacp/rx_machine.c238
-rw-r--r--src/plugins/lacp/rx_machine.h6
-rw-r--r--src/plugins/lacp/selection.c52
-rw-r--r--src/plugins/lacp/test/test_lacp.py82
-rw-r--r--src/plugins/lacp/tx_machine.c24
-rw-r--r--src/plugins/lacp/tx_machine.h2
-rw-r--r--src/vat/api_format.c96
-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
-rw-r--r--src/vpp/api/custom_dump.c34
-rw-r--r--test/test_bond.py63
-rw-r--r--test/vpp_bond_interface.py18
26 files changed, 1430 insertions, 1143 deletions
diff --git a/src/plugins/lacp/cli.c b/src/plugins/lacp/cli.c
index fee1be19463..7abc6f0c4ca 100644
--- a/src/plugins/lacp/cli.c
+++ b/src/plugins/lacp/cli.c
@@ -22,44 +22,44 @@ lacp_dump_ifs (lacp_interface_details_t ** out_lacpifs)
{
vnet_main_t *vnm = vnet_get_main ();
bond_main_t *bm = &bond_main;
- slave_if_t *sif;
+ member_if_t *mif;
bond_if_t *bif;
vnet_hw_interface_t *hi;
lacp_interface_details_t *r_lacpifs = NULL;
lacp_interface_details_t *lacpif = NULL;
/* *INDENT-OFF* */
- pool_foreach (sif, bm->neighbors,
- if (sif->lacp_enabled == 0)
+ pool_foreach (mif, bm->neighbors,
+ if (mif->lacp_enabled == 0)
continue;
vec_add2(r_lacpifs, lacpif, 1);
clib_memset (lacpif, 0, sizeof (*lacpif));
- lacpif->sw_if_index = sif->sw_if_index;
- hi = vnet_get_hw_interface (vnm, sif->hw_if_index);
+ lacpif->sw_if_index = mif->sw_if_index;
+ hi = vnet_get_hw_interface (vnm, mif->hw_if_index);
clib_memcpy(lacpif->interface_name, hi->name,
MIN (ARRAY_LEN (lacpif->interface_name) - 1,
vec_len (hi->name)));
- bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
+ bif = bond_get_bond_if_by_dev_instance (mif->bif_dev_instance);
hi = vnet_get_hw_interface (vnm, bif->hw_if_index);
clib_memcpy(lacpif->bond_interface_name, hi->name,
MIN (ARRAY_LEN (lacpif->bond_interface_name) - 1,
vec_len (hi->name)));
- clib_memcpy (lacpif->actor_system, sif->actor.system, 6);
- lacpif->actor_system_priority = sif->actor.system_priority;
- lacpif->actor_key = sif->actor.key;
- lacpif->actor_port_priority = sif->actor.port_priority;
- lacpif->actor_port_number = sif->actor.port_number;
- lacpif->actor_state = sif->actor.state;
- clib_memcpy (lacpif->partner_system, sif->partner.system, 6);
- lacpif->partner_system_priority = sif->partner.system_priority;
- lacpif->partner_key = sif->partner.key;
- lacpif->partner_port_priority = sif->partner.port_priority;
- lacpif->partner_port_number = sif->partner.port_number;
- lacpif->partner_state = sif->partner.state;
- lacpif->rx_state = sif->rx_state;
- lacpif->tx_state = sif->tx_state;
- lacpif->ptx_state = sif->ptx_state;
- lacpif->mux_state = sif->mux_state;
+ clib_memcpy (lacpif->actor_system, mif->actor.system, 6);
+ lacpif->actor_system_priority = mif->actor.system_priority;
+ lacpif->actor_key = mif->actor.key;
+ lacpif->actor_port_priority = mif->actor.port_priority;
+ lacpif->actor_port_number = mif->actor.port_number;
+ lacpif->actor_state = mif->actor.state;
+ clib_memcpy (lacpif->partner_system, mif->partner.system, 6);
+ lacpif->partner_system_priority = mif->partner.system_priority;
+ lacpif->partner_key = mif->partner.key;
+ lacpif->partner_port_priority = mif->partner.port_priority;
+ lacpif->partner_port_number = mif->partner.port_number;
+ lacpif->partner_state = mif->partner.state;
+ lacpif->rx_state = mif->rx_state;
+ lacpif->tx_state = mif->tx_state;
+ lacpif->ptx_state = mif->ptx_state;
+ lacpif->mux_state = mif->mux_state;
);
/* *INDENT-ON* */
@@ -72,7 +72,7 @@ static void
show_lacp (vlib_main_t * vm, u32 * sw_if_indices)
{
int i;
- slave_if_t *sif;
+ member_if_t *mif;
bond_if_t *bif;
if (!sw_if_indices)
@@ -87,56 +87,56 @@ show_lacp (vlib_main_t * vm, u32 * sw_if_indices)
for (i = 0; i < vec_len (sw_if_indices); i++)
{
- sif = bond_get_slave_by_sw_if_index (sw_if_indices[i]);
- if (!sif || (sif->lacp_enabled == 0))
+ mif = bond_get_member_by_sw_if_index (sw_if_indices[i]);
+ if (!mif || (mif->lacp_enabled == 0))
continue;
- bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
+ bif = bond_get_bond_if_by_dev_instance (mif->bif_dev_instance);
vlib_cli_output (vm,
"%-25U %-12d %-16U %3x %3x %3x %3x %3x %3x %3x %3x "
"%4x %3x %3x %3x %3x %3x %3x %3x",
format_vnet_sw_if_index_name, vnet_get_main (),
- sif->sw_if_index, sif->sw_if_index,
+ mif->sw_if_index, mif->sw_if_index,
format_vnet_sw_if_index_name, vnet_get_main (),
- bif->sw_if_index, lacp_bit_test (sif->actor.state, 7),
- lacp_bit_test (sif->actor.state, 6),
- lacp_bit_test (sif->actor.state, 5),
- lacp_bit_test (sif->actor.state, 4),
- lacp_bit_test (sif->actor.state, 3),
- lacp_bit_test (sif->actor.state, 2),
- lacp_bit_test (sif->actor.state, 1),
- lacp_bit_test (sif->actor.state, 0),
- lacp_bit_test (sif->partner.state, 7),
- lacp_bit_test (sif->partner.state, 6),
- lacp_bit_test (sif->partner.state, 5),
- lacp_bit_test (sif->partner.state, 4),
- lacp_bit_test (sif->partner.state, 3),
- lacp_bit_test (sif->partner.state, 2),
- lacp_bit_test (sif->partner.state, 1),
- lacp_bit_test (sif->partner.state, 0));
+ bif->sw_if_index, lacp_bit_test (mif->actor.state, 7),
+ lacp_bit_test (mif->actor.state, 6),
+ lacp_bit_test (mif->actor.state, 5),
+ lacp_bit_test (mif->actor.state, 4),
+ lacp_bit_test (mif->actor.state, 3),
+ lacp_bit_test (mif->actor.state, 2),
+ lacp_bit_test (mif->actor.state, 1),
+ lacp_bit_test (mif->actor.state, 0),
+ lacp_bit_test (mif->partner.state, 7),
+ lacp_bit_test (mif->partner.state, 6),
+ lacp_bit_test (mif->partner.state, 5),
+ lacp_bit_test (mif->partner.state, 4),
+ lacp_bit_test (mif->partner.state, 3),
+ lacp_bit_test (mif->partner.state, 2),
+ lacp_bit_test (mif->partner.state, 1),
+ lacp_bit_test (mif->partner.state, 0));
vlib_cli_output (vm,
" LAG ID: "
"[(%04x,%02x-%02x-%02x-%02x-%02x-%02x,%04x,%04x,%04x), "
"(%04x,%02x-%02x-%02x-%02x-%02x-%02x,%04x,%04x,%04x)]",
- ntohs (sif->actor.system_priority),
- sif->actor.system[0], sif->actor.system[1],
- sif->actor.system[2], sif->actor.system[3],
- sif->actor.system[4], sif->actor.system[5],
- ntohs (sif->actor.key),
- ntohs (sif->actor.port_priority),
- ntohs (sif->actor.port_number),
- ntohs (sif->partner.system_priority),
- sif->partner.system[0], sif->partner.system[1],
- sif->partner.system[2], sif->partner.system[3],
- sif->partner.system[4], sif->partner.system[5],
- ntohs (sif->partner.key),
- ntohs (sif->partner.port_priority),
- ntohs (sif->partner.port_number));
+ ntohs (mif->actor.system_priority),
+ mif->actor.system[0], mif->actor.system[1],
+ mif->actor.system[2], mif->actor.system[3],
+ mif->actor.system[4], mif->actor.system[5],
+ ntohs (mif->actor.key),
+ ntohs (mif->actor.port_priority),
+ ntohs (mif->actor.port_number),
+ ntohs (mif->partner.system_priority),
+ mif->partner.system[0], mif->partner.system[1],
+ mif->partner.system[2], mif->partner.system[3],
+ mif->partner.system[4], mif->partner.system[5],
+ ntohs (mif->partner.key),
+ ntohs (mif->partner.port_priority),
+ ntohs (mif->partner.port_number));
vlib_cli_output (vm,
" RX-state: %U, TX-state: %U, "
"MUX-state: %U, PTX-state: %U",
- format_rx_sm_state, sif->rx_state, format_tx_sm_state,
- sif->tx_state, format_mux_sm_state, sif->mux_state,
- format_ptx_sm_state, sif->ptx_state);
+ format_rx_sm_state, mif->rx_state, format_tx_sm_state,
+ mif->tx_state, format_mux_sm_state, mif->mux_state,
+ format_ptx_sm_state, mif->ptx_state);
}
}
@@ -144,7 +144,7 @@ static void
show_lacp_details (vlib_main_t * vm, u32 * sw_if_indices)
{
lacp_main_t *lm = &lacp_main;
- slave_if_t *sif;
+ member_if_t *mif;
lacp_state_struct *state_entry;
int i;
f64 now;
@@ -156,56 +156,56 @@ show_lacp_details (vlib_main_t * vm, u32 * sw_if_indices)
now = vlib_time_now (vm);
for (i = 0; i < vec_len (sw_if_indices); i++)
{
- sif = bond_get_slave_by_sw_if_index (sw_if_indices[i]);
- if (!sif || (sif->lacp_enabled == 0))
+ mif = bond_get_member_by_sw_if_index (sw_if_indices[i]);
+ if (!mif || (mif->lacp_enabled == 0))
continue;
vlib_cli_output (vm, " %U", format_vnet_sw_if_index_name,
- vnet_get_main (), sif->sw_if_index);
+ vnet_get_main (), mif->sw_if_index);
vlib_cli_output (vm, " Good LACP PDUs received: %llu",
- sif->pdu_received);
+ mif->pdu_received);
vlib_cli_output (vm, " Bad LACP PDUs received: %llu",
- sif->bad_pdu_received);
- vlib_cli_output (vm, " LACP PDUs sent: %llu", sif->pdu_sent);
- if (lacp_timer_is_running (sif->last_lacpdu_recd_time))
+ mif->bad_pdu_received);
+ vlib_cli_output (vm, " LACP PDUs sent: %llu", mif->pdu_sent);
+ if (lacp_timer_is_running (mif->last_lacpdu_recd_time))
vlib_cli_output (vm,
" last LACP PDU received: %10.2f seconds ago",
- now - sif->last_lacpdu_recd_time);
- if (lacp_timer_is_running (sif->last_lacpdu_sent_time))
+ now - mif->last_lacpdu_recd_time);
+ if (lacp_timer_is_running (mif->last_lacpdu_sent_time))
vlib_cli_output (vm, " last LACP PDU sent: %10.2f seconds ago",
- now - sif->last_lacpdu_sent_time);
+ now - mif->last_lacpdu_sent_time);
vlib_cli_output (vm, " Good Marker PDUs received: %llu",
- sif->marker_pdu_received);
+ mif->marker_pdu_received);
vlib_cli_output (vm, " Bad Marker PDUs received: %llu",
- sif->marker_bad_pdu_received);
- if (lacp_timer_is_running (sif->last_marker_pdu_recd_time))
+ mif->marker_bad_pdu_received);
+ if (lacp_timer_is_running (mif->last_marker_pdu_recd_time))
vlib_cli_output (vm,
" last Marker PDU received: %10.2f seconds ago",
- now - sif->last_marker_pdu_recd_time);
- if (lacp_timer_is_running (sif->last_marker_pdu_sent_time))
+ now - mif->last_marker_pdu_recd_time);
+ if (lacp_timer_is_running (mif->last_marker_pdu_sent_time))
vlib_cli_output (vm, " last Marker PDU sent: %10.2f seconds ago",
- now - sif->last_marker_pdu_sent_time);
- vlib_cli_output (vm, " debug: %d", sif->debug);
- vlib_cli_output (vm, " loopback port: %d", sif->loopback_port);
- vlib_cli_output (vm, " port_enabled: %d", sif->port_enabled);
- vlib_cli_output (vm, " port moved: %d", sif->port_moved);
- vlib_cli_output (vm, " ready_n: %d", sif->ready_n);
- vlib_cli_output (vm, " ready: %d", sif->ready);
+ now - mif->last_marker_pdu_sent_time);
+ vlib_cli_output (vm, " debug: %d", mif->debug);
+ vlib_cli_output (vm, " loopback port: %d", mif->loopback_port);
+ vlib_cli_output (vm, " port_enabled: %d", mif->port_enabled);
+ vlib_cli_output (vm, " port moved: %d", mif->port_moved);
+ vlib_cli_output (vm, " ready_n: %d", mif->ready_n);
+ vlib_cli_output (vm, " ready: %d", mif->ready);
vlib_cli_output (vm, " Actor");
vlib_cli_output (vm, " system: %U",
- format_ethernet_address, sif->actor.system);
+ format_ethernet_address, mif->actor.system);
vlib_cli_output (vm, " system priority: %u",
- ntohs (sif->actor.system_priority));
- vlib_cli_output (vm, " key: %u", ntohs (sif->actor.key));
+ ntohs (mif->actor.system_priority));
+ vlib_cli_output (vm, " key: %u", ntohs (mif->actor.key));
vlib_cli_output (vm, " port priority: %u",
- ntohs (sif->actor.port_priority));
+ ntohs (mif->actor.port_priority));
vlib_cli_output (vm, " port number: %u",
- ntohs (sif->actor.port_number));
- vlib_cli_output (vm, " state: 0x%x", sif->actor.state);
+ ntohs (mif->actor.port_number));
+ vlib_cli_output (vm, " state: 0x%x", mif->actor.state);
state_entry = (lacp_state_struct *) & lacp_state_array;
while (state_entry->str)
{
- if (sif->actor.state & (1 << state_entry->bit))
+ if (mif->actor.state & (1 << state_entry->bit))
vlib_cli_output (vm, " %s (%d)", state_entry->str,
state_entry->bit);
state_entry++;
@@ -213,48 +213,48 @@ show_lacp_details (vlib_main_t * vm, u32 * sw_if_indices)
vlib_cli_output (vm, " Partner");
vlib_cli_output (vm, " system: %U",
- format_ethernet_address, sif->partner.system);
+ format_ethernet_address, mif->partner.system);
vlib_cli_output (vm, " system priority: %u",
- ntohs (sif->partner.system_priority));
- vlib_cli_output (vm, " key: %u", ntohs (sif->partner.key));
+ ntohs (mif->partner.system_priority));
+ vlib_cli_output (vm, " key: %u", ntohs (mif->partner.key));
vlib_cli_output (vm, " port priority: %u",
- ntohs (sif->partner.port_priority));
+ ntohs (mif->partner.port_priority));
vlib_cli_output (vm, " port number: %u",
- ntohs (sif->partner.port_number));
- vlib_cli_output (vm, " state: 0x%x", sif->partner.state);
+ ntohs (mif->partner.port_number));
+ vlib_cli_output (vm, " state: 0x%x", mif->partner.state);
state_entry = (lacp_state_struct *) & lacp_state_array;
while (state_entry->str)
{
- if (sif->partner.state & (1 << state_entry->bit))
+ if (mif->partner.state & (1 << state_entry->bit))
vlib_cli_output (vm, " %s (%d)", state_entry->str,
state_entry->bit);
state_entry++;
}
- if (!lacp_timer_is_running (sif->wait_while_timer))
+ if (!lacp_timer_is_running (mif->wait_while_timer))
vlib_cli_output (vm, " wait while timer: not running");
else
vlib_cli_output (vm, " wait while timer: %10.2f seconds",
- sif->wait_while_timer - now);
- if (!lacp_timer_is_running (sif->current_while_timer))
+ mif->wait_while_timer - now);
+ if (!lacp_timer_is_running (mif->current_while_timer))
vlib_cli_output (vm, " current while timer: not running");
else
vlib_cli_output (vm, " current while timer: %10.2f seconds",
- sif->current_while_timer - now);
- if (!lacp_timer_is_running (sif->periodic_timer))
+ mif->current_while_timer - now);
+ if (!lacp_timer_is_running (mif->periodic_timer))
vlib_cli_output (vm, " periodic timer: not running");
else
vlib_cli_output (vm, " periodic timer: %10.2f seconds",
- sif->periodic_timer - now);
+ mif->periodic_timer - now);
vlib_cli_output (vm, " RX-state: %U", format_rx_sm_state,
- sif->rx_state);
+ mif->rx_state);
vlib_cli_output (vm, " TX-state: %U", format_tx_sm_state,
- sif->tx_state);
+ mif->tx_state);
vlib_cli_output (vm, " MUX-state: %U", format_mux_sm_state,
- sif->mux_state);
+ mif->mux_state);
vlib_cli_output (vm, " PTX-state: %U", format_ptx_sm_state,
- sif->ptx_state);
+ mif->ptx_state);
vlib_cli_output (vm, "\n");
}
}
@@ -265,7 +265,7 @@ show_lacp_fn (vlib_main_t * vm, unformat_input_t * input,
{
bond_main_t *bm = &bond_main;
vnet_main_t *vnm = &vnet_main;
- slave_if_t *sif;
+ member_if_t *mif;
clib_error_t *error = 0;
u8 details = 0;
u32 sw_if_index, *sw_if_indices = 0;
@@ -275,13 +275,13 @@ show_lacp_fn (vlib_main_t * vm, unformat_input_t * input,
if (unformat
(input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
{
- 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)
{
- error = clib_error_return (0, "interface is not enslaved");
+ error = clib_error_return (0, "interface is not a member");
goto done;
}
- vec_add1 (sw_if_indices, sif->sw_if_index);
+ vec_add1 (sw_if_indices, mif->sw_if_index);
}
else if (unformat (input, "details"))
details = 1;
@@ -295,8 +295,8 @@ show_lacp_fn (vlib_main_t * vm, unformat_input_t * input,
if (vec_len (sw_if_indices) == 0)
{
- pool_foreach (sif, bm->neighbors,
- vec_add1 (sw_if_indices, sif->sw_if_index);
+ pool_foreach (mif, bm->neighbors,
+ vec_add1 (sw_if_indices, mif->sw_if_index);
);
}
@@ -329,7 +329,7 @@ debug_lacp_command_fn (vlib_main_t * vm, unformat_input_t * input,
u8 onoff = 0;
u8 input_found = 0;
u32 sw_if_index = ~0;
- slave_if_t *sif;
+ member_if_t *mif;
vnet_main_t *vnm = vnet_get_main ();
/* Get a line of input. */
@@ -370,10 +370,11 @@ debug_lacp_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (sw_if_index != ~0)
{
- sif = bond_get_slave_by_sw_if_index (sw_if_index);
- if (!sif)
- return (clib_error_return (0, "Please enslave the interface first"));
- sif->debug = onoff;
+ mif = bond_get_member_by_sw_if_index (sw_if_index);
+ if (!mif)
+ return (clib_error_return
+ (0, "Please add the member interface first"));
+ mif->debug = onoff;
}
else
lm->debug = onoff;
diff --git a/src/plugins/lacp/input.c b/src/plugins/lacp/input.c
index fd1296afe3e..4a69e0fb02a 100644
--- a/src/plugins/lacp/input.c
+++ b/src/plugins/lacp/input.c
@@ -19,9 +19,9 @@
#include <vpp/stats/stat_segment.h>
static int
-lacp_packet_scan (vlib_main_t * vm, slave_if_t * sif)
+lacp_packet_scan (vlib_main_t * vm, member_if_t * mif)
{
- lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->last_rx_pkt;
+ lacp_pdu_t *lacpdu = (lacp_pdu_t *) mif->last_rx_pkt;
if (lacpdu->subtype != LACP_SUBTYPE)
return LACP_ERROR_UNSUPPORTED;
@@ -36,33 +36,33 @@ lacp_packet_scan (vlib_main_t * vm, slave_if_t * sif)
(lacpdu->terminator.tlv_length != 0))
return (LACP_ERROR_BAD_TLV);
- lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
- LACP_RX_EVENT_PDU_RECEIVED, &sif->rx_state);
+ lacp_machine_dispatch (&lacp_rx_machine, vm, mif,
+ LACP_RX_EVENT_PDU_RECEIVED, &mif->rx_state);
return LACP_ERROR_NONE;
}
static void
-marker_fill_pdu (marker_pdu_t * marker, slave_if_t * sif)
+marker_fill_pdu (marker_pdu_t * marker, member_if_t * mif)
{
- marker_pdu_t *pkt = (marker_pdu_t *) sif->last_marker_pkt;
+ marker_pdu_t *pkt = (marker_pdu_t *) mif->last_marker_pkt;
marker->marker_info = pkt->marker_info;
marker->marker_info.tlv_type = MARKER_RESPONSE_INFORMATION;
}
void
-marker_fill_request_pdu (marker_pdu_t * marker, slave_if_t * sif)
+marker_fill_request_pdu (marker_pdu_t * marker, member_if_t * mif)
{
marker->marker_info.tlv_type = MARKER_INFORMATION;
- marker->marker_info.requester_port = sif->actor.port_number;
- clib_memcpy (marker->marker_info.requester_system, sif->actor.system, 6);
- marker->marker_info.requester_transaction_id = sif->marker_tx_id;
- sif->marker_tx_id++;
+ marker->marker_info.requester_port = mif->actor.port_number;
+ clib_memcpy (marker->marker_info.requester_system, mif->actor.system, 6);
+ marker->marker_info.requester_transaction_id = mif->marker_tx_id;
+ mif->marker_tx_id++;
}
static void
-send_ethernet_marker_response_pdu (vlib_main_t * vm, slave_if_t * sif)
+send_ethernet_marker_response_pdu (vlib_main_t * vm, member_if_t * mif)
{
lacp_main_t *lm = &lacp_main;
u32 *to_next;
@@ -78,18 +78,18 @@ send_ethernet_marker_response_pdu (vlib_main_t * vm, slave_if_t * sif)
* into the buffer by the packet template mechanism
*/
h0 = vlib_packet_template_get_packet
- (vm, &lm->marker_packet_templates[sif->packet_template_index], &bi0);
+ (vm, &lm->marker_packet_templates[mif->packet_template_index], &bi0);
if (!h0)
return;
/* Add the interface's ethernet source address */
- hw = vnet_get_sup_hw_interface (vnm, sif->sw_if_index);
+ hw = vnet_get_sup_hw_interface (vnm, mif->sw_if_index);
clib_memcpy (h0->ethernet.src_address, hw->hw_address,
vec_len (hw->hw_address));
- marker_fill_pdu (&h0->marker, sif);
+ marker_fill_pdu (&h0->marker, mif);
/* Set the outbound packet length */
b0 = vlib_get_buffer (vm, bi0);
@@ -108,14 +108,14 @@ send_ethernet_marker_response_pdu (vlib_main_t * vm, slave_if_t * sif)
f->n_vectors = 1;
vlib_put_frame_to_node (vm, hw->output_node_index, f);
- sif->last_marker_pdu_sent_time = vlib_time_now (vm);
- sif->marker_pdu_sent++;
+ mif->last_marker_pdu_sent_time = vlib_time_now (vm);
+ mif->marker_pdu_sent++;
}
static int
-handle_marker_protocol (vlib_main_t * vm, slave_if_t * sif)
+handle_marker_protocol (vlib_main_t * vm, member_if_t * mif)
{
- marker_pdu_t *marker = (marker_pdu_t *) sif->last_marker_pkt;
+ marker_pdu_t *marker = (marker_pdu_t *) mif->last_marker_pkt;
/*
* According to the spec, no checking on the version number and tlv types.
@@ -125,7 +125,7 @@ handle_marker_protocol (vlib_main_t * vm, slave_if_t * sif)
(marker->terminator.tlv_length != 0))
return (LACP_ERROR_BAD_TLV);
- send_ethernet_marker_response_pdu (vm, sif);
+ send_ethernet_marker_response_pdu (vm, mif);
return LACP_ERROR_NONE;
}
@@ -137,16 +137,16 @@ lacp_error_t
lacp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0)
{
bond_main_t *bm = &bond_main;
- slave_if_t *sif;
+ member_if_t *mif;
uword nbytes;
lacp_error_t e;
marker_pdu_t *marker;
uword last_packet_signature;
bond_if_t *bif;
- sif =
- bond_get_slave_by_sw_if_index (vnet_buffer (b0)->sw_if_index[VLIB_RX]);
- if ((sif == 0) || (sif->mode != BOND_MODE_LACP))
+ mif =
+ bond_get_member_by_sw_if_index (vnet_buffer (b0)->sw_if_index[VLIB_RX]);
+ if ((mif == 0) || (mif->mode != BOND_MODE_LACP))
{
return LACP_ERROR_DISABLED;
}
@@ -155,20 +155,20 @@ lacp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0)
marker = (marker_pdu_t *) (b0->data + b0->current_data);
if (marker->subtype == MARKER_SUBTYPE)
{
- sif->last_marker_pdu_recd_time = vlib_time_now (vm);
- if (sif->last_marker_pkt)
- _vec_len (sif->last_marker_pkt) = 0;
- vec_validate (sif->last_marker_pkt,
+ mif->last_marker_pdu_recd_time = vlib_time_now (vm);
+ if (mif->last_marker_pkt)
+ _vec_len (mif->last_marker_pkt) = 0;
+ vec_validate (mif->last_marker_pkt,
vlib_buffer_length_in_chain (vm, b0) - 1);
- nbytes = vlib_buffer_contents (vm, bi0, sif->last_marker_pkt);
- ASSERT (nbytes <= vec_len (sif->last_marker_pkt));
+ nbytes = vlib_buffer_contents (vm, bi0, mif->last_marker_pkt);
+ ASSERT (nbytes <= vec_len (mif->last_marker_pkt));
if (nbytes < sizeof (lacp_pdu_t))
{
- sif->marker_bad_pdu_received++;
+ mif->marker_bad_pdu_received++;
return LACP_ERROR_TOO_SMALL;
}
- e = handle_marker_protocol (vm, sif);
- sif->marker_pdu_received++;
+ e = handle_marker_protocol (vm, mif);
+ mif->marker_pdu_received++;
return e;
}
@@ -177,57 +177,57 @@ lacp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0)
* the per-neighbor rx buffer. Reset its apparent length to zero
* and reuse it.
*/
- if (sif->last_rx_pkt)
- _vec_len (sif->last_rx_pkt) = 0;
+ if (mif->last_rx_pkt)
+ _vec_len (mif->last_rx_pkt) = 0;
/*
* Make sure the per-neighbor rx buffer is big enough to hold
* the data we're about to copy
*/
- vec_validate (sif->last_rx_pkt, vlib_buffer_length_in_chain (vm, b0) - 1);
+ vec_validate (mif->last_rx_pkt, vlib_buffer_length_in_chain (vm, b0) - 1);
/*
* Coalesce / copy the buffer chain into the per-neighbor
* rx buffer
*/
- nbytes = vlib_buffer_contents (vm, bi0, sif->last_rx_pkt);
- ASSERT (nbytes <= vec_len (sif->last_rx_pkt));
+ nbytes = vlib_buffer_contents (vm, bi0, mif->last_rx_pkt);
+ ASSERT (nbytes <= vec_len (mif->last_rx_pkt));
- sif->last_lacpdu_recd_time = vlib_time_now (vm);
+ mif->last_lacpdu_recd_time = vlib_time_now (vm);
if (nbytes < sizeof (lacp_pdu_t))
{
- sif->bad_pdu_received++;
+ mif->bad_pdu_received++;
return LACP_ERROR_TOO_SMALL;
}
last_packet_signature =
- hash_memory (sif->last_rx_pkt, vec_len (sif->last_rx_pkt), 0xd00b);
+ hash_memory (mif->last_rx_pkt, vec_len (mif->last_rx_pkt), 0xd00b);
- if (sif->last_packet_signature_valid &&
- (sif->last_packet_signature == last_packet_signature) &&
- ((sif->actor.state & LACP_STEADY_STATE) == LACP_STEADY_STATE))
+ if (mif->last_packet_signature_valid &&
+ (mif->last_packet_signature == last_packet_signature) &&
+ ((mif->actor.state & LACP_STEADY_STATE) == LACP_STEADY_STATE))
{
- lacp_start_current_while_timer (vm, sif, sif->ttl_in_seconds);
+ lacp_start_current_while_timer (vm, mif, mif->ttl_in_seconds);
e = LACP_ERROR_CACHE_HIT;
}
else
{
/* Actually scan the packet */
- e = lacp_packet_scan (vm, sif);
- bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
+ e = lacp_packet_scan (vm, mif);
+ bif = bond_get_bond_if_by_dev_instance (mif->bif_dev_instance);
stat_segment_set_state_counter (bm->stats[bif->sw_if_index]
- [sif->sw_if_index].actor_state,
- sif->actor.state);
+ [mif->sw_if_index].actor_state,
+ mif->actor.state);
stat_segment_set_state_counter (bm->stats[bif->sw_if_index]
- [sif->sw_if_index].partner_state,
- sif->partner.state);
- sif->last_packet_signature_valid = 1;
- sif->last_packet_signature = last_packet_signature;
+ [mif->sw_if_index].partner_state,
+ mif->partner.state);
+ mif->last_packet_signature_valid = 1;
+ mif->last_packet_signature = last_packet_signature;
}
- sif->pdu_received++;
+ mif->pdu_received++;
- if (sif->last_rx_pkt)
- _vec_len (sif->last_rx_pkt) = 0;
+ if (mif->last_rx_pkt)
+ _vec_len (mif->last_rx_pkt) = 0;
return e;
}
diff --git a/src/plugins/lacp/lacp.api b/src/plugins/lacp/lacp.api
index d50bd78836b..4ee8f62a880 100644
--- a/src/plugins/lacp/lacp.api
+++ b/src/plugins/lacp/lacp.api
@@ -31,8 +31,8 @@ define sw_interface_lacp_dump
};
/** \brief Reply for lacp dump request
- @param sw_if_index - software index of slave interface
- @param interface_name - name of slave interface
+ @param sw_if_index - software index of member interface
+ @param interface_name - name of member interface
@param rx_state - rx machine state
@param tx_state - tx machine state
@param mux_state - mux machine state
diff --git a/src/plugins/lacp/lacp.c b/src/plugins/lacp/lacp.c
index 01d8e7b25e0..319a8f79d48 100644
--- a/src/plugins/lacp/lacp.c
+++ b/src/plugins/lacp/lacp.c
@@ -29,20 +29,20 @@ lacp_main_t lacp_main;
* Generate lacp pdu
*/
static void
-lacp_fill_pdu (lacp_pdu_t * lacpdu, slave_if_t * sif)
+lacp_fill_pdu (lacp_pdu_t * lacpdu, member_if_t * mif)
{
/* Actor TLV */
- lacpdu->actor.port_info = sif->actor;
+ lacpdu->actor.port_info = mif->actor;
/* Partner TLV */
- lacpdu->partner.port_info = sif->partner;
+ lacpdu->partner.port_info = mif->partner;
}
/*
* send a lacp pkt on an ethernet interface
*/
static void
-lacp_send_ethernet_lacp_pdu (vlib_main_t * vm, slave_if_t * sif)
+lacp_send_ethernet_lacp_pdu (vlib_main_t * vm, member_if_t * mif)
{
lacp_main_t *lm = &lacp_main;
u32 *to_next;
@@ -58,18 +58,18 @@ lacp_send_ethernet_lacp_pdu (vlib_main_t * vm, slave_if_t * sif)
* into the buffer by the packet template mechanism
*/
h0 = vlib_packet_template_get_packet
- (vm, &lm->packet_templates[sif->packet_template_index], &bi0);
+ (vm, &lm->packet_templates[mif->packet_template_index], &bi0);
if (!h0)
return;
/* Add the interface's ethernet source address */
- hw = vnet_get_sup_hw_interface (vnm, sif->sw_if_index);
+ hw = vnet_get_sup_hw_interface (vnm, mif->sw_if_index);
clib_memcpy (h0->ethernet.src_address, hw->hw_address,
vec_len (hw->hw_address));
- lacp_fill_pdu (&h0->lacp, sif);
+ lacp_fill_pdu (&h0->lacp, mif);
/* Set the outbound packet length */
b0 = vlib_get_buffer (vm, bi0);
@@ -89,44 +89,44 @@ lacp_send_ethernet_lacp_pdu (vlib_main_t * vm, slave_if_t * sif)
vlib_put_frame_to_node (vm, hw->output_node_index, f);
- sif->last_lacpdu_sent_time = vlib_time_now (vm);
- sif->pdu_sent++;
+ mif->last_lacpdu_sent_time = vlib_time_now (vm);
+ mif->pdu_sent++;
}
/*
* Decide which lacp packet template to use
*/
static int
-lacp_pick_packet_template (slave_if_t * sif)
+lacp_pick_packet_template (member_if_t * mif)
{
- sif->packet_template_index = LACP_PACKET_TEMPLATE_ETHERNET;
+ mif->packet_template_index = LACP_PACKET_TEMPLATE_ETHERNET;
return 0;
}
void
-lacp_send_lacp_pdu (vlib_main_t * vm, slave_if_t * sif)
+lacp_send_lacp_pdu (vlib_main_t * vm, member_if_t * mif)
{
- if ((sif->mode != BOND_MODE_LACP) || (sif->port_enabled == 0))
+ if ((mif->mode != BOND_MODE_LACP) || (mif->port_enabled == 0))
{
- lacp_stop_timer (&sif->periodic_timer);
+ lacp_stop_timer (&mif->periodic_timer);
return;
}
- if (sif->packet_template_index == (u8) ~ 0)
+ if (mif->packet_template_index == (u8) ~ 0)
{
/* If we don't know how to talk to this peer, don't try again */
- if (lacp_pick_packet_template (sif))
+ if (lacp_pick_packet_template (mif))
{
- lacp_stop_timer (&sif->periodic_timer);
+ lacp_stop_timer (&mif->periodic_timer);
return;
}
}
- switch (sif->packet_template_index)
+ switch (mif->packet_template_index)
{
case LACP_PACKET_TEMPLATE_ETHERNET:
- lacp_send_ethernet_lacp_pdu (vm, sif);
+ lacp_send_ethernet_lacp_pdu (vm, mif);
break;
default:
@@ -138,51 +138,51 @@ void
lacp_periodic (vlib_main_t * vm)
{
bond_main_t *bm = &bond_main;
- slave_if_t *sif;
+ member_if_t *mif;
bond_if_t *bif;
u8 actor_state, partner_state;
/* *INDENT-OFF* */
- pool_foreach (sif, bm->neighbors,
+ pool_foreach (mif, bm->neighbors,
({
- if (sif->port_enabled == 0)
+ if (mif->port_enabled == 0)
continue;
- actor_state = sif->actor.state;
- partner_state = sif->partner.state;
- if (lacp_timer_is_running (sif->current_while_timer) &&
- lacp_timer_is_expired (vm, sif->current_while_timer))
+ actor_state = mif->actor.state;
+ partner_state = mif->partner.state;
+ if (lacp_timer_is_running (mif->current_while_timer) &&
+ lacp_timer_is_expired (vm, mif->current_while_timer))
{
- lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
- LACP_RX_EVENT_TIMER_EXPIRED, &sif->rx_state);
+ lacp_machine_dispatch (&lacp_rx_machine, vm, mif,
+ LACP_RX_EVENT_TIMER_EXPIRED, &mif->rx_state);
}
- if (lacp_timer_is_running (sif->periodic_timer) &&
- lacp_timer_is_expired (vm, sif->periodic_timer))
+ if (lacp_timer_is_running (mif->periodic_timer) &&
+ lacp_timer_is_expired (vm, mif->periodic_timer))
{
- lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
- LACP_PTX_EVENT_TIMER_EXPIRED, &sif->ptx_state);
+ lacp_machine_dispatch (&lacp_ptx_machine, vm, mif,
+ LACP_PTX_EVENT_TIMER_EXPIRED, &mif->ptx_state);
}
- if (lacp_timer_is_running (sif->wait_while_timer) &&
- lacp_timer_is_expired (vm, sif->wait_while_timer))
+ if (lacp_timer_is_running (mif->wait_while_timer) &&
+ lacp_timer_is_expired (vm, mif->wait_while_timer))
{
- sif->ready_n = 1;
- lacp_stop_timer (&sif->wait_while_timer);
- lacp_selection_logic (vm, sif);
+ mif->ready_n = 1;
+ lacp_stop_timer (&mif->wait_while_timer);
+ lacp_selection_logic (vm, mif);
}
- if (actor_state != sif->actor.state)
+ if (actor_state != mif->actor.state)
{
- bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
+ bif = bond_get_bond_if_by_dev_instance (mif->bif_dev_instance);
stat_segment_set_state_counter (bm->stats[bif->sw_if_index]
- [sif->sw_if_index].actor_state,
- sif->actor.state);
+ [mif->sw_if_index].actor_state,
+ mif->actor.state);
}
- if (partner_state != sif->partner.state)
+ if (partner_state != mif->partner.state)
{
- bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
+ bif = bond_get_bond_if_by_dev_instance (mif->bif_dev_instance);
stat_segment_set_state_counter (bm->stats[bif->sw_if_index]
- [sif->sw_if_index].partner_state,
- sif->partner.state);
+ [mif->sw_if_index].partner_state,
+ mif->partner.state);
}
}));
/* *INDENT-ON* */
@@ -190,7 +190,7 @@ lacp_periodic (vlib_main_t * vm)
static void
lacp_interface_enable_disable (vlib_main_t * vm, bond_if_t * bif,
- slave_if_t * sif, u8 enable)
+ member_if_t * mif, u8 enable)
{
lacp_main_t *lm = &lacp_main;
uword port_number;
@@ -202,8 +202,8 @@ lacp_interface_enable_disable (vlib_main_t * vm, bond_if_t * bif,
bif->port_number_bitmap = clib_bitmap_set (bif->port_number_bitmap,
port_number, 1);
// bitmap starts at 0. Our port number starts at 1.
- lacp_init_neighbor (sif, bif->hw_address, port_number + 1, sif->group);
- lacp_init_state_machines (vm, sif);
+ lacp_init_neighbor (mif, bif->hw_address, port_number + 1, mif->group);
+ lacp_init_state_machines (vm, mif);
lm->lacp_int++;
if (lm->lacp_int == 1)
{
@@ -315,77 +315,77 @@ lacp_periodic_init (vlib_main_t * vm)
int
lacp_machine_dispatch (lacp_machine_t * machine, vlib_main_t * vm,
- slave_if_t * sif, int event, int *state)
+ member_if_t * mif, int event, int *state)
{
lacp_fsm_state_t *transition;
int rc = 0;
transition = &machine->tables[*state].state_table[event];
- LACP_DBG2 (sif, event, *state, machine, transition);
+ LACP_DBG2 (mif, event, *state, machine, transition);
*state = transition->next_state;
if (transition->action)
- rc = (*transition->action) ((void *) vm, (void *) sif);
+ rc = (*transition->action) ((void *) vm, (void *) mif);
return rc;
}
void
-lacp_init_neighbor (slave_if_t * sif, u8 * hw_address, u16 port_number,
+lacp_init_neighbor (member_if_t * mif, u8 * hw_address, u16 port_number,
u32 group)
{
- lacp_stop_timer (&sif->wait_while_timer);
- lacp_stop_timer (&sif->current_while_timer);
- lacp_stop_timer (&sif->actor_churn_timer);
- lacp_stop_timer (&sif->partner_churn_timer);
- lacp_stop_timer (&sif->periodic_timer);
- lacp_stop_timer (&sif->last_lacpdu_sent_time);
- lacp_stop_timer (&sif->last_lacpdu_recd_time);
- lacp_stop_timer (&sif->last_marker_pdu_sent_time);
- lacp_stop_timer (&sif->last_marker_pdu_recd_time);
- sif->lacp_enabled = 1;
- sif->loopback_port = 0;
- sif->ready = 0;
- sif->ready_n = 0;
- sif->port_moved = 0;
- sif->ntt = 0;
- sif->selected = LACP_PORT_UNSELECTED;
- sif->actor.state = LACP_STATE_AGGREGATION;
- if (sif->ttl_in_seconds == LACP_SHORT_TIMOUT_TIME)
- sif->actor.state |= LACP_STATE_LACP_TIMEOUT;
- if (sif->is_passive == 0)
- sif->actor.state |= LACP_STATE_LACP_ACTIVITY;
- clib_memcpy (sif->actor.system, hw_address, 6);
- sif->actor.system_priority = htons (LACP_DEFAULT_SYSTEM_PRIORITY);
- sif->actor.key = htons (group);
- sif->actor.port_number = htons (port_number);
- sif->actor.port_priority = htons (LACP_DEFAULT_PORT_PRIORITY);
-
- sif->partner.system_priority = htons (LACP_DEFAULT_SYSTEM_PRIORITY);
- sif->partner.key = htons (group);
- sif->partner.port_number = htons (port_number);
- sif->partner.port_priority = htons (LACP_DEFAULT_PORT_PRIORITY);
- sif->partner.state = 0;
-
- sif->actor_admin = sif->actor;
- sif->partner_admin = sif->partner;
+ lacp_stop_timer (&mif->wait_while_timer);
+ lacp_stop_timer (&mif->current_while_timer);
+ lacp_stop_timer (&mif->actor_churn_timer);
+ lacp_stop_timer (&mif->partner_churn_timer);
+ lacp_stop_timer (&mif->periodic_timer);
+ lacp_stop_timer (&mif->last_lacpdu_sent_time);
+ lacp_stop_timer (&mif->last_lacpdu_recd_time);
+ lacp_stop_timer (&mif->last_marker_pdu_sent_time);
+ lacp_stop_timer (&mif->last_marker_pdu_recd_time);
+ mif->lacp_enabled = 1;
+ mif->loopback_port = 0;
+ mif->ready = 0;
+ mif->ready_n = 0;
+ mif->port_moved = 0;
+ mif->ntt = 0;
+ mif->selected = LACP_PORT_UNSELECTED;
+ mif->actor.state = LACP_STATE_AGGREGATION;
+ if (mif->ttl_in_seconds == LACP_SHORT_TIMOUT_TIME)
+ mif->actor.state |= LACP_STATE_LACP_TIMEOUT;
+ if (mif->is_passive == 0)
+ mif->actor.state |= LACP_STATE_LACP_ACTIVITY;
+ clib_memcpy (mif->actor.system, hw_address, 6);
+ mif->actor.system_priority = htons (LACP_DEFAULT_SYSTEM_PRIORITY);
+ mif->actor.key = htons (group);
+ mif->actor.port_number = htons (port_number);
+ mif->actor.port_priority = htons (LACP_DEFAULT_PORT_PRIORITY);
+
+ mif->partner.system_priority = htons (LACP_DEFAULT_SYSTEM_PRIORITY);
+ mif->partner.key = htons (group);
+ mif->partner.port_number = htons (port_number);
+ mif->partner.port_priority = htons (LACP_DEFAULT_PORT_PRIORITY);
+ mif->partner.state = 0;
+
+ mif->actor_admin = mif->actor;
+ mif->partner_admin = mif->partner;
}
void
-lacp_init_state_machines (vlib_main_t * vm, slave_if_t * sif)
+lacp_init_state_machines (vlib_main_t * vm, member_if_t * mif)
{
bond_main_t *bm = &bond_main;
- bond_if_t *bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
+ bond_if_t *bif = bond_get_bond_if_by_dev_instance (mif->bif_dev_instance);
- lacp_init_tx_machine (vm, sif);
- lacp_init_mux_machine (vm, sif);
- lacp_init_ptx_machine (vm, sif);
- lacp_init_rx_machine (vm, sif);
+ lacp_init_tx_machine (vm, mif);
+ lacp_init_mux_machine (vm, mif);
+ lacp_init_ptx_machine (vm, mif);
+ lacp_init_rx_machine (vm, mif);
stat_segment_set_state_counter (bm->stats[bif->sw_if_index]
- [sif->sw_if_index].actor_state,
- sif->actor.state);
+ [mif->sw_if_index].actor_state,
+ mif->actor.state);
stat_segment_set_state_counter (bm->stats[bif->sw_if_index]
- [sif->sw_if_index].partner_state,
- sif->partner.state);
+ [mif->sw_if_index].partner_state,
+ mif->partner.state);
}
VLIB_INIT_FUNCTION (lacp_periodic_init);
@@ -394,24 +394,24 @@ static clib_error_t *
lacp_sw_interface_up_down (vnet_main_t * vnm, u32 sw_if_index, u32 flags)
{
lacp_main_t *lm = &lacp_main;
- slave_if_t *sif;
+ member_if_t *mif;
vlib_main_t *vm = lm->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 == 0)
+ if (mif->lacp_enabled == 0)
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)
+ if (mif->port_enabled == 0)
{
- lacp_init_neighbor (sif, sif->actor_admin.system,
- ntohs (sif->actor_admin.port_number),
- ntohs (sif->actor_admin.key));
- lacp_init_state_machines (vm, sif);
+ lacp_init_neighbor (mif, mif->actor_admin.system,
+ ntohs (mif->actor_admin.port_number),
+ ntohs (mif->actor_admin.key));
+ lacp_init_state_machines (vm, mif);
}
}
@@ -424,27 +424,27 @@ static clib_error_t *
lacp_hw_interface_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
lacp_main_t *lm = &lacp_main;
- slave_if_t *sif;
+ member_if_t *mif;
vnet_sw_interface_t *sw;
vlib_main_t *vm = lm->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 == 0)
+ if (mif->lacp_enabled == 0)
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)
+ if (mif->port_enabled == 0)
{
- lacp_init_neighbor (sif, sif->actor_admin.system,
- ntohs (sif->actor_admin.port_number),
- ntohs (sif->actor_admin.key));
- lacp_init_state_machines (vm, sif);
+ lacp_init_neighbor (mif, mif->actor_admin.system,
+ ntohs (mif->actor_admin.port_number),
+ ntohs (mif->actor_admin.key));
+ lacp_init_state_machines (vm, mif);
}
}
diff --git a/src/plugins/lacp/machine.h b/src/plugins/lacp/machine.h
index 0590b6cf101..2e628b6d51c 100644
--- a/src/plugins/lacp/machine.h
+++ b/src/plugins/lacp/machine.h
@@ -29,7 +29,7 @@ typedef struct
int next_state;
} lacp_fsm_state_t;
-typedef void (*debug_func) (slave_if_t * sif, int event, int state,
+typedef void (*debug_func) (member_if_t * mif, int event, int state,
lacp_fsm_state_t * transition);
typedef struct
@@ -44,7 +44,7 @@ typedef struct
} lacp_machine_t;
extern int lacp_machine_dispatch (lacp_machine_t * machine, vlib_main_t * vm,
- slave_if_t * sif, int event, int *state);
+ member_if_t * mif, int event, int *state);
#endif /* __LACP_MACHINE_H__ */
diff --git a/src/plugins/lacp/mux_machine.c b/src/plugins/lacp/mux_machine.c
index 6a5549077a2..974dbd9dac9 100644
--- a/src/plugins/lacp/mux_machine.c
+++ b/src/plugins/lacp/mux_machine.c
@@ -80,39 +80,39 @@ lacp_machine_t lacp_mux_machine = {
};
static void
-lacp_detach_mux_from_aggregator (vlib_main_t * vm, slave_if_t * sif)
+lacp_detach_mux_from_aggregator (vlib_main_t * vm, member_if_t * mif)
{
- sif->actor.state &= ~LACP_STATE_SYNCHRONIZATION;
- sif->ready = 0;
- sif->ready_n = 0;
+ mif->actor.state &= ~LACP_STATE_SYNCHRONIZATION;
+ mif->ready = 0;
+ mif->ready_n = 0;
}
static void
-lacp_attach_mux_to_aggregator (vlib_main_t * vm, slave_if_t * sif)
+lacp_attach_mux_to_aggregator (vlib_main_t * vm, member_if_t * mif)
{
- sif->actor.state |= LACP_STATE_SYNCHRONIZATION;
+ mif->actor.state |= LACP_STATE_SYNCHRONIZATION;
}
int
lacp_mux_action_detached (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
+ member_if_t *mif = p2;
- lacp_detach_mux_from_aggregator (vm, sif);
- sif->actor.state &= ~LACP_STATE_COLLECTING;
- bond_disable_collecting_distributing (vm, sif);
- sif->actor.state &= ~LACP_STATE_DISTRIBUTING;
- sif->ntt = 1;
- lacp_start_periodic_timer (vm, sif, 0);
+ lacp_detach_mux_from_aggregator (vm, mif);
+ mif->actor.state &= ~LACP_STATE_COLLECTING;
+ bond_disable_collecting_distributing (vm, mif);
+ mif->actor.state &= ~LACP_STATE_DISTRIBUTING;
+ mif->ntt = 1;
+ lacp_start_periodic_timer (vm, mif, 0);
- if (sif->selected == LACP_PORT_SELECTED)
- lacp_machine_dispatch (&lacp_mux_machine, vm, sif,
- LACP_MUX_EVENT_SELECTED, &sif->mux_state);
+ if (mif->selected == LACP_PORT_SELECTED)
+ lacp_machine_dispatch (&lacp_mux_machine, vm, mif,
+ LACP_MUX_EVENT_SELECTED, &mif->mux_state);
- if (sif->selected == LACP_PORT_STANDBY)
- lacp_machine_dispatch (&lacp_mux_machine, vm, sif, LACP_MUX_EVENT_STANDBY,
- &sif->mux_state);
+ if (mif->selected == LACP_PORT_STANDBY)
+ lacp_machine_dispatch (&lacp_mux_machine, vm, mif, LACP_MUX_EVENT_STANDBY,
+ &mif->mux_state);
return 0;
}
@@ -121,24 +121,24 @@ int
lacp_mux_action_attached (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
-
- lacp_attach_mux_to_aggregator (vm, sif);
- sif->actor.state &= ~LACP_STATE_COLLECTING;
- bond_disable_collecting_distributing (vm, sif);
- sif->actor.state &= ~LACP_STATE_DISTRIBUTING;
- sif->ntt = 1;
- lacp_start_periodic_timer (vm, sif, 0);
-
- if ((sif->selected == LACP_PORT_UNSELECTED) ||
- (sif->selected == LACP_PORT_STANDBY))
- lacp_machine_dispatch (&lacp_mux_machine, vm, sif,
- LACP_MUX_EVENT_UNSELECTED, &sif->mux_state);
-
- if ((sif->selected == LACP_PORT_SELECTED) &&
- (sif->partner.state & LACP_STATE_SYNCHRONIZATION))
- lacp_machine_dispatch (&lacp_mux_machine, vm, sif, LACP_MUX_EVENT_SYNC,
- &sif->mux_state);
+ member_if_t *mif = p2;
+
+ lacp_attach_mux_to_aggregator (vm, mif);
+ mif->actor.state &= ~LACP_STATE_COLLECTING;
+ bond_disable_collecting_distributing (vm, mif);
+ mif->actor.state &= ~LACP_STATE_DISTRIBUTING;
+ mif->ntt = 1;
+ lacp_start_periodic_timer (vm, mif, 0);
+
+ if ((mif->selected == LACP_PORT_UNSELECTED) ||
+ (mif->selected == LACP_PORT_STANDBY))
+ lacp_machine_dispatch (&lacp_mux_machine, vm, mif,
+ LACP_MUX_EVENT_UNSELECTED, &mif->mux_state);
+
+ if ((mif->selected == LACP_PORT_SELECTED) &&
+ (mif->partner.state & LACP_STATE_SYNCHRONIZATION))
+ lacp_machine_dispatch (&lacp_mux_machine, vm, mif, LACP_MUX_EVENT_SYNC,
+ &mif->mux_state);
return 0;
}
@@ -146,18 +146,18 @@ int
lacp_mux_action_waiting (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
+ member_if_t *mif = p2;
- if (!lacp_timer_is_running (sif->wait_while_timer))
- lacp_start_wait_while_timer (vm, sif, LACP_AGGREGATE_WAIT_TIME);
+ if (!lacp_timer_is_running (mif->wait_while_timer))
+ lacp_start_wait_while_timer (vm, mif, LACP_AGGREGATE_WAIT_TIME);
- if ((sif->selected == LACP_PORT_SELECTED) && sif->ready)
- lacp_machine_dispatch (&lacp_mux_machine, vm, sif,
- LACP_MUX_EVENT_READY, &sif->mux_state);
+ if ((mif->selected == LACP_PORT_SELECTED) && mif->ready)
+ lacp_machine_dispatch (&lacp_mux_machine, vm, mif,
+ LACP_MUX_EVENT_READY, &mif->mux_state);
- if (sif->selected == LACP_PORT_UNSELECTED)
- lacp_machine_dispatch (&lacp_mux_machine, vm, sif,
- LACP_MUX_EVENT_UNSELECTED, &sif->mux_state);
+ if (mif->selected == LACP_PORT_UNSELECTED)
+ lacp_machine_dispatch (&lacp_mux_machine, vm, mif,
+ LACP_MUX_EVENT_UNSELECTED, &mif->mux_state);
return 0;
}
@@ -166,18 +166,18 @@ int
lacp_mux_action_collecting_distributing (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
+ member_if_t *mif = p2;
- sif->actor.state |= LACP_STATE_SYNCHRONIZATION | LACP_STATE_COLLECTING |
+ mif->actor.state |= LACP_STATE_SYNCHRONIZATION | LACP_STATE_COLLECTING |
LACP_STATE_DISTRIBUTING;
- bond_enable_collecting_distributing (vm, sif);
- sif->ntt = 1;
- lacp_start_periodic_timer (vm, sif, 0);
- if ((sif->selected == LACP_PORT_UNSELECTED) ||
- (sif->selected == LACP_PORT_STANDBY) ||
- !(sif->partner.state & LACP_STATE_SYNCHRONIZATION))
- lacp_machine_dispatch (&lacp_mux_machine, vm, sif,
- LACP_MUX_EVENT_UNSELECTED, &sif->mux_state);
+ bond_enable_collecting_distributing (vm, mif);
+ mif->ntt = 1;
+ lacp_start_periodic_timer (vm, mif, 0);
+ if ((mif->selected == LACP_PORT_UNSELECTED) ||
+ (mif->selected == LACP_PORT_STANDBY) ||
+ !(mif->partner.state & LACP_STATE_SYNCHRONIZATION))
+ lacp_machine_dispatch (&lacp_mux_machine, vm, mif,
+ LACP_MUX_EVENT_UNSELECTED, &mif->mux_state);
return 0;
@@ -204,7 +204,7 @@ format_mux_event (u8 * s, va_list * args)
}
void
-lacp_mux_debug_func (slave_if_t * sif, int event, int state,
+lacp_mux_debug_func (member_if_t * mif, int event, int state,
lacp_fsm_state_t * transition)
{
vlib_worker_thread_t *w = vlib_worker_threads + os_get_thread_index ();
@@ -224,16 +224,16 @@ lacp_mux_debug_func (slave_if_t * sif, int event, int state,
ed->event =
elog_string (&vlib_global_main.elog_main, "%U-MUX: %U, %U->%U%c",
format_vnet_sw_if_index_name, vnet_get_main (),
- sif->sw_if_index, format_mux_event, event,
+ mif->sw_if_index, format_mux_event, event,
format_mux_sm_state, state, format_mux_sm_state,
transition->next_state, 0);
}
void
-lacp_init_mux_machine (vlib_main_t * vm, slave_if_t * sif)
+lacp_init_mux_machine (vlib_main_t * vm, member_if_t * mif)
{
- lacp_machine_dispatch (&lacp_mux_machine, vm, sif, LACP_MUX_EVENT_BEGIN,
- &sif->mux_state);
+ lacp_machine_dispatch (&lacp_mux_machine, vm, mif, LACP_MUX_EVENT_BEGIN,
+ &mif->mux_state);
}
/*
diff --git a/src/plugins/lacp/mux_machine.h b/src/plugins/lacp/mux_machine.h
index 48e9a0bed4e..6fd251327d0 100644
--- a/src/plugins/lacp/mux_machine.h
+++ b/src/plugins/lacp/mux_machine.h
@@ -53,7 +53,7 @@ int lacp_mux_action_detached (void *p1, void *p2);
int lacp_mux_action_attached (void *p1, void *p2);
int lacp_mux_action_waiting (void *p1, void *p2);
int lacp_mux_action_collecting_distributing (void *p1, void *p2);
-void lacp_mux_debug_func (slave_if_t * sif, int event, int state,
+void lacp_mux_debug_func (member_if_t * mif, int event, int state,
lacp_fsm_state_t * transition);
#define LACP_ACTION_DETACHED LACP_ACTION_ROUTINE(lacp_mux_action_detached)
@@ -63,10 +63,10 @@ void lacp_mux_debug_func (slave_if_t * sif, int event, int state,
LACP_ACTION_ROUTINE(lacp_mux_action_collecting_distributing)
static inline void
-lacp_start_wait_while_timer (vlib_main_t * vm, slave_if_t * sif,
+lacp_start_wait_while_timer (vlib_main_t * vm, member_if_t * mif,
u8 expiration)
{
- sif->wait_while_timer = vlib_time_now (vm) + expiration;
+ mif->wait_while_timer = vlib_time_now (vm) + expiration;
}
#endif /* __LACP_MUX_MACHINE_H__ */
diff --git a/src/plugins/lacp/node.h b/src/plugins/lacp/node.h
index 59af66f20d0..0c4e4572c07 100644
--- a/src/plugins/lacp/node.h
+++ b/src/plugins/lacp/node.h
@@ -146,15 +146,15 @@ int lacp_dump_ifs (lacp_interface_details_t ** out_bondids);
lacp_error_t lacp_input (vlib_main_t * vm, vlib_buffer_t * b0, u32 bi0);
void lacp_periodic (vlib_main_t * vm);
u8 *lacp_input_format_trace (u8 * s, va_list * args);
-void lacp_init_neighbor (slave_if_t * sif, u8 * hw_address,
+void lacp_init_neighbor (member_if_t * mif, u8 * hw_address,
u16 port_number, u32 group);
-void lacp_init_state_machines (vlib_main_t * vm, slave_if_t * sif);
-void lacp_init_rx_machine (vlib_main_t * vm, slave_if_t * sif);
-void lacp_init_tx_machine (vlib_main_t * vm, slave_if_t * sif);
-void lacp_init_ptx_machine (vlib_main_t * vm, slave_if_t * sif);
-void lacp_init_mux_machine (vlib_main_t * vm, slave_if_t * sif);
-void lacp_selection_logic (vlib_main_t * vm, slave_if_t * sif);
-void lacp_send_lacp_pdu (vlib_main_t * vm, slave_if_t * sif);
+void lacp_init_state_machines (vlib_main_t * vm, member_if_t * mif);
+void lacp_init_rx_machine (vlib_main_t * vm, member_if_t * mif);
+void lacp_init_tx_machine (vlib_main_t * vm, member_if_t * mif);
+void lacp_init_ptx_machine (vlib_main_t * vm, member_if_t * mif);
+void lacp_init_mux_machine (vlib_main_t * vm, member_if_t * mif);
+void lacp_selection_logic (vlib_main_t * vm, member_if_t * mif);
+void lacp_send_lacp_pdu (vlib_main_t * vm, member_if_t * mif);
static inline void
lacp_stop_timer (f64 * timer)
diff --git a/src/plugins/lacp/ptx_machine.c b/src/plugins/lacp/ptx_machine.c
index 941fc58cbc4..bb9d033c13a 100644
--- a/src/plugins/lacp/ptx_machine.c
+++ b/src/plugins/lacp/ptx_machine.c
@@ -75,10 +75,10 @@ int
lacp_ptx_action_no_periodic (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
+ member_if_t *mif = p2;
- lacp_stop_timer (&sif->periodic_timer);
- lacp_ptx_post_short_timeout_event (vm, sif);
+ lacp_stop_timer (&mif->periodic_timer);
+ lacp_ptx_post_short_timeout_event (vm, mif);
return 0;
}
@@ -86,26 +86,26 @@ int
lacp_ptx_action_slow_periodic (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
+ member_if_t *mif = p2;
u8 timer_expired;
- if (!(sif->partner.state & LACP_STATE_LACP_ACTIVITY) &&
- !(sif->actor.state & LACP_STATE_LACP_ACTIVITY))
- lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
- LACP_PTX_EVENT_NO_PERIODIC, &sif->ptx_state);
+ if (!(mif->partner.state & LACP_STATE_LACP_ACTIVITY) &&
+ !(mif->actor.state & LACP_STATE_LACP_ACTIVITY))
+ lacp_machine_dispatch (&lacp_ptx_machine, vm, mif,
+ LACP_PTX_EVENT_NO_PERIODIC, &mif->ptx_state);
else
{
- if (lacp_timer_is_running (sif->periodic_timer) &&
- lacp_timer_is_expired (vm, sif->periodic_timer))
+ if (lacp_timer_is_running (mif->periodic_timer) &&
+ lacp_timer_is_expired (vm, mif->periodic_timer))
timer_expired = 1;
else
timer_expired = 0;
- lacp_schedule_periodic_timer (vm, sif);
+ lacp_schedule_periodic_timer (vm, mif);
- if (timer_expired || (sif->partner.state & LACP_STATE_LACP_TIMEOUT))
- lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
- LACP_PTX_EVENT_TIMER_EXPIRED, &sif->ptx_state);
+ if (timer_expired || (mif->partner.state & LACP_STATE_LACP_TIMEOUT))
+ lacp_machine_dispatch (&lacp_ptx_machine, vm, mif,
+ LACP_PTX_EVENT_TIMER_EXPIRED, &mif->ptx_state);
}
return 0;
@@ -115,30 +115,30 @@ int
lacp_ptx_action_fast_periodic (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
+ member_if_t *mif = p2;
u8 timer_expired;
- if (!(sif->partner.state & LACP_STATE_LACP_ACTIVITY) &&
- !(sif->actor.state & LACP_STATE_LACP_ACTIVITY))
- lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
- LACP_PTX_EVENT_NO_PERIODIC, &sif->ptx_state);
+ if (!(mif->partner.state & LACP_STATE_LACP_ACTIVITY) &&
+ !(mif->actor.state & LACP_STATE_LACP_ACTIVITY))
+ lacp_machine_dispatch (&lacp_ptx_machine, vm, mif,
+ LACP_PTX_EVENT_NO_PERIODIC, &mif->ptx_state);
else
{
- if (lacp_timer_is_running (sif->periodic_timer) &&
- lacp_timer_is_expired (vm, sif->periodic_timer))
+ if (lacp_timer_is_running (mif->periodic_timer) &&
+ lacp_timer_is_expired (vm, mif->periodic_timer))
timer_expired = 1;
else
timer_expired = 0;
- lacp_start_periodic_timer (vm, sif, LACP_FAST_PERIODIC_TIMER);
+ lacp_start_periodic_timer (vm, mif, LACP_FAST_PERIODIC_TIMER);
if (timer_expired)
- lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
- LACP_PTX_EVENT_TIMER_EXPIRED, &sif->ptx_state);
+ lacp_machine_dispatch (&lacp_ptx_machine, vm, mif,
+ LACP_PTX_EVENT_TIMER_EXPIRED, &mif->ptx_state);
- if (!(sif->partner.state & LACP_STATE_LACP_TIMEOUT))
- lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
- LACP_PTX_EVENT_LONG_TIMEOUT, &sif->ptx_state);
+ if (!(mif->partner.state & LACP_STATE_LACP_TIMEOUT))
+ lacp_machine_dispatch (&lacp_ptx_machine, vm, mif,
+ LACP_PTX_EVENT_LONG_TIMEOUT, &mif->ptx_state);
}
return 0;
@@ -148,23 +148,23 @@ int
lacp_ptx_action_timer_expired (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
+ member_if_t *mif = p2;
- if (!(sif->partner.state & LACP_STATE_LACP_ACTIVITY) &&
- !(sif->actor.state & LACP_STATE_LACP_ACTIVITY))
- lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
- LACP_PTX_EVENT_NO_PERIODIC, &sif->ptx_state);
+ if (!(mif->partner.state & LACP_STATE_LACP_ACTIVITY) &&
+ !(mif->actor.state & LACP_STATE_LACP_ACTIVITY))
+ lacp_machine_dispatch (&lacp_ptx_machine, vm, mif,
+ LACP_PTX_EVENT_NO_PERIODIC, &mif->ptx_state);
else
{
- sif->ntt = 1;
- lacp_machine_dispatch (&lacp_tx_machine, vm, sif, LACP_TX_EVENT_NTT,
- &sif->tx_state);
- if (sif->partner.state & LACP_STATE_LACP_TIMEOUT)
- lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
- LACP_PTX_EVENT_SHORT_TIMEOUT, &sif->ptx_state);
+ mif->ntt = 1;
+ lacp_machine_dispatch (&lacp_tx_machine, vm, mif, LACP_TX_EVENT_NTT,
+ &mif->tx_state);
+ if (mif->partner.state & LACP_STATE_LACP_TIMEOUT)
+ lacp_machine_dispatch (&lacp_ptx_machine, vm, mif,
+ LACP_PTX_EVENT_SHORT_TIMEOUT, &mif->ptx_state);
else
- lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
- LACP_PTX_EVENT_LONG_TIMEOUT, &sif->ptx_state);
+ lacp_machine_dispatch (&lacp_ptx_machine, vm, mif,
+ LACP_PTX_EVENT_LONG_TIMEOUT, &mif->ptx_state);
}
return 0;
@@ -191,7 +191,7 @@ format_ptx_event (u8 * s, va_list * args)
}
void
-lacp_ptx_debug_func (slave_if_t * sif, int event, int state,
+lacp_ptx_debug_func (member_if_t * mif, int event, int state,
lacp_fsm_state_t * transition)
{
vlib_worker_thread_t *w = vlib_worker_threads + os_get_thread_index ();
@@ -211,16 +211,16 @@ lacp_ptx_debug_func (slave_if_t * sif, int event, int state,
ed->event =
elog_string (&vlib_global_main.elog_main, "%U-PTX: %U, %U->%U%c",
format_vnet_sw_if_index_name, vnet_get_main (),
- sif->sw_if_index, format_ptx_event, event,
+ mif->sw_if_index, format_ptx_event, event,
format_ptx_sm_state, state, format_ptx_sm_state,
transition->next_state, 0);
}
void
-lacp_init_ptx_machine (vlib_main_t * vm, slave_if_t * sif)
+lacp_init_ptx_machine (vlib_main_t * vm, member_if_t * mif)
{
- lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
- LACP_PTX_EVENT_NO_PERIODIC, &sif->ptx_state);
+ lacp_machine_dispatch (&lacp_ptx_machine, vm, mif,
+ LACP_PTX_EVENT_NO_PERIODIC, &mif->ptx_state);
}
/*
diff --git a/src/plugins/lacp/ptx_machine.h b/src/plugins/lacp/ptx_machine.h
index 4b4f4134254..7b8fc535da8 100644
--- a/src/plugins/lacp/ptx_machine.h
+++ b/src/plugins/lacp/ptx_machine.h
@@ -51,7 +51,7 @@ int lacp_ptx_action_no_periodic (void *p1, void *p2);
int lacp_ptx_action_slow_periodic (void *p1, void *p2);
int lacp_ptx_action_fast_periodic (void *p1, void *p2);
int lacp_ptx_action_timer_expired (void *p1, void *p2);
-void lacp_ptx_debug_func (slave_if_t * sif, int event, int state,
+void lacp_ptx_debug_func (member_if_t * mif, int event, int state,
lacp_fsm_state_t * transition);
#define LACP_ACTION_NO_PERIODIC \
@@ -64,36 +64,36 @@ void lacp_ptx_debug_func (slave_if_t * sif, int event, int state,
LACP_ACTION_ROUTINE(lacp_ptx_action_timer_expired)
static inline void
-lacp_start_periodic_timer (vlib_main_t * vm, slave_if_t * sif, u8 expiration)
+lacp_start_periodic_timer (vlib_main_t * vm, member_if_t * mif, u8 expiration)
{
- sif->periodic_timer = vlib_time_now (vm) + expiration;
+ mif->periodic_timer = vlib_time_now (vm) + expiration;
}
static inline void
-lacp_schedule_periodic_timer (vlib_main_t * vm, slave_if_t * sif)
+lacp_schedule_periodic_timer (vlib_main_t * vm, member_if_t * mif)
{
// do fast rate if partner is in short timeout or
// we are not yet synchronized
- if ((sif->partner.state & LACP_STATE_LACP_TIMEOUT) ||
- (((sif->actor.state & (LACP_STATE_SYNCHRONIZATION |
+ if ((mif->partner.state & LACP_STATE_LACP_TIMEOUT) ||
+ (((mif->actor.state & (LACP_STATE_SYNCHRONIZATION |
LACP_STATE_COLLECTING |
LACP_STATE_DISTRIBUTING)) !=
(LACP_STATE_SYNCHRONIZATION | LACP_STATE_COLLECTING |
LACP_STATE_DISTRIBUTING))
- && (sif->partner.state & LACP_STATE_AGGREGATION)))
- lacp_start_periodic_timer (vm, sif, LACP_FAST_PERIODIC_TIMER);
+ && (mif->partner.state & LACP_STATE_AGGREGATION)))
+ lacp_start_periodic_timer (vm, mif, LACP_FAST_PERIODIC_TIMER);
else
- lacp_start_periodic_timer (vm, sif, LACP_SLOW_PERIODIC_TIMER);
+ lacp_start_periodic_timer (vm, mif, LACP_SLOW_PERIODIC_TIMER);
}
static inline void
-lacp_ptx_post_short_timeout_event (vlib_main_t * vm, slave_if_t * sif)
+lacp_ptx_post_short_timeout_event (vlib_main_t * vm, member_if_t * mif)
{
- if (sif->lacp_enabled && sif->port_enabled &&
- ((sif->partner.state & LACP_STATE_LACP_ACTIVITY) ||
- (sif->actor.state & LACP_STATE_LACP_ACTIVITY)))
- lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
- LACP_PTX_EVENT_SHORT_TIMEOUT, &sif->ptx_state);
+ if (mif->lacp_enabled && mif->port_enabled &&
+ ((mif->partner.state & LACP_STATE_LACP_ACTIVITY) ||
+ (mif->actor.state & LACP_STATE_LACP_ACTIVITY)))
+ lacp_machine_dispatch (&lacp_ptx_machine, vm, mif,
+ LACP_PTX_EVENT_SHORT_TIMEOUT, &mif->ptx_state);
}
#endif /* __LACP_PTX_MACHINE_H__ */
diff --git a/src/plugins/lacp/rx_machine.c b/src/plugins/lacp/rx_machine.c
index 605cccba08c..60edc80d863 100644
--- a/src/plugins/lacp/rx_machine.c
+++ b/src/plugins/lacp/rx_machine.c
@@ -111,11 +111,11 @@ lacp_machine_t lacp_rx_machine = {
};
static void
-lacp_set_port_unselected (vlib_main_t * vm, slave_if_t * sif)
+lacp_set_port_unselected (vlib_main_t * vm, member_if_t * mif)
{
- sif->selected = LACP_PORT_UNSELECTED;
+ mif->selected = LACP_PORT_UNSELECTED;
- switch (sif->mux_state)
+ switch (mif->mux_state)
{
case LACP_MUX_STATE_DETACHED:
break;
@@ -125,78 +125,78 @@ lacp_set_port_unselected (vlib_main_t * vm, slave_if_t * sif)
return;
break;
case LACP_MUX_STATE_COLLECTING_DISTRIBUTING:
- if (sif->partner.state & LACP_STATE_SYNCHRONIZATION)
+ if (mif->partner.state & LACP_STATE_SYNCHRONIZATION)
return;
break;
default:
break;
}
- lacp_machine_dispatch (&lacp_mux_machine, vm, sif,
- LACP_MUX_EVENT_UNSELECTED, &sif->mux_state);
+ lacp_machine_dispatch (&lacp_mux_machine, vm, mif,
+ LACP_MUX_EVENT_UNSELECTED, &mif->mux_state);
}
static void
-lacp_update_default_selected (vlib_main_t * vm, slave_if_t * sif)
+lacp_update_default_selected (vlib_main_t * vm, member_if_t * mif)
{
- if ((sif->partner_admin.state & LACP_STATE_AGGREGATION) !=
- (sif->partner.state & LACP_STATE_AGGREGATION) ||
- memcmp (&sif->partner, &sif->partner_admin,
- sizeof (sif->partner) - sizeof (sif->partner.state)))
+ if ((mif->partner_admin.state & LACP_STATE_AGGREGATION) !=
+ (mif->partner.state & LACP_STATE_AGGREGATION) ||
+ memcmp (&mif->partner, &mif->partner_admin,
+ sizeof (mif->partner) - sizeof (mif->partner.state)))
{
- lacp_set_port_unselected (vm, sif);
+ lacp_set_port_unselected (vm, mif);
}
}
static void
-lacp_record_default (slave_if_t * sif)
+lacp_record_default (member_if_t * mif)
{
- sif->partner = sif->partner_admin;
- sif->actor.state |= LACP_STATE_DEFAULTED;
+ mif->partner = mif->partner_admin;
+ mif->actor.state |= LACP_STATE_DEFAULTED;
}
static void
-lacp_update_selected (vlib_main_t * vm, slave_if_t * sif)
+lacp_update_selected (vlib_main_t * vm, member_if_t * mif)
{
- lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->last_rx_pkt;
+ lacp_pdu_t *lacpdu = (lacp_pdu_t *) mif->last_rx_pkt;
if ((lacpdu->actor.port_info.state & LACP_STATE_AGGREGATION) !=
- (sif->partner.state & LACP_STATE_AGGREGATION) ||
- memcmp (&sif->partner, &lacpdu->actor.port_info,
- sizeof (sif->partner) - sizeof (sif->partner.state)))
+ (mif->partner.state & LACP_STATE_AGGREGATION) ||
+ memcmp (&mif->partner, &lacpdu->actor.port_info,
+ sizeof (mif->partner) - sizeof (mif->partner.state)))
{
- lacp_set_port_unselected (vm, sif);
+ lacp_set_port_unselected (vm, mif);
}
}
static void
-lacp_update_ntt (vlib_main_t * vm, slave_if_t * sif)
+lacp_update_ntt (vlib_main_t * vm, member_if_t * mif)
{
- lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->last_rx_pkt;
+ lacp_pdu_t *lacpdu = (lacp_pdu_t *) mif->last_rx_pkt;
u8 states = LACP_STATE_LACP_ACTIVITY | LACP_STATE_LACP_TIMEOUT |
LACP_STATE_SYNCHRONIZATION | LACP_STATE_AGGREGATION;
if ((states & lacpdu->partner.port_info.state) !=
- (states & sif->actor.state)
- || memcmp (&sif->actor, &lacpdu->partner.port_info,
- sizeof (sif->actor) - sizeof (sif->actor.state)))
+ (states & mif->actor.state)
+ || memcmp (&mif->actor, &lacpdu->partner.port_info,
+ sizeof (mif->actor) - sizeof (mif->actor.state)))
{
- sif->ntt = 1;
- lacp_start_periodic_timer (vm, sif, 0);
+ mif->ntt = 1;
+ lacp_start_periodic_timer (vm, mif, 0);
}
}
/*
- * compare lacpdu partner info against sif->partner. Return 1 if they match, 0
+ * compare lacpdu partner info against mif->partner. Return 1 if they match, 0
* otherwise.
*/
static u8
-lacp_compare_partner (slave_if_t * sif)
+lacp_compare_partner (member_if_t * mif)
{
- lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->last_rx_pkt;
+ lacp_pdu_t *lacpdu = (lacp_pdu_t *) mif->last_rx_pkt;
- if ((!memcmp (&sif->partner, &lacpdu->actor.port_info,
- sizeof (sif->partner) - sizeof (sif->partner.state)) &&
- ((sif->actor.state & LACP_STATE_AGGREGATION) ==
+ if ((!memcmp (&mif->partner, &lacpdu->actor.port_info,
+ sizeof (mif->partner) - sizeof (mif->partner.state)) &&
+ ((mif->actor.state & LACP_STATE_AGGREGATION) ==
(lacpdu->partner.port_info.state & LACP_STATE_AGGREGATION))) ||
((lacpdu->actor.port_info.state & LACP_STATE_AGGREGATION) == 0))
return 1;
@@ -205,50 +205,50 @@ lacp_compare_partner (slave_if_t * sif)
}
static void
-lacp_record_pdu (vlib_main_t * vm, slave_if_t * sif)
+lacp_record_pdu (vlib_main_t * vm, member_if_t * mif)
{
- lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->last_rx_pkt;
+ lacp_pdu_t *lacpdu = (lacp_pdu_t *) mif->last_rx_pkt;
u8 match;
/* Transition PTX out of NO_PERIODIC if needed */
- if (!(sif->partner.state & LACP_STATE_LACP_ACTIVITY) &&
+ if (!(mif->partner.state & LACP_STATE_LACP_ACTIVITY) &&
(lacpdu->actor.port_info.state & LACP_STATE_LACP_ACTIVITY))
- lacp_ptx_post_short_timeout_event (vm, sif);
- match = lacp_compare_partner (sif);
- sif->partner = lacpdu->actor.port_info;
- sif->actor.state &= ~LACP_STATE_DEFAULTED;
+ lacp_ptx_post_short_timeout_event (vm, mif);
+ match = lacp_compare_partner (mif);
+ mif->partner = lacpdu->actor.port_info;
+ mif->actor.state &= ~LACP_STATE_DEFAULTED;
if (match && (lacpdu->actor.port_info.state & LACP_STATE_SYNCHRONIZATION))
- sif->partner.state |= LACP_STATE_SYNCHRONIZATION;
+ mif->partner.state |= LACP_STATE_SYNCHRONIZATION;
else
- sif->partner.state &= ~LACP_STATE_SYNCHRONIZATION;
+ mif->partner.state &= ~LACP_STATE_SYNCHRONIZATION;
}
static void
-lacp_set_port_moved (vlib_main_t * vm, slave_if_t * sif, u8 val)
+lacp_set_port_moved (vlib_main_t * vm, member_if_t * mif, u8 val)
{
- sif->port_moved = val;
-
- if (sif->port_moved)
- lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
- LACP_RX_EVENT_PORT_MOVED, &sif->rx_state);
- else if (!sif->port_enabled)
- lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
- LACP_RX_EVENT_PORT_DISABLED, &sif->rx_state);
+ mif->port_moved = val;
+
+ if (mif->port_moved)
+ lacp_machine_dispatch (&lacp_rx_machine, vm, mif,
+ LACP_RX_EVENT_PORT_MOVED, &mif->rx_state);
+ else if (!mif->port_enabled)
+ lacp_machine_dispatch (&lacp_rx_machine, vm, mif,
+ LACP_RX_EVENT_PORT_DISABLED, &mif->rx_state);
}
int
lacp_rx_action_initialize (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
+ member_if_t *mif = p2;
- lacp_set_port_unselected (vm, sif);
- lacp_record_default (sif);
- sif->actor.state &= ~LACP_STATE_EXPIRED;
- lacp_set_port_moved (vm, sif, 0);
+ lacp_set_port_unselected (vm, mif);
+ lacp_record_default (mif);
+ mif->actor.state &= ~LACP_STATE_EXPIRED;
+ lacp_set_port_moved (vm, mif, 0);
/* UCT */
- lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
- LACP_RX_EVENT_BEGIN, &sif->rx_state);
+ lacp_machine_dispatch (&lacp_rx_machine, vm, mif,
+ LACP_RX_EVENT_BEGIN, &mif->rx_state);
return 0;
}
@@ -257,22 +257,22 @@ int
lacp_rx_action_port_disabled (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
+ member_if_t *mif = p2;
- sif->partner.state &= ~LACP_STATE_SYNCHRONIZATION;
- if (sif->port_moved)
+ mif->partner.state &= ~LACP_STATE_SYNCHRONIZATION;
+ if (mif->port_moved)
{
- lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
- LACP_RX_EVENT_PORT_MOVED, &sif->rx_state);
+ lacp_machine_dispatch (&lacp_rx_machine, vm, mif,
+ LACP_RX_EVENT_PORT_MOVED, &mif->rx_state);
}
- if (sif->port_enabled)
+ if (mif->port_enabled)
{
- if (sif->lacp_enabled)
- lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
- LACP_RX_EVENT_LACP_ENABLED, &sif->rx_state);
+ if (mif->lacp_enabled)
+ lacp_machine_dispatch (&lacp_rx_machine, vm, mif,
+ LACP_RX_EVENT_LACP_ENABLED, &mif->rx_state);
else
- lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
- LACP_RX_EVENT_LACP_DISABLED, &sif->rx_state);
+ lacp_machine_dispatch (&lacp_rx_machine, vm, mif,
+ LACP_RX_EVENT_LACP_DISABLED, &mif->rx_state);
}
return 0;
@@ -282,25 +282,25 @@ int
lacp_rx_action_expired (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
+ member_if_t *mif = p2;
u8 timer_expired;
- sif->partner.state &= ~LACP_STATE_SYNCHRONIZATION;
- sif->partner.state |= LACP_STATE_LACP_TIMEOUT;
- lacp_ptx_post_short_timeout_event (vm, sif);
- if (lacp_timer_is_running (sif->current_while_timer) &&
- lacp_timer_is_expired (vm, sif->current_while_timer))
+ mif->partner.state &= ~LACP_STATE_SYNCHRONIZATION;
+ mif->partner.state |= LACP_STATE_LACP_TIMEOUT;
+ lacp_ptx_post_short_timeout_event (vm, mif);
+ if (lacp_timer_is_running (mif->current_while_timer) &&
+ lacp_timer_is_expired (vm, mif->current_while_timer))
timer_expired = 1;
else
timer_expired = 0;
- lacp_start_current_while_timer (vm, sif, sif->ttl_in_seconds);
- sif->actor.state |= LACP_STATE_EXPIRED;
+ lacp_start_current_while_timer (vm, mif, mif->ttl_in_seconds);
+ mif->actor.state |= LACP_STATE_EXPIRED;
if (timer_expired)
- lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
- LACP_RX_EVENT_TIMER_EXPIRED, &sif->rx_state);
- if (sif->last_rx_pkt && vec_len (sif->last_rx_pkt))
- lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
- LACP_RX_EVENT_PDU_RECEIVED, &sif->rx_state);
+ lacp_machine_dispatch (&lacp_rx_machine, vm, mif,
+ LACP_RX_EVENT_TIMER_EXPIRED, &mif->rx_state);
+ if (mif->last_rx_pkt && vec_len (mif->last_rx_pkt))
+ lacp_machine_dispatch (&lacp_rx_machine, vm, mif,
+ LACP_RX_EVENT_PDU_RECEIVED, &mif->rx_state);
return 0;
}
@@ -309,12 +309,12 @@ int
lacp_rx_action_lacp_disabled (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
+ member_if_t *mif = p2;
- lacp_set_port_unselected (vm, sif);
- lacp_record_default (sif);
- sif->partner.state &= ~LACP_STATE_AGGREGATION;
- sif->actor.state &= ~LACP_STATE_EXPIRED;
+ lacp_set_port_unselected (vm, mif);
+ lacp_record_default (mif);
+ mif->partner.state &= ~LACP_STATE_AGGREGATION;
+ mif->actor.state &= ~LACP_STATE_EXPIRED;
return 0;
}
@@ -323,33 +323,33 @@ int
lacp_rx_action_defaulted (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
+ member_if_t *mif = p2;
- lacp_stop_timer (&sif->current_while_timer);
- lacp_update_default_selected (vm, sif);
- lacp_record_default (sif);
- sif->actor.state &= ~LACP_STATE_EXPIRED;
- if (sif->last_rx_pkt && vec_len (sif->last_rx_pkt))
- lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
- LACP_RX_EVENT_PDU_RECEIVED, &sif->rx_state);
+ lacp_stop_timer (&mif->current_while_timer);
+ lacp_update_default_selected (vm, mif);
+ lacp_record_default (mif);
+ mif->actor.state &= ~LACP_STATE_EXPIRED;
+ if (mif->last_rx_pkt && vec_len (mif->last_rx_pkt))
+ lacp_machine_dispatch (&lacp_rx_machine, vm, mif,
+ LACP_RX_EVENT_PDU_RECEIVED, &mif->rx_state);
return 0;
}
static int
-lacp_port_is_moved (vlib_main_t * vm, slave_if_t * sif)
+lacp_port_is_moved (vlib_main_t * vm, member_if_t * mif)
{
bond_main_t *bm = &bond_main;
- slave_if_t *sif2;
- lacp_pdu_t *lacpdu = (lacp_pdu_t *) sif->last_rx_pkt;
+ member_if_t *mif2;
+ lacp_pdu_t *lacpdu = (lacp_pdu_t *) mif->last_rx_pkt;
/* *INDENT-OFF* */
- pool_foreach (sif2, bm->neighbors, {
+ pool_foreach (mif2, bm->neighbors, {
{
- if ((sif != sif2) && (sif2->rx_state == LACP_RX_STATE_PORT_DISABLED) &&
- !memcmp (sif2->partner.system,
+ if ((mif != mif2) && (mif2->rx_state == LACP_RX_STATE_PORT_DISABLED) &&
+ !memcmp (mif2->partner.system,
lacpdu->partner.port_info.system, 6) &&
- (sif2->partner.port_number == lacpdu->partner.port_info.port_number))
+ (mif2->partner.port_number == lacpdu->partner.port_info.port_number))
return 1;
}
});
@@ -362,16 +362,16 @@ int
lacp_rx_action_current (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
+ member_if_t *mif = p2;
- lacp_update_selected (vm, sif);
- lacp_update_ntt (vm, sif);
- lacp_record_pdu (vm, sif);
- lacp_start_current_while_timer (vm, sif, sif->ttl_in_seconds);
- sif->actor.state &= ~LACP_STATE_EXPIRED;
- if (lacp_port_is_moved (vm, sif))
- lacp_set_port_moved (vm, sif, 1);
- lacp_selection_logic (vm, sif);
+ lacp_update_selected (vm, mif);
+ lacp_update_ntt (vm, mif);
+ lacp_record_pdu (vm, mif);
+ lacp_start_current_while_timer (vm, mif, mif->ttl_in_seconds);
+ mif->actor.state &= ~LACP_STATE_EXPIRED;
+ if (lacp_port_is_moved (vm, mif))
+ lacp_set_port_moved (vm, mif, 1);
+ lacp_selection_logic (vm, mif);
return 0;
}
@@ -397,7 +397,7 @@ format_rx_event (u8 * s, va_list * args)
}
void
-lacp_rx_debug_func (slave_if_t * sif, int event, int state,
+lacp_rx_debug_func (member_if_t * mif, int event, int state,
lacp_fsm_state_t * transition)
{
vlib_worker_thread_t *w = vlib_worker_threads + os_get_thread_index ();
@@ -416,18 +416,18 @@ lacp_rx_debug_func (slave_if_t * sif, int event, int state,
ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);
ed->event = elog_string (&vlib_global_main.elog_main, "%U-RX: %U, %U->%U%c",
format_vnet_sw_if_index_name, vnet_get_main (),
- sif->sw_if_index, format_rx_event, event,
+ mif->sw_if_index, format_rx_event, event,
format_rx_sm_state, state, format_rx_sm_state,
transition->next_state, 0);
}
void
-lacp_init_rx_machine (vlib_main_t * vm, slave_if_t * sif)
+lacp_init_rx_machine (vlib_main_t * vm, member_if_t * mif)
{
- lacp_machine_dispatch (&lacp_rx_machine, vm, sif, LACP_RX_EVENT_BEGIN,
- &sif->rx_state);
- lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
- LACP_RX_EVENT_LACP_ENABLED, &sif->rx_state);
+ lacp_machine_dispatch (&lacp_rx_machine, vm, mif, LACP_RX_EVENT_BEGIN,
+ &mif->rx_state);
+ lacp_machine_dispatch (&lacp_rx_machine, vm, mif,
+ LACP_RX_EVENT_LACP_ENABLED, &mif->rx_state);
}
/*
diff --git a/src/plugins/lacp/rx_machine.h b/src/plugins/lacp/rx_machine.h
index 706dbd08c67..4642603379b 100644
--- a/src/plugins/lacp/rx_machine.h
+++ b/src/plugins/lacp/rx_machine.h
@@ -59,7 +59,7 @@ int lacp_rx_action_expired (void *, void *);
int lacp_rx_action_lacp_disabled (void *, void *);
int lacp_rx_action_defaulted (void *, void *);
int lacp_rx_action_current (void *, void *);
-void lacp_rx_debug_func (slave_if_t * sif, int event, int state,
+void lacp_rx_debug_func (member_if_t * mif, int event, int state,
lacp_fsm_state_t * transition);
#define LACP_ACTION_INITIALIZE \
@@ -74,10 +74,10 @@ void lacp_rx_debug_func (slave_if_t * sif, int event, int state,
#define LACP_ACTION_CURRENT LACP_ACTION_ROUTINE(lacp_rx_action_current)
static inline void
-lacp_start_current_while_timer (vlib_main_t * vm, slave_if_t * sif,
+lacp_start_current_while_timer (vlib_main_t * vm, member_if_t * mif,
u8 expiration)
{
- sif->current_while_timer = vlib_time_now (vm) + expiration;
+ mif->current_while_timer = vlib_time_now (vm) + expiration;
}
#endif /* __LACP_RX_MACHINE_H__ */
diff --git a/src/plugins/lacp/selection.c b/src/plugins/lacp/selection.c
index 898b6a95023..f3fb6b9faa4 100644
--- a/src/plugins/lacp/selection.c
+++ b/src/plugins/lacp/selection.c
@@ -20,27 +20,27 @@
#include <lacp/node.h>
static void
-lacp_set_port_selected (vlib_main_t * vm, slave_if_t * sif)
+lacp_set_port_selected (vlib_main_t * vm, member_if_t * mif)
{
/* Handle loopback port */
- if (!memcmp (sif->partner.system, sif->actor.system, 6) &&
- (sif->partner.key == sif->actor.key))
+ if (!memcmp (mif->partner.system, mif->actor.system, 6) &&
+ (mif->partner.key == mif->actor.key))
{
- sif->loopback_port = 1;
- sif->actor.state &= ~LACP_STATE_AGGREGATION;
+ mif->loopback_port = 1;
+ mif->actor.state &= ~LACP_STATE_AGGREGATION;
}
- sif->selected = LACP_PORT_SELECTED;
+ mif->selected = LACP_PORT_SELECTED;
- switch (sif->mux_state)
+ switch (mif->mux_state)
{
case LACP_MUX_STATE_DETACHED:
break;
case LACP_MUX_STATE_WAITING:
- if (!sif->ready)
+ if (!mif->ready)
return;
break;
case LACP_MUX_STATE_ATTACHED:
- if (!(sif->partner.state & LACP_STATE_SYNCHRONIZATION))
+ if (!(mif->partner.state & LACP_STATE_SYNCHRONIZATION))
return;
break;
case LACP_MUX_STATE_COLLECTING_DISTRIBUTING:
@@ -48,39 +48,39 @@ lacp_set_port_selected (vlib_main_t * vm, slave_if_t * sif)
default:
break;
}
- lacp_machine_dispatch (&lacp_mux_machine, vm, sif, LACP_MUX_EVENT_SELECTED,
- &sif->mux_state);
+ lacp_machine_dispatch (&lacp_mux_machine, vm, mif, LACP_MUX_EVENT_SELECTED,
+ &mif->mux_state);
}
void
-lacp_selection_logic (vlib_main_t * vm, slave_if_t * sif)
+lacp_selection_logic (vlib_main_t * vm, member_if_t * mif)
{
- slave_if_t *sif2;
+ member_if_t *mif2;
bond_if_t *bif;
u32 *sw_if_index;
- bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
- vec_foreach (sw_if_index, bif->slaves)
+ bif = bond_get_bond_if_by_dev_instance (mif->bif_dev_instance);
+ vec_foreach (sw_if_index, bif->members)
{
- sif2 = bond_get_slave_by_sw_if_index (*sw_if_index);
- if (sif2 && (sif2->actor.state & LACP_STATE_SYNCHRONIZATION) &&
- (sif2->ready_n == 0))
+ mif2 = bond_get_member_by_sw_if_index (*sw_if_index);
+ if (mif2 && (mif2->actor.state & LACP_STATE_SYNCHRONIZATION) &&
+ (mif2->ready_n == 0))
goto out;
}
- vec_foreach (sw_if_index, bif->slaves)
+ vec_foreach (sw_if_index, bif->members)
{
- sif2 = bond_get_slave_by_sw_if_index (*sw_if_index);
- if (sif2)
+ mif2 = bond_get_member_by_sw_if_index (*sw_if_index);
+ if (mif2)
{
- sif2->ready = 1;
- if (sif2->selected == LACP_PORT_SELECTED)
- lacp_machine_dispatch (&lacp_mux_machine, vm, sif2,
- LACP_MUX_EVENT_READY, &sif2->mux_state);
+ mif2->ready = 1;
+ if (mif2->selected == LACP_PORT_SELECTED)
+ lacp_machine_dispatch (&lacp_mux_machine, vm, mif2,
+ LACP_MUX_EVENT_READY, &mif2->mux_state);
}
}
out:
- lacp_set_port_selected (vm, sif);
+ lacp_set_port_selected (vm, mif);
}
/*
diff --git a/src/plugins/lacp/test/test_lacp.py b/src/plugins/lacp/test/test_lacp.py
index fa4b0a21ca9..b5f2dae2cd3 100644
--- a/src/plugins/lacp/test/test_lacp.py
+++ b/src/plugins/lacp/test/test_lacp.py
@@ -105,21 +105,21 @@ class TestMarker(VppTestCase):
bond1.add_vpp_config()
bond1.admin_up()
- bond0.enslave_vpp_bond_interface(sw_if_index=memif1.sw_if_index)
- bond1.enslave_vpp_bond_interface(sw_if_index=memif11.sw_if_index)
+ bond0.add_member_vpp_bond_interface(sw_if_index=memif1.sw_if_index)
+ bond1.add_member_vpp_bond_interface(sw_if_index=memif11.sw_if_index)
# wait for memif protocol exchange and hardware carrier to come up
self.assertEqual(memif1.wait_for_link_up(10), True)
self.assertEqual(memif11.wait_for_link_up(10), True)
# verify memif1 in bond0
- intfs = self.vapi.sw_interface_slave_dump(
+ intfs = self.vapi.sw_member_interface_dump(
sw_if_index=bond0.sw_if_index)
for intf in intfs:
self.assertEqual(intf.sw_if_index, memif1.sw_if_index)
# verify memif11 in bond1
- intfs = self.vapi.sw_interface_slave_dump(
+ intfs = self.vapi.sw_member_interface_dump(
sw_if_index=bond1.sw_if_index)
for intf in intfs:
self.assertEqual(intf.sw_if_index, memif11.sw_if_index)
@@ -134,7 +134,7 @@ class TestMarker(VppTestCase):
requester_system=bond_mac,
requester_transaction_id=1))
- bond1.enslave_vpp_bond_interface(sw_if_index=self.pg0.sw_if_index)
+ bond1.add_member_vpp_bond_interface(sw_if_index=self.pg0.sw_if_index)
self.pg0.add_stream(marker)
self.pg_enable_capture(self.pg_interfaces)
self.pg_start()
@@ -185,19 +185,19 @@ class TestLACP(VppTestCase):
if timeout <= 0:
return 0
- def wait_for_slave_detach(self, bond, timeout, count, step=1):
+ def wait_for_member_detach(self, bond, timeout, count, step=1):
while 1:
- intfs = self.vapi.sw_interface_bond_dump()
+ intfs = self.vapi.sw_bond_interface_dump(
+ sw_if_index=bond.sw_if_index)
for intf in intfs:
- if (bond.sw_if_index == intf.sw_if_index):
- if ((intf.slaves == count) and
- (intf.active_slaves == count)):
- return 1
- else:
- self.sleep(1)
- timeout -= step
- if (timeouut <= 0):
- return 0
+ if ((intf.members == count) and
+ (intf.active_members == count)):
+ return 1
+ else:
+ self.sleep(1)
+ timeout -= step
+ if (timeouut <= 0):
+ return 0
def test_lacp_connect(self):
""" LACP protocol connect test """
@@ -284,13 +284,13 @@ class TestLACP(VppTestCase):
bond1.add_vpp_config()
bond1.admin_up()
- # enslave memif1 and memif2 to bond0
- bond0.enslave_vpp_bond_interface(sw_if_index=memif1.sw_if_index)
- bond0.enslave_vpp_bond_interface(sw_if_index=memif2.sw_if_index)
+ # add member memif1 and memif2 to bond0
+ bond0.add_member_vpp_bond_interface(sw_if_index=memif1.sw_if_index)
+ bond0.add_member_vpp_bond_interface(sw_if_index=memif2.sw_if_index)
- # enslave memif11 and memif12 to bond1
- bond1.enslave_vpp_bond_interface(sw_if_index=memif11.sw_if_index)
- bond1.enslave_vpp_bond_interface(sw_if_index=memif12.sw_if_index)
+ # add member memif11 and memif12 to bond1
+ bond1.add_member_vpp_bond_interface(sw_if_index=memif11.sw_if_index)
+ bond1.add_member_vpp_bond_interface(sw_if_index=memif12.sw_if_index)
# wait for memif protocol exchange and hardware carrier to come up
self.assertEqual(memif1.wait_for_link_up(10), True)
@@ -299,14 +299,14 @@ class TestLACP(VppTestCase):
self.assertEqual(memif12.wait_for_link_up(10), True)
# verify memif1 and memif2 in bond0
- intfs = self.vapi.sw_interface_slave_dump(
+ intfs = self.vapi.sw_member_interface_dump(
sw_if_index=bond0.sw_if_index)
for intf in intfs:
self.assertIn(
intf.sw_if_index, (memif1.sw_if_index, memif2.sw_if_index))
# verify memif11 and memif12 in bond1
- intfs = self.vapi.sw_interface_slave_dump(
+ intfs = self.vapi.sw_member_interface_dump(
sw_if_index=bond1.sw_if_index)
for intf in intfs:
self.assertIn(
@@ -324,37 +324,37 @@ class TestLACP(VppTestCase):
self.assertEqual(
intf.partner_state, LACP_COLLECTION_AND_DISTRIBUTION_STATE)
- intfs = self.vapi.sw_interface_bond_dump()
+ intfs = self.vapi.sw_bond_interface_dump(sw_if_index=0xFFFFFFFF)
for intf in intfs:
- self.assertEqual(intf.slaves, 2)
- self.assertEqual(intf.active_slaves, 2)
+ self.assertEqual(intf.members, 2)
+ self.assertEqual(intf.active_members, 2)
self.assertEqual(
intf.mode, VppEnum.vl_api_bond_mode_t.BOND_API_MODE_LACP)
self.logger.info(self.vapi.ppcli("show lacp"))
self.logger.info(self.vapi.ppcli("show lacp details"))
- # detach slave memif1
+ # detach member memif1
bond0.detach_vpp_bond_interface(sw_if_index=memif1.sw_if_index)
- self.wait_for_slave_detach(bond0, timeout=10, count=1)
- intfs = self.vapi.sw_interface_bond_dump()
+ self.wait_for_member_detach(bond0, timeout=10, count=1)
+ intfs = self.vapi.sw_bond_interface_dump(
+ sw_if_index=bond0.sw_if_index)
for intf in intfs:
- if (bond0.sw_if_index == intf.sw_if_index):
- self.assertEqual(intf.slaves, 1)
- self.assertEqual(intf.active_slaves, 1)
- self.assertEqual(
- intf.mode, VppEnum.vl_api_bond_mode_t.BOND_API_MODE_LACP)
+ self.assertEqual(intf.members, 1)
+ self.assertEqual(intf.active_members, 1)
+ self.assertEqual(
+ intf.mode, VppEnum.vl_api_bond_mode_t.BOND_API_MODE_LACP)
- # detach slave memif2
+ # detach member memif2
bond0.detach_vpp_bond_interface(sw_if_index=memif2.sw_if_index)
- self.wait_for_slave_detach(bond0, timeout=10, count=0)
+ self.wait_for_member_detach(bond0, timeout=10, count=0)
- intfs = self.vapi.sw_interface_bond_dump()
+ intfs = self.vapi.sw_bond_interface_dump(
+ sw_if_index=bond0.sw_if_index)
for intf in intfs:
- if (bond0.sw_if_index == intf.sw_if_index):
- self.assertEqual(intf.slaves, 0)
- self.assertEqual(intf.active_slaves, 0)
+ self.assertEqual(intf.members, 0)
+ self.assertEqual(intf.active_members, 0)
bond0.remove_vpp_config()
bond1.remove_vpp_config()
diff --git a/src/plugins/lacp/tx_machine.c b/src/plugins/lacp/tx_machine.c
index 3377da86422..1eb3bc1c4b7 100644
--- a/src/plugins/lacp/tx_machine.c
+++ b/src/plugins/lacp/tx_machine.c
@@ -39,22 +39,22 @@ int
lacp_tx_action_transmit (void *p1, void *p2)
{
vlib_main_t *vm = p1;
- slave_if_t *sif = p2;
+ member_if_t *mif = p2;
f64 now = vlib_time_now (vm);
- if (!lacp_timer_is_running (sif->periodic_timer))
+ if (!lacp_timer_is_running (mif->periodic_timer))
return 0;
// No more than 3 LACPDUs per fast interval
- if (now <= (sif->last_lacpdu_sent_time + 0.333))
+ if (now <= (mif->last_lacpdu_sent_time + 0.333))
return 0;
- if (sif->ntt)
+ if (mif->ntt)
{
- lacp_send_lacp_pdu (vm, sif);
- lacp_schedule_periodic_timer (vm, sif);
+ lacp_send_lacp_pdu (vm, mif);
+ lacp_schedule_periodic_timer (vm, mif);
}
- sif->ntt = 0;
+ mif->ntt = 0;
return 0;
}
@@ -80,7 +80,7 @@ format_tx_event (u8 * s, va_list * args)
}
void
-lacp_tx_debug_func (slave_if_t * sif, int event, int state,
+lacp_tx_debug_func (member_if_t * mif, int event, int state,
lacp_fsm_state_t * transition)
{
vlib_worker_thread_t *w = vlib_worker_threads + os_get_thread_index ();
@@ -99,16 +99,16 @@ lacp_tx_debug_func (slave_if_t * sif, int event, int state,
ed = ELOG_TRACK_DATA (&vlib_global_main.elog_main, e, w->elog_track);
ed->event = elog_string (&vlib_global_main.elog_main, "%U-TX: %U, %U->%U%c",
format_vnet_sw_if_index_name, vnet_get_main (),
- sif->sw_if_index, format_tx_event, event,
+ mif->sw_if_index, format_tx_event, event,
format_tx_sm_state, state, format_tx_sm_state,
transition->next_state, 0);
}
void
-lacp_init_tx_machine (vlib_main_t * vm, slave_if_t * sif)
+lacp_init_tx_machine (vlib_main_t * vm, member_if_t * mif)
{
- lacp_machine_dispatch (&lacp_tx_machine, vm, sif, LACP_TX_EVENT_BEGIN,
- &sif->tx_state);
+ lacp_machine_dispatch (&lacp_tx_machine, vm, mif, LACP_TX_EVENT_BEGIN,
+ &mif->tx_state);
}
/*
diff --git a/src/plugins/lacp/tx_machine.h b/src/plugins/lacp/tx_machine.h
index 428c19b5edd..5e87aed4e6d 100644
--- a/src/plugins/lacp/tx_machine.h
+++ b/src/plugins/lacp/tx_machine.h
@@ -43,7 +43,7 @@ typedef enum
extern lacp_machine_t lacp_tx_machine;
int lacp_tx_action_transmit (void *p1, void *p2);
-void lacp_tx_debug_func (slave_if_t * sif, int event, int state,
+void lacp_tx_debug_func (member_if_t * mif, int event, int state,
lacp_fsm_state_t * transition);
#define LACP_ACTION_TRANSMIT LACP_ACTION_ROUTINE(lacp_tx_action_transmit)
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index d95fb8e9ee0..cc0f5bef8e4 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -1930,7 +1930,7 @@ static void vl_api_bond_delete_reply_t_handler_json
}
static void
-vl_api_bond_enslave_reply_t_handler (vl_api_bond_enslave_reply_t * mp)
+vl_api_bond_add_member_reply_t_handler (vl_api_bond_add_member_reply_t * mp)
{
vat_main_t *vam = &vat_main;
i32 retval = ntohl (mp->retval);
@@ -1946,8 +1946,8 @@ vl_api_bond_enslave_reply_t_handler (vl_api_bond_enslave_reply_t * mp)
}
}
-static void vl_api_bond_enslave_reply_t_handler_json
- (vl_api_bond_enslave_reply_t * mp)
+static void vl_api_bond_add_member_reply_t_handler_json
+ (vl_api_bond_add_member_reply_t * mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t node;
@@ -1963,8 +1963,8 @@ static void vl_api_bond_enslave_reply_t_handler_json
}
static void
-vl_api_bond_detach_slave_reply_t_handler (vl_api_bond_detach_slave_reply_t *
- mp)
+vl_api_bond_detach_member_reply_t_handler (vl_api_bond_detach_member_reply_t *
+ mp)
{
vat_main_t *vam = &vat_main;
i32 retval = ntohl (mp->retval);
@@ -1980,8 +1980,8 @@ vl_api_bond_detach_slave_reply_t_handler (vl_api_bond_detach_slave_reply_t *
}
}
-static void vl_api_bond_detach_slave_reply_t_handler_json
- (vl_api_bond_detach_slave_reply_t * mp)
+static void vl_api_bond_detach_member_reply_t_handler_json
+ (vl_api_bond_detach_member_reply_t * mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t node;
@@ -2039,8 +2039,8 @@ api_sw_interface_set_bond_weight (vat_main_t * vam)
return ret;
}
-static void vl_api_sw_interface_bond_details_t_handler
- (vl_api_sw_interface_bond_details_t * mp)
+static void vl_api_sw_bond_interface_details_t_handler
+ (vl_api_sw_bond_interface_details_t * mp)
{
vat_main_t *vam = &vat_main;
@@ -2048,11 +2048,11 @@ static void vl_api_sw_interface_bond_details_t_handler
"%-16s %-12d %-12U %-13U %-14u %-14u",
mp->interface_name, ntohl (mp->sw_if_index),
format_bond_mode, ntohl (mp->mode), format_bond_load_balance,
- ntohl (mp->lb), ntohl (mp->active_slaves), ntohl (mp->slaves));
+ ntohl (mp->lb), ntohl (mp->active_members), ntohl (mp->members));
}
-static void vl_api_sw_interface_bond_details_t_handler_json
- (vl_api_sw_interface_bond_details_t * mp)
+static void vl_api_sw_bond_interface_details_t_handler_json
+ (vl_api_sw_bond_interface_details_t * mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t *node = NULL;
@@ -2070,24 +2070,38 @@ static void vl_api_sw_interface_bond_details_t_handler_json
mp->interface_name);
vat_json_object_add_uint (node, "mode", ntohl (mp->mode));
vat_json_object_add_uint (node, "load_balance", ntohl (mp->lb));
- vat_json_object_add_uint (node, "active_slaves", ntohl (mp->active_slaves));
- vat_json_object_add_uint (node, "slaves", ntohl (mp->slaves));
+ vat_json_object_add_uint (node, "active_members",
+ ntohl (mp->active_members));
+ vat_json_object_add_uint (node, "members", ntohl (mp->members));
}
static int
-api_sw_interface_bond_dump (vat_main_t * vam)
+api_sw_bond_interface_dump (vat_main_t * vam)
{
- vl_api_sw_interface_bond_dump_t *mp;
+ unformat_input_t *i = vam->input;
+ vl_api_sw_bond_interface_dump_t *mp;
vl_api_control_ping_t *mp_ping;
int ret;
+ u32 sw_if_index = ~0;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+ ;
+ else if (unformat (i, "sw_if_index %d", &sw_if_index))
+ ;
+ else
+ break;
+ }
print (vam->ofp,
"\n%-16s %-12s %-12s %-13s %-14s %-14s",
"interface name", "sw_if_index", "mode", "load balance",
- "active slaves", "slaves");
+ "active members", "members");
/* Get list of bond interfaces */
- M (SW_INTERFACE_BOND_DUMP, mp);
+ M (SW_BOND_INTERFACE_DUMP, mp);
+ mp->sw_if_index = ntohl (sw_if_index);
S (mp);
/* Use a control ping for synchronization */
@@ -2098,8 +2112,8 @@ api_sw_interface_bond_dump (vat_main_t * vam)
return ret;
}
-static void vl_api_sw_interface_slave_details_t_handler
- (vl_api_sw_interface_slave_details_t * mp)
+static void vl_api_sw_member_interface_details_t_handler
+ (vl_api_sw_member_interface_details_t * mp)
{
vat_main_t *vam = &vat_main;
@@ -2109,8 +2123,8 @@ static void vl_api_sw_interface_slave_details_t_handler
ntohl (mp->weight), mp->is_local_numa);
}
-static void vl_api_sw_interface_slave_details_t_handler_json
- (vl_api_sw_interface_slave_details_t * mp)
+static void vl_api_sw_member_interface_details_t_handler_json
+ (vl_api_sw_member_interface_details_t * mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t *node = NULL;
@@ -2133,10 +2147,10 @@ static void vl_api_sw_interface_slave_details_t_handler_json
}
static int
-api_sw_interface_slave_dump (vat_main_t * vam)
+api_sw_member_interface_dump (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
- vl_api_sw_interface_slave_dump_t *mp;
+ vl_api_sw_member_interface_dump_t *mp;
vl_api_control_ping_t *mp_ping;
u32 sw_if_index = ~0;
u8 sw_if_index_set = 0;
@@ -2161,11 +2175,11 @@ api_sw_interface_slave_dump (vat_main_t * vam)
print (vam->ofp,
"\n%-25s %-12s %-7s %-12s %-10s %-10s",
- "slave interface name", "sw_if_index", "passive", "long_timeout",
+ "member interface name", "sw_if_index", "passive", "long_timeout",
"weight", "local numa");
/* Get list of bond interfaces */
- M (SW_INTERFACE_SLAVE_DUMP, mp);
+ M (SW_MEMBER_INTERFACE_DUMP, mp);
mp->sw_if_index = ntohl (sw_if_index);
S (mp);
@@ -5230,11 +5244,11 @@ _(VIRTIO_PCI_DELETE_REPLY, virtio_pci_delete_reply) \
_(SW_INTERFACE_VIRTIO_PCI_DETAILS, sw_interface_virtio_pci_details) \
_(BOND_CREATE_REPLY, bond_create_reply) \
_(BOND_DELETE_REPLY, bond_delete_reply) \
-_(BOND_ENSLAVE_REPLY, bond_enslave_reply) \
-_(BOND_DETACH_SLAVE_REPLY, bond_detach_slave_reply) \
+_(BOND_ADD_MEMBER_REPLY, bond_add_member_reply) \
+_(BOND_DETACH_MEMBER_REPLY, bond_detach_member_reply) \
_(SW_INTERFACE_SET_BOND_WEIGHT_REPLY, sw_interface_set_bond_weight_reply) \
-_(SW_INTERFACE_BOND_DETAILS, sw_interface_bond_details) \
-_(SW_INTERFACE_SLAVE_DETAILS, sw_interface_slave_details) \
+_(SW_BOND_INTERFACE_DETAILS, sw_bond_interface_details) \
+_(SW_MEMBER_INTERFACE_DETAILS, sw_member_interface_details) \
_(IP_ROUTE_ADD_DEL_REPLY, ip_route_add_del_reply) \
_(IP_TABLE_ADD_DEL_REPLY, ip_table_add_del_reply) \
_(IP_TABLE_REPLACE_BEGIN_REPLY, ip_table_replace_begin_reply) \
@@ -7747,10 +7761,10 @@ api_bond_delete (vat_main_t * vam)
}
static int
-api_bond_enslave (vat_main_t * vam)
+api_bond_add_member (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
- vl_api_bond_enslave_t *mp;
+ vl_api_bond_add_member_t *mp;
u32 bond_sw_if_index;
int ret;
u8 is_passive;
@@ -7781,12 +7795,12 @@ api_bond_enslave (vat_main_t * vam)
}
if (sw_if_index_is_set == 0)
{
- errmsg ("Missing slave sw_if_index. ");
+ errmsg ("Missing member sw_if_index. ");
return -99;
}
/* Construct the API message */
- M (BOND_ENSLAVE, mp);
+ M (BOND_ADD_MEMBER, mp);
mp->bond_sw_if_index = ntohl (bond_sw_if_index);
mp->sw_if_index = ntohl (sw_if_index);
@@ -7802,10 +7816,10 @@ api_bond_enslave (vat_main_t * vam)
}
static int
-api_bond_detach_slave (vat_main_t * vam)
+api_bond_detach_member (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
- vl_api_bond_detach_slave_t *mp;
+ vl_api_bond_detach_member_t *mp;
u32 sw_if_index = ~0;
u8 sw_if_index_set = 0;
int ret;
@@ -7828,7 +7842,7 @@ api_bond_detach_slave (vat_main_t * vam)
}
/* Construct the API message */
- M (BOND_DETACH_SLAVE, mp);
+ M (BOND_DETACH_MEMBER, mp);
mp->sw_if_index = ntohl (sw_if_index);
@@ -20618,13 +20632,13 @@ _(bond_create, \
"[id <if-id>]") \
_(bond_delete, \
"<vpp-if-name> | sw_if_index <id>") \
-_(bond_enslave, \
+_(bond_add_member, \
"sw_if_index <n> bond <sw_if_index> [is_passive] [is_long_timeout]") \
-_(bond_detach_slave, \
+_(bond_detach_member, \
"sw_if_index <n>") \
_(sw_interface_set_bond_weight, "<intfc> | sw_if_index <nn> weight <value>") \
-_(sw_interface_bond_dump, "") \
-_(sw_interface_slave_dump, \
+ _(sw_bond_interface_dump, "<intfc> | sw_if_index <nn>") \
+ _(sw_member_interface_dump, \
"<vpp-if-name> | sw_if_index <id>") \
_(ip_table_add_del, \
"table <n> [ipv6] [add | del]\n") \
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__ */
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index be6b094913b..451f263b70e 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -695,12 +695,12 @@ static void *vl_api_bond_delete_t_print
FINISH;
}
-static void *vl_api_bond_enslave_t_print
- (vl_api_bond_enslave_t * mp, void *handle)
+static void *vl_api_bond_add_member_t_print
+ (vl_api_bond_add_member_t * mp, void *handle)
{
u8 *s;
- s = format (0, "SCRIPT: bond_enslave ");
+ s = format (0, "SCRIPT: bond_add_member ");
s = format (s, "bond_sw_if_index %u ", (mp->bond_sw_if_index));
s = format (s, "sw_if_index %u ", (mp->sw_if_index));
if (mp->is_passive)
@@ -723,33 +723,35 @@ static void *vl_api_sw_interface_set_bond_weight_t_print
FINISH;
}
-static void *vl_api_bond_detach_slave_t_print
- (vl_api_bond_detach_slave_t * mp, void *handle)
+static void *vl_api_bond_detach_member_t_print
+ (vl_api_bond_detach_member_t * mp, void *handle)
{
u8 *s;
- s = format (0, "SCRIPT: bond_detach_slave ");
+ s = format (0, "SCRIPT: bond_detach_member ");
s = format (s, "sw_if_index %d ", (mp->sw_if_index));
FINISH;
}
-static void *vl_api_sw_interface_bond_dump_t_print
- (vl_api_sw_interface_bond_dump_t * mp, void *handle)
+static void *vl_api_sw_bond_interface_dump_t_print
+ (vl_api_sw_bond_interface_dump_t * mp, void *handle)
{
u8 *s;
- s = format (0, "SCRIPT: sw_interface_bond_dump ");
+ s = format (0, "SCRIPT: sw_bond_interface_dump ");
+ if (mp->sw_if_index != ~0)
+ s = format (s, "sw_if_index %d ", (mp->sw_if_index));
FINISH;
}
-static void *vl_api_sw_interface_slave_dump_t_print
- (vl_api_sw_interface_slave_dump_t * mp, void *handle)
+static void *vl_api_sw_member_interface_dump_t_print
+ (vl_api_sw_member_interface_dump_t * mp, void *handle)
{
u8 *s;
- s = format (0, "SCRIPT: sw_interface_slave_dump ");
+ s = format (0, "SCRIPT: sw_member_interface_dump ");
s = format (s, "sw_if_index %d ", (mp->sw_if_index));
FINISH;
@@ -3543,11 +3545,11 @@ _(SW_INTERFACE_SET_VXLAN_BYPASS, sw_interface_set_vxlan_bypass) \
_(SW_INTERFACE_SET_GENEVE_BYPASS, sw_interface_set_geneve_bypass) \
_(BOND_CREATE, bond_create) \
_(BOND_DELETE, bond_delete) \
-_(BOND_ENSLAVE, bond_enslave) \
-_(BOND_DETACH_SLAVE, bond_detach_slave) \
+_(BOND_ADD_MEMBER, bond_add_member) \
+_(BOND_DETACH_MEMBER, bond_detach_member) \
_(SW_INTERFACE_SET_BOND_WEIGHT, sw_interface_set_bond_weight) \
-_(SW_INTERFACE_SLAVE_DUMP, sw_interface_slave_dump) \
-_(SW_INTERFACE_BOND_DUMP, sw_interface_bond_dump) \
+_(SW_MEMBER_INTERFACE_DUMP, sw_member_interface_dump) \
+_(SW_BOND_INTERFACE_DUMP, sw_bond_interface_dump) \
_(SW_INTERFACE_RX_PLACEMENT_DUMP, sw_interface_rx_placement_dump) \
_(TAP_CREATE_V2, tap_create_v2) \
_(TAP_DELETE_V2, tap_delete_v2) \
diff --git a/test/test_bond.py b/test/test_bond.py
index dd4a6453977..911b1fb4deb 100644
--- a/test/test_bond.py
+++ b/test/test_bond.py
@@ -51,11 +51,11 @@ class TestBondInterface(VppTestCase):
#
# RX-> TX->
#
- # pg2 ------+ +------pg0 (slave)
+ # pg2 ------+ +------pg0 (member)
# | |
# BondEthernet0 (10.10.10.1)
# | |
- # pg3 ------+ +------pg1 (slave)
+ # pg3 ------+ +------pg1 (memberx)
#
# create interface (BondEthernet0)
@@ -83,14 +83,14 @@ class TestBondInterface(VppTestCase):
self.logger.info(self.vapi.cli("show interface address"))
self.logger.info(self.vapi.cli("show ip neighbors"))
- # enslave pg0 and pg1 to BondEthernet0
- self.logger.info("bond enslave interface pg0 to BondEthernet0")
- bond0.enslave_vpp_bond_interface(sw_if_index=self.pg0.sw_if_index)
- self.logger.info("bond enslave interface pg1 to BondEthernet0")
- bond0.enslave_vpp_bond_interface(sw_if_index=self.pg1.sw_if_index)
+ # add member pg0 and pg1 to BondEthernet0
+ self.logger.info("bond add member interface pg0 to BondEthernet0")
+ bond0.add_member_vpp_bond_interface(sw_if_index=self.pg0.sw_if_index)
+ self.logger.info("bond add_member interface pg1 to BondEthernet0")
+ bond0.add_member_vpp_bond_interface(sw_if_index=self.pg1.sw_if_index)
- # verify both slaves in BondEthernet0
- if_dump = self.vapi.sw_interface_slave_dump(bond0.sw_if_index)
+ # verify both members in BondEthernet0
+ if_dump = self.vapi.sw_member_interface_dump(bond0.sw_if_index)
self.assertTrue(self.pg0.is_interface_config_in_dump(if_dump))
self.assertTrue(self.pg1.is_interface_config_in_dump(if_dump))
@@ -163,8 +163,8 @@ class TestBondInterface(VppTestCase):
bond0.remove_vpp_config()
- def test_bond_enslave(self):
- """ Bond enslave/detach slave test """
+ def test_bond_add_member(self):
+ """ Bond add_member/detach member test """
# create interface (BondEthernet0) and set bond mode to LACP
self.logger.info("create bond")
@@ -172,25 +172,27 @@ class TestBondInterface(VppTestCase):
bond0.add_vpp_config()
bond0.admin_up()
- # verify that interfaces can be enslaved and detached two times
+ # verify that interfaces can be added as_member and detached two times
for i in range(2):
# verify pg0 and pg1 not in BondEthernet0
- if_dump = self.vapi.sw_interface_slave_dump(bond0.sw_if_index)
+ if_dump = self.vapi.sw_member_interface_dump(bond0.sw_if_index)
self.assertFalse(self.pg0.is_interface_config_in_dump(if_dump))
self.assertFalse(self.pg1.is_interface_config_in_dump(if_dump))
- # enslave pg0 and pg1 to BondEthernet0
- self.logger.info("bond enslave interface pg0 to BondEthernet0")
- bond0.enslave_vpp_bond_interface(sw_if_index=self.pg0.sw_if_index,
- is_passive=0,
- is_long_timeout=0)
-
- self.logger.info("bond enslave interface pg1 to BondEthernet0")
- bond0.enslave_vpp_bond_interface(sw_if_index=self.pg1.sw_if_index,
- is_passive=0,
- is_long_timeout=0)
- # verify both slaves in BondEthernet0
- if_dump = self.vapi.sw_interface_slave_dump(bond0.sw_if_index)
+ # add_member pg0 and pg1 to BondEthernet0
+ self.logger.info("bond add_member interface pg0 to BondEthernet0")
+ bond0.add_member_vpp_bond_interface(
+ sw_if_index=self.pg0.sw_if_index,
+ is_passive=0,
+ is_long_timeout=0)
+
+ self.logger.info("bond add_member interface pg1 to BondEthernet0")
+ bond0.add_member_vpp_bond_interface(
+ sw_if_index=self.pg1.sw_if_index,
+ is_passive=0,
+ is_long_timeout=0)
+ # verify both members in BondEthernet0
+ if_dump = self.vapi.sw_member_interface_dump(bond0.sw_if_index)
self.assertTrue(self.pg0.is_interface_config_in_dump(if_dump))
self.assertTrue(self.pg1.is_interface_config_in_dump(if_dump))
@@ -199,7 +201,7 @@ class TestBondInterface(VppTestCase):
bond0.detach_vpp_bond_interface(sw_if_index=self.pg0.sw_if_index)
# verify pg0 is not in BondEthernet0, but pg1 is
- if_dump = self.vapi.sw_interface_slave_dump(bond0.sw_if_index)
+ if_dump = self.vapi.sw_member_interface_dump(bond0.sw_if_index)
self.assertFalse(self.pg0.is_interface_config_in_dump(if_dump))
self.assertTrue(self.pg1.is_interface_config_in_dump(if_dump))
@@ -208,7 +210,7 @@ class TestBondInterface(VppTestCase):
bond0.detach_vpp_bond_interface(sw_if_index=self.pg1.sw_if_index)
# verify pg0 and pg1 not in BondEthernet0
- if_dump = self.vapi.sw_interface_slave_dump(bond0.sw_if_index)
+ if_dump = self.vapi.sw_member_interface_dump(bond0.sw_if_index)
self.assertFalse(self.pg0.is_interface_config_in_dump(if_dump))
self.assertFalse(self.pg1.is_interface_config_in_dump(if_dump))
@@ -234,7 +236,7 @@ class TestBondInterface(VppTestCase):
self.assertIn('BondEthernet1', ifs)
# verify they are in the dump also
- if_dump = self.vapi.sw_interface_bond_dump()
+ if_dump = self.vapi.sw_bond_interface_dump(sw_if_index=0xFFFFFFFF)
self.assertTrue(bond0.is_interface_config_in_dump(if_dump))
self.assertTrue(bond1.is_interface_config_in_dump(if_dump))
@@ -252,7 +254,7 @@ class TestBondInterface(VppTestCase):
self.assertNotIn('BondEthernet1', ifs)
# verify BondEthernet1 is not in the dump
- if_dump = self.vapi.sw_interface_bond_dump()
+ if_dump = self.vapi.sw_bond_interface_dump(sw_if_index=0xFFFFFFFF)
self.assertFalse(bond1.is_interface_config_in_dump(if_dump))
# verify BondEthernet0 is still in the dump
@@ -269,7 +271,8 @@ class TestBondInterface(VppTestCase):
self.assertNotIn('BondEthernet0', ifs)
# verify BondEthernet0 is not in the dump
- if_dump = self.vapi.sw_interface_bond_dump()
+ if_dump = self.vapi.sw_bond_interface_dump(
+ sw_if_index=bond0.sw_if_index)
self.assertFalse(bond0.is_interface_config_in_dump(if_dump))
diff --git a/test/vpp_bond_interface.py b/test/vpp_bond_interface.py
index 0db04e135b1..8ad7bceac70 100644
--- a/test/vpp_bond_interface.py
+++ b/test/vpp_bond_interface.py
@@ -27,18 +27,18 @@ class VppBondInterface(VppInterface):
def remove_vpp_config(self):
self.test.vapi.bond_delete(self.sw_if_index)
- def enslave_vpp_bond_interface(self,
- sw_if_index,
- is_passive=0,
- is_long_timeout=0):
- self.test.vapi.bond_enslave(sw_if_index,
- self.sw_if_index,
- is_passive,
- is_long_timeout)
+ def add_member_vpp_bond_interface(self,
+ sw_if_index,
+ is_passive=0,
+ is_long_timeout=0):
+ self.test.vapi.bond_add_member(sw_if_index,
+ self.sw_if_index,
+ is_passive,
+ is_long_timeout)
def detach_vpp_bond_interface(self,
sw_if_index):
- self.test.vapi.bond_detach_slave(sw_if_index)
+ self.test.vapi.bond_detach_member(sw_if_index)
def is_interface_config_in_dump(self, dump):
for i in dump: