patch 'net/mlx5: fix link status query' has been queued to stable release 25.11.5
Kevin Traynor
ktraynor at redhat.com
Thu Dec 3 14:05:09 CET 2026
Hi,
FYI, your patch has been queued to stable release 25.11.5
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/08/26. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/ced0ae5e9b59900bd1006a5af2a8e313a9108da7
Thanks.
Kevin
---
>From ced0ae5e9b59900bd1006a5af2a8e313a9108da7 Mon Sep 17 00:00:00 2001
From: Dariusz Sosnowski <dsosnowski at nvidia.com>
Date: Fri, 30 Oct 2026 18:28:42 +0100
Subject: [PATCH] net/mlx5: fix link status query
[ upstream commit 6897f54b60b99a300d67e04c95b710b9f0c11b94 ]
Querying link parameters in mlx5 driver is implemented using
either ETHTOOL_GLINKSETTINGS or ETHTOOL_GSET ioctl commands.
Link status reported by the above can be stale, due to a delay
introduced by Linux kernel's linkwatch mechanism.
This patch fixes that by reading link carrier status through
ETHTOOL_GLINK command. This ethtool command,
implemented by mlx5 since kernel 4.14, will always get
the current link status. It also flushes the pending link watch
events, so following ETHTOOL_GLINKSETTINGS/ETHTOOL_GSET will
return actual link carrier status.
Fixes: 17f95513adca ("net/mlx5: fix link status change detection")
Signed-off-by: Cosmin Ratiu <cratiu at nvidia.com>
Signed-off-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
---
.mailmap | 1 +
drivers/net/mlx5/linux/mlx5_ethdev_os.c | 46 ++++++++++++++++++++++---
drivers/net/mlx5/mlx5.h | 1 +
3 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/.mailmap b/.mailmap
index c5838825c9..eced8eafff 100644
--- a/.mailmap
+++ b/.mailmap
@@ -314,4 +314,5 @@ Congwen Zhang <zhang.congwen at zte.com.cn>
Conor Fogarty <conor.fogarty at intel.com>
Conor Walsh <conor.walsh at intel.com>
+Cosmin Ratiu <cratiu at nvidia.com>
Cristian Bidea <cristian.bidea at keysight.com>
Cristian Dumitrescu <cristian.dumitrescu at intel.com>
diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
index f6394ebd19..f30fb6da5c 100644
--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
@@ -318,4 +318,38 @@ mlx5_find_master_dev(struct rte_eth_dev *dev)
}
+/**
+ * Retrieve the carrier state of a device.
+ *
+ * The IFF_RUNNING flag reported by SIOCGIFFLAGS reflects the RFC 2863
+ * operational state, which the kernel only refreshes from its link watch
+ * work queue and which may therefore lag the actual carrier by up to a
+ * second. ETHTOOL_GLINK reports the carrier directly, and additionally
+ * flushes any link watch event still pending for the device.
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ *
+ * @return
+ * 1 if the carrier is up, 0 otherwise.
+ * Negative errno value is returned on error.
+ */
+int
+mlx5_link_carrier_get(struct rte_eth_dev *dev)
+{
+ struct ethtool_value ecmd = {
+ .cmd = ETHTOOL_GLINK,
+ };
+ struct ifreq ifr = {
+ .ifr_data = (void *)&ecmd,
+ };
+ int ret;
+
+ ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
+ if (ret != 0)
+ return ret;
+
+ return !!ecmd.data;
+}
+
/**
* DPDK callback to retrieve physical link information.
@@ -348,7 +382,9 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
return ret;
}
+ ret = mlx5_link_carrier_get(dev);
+ if (ret < 0)
+ return ret;
dev_link = (struct rte_eth_link) {
- .link_status = ((ifr.ifr_flags & IFF_UP) &&
- (ifr.ifr_flags & IFF_RUNNING)),
+ .link_status = ((ifr.ifr_flags & IFF_UP) && ret),
};
ifr = (struct ifreq) {
@@ -429,7 +465,9 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
return ret;
}
+ ret = mlx5_link_carrier_get(dev);
+ if (ret < 0)
+ return ret;
dev_link = (struct rte_eth_link) {
- .link_status = ((ifr.ifr_flags & IFF_UP) &&
- (ifr.ifr_flags & IFF_RUNNING)),
+ .link_status = ((ifr.ifr_flags & IFF_UP) && ret),
};
ifr = (struct ifreq) {
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index b275a0b9a8..c0fdb3e3a8 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -2376,4 +2376,5 @@ int mlx5_set_mtu(struct rte_eth_dev *dev, uint16_t mtu);
int mlx5_read_clock(struct rte_eth_dev *dev, uint64_t *clock);
int mlx5_link_update(struct rte_eth_dev *dev, int wait_to_complete);
+int mlx5_link_carrier_get(struct rte_eth_dev *dev);
int mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev,
struct rte_eth_fc_conf *fc_conf);
--
2.56.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-12-03 12:52:50.024532304 +0000
+++ 0383-net-mlx5-fix-link-status-query.patch 2026-12-03 12:52:39.291938783 +0000
@@ -1 +1 @@
-From 6897f54b60b99a300d67e04c95b710b9f0c11b94 Mon Sep 17 00:00:00 2001
+From ced0ae5e9b59900bd1006a5af2a8e313a9108da7 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 6897f54b60b99a300d67e04c95b710b9f0c11b94 ]
+
@@ -19 +20,0 @@
-Cc: stable at dpdk.org
@@ -30 +31 @@
-index a4af517007..9db000bb6b 100644
+index c5838825c9..eced8eafff 100644
@@ -33 +34 @@
-@@ -320,4 +320,5 @@ Congwen Zhang <zhang.congwen at zte.com.cn>
+@@ -314,4 +314,5 @@ Congwen Zhang <zhang.congwen at zte.com.cn>
@@ -107 +108 @@
-index 7923125c5c..5ea49ca807 100644
+index b275a0b9a8..c0fdb3e3a8 100644
@@ -110 +111 @@
-@@ -2392,4 +2392,5 @@ int mlx5_set_mtu(struct rte_eth_dev *dev, uint16_t mtu);
+@@ -2376,4 +2376,5 @@ int mlx5_set_mtu(struct rte_eth_dev *dev, uint16_t mtu);
More information about the stable
mailing list