On 18.09.2026 15:32, Aleksandr Loktionov wrote:
> From: Konrad Knitter <[email protected]>
>
> Disabling autonegotiation was silently ignored when autoneg had not yet
> completed (ICE_AQ_AN_COMPLETED was not set), leaving the configuration
> unchanged with no error. This could prevent link from forming if the
> link partner requires non-autoneg mode.
>
> Extend the condition to also allow disabling autoneg when the link
> partner reports no AN ability (ICE_AQ_LP_AN_ABILITY clear). Gate the
> ICE_AQ_LP_AN_ABILITY check on the link being up so that stale or
> zeroed an_info when link is down does not produce a false positive.
> Introduce the helper ice_autoneg_disable_allowed() to make the check
> explicit.
>
> Fixes: f1a4a66d2310 ("ice: fix set pause param autoneg check")
> Signed-off-by: Konrad Knitter <[email protected]>
> Signed-off-by: Aleksandr Loktionov <[email protected]>
> Reviewed-by: Simon Horman <[email protected]>
> ---
> drivers/net/ethernet/intel/ice/ice_ethtool.c | 26 ++++++++++++++++++--
> 1 file changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c
> b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> index a257b7d..4ce198f 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> @@ -2501,6 +2501,28 @@ ice_ksettings_find_adv_link_speed(const struct
> ethtool_link_ksettings *ks)
> return adv_link_speed;
> }
>
> +/**
> + * ice_autoneg_disable_allowed - check if autoneg can be disabled
> + * @p: port info
> + *
> + * Check if autonegotiation can be disabled based on link state.
> + * ICE_AQ_LP_AN_ABILITY is only valid when the link is up; gate that
> + * check accordingly to avoid false positives from stale link data.
> + *
> + * Return: true if autoneg has completed, or if the link is up and the
> + * link partner does not advertise autonegotiation capability.
> + */
> +static bool ice_autoneg_disable_allowed(struct ice_port_info *p)
> +{
> + u8 an_info = p->phy.link_info.an_info;
> +
> + if (an_info & ICE_AQ_AN_COMPLETED)
> + return true;
> + /* ICE_AQ_LP_AN_ABILITY is only valid when link is up */
> + return (p->phy.link_info.link_info & ICE_AQ_LINK_UP) &&
> + !(an_info & ICE_AQ_LP_AN_ABILITY);
> +}
> +
> /**
> * ice_setup_autoneg
> * @p: port info
> @@ -2539,8 +2561,8 @@ ice_setup_autoneg(struct ice_port_info *p, struct
> ethtool_link_ksettings *ks,
> }
> }
> } else {
> - /* If autoneg is currently enabled */
> - if (p->phy.link_info.an_info & ICE_AQ_AN_COMPLETED) {
> + /* If autoneg completed or link partner does not support AN */
> + if (ice_autoneg_disable_allowed(p)) {
> /* If autoneg is supported 10GBASE_T is the only PHY
> * that can disable it, so otherwise return error
> */
Reviewed-by: Tomasz Lichwala <[email protected]>