|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
184 return (VNET_API_ERROR_ENTRY_ALREADY_EXISTS);
261 return (VNET_API_ERROR_NO_SUCH_ENTRY);
334 s =
format (s,
"abf-interface-attach: policy:%d priority:%d",
366 else if (
unformat (input,
"policy %d", &policy_id))
407 .path =
"abf attach",
409 .short_help =
"abf attach <ip4|ip6> [del] policy <value> <interface>",
462 .path =
"show abf attach",
464 .short_help =
"show abf attach <interface>",
497 #define abf_error(n,s) ABF_ERROR_##n,
513 matches = misses = 0;
523 const u32 *attachments0;
527 u32 bi0, sw_if_index0;
529 u32 match_acl_index = ~0;
530 u32 match_acl_pos = ~0;
531 u32 match_rule_index = ~0;
532 u32 trace_bitmap = 0;
573 &match_acl_index, &match_rule_index, &trace_bitmap))
607 to_next, n_left_to_next, bi0,
618 ABF_ERROR_MATCHED, matches);
623 ABF_ERROR_MISSED, misses);
625 return frame->n_vectors;
654 #define abf_error(n,s) s,
663 .name =
"abf-input-ip4",
664 .vector_size =
sizeof (
u32),
679 .name =
"abf-input-ip6",
680 .vector_size =
sizeof (
u32),
694 .arc_name =
"ip4-unicast",
695 .node_name =
"abf-input-ip4",
701 .arc_name =
"ip6-unicast",
702 .node_name =
"abf-input-ip6",
766 return (acl_init_res);
769 acl_plugin.register_user_module (
"ABF plugin",
"sw_if_index", NULL);
#define FIB_PROTOCOL_MAX
Definition outside of enum so it does not need to be included in non-defaulted switch statements.
u32 ap_id
The policy ID - as configured by the client.
u16 dpoi_next_node
The next VLIB node to follow.
index_t dpoi_index
the index of objects of that type
static abf_itf_attach_t * abf_itf_attach_db_find(u32 abf_index, u32 sw_if_index)
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
static fib_node_t * abf_itf_attach_get_node(fib_node_index_t index)
static int acl_plugin_match_5tuple_inline(void *p_acl_main, u32 lc_index, fa_5tuple_opaque_t *pkt_5tuple, int is_ip6, u8 *r_action, u32 *r_acl_pos_p, u32 *r_acl_match_p, u32 *r_rule_match_p, u32 *trace_bitmap)
static uword * abf_itf_attach_db
A DB of attachments; key={abf_index,sw_if_index}.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
nat44_ei_hairpin_src_next_t next_index
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
static clib_error_t * acl_plugin_exports_init(acl_plugin_methods_t *m)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
int abf_itf_attach(fib_protocol_t fproto, u32 policy_id, u32 priority, u32 sw_if_index)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static u8 * format_abf_intf_attach(u8 *s, va_list *args)
static u64 abf_itf_attach_mk_key(u32 abf_index, u32 sw_if_index)
@ VLIB_NODE_TYPE_INTERNAL
vlib_main_t vlib_node_runtime_t * node
A FIB graph nodes virtual function table.
static char * abf_error_strings[]
#define clib_error_return(e, args...)
static void abf_itf_attach_stack(abf_itf_attach_t *aia)
#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.
fib_node_t aia_node
Linkage into the FIB graph.
Attachment data for an ABF policy to an interface.
enum abf_next_t_ abf_next_t
An ACL based Forwarding 'policy'.
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
static vlib_cli_command_t abf_show_attach_cmd_node
(constructor) VLIB_CLI_COMMAND (abf_show_attach_cmd_node)
abf_policy_t * abf_policy_get(u32 index)
Get an ABF object from its VPP index.
u32 aia_sw_if_index
The interface for the attachment.
import vnet interface_types api
#define hash_set(h, key, value)
@ FIB_FORW_CHAIN_TYPE_UNICAST_IP4
Contribute an object that is to be used to forward IP4 packets.
#define STRUCT_OFFSET_OF(t, f)
vlib_node_registration_t abf_ip6_node
(constructor) VLIB_REGISTER_NODE (abf_ip6_node)
static abf_itf_attach_t * abf_itf_attach_get(u32 index)
static acl_plugin_methods_t acl_plugin
abf_itf_attach_t * abf_itf_attach_pool
Pool of ABF interface attachment objects.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
fib_node_index_t ap_pl
The path-list describing how to forward in case of a match.
u32 abf_policy_find(u32 policy_id)
Find a ABF object from the client's policy ID.
static vlib_cli_command_t abf_itf_attach_cmd_node
Attach an ABF policy to an interface.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
fib_node_type_t abf_policy_fib_node_type
FIB node type the attachment is registered.
vnet_main_t * vnet_get_main(void)
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static uword abf_input_ip4(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void abf_itf_attach_db_del(u32 abf_index, u32 sw_if_index)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
u32 fib_node_index_t
A typedef of a node index.
static const fib_node_vft_t abf_itf_attach_vft
u32 aia_sibling
Sibling index on the policy's path list.
static void abf_itf_attach_db_add(u32 abf_index, u32 sw_if_index, abf_itf_attach_t *aia)
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
int(* abf_itf_attach_walk_cb_t)(index_t aii, void *ctx0)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define VLIB_CLI_COMMAND(x,...)
void dpo_stack_from_node(u32 child_node_index, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child parent relationship.
VNET_FEATURE_INIT(abf_ip4_feat, static)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
static clib_error_t * abf_show_attach_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void fib_path_list_contribute_forwarding(fib_node_index_t path_list_index, fib_forward_chain_type_t fct, fib_path_list_fwd_flags_t flags, dpo_id_t *dpo)
static int abf_cmp_attach_for_sort(void *v1, void *v2)
static uword abf_input_ip6(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
struct _vlib_node_registration vlib_node_registration_t
@ FIB_NODE_BACK_WALK_CONTINUE
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject.
#define vec_search(v, E)
Search a vector for the index of the entry that matches.
static uword abf_input_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, fib_protocol_t fproto)
static fib_node_back_walk_rc_t abf_itf_attach_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
void abf_setup_acl_lc(fib_protocol_t fproto, u32 sw_if_index)
#define vec_free(V)
Free vector's memory (no header).
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
u8 * format_fib_protocol(u8 *s, va_list *ap)
static void abf_itf_attach_last_lock_gone(fib_node_t *node)
#define pool_foreach_index(i, v)
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
static void acl_plugin_fill_5tuple_inline(void *p_acl_main, u32 lc_index, vlib_buffer_t *b0, int is_ip6, int is_input, int is_l2_path, fa_5tuple_opaque_t *p5tuple_pkt)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
vlib_put_next_frame(vm, node, next_index, 0)
static u32 * abf_alctx_per_itf[FIB_PROTOCOL_MAX]
Per interface values of ACL lookup context IDs.
u32 ap_acl
ACL index to match.
#define VLIB_INIT_FUNCTION(x)
u32 aia_prio
The priority of this policy for attachment.
dpo_id_t aia_dpo
The DPO actually used for forwarding.
int abf_itf_detach(fib_protocol_t fproto, u32 policy_id, u32 sw_if_index)
#define vec_foreach(var, vec)
Vector iterator.
static fib_node_type_t abf_itf_attach_fib_node_type
FIB node registered type for the bonds.
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)
An node in the FIB graph.
#define hash_unset(h, key)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
void fib_node_init(fib_node_t *node, fib_node_type_t type)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static u8 * format_abf_input_trace(u8 *s, va_list *args)
u32 aia_acl
The ACL and DPO are cached for fast DP access.
#define VNET_FEATURES(...)
static u32 abf_acl_user_id
ABF ACL module user id returned during the initialization.
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
struct abf_input_trace_t_ abf_input_trace_t
Context passed between object during a back walk.
vlib_node_registration_t abf_ip4_node
Forward declarations;.
void fib_node_child_remove(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_index_t sibling_index)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
@ FIB_FORW_CHAIN_TYPE_UNICAST_IP6
Contribute an object that is to be used to forward IP6 packets.
static clib_error_t * abf_itf_attach_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
vl_api_mac_event_action_t action
vl_api_interface_index_t sw_if_index
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
void abf_itf_attach_walk(abf_itf_attach_walk_cb_t cb, void *ctx)
u32 aia_abf
The VPP index of the ABF policy.
static clib_error_t * abf_itf_bond_init(vlib_main_t *vm)
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
static u32 ** abf_per_itf[FIB_PROTOCOL_MAX]
A per interface vector of attached policies.
fib_node_type_t fib_node_register_new_type(const fib_node_vft_t *vft)
Create a new FIB node type and Register the function table for it.
fib_protocol_t aia_proto
The protocol for the attachment.
u32 fib_node_child_add(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_type_t type, fib_node_index_t index)
vl_api_fib_path_type_t type
#define vec_del1(v, i)
Delete the element at index I.
@ FIB_PATH_LIST_FWD_FLAG_COLLAPSE
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)
static abf_itf_attach_t * abf_itf_attach_get_from_node(fib_node_t *node)