qemu/net
Eugenio Pérez 6949843046 vdpa: add vdpa net migration state notifier
This allows net to restart the device backend to configure SVQ on it.

Ideally, these changes should not be net specific and they could be done
in:
* vhost_vdpa_set_features (with VHOST_F_LOG_ALL)
* vhost_vdpa_set_vring_addr (with .enable_log)
* vhost_vdpa_set_log_base.

However, the vdpa net backend is the one with enough knowledge to
configure everything because of some reasons:
* Queues might need to be shadowed or not depending on its kind (control
  vs data).
* Queues need to share the same map translations (iova tree).

Also, there are other problems that may have solutions but complicates
the implementation at this stage:
* We're basically duplicating vhost_dev_start and vhost_dev_stop, and
  they could go out of sync.  If we want to reuse them, we need a way to
  skip some function calls to avoid recursiveness (either vhost_ops ->
  vhost_set_features, vhost_set_vring_addr, ...).
* We need to traverse all vhost_dev of a given net device twice: one to
  stop and get the vq state and another one after the reset to
  configure properties like address, fd, etc.

Because of that it is cleaner to restart the whole net backend and
configure again as expected, similar to how vhost-kernel moves between
userspace and passthrough.

If more kinds of devices need dynamic switching to SVQ we can:
* Create a callback struct like VhostOps and move most of the code
  there.  VhostOps cannot be reused since all vdpa backend share them,
  and to personalize just for networking would be too heavy.
* Add a parent struct or link all the vhost_vdpa or vhost_dev structs so
  we can traverse them.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230303172445.1089785-9-eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2023-03-07 12:38:59 -05:00
..
can util/log: Remove qemu_log_flush 2022-04-20 10:51:11 -07:00
announce.c qapi net: Elide redundant has_FOO in generated C 2022-12-14 20:04:47 +01:00
checksum.c net/checksum: Remove unused variable in net_checksum_add_iov 2021-07-26 07:06:58 -10:00
clients.h qapi: net: add stream and dgram netdevs 2022-10-28 13:28:52 +08:00
colo-compare.c qapi: Use returned bool to check for failure (again) 2022-12-14 16:19:35 +01:00
colo-compare.h Add the function of colo_compare_cleanup 2021-06-11 10:30:13 +08:00
colo.c net/colo.c: Fix the pointer issue reported by Coverity. 2022-09-02 10:22:39 +08:00
colo.h net/colo.c: Fix the pointer issue reported by Coverity. 2022-09-02 10:22:39 +08:00
dgram.c net: dgram: add unix socket 2022-10-28 13:28:52 +08:00
dump.c rtc: Move RTC function prototypes to their own header 2022-01-28 14:29:46 +00:00
eth.c net/eth: Don't consider ESP to be an IPv6 option header 2022-02-14 11:50:44 +08:00
filter-buffer.c netfilter: Use class properties 2020-12-15 10:02:07 -05:00
filter-mirror.c net/filter: Optimize filter_send to coroutine 2022-02-14 11:50:44 +08:00
filter-replay.c hw: Do not include qemu/log.h if it is not necessary 2021-05-02 17:24:50 +02:00
filter-rewriter.c net/colo: Fix a "double free" crash to clear the conn_list 2022-07-20 16:58:08 +08:00
filter.c netfilter: Use class properties 2020-12-15 10:02:07 -05:00
hub.c qapi net: Elide redundant has_FOO in generated C 2022-12-14 20:04:47 +01:00
hub.h net: Remove deprecated [hub_id name] tuple of 'hostfwd_add' / 'hostfwd_remove' 2020-03-09 18:44:04 +00:00
l2tpv3.c net: Increase L2TPv3 buffer to fit jumboframes 2023-02-17 13:31:33 +08:00
meson.build net: Move HMP commands from monitor to net/ 2023-02-04 07:56:54 +01:00
net-hmp-cmds.c net: Move hmp_info_network() to net-hmp-cmds.c 2023-02-04 07:56:54 +01:00
net.c net: Replace "Supported NIC models" with "Available NIC models" 2023-02-17 13:31:33 +08:00
netmap.c Do not include sysemu/sysemu.h if it's not really necessary 2021-05-02 17:24:50 +02:00
queue.c net: introduce qemu_receive_packet() 2021-03-15 16:41:22 +08:00
slirp.c qapi net: Elide redundant has_FOO in generated C 2022-12-14 20:04:47 +01:00
socket.c error handling: Use RETRY_ON_EINTR() macro where applicable 2023-01-09 13:50:47 +01:00
stream.c net: stream: add a new option to automatically reconnect 2023-02-17 13:31:33 +08:00
tap-bsd.c Refactoring: refactor TFR() macro to RETRY_ON_EINTR() 2023-01-09 13:50:47 +01:00
tap-linux.c Refactoring: refactor TFR() macro to RETRY_ON_EINTR() 2023-01-09 13:50:47 +01:00
tap-linux.h net: Replace TAB indentations with spaces 2022-11-11 09:39:03 +01:00
tap-solaris.c Refactoring: refactor TFR() macro to RETRY_ON_EINTR() 2023-01-09 13:50:47 +01:00
tap-stub.c net: Added SetSteeringEBPF method for NetClientState. 2021-06-04 15:25:46 +08:00
tap-win32.c qapi net: Elide redundant has_FOO in generated C 2022-12-14 20:04:47 +01:00
tap.c error handling: Use RETRY_ON_EINTR() macro where applicable 2023-01-09 13:50:47 +01:00
tap_int.h net: Added SetSteeringEBPF method for NetClientState. 2021-06-04 15:25:46 +08:00
trace-events net/colo.c: Fix the pointer issue reported by Coverity. 2022-09-02 10:22:39 +08:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
util.c net: Clean up includes 2016-02-04 17:41:30 +00:00
util.h Replace config-time define HOST_WORDS_BIGENDIAN 2022-04-06 10:50:37 +02:00
vde.c net: introduce qemu_set_info_str() function 2022-10-28 13:28:52 +08:00
vhost-user-stub.c vhost-net-user: add stubs for when no virtio-net device is present 2019-02-21 12:28:01 -05:00
vhost-user.c vhost-user: Refactor the chr_closed_bh 2023-01-08 01:54:22 -05:00
vhost-vdpa-stub.c vhost-net-vdpa: add stubs for when no virtio-net device is present 2022-07-20 16:58:08 +08:00
vhost-vdpa.c vdpa: add vdpa net migration state notifier 2023-03-07 12:38:59 -05:00
vmnet-bridged.m net/vmnet: implement bridged mode (vmnet-bridged) 2022-05-17 16:48:23 +08:00
vmnet-common.m vmnet: stop recieving events when VM is stopped 2023-02-17 13:31:33 +08:00
vmnet-host.c qapi net: Elide redundant has_FOO in generated C 2022-12-14 20:04:47 +01:00
vmnet-shared.c qapi net: Elide redundant has_FOO in generated C 2022-12-14 20:04:47 +01:00
vmnet_int.h vmnet: stop recieving events when VM is stopped 2023-02-17 13:31:33 +08:00