summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/vhost_user_api.c
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2018-08-21 16:07:03 +0200
committerDamjan Marion <dmarion@me.com>2018-09-20 09:12:12 +0000
commitee2e58f6ea802437ed52cc3e4d59b89d92757135 (patch)
tree9c84a87979cf99a89635446a9868f88c84fe14df /src/vnet/devices/virtio/vhost_user_api.c
parentfe0aa7648703f63159be8362836b39d4727fbb0c (diff)
vhost-user: Add disable feature support in api
Two flags to disable mergable rx buffers and indirect descriptors are added to api. Change-Id: Iba0ee9c48d19dfc3d3420a3fdaf44a1a1d325e99 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio/vhost_user_api.c')
-rw-r--r--src/vnet/devices/virtio/vhost_user_api.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/vnet/devices/virtio/vhost_user_api.c b/src/vnet/devices/virtio/vhost_user_api.c
index 59dba252f22..016ccbd2687 100644
--- a/src/vnet/devices/virtio/vhost_user_api.c
+++ b/src/vnet/devices/virtio/vhost_user_api.c
@@ -76,9 +76,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);