From: Simon Horman <horms@kernel.org>
To: aleksandr.loktionov@intel.com
Cc: 'Simon Horman' <horms@kernel.org>,
intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com,
netdev@vger.kernel.org, jacob.e.keller@intel.com
Subject: Re: [PATCH iwl-next 2/10] ice: allow setting advertised speed and duplex for all media types
Date: Tue, 14 Apr 2026 10:04:29 +0100 [thread overview]
Message-ID: <20260414090429.740296-1-horms@kernel.org> (raw)
In-Reply-To: <20260410074921.1254213-3-aleksandr.loktionov@intel.com>
From: 'Simon Horman' <horms@kernel.org>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://sashiko.dev
---
ice: allow setting advertised speed and duplex for all media types
This commit allows setting advertised speed and duplex for all media types by
only refusing media types NONE or UNKNOWN in strict mode. It adds AUI and NONE
to the ice_media_type enum.
> diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> index e6a20af6f63de..62d214c5582ad 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> @@ -2634,10 +2635,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;
Will AUI media types still be rejected here in strict mode?
The patch adds ICE_MEDIA_AUI and ICE_MEDIA_NONE to enum ice_media_type, but
doesn't appear to update ice_get_media_type() to actually return these new
values.
If AUI media continues to fall through to ICE_MEDIA_UNKNOWN, wouldn't the new
logic still reject it when lenient mode is disabled, defeating the intent of
the patch?
[ ... ]
> @@ -2667,7 +2672,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;
This isn't a bug introduced by this patch, but does taking this error path
accidentally release another thread's lock?
The ICE_CFG_BUSY flag is used as an ad-hoc lock later in this function:
while (test_and_set_bit(ICE_CFG_BUSY, pf->state)) {
timeout--;
if (!timeout) {
err = -EBUSY;
goto done;
}
usleep_range(TEST_SET_BITS_SLEEP_MIN, TEST_SET_BITS_SLEEP_MAX);
}
If the bitmap_subset() check fails, or if the while loop times out, it jumps to
the done label:
done:
kfree(phy_caps);
clear_bit(ICE_CFG_BUSY, pf->state);
Since the bitmap_subset() check happens before test_and_set_bit() has acquired
the lock, wouldn't this unconditionally clear the ICE_CFG_BUSY flag even if
another thread currently holds it? Could this synchronization be replaced with a
standard lock to avoid these issues?
next prev parent reply other threads:[~2026-04-14 9:04 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-10 7:49 [PATCH iwl-next 0/10] ice: misc cleanups and improvements Aleksandr Loktionov
2026-04-10 7:49 ` [PATCH iwl-next 1/10] ice: translate FW to SW for max num TCs encoding Aleksandr Loktionov
2026-04-14 8:44 ` Simon Horman
2026-04-10 7:49 ` [PATCH iwl-next 2/10] ice: allow setting advertised speed and duplex for all media types Aleksandr Loktionov
2026-04-14 9:04 ` Simon Horman [this message]
2026-04-10 7:49 ` [PATCH iwl-next 3/10] ice: add PORT_AUI and PORT_NONE ethtool port type reporting Aleksandr Loktionov
2026-04-10 7:49 ` [PATCH iwl-next 4/10] ice: reorder ice_flash_info fields to eliminate padding Aleksandr Loktionov
2026-04-14 9:16 ` Simon Horman
2026-04-10 7:49 ` [PATCH iwl-next 5/10] ice: improve Add/Update VSI error messages in ice_vsi_init() Aleksandr Loktionov
2026-04-14 9:30 ` Simon Horman
2026-04-10 7:49 ` [PATCH iwl-next 6/10] ice: increase OICR interrupt moderation rate to 20K interrupts/sec Aleksandr Loktionov
2026-04-14 9:33 ` Simon Horman
2026-04-10 7:49 ` [PATCH iwl-next 7/10] ice: emit user-visible info message for non-contiguous ETS TC config Aleksandr Loktionov
2026-04-14 9:35 ` Simon Horman
2026-04-10 7:49 ` [PATCH iwl-next 8/10] ice: move ice_phy_get_speed_eth56g() from ice_ptp_hw.c to ice_common.c Aleksandr Loktionov
2026-04-14 9:38 ` Simon Horman
2026-04-10 7:49 ` [PATCH iwl-next 9/10] ice: use inline helpers instead of memcmp() for IPv6 mask checks in ice_ethtool_fdir Aleksandr Loktionov
2026-04-14 9:39 ` Simon Horman
2026-04-10 7:49 ` [PATCH iwl-next 10/10] ice: promote Tx FIFO drain timeout message from dev_dbg to dev_warn Aleksandr Loktionov
2026-04-14 9:39 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260414090429.740296-1-horms@kernel.org \
--to=horms@kernel.org \
--cc=aleksandr.loktionov@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jacob.e.keller@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox