Skip to content

Commit

Permalink
virtio_net: disable VIRTIO_NET_F_STANDBY if VIRTIO_NET_F_MAC is not set
Browse files Browse the repository at this point in the history
failover relies on the MAC address to pair the primary and the standby
devices:

  "[...] the hypervisor needs to enable VIRTIO_NET_F_STANDBY
   feature on the virtio-net interface and assign the same MAC address
   to both virtio-net and VF interfaces."

  Documentation/networking/net_failover.rst

This patch disables the STANDBY feature if the MAC address is not
provided by the hypervisor.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Laurent Vivier authored and Jakub Kicinski committed Feb 2, 2023
1 parent ca3daf4 commit 7c06458
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -3813,6 +3813,12 @@ static int virtnet_validate(struct virtio_device *vdev)
__virtio_clear_bit(vdev, VIRTIO_NET_F_MTU);
}

if (virtio_has_feature(vdev, VIRTIO_NET_F_STANDBY) &&
!virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) {
dev_warn(&vdev->dev, "device advertises feature VIRTIO_NET_F_STANDBY but not VIRTIO_NET_F_MAC, disabling standby");
__virtio_clear_bit(vdev, VIRTIO_NET_F_STANDBY);
}

return 0;
}

Expand Down

0 comments on commit 7c06458

Please sign in to comment.