Skip to contentSkip to conversation

net/ice: updates for link speed setting

PATCH Applied Bruce Richardson 2 participants 6 messages Sep 10 – Sep 25 Network drivers

lore
Share & tools
lore
#0 lore raw

cover net/ice: updates for link speed setting

A pair of patches to improve the setting of link speeds for ice

Bruce Richardson (2):
net/ice: check for missing fixed speed setting net/ice: disable link negotiation for fixed speed selection

 drivers/net/intel/ice/ice_ethdev.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

--
2.53.0

#1 lore raw

PATCH 1/2 net/ice: check for missing fixed speed setting

When the user requests a fixed speed for a NIC link, the speeds bitmask passed must have a speed value actually set in it, as well as the "FIXED" flag. Catch this case and log an error message.

Fixes 36afbc269081 ("net/ice: support link speed change")
---
 drivers/net/intel/ice/ice_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/intel/ice/ice_ethdev.c +4 -0
index 76b8ff0a72..dc955d130b 100644
@@ -4936,6 +4936,10 @@ ice_apply_link_speed(struct rte_eth_dev *dev)
 					RTE_ETH_LINK_SPEED_100M;
 	}
 	speed = ice_parse_link_speeds(conf->link_speeds);
+	if (speed == ICE_AQ_LINK_SPEED_UNKNOWN) {
+		PMD_DRV_LOG(ERR, "No valid link speed setting specified");
+		return -EINVAL;
+	}
 
 	return ice_phy_conf_link(hw, speed, true);
 }
Signature · 1 line
2.53.0
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] net/ice: check for missing fixed speed setting

Quoted 17 lines · Bruce Richardson

When the user requests a fixed speed for a NIC link, the speeds bitmask passed must have a speed value actually set in it, as well as the "FIXED" flag. Catch this case and log an error message.

Fixes 36afbc269081 ("net/ice: support link speed change")
---
  drivers/net/intel/ice/ice_ethdev.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/net/intel/ice/ice_ethdev.c +0 -0
index 76b8ff0a72..dc955d130b 100644

drivers/net/intel/ice/ice_ethdev.c ice_apply_link_speed(struct rte_eth_dev *dev) · line 4945

Quoted 10 lines
drivers/net/intel/ice/ice_ethdev.c +4 -0
@@ -4936,6 +4936,10 @@ ice_apply_link_speed(struct rte_eth_dev *dev)
  					RTE_ETH_LINK_SPEED_100M;
  	}
  	speed = ice_parse_link_speeds(conf->link_speeds);
+	if (speed == ICE_AQ_LINK_SPEED_UNKNOWN) {
+		PMD_DRV_LOG(ERR, "No valid link speed setting specified");
+		return -EINVAL;
+	}
 
  	return ice_phy_conf_link(hw, speed, true);
  }
Signature · 2 lines
Thanks,
Anatoly
#3 lore raw

PATCH 2/2 net/ice: disable link negotiation for fixed speed selection

In reply to Bruce Richardson

When the user has requested fixed link parameters, e.g. speed, duplex, etc., disable the HW link negotiation, i.e. AN Clause 28, Clause 37 etc.

---
 drivers/net/intel/ice/ice_ethdev.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/net/intel/ice/ice_ethdev.c +11 -4
index dc955d130b..592e7c4c21 100644
@@ -124,7 +124,8 @@ static int ice_dev_info_get(struct rte_eth_dev *dev,
 			    struct rte_eth_dev_info *dev_info);
 static int ice_phy_conf_link(struct ice_hw *hw,
 					u16 force_speed,
-					bool link_up);
+					bool link_up,
+					bool link_autoneg);
 static int ice_link_update(struct rte_eth_dev *dev,
 			   int wait_to_complete);
 static int ice_dev_set_link_up(struct rte_eth_dev *dev);
@@ -4941,13 +4942,15 @@ ice_apply_link_speed(struct rte_eth_dev *dev)
 		return -EINVAL;
 	}
 
-	return ice_phy_conf_link(hw, speed, true);
+	bool link_autoneg = (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) == 0;
+	return ice_phy_conf_link(hw, speed, true, link_autoneg);
 }
 
 static int
 ice_phy_conf_link(struct ice_hw *hw,
 		   u16 link_speeds_bitmap,
-		   bool link_up)
+		   bool link_up,
+		   bool link_autoneg)
 {
 	struct ice_aqc_set_phy_cfg_data cfg = { 0 };
 	struct ice_port_info *pi = hw->port_info;
@@ -4991,6 +4994,10 @@ ice_phy_conf_link(struct ice_hw *hw,
 
 	cfg.caps = phy_caps->caps | ICE_AQ_PHY_ENA_AUTO_LINK_UPDT;
 	cfg.low_power_ctrl_an = phy_caps->low_power_ctrl_an;
+	if (!link_autoneg)
+		cfg.low_power_ctrl_an &= ~(ICE_AQC_PHY_AN_EN_CLAUSE28 |
+				ICE_AQC_PHY_AN_EN_CLAUSE73 |
+				ICE_AQC_PHY_AN_EN_CLAUSE37);
 	cfg.eee_cap = phy_caps->eee_cap;
 	cfg.eeer_value = phy_caps->eeer_value;
 	cfg.link_fec_opt = phy_caps->link_fec_options;
@@ -5018,7 +5025,7 @@ ice_dev_set_link_down(struct rte_eth_dev *dev)
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint8_t speed = ICE_LINK_SPEED_UNKNOWN;
 
-	return ice_phy_conf_link(hw, speed, false);
+	return ice_phy_conf_link(hw, speed, false, true);
 }
 
 static int
Signature · 1 line
2.53.0
author Applied
#5 lore raw
In reply to Bruce Richardson
Quoted 9 lines · Bruce Richardson

A pair of patches to improve the setting of link speeds for ice

Bruce Richardson (2):
net/ice: check for missing fixed speed setting net/ice: disable link negotiation for fixed speed selection

 drivers/net/intel/ice/ice_ethdev.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

Applied to dpdk-next-net-intel.

/Bruce