nsh: migrate old MUTIARCH macros to VLIB_NODE_FN

Change-Id: Iafe8b3a38f2a7d7571e60db91608d8130bb07cb3
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
This commit is contained in:
Filip Tehlar
2019-02-26 02:59:07 -08:00
committed by Damjan Marion
parent 849cbe225e
commit 4ba19b8a75
8 changed files with 2438 additions and 2289 deletions

View File

@ -14,8 +14,11 @@
add_vpp_plugin(nsh add_vpp_plugin(nsh
SOURCES SOURCES
nsh.c nsh.c
nsh_node.c
nsh_output.c nsh_output.c
nsh_pop.c nsh_pop.c
nsh_cli.c
nsh_api.c
nsh-md2-ioam/nsh_md2_ioam.c nsh-md2-ioam/nsh_md2_ioam.c
nsh-md2-ioam/nsh_md2_ioam_api.c nsh-md2-ioam/nsh_md2_ioam_api.c
nsh-md2-ioam/md2_ioam_transit.c nsh-md2-ioam/md2_ioam_transit.c
@ -24,6 +27,11 @@ add_vpp_plugin(nsh
nsh-md2-ioam/export-nsh-md2-ioam/nsh_md2_ioam_export_thread.c nsh-md2-ioam/export-nsh-md2-ioam/nsh_md2_ioam_export_thread.c
nsh-md2-ioam/export-nsh-md2-ioam/nsh_md2_ioam_node.c nsh-md2-ioam/export-nsh-md2-ioam/nsh_md2_ioam_node.c
MULTIARCH_SOURCES
nsh_node.c
nsh_output.c
nsh_pop.c
API_FILES API_FILES
nsh.api nsh.api

File diff suppressed because it is too large Load Diff

View File

@ -159,13 +159,16 @@ typedef struct {
u8 input_feature_arc_index; u8 input_feature_arc_index;
u8 output_feature_arc_index; u8 output_feature_arc_index;
u32 nsh_input_node_index;
u32 nsh_proxy_node_index;
u32 nsh_classifier_node_index;
/* convenience */ /* convenience */
vlib_main_t * vlib_main; vlib_main_t * vlib_main;
vnet_main_t * vnet_main; vnet_main_t * vnet_main;
} nsh_main_t; } nsh_main_t;
nsh_main_t nsh_main; extern nsh_main_t nsh_main;
extern vlib_node_registration_t nsh_aware_vnf_proxy_node; extern vlib_node_registration_t nsh_aware_vnf_proxy_node;
extern vlib_node_registration_t nsh_eth_output_node; extern vlib_node_registration_t nsh_eth_output_node;
@ -268,4 +271,25 @@ typedef struct _nsh_main_dummy
u8 output_feature_arc_index; u8 output_feature_arc_index;
} nsh_main_dummy_t; } nsh_main_dummy_t;
int
nsh_add_del_map (nsh_add_del_map_args_t * a, u32 * map_indexp);
int
nsh_add_del_proxy_session (nsh_add_del_map_args_t * a);
nsh_option_map_t *
nsh_md2_lookup_option (u16 class, u8 type);
int
nsh_add_del_entry (nsh_add_del_entry_args_t * a, u32 * entry_indexp);
u8 *
format_nsh_node_map_trace (u8 * s, va_list * args);
u8 *
format_nsh_header (u8 * s, va_list * args);
clib_error_t *
nsh_api_init (vlib_main_t * vm, nsh_main_t * nm);
#endif /* included_nsh_h */ #endif /* included_nsh_h */

724
src/plugins/nsh/nsh_api.c Normal file

File diff suppressed because it is too large Load Diff

645
src/plugins/nsh/nsh_cli.c Normal file

File diff suppressed because it is too large Load Diff

982
src/plugins/nsh/nsh_node.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -323,8 +323,7 @@ typedef enum nsh_midchain_next_t_
NSH_MIDCHAIN_NEXT_DROP, NSH_MIDCHAIN_NEXT_DROP,
} nsh_midchain_next_t; } nsh_midchain_next_t;
static inline uword VLIB_NODE_FN (nsh_eth_output) (vlib_main_t * vm,
nsh_eth_output (vlib_main_t * vm,
vlib_node_runtime_t * node, vlib_node_runtime_t * node,
vlib_frame_t * from_frame) vlib_frame_t * from_frame)
{ {
@ -332,7 +331,6 @@ nsh_eth_output (vlib_main_t * vm,
} }
VLIB_REGISTER_NODE (nsh_eth_output_node) = { VLIB_REGISTER_NODE (nsh_eth_output_node) = {
.function = nsh_eth_output,
.name = "nsh-eth-output", .name = "nsh-eth-output",
/* Takes a vector of packets. */ /* Takes a vector of packets. */
.vector_size = sizeof (u32), .vector_size = sizeof (u32),
@ -346,10 +344,7 @@ VLIB_REGISTER_NODE (nsh_eth_output_node) = {
.format_trace = format_nsh_output_trace, .format_trace = format_nsh_output_trace,
}; };
VLIB_NODE_FUNCTION_MULTIARCH (nsh_eth_output_node, nsh_eth_output) VLIB_NODE_FN (nsh_midchain) (vlib_main_t * vm,
static inline uword
nsh_midchain (vlib_main_t * vm,
vlib_node_runtime_t * node, vlib_node_runtime_t * node,
vlib_frame_t * from_frame) vlib_frame_t * from_frame)
{ {
@ -357,7 +352,6 @@ nsh_midchain (vlib_main_t * vm,
} }
VLIB_REGISTER_NODE (nsh_midchain_node) = { VLIB_REGISTER_NODE (nsh_midchain_node) = {
.function = nsh_midchain,
.name = "nsh-midchain", .name = "nsh-midchain",
.vector_size = sizeof (u32), .vector_size = sizeof (u32),
.format_trace = format_nsh_output_trace, .format_trace = format_nsh_output_trace,
@ -367,8 +361,6 @@ VLIB_REGISTER_NODE (nsh_midchain_node) = {
}, },
}; };
VLIB_NODE_FUNCTION_MULTIARCH (nsh_midchain_node, nsh_midchain)
/* Built-in nsh tx feature path definition */ /* Built-in nsh tx feature path definition */
VNET_FEATURE_INIT (nsh_interface_output, static) = { VNET_FEATURE_INIT (nsh_interface_output, static) = {
.arc_name = "nsh-eth-output", .arc_name = "nsh-eth-output",
@ -423,8 +415,7 @@ typedef struct nsh_adj_incomplete_trace_t_
* We pay a cost for this 'routing' node, but an incomplete adj is the * We pay a cost for this 'routing' node, but an incomplete adj is the
* exception case. * exception case.
*/ */
static inline uword VLIB_NODE_FN (nsh_adj_incomplete) (vlib_main_t * vm,
nsh_adj_incomplete (vlib_main_t * vm,
vlib_node_runtime_t * node, vlib_node_runtime_t * node,
vlib_frame_t * from_frame) vlib_frame_t * from_frame)
{ {
@ -503,7 +494,6 @@ format_nsh_adj_incomplete_trace (u8 * s, va_list * args)
} }
VLIB_REGISTER_NODE (nsh_adj_incomplete_node) = { VLIB_REGISTER_NODE (nsh_adj_incomplete_node) = {
.function = nsh_adj_incomplete,
.name = "nsh-adj-incomplete", .name = "nsh-adj-incomplete",
.format_trace = format_nsh_adj_incomplete_trace, .format_trace = format_nsh_adj_incomplete_trace,
/* Takes a vector of packets. */ /* Takes a vector of packets. */
@ -516,5 +506,3 @@ VLIB_REGISTER_NODE (nsh_adj_incomplete_node) = {
}, },
}; };
VLIB_NODE_FUNCTION_MULTIARCH (nsh_adj_incomplete_node,
nsh_adj_incomplete)

View File

@ -30,20 +30,8 @@ extern nsh_option_map_t * nsh_md2_lookup_option (u16 class, u8 type);
extern u8 * format_nsh_header (u8 * s, va_list * args); extern u8 * format_nsh_header (u8 * s, va_list * args);
extern u8 * format_nsh_node_map_trace (u8 * s, va_list * args); extern u8 * format_nsh_node_map_trace (u8 * s, va_list * args);
extern u8 * format_nsh_pop_header (u8 * s, va_list * args);
/* format from network order */ extern u8 * format_nsh_pop_node_map_trace (u8 * s, va_list * args);
u8 * format_nsh_pop_header (u8 * s, va_list * args)
{
return format_nsh_header(s, args);
}
u8 * format_nsh_pop_node_map_trace (u8 * s, va_list * args)
{
return format_nsh_node_map_trace(s, args);
}
static uword static uword
nsh_pop_inline (vlib_main_t * vm, nsh_pop_inline (vlib_main_t * vm,
@ -326,8 +314,7 @@ nsh_pop_inline (vlib_main_t * vm,
* @return from_frame->n_vectors * @return from_frame->n_vectors
* *
*/ */
static uword VLIB_NODE_FN (nsh_pop) (vlib_main_t * vm, vlib_node_runtime_t * node,
nsh_pop (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * from_frame) vlib_frame_t * from_frame)
{ {
return nsh_pop_inline (vm, node, from_frame); return nsh_pop_inline (vm, node, from_frame);
@ -341,7 +328,6 @@ static char * nsh_pop_node_error_strings[] = {
/* register nsh-input node */ /* register nsh-input node */
VLIB_REGISTER_NODE (nsh_pop_node) = { VLIB_REGISTER_NODE (nsh_pop_node) = {
.function = nsh_pop,
.name = "nsh-pop", .name = "nsh-pop",
.vector_size = sizeof (u32), .vector_size = sizeof (u32),
.format_trace = format_nsh_pop_node_map_trace, .format_trace = format_nsh_pop_node_map_trace,
@ -360,6 +346,3 @@ VLIB_REGISTER_NODE (nsh_pop_node) = {
}, },
}; };
VLIB_NODE_FUNCTION_MULTIARCH (nsh_pop_node, nsh_pop);