X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fdevices%2Fvirtio%2Fvhost_user_api.c;h=8f0b9d90f533d02ff889f4a53fb0e2c22175ce67;hb=e63325e3c;hp=442d9146945e3f1dd0adbc6f9897d15ddad3c66e;hpb=6c4dae27e75fc668f86c9cca0f3f58273b680621;p=vpp.git diff --git a/src/vnet/devices/virtio/vhost_user_api.c b/src/vnet/devices/virtio/vhost_user_api.c index 442d9146945..8f0b9d90f53 100644 --- a/src/vnet/devices/virtio/vhost_user_api.c +++ b/src/vnet/devices/virtio/vhost_user_api.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include @@ -58,12 +58,11 @@ send_sw_interface_event_deleted (vpe_api_main_t * am, vl_api_sw_interface_event_t *mp; mp = vl_msg_api_alloc (sizeof (*mp)); - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_EVENT); mp->sw_if_index = ntohl (sw_if_index); - mp->admin_up_down = 0; - mp->link_up_down = 0; + mp->flags = 0; mp->deleted = 1; vl_api_send_msg (reg, (u8 *) mp); } @@ -76,9 +75,19 @@ vl_api_create_vhost_user_if_t_handler (vl_api_create_vhost_user_if_t * mp) u32 sw_if_index = (u32) ~ 0; vnet_main_t *vnm = vnet_get_main (); vlib_main_t *vm = vlib_get_main (); + u64 features = (u64) ~ (0ULL); + u64 disabled_features = (u64) (0ULL); + + if (mp->disable_mrg_rxbuf) + disabled_features = (1ULL << FEAT_VIRTIO_NET_F_MRG_RXBUF); + + if (mp->disable_indirect_desc) + disabled_features |= (1ULL << FEAT_VIRTIO_F_INDIRECT_DESC); + + features &= ~disabled_features; rv = vhost_user_create_if (vnm, vm, (char *) mp->sock_filename, - mp->is_server, &sw_if_index, (u64) ~ 0, + mp->is_server, &sw_if_index, features, mp->renumber, ntohl (mp->custom_dev_instance), (mp->use_custom_mac) ? mp->mac_address : NULL); @@ -155,7 +164,7 @@ send_sw_interface_vhost_user_details (vpe_api_main_t * am, vl_api_sw_interface_vhost_user_details_t *mp; mp = vl_msg_api_alloc (sizeof (*mp)); - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_VHOST_USER_DETAILS); mp->sw_if_index = ntohl (vui->sw_if_index); mp->virtio_net_hdr_sz = ntohl (vui->virtio_net_hdr_sz); @@ -234,6 +243,9 @@ vhost_user_api_hookup (vlib_main_t * vm) foreach_vpe_api_msg; #undef _ + /* Mark CREATE_VHOST_USER_IF as mp safe */ + am->is_mp_safe[VL_API_CREATE_VHOST_USER_IF] = 1; + /* * Set up the (msg_name, crc, message-id) table */