aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Skorichenko <askorichenko@netgate.com>2022-05-20 11:13:19 +0000
committerMatthew Smith <mgsmith@netgate.com>2022-05-23 16:33:51 +0000
commitd8366d085fa375968c8ddafb4eea85b1b167b34c (patch)
treeb5e2665ae3b14f2498592bf5b2a19b3daa26b84a
parent8abbdf509bbd20c5325c8637f78f502aeeb77af3 (diff)
dpdk: fix update link state
Type: fix Correct vnet_hw_interface_t flags update on link state changes. Currently incomplete set of flags is applied on each change, only flags related to the most recent change are being set correct. E.g. setting the link up would erase the duplex part of the flags. Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com> Change-Id: I5b95e1c0eaea0c283b108dbf7f809682ec9064eb
-rw-r--r--src/plugins/dpdk/device/init.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 6b1479b9c75..80a075f2bb1 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -1373,9 +1373,20 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now)
ed->new_link_state = (u8) xd->link.link_status;
}
- if ((xd->link.link_duplex != prev_link.link_duplex))
+ hw_flags_chg = ((xd->link.link_duplex != prev_link.link_duplex) ||
+ (xd->link.link_status != prev_link.link_status));
+
+ if (xd->link.link_speed != prev_link.link_speed)
+ vnet_hw_interface_set_link_speed (vnm, xd->hw_if_index,
+ (xd->link.link_speed == UINT32_MAX) ?
+ UINT32_MAX :
+ xd->link.link_speed * 1000);
+
+ if (hw_flags_chg)
{
- hw_flags_chg = 1;
+ if (xd->link.link_status)
+ hw_flags |= VNET_HW_INTERFACE_FLAG_LINK_UP;
+
switch (xd->link.link_duplex)
{
case RTE_ETH_LINK_HALF_DUPLEX:
@@ -1387,23 +1398,7 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now)
default:
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 == UINT32_MAX) ?
- UINT32_MAX :
- xd->link.link_speed * 1000);
-
- if (xd->link.link_status != prev_link.link_status)
- {
- hw_flags_chg = 1;
- if (xd->link.link_status)
- hw_flags |= VNET_HW_INTERFACE_FLAG_LINK_UP;
- }
-
- if (hw_flags_chg)
- {
if (LINK_STATE_ELOGS)
{
ELOG_TYPE_DECLARE (e) =