@@ -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,
491499VLIB_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 );
0 commit comments