diff mbox

[net-next,3/5] be2net: Fix to apply duplex value as unknown when link is down.

Message ID cf78444f-636f-44c5-beb7-5626b8a3df17@exht1.ad.emulex.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Somnath Kotur April 26, 2012, 2:28 p.m. UTC
From: Somnath Kotur <somnath.kotur@emulex.com>


Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
---
 drivers/net/ethernet/emulex/benet/be_ethtool.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Ben Hutchings April 26, 2012, 5:24 p.m. UTC | #1
On Thu, 2012-04-26 at 19:58 +0530, Somnath Kotur wrote:
> From: Somnath Kotur <somnath.kotur@emulex.com>
> 
> 
> Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
> ---
>  drivers/net/ethernet/emulex/benet/be_ethtool.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
> index 5296df5..bb2add7 100644
> --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
> +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
> @@ -618,7 +618,7 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
>  		ecmd->supported = adapter->phy.supported;
>  	}
>  
> -	ecmd->duplex = DUPLEX_FULL;
> +	ecmd->duplex = netif_carrier_ok(netdev) ? DUPLEX_FULL : -1;
>  	ecmd->phy_address = adapter->port_num;
>  
>  	return 0;

I don't see any problem with reporting full-duplex all the time if you
don't support any half-duplex link modes.  But we don't yet have
consistency between drivers in speed/duplex reporting while the link is
down, so I won't insist that that is the right thing to do.

However you should use DUPLEX_UNKNOWN rather than -1.

Ben.
Somnath Kotur April 27, 2012, 6:42 a.m. UTC | #2
> I don't see any problem with reporting full-duplex all the time if you don't

> support any half-duplex link modes.  But we don't yet have consistency

> between drivers in speed/duplex reporting while the link is down, so I won't

> insist that that is the right thing to do.

> 

> However you should use DUPLEX_UNKNOWN rather than -1.

> 

> Ben.


Yes, Agreed. Thank you for your review/suggestion.

Will make the change and re-post.

-Som.

> --

> Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer;

> that's the marketing department's job.

> They asked us to note that Solarflare product names are trademarked.
diff mbox

Patch

diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
index 5296df5..bb2add7 100644
--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -618,7 +618,7 @@  static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
 		ecmd->supported = adapter->phy.supported;
 	}
 
-	ecmd->duplex = DUPLEX_FULL;
+	ecmd->duplex = netif_carrier_ok(netdev) ? DUPLEX_FULL : -1;
 	ecmd->phy_address = adapter->port_num;
 
 	return 0;