summaryrefslogtreecommitdiffstats
path: root/src/vnet/bonding
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2020-07-30 07:31:40 -0700
committerDave Barach <openvpp@barachs.net>2020-09-02 14:47:28 +0000
commitea7178631ef292530993e0c91bf86f1ca9ae99d4 (patch)
treea06bb2708ebcf1695cd2406cf24bc3d8d05200fd /src/vnet/bonding
parent8ccea00339a550902f76a5ec24c1dda5a5975eaf (diff)
bonding: add bond_create2 API to include gso option
gso option is available for the debug CLI version of bond create. This patch is to create a new API to have the corresponding option in the binary API. The old binary API bond_create is marked deprecated. Type: improvement Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Id9501b8e6d267ae09e2b411957f181343da459c0
Diffstat (limited to 'src/vnet/bonding')
-rw-r--r--src/vnet/bonding/bond.api45
-rw-r--r--src/vnet/bonding/bond_api.c34
2 files changed, 75 insertions, 4 deletions
diff --git a/src/vnet/bonding/bond.api b/src/vnet/bonding/bond.api
index 682298e9084..3a882b4f172 100644
--- a/src/vnet/bonding/bond.api
+++ b/src/vnet/bonding/bond.api
@@ -55,6 +55,7 @@ enum bond_lb_algo
*/
define bond_create
{
+ option deprecated;
u32 client_index;
u32 context;
u32 id [default=0xFFFFFFFF];
@@ -77,6 +78,42 @@ define bond_create_reply
vl_api_interface_index_t sw_if_index;
};
+/** \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 mode - mode, required (1=round-robin, 2=active-backup, 3=xor, 4=broadcast, 5=lacp)
+ @param lb - load balance, optional (0=l2, 1=l34, 2=l23) valid for xor and lacp modes. Otherwise ignored (default=l2)
+ @param numa_only - if numa_only is set, pkts will be transmitted by LAG members on local numa node only if have at least one, otherwise it works as usual.
+ @param enable_gso - enable gso support (default 0)
+ @param use_custom_mac - if set, mac_address is valid
+ @param mac_address - mac addr to assign to the interface if use_custom_mac is set
+ @param id - if non-~0, specifies a custom interface ID (default=0xFFFFFFFF)
+*/
+define bond_create2
+{
+ u32 client_index;
+ u32 context;
+ vl_api_bond_mode_t mode;
+ vl_api_bond_lb_algo_t lb;
+ bool numa_only;
+ bool enable_gso;
+ bool use_custom_mac;
+ vl_api_mac_address_t mac_address;
+ u32 id [default=0xFFFFFFFF];
+};
+
+/** \brief Reply for bond create2 reply
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+ @param sw_if_index - software index allocated for the new tap interface
+*/
+define bond_create2_reply
+{
+ u32 context;
+ i32 retval;
+ vl_api_interface_index_t sw_if_index;
+};
+
/** \brief Delete bond interface
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -99,7 +136,7 @@ autoreply define bond_delete
*/
define bond_enslave
{
- option deprecated="20.06";
+ option deprecated;
u32 client_index;
u32 context;
vl_api_interface_index_t sw_if_index;
@@ -153,7 +190,7 @@ define bond_add_member_reply
*/
autoreply define bond_detach_slave
{
- option deprecated="20.06";
+ option deprecated;
u32 client_index;
u32 context;
vl_api_interface_index_t sw_if_index;
@@ -174,7 +211,7 @@ autoreply define bond_detach_member
/** \brief Dump bond interfaces request */
define sw_interface_bond_dump
{
- option deprecated="20.06";
+ option deprecated;
u32 client_index;
u32 context;
};
@@ -240,7 +277,7 @@ define sw_bond_interface_details
*/
define sw_interface_slave_dump
{
- option deprecated="20.06";
+ option deprecated;
u32 client_index;
u32 context;
vl_api_interface_index_t sw_if_index;
diff --git a/src/vnet/bonding/bond_api.c b/src/vnet/bonding/bond_api.c
index 4306e3cba9f..8b8385d8205 100644
--- a/src/vnet/bonding/bond_api.c
+++ b/src/vnet/bonding/bond_api.c
@@ -46,6 +46,7 @@
#define foreach_bond_api_msg \
_(BOND_CREATE, bond_create) \
+_(BOND_CREATE2, bond_create2) \
_(BOND_DELETE, bond_delete) \
_(BOND_ENSLAVE, bond_enslave) \
_(BOND_ADD_MEMBER, bond_add_member) \
@@ -103,6 +104,39 @@ vl_api_bond_create_t_handler (vl_api_bond_create_t * mp)
}
static void
+vl_api_bond_create2_t_handler (vl_api_bond_create2_t * mp)
+{
+ vlib_main_t *vm = vlib_get_main ();
+ vl_api_bond_create2_reply_t *rmp;
+ bond_create_if_args_t _a, *ap = &_a;
+
+ clib_memset (ap, 0, sizeof (*ap));
+
+ ap->id = ntohl (mp->id);
+
+ if (mp->use_custom_mac)
+ {
+ mac_address_decode (mp->mac_address, (mac_address_t *) ap->hw_addr);
+ ap->hw_addr_set = 1;
+ }
+
+ ap->mode = ntohl (mp->mode);
+ ap->lb = ntohl (mp->lb);
+ ap->numa_only = mp->numa_only;
+ ap->gso = mp->enable_gso;
+ bond_create_if (vm, ap);
+
+ int rv = ap->rv;
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO2(VL_API_BOND_CREATE2_REPLY,
+ ({
+ rmp->sw_if_index = ntohl (ap->sw_if_index);
+ }));
+ /* *INDENT-ON* */
+}
+
+static void
vl_api_bond_add_member_t_handler (vl_api_bond_add_member_t * mp)
{
vlib_main_t *vm = vlib_get_main ();