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.
Signed-off-by: Bruce Richardson <[email protected]> --- drivers/net/intel/ice/ice_ethdev.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/net/intel/ice/ice_ethdev.c b/drivers/net/intel/ice/ice_ethdev.c index dc955d130b..592e7c4c21 100644 --- a/drivers/net/intel/ice/ice_ethdev.c +++ b/drivers/net/intel/ice/ice_ethdev.c @@ -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 -- 2.53.0

