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"))
337 if (!(params & PARAM_AD_NH) &&
363 if ((params & params_chk) != params_chk)
371 *plugin_mem_p = ls_mem;
376 ls_mem->
nh_addr.ip4 = nh_addr.ip4;
378 ls_mem->
nh_addr.ip6 = nh_addr.ip6;
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",
dpo_type_t srv6_ad_flow_dpo_type
DPO type.
u32 sw_if_index_out
Outgoing iface to proxied dev.
dpo_lock_fn_t dv_lock
A reference counting lock function.
#define SID_CREATE_IFACE_FEATURE_ERROR
A virtual function table regisitered for a DPO type.
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
static void * clib_mem_alloc_aligned_at_offset(uword size, uword align, uword align_offset, int os_out_of_memory_on_failure)
static void clib_dlist_init(dlist_elt_t *pool, u32 index)
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define pool_alloc(P, N)
Allocate N more free elements to pool (unspecified alignment).
vnet_interface_main_t interface_main
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
srv6_ad_flow_entry_t * cache
Cache table.
#define SRV6_AD_FLOW_DEFAULT_CACHE_SIZE
static int srv6_ad_flow_localsid_removal_fn(ip6_sr_localsid_t *localsid)
uword unformat_srv6_ad_flow_localsid(unformat_input_t *input, va_list *args)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Combined counter to hold both packets and byte differences.
#define SID_CREATE_INVALID_IFACE_TYPE
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
static u32 ad_flow_calc_bihash_buckets(u32 n_elts)
unformat_function_t unformat_vnet_sw_interface
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
format_function_t format_vnet_sw_if_index_name
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 pool_len(p)
Number of elements in pool vector.
#define VLIB_INIT_FUNCTION(x)
u32 * sw_iface_localsid6
Retrieve local SID from iface.
description fragment has unexpected format
srv6_ad_flow_localsid_t ** sids
Pool of AD SID pointers.
vlib_combined_counter_main_t sid_cache_full_counters
#define clib_error_return(e, args...)
vnet_main_t * vnet_get_main(void)
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
unsigned char params_str[]
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
static const char *const *const srv6_ad_flow_nodes[DPO_PROTO_NUM]
dpo_type_t dpo_register_new_type(const dpo_vft_t *vft, const char *const *const *nodes)
Create and register a new DPO type.
u8 * format_srv6_ad_flow_localsid(u8 *s, va_list *args)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
#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.
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.
counter_t packets
packet counter
static clib_error_t * srv6_ad_flow_init(vlib_main_t *vm)
#define pool_put(P, E)
Free an object E in pool P.
static u32 ad_flow_calc_bihash_memory(u32 n_buckets, uword kv_size)
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)
ip46_address_t nh_addr
Proxied device address.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
unsigned char function_name[]
u32 sw_if_index_in
Incoming iface from proxied dev.
#define pool_free(p)
Free a pool.
ip6_sr_localsid_t * localsids
static u8 * format_srv6_ad_flow_dpo(u8 *s, va_list *args)
unsigned char keyword_str[]
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...
#define vec_free(V)
Free vector's memory (no header).
u32 srv6_localsid_behavior_id
SRv6 LocalSID behavior number.
vlib_combined_counter_main_t sid_bypass_counters
Packets/bytes bypassing NF.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
u32 adj_index_t
An index for adjacencies.
vlib_combined_counter_main_t sid_punt_counters
Packets/bytes punted.
VNET_FEATURE_INIT(srv6_ad4_flow_rewrite, static)
srv6_ad_flow_main_t srv6_ad_flow_main
vnet_main_t * vnet_main
[convenience] vnet main
clib_bihash_40_8_t ftable
Flow table.
u32 * sw_iface_localsid4
Retrieve local SID from iface.
static int srv6_ad_flow_localsid_creation_fn(ip6_sr_localsid_t *localsid)
void * plugin_mem
Memory to be used by the plugin callback functions.
void srv6_ad_flow_dpo_lock(dpo_id_t *dpo)
static void clib_mem_free(void *p)
vlib_combined_counter_main_t rw_invalid_counters
Invalid rewrite counters.
counter_t bytes
byte counter
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static uword max_log2(uword x)
static const char *const srv6_ad_flow_ip6_nodes[]
vnet_sw_interface_t * sw_interfaces
#define SID_CREATE_INVALID_ADJ_INDEX
void srv6_ad_flow_dpo_unlock(dpo_id_t *dpo)
Segment Routing main datastructure.
vnet_sw_interface_type_t type
#define SID_CREATE_INVALID_IFACE_INDEX
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.
u32 nh_adj
Adjacency index for out.
vlib_main_t * vlib_main
[convenience] vlib main
vlib_combined_counter_main_t rw_valid_counters
Valid rewrite counters.