|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
15 #ifndef included_map_h
16 #define included_map_h
29 #include <map/map.api_enum.h>
31 #define MAP_SKIP_IP6_LOOKUP 1
33 #define MAP_ERR_GOOD 0
34 #define MAP_ERR_BAD_POOL_SIZE -1
35 #define MAP_ERR_BAD_HT_RATIO -2
36 #define MAP_ERR_BAD_LIFETIME -3
37 #define MAP_ERR_BAD_BUFFERS -4
38 #define MAP_ERR_BAD_BUFFERS_TOO_LARGE -5
39 #define MAP_ERR_UNSUPPORTED -6
43 ip6_address_t * ip6_src,
u8 ip6_src_len,
44 u8 ea_bits_len,
u8 psid_offset,
u8 psid_length,
104 "MAP domain fits in one cacheline");
116 #define MAP_REASS_INDEX_NONE ((u16)0xffff)
131 #ifdef MAP_SKIP_IP6_LOOKUP
254 return clib_net_to_host_u64 (d->
rules[psid].as_u64[0]);
266 return clib_host_to_net_u64 (
map_get_pfx (d, clib_net_to_host_u32 (
addr),
267 clib_net_to_host_u16 (
port)));
280 return clib_net_to_host_u64 (d->
rules[psid].as_u64[1]);
282 return clib_net_to_host_u64 (d->
ip6_prefix.as_u64[1]);
292 return ((
u64)
addr << 16) | psid;
298 return clib_host_to_net_u64 (
map_get_sfx (d, clib_net_to_host_u32 (
addr),
299 clib_net_to_host_u16 (
port)));
305 ASSERT (prefix_len == 64 || prefix_len == 96);
306 if (prefix_len == 96)
307 return clib_host_to_net_u32 (clib_net_to_host_u64 (
addr->as_u64[1]));
309 return clib_host_to_net_u32 (clib_net_to_host_u64 (
addr->as_u64[1]) >>
321 *
error = MAP_ERROR_NO_DOMAIN;
324 *map_domain_index = mdi;
341 *
error = MAP_ERROR_NO_DOMAIN;
345 *map_domain_index = mdi;
408 u32 pi0 = to_next[0] =
from[0];
416 n_left_to_next, pi0,
next);
426 u8 opt_len, opts_len, kind;
435 for (; opts_len > 0; opts_len -= opt_len,
data += opt_len)
452 if (opt_len < 2 || opt_len > opts_len)
474 #ifdef MAP_SKIP_IP6_LOOKUP
488 #ifdef MAP_SKIP_IP6_LOOKUP
vlib_node_registration_t ip4_map_t_node
(constructor) VLIB_REGISTER_NODE (ip4_map_t_node)
#define FIB_PROTOCOL_MAX
Definition outside of enum so it does not need to be included in non-defaulted switch statements.
map_domain_extra_t * domain_extras
static_always_inline void map_send_all_to_node(vlib_main_t *vm, u32 *pi_vector, vlib_node_runtime_t *node, vlib_error_t *error, u32 next)
@ MAP_DOMAIN_IPV4_FRAGMENT
clib_error_t * map_plugin_api_hookup(vlib_main_t *vm)
index_t dpoi_index
the index of objects of that type
@ TCP_OPTION_EOL
End of options.
int map_param_set_security_check(bool enable, bool fragments)
vlib_node_registration_t ip6_map_t_tcp_udp_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_tcp_udp_node)
#define clib_memcpy(d, s, n)
nat44_ei_hairpin_src_next_t next_index
STATIC_ASSERT((sizeof(map_domain_t)<=CLIB_CACHE_LINE_BYTES), "MAP domain fits in one cacheline")
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
ip4_address_t icmp4_src_address
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
struct _tcp_header tcp_header_t
int map_if_enable_disable(bool is_enable, u32 sw_if_index, bool is_translation)
int map_delete_domain(u32 map_domain_index)
vlib_main_t vlib_node_runtime_t * node
static_always_inline bool ip6_map_ip4_lookup_bypass(vlib_buffer_t *p0, ip4_header_t *ip)
fib_node_t node
Linkage into the FIB graph.
static_always_inline map_domain_t * ip6_map_get_domain(ip6_address_t *addr, u32 *map_domain_index, u8 *error)
lpm_t * ip6_src_prefix_tbl
#define FIB_NODE_INDEX_INVALID
@ TCP_OPTION_NOOP
No operation.
struct map_main_pre_resolved_t_ map_main_pre_resolved_t
A pre-resolved next-hop.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
uword * bm_encap_enabled_by_sw_if
static_always_inline u32 ip6_map_t_embedded_address(map_domain_t *d, ip6_address_t *addr)
vlib_node_registration_t ip4_map_t_fragmented_node
(constructor) VLIB_REGISTER_NODE (ip4_map_t_fragmented_node)
static void map_add_trace(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_buffer_t *b, u32 map_domain_index, u16 port)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
#define clib_atomic_release(a)
fib_node_index_t fei
The FIB entry index of the next-hop.
static void map_domain_counter_lock(map_main_t *mm)
u32 sibling
This object sibling index on the FIB entry's child dependency list.
manual_print typedef ip6_prefix
int map_param_set_icmp6(u8 enable_unreachable)
static_always_inline void map_mss_clamping(tcp_header_t *tcp, ip_csum_t *sum, u16 mss_clamping)
vlib_simple_counter_main_t icmp_relayed
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static void map_domain_counter_unlock(map_main_t *mm)
vl_counter_map_enum_t map_error_t
static_always_inline u64 map_get_sfx(map_domain_t *d, u32 addr, u16 port)
int map_param_set_fragmentation(bool inner, bool ignore_df)
int map_param_set_icmp(ip4_address_t *ip4_err_relay_src)
int map_param_set_traffic_class(bool copy, u8 tc)
vlib_node_registration_t ip4_map_t_icmp_node
(constructor) VLIB_REGISTER_NODE (ip4_map_t_icmp_node)
void map_pre_resolve(ip4_address_t *ip4, ip6_address_t *ip6, bool is_del)
u64 map_error_counter_get(u32 node_index, map_error_t map_error)
#define clib_atomic_test_and_set(a)
#define static_always_inline
u32 fib_node_index_t
A typedef of a node index.
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
uword ip4_sv_reass_custom_next_index
static_always_inline map_domain_t * ip4_map_get_domain(ip4_address_t *addr, u32 *map_domain_index, u8 *error)
int map_add_del_psid(u32 map_domain_index, u16 psid, ip6_address_t *tep, bool is_add)
vlib_combined_counter_main_t * domain_counters
u32(* lookup)(struct lpm_ *lpm, void *addr_v, u8 pfxlen)
vlib_node_registration_t ip6_map_t_icmp_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_icmp_node)
vlib_node_registration_t ip6_map_t_fragmented_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_fragmented_node)
vlib_node_registration_t ip6_map_node
(constructor) VLIB_REGISTER_NODE (ip6_map_node)
vlib_node_registration_t ip4_map_t_tcp_udp_node
(constructor) VLIB_REGISTER_NODE (ip4_map_t_tcp_udp_node)
#define CLIB_CACHE_LINE_BYTES
struct _vlib_node_registration vlib_node_registration_t
int map_param_set_tcp(u16 tcp_mss)
#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.
template key/value backing page structure
static_always_inline u32 map_get_ip4(ip6_address_t *addr, u16 prefix_len)
map_main_pre_resolved_t pre_resolved[FIB_PROTOCOL_MAX]
Pre-resolved next hops for v4 and v6.
static void mss_clamping(u16 mss_clamping, tcp_header_t *tcp, ip_csum_t *sum)
static_always_inline u64 map_get_pfx(map_domain_t *d, u32 addr, u16 port)
A collection of combined counters.
vlib_node_registration_t ip6_map_t_node
(constructor) VLIB_REGISTER_NODE (ip6_map_t_node)
void map_ip6_drop_pi(u32 pi)
vlib_put_next_frame(vm, node, next_index, 0)
volatile u32 * counter_lock
static_always_inline u64 map_get_sfx_net(map_domain_t *d, u32 addr, u16 port)
@ TCP_OPTION_MSS
Limit MSS.
static_always_inline bool ip4_map_ip6_lookup_bypass(vlib_buffer_t *p0, ip4_header_t *ip)
uword * bm_trans_enabled_by_sw_if
manual_print typedef ip4_prefix
int map_create_domain(ip4_address_t *ip4_prefix, u8 ip4_prefix_len, ip6_address_t *ip6_prefix, u8 ip6_prefix_len, ip6_address_t *ip6_src, u8 ip6_src_len, u8 ea_bits_len, u8 psid_offset, u8 psid_length, u32 *map_domain_index, u16 mtu, u8 flags, u8 *tag)
An node in the FIB graph.
#define ip_csum_update(sum, old, new, type, field)
A collection of simple counters.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
u8 * format_map_trace(u8 *s, va_list *args)
static_always_inline u64 map_get_pfx_net(map_domain_t *d, u32 addr, u16 port)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
vlib_simple_counter_main_t * simple_domain_counters
static_always_inline void ip4_map_t_embedded_address(map_domain_t *d, ip6_address_t *ip6, const ip4_address_t *ip4)
dpo_id_t dpo
The Load-balance object index to use to forward.
vlib_node_registration_t ip4_map_node
(constructor) VLIB_REGISTER_NODE (ip4_map_node)
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).
VLIB buffer representation.
vl_api_wireguard_peer_flags_t flags