From: "Eugenio Pérez" <eperezma@redhat.com>
To: qemu-devel@nongnu.org
Cc: Eli Cohen <eli@mellanox.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
Liuxiangdong <liuxiangdong5@huawei.com>,
Zhu Lingshan <lingshan.zhu@intel.com>,
Laurent Vivier <lvivier@redhat.com>,
Parav Pandit <parav@mellanox.com>,
Gautam Dawar <gdawar@xilinx.com>, Lei Yang <leiyang@redhat.com>,
Harpreet Singh Anand <hanand@xilinx.com>,
Stefano Garzarella <sgarzare@redhat.com>,
Si-Wei Liu <si-wei.liu@oracle.com>, Cindy Lu <lulu@redhat.com>
Subject: [PATCH v2 1/4] virtio_net: Modify virtio_net_get_config to early return
Date: Thu, 24 Nov 2022 18:33:11 +0100 [thread overview]
Message-ID: <20221124173314.2123015-2-eperezma@redhat.com> (raw)
In-Reply-To: <20221124173314.2123015-1-eperezma@redhat.com>
Next patches introduce more code on vhost-vdpa branch, with already have
too much indentation.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/net/virtio-net.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index aba12759d5..eed629766f 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -168,20 +168,22 @@ static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config)
if (nc->peer && nc->peer->info->type == NET_CLIENT_DRIVER_VHOST_VDPA) {
ret = vhost_net_get_config(get_vhost_net(nc->peer), (uint8_t *)&netcfg,
n->config_size);
- if (ret != -1) {
- /*
- * Some NIC/kernel combinations present 0 as the mac address. As
- * that is not a legal address, try to proceed with the
- * address from the QEMU command line in the hope that the
- * address has been configured correctly elsewhere - just not
- * reported by the device.
- */
- if (memcmp(&netcfg.mac, &zero, sizeof(zero)) == 0) {
- info_report("Zero hardware mac address detected. Ignoring.");
- memcpy(netcfg.mac, n->mac, ETH_ALEN);
- }
- memcpy(config, &netcfg, n->config_size);
+ if (ret == -1) {
+ return;
}
+
+ /*
+ * Some NIC/kernel combinations present 0 as the mac address. As that
+ * is not a legal address, try to proceed with the address from the
+ * QEMU command line in the hope that the address has been configured
+ * correctly elsewhere - just not reported by the device.
+ */
+ if (memcmp(&netcfg.mac, &zero, sizeof(zero)) == 0) {
+ info_report("Zero hardware mac address detected. Ignoring.");
+ memcpy(netcfg.mac, n->mac, ETH_ALEN);
+ }
+
+ memcpy(config, &netcfg, n->config_size);
}
}
--
2.31.1
next prev parent reply other threads:[~2022-11-24 17:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-24 17:33 [PATCH v2 0/4] Guest announce feature emulation using Shadow VirtQueue Eugenio Pérez
2022-11-24 17:33 ` Eugenio Pérez [this message]
2022-11-30 6:55 ` [PATCH v2 1/4] virtio_net: Modify virtio_net_get_config to early return Jason Wang
2022-11-24 17:33 ` [PATCH v2 2/4] virtio_net: copy VIRTIO_NET_S_ANNOUNCE if device model has it Eugenio Pérez
2022-11-30 6:58 ` Jason Wang
2022-12-20 13:44 ` Michael S. Tsirkin
2022-12-20 13:53 ` Eugenio Perez Martin
2022-11-24 17:33 ` [PATCH v2 3/4] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail Eugenio Pérez
2022-11-30 7:01 ` Jason Wang
2022-11-30 7:06 ` Eugenio Perez Martin
2022-12-01 8:39 ` Jason Wang
2022-12-01 9:28 ` Eugenio Perez Martin
2022-12-05 4:27 ` Jason Wang
2022-12-05 13:06 ` Eugenio Perez Martin
2022-12-06 7:30 ` Jason Wang
2022-11-30 7:10 ` Michael S. Tsirkin
2022-11-30 7:17 ` Eugenio Perez Martin
2022-11-24 17:33 ` [PATCH v2 4/4] vdpa: do not handle VIRTIO_NET_F_GUEST_ANNOUNCE in vhost-vdpa Eugenio Pérez
2022-11-30 7:02 ` Jason Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221124173314.2123015-2-eperezma@redhat.com \
--to=eperezma@redhat.com \
--cc=eli@mellanox.com \
--cc=gdawar@xilinx.com \
--cc=hanand@xilinx.com \
--cc=jasowang@redhat.com \
--cc=leiyang@redhat.com \
--cc=lingshan.zhu@intel.com \
--cc=liuxiangdong5@huawei.com \
--cc=lulu@redhat.com \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=parav@mellanox.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=si-wei.liu@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.