7c1f0c33 | 21-Oct-2022 |
Laurent Vivier <lvivier@redhat.com> |
net: dgram: make dgram_dst generic
dgram_dst is a sockaddr_in structure. To be able to use it with unix socket, use a pointer to a generic sockaddr structure.
Rename it dest_addr, and store socket
net: dgram: make dgram_dst generic
dgram_dst is a sockaddr_in structure. To be able to use it with unix socket, use a pointer to a generic sockaddr structure.
Rename it dest_addr, and store socket length in dest_len.
Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Stefano Brivio <sbrivio@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
13c6be96 | 21-Oct-2022 |
Laurent Vivier <lvivier@redhat.com> |
net: stream: add unix socket
Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Stefano Brivio <sbrivio@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Markus Armbru
net: stream: add unix socket
Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Stefano Brivio <sbrivio@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> (QAPI schema) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
80d3e477 | 21-Oct-2022 |
Stefano Brivio <sbrivio@redhat.com> |
net: stream: Don't ignore EINVAL on netdev socket connection
Other errors are treated as failure by net_stream_client_init(), but if connect() returns EINVAL, we'll fail silently. Remove the related
net: stream: Don't ignore EINVAL on netdev socket connection
Other errors are treated as failure by net_stream_client_init(), but if connect() returns EINVAL, we'll fail silently. Remove the related exception.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com> [lvivier: applied to net/stream.c] Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@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 ...
|
daf188ff | 21-Oct-2022 |
Stefano Brivio <sbrivio@redhat.com> |
net: socket: Don't ignore EINVAL on netdev socket connection
Other errors are treated as failure by net_socket_connect_init(), but if connect() returns EINVAL, we'll fail silently. Remove the relate
net: socket: Don't ignore EINVAL on netdev socket connection
Other errors are treated as failure by net_socket_connect_init(), but if connect() returns EINVAL, we'll fail silently. Remove the related exception.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: Laurent Vivier <lvivier@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 ...
|
5166fe0a | 21-Oct-2022 |
Laurent Vivier <lvivier@redhat.com> |
qapi: net: add stream and dgram netdevs
Copied from socket netdev file and modified to use SocketAddress to be able to introduce new features like unix socket.
"udp" and "mcast" are squashed into d
qapi: net: add stream and dgram netdevs
Copied from socket netdev file and modified to use SocketAddress to be able to introduce new features like unix socket.
"udp" and "mcast" are squashed into dgram netdev, multicast is detected according to the IP address type. "listen" and "connect" modes are managed by stream netdev. An optional parameter "server" defines the mode (off by default)
The two new types need to be parsed the modern way with -netdev, because with the traditional way, the "type" field of netdev structure collides with the "type" field of SocketAddress and prevents the correct evaluation of the command line option. Moreover the traditional way doesn't allow to use the same type (SocketAddress) several times with the -netdev option (needed to specify "local" and "remote" addresses).
The previous commit paved the way for parsing the modern way, but omitted one detail: how to pick modern vs. traditional, in netdev_is_modern().
We want to pick based on the value of parameter "type". But how to extract it from the option argument?
Parsing the option argument, either the modern or the traditional way, extracts it for us, but only if parsing succeeds.
If parsing fails, there is no good option. No matter which parser we pick, it'll be the wrong one for some arguments, and the error reporting will be confusing.
Fortunately, the traditional parser accepts *anything* when called in a certain way. This maximizes our chance to extract the value of "type", and in turn minimizes the risk of confusing error reporting.
Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Stefano Brivio <sbrivio@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
53b85d95 | 21-Oct-2022 |
Laurent Vivier <lvivier@redhat.com> |
net: introduce qemu_set_info_str() function
Embed the setting of info_str in a function.
Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> A
net: introduce qemu_set_info_str() function
Embed the setting of info_str in a function.
Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
f3eedcdd | 21-Oct-2022 |
Laurent Vivier <lvivier@redhat.com> |
qapi: net: introduce a way to bypass qemu_opts_parse_noisily()
As qemu_opts_parse_noisily() flattens the QAPI structures ("type" field of Netdev structure can collides with "type" field of SocketAdd
qapi: net: introduce a way to bypass qemu_opts_parse_noisily()
As qemu_opts_parse_noisily() flattens the QAPI structures ("type" field of Netdev structure can collides with "type" field of SocketAddress), we introduce a way to bypass qemu_opts_parse_noisily() and use directly visit_type_Netdev() to parse the backend parameters.
More details from Markus:
qemu_init() passes the argument of -netdev, -nic, and -net to net_client_parse().
net_client_parse() parses with qemu_opts_parse_noisily(), passing QemuOptsList qemu_netdev_opts for -netdev, qemu_nic_opts for -nic, and qemu_net_opts for -net. Their desc[] are all empty, which means any keys are accepted. The result of the parse (a QemuOpts) is stored in the QemuOptsList.
Note that QemuOpts is flat by design. In some places, we layer non-flat on top using dotted keys convention, but not here.
net_init_clients() iterates over the stored QemuOpts, and passes them to net_init_netdev(), net_param_nic(), or net_init_client(), respectively.
These functions pass the QemuOpts to net_client_init(). They also do other things with the QemuOpts, which we can ignore here.
net_client_init() uses the opts visitor to convert the (flat) QemOpts to a (non-flat) QAPI object Netdev. Netdev is also the argument of QMP command netdev_add.
The opts visitor was an early attempt to support QAPI in (QemuOpts-based) CLI. It restricts QAPI types to a certain shape; see commit eb7ee2cbeb "qapi: introduce OptsVisitor".
A more modern way to support QAPI is qobject_input_visitor_new_str(). It uses keyval_parse() instead of QemuOpts for KEY=VALUE,... syntax, and it also supports JSON syntax. The former isn't quite as expressive as JSON, but it's a lot closer than QemuOpts + opts visitor.
This commit paves the way to use of the modern way instead.
Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
show more ...
|
21fccb2c | 21-Oct-2022 |
Laurent Vivier <lvivier@redhat.com> |
net: simplify net_client_parse() error management
All net_client_parse() callers exit in case of error.
Move exit(1) to net_client_parse() and remove error checking from the callers.
Suggested-by:
net: simplify net_client_parse() error management
All net_client_parse() callers exit in case of error.
Move exit(1) to net_client_parse() and remove error checking from the callers.
Suggested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Markus Armbruster <armbru@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 ...
|
d63ef17b | 21-Oct-2022 |
Laurent Vivier <lvivier@redhat.com> |
net: remove the @errp argument of net_client_inits()
The only caller passes &error_fatal, so use this directly in the function.
It's what we do for -blockdev, -device, and -object.
Suggested-by: M
net: remove the @errp argument of net_client_inits()
The only caller passes &error_fatal, so use this directly in the function.
It's what we do for -blockdev, -device, and -object.
Suggested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Markus Armbruster <armbru@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 ...
|
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 ...
|