FD.io VPP  v18.04-17-g3a0d853
Vector Packet Processing
tapcli.c File Reference

dynamic tap interface hookup More...

+ Include dependency graph for tapcli.c:

Go to the source code of this file.

Data Structures

struct  tapcli_interface_t
 Struct for the tapcli interface. More...
 
struct  tapcli_rx_trace_t
 Struct for RX trace. More...
 
struct  tapcli_per_thread_t
 TAPCLI per thread struct. More...
 
struct  tapcli_main_t
 TAPCLI main state struct. More...
 
struct  ip6_ifreq_t
 

Functions

static void tapcli_nopunt_frame (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 Free "no punt" frame. More...
 
u8format_tapcli_rx_trace (u8 *s, va_list *va)
 Function to format TAP CLI trace. More...
 
static uword tapcli_tx (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 tapcli TX node function More...
 
static uword tapcli_rx_iface (vlib_main_t *vm, vlib_node_runtime_t *node, tapcli_interface_t *ti)
 Dispatch tapcli RX node function for node tap_cli_rx. More...
 
static uword tapcli_rx (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 tapcli RX node function More...
 
static clib_error_ttapcli_read_ready (clib_file_t *uf)
 Gets called when file descriptor is ready from epoll. More...
 
static clib_error_ttapcli_config (vlib_main_t *vm, unformat_input_t *input)
 CLI function for TAPCLI configuration. More...
 
static int tap_name_renumber (vnet_hw_interface_t *hi, u32 new_dev_instance)
 Renumber TAPCLI interface. More...
 
 VNET_HW_INTERFACE_CLASS (tapcli_interface_class, static)
 
static u8format_tapcli_interface_name (u8 *s, va_list *args)
 Formatter for TAPCLI interface name. More...
 
static u32 tapcli_flag_change (vnet_main_t *vnm, vnet_hw_interface_t *hw, u32 flags)
 Modify interface flags for TAPCLI interface. More...
 
static void tapcli_set_interface_next_node (vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
 Setting the TAP interface's next processing node. More...
 
static clib_error_ttapcli_interface_admin_up_down (vnet_main_t *vnm, u32 hw_if_index, u32 flags)
 Set link_state == admin_state otherwise things like ip6 neighbor discovery breaks. More...
 
 VNET_DEVICE_CLASS (tapcli_dev_class, static)
 
int vnet_tap_dump_ifs (tapcli_interface_details_t **out_tapids)
 Dump TAP interfaces. More...
 
static tapcli_interface_ttapcli_get_new_tapif ()
 Get tap interface from inactive interfaces or create new. More...
 
int vnet_tap_connect (vlib_main_t *vm, vnet_tap_connect_args_t *ap)
 Connect a TAP interface. More...
 
int vnet_tap_connect_renumber (vlib_main_t *vm, vnet_tap_connect_args_t *ap)
 Renumber a TAP interface. More...
 
static int tapcli_tap_disconnect (tapcli_interface_t *ti)
 Disconnect TAP CLI interface. More...
 
int vnet_tap_delete (vlib_main_t *vm, u32 sw_if_index)
 Delete TAP interface. More...
 
static clib_error_ttap_delete_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI function to delete TAP interface. More...
 
int vnet_tap_modify (vlib_main_t *vm, vnet_tap_connect_args_t *ap)
 Modifies tap interface - can result in new interface being created. More...
 
static clib_error_ttap_modify_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI function to modify TAP interface. More...
 
static clib_error_ttap_connect_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI function to connect TAP interface. More...
 
clib_error_ttapcli_init (vlib_main_t *vm)
 TAPCLI main init. More...
 

Variables

static vnet_device_class_t tapcli_dev_class
 
static vnet_hw_interface_class_t tapcli_interface_class
 
static vlib_node_registration_t tapcli_rx_node
 (constructor) VLIB_REGISTER_NODE (tapcli_rx_node) More...
 
static tapcli_main_t tapcli_main
 
static vlib_node_registration_t tapcli_tx_node
 (constructor) VLIB_REGISTER_NODE (tapcli_tx_node) More...
 
static char * tapcli_rx_error_strings []
 TAPCLI error strings. More...
 
static vlib_cli_command_t tap_delete_command
 (constructor) VLIB_CLI_COMMAND (tap_delete_command) More...
 
static vlib_cli_command_t tap_modify_command
 (constructor) VLIB_CLI_COMMAND (tap_modify_command) More...
 
static vlib_cli_command_t tap_connect_command
 (constructor) VLIB_CLI_COMMAND (tap_connect_command) More...
 

Detailed Description

dynamic tap interface hookup

Definition in file tapcli.c.

Function Documentation

static u8* format_tapcli_interface_name ( u8 s,
va_list *  args 
)
static

Formatter for TAPCLI interface name.

Parameters
*s- formatter string
*args- va_list
Returns
*s - formatted string

Definition at line 629 of file tapcli.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* format_tapcli_rx_trace ( u8 s,
va_list *  va 
)

Function to format TAP CLI trace.

Parameters
*s- u8 - formatting string
*va- va_list
Returns
*s - u8 - formatted string

Definition at line 90 of file tapcli.c.

+ Here is the call graph for this function:

static clib_error_t* tap_connect_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI function to connect TAP interface.

Parameters
*vm- vlib_main_t
*input- unformat_input_t
*cmd- vlib_cli_command_t
Returns
error - clib_error_t

Definition at line 1364 of file tapcli.c.

+ Here is the call graph for this function:

static clib_error_t* tap_delete_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI function to delete TAP interface.

Parameters
*vm- vlib_main_t
*input- unformat_input_t
*cmd- vlib_cli_command_t
Returns
error - clib_error_t

Definition at line 1207 of file tapcli.c.

+ Here is the call graph for this function:

static clib_error_t* tap_modify_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI function to modify TAP interface.

Parameters
*vm- vlib_main_t
*input- unformat_input_t
*cmd- vlib_cli_command_t
Returns
error - clib_error_t

Definition at line 1287 of file tapcli.c.

+ Here is the call graph for this function:

static int tap_name_renumber ( vnet_hw_interface_t hi,
u32  new_dev_instance 
)
static

Renumber TAPCLI interface.

Parameters
*hi- vnet_hw_interface_t
new_dev_instance- u32
Returns
rc - int

Definition at line 579 of file tapcli.c.

+ Here is the caller graph for this function:

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

CLI function for TAPCLI configuration.

Parameters
*vm- vlib_main_t
*input- unformat_input_t
Returns
error - clib_error_t

Definition at line 538 of file tapcli.c.

+ Here is the call graph for this function:

static u32 tapcli_flag_change ( vnet_main_t vnm,
vnet_hw_interface_t hw,
u32  flags 
)
static

Modify interface flags for TAPCLI interface.

Parameters
*vnm- vnet_main_t
*hw- vnet_hw_interface_t
flags- u32
Returns
rc - u32

Definition at line 656 of file tapcli.c.

+ Here is the caller graph for this function:

static tapcli_interface_t* tapcli_get_new_tapif ( )
static

Get tap interface from inactive interfaces or create new.

Returns
interface - tapcli_interface_t

Definition at line 811 of file tapcli.c.

+ Here is the caller graph for this function:

clib_error_t* tapcli_init ( vlib_main_t vm)

TAPCLI main init.

Parameters
*vm- vlib_main_t
Returns
error - clib_error_t

Definition at line 1525 of file tapcli.c.

+ Here is the call graph for this function:

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

Set link_state == admin_state otherwise things like ip6 neighbor discovery breaks.

Parameters
*vnm- vnet_main_t
hw_if_index- u32
flags- u32
Returns
error - clib_error_t

Definition at line 745 of file tapcli.c.

+ Here is the call graph for this function:

static void tapcli_nopunt_frame ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

Free "no punt" frame.

Parameters
*vm- vlib_main_t
*node- vlib_node_runtime_t
*frame- vlib_frame_t

Definition at line 603 of file tapcli.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* tapcli_read_ready ( clib_file_t uf)
static

Gets called when file descriptor is ready from epoll.

Parameters
*uf- clib_file_t
Returns
error - clib_error_t

Schedule the rx node

Mark the specific tap interface ready-to-read

Definition at line 507 of file tapcli.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword tapcli_rx ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

tapcli RX node function

Node Identifier:
tap-cli-rx

Input node from the Kernel tun/tap device

Parameters
*vm- vlib_main_t
*node- vlib_node_runtime_t
*frame- vlib_frame_t
Returns
n_packets - uword

Definition at line 444 of file tapcli.c.

+ Here is the call graph for this function:

static uword tapcli_rx_iface ( vlib_main_t vm,
vlib_node_runtime_t node,
tapcli_interface_t ti 
)
static

Dispatch tapcli RX node function for node tap_cli_rx.

Parameters
*vm- vlib_main_t
*node- vlib_node_runtime_t
*ti- tapcli_interface_t
Returns
n_packets - uword

Definition at line 267 of file tapcli.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void tapcli_set_interface_next_node ( vnet_main_t vnm,
u32  hw_if_index,
u32  node_index 
)
static

Setting the TAP interface's next processing node.

Parameters
*vnm- vnet_main_t
hw_if_index- u32
node_index- u32

Shut off redirection

Definition at line 715 of file tapcli.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int tapcli_tap_disconnect ( tapcli_interface_t ti)
static

Disconnect TAP CLI interface.

Parameters
*ti- tapcli_interface_t
Returns
rc - int

Definition at line 1130 of file tapcli.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword tapcli_tx ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

tapcli TX node function

Node Identifier:
tap-cli-tx

Output node, writes the buffers comprising the incoming frame to the tun/tap device, aka hands them to the Linux kernel stack.

Parameters
*vm- vlib_main_t
*node- vlib_node_runtime_t
*frame- vlib_frame_t
Returns
n_packets - uword

Definition at line 171 of file tapcli.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VNET_DEVICE_CLASS ( tapcli_dev_class  ,
static   
)

+ Here is the caller graph for this function:

VNET_HW_INTERFACE_CLASS ( tapcli_interface_class  ,
static   
)

+ Here is the caller graph for this function:

int vnet_tap_connect ( vlib_main_t vm,
vnet_tap_connect_args_t ap 
)

Connect a TAP interface.

Connect a tap interface.

Parameters
vm- vlib_main_t
ap- vnet_tap_connect_args_t
Returns
rc - int

Definition at line 855 of file tapcli.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_tap_connect_renumber ( vlib_main_t vm,
vnet_tap_connect_args_t ap 
)

Renumber a TAP interface.

Connect / renumber a tap interface.

Parameters
*vm- vlib_main_t
*intfc_name- u8
*hwaddr_arg- u8
*sw_if_indexp- u32
renumber- u8
custom_dev_instance- u32
Returns
rc - int

Definition at line 1110 of file tapcli.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_tap_delete ( vlib_main_t vm,
u32  sw_if_index 
)

Delete TAP interface.

delete a tap interface

Parameters
*vm- vlib_main_t
sw_if_index- u32
Returns
rc - int

Definition at line 1167 of file tapcli.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_tap_dump_ifs ( tapcli_interface_details_t **  out_tapids)

Dump TAP interfaces.

Parameters
**out_tapids- tapcli_interface_details_t
Returns
rc - int

Definition at line 781 of file tapcli.c.

+ Here is the caller graph for this function:

int vnet_tap_modify ( vlib_main_t vm,
vnet_tap_connect_args_t ap 
)

Modifies tap interface - can result in new interface being created.

Modify a tap interface.

Parameters
*vm- vlib_main_t
orig_sw_if_index- u32
*intfc_name- u8
*hwaddr_arg- u8
*sw_if_indexp- u32
renumber- u8
custom_dev_instance- u32
Returns
rc - int

Definition at line 1264 of file tapcli.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

vlib_cli_command_t tap_connect_command
static
Initial value:
= {
.path = "tap connect",
.short_help =
"tap connect <intfc-name> [address <ip-addr>/mw] [hwaddr <addr>]",
}
static clib_error_t * tap_connect_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI function to connect TAP interface.
Definition: tapcli.c:1364

(constructor) VLIB_CLI_COMMAND (tap_connect_command)

Definition at line 1508 of file tapcli.c.

vlib_cli_command_t tap_delete_command
static
Initial value:
= {
.path = "tap delete",
.short_help = "tap delete <vpp-tap-intfc-name>",
.function = tap_delete_command_fn,
}
static clib_error_t * tap_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI function to delete TAP interface.
Definition: tapcli.c:1207

(constructor) VLIB_CLI_COMMAND (tap_delete_command)

Definition at line 1242 of file tapcli.c.

vlib_cli_command_t tap_modify_command
static
Initial value:
= {
.path = "tap modify",
.short_help = "tap modify <vpp-tap-intfc-name> <linux-intfc-name> [hwaddr <addr>]",
.function = tap_modify_command_fn,
}
static clib_error_t * tap_modify_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI function to modify TAP interface.
Definition: tapcli.c:1287

(constructor) VLIB_CLI_COMMAND (tap_modify_command)

Definition at line 1346 of file tapcli.c.

vnet_device_class_t tapcli_dev_class
static

Definition at line 47 of file tapcli.c.

vnet_hw_interface_class_t tapcli_interface_class
static

Definition at line 48 of file tapcli.c.

tapcli_main_t tapcli_main
static

Definition at line 154 of file tapcli.c.

char* tapcli_rx_error_strings[]
static
Initial value:
= {
#define _(sym,string)
}
#define foreach_tapcli_error
TAP CLI errors.
Definition: tapcli.h:26

TAPCLI error strings.

Definition at line 477 of file tapcli.c.

static vlib_node_registration_t tapcli_rx_node
static
Initial value:
= {
.function = tapcli_rx,
.name = "tapcli-rx",
.sibling_of = "device-input",
.state = VLIB_NODE_STATE_INTERRUPT,
.vector_size = 4,
.n_errors = TAPCLI_N_ERROR,
.error_strings = tapcli_rx_error_strings,
.format_trace = format_tapcli_rx_trace,
}
static char * tapcli_rx_error_strings[]
TAPCLI error strings.
Definition: tapcli.c:477
static uword tapcli_rx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
tapcli RX node function
Definition: tapcli.c:444
u8 * format_tapcli_rx_trace(u8 *s, va_list *va)
Function to format TAP CLI trace.
Definition: tapcli.c:90

(constructor) VLIB_REGISTER_NODE (tapcli_rx_node)

Definition at line 49 of file tapcli.c.

vlib_node_registration_t tapcli_tx_node
static
Initial value:
= {
.function = tapcli_tx,
.name = "tapcli-tx",
.vector_size = 4,
}
static uword tapcli_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
tapcli TX node function
Definition: tapcli.c:171

(constructor) VLIB_REGISTER_NODE (tapcli_tx_node)

Definition at line 247 of file tapcli.c.