diff mbox series

[net,3/3] amd-xgbe: propagate the correct speed and duplex status

Message ID 20231121191435.4049995-4-Raju.Rangoju@amd.com (mailing list archive)
State Accepted
Commit 7a2323ac24a50311f64a3a9b54ed5bef5821ecae
Delegated to: Netdev Maintainers
Headers show
Series amd-xgbe: fixes to handle corner-cases | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/codegen success Generated files up to date
netdev/tree_selection success Clearly marked for net
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: 1115 this patch: 1115
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 1142 this patch: 1142
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: 1142 this patch: 1142
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Raju Rangoju Nov. 21, 2023, 7:14 p.m. UTC
xgbe_get_link_ksettings() does not propagate correct speed and duplex
information to ethtool during cable unplug. Due to which ethtool reports
incorrect values for speed and duplex.

Address this by propagating correct information.

Fixes: 7c12aa08779c ("amd-xgbe: Move the PHY support into amd-xgbe")
Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Wojciech Drewek Nov. 22, 2023, 10:53 a.m. UTC | #1
On 21.11.2023 20:14, Raju Rangoju wrote:
> xgbe_get_link_ksettings() does not propagate correct speed and duplex
> information to ethtool during cable unplug. Due to which ethtool reports
> incorrect values for speed and duplex.
> 
> Address this by propagating correct information.
> 
> Fixes: 7c12aa08779c ("amd-xgbe: Move the PHY support into amd-xgbe")
> Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
> Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
> ---

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>

>  drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
> index 6e83ff59172a..32fab5e77246 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
> @@ -314,10 +314,15 @@ static int xgbe_get_link_ksettings(struct net_device *netdev,
>  
>  	cmd->base.phy_address = pdata->phy.address;
>  
> -	cmd->base.autoneg = pdata->phy.autoneg;
> -	cmd->base.speed = pdata->phy.speed;
> -	cmd->base.duplex = pdata->phy.duplex;
> +	if (netif_carrier_ok(netdev)) {
> +		cmd->base.speed = pdata->phy.speed;
> +		cmd->base.duplex = pdata->phy.duplex;
> +	} else {
> +		cmd->base.speed = SPEED_UNKNOWN;
> +		cmd->base.duplex = DUPLEX_UNKNOWN;
> +	}
>  
> +	cmd->base.autoneg = pdata->phy.autoneg;
>  	cmd->base.port = PORT_NONE;
>  
>  	XGBE_LM_COPY(cmd, supported, lks, supported);
diff mbox series

Patch

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
index 6e83ff59172a..32fab5e77246 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
@@ -314,10 +314,15 @@  static int xgbe_get_link_ksettings(struct net_device *netdev,
 
 	cmd->base.phy_address = pdata->phy.address;
 
-	cmd->base.autoneg = pdata->phy.autoneg;
-	cmd->base.speed = pdata->phy.speed;
-	cmd->base.duplex = pdata->phy.duplex;
+	if (netif_carrier_ok(netdev)) {
+		cmd->base.speed = pdata->phy.speed;
+		cmd->base.duplex = pdata->phy.duplex;
+	} else {
+		cmd->base.speed = SPEED_UNKNOWN;
+		cmd->base.duplex = DUPLEX_UNKNOWN;
+	}
 
+	cmd->base.autoneg = pdata->phy.autoneg;
 	cmd->base.port = PORT_NONE;
 
 	XGBE_LM_COPY(cmd, supported, lks, supported);