summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/avf/device.c5
-rw-r--r--src/plugins/dpdk/device/init.c4
-rw-r--r--src/plugins/vmxnet3/vmxnet3.c10
-rw-r--r--src/vnet/interface_format.c2
4 files changed, 13 insertions, 8 deletions
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index df6d12881a5..d12785cc552 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -1169,8 +1169,9 @@ avf_process_one_device (vlib_main_t * vm, avf_device_t * ad, int is_irq)
flags |= (VNET_HW_INTERFACE_FLAG_FULL_DUPLEX |
VNET_HW_INTERFACE_FLAG_LINK_UP);
vnet_hw_interface_set_flags (vnm, ad->hw_if_index, flags);
- vnet_hw_interface_set_link_speed (vnm, ad->hw_if_index,
- mbps * 1000);
+ vnet_hw_interface_set_link_speed (
+ vnm, ad->hw_if_index,
+ (mbps == UINT32_MAX) ? UINT32_MAX : mbps * 1000);
ad->link_speed = mbps;
}
else if (!link_up && (ad->flags & AVF_DEVICE_F_LINK_UP) != 0)
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 6d3b8643147..6b1479b9c75 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -1390,7 +1390,9 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now)
}
if (xd->link.link_speed != prev_link.link_speed)
vnet_hw_interface_set_link_speed (vnm, xd->hw_if_index,
- xd->link.link_speed * 1000);
+ (xd->link.link_speed == UINT32_MAX) ?
+ UINT32_MAX :
+ xd->link.link_speed * 1000);
if (xd->link.link_status != prev_link.link_status)
{
diff --git a/src/plugins/vmxnet3/vmxnet3.c b/src/plugins/vmxnet3/vmxnet3.c
index a0c125a2c97..770cb2d418d 100644
--- a/src/plugins/vmxnet3/vmxnet3.c
+++ b/src/plugins/vmxnet3/vmxnet3.c
@@ -572,8 +572,9 @@ vmxnet3_event_irq_handler (vlib_main_t * vm, vlib_pci_dev_handle_t h,
{
vd->flags |= VMXNET3_DEVICE_F_LINK_UP;
vd->link_speed = ret >> 16;
- vnet_hw_interface_set_link_speed (vnm, vd->hw_if_index,
- vd->link_speed * 1000);
+ vnet_hw_interface_set_link_speed (
+ vnm, vd->hw_if_index,
+ (vd->link_speed == UINT32_MAX) ? UINT32_MAX : vd->link_speed * 1000);
vnet_hw_interface_set_flags (vnm, vd->hw_if_index,
VNET_HW_INTERFACE_FLAG_LINK_UP);
}
@@ -867,8 +868,9 @@ vmxnet3_create_if (vlib_main_t * vm, vmxnet3_create_if_args_t * args)
vd->flags |= VMXNET3_DEVICE_F_INITIALIZED;
vmxnet3_enable_interrupt (vd);
- vnet_hw_interface_set_link_speed (vnm, vd->hw_if_index,
- vd->link_speed * 1000);
+ vnet_hw_interface_set_link_speed (
+ vnm, vd->hw_if_index,
+ (vd->link_speed == UINT32_MAX) ? UINT32_MAX : vd->link_speed * 1000);
if (vd->flags & VMXNET3_DEVICE_F_LINK_UP)
vnet_hw_interface_set_flags (vnm, vd->hw_if_index,
VNET_HW_INTERFACE_FLAG_LINK_UP);
diff --git a/src/vnet/interface_format.c b/src/vnet/interface_format.c
index e34b6fb62c0..304fbb8a068 100644
--- a/src/vnet/interface_format.c
+++ b/src/vnet/interface_format.c
@@ -120,7 +120,7 @@ format_vnet_hw_interface_link_speed (u8 * s, va_list * args)
{
u32 link_speed = va_arg (*args, u32);
- if (link_speed == 0)
+ if (link_speed == 0 || link_speed == UINT32_MAX)
return format (s, "unknown");
if (link_speed >= 1000000)