summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2021-10-20 12:55:55 +0800
committerMichael S. Tsirkin <mst@redhat.com>2021-10-20 04:44:05 -0400
commit2f849dbdb2ab2c70715520a8129524f197b9a8ba (patch)
tree442dc7b43b2e65a732a4cd5d29b2fa0cb6fb14a2 /net
parent654790b65b8435a7d409b1873b566e8db9e91b9b (diff)
downloadqemu-2f849dbdb2ab2c70715520a8129524f197b9a8ba.zip
net: introduce control client
This patch introduces a boolean for the device has control queue which can accepts control command via network queue. The first user would be the control virtqueue support for vhost. Signed-off-by: Jason Wang <jasowang@redhat.com> Message-Id: <20211020045600.16082-6-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/net.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/net/net.c b/net/net.c
index 52c99196c6..f0d14dbfc1 100644
--- a/net/net.c
+++ b/net/net.c
@@ -239,7 +239,8 @@ static void qemu_net_client_setup(NetClientState *nc,
NetClientState *peer,
const char *model,
const char *name,
- NetClientDestructor *destructor)
+ NetClientDestructor *destructor,
+ bool is_datapath)
{
nc->info = info;
nc->model = g_strdup(model);
@@ -258,6 +259,7 @@ static void qemu_net_client_setup(NetClientState *nc,
nc->incoming_queue = qemu_new_net_queue(qemu_deliver_packet_iov, nc);
nc->destructor = destructor;
+ nc->is_datapath = is_datapath;
QTAILQ_INIT(&nc->filters);
}
@@ -272,7 +274,23 @@ NetClientState *qemu_new_net_client(NetClientInfo *info,
nc = g_malloc0(info->size);
qemu_net_client_setup(nc, info, peer, model, name,
- qemu_net_client_destructor);
+ qemu_net_client_destructor, true);
+
+ return nc;
+}
+
+NetClientState *qemu_new_net_control_client(NetClientInfo *info,
+ NetClientState *peer,
+ const char *model,
+ const char *name)
+{
+ NetClientState *nc;
+
+ assert(info->size >= sizeof(NetClientState));
+
+ nc = g_malloc0(info->size);
+ qemu_net_client_setup(nc, info, peer, model, name,
+ qemu_net_client_destructor, false);
return nc;
}
@@ -297,7 +315,7 @@ NICState *qemu_new_nic(NetClientInfo *info,
for (i = 0; i < queues; i++) {
qemu_net_client_setup(&nic->ncs[i], info, peers[i], model, name,
- NULL);
+ NULL, true);
nic->ncs[i].queue_index = i;
}