[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 6/7] vhost_net: Add NetClientInfo prepare callback
From: |
Eugenio Pérez |
Subject: |
[PATCH v2 6/7] vhost_net: Add NetClientInfo prepare callback |
Date: |
Fri, 22 Jul 2022 15:43:17 +0200 |
This is used by the backend to perform actions before the device is
started.
In particular, vdpa will use it to isolate CVQ in its own ASID if
possible, and start SVQ unconditionally only in CVQ.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
include/net/net.h | 2 ++
hw/net/vhost_net.c | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/include/net/net.h b/include/net/net.h
index ad9e80083a..37aecff8f7 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -44,6 +44,7 @@ typedef struct NICConf {
typedef void (NetPoll)(NetClientState *, bool enable);
typedef bool (NetCanReceive)(NetClientState *);
+typedef void (NetPrepare)(NetClientState *);
typedef int (NetStart)(NetClientState *);
typedef ssize_t (NetReceive)(NetClientState *, const uint8_t *, size_t);
typedef ssize_t (NetReceiveIOV)(NetClientState *, const struct iovec *, int);
@@ -72,6 +73,7 @@ typedef struct NetClientInfo {
NetReceive *receive_raw;
NetReceiveIOV *receive_iov;
NetCanReceive *can_receive;
+ NetPrepare *prepare;
NetStart *start;
NetCleanup *cleanup;
LinkStatusChanged *link_status_changed;
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index ddd9ee0441..0fc892c22b 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -244,6 +244,10 @@ static int vhost_net_start_one(struct vhost_net *net,
struct vhost_vring_file file = { };
int r;
+ if (net->nc->info->prepare) {
+ net->nc->info->prepare(net->nc);
+ }
+
r = vhost_dev_enable_notifiers(&net->dev, dev);
if (r < 0) {
goto fail_notifiers;
--
2.31.1
- [PATCH v2 0/7] ASID support in vhost-vdpa net, Eugenio Pérez, 2022/07/22
- [PATCH v2 1/7] linux-headers: Update kernel headers to v5.19-rc1, Eugenio Pérez, 2022/07/22
- [PATCH v2 3/7] vdpa: Allocate SVQ unconditionally, Eugenio Pérez, 2022/07/22
- [PATCH v2 2/7] vdpa: Use v->shadow_vqs_enabled in vhost_vdpa_svqs_start & stop, Eugenio Pérez, 2022/07/22
- [PATCH v2 5/7] vdpa: Store x-svq parameter in VhostVDPAState, Eugenio Pérez, 2022/07/22
- [PATCH v2 6/7] vhost_net: Add NetClientInfo prepare callback,
Eugenio Pérez <=
- [PATCH v2 4/7] vdpa: Add asid parameter to vhost_vdpa_dma_map/unmap, Eugenio Pérez, 2022/07/22
- [PATCH v2 7/7] vdpa: Always start CVQ in SVQ mode, Eugenio Pérez, 2022/07/22