[Intel-wired-lan] [PATCH iwl-next 2/10] ice: allow setting advertised speed and duplex for all media types

Aleksandr Loktionov
2026-04-10T07:49:31Z

From: Paul Greenwalt <paul.greenwalt@intel.com>

When AUI media type support was added, the set of media types that
support configuring speed and duplex via autonegotiation was not
updated. This results in AUI media types being rejected when the user
sets speed and duplex via ethtool.

Fix this by only refusing media type NONE or UNKNOWN (in strict mode);
all other media types should support setting speed and duplex.

Signed-off-by: Paul Greenwalt <paul.greenwalt@intel.com>
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
---
drivers/net/ethernet/intel/ice/ice_ethtool.c | 17 +++++++++++------
drivers/net/ethernet/intel/ice/ice_type.h | 2 ++
2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index b5a63b1..96ce6b3 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -2217,6 +2217,7 @@ ice_set_link_ksettings(struct net_device *netdev,
u8 autoneg_changed = 0;
u64 phy_type_high = 0;
u64 phy_type_low = 0;
+ bool lenient_mode;
bool linkup;
int err;

@@ -2225,10 +2226,14 @@ ice_set_link_ksettings(struct net_device *netdev,
if (!pi)
return -EIO;

- if (pi->phy.media_type != ICE_MEDIA_BASET &&
- pi->phy.media_type != ICE_MEDIA_FIBER &&
- pi->phy.media_type != ICE_MEDIA_BACKPLANE &&
- pi->phy.media_type != ICE_MEDIA_DA &&
+ lenient_mode = test_bit(ICE_FLAG_LINK_LENIENT_MODE_ENA, pf->flags);
+
+ /* Setting the speed and duplex advertised by autonegotiation is
+ * supported for all media types, so only return unsupported for media
+ * type none or unknown in strict mode.
+ */
+ if ((pi->phy.media_type == ICE_MEDIA_NONE ||
+ (pi->phy.media_type == ICE_MEDIA_UNKNOWN && !lenient_mode)) &&
pi->phy.link_info.link_info & ICE_AQ_LINK_UP)
return -EOPNOTSUPP;

@@ -2258,7 +2263,7 @@ ice_set_link_ksettings(struct net_device *netdev,
if (!bitmap_subset(copy_ks.link_modes.advertising,
safe_ks.link_modes.supported,
__ETHTOOL_LINK_MODE_MASK_NBITS)) {
- if (!test_bit(ICE_FLAG_LINK_LENIENT_MODE_ENA, pf->flags))
+ if (!lenient_mode)
netdev_info(netdev, "The selected speed is not supported by the current media. Please select a link speed that is supported by the current media.\n");
err = -EOPNOTSUPP;
goto done;
@@ -2359,7 +2364,7 @@ ice_set_link_ksettings(struct net_device *netdev,
* intersect the requested advertised speed with NVM media type
* PHY types.
*/
- if (test_bit(ICE_FLAG_LINK_LENIENT_MODE_ENA, pf->flags)) {
+ if (lenient_mode) {
config.phy_type_high = cpu_to_le64(phy_type_high) &
pf->nvm_phy_type_hi;
config.phy_type_low = cpu_to_le64(phy_type_low) &

diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h
--- a/drivers/net/ethernet/intel/ice/ice_type.h
+++ b/drivers/net/ethernet/intel/ice/ice_type.h
@@ -151,6 +151,8 @@ enum ice_media_type {
ICE_MEDIA_UNKNOWN = 0,
ICE_MEDIA_FIBER,
ICE_MEDIA_BASET,
ICE_MEDIA_BACKPLANE,
ICE_MEDIA_DA,
+ ICE_MEDIA_AUI,
+ ICE_MEDIA_NONE,
};
--
2.52.0