From 48322f0c377cf4c5d789f0a4e4808a998a2ee9c1 Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Mon, 2 Jul 2018 13:24:43 +0200 Subject: [PATCH] virtio/user: negotiate VHOST_USER_PROTOCOL_F_CONFIG It was introduced a while after the original GET/SET_CONFIG implementation in QEMU, but within the same QEMU release (2.12?). It is required by the vhost-user spec. Rte_vhost doesn't check it, so everything worked so far, but other implementations might (and should) reject our GET_CONFIG requests right now. As a part of this feature, we should also check the same flag before sending GET/SET_CONFIG messages to respect those devices that really don't implement F_CONFIG. This is done in a separate patch. Change-Id: Ib7e9b11a0074f4aee70609af0cad2ef59a8bf427 Signed-off-by: Dariusz Stojaczyk Reviewed-on: https://review.gerrithub.io/417459 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- lib/virtio/virtio_user.c | 3 ++- lib/virtio/virtio_user/vhost.h | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/virtio/virtio_user.c b/lib/virtio/virtio_user.c index bdffde5db..8795e0a94 100644 --- a/lib/virtio/virtio_user.c +++ b/lib/virtio/virtio_user.c @@ -47,7 +47,8 @@ #include "spdk_internal/virtio.h" #define VIRTIO_USER_SUPPORTED_PROTOCOL_FEATURES \ - ((1ULL << VHOST_USER_PROTOCOL_F_MQ)) + ((1ULL << VHOST_USER_PROTOCOL_F_MQ) | \ + (1ULL << VHOST_USER_PROTOCOL_F_CONFIG)) static int virtio_user_create_queue(struct virtio_dev *vdev, uint32_t queue_sel) diff --git a/lib/virtio/virtio_user/vhost.h b/lib/virtio/virtio_user/vhost.h index 7a434064a..2503e00f4 100644 --- a/lib/virtio/virtio_user/vhost.h +++ b/lib/virtio/virtio_user/vhost.h @@ -47,6 +47,10 @@ #define VHOST_USER_PROTOCOL_F_MQ 0 #endif +#ifndef VHOST_USER_PROTOCOL_F_CONFIG +#define VHOST_USER_PROTOCOL_F_CONFIG 9 +#endif + enum vhost_user_request { VHOST_USER_NONE = 0, VHOST_USER_GET_FEATURES = 1,