X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fvmxnet3%2Fvmxnet3_api.c;h=cdb68708f579f4ef1a3074c776950c156894e03f;hb=277f03f06;hp=5e1bb9e2f184979f749e9ed2e55daf9753bc3fb0;hpb=ee8ba6877efb916b88255821f94ef33437724f75;p=vpp.git diff --git a/src/plugins/vmxnet3/vmxnet3_api.c b/src/plugins/vmxnet3/vmxnet3_api.c index 5e1bb9e2f18..cdb68708f57 100644 --- a/src/plugins/vmxnet3/vmxnet3_api.c +++ b/src/plugins/vmxnet3/vmxnet3_api.c @@ -19,43 +19,18 @@ #include #include #include - +#include #include #include #include /* define message IDs */ -#include - -/* define message structures */ -#define vl_typedefs -#include -#undef vl_typedefs - -/* define generated endian-swappers */ -#define vl_endianfun -#include -#undef vl_endianfun - -/* instantiate all the print functions we know about */ -#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) -#define vl_printfun -#include -#undef vl_printfun - -/* get the API version number */ -#define vl_api_version(n,v) static u32 api_version=(v); -#include -#undef vl_api_version +#include +#include #include -#define foreach_vmxnet3_plugin_api_msg \ -_(VMXNET3_CREATE, vmxnet3_create) \ -_(VMXNET3_DELETE, vmxnet3_delete) \ -_(VMXNET3_DUMP, vmxnet3_dump) - static void vl_api_vmxnet3_create_t_handler (vl_api_vmxnet3_create_t * mp) { @@ -74,6 +49,7 @@ vl_api_vmxnet3_create_t_handler (vl_api_vmxnet3_create_t * mp) args.txq_num = ntohs (mp->txq_num); args.rxq_num = ntohs (mp->rxq_num); args.bind = mp->bind; + args.enable_gso = mp->enable_gso; vmxnet3_create_if (vm, &args); rv = args.rv; @@ -97,10 +73,12 @@ vl_api_vmxnet3_delete_t_handler (vl_api_vmxnet3_delete_t * mp) vnet_hw_interface_t *hw; int rv = 0; - hw = vnet_get_sup_hw_interface (vnm, htonl (mp->sw_if_index)); + hw = + vnet_get_sup_hw_interface_api_visible_or_null (vnm, + htonl (mp->sw_if_index)); if (hw == NULL || vmxnet3_device_class.index != hw->dev_class_index) { - rv = VNET_API_ERROR_INVALID_INTERFACE; + rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; goto reply; } @@ -209,49 +187,15 @@ vl_api_vmxnet3_dump_t_handler (vl_api_vmxnet3_dump_t * mp) vec_free (if_name); } -#define vl_msg_name_crc_list -#include -#undef vl_msg_name_crc_list - -static void -setup_message_id_table (vmxnet3_main_t * vmxm, api_main_t * am) -{ -#define _(id,n,crc) \ - vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + vmxm->msg_id_base); - foreach_vl_msg_name_crc_vmxnet3; -#undef _ -} - /* set tup the API message handling tables */ +#include clib_error_t * vmxnet3_plugin_api_hookup (vlib_main_t * vm) { vmxnet3_main_t *vmxm = &vmxnet3_main; - api_main_t *am = &api_main; - u8 *name; - - /* construct the API name */ - name = format (0, "vmxnet3_%08x%c", api_version, 0); /* ask for a correctly-sized block of API message decode slots */ - vmxm->msg_id_base = vl_msg_api_get_msg_ids - ((char *) name, VL_MSG_FIRST_AVAILABLE); - -#define _(N,n) \ - vl_msg_api_set_handlers((VL_API_##N + vmxm->msg_id_base), \ - #n, \ - vl_api_##n##_t_handler, \ - vl_noop_handler, \ - vl_api_##n##_t_endian, \ - vl_api_##n##_t_print, \ - sizeof(vl_api_##n##_t), 1); - foreach_vmxnet3_plugin_api_msg; -#undef _ - - /* set up the (msg_name, crc, message-id) table */ - setup_message_id_table (vmxm, am); - - vec_free (name); + vmxm->msg_id_base = setup_message_id_table (); return 0; }