From ea7178631ef292530993e0c91bf86f1ca9ae99d4 Mon Sep 17 00:00:00 2001 From: Steven Luong Date: Thu, 30 Jul 2020 07:31:40 -0700 Subject: 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 Change-Id: Id9501b8e6d267ae09e2b411957f181343da459c0 --- src/vnet/bonding/bond_api.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/vnet/bonding/bond_api.c') 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) \ @@ -102,6 +103,39 @@ vl_api_bond_create_t_handler (vl_api_bond_create_t * mp) /* *INDENT-ON* */ } +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) { -- cgit 1.2.3-korg