From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: Jamie Gloudon <jamie.gloudon@gmx.fr>, <netdev@vger.kernel.org>
Cc: "moderated list:INTEL ETHERNET DRIVERS"
<intel-wired-lan@lists.osuosl.org>
Subject: Re: [Intel-wired-lan] [PATCH 1/1] net-next: e1000e: Enable Link Partner Advertised Support
Date: Tue, 8 Nov 2022 16:15:20 -0800 [thread overview]
Message-ID: <e4578331-7761-cec0-7f0b-85d2d92cbded@intel.com> (raw)
In-Reply-To: <Y2p0kxpSN20BfiCD@gmx.fr>
CC: Intel-wired-LAN
On 11/8/2022 7:24 AM, Jamie Gloudon wrote:
> This enables link partner advertised support to show link modes and
> pause frame use.
>
> Signed-off-by: Jamie Gloudon <jamie.gloudon@gmx.fr>
> ---
> drivers/net/ethernet/intel/e1000e/ethtool.c | 10 +++++++++-
> drivers/net/ethernet/intel/e1000e/phy.c | 9 +++++++++
> 2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c
> index 51a5afe9df2f..743462adccd0 100644
> --- a/drivers/net/ethernet/intel/e1000e/ethtool.c
> +++ b/drivers/net/ethernet/intel/e1000e/ethtool.c
> @@ -110,9 +110,9 @@ static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
> static int e1000_get_link_ksettings(struct net_device *netdev,
> struct ethtool_link_ksettings *cmd)
> {
> + u32 speed, supported, advertising, lp_advertising, lpa_t;
> struct e1000_adapter *adapter = netdev_priv(netdev);
> struct e1000_hw *hw = &adapter->hw;
> - u32 speed, supported, advertising;
>
> if (hw->phy.media_type == e1000_media_type_copper) {
> supported = (SUPPORTED_10baseT_Half |
> @@ -120,7 +120,9 @@ static int e1000_get_link_ksettings(struct net_device *netdev,
> SUPPORTED_100baseT_Half |
> SUPPORTED_100baseT_Full |
> SUPPORTED_1000baseT_Full |
> + SUPPORTED_Asym_Pause |
> SUPPORTED_Autoneg |
> + SUPPORTED_Pause |
> SUPPORTED_TP);
> if (hw->phy.type == e1000_phy_ife)
> supported &= ~SUPPORTED_1000baseT_Full;
> @@ -192,10 +194,16 @@ static int e1000_get_link_ksettings(struct net_device *netdev,
> if (hw->phy.media_type != e1000_media_type_copper)
> cmd->base.eth_tp_mdix_ctrl = ETH_TP_MDI_INVALID;
>
> + lpa_t = mii_stat1000_to_ethtool_lpa_t(adapter->phy_regs.stat1000);
> + lp_advertising = lpa_t |
> + mii_lpa_to_ethtool_lpa_t(adapter->phy_regs.lpa);
> +
> ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
> supported);
> ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
> advertising);
> + ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.lp_advertising,
> + lp_advertising);
>
> return 0;
> }
> diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c
> index 060b263348ce..08c3d477dd6f 100644
> --- a/drivers/net/ethernet/intel/e1000e/phy.c
> +++ b/drivers/net/ethernet/intel/e1000e/phy.c
> @@ -2,6 +2,7 @@
> /* Copyright(c) 1999 - 2018 Intel Corporation. */
>
> #include "e1000.h"
> +#include <linux/ethtool.h>
>
> static s32 e1000_wait_autoneg(struct e1000_hw *hw);
> static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
> @@ -1011,6 +1012,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
> */
> mii_autoneg_adv_reg &=
> ~(ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP);
> + phy->autoneg_advertised &=
> + ~(ADVERTISED_Pause | ADVERTISED_Asym_Pause);
> break;
> case e1000_fc_rx_pause:
> /* Rx Flow control is enabled, and Tx Flow control is
> @@ -1024,6 +1027,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
> */
> mii_autoneg_adv_reg |=
> (ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP);
> + phy->autoneg_advertised |=
> + (ADVERTISED_Pause | ADVERTISED_Asym_Pause);
> break;
> case e1000_fc_tx_pause:
> /* Tx Flow control is enabled, and Rx Flow control is
> @@ -1031,6 +1036,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
> */
> mii_autoneg_adv_reg |= ADVERTISE_PAUSE_ASYM;
> mii_autoneg_adv_reg &= ~ADVERTISE_PAUSE_CAP;
> + phy->autoneg_advertised |= ADVERTISED_Asym_Pause;
> + phy->autoneg_advertised &= ~ADVERTISED_Pause;
> break;
> case e1000_fc_full:
> /* Flow control (both Rx and Tx) is enabled by a software
> @@ -1038,6 +1045,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
> */
> mii_autoneg_adv_reg |=
> (ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP);
> + phy->autoneg_advertised |=
> + (ADVERTISED_Pause | ADVERTISED_Asym_Pause);
> break;
> default:
> e_dbg("Flow control param set incorrectly\n");
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
parent reply other threads:[~2022-11-09 0:15 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <Y2p0kxpSN20BfiCD@gmx.fr>]
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=e4578331-7761-cec0-7f0b-85d2d92cbded@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jamie.gloudon@gmx.fr \
--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