qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Eugenio Pérez" <eperezma@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gautam Dawar <gdawar@xilinx.com>,
	Parav Pandit <parav@mellanox.com>,
	Zhu Lingshan <lingshan.zhu@intel.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>, Cindy Lu <lulu@redhat.com>,
	Eli Cohen <eli@mellanox.com>, Laurent Vivier <lvivier@redhat.com>,
	Si-Wei Liu <si-wei.liu@oracle.com>,
	Liuxiangdong <liuxiangdong5@huawei.com>,
	Harpreet Singh Anand <hanand@xilinx.com>
Subject: [PATCH 1/3] virtio_net: Modify virtio_net_get_config to early return
Date: Wed, 26 Oct 2022 11:53:01 +0200	[thread overview]
Message-ID: <20221026095303.37907-2-eperezma@redhat.com> (raw)
In-Reply-To: <20221026095303.37907-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>
---
 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 e9f696b4cf..56ff219196 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -158,20 +158,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



  reply	other threads:[~2022-10-26  9:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  9:53 [PATCH 0/3] Emulate status feature in vhost-vdpa net Eugenio Pérez
2022-10-26  9:53 ` Eugenio Pérez [this message]
2022-10-26 13:38   ` [PATCH 1/3] virtio_net: Modify virtio_net_get_config to early return Philippe Mathieu-Daudé
2022-10-26  9:53 ` [PATCH 2/3] virtio_net: Handle _F_STATUS emulation in virtio_net_get_config Eugenio Pérez
2022-10-26  9:53 ` [PATCH 3/3] vdpa: Expose VIRTIO_NET_F_STATUS unconditionally Eugenio Pérez
2022-10-27  4:31   ` Jason Wang
2022-10-27  6:46     ` Eugenio Perez Martin
2022-10-27  6:54       ` Jason Wang
2022-10-27 10:17         ` Eugenio Perez Martin
2022-10-28  1:58           ` Jason Wang
2022-10-28  9:29             ` Eugenio Perez Martin
2022-11-01  8:09               ` Jason Wang
2022-11-02 11:18                 ` Eugenio Perez Martin
2022-11-03  3:21                   ` Jason Wang
2022-11-03  8:11                     ` Eugenio Perez Martin
2022-11-07  7:51                       ` Jason Wang
2022-11-07  9:25                         ` Eugenio Perez Martin
2022-10-26 20:53 ` [PATCH 0/3] Emulate status feature in vhost-vdpa net Michael S. Tsirkin

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=20221026095303.37907-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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).