summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-11-08 15:30:16 +0100
committerFlorin Coras <florin.coras@gmail.com>2018-11-08 17:08:11 +0000
commit5100aa9cb9e7acff35fa3bfde8aa95b5ace60344 (patch)
treea42bb046ea2933042b2722e7b4fe229e3070cac5 /src/plugins
parenta71844f27a0be91fcda25b19604d16122ccc3e73 (diff)
vnet: store hw interface speed in kbps instead of using flags
Change-Id: Idd4471a3adf7023e48e85717f00c786b1dde0cca Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/avf/device.c12
-rw-r--r--src/plugins/dpdk/device/format.c4
-rw-r--r--src/plugins/dpdk/device/init.c52
3 files changed, 13 insertions, 55 deletions
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index 713953fe4c6..6bf1fe05f05 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -899,6 +899,7 @@ avf_process_one_device (vlib_main_t * vm, avf_device_t * ad, int is_irq)
int link_up = e->event_data.link_event.link_status;
virtchnl_link_speed_t speed = e->event_data.link_event.link_speed;
u32 flags = 0;
+ u32 kbps = 0;
if (link_up && (ad->flags & AVF_DEVICE_F_LINK_UP) == 0)
{
@@ -906,16 +907,17 @@ 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);
if (speed == VIRTCHNL_LINK_SPEED_40GB)
- flags |= VNET_HW_INTERFACE_FLAG_SPEED_40G;
+ kbps = 40000000;
else if (speed == VIRTCHNL_LINK_SPEED_25GB)
- flags |= VNET_HW_INTERFACE_FLAG_SPEED_25G;
+ kbps = 25000000;
else if (speed == VIRTCHNL_LINK_SPEED_10GB)
- flags |= VNET_HW_INTERFACE_FLAG_SPEED_10G;
+ kbps = 10000000;
else if (speed == VIRTCHNL_LINK_SPEED_1GB)
- flags |= VNET_HW_INTERFACE_FLAG_SPEED_1G;
+ kbps = 1000000;
else if (speed == VIRTCHNL_LINK_SPEED_100MB)
- flags |= VNET_HW_INTERFACE_FLAG_SPEED_100M;
+ kbps = 100000;
vnet_hw_interface_set_flags (vnm, ad->hw_if_index, flags);
+ vnet_hw_interface_set_link_speed (vnm, ad->hw_if_index, kbps);
ad->link_speed = speed;
}
else if (!link_up && (ad->flags & AVF_DEVICE_F_LINK_UP) != 0)
diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c
index ef15055094a..fdc2850e7e0 100644
--- a/src/plugins/dpdk/device/format.c
+++ b/src/plugins/dpdk/device/format.c
@@ -398,8 +398,8 @@ format_dpdk_link_status (u8 * s, va_list * args)
s = format (s, "%s duplex ", (l->link_duplex == ETH_LINK_FULL_DUPLEX) ?
"full" : "half");
- s = format (s, "speed %u mtu %d %s\n", l->link_speed,
- hi->max_packet_bytes, promisc ? " promisc" : "");
+ s = format (s, "mtu %d %s\n", hi->max_packet_bytes, promisc ?
+ " promisc" : "");
}
else
s = format (s, "\n");
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index c130dbce5df..fcdc29bfdc4 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -1584,54 +1584,10 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now)
break;
}
}
- if (hw_flags_chg || (xd->link.link_speed != prev_link.link_speed))
- {
- hw_flags_chg = 1;
- switch (xd->link.link_speed)
- {
- case ETH_SPEED_NUM_10M:
- hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_10M;
- break;
- case ETH_SPEED_NUM_100M:
- hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_100M;
- break;
- case ETH_SPEED_NUM_1G:
- hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_1G;
- break;
- case ETH_SPEED_NUM_2_5G:
- hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_2_5G;
- break;
- case ETH_SPEED_NUM_5G:
- hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_5G;
- break;
- case ETH_SPEED_NUM_10G:
- hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_10G;
- break;
- case ETH_SPEED_NUM_20G:
- hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_20G;
- break;
- case ETH_SPEED_NUM_25G:
- hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_25G;
- break;
- case ETH_SPEED_NUM_40G:
- hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_40G;
- break;
- case ETH_SPEED_NUM_50G:
- hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_50G;
- break;
- case ETH_SPEED_NUM_56G:
- hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_56G;
- break;
- case ETH_SPEED_NUM_100G:
- hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_100G;
- break;
- case 0:
- break;
- default:
- dpdk_log_warn ("unknown link speed %d", xd->link.link_speed);
- break;
- }
- }
+ 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);
+
if (hw_flags_chg)
{
if (LINK_STATE_ELOGS)