From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Ariel Elior <aelior@marvell.com>,
Manish Chopra <manishc@marvell.com>,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
linux-usb@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH 7/8] net: intel: igb: Use linkmode helpers for EEE
Date: Tue, 6 Feb 2024 10:34:25 +0100 [thread overview]
Message-ID: <20240206103425.28e64a8f@device-28.home> (raw)
In-Reply-To: <20240204-keee-u32-cleanup-v1-7-fb6e08329d9a@lunn.ch>
Hello Andrew,
On Sun, 04 Feb 2024 17:40:24 -0600
Andrew Lunn <andrew@lunn.ch> wrote:
> Make use of the existing linkmode helpers for converting PHY EEE
> register values into links modes, now that ethtool_keee uses link
> modes, rather than u32 values.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
[...]
> @@ -3109,6 +3111,8 @@ static int igb_set_eee(struct net_device *netdev,
> struct ethtool_keee *edata)
> {
> struct igb_adapter *adapter = netdev_priv(netdev);
> + __ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = {};
> + __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp) = {};
> struct e1000_hw *hw = &adapter->hw;
> struct ethtool_keee eee_curr;
> bool adv1g_eee = true, adv100m_eee = true;
> @@ -3138,14 +3142,21 @@ static int igb_set_eee(struct net_device *netdev,
> return -EINVAL;
> }
>
> - if (!edata->advertised_u32 || (edata->advertised_u32 &
> - ~(ADVERTISE_100_FULL | ADVERTISE_1000_FULL))) {
> + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
> + supported);
> + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
> + supported);
> + if (linkmode_andnot(tmp, edata->advertised, supported)) {
> dev_err(&adapter->pdev->dev,
> "EEE Advertisement supports only 100Tx and/or 100T full duplex\n");
> return -EINVAL;
> }
> - adv100m_eee = !!(edata->advertised_u32 & ADVERTISE_100_FULL);
> - adv1g_eee = !!(edata->advertised_u32 & ADVERTISE_1000_FULL);
> + adv100m_eee = linkmode_test_bit(
> + ETHTOOL_LINK_MODE_100baseT_Full_BIT,
> + edata->advertised);
> + adv1g_eee = linkmode_test_bit(
> + ETHTOOL_LINK_MODE_100baseT_Full_BIT,
Probably a typo, I think it should be ETHTOOL_LINK_MODE_1000baseT_Full_BIT
here :)
> + edata->advertised);
>
> } else if (!edata->eee_enabled) {
> dev_err(&adapter->pdev->dev,
> @@ -3153,7 +3164,7 @@ static int igb_set_eee(struct net_device *netdev,
> return -EINVAL;
> }
>
> - adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised_u32);
> + adapter->eee_advert = linkmode_to_mii_eee_cap1_t(edata->advertised);
> if (hw->dev_spec._82575.eee_disable != !edata->eee_enabled) {
> hw->dev_spec._82575.eee_disable = !edata->eee_enabled;
> adapter->flags |= IGB_FLAG_EEE;
>
Thanks,
Maxime
next prev parent reply other threads:[~2024-02-06 9:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-04 23:40 [PATCH 0/8] drivers: net: Convert EEE handling to use linkmode bitmaps Andrew Lunn
2024-02-04 23:40 ` [PATCH 1/8] net: usb: r8152: Use linkmode helpers for EEE Andrew Lunn
2024-02-04 23:40 ` [PATCH 2/8] net: usb: ax88179_178a: " Andrew Lunn
2024-02-04 23:40 ` [PATCH 3/8] net: qlogic: qede: " Andrew Lunn
2024-02-04 23:40 ` [PATCH 4/8] net: ethernet: ixgbe: Convert EEE to use linkmodes Andrew Lunn
2024-02-04 23:40 ` [PATCH 5/8] net: intel: i40e/igc: Remove setting Autoneg in EEE capabilities Andrew Lunn
2024-02-04 23:40 ` [PATCH 6/8] net: intel: e1000e: Use linkmode helpers for EEE Andrew Lunn
2024-02-04 23:40 ` [PATCH 7/8] net: intel: igb: " Andrew Lunn
2024-02-06 9:34 ` Maxime Chevallier [this message]
2024-02-06 14:25 ` Andrew Lunn
2024-02-04 23:40 ` [PATCH 8/8] net: intel: igc: " Andrew Lunn
2024-02-05 1:03 ` [PATCH 0/8] drivers: net: Convert EEE handling to use linkmode bitmaps Andrew Lunn
2024-02-06 9:38 ` Maxime Chevallier
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=20240206103425.28e64a8f@device-28.home \
--to=maxime.chevallier@bootlin.com \
--cc=aelior@marvell.com \
--cc=andrew@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=manishc@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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