[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH RFC 7/7] drivers/virtio: Fix the return value checking of virtio_config_get



According to current implementation if virtio_config_get, it returns 0 if
there is no error. Thus, we can't check here since 0 != UK_NETDEV_HWADDR_LEN

Without this patch, on arm64 kvm, virtio_net device can't get the mac address
which was assigned by qemu command line.

Signed-off-by: Jia He <justin.he@xxxxxxx>
---
 plat/drivers/virtio/virtio_net.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/plat/drivers/virtio/virtio_net.c b/plat/drivers/virtio/virtio_net.c
index 3025ed3..5139535 100644
--- a/plat/drivers/virtio/virtio_net.c
+++ b/plat/drivers/virtio/virtio_net.c
@@ -835,7 +835,6 @@ static __u16 virtio_net_mtu_get(struct uk_netdev *n)
 static int virtio_netdev_feature_negotiate(struct virtio_net_device *vndev)
 {
        __u64 host_features = 0;
-       __u16 hw_len;
        int rc = 0;
 
        /**
@@ -865,16 +864,14 @@ static int virtio_netdev_feature_negotiate(struct 
virtio_net_device *vndev)
         * virtio device in a separate header file which could be reused across
         * different virtio devices.
         */
-       hw_len = virtio_config_get(vndev->vdev,
+       rc = virtio_config_get(vndev->vdev,
                                   __offsetof(struct virtio_net_config, mac),
                                   &vndev->hw_addr.addr_bytes[0],
                                   UK_NETDEV_HWADDR_LEN, 1);
-       if (unlikely(hw_len != UK_NETDEV_HWADDR_LEN)) {
+       if (rc < 0) {
                uk_pr_err("Failed to retrieve the mac address from device\n");
-               rc = -EAGAIN;
                goto exit;
        }
-       rc = 0;
 
        /**
         * Mask out features supported by both driver and device.
-- 
2.17.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.