aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/vmxnet3/cli.c17
-rw-r--r--src/plugins/vmxnet3/vmxnet3_api.c67
-rw-r--r--src/plugins/vmxnet3/vmxnet3_test.c27
3 files changed, 84 insertions, 27 deletions
diff --git a/src/plugins/vmxnet3/cli.c b/src/plugins/vmxnet3/cli.c
index 776901e8ac2..76db1cab7ed 100644
--- a/src/plugins/vmxnet3/cli.c
+++ b/src/plugins/vmxnet3/cli.c
@@ -32,6 +32,7 @@ vmxnet3_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
{
unformat_input_t _line_input, *line_input = &_line_input;
vmxnet3_create_if_args_t args;
+ u32 size;
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
@@ -46,14 +47,14 @@ vmxnet3_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
args.enable_elog = 1;
else if (unformat (line_input, "bind"))
args.bind = 1;
- else if (unformat (line_input, "rx-queue-size %u", &args.rxq_size))
- ;
- else if (unformat (line_input, "tx-queue-size %u", &args.txq_size))
- ;
- else if (unformat (line_input, "num-tx-queues %u", &args.txq_num))
- ;
- else if (unformat (line_input, "num-rx-queues %u", &args.rxq_num))
- ;
+ else if (unformat (line_input, "rx-queue-size %u", &size))
+ args.rxq_size = size;
+ else if (unformat (line_input, "tx-queue-size %u", &size))
+ args.txq_size = size;
+ else if (unformat (line_input, "num-tx-queues %u", &size))
+ args.txq_num = size;
+ else if (unformat (line_input, "num-rx-queues %u", &size))
+ args.rxq_num = size;
else
return clib_error_return (0, "unknown input `%U'",
format_unformat_error, input);
diff --git a/src/plugins/vmxnet3/vmxnet3_api.c b/src/plugins/vmxnet3/vmxnet3_api.c
index 5e1bb9e2f18..8395f158c9a 100644
--- a/src/plugins/vmxnet3/vmxnet3_api.c
+++ b/src/plugins/vmxnet3/vmxnet3_api.c
@@ -40,15 +40,19 @@
/* instantiate all the print functions we know about */
#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
-#define vl_printfun
-#include <vmxnet3/vmxnet3_all_api_h.h>
-#undef vl_printfun
/* get the API version number */
#define vl_api_version(n,v) static u32 api_version=(v);
#include <vmxnet3/vmxnet3_all_api_h.h>
#undef vl_api_version
+/* Macro to finish up custom dump fns */
+#define FINISH \
+ vec_add1 (s, 0); \
+ vl_print (handle, (char *)s); \
+ vec_free (s); \
+ return handle;
+
#include <vlibapi/api_helper_macros.h>
#define foreach_vmxnet3_plugin_api_msg \
@@ -86,6 +90,30 @@ vl_api_vmxnet3_create_t_handler (vl_api_vmxnet3_create_t * mp)
/* *INDENT-ON* */
}
+static void *
+vl_api_vmxnet3_create_t_print (vl_api_vmxnet3_create_t * mp, void *handle)
+{
+ u8 *s;
+ u32 pci_addr = ntohl (mp->pci_addr);
+
+ s = format (0, "SCRIPT: vmxnet3_create ");
+ s = format (s, "%U ", format_vlib_pci_addr, &pci_addr);
+ if (mp->enable_elog)
+ s = format (s, "elog ");
+ if (mp->bind)
+ s = format (s, "bind ");
+ if (mp->rxq_size)
+ s = format (s, "rx-queue-size %u ", ntohs (mp->rxq_size));
+ if (mp->txq_size)
+ s = format (s, "tx-queue-size %u ", ntohs (mp->txq_size));
+ if (mp->rxq_num)
+ s = format (s, "num-rx-queues %u ", ntohs (mp->rxq_num));
+ if (mp->txq_num)
+ s = format (s, "num-tx-queues %u ", ntohs (mp->txq_num));
+
+ FINISH;
+}
+
static void
vl_api_vmxnet3_delete_t_handler (vl_api_vmxnet3_delete_t * mp)
{
@@ -112,6 +140,17 @@ reply:
REPLY_MACRO (VL_API_VMXNET3_DELETE_REPLY + vmxm->msg_id_base);
}
+static void *
+vl_api_vmxnet3_delete_t_print (vl_api_vmxnet3_delete_t * mp, void *handle)
+{
+ u8 *s;
+
+ s = format (0, "SCRIPT: vmxnet3_delete ");
+ s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
+
+ FINISH;
+}
+
static void
send_vmxnet3_details (vl_api_registration_t * reg, vmxnet3_device_t * vd,
vnet_sw_interface_t * swif, u8 * interface_name,
@@ -209,6 +248,16 @@ vl_api_vmxnet3_dump_t_handler (vl_api_vmxnet3_dump_t * mp)
vec_free (if_name);
}
+static void *
+vl_api_vmxnet3_dump_t_print (vl_api_vmxnet3_create_t * mp, void *handle)
+{
+ u8 *s;
+
+ s = format (0, "SCRIPT: vmxnet3_dump ");
+
+ FINISH;
+}
+
#define vl_msg_name_crc_list
#include <vmxnet3/vmxnet3_all_api_h.h>
#undef vl_msg_name_crc_list
@@ -222,6 +271,16 @@ setup_message_id_table (vmxnet3_main_t * vmxm, api_main_t * am)
#undef _
}
+static void
+plugin_custom_dump_configure (vmxnet3_main_t * vmxm)
+{
+#define _(n,f) api_main.msg_print_handlers \
+ [VL_API_##n + vmxm->msg_id_base] \
+ = (void *) vl_api_##f##_t_print;
+ foreach_vmxnet3_plugin_api_msg;
+#undef _
+}
+
/* set tup the API message handling tables */
clib_error_t *
vmxnet3_plugin_api_hookup (vlib_main_t * vm)
@@ -251,6 +310,8 @@ vmxnet3_plugin_api_hookup (vlib_main_t * vm)
/* set up the (msg_name, crc, message-id) table */
setup_message_id_table (vmxm, am);
+ plugin_custom_dump_configure (vmxm);
+
vec_free (name);
return 0;
}
diff --git a/src/plugins/vmxnet3/vmxnet3_test.c b/src/plugins/vmxnet3/vmxnet3_test.c
index fe491b2a41d..d32bceefe5b 100644
--- a/src/plugins/vmxnet3/vmxnet3_test.c
+++ b/src/plugins/vmxnet3/vmxnet3_test.c
@@ -102,31 +102,26 @@ api_vmxnet3_create (vat_main_t * vam)
vl_api_vmxnet3_create_t *mp;
vmxnet3_create_if_args_t args;
int ret;
- u32 x[4];
+ u32 size;
clib_memset (&args, 0, sizeof (vmxnet3_create_if_args_t));
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (i, "%x:%x:%x.%x", &x[0], &x[1], &x[2], &x[3]))
- {
- args.addr.domain = x[0];
- args.addr.bus = x[1];
- args.addr.slot = x[2];
- args.addr.function = x[3];
- }
+ if (unformat (i, "%U", unformat_vlib_pci_addr, &args.addr))
+ ;
else if (unformat (i, "elog"))
args.enable_elog = 1;
else if (unformat (i, "bind"))
args.bind = 1;
- else if (unformat (i, "rx-queue-size %u", &args.rxq_size))
- ;
- else if (unformat (i, "tx-queue-size %u", &args.txq_size))
- ;
- else if (unformat (i, "num-tx-queues %u", &args.txq_num))
- ;
- else if (unformat (i, "num-rx-queues %u", &args.rxq_num))
- ;
+ else if (unformat (i, "rx-queue-size %u", &size))
+ args.rxq_size = size;
+ else if (unformat (i, "tx-queue-size %u", &size))
+ args.txq_size = size;
+ else if (unformat (i, "num-tx-queues %u", &size))
+ args.txq_num = size;
+ else if (unformat (i, "num-rx-queues %u", &size))
+ args.rxq_num = size;
else
{
clib_warning ("unknown input '%U'", format_unformat_error, i);