30e4226b | 21-Oct-2022 |
Laurent Vivier <lvivier@redhat.com> |
net: introduce convert_host_port()
Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Acked-b
net: introduce convert_host_port()
Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
7d0e12af | 03-Oct-2022 |
Daniel P. Berrangé <berrange@redhat.com> |
net: improve error message for missing netdev backend
The current message when using '-net user...' with SLIRP disabled at compile time is:
qemu-system-x86_64: -net user: Parameter 'type' expects
net: improve error message for missing netdev backend
The current message when using '-net user...' with SLIRP disabled at compile time is:
qemu-system-x86_64: -net user: Parameter 'type' expects a net backend type (maybe it is not compiled into this binary)
An observation is that we're using the 'netdev->type' field here which is an enum value, produced after QAPI has converted from its string form.
IOW, at this point in the code, we know that the user's specified type name was a valid network backend. The only possible scenario that can make the backend init function be NULL, is if support for that backend was disabled at build time. Given this, we don't need to caveat our error message with a 'maybe' hint, we can be totally explicit.
The use of QERR_INVALID_PARAMETER_VALUE doesn't really lend itself to user friendly error message text. Since this is not used to set a specific QAPI error class, we can simply stop using this pre-formatted error text and provide something better.
Thus the new message is:
qemu-system-x86_64: -net user: network backend 'user' is not compiled into this binary
The case of passing 'hubport' for -net is also given a message reminding people they should have used -netdev/-nic instead, as this backend type is only valid for the modern syntax.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
8801ccd0 | 08-Oct-2022 |
Si-Wei Liu <si-wei.liu@oracle.com> |
vhost-vdpa: allow passing opened vhostfd to vhost-vdpa
Similar to other vhost backends, vhostfd can be passed to vhost-vdpa backend as another parameter to instantiate vhost-vdpa net client. This wo
vhost-vdpa: allow passing opened vhostfd to vhost-vdpa
Similar to other vhost backends, vhostfd can be passed to vhost-vdpa backend as another parameter to instantiate vhost-vdpa net client. This would benefit the use case where only open file descriptors, as opposed to raw vhost-vdpa device paths, are accessible from the QEMU process.
(qemu) netdev_add type=vhost-vdpa,vhostfd=61,id=vhost-vdpa1
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com> Acked-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
6ce262fb | 20-Oct-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: Remove shadow CVQ command check
The guest will see undefined behavior if it issue not negotiate commands, bit it is expected somehow.
Simplify code deleting this check.
Signed-off-by: Eugeni
vdpa: Remove shadow CVQ command check
The guest will see undefined behavior if it issue not negotiate commands, bit it is expected somehow.
Simplify code deleting this check.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
faa825dd | 20-Oct-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: Delete duplicated vdpa_feature_bits entry
This entry was duplicated on referenced commit. Removing it.
Fixes: 402378407dbd ("vhost-vdpa: multiqueue support") Signed-off-by: Eugenio Pérez <epe
vdpa: Delete duplicated vdpa_feature_bits entry
This entry was duplicated on referenced commit. Removing it.
Fixes: 402378407dbd ("vhost-vdpa: multiqueue support") Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
bf769f74 | 23-Sep-2022 |
lu zhipeng <luzhipeng@cestc.cn> |
virtio: del net client if net_init_tap_one failed
If the net tap initializes successful, but failed during network card hot-plugging, the net-tap will remains, so cleanup.
Signed-off-by: lu zhipeng
virtio: del net client if net_init_tap_one failed
If the net tap initializes successful, but failed during network card hot-plugging, the net-tap will remains, so cleanup.
Signed-off-by: lu zhipeng <luzhipeng@cestc.cn> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
72b99a87 | 06-Sep-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: Allow MQ feature in SVQ
Finally enable SVQ with MQ feature.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com> |
275ba561 | 06-Sep-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: validate MQ CVQ commands
So we are sure we can update the device model properly before sending to the device.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jas
vdpa: validate MQ CVQ commands
So we are sure we can update the device model properly before sending to the device.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
f64c7cda | 06-Sep-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: Add vhost_vdpa_net_load_mq
Same way as with the MAC, restore the expected number of queues at device's start.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jas
vdpa: Add vhost_vdpa_net_load_mq
Same way as with the MAC, restore the expected number of queues at device's start.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
f73c0c43 | 06-Sep-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: extract vhost_vdpa_net_load_mac from vhost_vdpa_net_load
Since there may be many commands we need to issue to load the NIC state, let's split them in individual functions
Signed-off-by: Eugen
vdpa: extract vhost_vdpa_net_load_mac from vhost_vdpa_net_load
Since there may be many commands we need to issue to load the NIC state, let's split them in individual functions
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
17fb889f | 06-Sep-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: Make VhostVDPAState cvq_cmd_in_buffer control ack type
This allows to simplify the code. Rename to status while we're at it.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by:
vdpa: Make VhostVDPAState cvq_cmd_in_buffer control ack type
This allows to simplify the code. Rename to status while we're at it.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
3772cf0d | 22-Aug-2022 |
Zhang Chen <chen.zhang@intel.com> |
net/colo.c: Fix the pointer issue reported by Coverity.
When enabled the virtio-net-pci, guest network packet will load the vnet_hdr. In COLO status, the primary VM's network packet maybe redirect t
net/colo.c: Fix the pointer issue reported by Coverity.
When enabled the virtio-net-pci, guest network packet will load the vnet_hdr. In COLO status, the primary VM's network packet maybe redirect to another VM, it needs filter-redirect enable the vnet_hdr flag at the same time, COLO-proxy will correctly parse the original network packet. If have any misconfiguration here, the vnet_hdr_len is wrong for parse the packet, the data+offset will point to wrong place.
Signed-off-by: Zhang Chen <chen.zhang@intel.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
0e3fdcff | 23-Aug-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: Delete CVQ migration blocker
We can restore the device state in the destination via CVQ now. Remove the migration blocker.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Jason W
vdpa: Delete CVQ migration blocker
We can restore the device state in the destination via CVQ now. Remove the migration blocker.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
dd036d8d | 23-Aug-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: Add virtio-net mac address via CVQ at start
This is needed so the destination vdpa device see the same state a the guest set in the source.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
vdpa: Add virtio-net mac address via CVQ at start
This is needed so the destination vdpa device see the same state a the guest set in the source.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
be4278b6 | 23-Aug-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: extract vhost_vdpa_net_cvq_add from vhost_vdpa_net_handle_ctrl_avail
So we can reuse it to inject state messages.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Jason Wang <jaso
vdpa: extract vhost_vdpa_net_cvq_add from vhost_vdpa_net_handle_ctrl_avail
So we can reuse it to inject state messages.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> -- v7: * Remove double free error
v6: * Do not assume in buffer sent to the device is sizeof(virtio_net_ctrl_ack)
v5: * Do not use an artificial !NULL VirtQueueElement * Use only out size instead of iovec dev_buffers for these functions.
Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
7a7f87e9 | 23-Aug-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: Move command buffers map to start of net device
As this series will reuse them to restore the device state at the end of a migration (or a device start), let's allocate only once at the device
vdpa: Move command buffers map to start of net device
As this series will reuse them to restore the device state at the end of a migration (or a device start), let's allocate only once at the device start so we don't duplicate their map and unmap.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
f8972b56 | 23-Aug-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: add net_vhost_vdpa_cvq_info NetClientInfo
Next patches will add a new info callback to restore NIC status through CVQ. Since only the CVQ vhost device is needed, create it with a new NetClient
vdpa: add net_vhost_vdpa_cvq_info NetClientInfo
Next patches will add a new info callback to restore NIC status through CVQ. Since only the CVQ vhost device is needed, create it with a new NetClientInfo.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
69292a8e | 23-Aug-2022 |
Eugenio Pérez <eperezma@redhat.com> |
util: accept iova_tree_remove_parameter by value
It's convenient to call iova_tree_remove from a map returned from iova_tree_find or iova_tree_find_iova. With the current code this is not possible,
util: accept iova_tree_remove_parameter by value
It's convenient to call iova_tree_remove from a map returned from iova_tree_find or iova_tree_find_iova. With the current code this is not possible, since we will free it, and then we will try to search for it again.
Fix it making accepting the map by value, forcing a copy of the argument. Not applying a fixes tag, since there is no use like that at the moment.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
aed5da45 | 02-Aug-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: Fix file descriptor leak on get features error
File descriptor vdpa_device_fd is not free in the case of returning error from vhost_vdpa_get_features. Fixing it by making all errors go to the
vdpa: Fix file descriptor leak on get features error
File descriptor vdpa_device_fd is not free in the case of returning error from vhost_vdpa_get_features. Fixing it by making all errors go to the same error path.
Resolves: Coverity CID 1490785 Fixes: 8170ab3f43 ("vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs")
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20220802112447.249436-2-eperezma@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
show more ...
|
8bdab83b | 01-Apr-2022 |
Zhang Chen <chen.zhang@intel.com> |
net/colo.c: fix segmentation fault when packet is not parsed correctly
When COLO use only one vnet_hdr_support parameter between filter-redirector and filter-mirror(or colo-compare), COLO will crash
net/colo.c: fix segmentation fault when packet is not parsed correctly
When COLO use only one vnet_hdr_support parameter between filter-redirector and filter-mirror(or colo-compare), COLO will crash with segmentation fault. Back track as follow:
Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault. 0x0000555555cb200b in eth_get_l2_hdr_length (p=0x0) at /home/tao/project/COLO/colo-qemu/include/net/eth.h:296 296 uint16_t proto = be16_to_cpu(PKT_GET_ETH_HDR(p)->h_proto); (gdb) bt 0 0x0000555555cb200b in eth_get_l2_hdr_length (p=0x0) at /home/tao/project/COLO/colo-qemu/include/net/eth.h:296 1 0x0000555555cb22b4 in parse_packet_early (pkt=0x555556a44840) at net/colo.c:49 2 0x0000555555cb2b91 in is_tcp_packet (pkt=0x555556a44840) at net/filter-rewriter.c:63
So wrong vnet_hdr_len will cause pkt->data become NULL. Add check to raise error and add trace-events to track vnet_hdr_len.
Signed-off-by: Tao Xu <tao3.xu@intel.com> Signed-off-by: Zhang Chen <chen.zhang@intel.com> Reviewed-by: Li Zhijian <lizhijian@fujitsu.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
94c36c48 | 01-Apr-2022 |
Zhang Chen <chen.zhang@intel.com> |
net/colo.c: No need to track conn_list for filter-rewriter
Filter-rewriter no need to track connection in conn_list. This patch fix the glib g_queue_is_empty assertion when COLO guest keep a lot of
net/colo.c: No need to track conn_list for filter-rewriter
Filter-rewriter no need to track connection in conn_list. This patch fix the glib g_queue_is_empty assertion when COLO guest keep a lot of network connection.
Signed-off-by: Zhang Chen <chen.zhang@intel.com> Reviewed-by: Li Zhijian <lizhijian@fujitsu.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
a18d4369 | 01-Apr-2022 |
Zhang Chen <chen.zhang@intel.com> |
net/colo: Fix a "double free" crash to clear the conn_list
We notice the QEMU may crash when the guest has too many incoming network connections with the following log:
15197@1593578622.668573:colo
net/colo: Fix a "double free" crash to clear the conn_list
We notice the QEMU may crash when the guest has too many incoming network connections with the following log:
15197@1593578622.668573:colo_proxy_main : colo proxy connection hashtable full, clear it free(): invalid pointer [1] 15195 abort (core dumped) qemu-system-x86_64 ....
This is because we create the s->connection_track_table with g_hash_table_new_full() which is defined as:
GHashTable * g_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func, GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func);
The fourth parameter connection_destroy() will be called to free the memory allocated for all 'Connection' values in the hashtable when we call g_hash_table_remove_all() in the connection_hashtable_reset().
But both connection_track_table and conn_list reference to the same conn instance. It will trigger double free in conn_list clear. So this patch remove free action on hash table side to avoid double free the conn.
Signed-off-by: Like Xu <like.xu@linux.intel.com> Signed-off-by: Zhang Chen <chen.zhang@intel.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
1576dbb5 | 20-Jul-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: Add x-svq to NetdevVhostVDPAOptions
Finally offering the possibility to enable SVQ from the command line.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Markus Armbruster <armbr
vdpa: Add x-svq to NetdevVhostVDPAOptions
Finally offering the possibility to enable SVQ from the command line.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
8170ab3f | 20-Jul-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs
To know the device features is needed for CVQ SVQ, so SVQ knows if it can handle all commands or not. Extract from vhost_vdpa_get_
vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs
To know the device features is needed for CVQ SVQ, so SVQ knows if it can handle all commands or not. Extract from vhost_vdpa_get_max_queue_pairs so we can reuse it.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
2df4dd31 | 20-Jul-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa: Buffer CVQ support on shadow virtqueue
Introduce the control virtqueue support for vDPA shadow virtqueue. This is needed for advanced networking features like rx filtering.
Virtio-net control
vdpa: Buffer CVQ support on shadow virtqueue
Introduce the control virtqueue support for vDPA shadow virtqueue. This is needed for advanced networking features like rx filtering.
Virtio-net control VQ copies the descriptors to qemu's VA, so we avoid TOCTOU with the guest's or device's memory every time there is a device model change. Otherwise, the guest could change the memory content in the time between qemu and the device read it.
To demonstrate command handling, VIRTIO_NET_F_CTRL_MACADDR is implemented. If the virtio-net driver changes MAC the virtio-net device model will be updated with the new one, and a rx filtering change event will be raised.
More cvq commands could be added here straightforwardly but they have not been tested.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|