|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
28 #define REP_DBG(_rep, _fmt, _args...) \
30 vlib_log_debug(replicate_logger, \
33 replicate_get_index(_rep), \
34 REPLICATE_FORMAT_NONE, \
38 #define foreach_replicate_dpo_error \
39 _(BUFFER_ALLOCATION_FAILURE, "Buffer Allocation Failure")
42 #define _(sym,str) REPLICATE_DPO_ERROR_##sym,
49 #define _(sym,string) string,
65 .stat_segment_name =
"/net/mroute",
107 int flags = va_arg (*args,
int);
115 s =
format (s,
"has-local ");
140 s =
format(s,
"to:[%Ld:%Ld]]",
to.packets,
to.bytes);
163 u32 indent = va_arg(*args,
u32);
227 ASSERT(bucket < rep->rep_n_buckets);
305 ASSERT(bucket < n_buckets);
424 dpo_id_t *new_buckets, *old_buckets, *tmp_dpo;
497 for (ii = n_buckets; ii < old_n_buckets; ii++)
557 dpo_id_t *old_buckets, *copy_buckets;
573 (&old_buckets[bucket]));
712 .path =
"show replicate",
713 .short_help =
"show replicate [<index>]",
742 to_next, n_left_to_next);
746 u32 next0, ci0, bi0, bucket, repi0;
774 REPLICATE_DPO_ERROR_BUFFER_ALLOCATION_FAILURE, 1);
777 for (bucket = 0; bucket < num_cloned; bucket++)
800 to_next, n_left_to_next,
814 return frame->n_vectors;
824 s =
format (s,
"replicate: %d via %U",
843 .name =
"ip4-replicate",
844 .vector_size =
sizeof (
u32),
869 .name =
"ip6-replicate",
870 .vector_size =
sizeof (
u32),
895 .name =
"mpls-replicate",
896 .vector_size =
sizeof (
u32),
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
#define foreach_replicate_dpo_error
int dpo_is_drop(const dpo_id_t *dpo)
The Drop DPO will drop all packets, no questions asked.
const static char *const *const replicate_nodes[DPO_PROTO_NUM]
u16 dpoi_next_node
The next VLIB node to follow.
static u32 vlib_num_workers()
index_t dpoi_index
the index of objects of that type
static void replicate_lock(dpo_id_t *dpo)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
static uword ip6_replicate(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
nat44_ei_hairpin_src_next_t next_index
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
dpo_type_t dpoi_type
the type
#define REP_DBG(_rep, _fmt, _args...)
#define REP_NUM_INLINE_BUCKETS
The number of buckets that a load-balance object can have and still fit in one cache-line.
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
vlib_main_t vlib_node_runtime_t * node
static const dpo_id_t * replicate_get_bucket_i(const replicate_t *rep, u32 bucket)
u8 * format_replicate(u8 *s, va_list *args)
#define REP_HAS_INLINE_BUCKETS(_rep)
u8 * format_dpo_type(u8 *s, va_list *args)
format a DPO type
int dpo_is_receive(const dpo_id_t *dpo)
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.
clib_error_t * replicate_dpo_init(vlib_main_t *vm)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
char * name
The counter collection's name.
#define VLIB_BUFFER_CLONE_HEAD_SIZE
static load_balance_path_t * replicate_multipath_next_hop_fixup(load_balance_path_t *nhs, dpo_proto_t drop_proto)
vl_api_gbp_next_hop_t nhs[8]
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static clib_error_t * replicate_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 rep_locks
The number of locks, which is approximately the number of users, of this load-balance.
vlib_node_registration_t ip4_replicate_node
IP4 replication node.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static u8 * format_replicate_dpo(u8 *s, va_list *args)
#define pool_foreach(VAR, POOL)
Iterate through pool.
u16 rep_n_buckets
number of buckets in the replicate.
static void replicate_mem_show(void)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define MPLS_IS_REPLICATE
The top bit of the index, which is the result of the MPLS lookup is used to determine if the DPO is a...
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
void dpo_stack(dpo_type_t child_type, dpo_proto_t child_proto, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child-parent relationship.
vlib_node_registration_t ip6_replicate_node
IPv6 replication node.
Combined counter to hold both packets and byte differences.
static_always_inline uword vlib_get_thread_index(void)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
void replicate_set_bucket(index_t repi, u32 bucket, const dpo_id_t *next)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
static uword ip4_replicate(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
struct replicate_trace_t_ replicate_trace_t
const static char *const replicate_ip4_nodes[]
The per-protocol VLIB graph nodes that are assigned to a replicate object.
void fib_show_memory_usage(const char *name, u32 in_use_elts, u32 allocd_elts, size_t size_elt)
Show the memory usage for a type.
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.
static void replicate_destroy(replicate_t *rep)
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static void replicate_unlock(dpo_id_t *dpo)
sll srl srl sll sra u16x4 i
static u16 vlib_buffer_clone(vlib_main_t *vm, u32 src_buffer, u32 *buffers, u16 n_buffers, u16 head_end_offset)
Create multiple clones of buffer and store them in the supplied array.
index_t replicate_create(u32 n_buckets, dpo_proto_t rep_proto)
vnet_feature_config_main_t * cm
const static char *const replicate_ip6_nodes[]
static char * replicate_dpo_error_strings[]
const static dpo_vft_t rep_vft
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
dpo_lock_fn_t dv_lock
A reference counting lock function.
replicate_flags_t rep_flags
Flags specifying the replicate properties/behaviour.
#define CLIB_MEMORY_BARRIER()
#define CLIB_CACHE_LINE_BYTES
struct _vlib_node_registration vlib_node_registration_t
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
const static char *const replicate_mpls_nodes[]
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject.
int replicate_is_drop(const dpo_id_t *dpo)
static u8 * format_replicate_flags(u8 *s, va_list *args)
static dpo_id_t * replicate_get_buckets(replicate_t *rep)
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).
#define pool_len(p)
Number of elements in pool vector.
#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.
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
dpo_id_t * rep_buckets
Vector of buckets containing the next DPOs, sized as repo_num.
static void replicate_set_n_buckets(replicate_t *rep, u32 n_buckets)
description fragment has unexpected format
A collection of combined counters.
vlib_put_next_frame(vm, node, next_index, 0)
vlib_log_class_t replicate_logger
the logger
#define VLIB_INIT_FUNCTION(x)
@ REPLICATE_FORMAT_DETAIL
vlib_combined_counter_main_t repm_counters
#define vec_foreach(var, vec)
Vector iterator.
dpo_id_t rep_buckets_inline[REP_NUM_INLINE_BUCKETS]
The rest of the cache line is used for buckets.
static uword pool_elts(void *v)
Number of active elements in a pool.
vlib_node_registration_t mpls_replicate_node
MPLS replication node.
static uword mpls_replicate(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
@ REPLICATE_FLAGS_HAS_LOCAL
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void replicate_module_init(void)
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
A virtual function table regisitered for a DPO type.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
enum replicate_format_flags_t_ replicate_format_flags_t
Flags controlling load-balance formatting/display.
static u8 * format_replicate_trace(u8 *s, va_list *args)
enum replicate_flags_t_ replicate_flags_t
Flags on the replicate DPO.
static u8 * replicate_format(index_t repi, replicate_format_flags_t flags, u32 indent, u8 *s)
static replicate_t * replicate_create_i(u32 num_buckets, dpo_proto_t rep_proto)
static replicate_t * replicate_alloc_i(void)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
static index_t replicate_get_index(const replicate_t *rep)
static replicate_t * replicate_get(index_t repi)
replicate_main_t replicate_main
The one instance of replicate main.
static void replicate_set_bucket_i(replicate_t *rep, u32 bucket, dpo_id_t *buckets, const dpo_id_t *next)
static void replicate_fill_buckets(replicate_t *rep, load_balance_path_t *nhs, dpo_id_t *buckets, u32 n_buckets)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
#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).
One path from an [EU]CMP set that the client wants to add to a load-balance object.
void replicate_multipath_update(const dpo_id_t *dpo, load_balance_path_t *next_hops)
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
static uword replicate_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static vlib_cli_command_t replicate_show_command
(constructor) VLIB_CLI_COMMAND (replicate_show_command)
dpo_proto_t rep_proto
The protocol of packets that traverse this REP.
replicate_t * replicate_pool
Pool of all DPOs.
index_t replicate_dup(replicate_flags_t flags, index_t repi)
vlib_increment_combined_counter(ccm, ti, sw_if_index, n_buffers, n_bytes)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
void dpo_register(dpo_type_t type, const dpo_vft_t *vft, const char *const *const *nodes)
For a given DPO type Register:
VLIB buffer representation.
const dpo_id_t * replicate_get_bucket(index_t repi, u32 bucket)
#define VLIB_REGISTER_NODE(x,...)
vl_api_wireguard_peer_flags_t flags