diff mbox series

[net,v2,6/6] igc: Fix Energy Efficient Ethernet support declaration

Message ID 20240603-net-2024-05-30-intel-net-fixes-v2-6-e3563aa89b0c@intel.com (mailing list archive)
State Accepted
Commit 7d67d11fbe194f71298263f48e33ae2afa38197e
Delegated to: Netdev Maintainers
Headers show
Series Intel Wired LAN Driver Updates 2024-05-29 (ice, igc) | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 901 this patch: 901
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers fail 1 blamed authors not CCed: andrew@lunn.ch; 6 maintainers not CCed: andrew@lunn.ch pabeni@redhat.com edumazet@google.com anthony.l.nguyen@intel.com jesse.brandeburg@intel.com intel-wired-lan@lists.osuosl.org
netdev/build_clang success Errors and warnings before: 907 this patch: 907
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 905 this patch: 905
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 35 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 29 this patch: 29
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-06-04--18-00 (tests: 1045)

Commit Message

Jacob Keller June 3, 2024, 9:42 p.m. UTC
From: Sasha Neftin <sasha.neftin@intel.com>

The commit 01cf893bf0f4 ("net: intel: i40e/igc: Remove setting Autoneg in
EEE capabilities") removed SUPPORTED_Autoneg field but left inappropriate
ethtool_keee structure initialization. When "ethtool --show <device>"
(get_eee) invoke, the 'ethtool_keee' structure was accidentally overridden.
Remove the 'ethtool_keee' overriding and add EEE declaration as per IEEE
specification that allows reporting Energy Efficient Ethernet capabilities.

Examples:
Before fix:
ethtool --show-eee enp174s0
EEE settings for enp174s0:
	EEE status: not supported

After fix:
EEE settings for enp174s0:
	EEE status: disabled
	Tx LPI: disabled
	Supported EEE link modes:  100baseT/Full
	                           1000baseT/Full
	                           2500baseT/Full

Fixes: 01cf893bf0f4 ("net: intel: i40e/igc: Remove setting Autoneg in EEE capabilities")
Suggested-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 9 +++++++--
 drivers/net/ethernet/intel/igc/igc_main.c    | 4 ++++
 2 files changed, 11 insertions(+), 2 deletions(-)

Comments

Hariprasad Kelam June 4, 2024, 7:08 a.m. UTC | #1
> From: Sasha Neftin <sasha.neftin@intel.com>
> 
> The commit 01cf893bf0f4 ("net: intel: i40e/igc: Remove setting Autoneg in
> EEE capabilities") removed SUPPORTED_Autoneg field but left inappropriate
> ethtool_keee structure initialization. When "ethtool --show <device>"
> (get_eee) invoke, the 'ethtool_keee' structure was accidentally overridden.
> Remove the 'ethtool_keee' overriding and add EEE declaration as per IEEE
> specification that allows reporting Energy Efficient Ethernet capabilities.
> 
> Examples:
> Before fix:
> ethtool --show-eee enp174s0
> EEE settings for enp174s0:
> 	EEE status: not supported
> 
> After fix:
> EEE settings for enp174s0:
> 	EEE status: disabled
> 	Tx LPI: disabled
> 	Supported EEE link modes:  100baseT/Full
> 	                           1000baseT/Full
> 	                           2500baseT/Full
> 
> Fixes: 01cf893bf0f4 ("net: intel: i40e/igc: Remove setting Autoneg in EEE
> capabilities")
> Suggested-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
> Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
> Tested-by: Naama Meir <naamax.meir@linux.intel.com>
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/igc/igc_ethtool.c | 9 +++++++--
>  drivers/net/ethernet/intel/igc/igc_main.c    | 4 ++++
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c
> b/drivers/net/ethernet/intel/igc/igc_ethtool.c
> index f2c4f1966bb0..0cd2bd695db1 100644
> --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
> +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
> @@ -1629,12 +1629,17 @@ static int igc_ethtool_get_eee(struct net_device
> *netdev,
>  	struct igc_hw *hw = &adapter->hw;
>  	u32 eeer;
> 
> +	linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
> +			 edata->supported);
> +	linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
> +			 edata->supported);
> +	linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
> +			 edata->supported);
> +
>  	if (hw->dev_spec._base.eee_enable)
>  		mii_eee_cap1_mod_linkmode_t(edata->advertised,
>  					    adapter->eee_advert);
> 
> -	*edata = adapter->eee;
> -
>  	eeer = rd32(IGC_EEER);
> 
>  	/* EEE status on negotiated link */
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c
> b/drivers/net/ethernet/intel/igc/igc_main.c
> index 12f004f46082..305e05294a26 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -12,6 +12,7 @@
>  #include <linux/bpf_trace.h>
>  #include <net/xdp_sock_drv.h>
>  #include <linux/pci.h>
> +#include <linux/mdio.h>
> 
>  #include <net/ipv6.h>
> 
> @@ -4975,6 +4976,9 @@ void igc_up(struct igc_adapter *adapter)
>  	/* start the watchdog. */
>  	hw->mac.get_link_status = true;
>  	schedule_work(&adapter->watchdog_task);
> +
> +	adapter->eee_advert = MDIO_EEE_100TX | MDIO_EEE_1000T |
> +			      MDIO_EEE_2_5GT;

        Since advertised is supported here, does it make sense add below in " igc_ethtool_get_eee"

        linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
> +			 edata->advertisied);

Thanks,
Hariprasad k
>  }
> 
>  /**
> 
> --
> 2.44.0.53.g0f9d4d28b7e6
>
Sasha Neftin June 5, 2024, 5:13 a.m. UTC | #2
On 04/06/2024 10:08, Hariprasad Kelam wrote:
> 
> 
>> From: Sasha Neftin <sasha.neftin@intel.com>
>>
>> The commit 01cf893bf0f4 ("net: intel: i40e/igc: Remove setting Autoneg in
>> EEE capabilities") removed SUPPORTED_Autoneg field but left inappropriate
>> ethtool_keee structure initialization. When "ethtool --show <device>"
>> (get_eee) invoke, the 'ethtool_keee' structure was accidentally overridden.
>> Remove the 'ethtool_keee' overriding and add EEE declaration as per IEEE
>> specification that allows reporting Energy Efficient Ethernet capabilities.
>>
>> Examples:
>> Before fix:
>> ethtool --show-eee enp174s0
>> EEE settings for enp174s0:
>> 	EEE status: not supported
>>
>> After fix:
>> EEE settings for enp174s0:
>> 	EEE status: disabled
>> 	Tx LPI: disabled
>> 	Supported EEE link modes:  100baseT/Full
>> 	                           1000baseT/Full
>> 	                           2500baseT/Full
>>
>> Fixes: 01cf893bf0f4 ("net: intel: i40e/igc: Remove setting Autoneg in EEE
>> capabilities")
>> Suggested-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
>> Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
>> Tested-by: Naama Meir <naamax.meir@linux.intel.com>
>> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
>> ---
>>   drivers/net/ethernet/intel/igc/igc_ethtool.c | 9 +++++++--
>>   drivers/net/ethernet/intel/igc/igc_main.c    | 4 ++++
>>   2 files changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c
>> b/drivers/net/ethernet/intel/igc/igc_ethtool.c
>> index f2c4f1966bb0..0cd2bd695db1 100644
>> --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
>> +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
>> @@ -1629,12 +1629,17 @@ static int igc_ethtool_get_eee(struct net_device
>> *netdev,
>>   	struct igc_hw *hw = &adapter->hw;
>>   	u32 eeer;
>>
>> +	linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
>> +			 edata->supported);
>> +	linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
>> +			 edata->supported);
>> +	linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
>> +			 edata->supported);
>> +
>>   	if (hw->dev_spec._base.eee_enable)
>>   		mii_eee_cap1_mod_linkmode_t(edata->advertised,
>>   					    adapter->eee_advert);
>>
>> -	*edata = adapter->eee;
>> -
>>   	eeer = rd32(IGC_EEER);
>>
>>   	/* EEE status on negotiated link */
>> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c
>> b/drivers/net/ethernet/intel/igc/igc_main.c
>> index 12f004f46082..305e05294a26 100644
>> --- a/drivers/net/ethernet/intel/igc/igc_main.c
>> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
>> @@ -12,6 +12,7 @@
>>   #include <linux/bpf_trace.h>
>>   #include <net/xdp_sock_drv.h>
>>   #include <linux/pci.h>
>> +#include <linux/mdio.h>
>>
>>   #include <net/ipv6.h>
>>
>> @@ -4975,6 +4976,9 @@ void igc_up(struct igc_adapter *adapter)
>>   	/* start the watchdog. */
>>   	hw->mac.get_link_status = true;
>>   	schedule_work(&adapter->watchdog_task);
>> +
>> +	adapter->eee_advert = MDIO_EEE_100TX | MDIO_EEE_1000T |
>> +			      MDIO_EEE_2_5GT;
> 
>          Since advertised is supported here, does it make sense add below in " igc_ethtool_get_eee"

It is different. eee_advert is an internal field in the board-specific 
data structure. However, since i225/6 parts have only one PHY type 
(unlike the i210/1 parts family) and this field could be used only 
internally in a driver and FW, we probably can drop this assignment. I 
will double-check it and clean it up to eliminate duplication in a 
different patch.

> 
>          linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
>> +			 edata->advertisied);
> 
> Thanks,
> Hariprasad k
>>   }
>>
>>   /**
>>
>> --
>> 2.44.0.53.g0f9d4d28b7e6
>>
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
index f2c4f1966bb0..0cd2bd695db1 100644
--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
@@ -1629,12 +1629,17 @@  static int igc_ethtool_get_eee(struct net_device *netdev,
 	struct igc_hw *hw = &adapter->hw;
 	u32 eeer;
 
+	linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
+			 edata->supported);
+	linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
+			 edata->supported);
+	linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
+			 edata->supported);
+
 	if (hw->dev_spec._base.eee_enable)
 		mii_eee_cap1_mod_linkmode_t(edata->advertised,
 					    adapter->eee_advert);
 
-	*edata = adapter->eee;
-
 	eeer = rd32(IGC_EEER);
 
 	/* EEE status on negotiated link */
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 12f004f46082..305e05294a26 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -12,6 +12,7 @@ 
 #include <linux/bpf_trace.h>
 #include <net/xdp_sock_drv.h>
 #include <linux/pci.h>
+#include <linux/mdio.h>
 
 #include <net/ipv6.h>
 
@@ -4975,6 +4976,9 @@  void igc_up(struct igc_adapter *adapter)
 	/* start the watchdog. */
 	hw->mac.get_link_status = true;
 	schedule_work(&adapter->watchdog_task);
+
+	adapter->eee_advert = MDIO_EEE_100TX | MDIO_EEE_1000T |
+			      MDIO_EEE_2_5GT;
 }
 
 /**