@@ -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;
@@ -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;
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(+)