FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
lcp_interface.c File Reference
+ Include dependency graph for lcp_interface.c:

Go to the source code of this file.

Data Structures

struct  lcp_itf_pair_names_t_
 
struct  lcp_itf_pair_sweep_ctx_t_
 

Macros

#define LCP_ITF_PAIR_DBG(...)   vlib_log_notice (lcp_itf_pair_logger, __VA_ARGS__);
 
#define LCP_ITF_PAIR_INFO(...)   vlib_log_notice (lcp_itf_pair_logger, __VA_ARGS__);
 

Typedefs

typedef struct lcp_itf_pair_names_t_ lcp_itf_pair_names_t
 
typedef struct lcp_itf_pair_sweep_ctx_t_ lcp_itf_pair_sweep_ctx_t
 

Functions

u32 lcp_itf_num_pairs (void)
 
u8format_lcp_itf_pair (u8 *s, va_list *args)
 
static walk_rc_t lcp_itf_pair_walk_show_cb (index_t api, void *ctx)
 
void lcp_itf_pair_show (u32 phy_sw_if_index)
 
lcp_itf_pair_tlcp_itf_pair_get (u32 index)
 Get an interface-pair object from its VPP index. More...
 
index_t lcp_itf_pair_find_by_vif (u32 vif_index)
 Find a interface-pair object from the host interface. More...
 
int lcp_itf_pair_add_sub (u32 vif, u8 *host_if_name, u32 sub_sw_if_index, u32 phy_sw_if_index, u8 *ns)
 
static void lcp_itf_unset_adjs (lcp_itf_pair_t *lip)
 
static void lcp_itf_set_adjs (lcp_itf_pair_t *lip)
 
int __clib_weak lcp_nl_drain_messages (void)
 
int lcp_itf_pair_add (u32 host_sw_if_index, u32 phy_sw_if_index, u8 *host_name, u32 host_index, lip_host_type_t host_type, u8 *ns)
 Create an interface-pair. More...
 
static clib_error_tlcp_netlink_add_link_vlan (int parent, u32 vlan, const char *name)
 
static clib_error_tlcp_netlink_del_link (const char *name)
 
int lcp_itf_pair_del (u32 phy_sw_if_index)
 
static void lcp_itf_pair_delete_by_index (index_t lipi)
 
int lcp_itf_pair_delete (u32 phy_sw_if_index)
 Delete a LCP_ITF_PAIR. More...
 
void lcp_itf_pair_walk (lcp_itf_pair_walk_cb_t cb, void *ctx)
 Walk/visit each of the interface pairs. More...
 
static clib_error_tlcp_itf_pair_config (vlib_main_t *vm, unformat_input_t *input)
 
static int lcp_validate_if_name (u8 *name)
 
static int lcp_itf_get_ns_fd (char *ns_name)
 
static void lcp_itf_set_vif_link_state (u32 vif_index, u8 up, u8 *ns)
 
int lcp_itf_pair_create (u32 phy_sw_if_index, u8 *host_if_name, lip_host_type_t host_if_type, u8 *ns, u32 *host_sw_if_indexp)
 Create an interface-pair from PHY sw_if_index and tap name. More...
 
static walk_rc_t lcp_itf_pair_walk_mark (index_t lipi, void *ctx)
 
int lcp_itf_pair_replace_begin (void)
 Begin and End the replace process. More...
 
static walk_rc_t lcp_itf_pair_walk_sweep (index_t lipi, void *arg)
 
int lcp_itf_pair_replace_end (void)
 
static uword lcp_itf_pair_process (vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
 
static clib_error_tlcp_itf_phy_add (vnet_main_t *vnm, u32 sw_if_index, u32 is_create)
 
 VNET_SW_INTERFACE_ADD_DEL_FUNCTION (lcp_itf_phy_add)
 
static clib_error_tlcp_itf_pair_link_up_down (vnet_main_t *vnm, u32 hw_if_index, u32 flags)
 
 VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION (lcp_itf_pair_link_up_down)
 
static clib_error_tlcp_itf_pair_init (vlib_main_t *vm)
 

Variables

static vlib_log_class_t lcp_itf_pair_logger
 
lcp_itf_pair_tlcp_itf_pair_pool
 Pool of LIP objects. More...
 
static uwordlip_db_by_vif
 DBs of interface-pair objects: More...
 
index_tlip_db_by_phy
 Retreive the pair in the DP. More...
 
u32lip_db_by_host
 
const char * lcp_itf_l3_feat_names [N_LCP_ITF_HOST][N_AF]
 
const fib_route_path_flags_t lcp_itf_route_path_flags [N_LCP_ITF_HOST]
 
static lcp_itf_pair_names_tlipn_names
 
static vlib_node_registration_t lcp_itf_pair_process_node
 (constructor) VLIB_REGISTER_NODE (lcp_itf_pair_process_node) More...
 

Macro Definition Documentation

◆ LCP_ITF_PAIR_DBG

#define LCP_ITF_PAIR_DBG (   ...)    vlib_log_notice (lcp_itf_pair_logger, __VA_ARGS__);

Definition at line 63 of file lcp_interface.c.

◆ LCP_ITF_PAIR_INFO

#define LCP_ITF_PAIR_INFO (   ...)    vlib_log_notice (lcp_itf_pair_logger, __VA_ARGS__);

Definition at line 66 of file lcp_interface.c.

Typedef Documentation

◆ lcp_itf_pair_names_t

◆ lcp_itf_pair_sweep_ctx_t

Function Documentation

◆ format_lcp_itf_pair()

u8* format_lcp_itf_pair ( u8 s,
va_list *  args 
)

Definition at line 70 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_itf_get_ns_fd()

static int lcp_itf_get_ns_fd ( char *  ns_name)
static

Definition at line 601 of file lcp_interface.c.

+ Here is the caller graph for this function:

◆ lcp_itf_num_pairs()

u32 lcp_itf_num_pairs ( void  )

Definition at line 48 of file lcp_interface.c.

+ Here is the call graph for this function:

◆ lcp_itf_pair_add()

int lcp_itf_pair_add ( u32  host_sw_if_index,
u32  phy_sw_if_index,
u8 host_name,
u32  host_index,
lip_host_type_t  host_type,
u8 ns 
)

Create an interface-pair.

Returns
error code

Definition at line 226 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_itf_pair_add_sub()

int lcp_itf_pair_add_sub ( u32  vif,
u8 host_if_name,
u32  sub_sw_if_index,
u32  phy_sw_if_index,
u8 ns 
)

Definition at line 160 of file lcp_interface.c.

+ Here is the call graph for this function:

◆ lcp_itf_pair_config()

static clib_error_t* lcp_itf_pair_config ( vlib_main_t vm,
unformat_input_t input 
)
static

Definition at line 497 of file lcp_interface.c.

+ Here is the call graph for this function:

◆ lcp_itf_pair_create()

int lcp_itf_pair_create ( u32  phy_sw_if_index,
u8 host_if_name,
lip_host_type_t  host_if_type,
u8 ns,
u32 host_sw_if_indexp 
)

Create an interface-pair from PHY sw_if_index and tap name.

Returns
error code

Definition at line 642 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_itf_pair_del()

int lcp_itf_pair_del ( u32  phy_sw_if_index)

Definition at line 380 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_itf_pair_delete()

int lcp_itf_pair_delete ( u32  phy_sw_if_index)

Delete a LCP_ITF_PAIR.

Definition at line 460 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_itf_pair_delete_by_index()

static void lcp_itf_pair_delete_by_index ( index_t  lipi)
static

Definition at line 435 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_itf_pair_find_by_vif()

index_t lcp_itf_pair_find_by_vif ( u32  vif_index)

Find a interface-pair object from the host interface.

Parameters
host_sw_if_indexhost interface
Returns
VPP's object index

Definition at line 147 of file lcp_interface.c.

◆ lcp_itf_pair_get()

lcp_itf_pair_t* lcp_itf_pair_get ( u32  index)

Get an interface-pair object from its VPP index.

Definition at line 141 of file lcp_interface.c.

+ Here is the caller graph for this function:

◆ lcp_itf_pair_init()

static clib_error_t* lcp_itf_pair_init ( vlib_main_t vm)
static

Definition at line 991 of file lcp_interface.c.

+ Here is the call graph for this function:

◆ lcp_itf_pair_link_up_down()

static clib_error_t* lcp_itf_pair_link_up_down ( vnet_main_t vnm,
u32  hw_if_index,
u32  flags 
)
static

Definition at line 954 of file lcp_interface.c.

+ Here is the call graph for this function:

◆ lcp_itf_pair_process()

static uword lcp_itf_pair_process ( vlib_main_t vm,
vlib_node_runtime_t rt,
vlib_frame_t f 
)
static

Definition at line 890 of file lcp_interface.c.

+ Here is the call graph for this function:

◆ lcp_itf_pair_replace_begin()

int lcp_itf_pair_replace_begin ( void  )

Begin and End the replace process.

Definition at line 846 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_itf_pair_replace_end()

int lcp_itf_pair_replace_end ( void  )

Definition at line 873 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_itf_pair_show()

void lcp_itf_pair_show ( u32  phy_sw_if_index)

Definition at line 117 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_itf_pair_walk()

void lcp_itf_pair_walk ( lcp_itf_pair_walk_cb_t  cb,
void *  ctx 
)

Walk/visit each of the interface pairs.

Definition at line 475 of file lcp_interface.c.

+ Here is the caller graph for this function:

◆ lcp_itf_pair_walk_mark()

static walk_rc_t lcp_itf_pair_walk_mark ( index_t  lipi,
void *  ctx 
)
static

Definition at line 834 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_itf_pair_walk_show_cb()

static walk_rc_t lcp_itf_pair_walk_show_cb ( index_t  api,
void *  ctx 
)
static

Definition at line 101 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_itf_pair_walk_sweep()

static walk_rc_t lcp_itf_pair_walk_sweep ( index_t  lipi,
void *  arg 
)
static

Definition at line 859 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_itf_phy_add()

static clib_error_t* lcp_itf_phy_add ( vnet_main_t vnm,
u32  sw_if_index,
u32  is_create 
)
static

Definition at line 925 of file lcp_interface.c.

+ Here is the call graph for this function:

◆ lcp_itf_set_adjs()

static void lcp_itf_set_adjs ( lcp_itf_pair_t lip)
static

Definition at line 195 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_itf_set_vif_link_state()

static void lcp_itf_set_vif_link_state ( u32  vif_index,
u8  up,
u8 ns 
)
static

Definition at line 612 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_itf_unset_adjs()

static void lcp_itf_unset_adjs ( lcp_itf_pair_t lip)
static

Definition at line 188 of file lcp_interface.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lcp_netlink_add_link_vlan()

static clib_error_t* lcp_netlink_add_link_vlan ( int  parent,
u32  vlan,
const char *  name 
)
static

Definition at line 330 of file lcp_interface.c.

+ Here is the caller graph for this function:

◆ lcp_netlink_del_link()

static clib_error_t* lcp_netlink_del_link ( const char *  name)
static

Definition at line 357 of file lcp_interface.c.

+ Here is the caller graph for this function:

◆ lcp_nl_drain_messages()

int __clib_weak lcp_nl_drain_messages ( void  )

Definition at line 220 of file lcp_interface.c.

+ Here is the caller graph for this function:

◆ lcp_validate_if_name()

static int lcp_validate_if_name ( u8 name)
static

Definition at line 568 of file lcp_interface.c.

+ Here is the caller graph for this function:

◆ VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION()

VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION ( lcp_itf_pair_link_up_down  )

◆ VNET_SW_INTERFACE_ADD_DEL_FUNCTION()

VNET_SW_INTERFACE_ADD_DEL_FUNCTION ( lcp_itf_phy_add  )

Variable Documentation

◆ lcp_itf_l3_feat_names

const char* lcp_itf_l3_feat_names[N_LCP_ITF_HOST][N_AF]
Initial value:
= {
[AF_IP4] = "linux-cp-xc-ip4",
[AF_IP6] = "linux-cp-xc-ip6",
},
[AF_IP4] = "linux-cp-xc-l3-ip4",
[AF_IP6] = "linux-cp-xc-l3-ip6",
},
}

Definition at line 171 of file lcp_interface.c.

◆ lcp_itf_pair_logger

vlib_log_class_t lcp_itf_pair_logger
static

Definition at line 40 of file lcp_interface.c.

◆ lcp_itf_pair_pool

lcp_itf_pair_t* lcp_itf_pair_pool

Pool of LIP objects.

Definition at line 45 of file lcp_interface.c.

◆ lcp_itf_pair_process_node

vlib_node_registration_t lcp_itf_pair_process_node
static
Initial value:
= {
.function = lcp_itf_pair_process,
.name = "linux-cp-itf-process",
}

(constructor) VLIB_REGISTER_NODE (lcp_itf_pair_process_node)

Definition at line 918 of file lcp_interface.c.

◆ lcp_itf_route_path_flags

const fib_route_path_flags_t lcp_itf_route_path_flags[N_LCP_ITF_HOST]
Initial value:

Definition at line 182 of file lcp_interface.c.

◆ lip_db_by_host

u32* lip_db_by_host

Definition at line 61 of file lcp_interface.c.

◆ lip_db_by_phy

index_t* lip_db_by_phy

Retreive the pair in the DP.

Definition at line 60 of file lcp_interface.c.

◆ lip_db_by_vif

uword* lip_db_by_vif
static

DBs of interface-pair objects:

  • key'd by VIF (linux ID)
  • key'd by VPP's physical interface
  • number of shared uses of VPP's tap/host interface

Definition at line 59 of file lcp_interface.c.

◆ lipn_names

lcp_itf_pair_names_t* lipn_names
static

Definition at line 494 of file lcp_interface.c.

lcp_itf_pair_process
static uword lcp_itf_pair_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
Definition: lcp_interface.c:890
AF_IP4
@ AF_IP4
Definition: ip_types.h:23
FIB_ROUTE_PATH_DVR
@ FIB_ROUTE_PATH_DVR
A path that resolves via a DVR DPO.
Definition: fib_types.h:393
LCP_ITF_HOST_TUN
@ LCP_ITF_HOST_TUN
Definition: lcp_interface.h:36
FIB_ROUTE_PATH_FLAG_NONE
@ FIB_ROUTE_PATH_FLAG_NONE
Definition: fib_types.h:332
VLIB_NODE_TYPE_PROCESS
@ VLIB_NODE_TYPE_PROCESS
Definition: node.h:84
AF_IP6
@ AF_IP6
Definition: ip_types.h:24
LCP_ITF_HOST_TAP
@ LCP_ITF_HOST_TAP
Definition: lcp_interface.h:35