FD.io VPP  v21.10.1-2-g0a485f517
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_match_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__);
 
#define LCP_ITF_PAIR_ERR(...)   vlib_log_err (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)
 
void lcp_itf_pair_register_vft (lcp_itf_pair_vft_t *lcp_itf_vft)
 
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 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, u16 proto, 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 void lcp_itf_set_link_state (const lcp_itf_pair_t *lip, u8 state)
 
static walk_rc_t lcp_itf_pair_find_walk (vnet_main_t *vnm, u32 sw_if_index, void *arg)
 
static index_t lcp_itf_pair_find_by_outer_vlan (u32 sup_if_index, u16 vlan, bool dot1ad)
 
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 = NULL
 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
 
static lcp_itf_pair_vft_tlcp_itf_vfts = NULL
 vector of virtual function table More...
 
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 76 of file lcp_interface.c.

◆ LCP_ITF_PAIR_ERR

#define LCP_ITF_PAIR_ERR (   ...)    vlib_log_err (lcp_itf_pair_logger, __VA_ARGS__);

Definition at line 82 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 79 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 85 of file lcp_interface.c.

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

◆ lcp_itf_num_pairs()

u32 lcp_itf_num_pairs ( void  )

Definition at line 50 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 245 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 178 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 536 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 727 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 410 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 499 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 474 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_outer_vlan()

static index_t lcp_itf_pair_find_by_outer_vlan ( u32  sup_if_index,
u16  vlan,
bool  dot1ad 
)
static

Definition at line 707 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 165 of file lcp_interface.c.

+ Here is the caller graph for this function:

◆ lcp_itf_pair_find_walk()

static walk_rc_t lcp_itf_pair_find_walk ( vnet_main_t vnm,
u32  sw_if_index,
void *  arg 
)
static

Definition at line 680 of file lcp_interface.c.

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

◆ 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 156 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 1194 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 1157 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 1093 of file lcp_interface.c.

+ Here is the call graph for this function:

◆ lcp_itf_pair_register_vft()

void lcp_itf_pair_register_vft ( lcp_itf_pair_vft_t lcp_itf_vft)

Definition at line 71 of file lcp_interface.c.

◆ lcp_itf_pair_replace_begin()

int lcp_itf_pair_replace_begin ( void  )

Begin and End the replace process.

Definition at line 1049 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 1076 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 132 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 514 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 1037 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 116 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 1062 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 1128 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 220 of file lcp_interface.c.

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

◆ lcp_itf_set_link_state()

static void lcp_itf_set_link_state ( const lcp_itf_pair_t lip,
u8  state 
)
static

Definition at line 640 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 213 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,
u16  proto,
const char *  name 
)
static

Definition at line 352 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 387 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 607 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 196 of file lcp_interface.c.

◆ lcp_itf_pair_logger

vlib_log_class_t lcp_itf_pair_logger
static

Definition at line 42 of file lcp_interface.c.

◆ lcp_itf_pair_pool

lcp_itf_pair_t* lcp_itf_pair_pool = NULL

Pool of LIP objects.

Definition at line 47 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 1121 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 207 of file lcp_interface.c.

◆ lcp_itf_vfts

lcp_itf_pair_vft_t* lcp_itf_vfts = NULL
static

vector of virtual function table

Definition at line 68 of file lcp_interface.c.

◆ lip_db_by_host

u32* lip_db_by_host

Definition at line 63 of file lcp_interface.c.

◆ lip_db_by_phy

index_t* lip_db_by_phy

Retreive the pair in the DP.

Definition at line 62 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 61 of file lcp_interface.c.

◆ lipn_names

lcp_itf_pair_names_t* lipn_names
static

Definition at line 533 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:1093
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