All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulrich Weber <ulrich.weber@gmail.com>
To: intel-wired-lan@lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH] ice: set ethtool autoneg based on active cfg
Date: Thu, 14 Mar 2024 10:15:13 +0100	[thread overview]
Message-ID: <20240314091513.25984-1-ulrich.weber@gmail.com> (raw)

Current logic uses ICE_AQ_AN_COMPLETED information to
flag if autonegotiation is enabled or disabled.

Since new ethtool netlink interface checks if there is
a configuration change or not and ignores the call, if
there is no change, this makes is impossible to disable
autonegotiation on links without established autoneg.

This will change the logic to check the active phy
configuration if autoneg is enabled or not.

Signed-off-by: Ulrich Weber <ulrich.weber@gmail.com>
---
 src/ice_ethtool.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/ice_ethtool.c b/src/ice_ethtool.c
index e1eeb16babb3..8fe475944f2c 100644
--- a/src/ice_ethtool.c
+++ b/src/ice_ethtool.c
@@ -2857,10 +2857,6 @@ ice_get_link_ksettings(struct net_device *netdev,
 	else
 		ice_get_settings_link_down(ks, netdev);
 
-	/* set autoneg settings */
-	ks->base.autoneg = (hw_link_info->an_info & ICE_AQ_AN_COMPLETED) ?
-		AUTONEG_ENABLE : AUTONEG_DISABLE;
-
 	/* set media type settings */
 
 	switch (vsi->port_info->phy.media_type) {
@@ -2912,6 +2908,10 @@ ice_get_link_ksettings(struct net_device *netdev,
 	if (err)
 		goto done;
 
+	/* set autoneg settings based on active configuration */
+	ks->base.autoneg = ice_is_phy_caps_an_enabled(caps) ?
+		AUTONEG_ENABLE : AUTONEG_DISABLE;
+
 	/* Set the advertised flow control based on the PHY capability */
 	if ((caps->caps & ICE_AQC_PHY_EN_TX_LINK_PAUSE) &&
 	    (caps->caps & ICE_AQC_PHY_EN_RX_LINK_PAUSE)) {
@@ -2960,7 +2960,7 @@ ice_get_link_ksettings(struct net_device *netdev,
 		ethtool_link_ksettings_add_link_mode(ks, supported, FEC_RS);
 #endif /* ETHTOOL_GFECPARAM */
 
-	/* Set supported and advertised autoneg */
+	/* Set supported and advertised autoneg based on media */
 	if (ice_is_phy_caps_an_enabled(caps)) {
 		ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
 		ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg);
-- 
2.40.1


             reply	other threads:[~2024-03-14 15:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14  9:15 Ulrich Weber [this message]
2024-03-15 21:39 ` [Intel-wired-lan] [PATCH] ice: set ethtool autoneg based on active cfg Tony Nguyen
2024-03-18 13:24   ` Ulrich Weber

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=20240314091513.25984-1-ulrich.weber@gmail.com \
    --to=ulrich.weber@gmail.com \
    --cc=intel-wired-lan@lists.osuosl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.