Skip to content

Commit a06f685

Browse files
sluong99ayourtch
authored andcommitted
bonding: Add GSO support
Add GSO support, configurable from the CLI. Type: feature Ticket: VPP-1820 Signed-off-by: Steven Luong <[email protected]> Change-Id: I65885a071b24c74437e6cfe5eff237b01bc1744b
1 parent 03c0ef9 commit a06f685

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/vnet/bonding/cli.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args)
344344
vnet_main_t *vnm = vnet_get_main ();
345345
vnet_sw_interface_t *sw;
346346
bond_if_t *bif;
347+
vnet_hw_interface_t *hw;
347348

348349
if ((args->mode == BOND_MODE_LACP) && bm->lacp_plugin_loaded == 0)
349350
{
@@ -369,6 +370,7 @@ bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args)
369370
bif->id = args->id;
370371
bif->lb = args->lb;
371372
bif->mode = args->mode;
373+
bif->gso = args->gso;
372374

373375
// Adjust requested interface id
374376
if (bif->id == ~0)
@@ -419,6 +421,10 @@ bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args)
419421
bif->sw_if_index = sw->sw_if_index;
420422
bif->group = bif->sw_if_index;
421423
bif->numa_only = args->numa_only;
424+
425+
hw = vnet_get_hw_interface (vnm, bif->hw_if_index);
426+
hw->flags |= (VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
427+
VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
422428
if (vlib_get_thread_main ()->n_vlib_mains > 1)
423429
clib_spinlock_init (&bif->lockp);
424430

@@ -461,6 +467,8 @@ bond_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
461467
args.hw_addr_set = 1;
462468
else if (unformat (line_input, "id %u", &args.id))
463469
;
470+
else if (unformat (line_input, "gso"))
471+
args.gso = 1;
464472
else if (unformat (line_input, "numa-only"))
465473
{
466474
if (args.mode == BOND_MODE_LACP)
@@ -491,8 +499,8 @@ bond_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
491499
VLIB_CLI_COMMAND (bond_create_command, static) = {
492500
.path = "create bond",
493501
.short_help = "create bond mode {round-robin | active-backup | broadcast | "
494-
"{lacp | xor} [load-balance { l2 | l23 | l34 } [numa-only]]} [hw-addr <mac-address>] "
495-
"[id <if-id>]",
502+
"{lacp | xor} [load-balance { l2 | l23 | l34 } [numa-only]]} "
503+
"[hw-addr <mac-address>] [id <if-id>] [gso]",
496504
.function = bond_create_command_fn,
497505
};
498506
/* *INDENT-ON* */
@@ -580,6 +588,13 @@ bond_enslave (vlib_main_t * vm, bond_enslave_args_t * args)
580588
clib_error_return (0, "bond interface cannot be enslaved");
581589
return;
582590
}
591+
if (bif->gso && !(sif_hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO))
592+
{
593+
args->rv = VNET_API_ERROR_INVALID_INTERFACE;
594+
args->error =
595+
clib_error_return (0, "slave interface is not gso capable");
596+
return;
597+
}
583598
if (bif->mode == BOND_MODE_LACP)
584599
{
585600
u8 *name = format (0, "/if/lacp/%u/%u/state%c", bif->sw_if_index,
@@ -851,6 +866,8 @@ show_bond_details (vlib_main_t * vm)
851866
format_bond_mode, bif->mode);
852867
vlib_cli_output (vm, " load balance: %U",
853868
format_bond_load_balance, bif->lb);
869+
if (bif->gso)
870+
vlib_cli_output (vm, " gso enable");
854871
if (bif->mode == BOND_MODE_ROUND_ROBIN)
855872
vlib_cli_output (vm, " last xmit slave index: %u",
856873
bif->lb_rr_last_index);

src/vnet/bonding/node.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ typedef struct
8383
u8 mode;
8484
u8 lb;
8585
u8 numa_only;
86+
u8 gso;
8687
/* return */
8788
u32 sw_if_index;
8889
int rv;
@@ -193,6 +194,7 @@ typedef struct
193194
on local numa node works for lacp mode if have at least one,
194195
otherwise it works as usual. */
195196
u8 numa_only;
197+
u8 gso;
196198

197199
/* How many slaves on local numa node are there in lacp mode? */
198200
word n_numa_slaves;

0 commit comments

Comments
 (0)