patch 'net/mlx5: fix link status query' has been queued to stable release 24.11.9

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Nov 16 23:51:36 CET 2026


Hi,

FYI, your patch has been queued to stable release 24.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/18/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/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/b9e2a638557d65bdb687790f403c20b4e3e3c0fa

Thanks.

Luca Boccassi

---
>From b9e2a638557d65bdb687790f403c20b4e3e3c0fa 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 e00d17fc18..d39ed2840c 100644
--- a/.mailmap
+++ b/.mailmap
@@ -302,6 +302,7 @@ Congjie Zhou <zcjie0802 at qq.com>
 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>
 Cristian Sovaiala <cristian.sovaiala at nxp.com>
diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
index 49190f8101..5aad73e4a1 100644
--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
@@ -316,6 +316,40 @@ mlx5_find_master_dev(struct rte_eth_dev *dev)
 	return NULL;
 }
 
+/**
+ * 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.
  *
@@ -346,9 +380,11 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
 			dev->data->port_id, strerror(rte_errno));
 		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) {
 		.ifr_data = (void *)&edata,
@@ -427,9 +463,11 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 			dev->data->port_id, strerror(rte_errno));
 		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) {
 		.ifr_data = (void *)&gcmd,
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 202fa2e231..c87ceebd9c 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -2325,6 +2325,7 @@ int mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu);
 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);
 int mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev,
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-11-16 22:52:17.396858155 +0000
+++ 0022-net-mlx5-fix-link-status-query.patch	2026-11-16 22:52:16.444232318 +0000
@@ -1 +1 @@
-From 6897f54b60b99a300d67e04c95b710b9f0c11b94 Mon Sep 17 00:00:00 2001
+From b9e2a638557d65bdb687790f403c20b4e3e3c0fa 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 e00d17fc18..d39ed2840c 100644
@@ -33 +34 @@
-@@ -319,6 +319,7 @@ Congjie Zhou <zcjie0802 at qq.com>
+@@ -302,6 +302,7 @@ Congjie Zhou <zcjie0802 at qq.com>
@@ -42 +43 @@
-index f6394ebd19..f30fb6da5c 100644
+index 49190f8101..5aad73e4a1 100644
@@ -45 +46 @@
-@@ -317,6 +317,40 @@ mlx5_find_master_dev(struct rte_eth_dev *dev)
+@@ -316,6 +316,40 @@ mlx5_find_master_dev(struct rte_eth_dev *dev)
@@ -86 +87 @@
-@@ -347,9 +381,11 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
+@@ -346,9 +380,11 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
@@ -100 +101 @@
-@@ -428,9 +464,11 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
+@@ -427,9 +463,11 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
@@ -115 +116 @@
-index 7923125c5c..5ea49ca807 100644
+index 202fa2e231..c87ceebd9c 100644
@@ -118 +119 @@
-@@ -2391,6 +2391,7 @@ int mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu);
+@@ -2325,6 +2325,7 @@ int mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu);


More information about the stable mailing list