From: Cindy Lu <lulu@redhat.com>
To: mst@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org
Cc: lulu@redhat.com
Subject: [PATCH v1 3/4] vhost_net:enable configure interrupt when vhost_net start
Date: Wed, 13 Jan 2021 23:45:39 +0800 [thread overview]
Message-ID: <20210113154540.24981-4-lulu@redhat.com> (raw)
In-Reply-To: <20210113154540.24981-1-lulu@redhat.com>
When peer is vhost vdpa, setup the configure interrupt function
vhost_net_start and release the resource when vhost_net_stop
Signed-off-by: Cindy Lu <lulu@redhat.com>
---
hw/net/vhost_net.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 24d555e764..fddc1f51f5 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -345,6 +345,15 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
error_report("Error binding guest notifier: %d", -r);
goto err;
}
+ if (ncs->peer && ncs->peer->info->type == NET_CLIENT_DRIVER_VHOST_VDPA) {
+ if (k->set_config_notifiers) {
+ r = k->set_config_notifiers(qbus->parent, true, true);
+ if (r < 0) {
+ error_report("Error binding config notifier: %d", -r);
+ goto err;
+ }
+ }
+ }
for (i = 0; i < total_queues; i++) {
peer = qemu_get_peer(ncs, i);
@@ -391,7 +400,15 @@ void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs,
for (i = 0; i < total_queues; i++) {
vhost_net_stop_one(get_vhost_net(ncs[i].peer), dev);
}
-
+ if (ncs->peer && ncs->peer->info->type == NET_CLIENT_DRIVER_VHOST_VDPA) {
+ if (k->set_config_notifiers) {
+ r = k->set_config_notifiers(qbus->parent, false, false);
+ if (r < 0) {
+ error_report("Error unbinding config notifier: %d", -r);
+ }
+ assert(r >= 0);
+ }
+ }
r = k->set_guest_notifiers(qbus->parent, total_queues * 2, false);
if (r < 0) {
fprintf(stderr, "vhost guest notifier cleanup failed: %d\n", r);
--
2.21.3
next prev parent reply other threads:[~2021-01-13 15:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-13 15:45 [PATCH v1 0/4] vhost-vdpa: add support for configure interrupt Cindy Lu
2021-01-13 15:45 ` [PATCH v1 1/4] virtio:add support in " Cindy Lu
2021-01-14 4:33 ` Jason Wang
2021-01-14 5:57 ` Cindy Lu
2021-01-13 15:45 ` [PATCH v1 2/4] virtio-pci:add support for " Cindy Lu
2021-01-14 4:43 ` Jason Wang
2021-01-14 6:08 ` Cindy Lu
2021-01-13 15:45 ` Cindy Lu [this message]
2021-01-13 15:45 ` [PATCH v1 4/4] vhost-vdpa:add callback function " Cindy Lu
2021-01-13 16:17 ` Michael S. Tsirkin
2021-01-14 6:15 ` Cindy Lu
2021-01-14 4:46 ` Jason Wang
2021-01-14 6:11 ` Cindy Lu
2021-01-14 4:35 ` [PATCH v1 0/4] vhost-vdpa: add support " Jason Wang
2021-01-14 6:14 ` Cindy Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210113154540.24981-4-lulu@redhat.com \
--to=lulu@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).