[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v8 10/12] vhost_net: add NetClientState->load() callback
From: |
Jason Wang |
Subject: |
Re: [PATCH v8 10/12] vhost_net: add NetClientState->load() callback |
Date: |
Wed, 10 Aug 2022 13:07:56 +0800 |
On Wed, Aug 10, 2022 at 1:40 AM Eugenio Pérez <eperezma@redhat.com> wrote:
>
> It allows per-net client operations right after device's successful
> start. In particular, to load the device status.
>
> Vhost-vdpa net will use it to add the CVQ buffers to restore the device
> status.
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> v5: Rename start / load, naming it more specifically.
> ---
> include/net/net.h | 2 ++
> hw/net/vhost_net.c | 7 +++++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/include/net/net.h b/include/net/net.h
> index 476ad45b9a..81d0b21def 100644
> --- a/include/net/net.h
> +++ b/include/net/net.h
> @@ -45,6 +45,7 @@ typedef struct NICConf {
> typedef void (NetPoll)(NetClientState *, bool enable);
> typedef bool (NetCanReceive)(NetClientState *);
> typedef int (NetStart)(NetClientState *);
> +typedef int (NetLoad)(NetClientState *);
> typedef void (NetStop)(NetClientState *);
> typedef ssize_t (NetReceive)(NetClientState *, const uint8_t *, size_t);
> typedef ssize_t (NetReceiveIOV)(NetClientState *, const struct iovec *, int);
> @@ -74,6 +75,7 @@ typedef struct NetClientInfo {
> NetReceiveIOV *receive_iov;
> NetCanReceive *can_receive;
> NetStart *start;
> + NetLoad *load;
> NetStop *stop;
> NetCleanup *cleanup;
> LinkStatusChanged *link_status_changed;
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 9d4b334453..d28f8b974b 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -281,6 +281,13 @@ static int vhost_net_start_one(struct vhost_net *net,
> }
> }
> }
> +
> + if (net->nc->info->load) {
> + r = net->nc->info->load(net->nc);
> + if (r < 0) {
> + goto fail;
> + }
> + }
> return 0;
> fail:
> file.fd = -1;
> --
> 2.31.1
>
- Re: [PATCH v8 05/12] vhost_net: Add NetClientInfo prepare callback, (continued)
- [PATCH v8 04/12] vhost: Do not depend on !NULL VirtQueueElement on vhost_svq_flush, Eugenio Pérez, 2022/08/09
- [PATCH v8 06/12] vhost_net: Add NetClientInfo stop callback, Eugenio Pérez, 2022/08/09
- [PATCH v8 09/12] vdpa: extract vhost_vdpa_net_cvq_add from vhost_vdpa_net_handle_ctrl_avail, Eugenio Pérez, 2022/08/09
- [PATCH v8 08/12] vdpa: Move command buffers map to start of net device, Eugenio Pérez, 2022/08/09
- [PATCH v8 07/12] vdpa: add net_vhost_vdpa_cvq_info NetClientInfo, Eugenio Pérez, 2022/08/09
- [PATCH v8 10/12] vhost_net: add NetClientState->load() callback, Eugenio Pérez, 2022/08/09
- Re: [PATCH v8 10/12] vhost_net: add NetClientState->load() callback,
Jason Wang <=
- [PATCH v8 11/12] vdpa: Add virtio-net mac address via CVQ at start, Eugenio Pérez, 2022/08/09
- [PATCH v8 12/12] vdpa: Delete CVQ migration blocker, Eugenio Pérez, 2022/08/09
- Re: [PATCH v8 00/12] NIC vhost-vdpa state restore via Shadow CVQ, Eugenio Perez Martin, 2022/08/11