|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
34 #define ADJ_NBR_SET_KEY(_key, _lt, _nh) \
36 ip46_address_copy(&(_key).ank_ip, (_nh)); \
37 _key.ank_linkt = (_lt); \
40 #define ADJ_NBR_ITF_OK(_proto, _itf) \
41 (((_itf) < vec_len(adj_nbr_tables[_proto])) && \
42 (NULL != adj_nbr_tables[_proto][(_itf)]))
44 #define ADJ_NBR_ASSERT_NH_PROTO(nh_proto, err) \
46 ASSERT (nh_proto < FIB_PROTOCOL_IP_MAX); \
47 const fib_protocol_t nh_proto__ = (nh_proto); \
48 if (nh_proto__ >= FIB_PROTOCOL_IP_MAX) \
50 clib_warning ("BUG: protocol %d > %d\n", \
52 FIB_PROTOCOL_IP_MAX); \
181 if (feature_count > 0)
219 &adj->rewrite_header);
236 &adj->rewrite_header);
240 &adj->rewrite_header);
241 adj->rewrite_header.max_l3_packet_bytes =
242 clib_min (adj->rewrite_header.max_l3_packet_bytes, mtu);
284 &adj->rewrite_header);
360 adj->rewrite_header.sw_if_index),
369 adj->rewrite_header.sw_if_index),
408 adj->rewrite_header.sw_if_index);
473 old_next != adj_next_index &&
521 sizeof(adj->rewrite_data),
529 sizeof(adj->rewrite_data));
636 ip46_address_t
nh = {
657 const ip6_address_t *
addr,
664 ip46_address_t
nh = {
686 const ip46_address_t *
nh,
695 switch (adj_nh_proto)
976 else if (
unformat (input,
"%d", &ai))
1041 .path =
"show adj nbr",
1042 .short_help =
"show adj nbr [<adj_index>] [interface]",
1055 s =
format (s,
": via %U",
1060 vnm, adj->rewrite_header.sw_if_index);
1073 s =
format (s,
" via %U ",
1078 &adj->rewrite_header, sizeof (adj->rewrite_data), 0);
1161 "ip6-discover-neighbor",
1166 "mpls-adj-incomplete",
1189 .function_opaque = 0,
u32 adj_dpo_get_urpf(const dpo_id_t *dpo)
@ FIB_NODE_BW_REASON_FLAG_ADJ_DOWN
adj_flags_t ia_flags
Flags on the adjacency 1-bytes.
fib_protocol_t ia_nh_proto
The protocol of the neighbor/peer.
void adj_nbr_walk_nh4(u32 sw_if_index, const ip4_address_t *addr, adj_walk_cb_t cb, void *ctx)
Walk adjacencies on a link with a given v4 next-hop.
static ip46_type_t adj_proto_to_46(fib_protocol_t proto)
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
enum adj_nbr_interface_flags_t_ adj_nbr_interface_flags_t
Flags associated with the interface state walks.
index_t dpoi_index
the index of objects of that type
static adj_walk_rc_t adj_nbr_ethernet_mac_change_one(adj_index_t ai, void *arg)
@ IP_LOOKUP_NEXT_ARP
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
u8 * format_vnet_link(u8 *s, va_list *ap)
void adj_delegate_adj_created(ip_adjacency_t *adj)
@ FIB_NODE_BW_REASON_FLAG_INTERFACE_UP
static clib_error_t * adj_nbr_sw_interface_state_change(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
Registered function for SW interface state changes.
ip_lookup_main_t lookup_main
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
ip_adjacency_t * adj_pool
The global adjacency pool.
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.
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
static vlib_cli_command_t ip4_show_fib_command
(constructor) VLIB_CLI_COMMAND (ip4_show_fib_command)
ip4_main_t ip4_main
Global ip4 main structure.
static walk_rc_t adj_nbr_hw_sw_interface_state_change(vnet_main_t *vnm, u32 sw_if_index, void *arg)
Invoked on each SW interface of a HW interface when the HW interface state changes.
#define ip46_address_initializer
u32 adj_get_sw_if_index(adj_index_t ai)
Return the sw interface index of the adjacency.
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
static void adj_nbr_evaluate_feature(adj_index_t ai)
Check and set feature flags if o/p interface has any o/p features.
enum adj_walk_rc_t_ adj_walk_rc_t
return codes from a adjacency walker callback function
static u8 ip46_address_is_ip4(const ip46_address_t *ip46)
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
void vnet_update_adjacency_for_sw_interface(vnet_main_t *vnm, u32 sw_if_index, u32 ai)
const ip46_address_t ADJ_BCAST_ADDR
The special broadcast address (to construct a broadcast adjacency.
static uword hash_elts(void *v)
@ VNET_ITF_FUNC_PRIORITY_HIGH
u32 * config_index_by_sw_if_index
@ ADJ_NBR_REWRITE_FLAG_COMPLETE
An indication that the rewrite is complete, i.e.
@ VNET_REWRITE_HAS_FEATURES
This adjacency/interface has output features configured.
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
u16 adj_dpo_get_mtu(const dpo_id_t *dpo)
@ VNET_HW_INTERFACE_FLAG_LINK_UP
static void vnet_rewrite_clear_data_internal(vnet_rewrite_header_t *rw, int max_size)
adj_nbr_interface_flags_t flags
Flags on the interface.
static uword ** adj_nbr_tables[FIB_PROTOCOL_IP_MAX]
vnet_link_t ia_link
link/ether-type 1 bytes
void adj_nbr_set_mtu(adj_index_t adj_index, u16 mtu)
Set the MTU on an adjacency.
enum adj_nbr_rewrite_flag_t_ adj_nbr_rewrite_flag_t
When adding a rewrite to an adjacency these are flags that apply to that rewrite.
static adj_walk_rc_t adj_nbr_interface_state_change_one(adj_index_t ai, void *arg)
const static dpo_vft_t adj_nbr_incompl_dpo_vft
static clib_error_t * adj_nbr_interface_add_del(vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
adj_nbr_interface_add_del
fib_node_bw_reason_flag_t fnbw_reason
The reason/trigger for the backwalk.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
#define vec_elt(v, i)
Get vector value at index i.
static void hash_set_mem_alloc(uword **h, const void *key, uword v)
u8 * format_adj_nbr_incomplete(u8 *s, va_list *ap)
Format aa incomplete neigbour (ARP) adjacency.
const static char *const nbr_incomplete_ip6_nodes[]
#define hash_create_mem(elts, key_bytes, value_bytes)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static u8 ip46_address_is_equal(const ip46_address_t *ip46_1, const ip46_address_t *ip46_2)
Context for the state change walk of the DB.
const static char *const nbr_incomplete_ip4_nodes[]
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
static adj_index_t adj_get_index(const ip_adjacency_t *adj)
Get a pointer to an adjacency object from its index.
#define FIB_PROTOCOL_IP_MAX
Definition outside of enum so it does not need to be included in non-defaulted switch statements.
vnet_main_t * vnet_get_main(void)
format_function_t format_vnet_rewrite
#define vlib_worker_thread_barrier_sync(X)
@ ADJ_FLAG_SYNC_WALK_ACTIVE
static void adj_mem_show(void)
static ip_adjacency_t * adj_nbr_alloc(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
adj_index_t adj_nbr_add_or_lock_w_rewrite(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index, u8 *rewrite)
Add (and lock) a new or lock an existing neighbour adjacency.
#define FOR_EACH_VNET_LINK(_link)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION_PRIO(adj_nbr_sw_interface_state_change, VNET_ITF_FUNC_PRIORITY_HIGH)
#define vec_foreach_index(var, v)
Iterate over vector indices.
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.
@ IP_LOOKUP_NEXT_REWRITE
This packet is to be rewritten and forwarded to the next processing node.
static void adj_nbr_insert(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index, adj_index_t adj_index)
static clib_error_t * adj_nbr_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vnet_link_t fib_proto_to_link(fib_protocol_t proto)
Convert from a protocol to a link type.
VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION_PRIO(adj_nbr_hw_interface_state_change, VNET_ITF_FUNC_PRIORITY_HIGH)
vlib_node_registration_t ip6_discover_neighbor_node
(constructor) VLIB_REGISTER_NODE (ip6_discover_neighbor_node)
void adj_delegate_adj_modified(ip_adjacency_t *adj)
vnet_feature_config_main_t * cm
const static char *const *const nbr_incomplete_nodes[DPO_PROTO_NUM]
@ FIB_NODE_BW_REASON_FLAG_ADJ_UPDATE
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
struct adj_nbr_interface_state_change_ctx_t_ adj_nbr_interface_state_change_ctx_t
Context for the state change walk of the DB.
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u32 adj_nbr_db_size(void)
Return the size of the adjacency database.
dpo_lock_fn_t dv_lock
A reference counting lock function.
vnet_feature_main_t feature_main
@ IP_LOOKUP_NEXT_BCAST
Broadcast Adjacency.
static void adj_dpo_lock(dpo_id_t *dpo)
ethernet_address_change_ctx_t * address_change_callbacks
Functions to call when interface hw address changes.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static void vnet_rewrite_set_data_internal(vnet_rewrite_header_t *rw, int max_size, void *data, int data_bytes)
@ FIB_NODE_BW_REASON_FLAG_INTERFACE_DOWN
static u8 ip46_address_is_zero(const ip46_address_t *ip46)
void adj_nbr_update_rewrite_internal(ip_adjacency_t *adj, ip_lookup_next_t adj_next_index, u32 this_node, u32 next_node, u8 *rewrite)
adj_nbr_update_rewrite_internal
ip_lookup_next_t
An adjacency is a representation of an attached L3 peer.
void fib_walk_sync(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_back_walk_ctx_t *ctx)
Back walk all the children of a FIB node.
#define hash_get_mem(h, key)
void vnet_rewrite_init(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t linkt, u32 this_node, u32 next_node, vnet_rewrite_header_t *rw)
#define vec_free(V)
Free vector's memory (no header).
void adj_nbr_remove(adj_index_t ai, fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
u32 vnet_tx_node_index_for_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
union ip_adjacency_t_::@144 sub_type
#define pool_len(p)
Number of elements in pool vector.
adj_nbr_interface_flags_t_
Flags associated with the interface state walks.
ethernet_main_t ethernet_main
void adj_nbr_module_init(void)
Module initialisation.
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
static u32 adj_get_rewrite_node(vnet_link_t linkt)
format_function_t format_ip46_address
i16 ** feature_count_by_sw_if_index
feature reference counts by interface
u32 ia_node_index
The VLIB node in which this adj is used to forward packets.
#define ADJ_NBR_SET_KEY(_key, _lt, _nh)
vlib_node_registration_t ip4_arp_node
(constructor) VLIB_REGISTER_NODE (ip4_arp_node)
static void adj_dpo_unlock(dpo_id_t *dpo)
#define ADJ_NBR_ITF_OK(_proto, _itf)
u32 ia_cfg_index
feature [arc] config index
#define vec_foreach(var, vec)
Vector iterator.
@ FIB_NODE_BW_REASON_FLAG_INTERFACE_DELETE
const static char *const nbr_incomplete_mpls_nodes[]
static uword pool_elts(void *v)
Number of active elements in a pool.
const static char *const *const nbr_nodes[DPO_PROTO_NUM]
const static char *const nbr_ip6_nodes[]
ip_lookup_main_t lookup_main
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(adj_nbr_interface_add_del)
const static char *const nbr_ip4_nodes[]
The per-protocol VLIB graph nodes that are assigned to an adjacency object.
const static char *const nbr_mpls_nodes[]
static void hash_unset_mem_free(uword **h, const void *key)
u32 adj_index_t
An index for adjacencies.
adj_index_t adj_nbr_find(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index)
Lookup neighbor adjancency.
void adj_nbr_walk_nh6(u32 sw_if_index, const ip6_address_t *addr, adj_walk_cb_t cb, void *ctx)
Walk adjacencies on a link with a given v6 next-hop.
void adj_nbr_update_rewrite(adj_index_t adj_index, adj_nbr_rewrite_flag_t flags, u8 *rewrite)
adj_nbr_update_rewrite
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
void adj_lock(adj_index_t adj_index)
Take a reference counting lock on the adjacency.
A virtual function table regisitered for a DPO type.
static adj_walk_rc_t adj_nbr_show_one(adj_index_t ai, void *arg)
static vlib_main_t * vlib_get_main(void)
const static char *const nbr_ethernet_nodes[]
void adj_nbr_walk_nh(u32 sw_if_index, fib_protocol_t adj_nh_proto, const ip46_address_t *nh, adj_walk_cb_t cb, void *ctx)
Walk adjacencies on a link with a given next-hop.
static clib_error_t * adj_nbr_hw_interface_state_change(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Registered callback for HW interface state changes.
static void adj_nbr_ethernet_change_mac(ethernet_main_t *em, u32 sw_if_index, uword opaque)
Callback function invoked when an interface's MAC Address changes.
struct ip_adjacency_t_::@144::@145 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
Context passed between object during a back walk.
ip_adjacency_t * adj_alloc(fib_protocol_t proto)
void adj_nbr_walk(u32 sw_if_index, fib_protocol_t adj_nh_proto, adj_walk_cb_t cb, void *ctx)
Walk all adjacencies on a link for a given next-hop protocol.
@ FIB_NODE_BW_FLAG_FORCE_SYNC
Force the walk to be synchronous.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
@ DPO_ADJACENCY_INCOMPLETE
#define ADJ_NBR_ASSERT_NH_PROTO(nh_proto, err)
void vnet_hw_interface_walk_sw(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_sw_interface_walk_t fn, void *ctx)
Walk the SW interfaces on a HW interface - this is the super interface and any sub-interfaces.
adj_walk_rc_t(* adj_walk_cb_t)(adj_index_t ai, void *ctx)
Call back function when walking adjacencies.
vnet_feature_config_main_t * feature_config_mains
feature config main objects
struct adj_nbr_key_t_ adj_nbr_key_t
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
u8 * format_adj_nbr(u8 *s, va_list *ap)
Format a neigbour (REWRITE) adjacency.
vl_api_interface_index_t sw_if_index
#define hash_foreach_mem(key_var, value_var, h, body)
enum walk_rc_t_ walk_rc_t
Walk return code.
const static dpo_vft_t adj_nbr_dpo_vft
static u32 adj_get_nd_node(fib_protocol_t proto)
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
u8 output_feature_arc_index
u8 output_feature_arc_index
void dpo_register(dpo_type_t type, const dpo_vft_t *vft, const char *const *const *nodes)
For a given DPO type Register:
void vnet_rewrite_update_mtu(vnet_main_t *vnm, vnet_link_t linkt, vnet_rewrite_header_t *rw)
vl_api_wireguard_peer_flags_t flags
static adj_walk_rc_t adj_nbr_interface_delete_one(adj_index_t ai, void *arg)