On 15.09.2026 14:55, Aleksandr Loktionov wrote:
quoted hunk ↗ jump to hunk
+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);
When link is down and AN hasn't completed, this still silently no-ops the disable request (unchanged from before). Worth confirming that's the intended UX, or returning -EINVAL here too.
quoted hunk ↗ jump to hunk
+}
+
/**
* 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
*/
Thanks,
Tomasz