|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
32 u8 switching_active = 0;
41 if ((bif->
mode == BOND_MODE_ACTIVE_BACKUP) && (
i == 0) &&
51 if (i < bif->n_numa_members)
162 if (bif->
mode == BOND_MODE_ACTIVE_BACKUP)
190 bondif->
id = bif->
id;
199 bondif->
lb = bif->
lb;
206 *out_bondifs = r_bondifs;
213 u32 bond_sw_if_index)
230 vec_add2 (r_memberifs, memberif, 1);
251 *out_memberifs = r_memberifs;
324 if (bif->
mode == BOND_MODE_LACP)
343 u32 *mif_sw_if_index;
348 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
387 args->
rv = VNET_API_ERROR_FEATURE_DISABLED;
391 if (args->
mode > BOND_MODE_LACP || args->
mode < BOND_MODE_ROUND_ROBIN)
393 args->
rv = VNET_API_ERROR_INVALID_ARGUMENT;
397 if (args->
lb > BOND_LB_L23)
399 args->
rv = VNET_API_ERROR_INVALID_ARGUMENT;
416 args->
rv = VNET_API_ERROR_INSTANCE_IN_USE;
423 if (bif->
mode == BOND_MODE_ROUND_ROBIN)
424 bif->
lb = BOND_LB_RR;
425 else if (bif->
mode == BOND_MODE_BROADCAST)
426 bif->
lb = BOND_LB_BC;
427 else if (bif->
mode == BOND_MODE_ACTIVE_BACKUP)
428 bif->
lb = BOND_LB_AB;
438 memcpy (args->
hw_addr + 2, &rnd, sizeof (rnd));
450 args->
rv = VNET_API_ERROR_INVALID_REGISTRATION;
498 args.
lb = BOND_LB_L2;
504 else if (((args.
mode == BOND_MODE_LACP) || (args.
mode == BOND_MODE_XOR))
505 &&
unformat (line_input,
"load-balance %U",
508 else if (
unformat (line_input,
"hw-addr %U",
511 else if (
unformat (line_input,
"id %u", &args.
id))
513 else if (
unformat (line_input,
"gso"))
515 else if (
unformat (line_input,
"numa-only"))
517 if (args.
mode == BOND_MODE_LACP)
521 "Only lacp mode supports numa-only so far!");
529 if (mode_is_set == 0)
543 .path =
"create bond",
544 .short_help =
"create bond mode {round-robin | active-backup | broadcast | "
545 "{lacp | xor} [load-balance { l2 | l23 | l34 } [numa-only]]} "
546 "[hw-addr <mac-address>] [id <if-id>] [gso]",
579 "please specify interface name or sw_if_index");
582 if (
rv == VNET_API_ERROR_INVALID_SW_IF_INDEX)
593 .path =
"delete bond",
594 .short_help =
"delete bond {<interface> | sw_if_index <sw_idx>}",
615 args->
rv = VNET_API_ERROR_INVALID_INTERFACE;
622 args->
rv = VNET_API_ERROR_VALUE_EXIST;
624 (0,
"interface was already added as member");
630 args->
rv = VNET_API_ERROR_INVALID_INTERFACE;
637 args->
rv = VNET_API_ERROR_INVALID_INTERFACE;
642 if (bif->
mode == BOND_MODE_LACP)
652 if (args->
error != 0)
654 args->
rv = VNET_API_ERROR_INVALID_INTERFACE;
665 if (args->
error != 0)
667 args->
rv = VNET_API_ERROR_INVALID_INTERFACE;
739 if (bif->
mode == BOND_MODE_LACP)
770 "Error encountered on input feature arc enable");
794 else if (
unformat (line_input,
"passive"))
796 else if (
unformat (line_input,
"long-timeout"))
809 if (args.
group == ~0)
813 "please specify valid member interface name");
823 .short_help =
"bond add <BondEthernetx> <member-interface> "
824 "[passive] [long-timeout]",
838 args->
rv = VNET_API_ERROR_INVALID_INTERFACE;
877 "please specify valid member interface name");
887 .short_help =
"bond del <member-interface>",
899 "interface name",
"sw_if_index",
"mode",
900 "load balance",
"active members",
"members");
931 if (bif->
mode == BOND_MODE_ROUND_ROBIN)
940 if (bif->
mode == BOND_MODE_ACTIVE_BACKUP)
945 "sw_if_index: %u", mif->
weight,
991 .short_help =
"show bond [details]",
1007 args->
rv = VNET_API_ERROR_INVALID_INTERFACE;
1014 args->
rv = VNET_API_ERROR_INVALID_INTERFACE;
1018 if (bif->
mode != BOND_MODE_ACTIVE_BACKUP)
1020 args->
rv = VNET_API_ERROR_INVALID_ARGUMENT;
1026 old_weight = mif->
weight;
1037 (mif->
weight >= old_weight)))
1051 u8 weight_enter = 0;
1078 args.
rv = VNET_API_ERROR_INVALID_INTERFACE;
1081 if (weight_enter == 0)
1083 args.
rv = VNET_API_ERROR_INVALID_ARGUMENT;
1096 .path =
"set interface bond",
1097 .short_help =
"set interface bond <interface> | sw_if_index <idx>"
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
void bond_disable_collecting_distributing(vlib_main_t *vm, member_if_t *mif)
clib_error_t * stat_segment_register_state_counter(u8 *name, u32 *index)
static vlib_cli_command_t bond_delete__command
(constructor) VLIB_CLI_COMMAND (bond_delete__command)
static void clib_spinlock_init(clib_spinlock_t *p)
void bond_create_if(vlib_main_t *vm, bond_create_if_args_t *args)
vnet_interface_main_t * im
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
uword * member_by_sw_if_index
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
#define hash_set(h, key, value)
vnet_hw_interface_capabilities_t caps
static void show_bond(vlib_main_t *vm)
static uword unformat_bond_mode(unformat_input_t *input, va_list *args)
#define clib_memcpy(d, s, n)
static bond_if_t * bond_get_bond_if_by_dev_instance(u32 dev_instance)
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
u32 ethernet_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
static void bond_sort_members(bond_if_t *bif)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define vec_insert_elts(V, E, N, M)
Insert N vector elements starting at element M, insert given elements (no header, unspecified alignme...
bond_per_port_queue_t * per_port_queue
u8 * format_bond_interface_name(u8 *s, va_list *args)
#define clib_error_return(e, args...)
int bond_delete_if(vlib_main_t *vm, u32 sw_if_index)
#define vec_append(v1, v2)
Append v2 after v1.
static int bond_member_sort(void *a1, void *a2)
lacp_enable_disable_func lacp_enable_disable
static vlib_cli_command_t add_member_interface_command
(constructor) VLIB_CLI_COMMAND (add_member_interface_command)
#define pool_put(P, E)
Free an object E in pool P.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
static bond_if_t * bond_get_bond_if_by_sw_if_index(u32 sw_if_index)
@ VNET_HW_INTERFACE_FLAG_LINK_UP
static vlib_cli_command_t detach_interface_command
(constructor) VLIB_CLI_COMMAND (detach_interface_command)
clib_error_t * bond_cli_init(vlib_main_t *vm)
member interface details struct
u8 persistent_hw_address[6]
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
static void bond_delete_neighbor(vlib_main_t *vm, bond_if_t *bif, member_if_t *mif)
#define hash_unset(h, key)
static u32 random_u32(u32 *seed)
32-bit random number generator
@ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM
#define LACP_LONG_TIMOUT_TIME
#define pool_foreach(VAR, POOL)
Iterate through pool.
void bond_set_intf_weight(vlib_main_t *vm, bond_set_intf_weight_args_t *args)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static vlib_cli_command_t bond_create_command
(constructor) VLIB_CLI_COMMAND (bond_create_command)
static uword unformat_bond_load_balance(unformat_input_t *input, va_list *args)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
clib_error_t * vnet_hw_interface_change_mac_address(vnet_main_t *vnm, u32 hw_if_index, const u8 *mac_address)
uword * port_number_bitmap
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
#define LACP_SHORT_TIMOUT_TIME
@ VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
void bond_detach_member(vlib_main_t *vm, bond_detach_member_args_t *args)
vnet_device_class_t bond_dev_class
#define vec_foreach_index(var, v)
Iterate over vector indices.
#define clib_bitmap_free(v)
Free a bitmap.
static clib_error_t * bond_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
lacp_port_info_t actor_admin
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static vlib_cli_command_t set_interface_bond_cmd
(constructor) VLIB_CLI_COMMAND (set_interface_bond_cmd)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
static void bond_member_add_del_mac_addrs(bond_if_t *bif, u32 mif_sw_if_index, u8 is_add)
#define ALWAYS_ASSERT(truth)
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap.
#define CLIB_CACHE_LINE_BYTES
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
vnet_sw_interface_t * sw_interfaces
ethernet_interface_t * ethernet_get_interface(ethernet_main_t *em, u32 hw_if_index)
static vlib_cli_command_t show_bond_command
(constructor) VLIB_CLI_COMMAND (show_bond_command)
#define vec_free(V)
Free vector's memory (no header).
static clib_error_t * bond_set_intf_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
ethernet_main_t ethernet_main
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define VLIB_INIT_FUNCTION(x)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
void ethernet_delete_interface(vnet_main_t *vnm, u32 hw_if_index)
void bond_enable_collecting_distributing(vlib_main_t *vm, member_if_t *mif)
int bond_dump_member_ifs(member_interface_details_t **out_memberifs, u32 bond_sw_if_index)
static clib_error_t * add_member_interface_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
clib_error_t * stat_segment_deregister_state_counter(u32 index)
#define vec_foreach(var, vec)
Vector iterator.
uword * bond_by_sw_if_index
int bond_dump_ifs(bond_interface_details_t **out_bondifs)
static clib_error_t * show_bond_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static member_if_t * bond_get_member_by_sw_if_index(u32 sw_if_index)
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
clib_error_t * vnet_hw_interface_add_del_mac_address(vnet_main_t *vnm, u32 hw_if_index, const u8 *mac_address, u8 is_add)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
@ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM
static u8 * format_bond_load_balance(u8 *s, va_list *args)
static uword vnet_sw_interface_is_up(vnet_main_t *vnm, u32 sw_if_index)
BOND interface details struct.
static clib_error_t * detach_interface_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
bond_per_thread_data_t * per_thread_data
static f64 vlib_time_now(vlib_main_t *vm)
void bond_add_member(vlib_main_t *vm, bond_add_member_args_t *args)
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
static u8 * format_bond_mode(u8 *s, va_list *args)
static vlib_thread_main_t * vlib_get_thread_main()
vl_api_interface_index_t sw_if_index
ethernet_interface_address_t * secondary_addrs
static clib_error_t * bond_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, const u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
#define vec_del1(v, i)
Delete the element at index I.
vnet_interface_main_t interface_main
vlib_node_registration_t bond_process_node
(constructor) VLIB_REGISTER_NODE (bond_process_node)
static void show_bond_details(vlib_main_t *vm)