aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2020-03-19 14:03:31 +0100
committerDamjan Marion <dmarion@me.com>2020-03-21 12:06:26 +0000
commit529f0e97b6064039c500adce0d54b738954b2ffa (patch)
treeae4835cad1a0843fe0d22ed66dc2798e6bf55048 /src/vnet
parente5d34919b4561a5ee11e41dec6b0184537b39696 (diff)
virtio: fix link up/down flag
Type: fix "set int state <interface> down" puts the virtio device link down. It will not put the link in "UP" state, when "set int state <interface up>" will be used again to change the interface admin up. This patch fixes it. To test: create tap set int state tap0 up set int state tap0 down sh hardware sh int set int state tap0 up sh int sh hardware Change-Id: I3c0e31539f8a2a1e40220e7fb57eedecf408f067 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/devices/virtio/device.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c
index 588c84b7275..856e5f275e3 100644
--- a/src/vnet/devices/virtio/device.c
+++ b/src/vnet/devices/virtio/device.c
@@ -531,10 +531,16 @@ virtio_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
virtio_if_t *vif = pool_elt_at_index (mm->interfaces, hw->dev_instance);
if (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP)
- vif->flags |= VIRTIO_IF_FLAG_ADMIN_UP;
+ {
+ vif->flags |= VIRTIO_IF_FLAG_ADMIN_UP;
+ vnet_hw_interface_set_flags (vnm, vif->hw_if_index,
+ VNET_HW_INTERFACE_FLAG_LINK_UP);
+ }
else
- vif->flags &= ~VIRTIO_IF_FLAG_ADMIN_UP;
-
+ {
+ vif->flags &= ~VIRTIO_IF_FLAG_ADMIN_UP;
+ vnet_hw_interface_set_flags (vnm, vif->hw_if_index, 0);
+ }
return 0;
}