|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
25 #include <vpp/app/version.h>
30 #define SID_CREATE_IFACE_FEATURE_ERROR -1
31 #define SID_CREATE_INVALID_IFACE_TYPE -3
32 #define SID_CREATE_INVALID_IFACE_INDEX -4
33 #define SID_CREATE_INVALID_ADJ_INDEX -5
38 "Endpoint with flow-based dynamic proxy to SR-unaware appliance";
39 unsigned char params_str[] =
"nh <next-hop> oif <iface-out> iif <iface-in>";
46 return 1 << (
max_log2 (n_elts >> 1) + 1);
52 return n_buckets * (8 + kv_size * 4);
84 ls_mem->
nh_adj = nh_adj_index;
237 clib_bihash_free_40_8 (&ls_mem->
ftable);
273 vlib_counter_t sid_bypass, sid_punt, sid_full, rw_valid, rw_invalid;
286 format (s,
"\tTraffic that bypassed the NF: \t[%Ld packets : %Ld bytes]\n",
288 s =
format (s,
"\tPunted traffic: \t[%Ld packets : %Ld bytes]\n",
291 format (s,
"\tDropped traffic (cache full): \t[%Ld packets : %Ld bytes]\n",
293 s =
format (s,
"\tGood rewrite traffic: \t[%Ld packets : %Ld bytes]\n",
295 s =
format (s,
"\tBad rewrite traffic: \t[%Ld packets : %Ld bytes]\n",
311 void **plugin_mem_p = va_arg (*args,
void **);
322 #define PARAM_AD_NH (1 << 0)
323 #define PARAM_AD_OIF (1 << 1)
324 #define PARAM_AD_IIF (1 << 2)
326 if (!
unformat (input,
"end.ad.flow"))
363 if ((params & params_chk) != params_chk)
371 *plugin_mem_p = ls_mem;
393 return (
format (s,
"SR: dynamic_proxy_index:[%u]",
index));
413 "srv6-ad-flow-localsid",
450 .arc_name =
"ip4-unicast",
451 .node_name =
"srv6-ad4-flow-rewrite",
456 .arc_name =
"ip6-unicast",
457 .node_name =
"srv6-ad6-flow-rewrite",
464 .version = VPP_BUILD_VER,
465 .description =
"Dynamic Segment Routing for IPv6 (SRv6) Proxy",
uword unformat_srv6_ad_flow_localsid(unformat_input_t *input, va_list *args)
u32 srv6_localsid_behavior_id
SRv6 LocalSID behavior number.
static void clib_dlist_init(dlist_elt_t *pool, u32 index)
dpo_type_t dpo_register_new_type(const dpo_vft_t *vft, const char *const *const *nodes)
Create and register a new DPO type.
vnet_sw_interface_type_t type
#define SRV6_AD_FLOW_DEFAULT_CACHE_SIZE
adj_index_t adj_nbr_add_or_lock(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
Neighbour Adjacency sub-type.
srv6_ad_flow_entry_t * cache
Cache table.
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
int sr_localsid_register_function(vlib_main_t *vm, u8 *fn_name, u8 *keyword_str, u8 *def_str, u8 *params_str, u8 prefix_length, dpo_type_t *dpo, format_function_t *ls_format, unformat_function_t *ls_unformat, sr_plugin_callback_t *creation_fn, sr_plugin_callback_t *removal_fn)
SR LocalSID plugin registry.
#define SID_CREATE_INVALID_IFACE_TYPE
static void clib_mem_free(void *p)
void * plugin_mem
Memory to be used by the plugin callback functions.
#define clib_error_return(e, args...)
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
static int srv6_ad_flow_localsid_removal_fn(ip6_sr_localsid_t *localsid)
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
#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)
vlib_main_t * vlib_main
[convenience] vlib main
u32 sw_if_index_in
Incoming iface from proxied dev.
vlib_combined_counter_main_t rw_valid_counters
Valid rewrite counters.
u32 * sw_iface_localsid6
Retrieve local SID from iface.
static uword max_log2(uword x)
static u32 ad_flow_calc_bihash_memory(u32 n_buckets, uword kv_size)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static u32 ad_flow_calc_bihash_buckets(u32 n_elts)
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
clib_bihash_40_8_t ftable
Flow table.
vnet_main_t * vnet_get_main(void)
Combined counter to hold both packets and byte differences.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
srv6_ad_flow_main_t srv6_ad_flow_main
unsigned char keyword_str[]
unsigned char params_str[]
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
dpo_lock_fn_t dv_lock
A reference counting lock function.
u32 nh_adj
Adjacency index for out.
void srv6_ad_flow_dpo_lock(dpo_id_t *dpo)
unsigned char function_name[]
counter_t packets
packet counter
u8 * format_srv6_ad_flow_localsid(u8 *s, va_list *args)
vnet_sw_interface_t * sw_interfaces
dpo_type_t srv6_ad_flow_dpo_type
DPO type.
ip6_sr_localsid_t * localsids
static clib_error_t * srv6_ad_flow_init(vlib_main_t *vm)
vlib_combined_counter_main_t sid_bypass_counters
Packets/bytes bypassing NF.
static u8 * format_srv6_ad_flow_dpo(u8 *s, va_list *args)
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
Segment Routing main datastructure.
vlib_combined_counter_main_t sid_punt_counters
Packets/bytes punted.
#define vec_free(V)
Free vector's memory (no header).
#define pool_len(p)
Number of elements in pool vector.
static int srv6_ad_flow_localsid_creation_fn(ip6_sr_localsid_t *localsid)
vnet_main_t * vnet_main
[convenience] vnet main
u32 sw_if_index_out
Outgoing iface to proxied dev.
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
u32 * sw_iface_localsid4
Retrieve local SID from iface.
srv6_ad_flow_localsid_t ** sids
Pool of AD SID pointers.
#define VLIB_INIT_FUNCTION(x)
#define SID_CREATE_INVALID_ADJ_INDEX
vlib_combined_counter_main_t sid_cache_full_counters
counter_t bytes
byte counter
const static char *const srv6_ad_flow_ip6_nodes[]
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V,...
vlib_combined_counter_main_t rw_invalid_counters
Invalid rewrite counters.
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)
u32 adj_index_t
An index for adjacencies.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
VNET_FEATURE_INIT(srv6_ad4_flow_rewrite, static)
A virtual function table regisitered for a DPO type.
const static dpo_vft_t srv6_ad_flow_vft
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
#define pool_free(p)
Free a pool.
static void * clib_mem_alloc_aligned_at_offset(uword size, uword align, uword align_offset, int os_out_of_memory_on_failure)
#define pool_alloc(P, N)
Allocate N more free elements to pool (unspecified alignment).
ip46_address_t nh_addr
Proxied device address.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
#define SID_CREATE_IFACE_FEATURE_ERROR
@ VNET_SW_INTERFACE_TYPE_HARDWARE
void srv6_ad_flow_dpo_unlock(dpo_id_t *dpo)
#define SID_CREATE_INVALID_IFACE_INDEX
const static char *const *const srv6_ad_flow_nodes[DPO_PROTO_NUM]
vnet_interface_main_t interface_main