aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp
diff options
context:
space:
mode:
authorSteven <sluong@cisco.com>2017-12-20 12:43:01 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2018-03-21 21:02:15 +0000
commit9cd2d7a5a4fafadb65d772c48109d55d1e19d425 (patch)
tree4a9e0665be0096ee6bfc2235388f90b276b23814 /src/vpp
parent43ebe29b6ea1107c30311cfb3dbd8190282903d0 (diff)
bond: Add bonding driver and LACP protocol
Add bonding driver to support creation of bond interface which composes of multiple slave interfaces. The slave interfaces could be physical interfaces, or just any virtual interfaces. For example, memif interfaces. The syntax to create a bond interface is create bond mode <lacp | xor | acitve-backup | broadcast | round-robin> To enslave an interface to the bond interface, enslave interface TenGigabitEthernet6/0/0 to BondEthernet0 Please see src/plugins/lacp/lacp_doc.md for more examples and additional options. LACP is a control plane protocol which manages and monitors the status of the slave interfaces. The protocol is part of 802.3ad standard. This patch implements LACPv1. LACPv2 is not supported. To enable LACP on the bond interface, specify "mode lacp" when the bond interface is created. The syntax to enslave a slave interface is the same as other bonding modes. Change-Id: I06581d3b87635972f9f0e1ec50b67560fc13e26c Signed-off-by: Steven <sluong@cisco.com>
Diffstat (limited to 'src/vpp')
-rw-r--r--src/vpp/api/custom_dump.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index 28f16d2fe67..ded6e7de337 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -47,6 +47,8 @@
#include <vpp/api/vpe_msg_enum.h>
+#include <vnet/bonding/node.h>
+
#define vl_typedefs /* define message structures */
#include <vpp/api/vpe_all_api_h.h>
#undef vl_typedefs
@@ -609,6 +611,84 @@ static void *vl_api_sw_interface_tap_v2_dump_t_print
FINISH;
}
+static void *vl_api_bond_create_t_print
+ (vl_api_bond_create_t * mp, void *handle)
+{
+ u8 *s;
+ u8 null_mac[6];
+
+ memset (null_mac, 0, sizeof (null_mac));
+
+ s = format (0, "SCRIPT: bond_create ");
+ if (memcmp (mp->mac_address, null_mac, 6))
+ s = format (s, "mac-address %U ",
+ format_ethernet_address, mp->mac_address);
+ if (mp->mode)
+ s = format (s, "mode %U", format_bond_mode, mp->mode);
+ if (mp->lb)
+ s = format (s, "lb %U", format_bond_load_balance, mp->lb);
+ FINISH;
+}
+
+static void *vl_api_bond_delete_t_print
+ (vl_api_bond_delete_t * mp, void *handle)
+{
+ u8 *s;
+
+ s = format (0, "SCRIPT: bond_delete ");
+ s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
+
+ FINISH;
+}
+
+static void *vl_api_bond_enslave_t_print
+ (vl_api_bond_enslave_t * mp, void *handle)
+{
+ u8 *s;
+
+ s = format (0, "SCRIPT: bond_enslave ");
+ 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)
+ s = format (s, "passive ");
+ if (mp->is_long_timeout)
+ s = format (s, "long-timeout ");
+
+ FINISH;
+}
+
+static void *vl_api_bond_detach_slave_t_print
+ (vl_api_bond_detach_slave_t * mp, void *handle)
+{
+ u8 *s;
+
+ s = format (0, "SCRIPT: bond_detach_slave ");
+ s = format (s, "sw_if_index %d ", ntohl (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)
+{
+ u8 *s;
+
+ s = format (0, "SCRIPT: sw_interface_bond_dump ");
+
+ FINISH;
+}
+
+static void *vl_api_sw_interface_slave_dump_t_print
+ (vl_api_sw_interface_slave_dump_t * mp, void *handle)
+{
+ u8 *s;
+
+ s = format (0, "SCRIPT: sw_interface_slave_dump ");
+ s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
+
+ FINISH;
+}
+
static void *vl_api_ip_add_del_route_t_print
(vl_api_ip_add_del_route_t * mp, void *handle)
{
@@ -3357,6 +3437,10 @@ _(TAP_CONNECT, tap_connect) \
_(TAP_MODIFY, tap_modify) \
_(TAP_DELETE, tap_delete) \
_(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump) \
+_(BOND_CREATE, bond_create) \
+_(BOND_DELETE, bond_delete) \
+_(BOND_ENSLAVE, bond_enslave) \
+_(BOND_DETACH_SLAVE, bond_detach_slave) \
_(TAP_CREATE_V2, tap_create_v2) \
_(TAP_DELETE_V2, tap_delete_v2) \
_(SW_INTERFACE_TAP_V2_DUMP, sw_interface_tap_v2_dump) \