24 #include <vpp/app/version.h> 41 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 47 #define vl_api_version(n,v) static u32 api_version=(v); 51 #define REPLY_MSG_ID_BASE omp->msg_id_base 58 #define foreach_oddbuf_plugin_api_msg \ 59 _(ODDBUF_ENABLE_DISABLE, oddbuf_enable_disable) 73 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
78 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
81 sw_if_index, enable_disable, 0, 0);
93 int enable_disable = 1;
108 if (sw_if_index == ~0)
118 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
120 (0,
"Invalid interface, only works on physical ports");
123 case VNET_API_ERROR_UNIMPLEMENTED:
125 "Device driver doesn't support redirection");
137 .path =
"oddbuf enable-disable",
139 "oddbuf enable-disable <interface-name> [disable]",
148 vl_api_oddbuf_enable_disable_reply_t *rmp;
164 vl_msg_api_set_handlers((VL_API_##N + omp->msg_id_base), \ 166 vl_api_##n##_t_handler, \ 168 vl_api_##n##_t_endian, \ 169 vl_api_##n##_t_print, \ 170 sizeof(vl_api_##n##_t), 1); 177 #define vl_msg_name_crc_list 179 #undef vl_msg_name_crc_list 184 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + omp->msg_id_base); 185 foreach_vl_msg_name_crc_oddbuf;
199 name =
format (0,
"oddbuf_%08x%c", api_version, 0);
225 .arc_name =
"device-input",
226 .node_name =
"oddbuf",
234 .version = VPP_BUILD_VER,
235 .description =
"Awkward chained buffer geometry generator",
236 .default_disabled = 1,
258 else if (
unformat (line_input,
"first_offset %d",
273 .path =
"oddbuf configure",
275 "oddbuf configure n_to_copy <nn> offset <nn> first_offset <nn>",
static void vl_api_oddbuf_enable_disable_t_handler(vl_api_oddbuf_enable_disable_t *mp)
vnet_main_t * vnet_get_main(void)
vnet_interface_main_t interface_main
static clib_error_t * oddbuf_enable_disable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * oddbuf_init(vlib_main_t *vm)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
unformat_function_t unformat_vnet_sw_interface
static clib_error_t * oddbuf_plugin_api_hookup(vlib_main_t *vm)
vl_api_interface_index_t sw_if_index
#define VLIB_INIT_FUNCTION(x)
API to enable / disable oddbuf on an interface.
static clib_error_t * oddbuf_config_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define clib_error_return(e, args...)
#define foreach_oddbuf_plugin_api_msg
int oddbuf_enable_disable(oddbuf_main_t *omp, u32 sw_if_index, int enable_disable)
VNET_FEATURE_INIT(oddbuf, static)
API main structure, used by both vpp and binary API clients.
#define vec_free(V)
Free vector's memory (no header).
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
#define VLIB_CLI_COMMAND(x,...)
#define VNET_FEATURES(...)
vl_api_interface_index_t sw_if_index
vnet_sw_interface_t * sw_interfaces
vnet_sw_interface_type_t type
static void setup_message_id_table(oddbuf_main_t *omp, api_main_t *am)
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
oddbuf_main_t oddbuf_main
u16 vl_msg_api_get_msg_ids(const char *name, int n)