aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2020-01-06 15:14:46 -0800
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-04-06 12:12:58 +0000
commit2e1fa54b7ebaa37aa0b2a4e8a33f3368286ff28b (patch)
treea988b2ba68f93cbc447ec92a4e13410e3aad4152 /src/vnet
parent582eac5c30e78f65ba0127aed2cb7442f4122fd2 (diff)
bonding: Add GSO support
Add GSO support, configurable from the CLI. Type: feature Ticket: VPP-1820 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I65885a071b24c74437e6cfe5eff237b01bc1744b (cherry picked from commit a06f68556e506a6ff7f31a617a036614c84f71c0)
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/bonding/cli.c21
-rw-r--r--src/vnet/bonding/node.h2
2 files changed, 21 insertions, 2 deletions
diff --git a/src/vnet/bonding/cli.c b/src/vnet/bonding/cli.c
index 66aaa2e3816..09ef10f1b05 100644
--- a/src/vnet/bonding/cli.c
+++ b/src/vnet/bonding/cli.c
@@ -379,6 +379,7 @@ bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args)
vnet_main_t *vnm = vnet_get_main ();
vnet_sw_interface_t *sw;
bond_if_t *bif;
+ vnet_hw_interface_t *hw;
if ((args->mode == BOND_MODE_LACP) && bm->lacp_plugin_loaded == 0)
{
@@ -404,6 +405,7 @@ bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args)
bif->id = args->id;
bif->lb = args->lb;
bif->mode = args->mode;
+ bif->gso = args->gso;
// Adjust requested interface id
if (bif->id == ~0)
@@ -454,6 +456,10 @@ bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args)
bif->sw_if_index = sw->sw_if_index;
bif->group = bif->sw_if_index;
bif->numa_only = args->numa_only;
+
+ hw = vnet_get_hw_interface (vnm, bif->hw_if_index);
+ hw->flags |= (VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
+ VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
if (vlib_get_thread_main ()->n_vlib_mains > 1)
clib_spinlock_init (&bif->lockp);
@@ -496,6 +502,8 @@ bond_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
args.hw_addr_set = 1;
else if (unformat (line_input, "id %u", &args.id))
;
+ else if (unformat (line_input, "gso"))
+ args.gso = 1;
else if (unformat (line_input, "numa-only"))
{
if (args.mode == BOND_MODE_LACP)
@@ -526,8 +534,8 @@ bond_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
VLIB_CLI_COMMAND (bond_create_command, static) = {
.path = "create bond",
.short_help = "create bond mode {round-robin | active-backup | broadcast | "
- "{lacp | xor} [load-balance { l2 | l23 | l34 } [numa-only]]} [hw-addr <mac-address>] "
- "[id <if-id>]",
+ "{lacp | xor} [load-balance { l2 | l23 | l34 } [numa-only]]} "
+ "[hw-addr <mac-address>] [id <if-id>] [gso]",
.function = bond_create_command_fn,
};
/* *INDENT-ON* */
@@ -615,6 +623,13 @@ bond_enslave (vlib_main_t * vm, bond_enslave_args_t * args)
clib_error_return (0, "bond interface cannot be enslaved");
return;
}
+ if (bif->gso && !(sif_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");
+ return;
+ }
if (bif->mode == BOND_MODE_LACP)
{
u8 *name = format (0, "/if/lacp/%u/%u/state%c", bif->sw_if_index,
@@ -901,6 +916,8 @@ show_bond_details (vlib_main_t * vm)
format_bond_mode, bif->mode);
vlib_cli_output (vm, " load balance: %U",
format_bond_load_balance, bif->lb);
+ 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",
bif->lb_rr_last_index);
diff --git a/src/vnet/bonding/node.h b/src/vnet/bonding/node.h
index 8ead0228523..ddd48feb1a3 100644
--- a/src/vnet/bonding/node.h
+++ b/src/vnet/bonding/node.h
@@ -83,6 +83,7 @@ typedef struct
u8 mode;
u8 lb;
u8 numa_only;
+ u8 gso;
/* return */
u32 sw_if_index;
int rv;
@@ -196,6 +197,7 @@ typedef struct
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;