summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/vat/api_format.c10
-rw-r--r--src/vnet/devices/virtio/vhost_user.api6
-rw-r--r--src/vnet/devices/virtio/vhost_user_api.c12
-rw-r--r--src/vpp/api/custom_dump.c4
4 files changed, 30 insertions, 2 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 0dde721aa1e..5e1114fdfbd 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -14053,6 +14053,8 @@ api_create_vhost_user_if (vat_main_t * vam)
u32 custom_dev_instance = ~0;
u8 hwaddr[6];
u8 use_custom_mac = 0;
+ u8 disable_mrg_rxbuf = 0;
+ u8 disable_indirect_desc = 0;
u8 *tag = 0;
int ret;
@@ -14071,6 +14073,10 @@ api_create_vhost_user_if (vat_main_t * vam)
use_custom_mac = 1;
else if (unformat (i, "server"))
is_server = 1;
+ else if (unformat (i, "disable_mrg_rxbuf"))
+ disable_mrg_rxbuf = 1;
+ else if (unformat (i, "disable_indirect_desc"))
+ disable_indirect_desc = 1;
else if (unformat (i, "tag %s", &tag))
;
else
@@ -14093,6 +14099,8 @@ api_create_vhost_user_if (vat_main_t * vam)
M (CREATE_VHOST_USER_IF, mp);
mp->is_server = is_server;
+ mp->disable_mrg_rxbuf = disable_mrg_rxbuf;
+ mp->disable_indirect_desc = disable_indirect_desc;
clib_memcpy (mp->sock_filename, file_name, vec_len (file_name));
vec_free (file_name);
if (custom_dev_instance != ~0)
@@ -14100,6 +14108,7 @@ api_create_vhost_user_if (vat_main_t * vam)
mp->renumber = 1;
mp->custom_dev_instance = ntohl (custom_dev_instance);
}
+
mp->use_custom_mac = use_custom_mac;
clib_memcpy (mp->mac_address, hwaddr, 6);
if (tag)
@@ -23632,6 +23641,7 @@ _(l2_interface_vlan_tag_rewrite, \
"[translate-2-[1|2]] [push_dot1q 0] tag1 <nn> tag2 <nn>") \
_(create_vhost_user_if, \
"socket <filename> [server] [renumber <dev_instance>] " \
+ "[disable_mrg_rxbuf] [disable_indirect_desc] " \
"[mac <mac_address>]") \
_(modify_vhost_user_if, \
"<intfc> | sw_if_index <nn> socket <filename>\n" \
diff --git a/src/vnet/devices/virtio/vhost_user.api b/src/vnet/devices/virtio/vhost_user.api
index ccaa87cf0ce..c745b3d616b 100644
--- a/src/vnet/devices/virtio/vhost_user.api
+++ b/src/vnet/devices/virtio/vhost_user.api
@@ -13,13 +13,15 @@
* limitations under the License.
*/
-option version = "1.0.0";
+option version = "2.0.0";
/** \brief vhost-user interface create request
@param client_index - opaque cookie to identify the sender
@param is_server - our side is socket server
@param sock_filename - unix socket filename, used to speak with frontend
@param use_custom_mac - enable or disable the use of the provided hardware address
+ @param disable_mrg_rxbuf - disable the use of merge receive buffers
+ @param disable_indirect_desc - disable the use of indirect descriptors which driver can use
@param mac_address - hardware address to use if 'use_custom_mac' is set
*/
define create_vhost_user_if
@@ -29,6 +31,8 @@ define create_vhost_user_if
u8 is_server;
u8 sock_filename[256];
u8 renumber;
+ u8 disable_mrg_rxbuf;
+ u8 disable_indirect_desc;
u32 custom_dev_instance;
u8 use_custom_mac;
u8 mac_address[6];
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);
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index 85296bb2953..44aaf82a73c 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -1982,6 +1982,10 @@ static void *vl_api_create_vhost_user_if_t_print
s = format (s, "server ");
if (mp->renumber)
s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
+ if (mp->disable_mrg_rxbuf)
+ s = format (s, "disable_mrg_rxbuf ");
+ if (mp->disable_indirect_desc)
+ s = format (s, "disable_indirect_desc ");
if (mp->tag[0])
s = format (s, "tag %s", mp->tag);