Skip to contentSkip to conversation

net/ice: add explicit control of link auto-negotiation

PATCH Superseded Bruce Richardson 3 participants 6 messages Oct 30 – Nov 2 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ice: add explicit control of link auto-negotiation

When selecting a fixed speed of the link, whether or not autonegotiation (e.g. AN Clause 37, etc.), needs to be enabled depends on the peer link. While commit 3dc2933866d9 ("net/ice: disable link negotiation for fixed speed selection") would allow link setup when the remote side also has a fixed link without AN37 auto-negotiation, it causes the link to flap up and down when e.g. two ports are connected back to back and only one is set to a fixed speed.

Support both scenarios of auto-negotiation supported or unsupported on the remote end by adding an explicit driver option for disabling auto-negotiation when a fixed speed is selected. If no fixed speed setting, then new option does nothing.

Fixes 3dc2933866d9 ("net/ice: disable link negotiation for fixed speed selection")
---
 doc/guides/nics/ice.rst                | 10 ++++++++++
 doc/guides/rel_notes/release_26_11.rst |  2 ++
 drivers/net/intel/ice/ice_ethdev.c     | 12 +++++++++++-
 drivers/net/intel/ice/ice_ethdev.h     |  1 +
 4 files changed, 24 insertions(+), 1 deletion(-)
doc/guides/nics/ice.rst +10 -0
index ca3a94655b..af36341c9a 100644
@@ -107,6 +107,16 @@ Configuration
 Runtime Configuration
 ~~~~~~~~~~~~~~~~~~~~~
 
+``auto_neg_disable`` (default ``0``)
+   Control hardware link negotiation when a fixed speed is requested with ``RTE_ETH_LINK_SPEED_FIXED``.
+   By default, the firmware's negotiation settings are preserved,
+   allowing a fixed-speed link to use negotiation such as Clause 37 when required by its peer.
+   Set ``auto_neg_disable=1`` to disable Clause 28, Clause 37 and Clause 73 negotiation.
+   This option has no effect when automatic speed selection is requested.
+   For example::
+
+      -a 80:00.0,auto_neg_disable=1
+
 - ``Safe Mode Support`` (default ``0``)
 
   If driver failed to load OS package, by default driver's initialization failed.
doc/guides/rel_notes/release_26_11.rst +2 -0
index 9259954c0f..333d13c3f5 100644
@@ -159,6 +159,8 @@ New Features
 
 * **Updated Intel ice driver.**
 
+  * Added ``auto_neg_disable`` devarg to disable hardware link negotiation for fixed-speed links.
+    By default, fixed-speed links now preserve the firmware's negotiation settings.
   * Added chip temperature to the extended statistics.
   * Added Tx context descriptor support to the AVX2 and AVX512 vector Tx paths,
     enabling QinQ tag insertion and outer IPv4/UDP checksum offloads on those paths.
drivers/net/intel/ice/ice_ethdev.c +11 -1
index d6dfc07ad5..f9c719163d 100644
@@ -45,6 +45,7 @@
 #define ICE_RL_BURST_SIZE_ARG     "rl_burst_size"
 #define ICE_SOURCE_PRUNE_ARG      "source-prune"
 #define ICE_LINK_STATE_ON_CLOSE   "link_state_on_close"
+#define ICE_AUTO_NEG_DISABLE_ARG  "auto_neg_disable"
 
 #define ICE_CYCLECOUNTER_MASK  0xffffffffffffffffULL
 
@@ -64,6 +65,7 @@ static const char * const ice_valid_args[] = {
 	ICE_RL_BURST_SIZE_ARG,
 	ICE_SOURCE_PRUNE_ARG,
 	ICE_LINK_STATE_ON_CLOSE,
+	ICE_AUTO_NEG_DISABLE_ARG,
 	NULL
 };
 
@@ -2541,6 +2543,11 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)
 
 	ret = rte_kvargs_process(kvlist, ICE_LINK_STATE_ON_CLOSE,
 				 &parse_link_state_on_close, &ad->devargs.link_state_on_close);
+	if (ret)
+		goto bail;
+
+	ret = rte_kvargs_process(kvlist, ICE_AUTO_NEG_DISABLE_ARG,
+				 &parse_bool, &ad->devargs.auto_neg_disable);
 
 bail:
 	rte_kvargs_free(kvlist);
@@ -5225,6 +5232,7 @@ static int
 ice_apply_link_speed(struct rte_eth_dev *dev)
 {
 	uint16_t speed;
+	const struct ice_adapter *ad = ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct rte_eth_conf *conf = &dev->data->dev_conf;
 
@@ -5247,7 +5255,8 @@ ice_apply_link_speed(struct rte_eth_dev *dev)
 		return -EINVAL;
 	}
 
-	bool link_autoneg = (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) == 0;
+	const bool link_autoneg = !ad->devargs.auto_neg_disable ||
+			(conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) == 0;
 	return ice_phy_conf_link(hw, speed, true, link_autoneg);
 }
 
@@ -8197,6 +8206,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice,
 			      ICE_RL_BURST_SIZE_ARG "=<N>"
 			      ICE_SOURCE_PRUNE_ARG "=<0|1>"
 			      ICE_RX_LOW_LATENCY_ARG "=<0|1>"
+			      ICE_AUTO_NEG_DISABLE_ARG "=<0|1>"
 			      ICE_LINK_STATE_ON_CLOSE "=<down|up|initial>");
 
 RTE_LOG_REGISTER_SUFFIX(ice_logtype_init, init, NOTICE);
drivers/net/intel/ice/ice_ethdev.h +1 -0
index 945e765c2c..747c003bb3 100644
@@ -634,6 +634,7 @@ struct ice_pf {
 struct ice_devargs {
 	bool rx_low_latency;
 	bool safe_mode_support;
+	bool auto_neg_disable;
 	uint8_t proto_xtr_dflt;
 	bool default_mac_disable;
 	uint8_t proto_xtr[ICE_MAX_QUEUE_NUM];
Signature · 1 line
2.55.0
Acked-by on v1 1/1
#1 lore raw
Quoted 42 lines

Subject: [PATCH] net/ice: add explicit control of link auto-negotiation

When selecting a fixed speed of the link, whether or not autonegotiation (e.g. AN Clause 37, etc.), needs to be enabled depends on the peer link. While commit 3dc2933866d9 ("net/ice: disable link negotiation for fixed speed selection") would allow link setup when the remote side also has a fixed link without AN37 auto-negotiation, it causes the link to flap up and down when e.g. two ports are connected back to back and only one is set to a fixed speed.

Support both scenarios of auto-negotiation supported or unsupported on the remote end by adding an explicit driver option for disabling auto-negotiation when a fixed speed is selected. If no fixed speed setting, then new option does nothing.

Fixes 3dc2933866d9 ("net/ice: disable link negotiation for fixed speed

selection")

---
 doc/guides/nics/ice.rst                | 10 ++++++++++
 doc/guides/rel_notes/release_26_11.rst |  2 ++
 drivers/net/intel/ice/ice_ethdev.c     | 12 +++++++++++-
 drivers/net/intel/ice/ice_ethdev.h     |  1 +
 4 files changed, 24 insertions(+), 1 deletion(-)
doc/guides/nics/ice.rst +2 -0
index ca3a94655b..af36341c9a 100644
@@ -107,6 +107,16 @@ Configuration
 Runtime Configuration
 ~~~~~~~~~~~~~~~~~~~~~
 
+``auto_neg_disable`` (default ``0``)
+   Control hardware link negotiation when a fixed speed is requested with

``RTE_ETH_LINK_SPEED_FIXED``.

doc/guides/nics/ice.rst +2 -0
+   By default, the firmware's negotiation settings are preserved,
+   allowing a fixed-speed link to use negotiation such as Clause 37 when

required by its peer.
+ Set ``auto_neg_disable=1`` to disable Clause 28, Clause 37 and Clause 73
negotiation.

doc/guides/nics/ice.rst Configuration · line 119

Quoted 5 lines
doc/guides/nics/ice.rst +5 -0
+   This option has no effect when automatic speed selection is requested.
+   For example::
+
+      -a 80:00.0,auto_neg_disable=1
+

The approach looks good to me.
Something my AI review flagged was the setting of "link.link_autoneg" in ice_link_update() - your patch doesn't update that setting, and it's still just based off the dev_conf.link_speeds value, and doesn't take into account the value of the devarg (unlike ice_apply_link_speed() which accounts for both). Perhaps it's not necessary, just something to check.
Once that is addressed or ruled out:

#2 lore raw
Quoted 56 lines · Ciara
Quoted 42 lines

Subject: [PATCH] net/ice: add explicit control of link auto-negotiation

When selecting a fixed speed of the link, whether or not autonegotiation (e.g. AN Clause 37, etc.), needs to be enabled depends on the peer link. While commit 3dc2933866d9 ("net/ice: disable link negotiation for fixed speed selection") would allow link setup when the remote side also has a fixed link without AN37 auto-negotiation, it causes the link to flap up and down when e.g. two ports are connected back to back and only one is set to a fixed speed.

Support both scenarios of auto-negotiation supported or unsupported on the remote end by adding an explicit driver option for disabling auto-negotiation when a fixed speed is selected. If no fixed speed setting, then new option does nothing.

Fixes 3dc2933866d9 ("net/ice: disable link negotiation for fixed speed

selection")

---
 doc/guides/nics/ice.rst                | 10 ++++++++++
 doc/guides/rel_notes/release_26_11.rst |  2 ++
 drivers/net/intel/ice/ice_ethdev.c     | 12 +++++++++++-
 drivers/net/intel/ice/ice_ethdev.h     |  1 +
 4 files changed, 24 insertions(+), 1 deletion(-)
doc/guides/nics/ice.rst +2 -0
index ca3a94655b..af36341c9a 100644
@@ -107,6 +107,16 @@ Configuration
 Runtime Configuration
 ~~~~~~~~~~~~~~~~~~~~~
 
+``auto_neg_disable`` (default ``0``)
+   Control hardware link negotiation when a fixed speed is requested with

``RTE_ETH_LINK_SPEED_FIXED``.

doc/guides/nics/ice.rst +2 -0
+   By default, the firmware's negotiation settings are preserved,
+   allowing a fixed-speed link to use negotiation such as Clause 37 when

required by its peer.
+ Set ``auto_neg_disable=1`` to disable Clause 28, Clause 37 and Clause 73
negotiation.

doc/guides/nics/ice.rst Configuration · line 119

Quoted 5 lines
doc/guides/nics/ice.rst +5 -0
+   This option has no effect when automatic speed selection is requested.
+   For example::
+
+      -a 80:00.0,auto_neg_disable=1
+

The approach looks good to me.
Something my AI review flagged was the setting of "link.link_autoneg" in ice_link_update() - your patch doesn't update that setting, and it's still just based off the dev_conf.link_speeds value, and doesn't take into account the value of the devarg (unlike ice_apply_link_speed() which accounts for both). Perhaps it's not necessary, just something to check.
Once that is addressed or ruled out:

Quoted 1 line

Yes, good catch. That is fixed in v2, but I've dropped your ack as some of the logic has been moved to a subfunction to avoid copy-pasting too much.

#3 lore raw

why is auto negotiation disable a devarg rather than extending relevant part of ethdev? my opinion is every time a devarg like this gets added it means the ethdev abstraction is the real issue

Quoted 68 lines · On Mon, Nov 2, 2026, 16:37 Bruce Richardson <[email protected]> wrote:
Quoted 34 lines · Ciara
Quoted 34 lines

Subject: [PATCH] net/ice: add explicit control of link auto-negotiation

When selecting a fixed speed of the link, whether or not autonegotiation (e.g. AN Clause 37, etc.), needs to be enabled depends on the peer link. While commit 3dc2933866d9 ("net/ice: disable link negotiation for fixed speed selection") would allow link setup when the remote side also has a fixed link without AN37 auto-negotiation, it causes the link to flap up and down when e.g. two ports are connected back to back and only one is set to a fixed speed.

Support both scenarios of auto-negotiation supported or unsupported on the remote end by adding an explicit driver option for disabling auto-negotiation when a fixed speed is selected. If no fixed speed setting, then new option does nothing.

Fixes 3dc2933866d9 ("net/ice: disable link negotiation for fixed speed

selection")

---
 doc/guides/nics/ice.rst                | 10 ++++++++++
 doc/guides/rel_notes/release_26_11.rst |  2 ++
 drivers/net/intel/ice/ice_ethdev.c     | 12 +++++++++++-
 drivers/net/intel/ice/ice_ethdev.h     |  1 +
 4 files changed, 24 insertions(+), 1 deletion(-)
doc/guides/nics/ice.rst +0 -0
index ca3a94655b..af36341c9a 100644
@@ -107,6 +107,16 @@ Configuration
 Runtime Configuration
 ~~~~~~~~~~~~~~~~~~~~~
 
Quoted 2 lines

doc/guides/nics/ice.rst Configuration · line 111

Quoted 2 lines
doc/guides/nics/ice.rst +2 -0
+``auto_neg_disable`` (default ``0``)
+   Control hardware link negotiation when a fixed speed is requested

with

Quoted 3 lines

doc/guides/nics/ice.rst

Quoted 3 lines

``RTE_ETH_LINK_SPEED_FIXED``.

doc/guides/nics/ice.rst +2 -0
+   By default, the firmware's negotiation settings are preserved,
+   allowing a fixed-speed link to use negotiation such as Clause 37

when

Quoted 2 lines
Quoted 2 lines

required by its peer.
+ Set ``auto_neg_disable=1`` to disable Clause 28, Clause 37 and

Clause 73

Quoted 2 lines
Quoted 2 lines

negotiation.
+ This option has no effect when automatic speed selection is

requested.

Quoted 8 lines

doc/guides/nics/ice.rst Configuration · line 119

Quoted 4 lines
doc/guides/nics/ice.rst +4 -0
+   For example::
+
+      -a 80:00.0,auto_neg_disable=1
+

The approach looks good to me.
Something my AI review flagged was the setting of "link.link_autoneg" in ice_link_update() - your patch doesn't update that setting, and it's

still

Quoted 1 line

just based off the dev_conf.link_speeds value, and doesn't take into

account

Quoted 5 lines

the value of the devarg (unlike ice_apply_link_speed() which accounts for both). Perhaps it's not necessary, just something to check. Once that is addressed or ruled out:

Yes, good catch. That is fixed in v2, but I've dropped your ack as some of the logic has been moved to a subfunction to avoid copy-pasting too much.

#4 lore raw
Quoted 4 lines · Stephen Hemminger

why is auto negotiation disable a devarg rather than extending relevant part of ethdev? my opinion is every time a devarg like this gets added it means the ethdev abstraction is the real issue

Yes, it could well be.

Digging more into the ethdev API and drivers, it may just be that the limitation is simply one of documentation clarity and testpmd's use of the APIS.

Specifically, what does it mean to specify the RTE_ETH_LINK_SPEED_FIXED flag, and what does it mean to specify a particular speed without the flag being given. From what I see we have 3 options:

1. autonegotiate speed setting, e.g. choose highest supported of 10G, 2.5G or 1G for a given 10G NIC
2. allow only one particular speed but leave negotiation still enabled, e.g. set speed to 1G but leave AN37 enabled. This allows setting to 1G when other side has auto-negotiation enabled
3. set to a single speed and disable negotiation, e.g. set 1G fixed with AN37 disabled. This would be for compatibility with links not supporting negotiation, or where both sides explicitly set the speed.

Setting #1 is default and well understood. However, the difference between settings #2 and #3 doesn't seem to be called out anywhere explicitly in our docs for ethdev. I would imagine that #2 is where we specify a given link speed (or maybe speeds), but without RTE_LINK_SPEED_FIXED set in the bitmap. That would mean that #3 would be a single speed setting passed and RTE_LINK_SPEED_FIXED set.

Unfortunately, though, testpmd always sets the FIXED flag when we specify a link speed, meaning that scenarios #2 and #3 are indistinguishable. Asking AI to do a quick scan of the drivers indicates that some will leave negotiation on with a fixed speed, others keep it off. Some ignore the fixed flag and never check for it, and some just don't support disabling autonegotiation completely.

Would a good solution be to extend the testpmd command to allow the FIXED flag setting to be configurable rather than assumed as part of the speed setting? That would at least clarify the behaviour and allow testing the various options

/Bruce

#5 lore raw

PATCH v2 1/1 net/ice: add explicit control of link auto-negotiation

In reply to Bruce Richardson

When selecting a fixed speed of the link, whether or not autonegotiation (e.g. AN Clause 37, etc.), needs to be enabled depends on the peer link. While commit 3dc2933866d9 ("net/ice: disable link negotiation for fixed speed selection") would allow link setup when the remote side also has a fixed link without AN37 auto-negotiation, it causes the link to flap up and down when e.g. two ports are connected back to back and only one is set to a fixed speed.

Support both scenarios of auto-negotiation supported or unsupported on the remote end by adding an explicit driver option for disabling auto-negotiation when a fixed speed is selected. If no fixed speed setting, then new option does nothing.

Fixes 3dc2933866d9 ("net/ice: disable link negotiation for fixed speed selection")
---
 doc/guides/nics/ice.rst                | 10 ++++++++++
 doc/guides/rel_notes/release_26_11.rst |  2 ++
 drivers/net/intel/ice/ice_ethdev.c     | 23 +++++++++++++++++++----
 drivers/net/intel/ice/ice_ethdev.h     |  1 +
 4 files changed, 32 insertions(+), 4 deletions(-)
doc/guides/nics/ice.rst +10 -0
index faebfdcb63..15388f0185 100644
@@ -107,6 +107,16 @@ Configuration
 Runtime Configuration
 ~~~~~~~~~~~~~~~~~~~~~
 
+``auto_neg_disable`` (default ``0``)
+   Control hardware link negotiation when a fixed speed is requested with ``RTE_ETH_LINK_SPEED_FIXED``.
+   By default, the firmware's negotiation settings are preserved,
+   allowing a fixed-speed link to use negotiation such as Clause 37 when required by its peer.
+   Set ``auto_neg_disable=1`` to disable Clause 28, Clause 37 and Clause 73 negotiation.
+   This option has no effect when automatic speed selection is requested.
+   For example::
+
+      -a 80:00.0,auto_neg_disable=1
+
 - ``Safe Mode Support`` (default ``0``)
 
   If driver failed to load OS package, by default driver's initialization failed.
doc/guides/rel_notes/release_26_11.rst +2 -0
index 9e120ec221..96bd0ed7ca 100644
@@ -175,6 +175,8 @@ New Features
 
 * **Updated Intel ice driver.**
 
+  * Added ``auto_neg_disable`` devarg to disable hardware link negotiation for fixed-speed links.
+    By default, fixed-speed links now preserve the firmware's negotiation settings.
   * Added chip temperature to the extended statistics.
   * Added Tx context descriptor support to the AVX2 and AVX512 vector Tx paths,
     enabling QinQ tag insertion and outer IPv4/UDP checksum offloads on those paths.
drivers/net/intel/ice/ice_ethdev.c +19 -4
index d2ba64efb6..b18b4bbb05 100644
@@ -45,6 +45,7 @@
 #define ICE_RL_BURST_SIZE_ARG     "rl_burst_size"
 #define ICE_SOURCE_PRUNE_ARG      "source-prune"
 #define ICE_LINK_STATE_ON_CLOSE   "link_state_on_close"
+#define ICE_AUTO_NEG_DISABLE_ARG  "auto_neg_disable"
 
 #define ICE_CYCLECOUNTER_MASK  0xffffffffffffffffULL
 
@@ -64,6 +65,7 @@ static const char * const ice_valid_args[] = {
 	ICE_RL_BURST_SIZE_ARG,
 	ICE_SOURCE_PRUNE_ARG,
 	ICE_LINK_STATE_ON_CLOSE,
+	ICE_AUTO_NEG_DISABLE_ARG,
 	NULL
 };
 
@@ -2542,6 +2544,11 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)
 
 	ret = rte_kvargs_process(kvlist, ICE_LINK_STATE_ON_CLOSE,
 				 &parse_link_state_on_close, &ad->devargs.link_state_on_close);
+	if (ret)
+		goto bail;
+
+	ret = rte_kvargs_process(kvlist, ICE_AUTO_NEG_DISABLE_ARG,
+				 &parse_bool, &ad->devargs.auto_neg_disable);
 
 bail:
 	rte_kvargs_free(kvlist);
@@ -5092,6 +5099,15 @@ ice_atomic_write_link_status(struct rte_eth_dev *dev,
 	return 0;
 }
 
+static bool
+ice_link_autoneg_enabled(const struct rte_eth_dev *dev)
+{
+	const struct ice_adapter *ad = ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+
+	return !ad->devargs.auto_neg_disable ||
+			(dev->data->dev_conf.link_speeds & RTE_ETH_LINK_SPEED_FIXED) == 0;
+}
+
 static int
 ice_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 {
@@ -5180,8 +5196,7 @@ ice_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 		break;
 	}
 
-	link.link_autoneg = !(dev->data->dev_conf.link_speeds &
-			      RTE_ETH_LINK_SPEED_FIXED);
+	link.link_autoneg = ice_link_autoneg_enabled(dev);
 
 out:
 	ice_atomic_write_link_status(dev, &link);
@@ -5248,8 +5263,7 @@ ice_apply_link_speed(struct rte_eth_dev *dev)
 		return -EINVAL;
 	}
 
-	bool link_autoneg = (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) == 0;
-	return ice_phy_conf_link(hw, speed, true, link_autoneg);
+	return ice_phy_conf_link(hw, speed, true, ice_link_autoneg_enabled(dev));
 }
 
 static int
@@ -8198,6 +8212,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice,
 			      ICE_RL_BURST_SIZE_ARG "=<N>"
 			      ICE_SOURCE_PRUNE_ARG "=<0|1>"
 			      ICE_RX_LOW_LATENCY_ARG "=<0|1>"
+			      ICE_AUTO_NEG_DISABLE_ARG "=<0|1>"
 			      ICE_LINK_STATE_ON_CLOSE "=<down|up|initial>");
 
 RTE_LOG_REGISTER_SUFFIX(ice_logtype_init, init, NOTICE);
drivers/net/intel/ice/ice_ethdev.h +1 -0
index 945e765c2c..747c003bb3 100644
@@ -634,6 +634,7 @@ struct ice_pf {
 struct ice_devargs {
 	bool rx_low_latency;
 	bool safe_mode_support;
+	bool auto_neg_disable;
 	uint8_t proto_xtr_dflt;
 	bool default_mac_disable;
 	uint8_t proto_xtr[ICE_MAX_QUEUE_NUM];
Signature · 1 line
2.55.0