You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
virtio-net: Use virtio_config_val() for retrieving config
This patch modifies virtio-net to use virtio_config_val() instead of a 'if(virtio_has_feature()) vdev->config->get()' construct to retrieve optional values from the config space. Cc: Amit Shah <amit.shah@redhat.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: virtualization@lists.linux-foundation.org Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Rusty Russell
parent
3ead6f4d42
commit
77dd7693c5
@@ -925,12 +925,10 @@ static void virtnet_update_status(struct virtnet_info *vi)
|
|||||||
{
|
{
|
||||||
u16 v;
|
u16 v;
|
||||||
|
|
||||||
if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS))
|
if (virtio_config_val(vi->vdev, VIRTIO_NET_F_STATUS,
|
||||||
return;
|
|
||||||
|
|
||||||
vi->vdev->config->get(vi->vdev,
|
|
||||||
offsetof(struct virtio_net_config, status),
|
offsetof(struct virtio_net_config, status),
|
||||||
&v, sizeof(v));
|
&v) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Ignore unknown (future) status bits */
|
/* Ignore unknown (future) status bits */
|
||||||
v &= VIRTIO_NET_S_LINK_UP;
|
v &= VIRTIO_NET_S_LINK_UP;
|
||||||
@@ -1006,11 +1004,9 @@ static int virtnet_probe(struct virtio_device *vdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Configuration may specify what MAC to use. Otherwise random. */
|
/* Configuration may specify what MAC to use. Otherwise random. */
|
||||||
if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) {
|
if (virtio_config_val_len(vdev, VIRTIO_NET_F_MAC,
|
||||||
vdev->config->get(vdev,
|
|
||||||
offsetof(struct virtio_net_config, mac),
|
offsetof(struct virtio_net_config, mac),
|
||||||
dev->dev_addr, dev->addr_len);
|
dev->dev_addr, dev->addr_len) < 0)
|
||||||
} else
|
|
||||||
random_ether_addr(dev->dev_addr);
|
random_ether_addr(dev->dev_addr);
|
||||||
|
|
||||||
/* Set up our device-specific information */
|
/* Set up our device-specific information */
|
||||||
|
|||||||
Reference in New Issue
Block a user