diff options
author | Yuanhan Liu <yuanhan.liu@linux.intel.com> | 2015-09-23 12:19:58 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-09-24 16:27:52 +0300 |
commit | e2051e9e004649b53af4db34f78c689fb44e075b (patch) | |
tree | 5621451188099ce6e8d2df7dcc81f0d2401fd166 /hw/virtio | |
parent | d1f8b30ec8dde0318fd1b98d24a64926feae9625 (diff) |
vhost-user: add VHOST_USER_GET_QUEUE_NUM message
This is for querying how many queues the backend supports if it has mq
support(when VHOST_USER_PROTOCOL_F_MQ flag is set from the quried
protocol features).
vhost_net_get_max_queues() is the interface to export that value, and
to tell if the backend supports # of queues user requested, which is
done in the following patch.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Tested-by: Marcel Apfelbaum <marcel@redhat.com>
Diffstat (limited to 'hw/virtio')
-rw-r--r-- | hw/virtio/vhost-user.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 9cb2f52eb7..694fde5bf6 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -25,7 +25,9 @@ #define VHOST_MEMORY_MAX_NREGIONS 8 #define VHOST_USER_F_PROTOCOL_FEATURES 30 -#define VHOST_USER_PROTOCOL_FEATURE_MASK 0x0ULL +#define VHOST_USER_PROTOCOL_FEATURE_MASK 0x1ULL + +#define VHOST_USER_PROTOCOL_F_MQ 0 typedef enum VhostUserRequest { VHOST_USER_NONE = 0, @@ -45,6 +47,7 @@ typedef enum VhostUserRequest { VHOST_USER_SET_VRING_ERR = 14, VHOST_USER_GET_PROTOCOL_FEATURES = 15, VHOST_USER_SET_PROTOCOL_FEATURES = 16, + VHOST_USER_GET_QUEUE_NUM = 17, VHOST_USER_MAX } VhostUserRequest; @@ -211,6 +214,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, switch (msg_request) { case VHOST_USER_GET_FEATURES: case VHOST_USER_GET_PROTOCOL_FEATURES: + case VHOST_USER_GET_QUEUE_NUM: need_reply = 1; break; @@ -315,6 +319,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request, switch (msg_request) { case VHOST_USER_GET_FEATURES: case VHOST_USER_GET_PROTOCOL_FEATURES: + case VHOST_USER_GET_QUEUE_NUM: if (msg.size != sizeof(m.u64)) { error_report("Received bad msg size."); return -1; @@ -366,6 +371,14 @@ static int vhost_user_init(struct vhost_dev *dev, void *opaque) if (err < 0) { return err; } + + /* query the max queues we support if backend supports Multiple Queue */ + if (dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_MQ)) { + err = vhost_user_call(dev, VHOST_USER_GET_QUEUE_NUM, &dev->max_queues); + if (err < 0) { + return err; + } + } } return 0; |