@@ -124,6 +124,18 @@ uint64_t vhost_net_get_max_queues(VHostNetState *net)
return net->dev.max_queues;
}
+int vhost_net_set_queue_num(NetClientState *nc, uint64_t queues)
+{
+ VHostNetState *net = get_vhost_net(nc);
+ const VhostOps *vhost_ops = net->dev.vhost_ops;
+
+ if (vhost_ops->vhost_set_queue_num) {
+ return vhost_ops->vhost_set_queue_num(&net->dev, queues);
+ }
+
+ return 0;
+}
+
uint64_t vhost_net_get_acked_features(VHostNetState *net)
{
return net->dev.acked_features;
@@ -456,6 +468,11 @@ uint64_t vhost_net_get_max_queues(VHostNetState *net)
return 1;
}
+int vhost_net_set_queue_num(NetClientState *nc, uint64_t queues)
+{
+ return 0;
+}
+
struct vhost_net *vhost_net_init(VhostNetOptions *options)
{
error_report("vhost-net support is not compiled in");
@@ -15,6 +15,7 @@ typedef struct VhostNetOptions {
} VhostNetOptions;
uint64_t vhost_net_get_max_queues(VHostNetState *net);
+int vhost_net_set_queue_num(NetClientState *nc, uint64_t queues);
struct vhost_net *vhost_net_init(VhostNetOptions *options);
int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, int total_queues);
This patch adds a new help to notify the backend with the number of queue pairs setup by the guest driver. Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> --- hw/net/vhost_net.c | 17 +++++++++++++++++ include/net/vhost_net.h | 1 + 2 files changed, 18 insertions(+)