mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
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>
This commit is contained in:
parent
d1f8b30ec8
commit
e2051e9e00
5 changed files with 39 additions and 1 deletions
|
@ -122,6 +122,11 @@ void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
|
|||
vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
|
||||
}
|
||||
|
||||
uint64_t vhost_net_get_max_queues(VHostNetState *net)
|
||||
{
|
||||
return net->dev.max_queues;
|
||||
}
|
||||
|
||||
static int vhost_net_get_fd(NetClientState *backend)
|
||||
{
|
||||
switch (backend->info->type) {
|
||||
|
@ -144,6 +149,8 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
net->dev.max_queues = 1;
|
||||
|
||||
if (backend_kernel) {
|
||||
r = vhost_net_get_fd(options->net_backend);
|
||||
if (r < 0) {
|
||||
|
@ -414,6 +421,11 @@ VHostNetState *get_vhost_net(NetClientState *nc)
|
|||
return vhost_net;
|
||||
}
|
||||
#else
|
||||
uint64_t vhost_net_get_max_queues(VHostNetState *net)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct vhost_net *vhost_net_init(VhostNetOptions *options)
|
||||
{
|
||||
error_report("vhost-net support is not compiled in");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue