All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] cxgb4: do not return DUPLEX_UNKNOWN when link is down
@ 2018-07-13 12:26 Ganesh Goudar
  2018-07-16 20:44 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ganesh Goudar @ 2018-07-13 12:26 UTC (permalink / raw)
  To: netdev, davem; +Cc: nirranjan, indranil, venkatesh, Ganesh Goudar, Casey Leedom

We were returning DUPLEX_UNKNOWN in get_link_ksettings() when
the link was down.  Unfortunately, this causes a problem when
"ethtool -s autoneg on" is issued for a link which is down because
the ethtool code first reads the settings and then reapplies them
with only the changes provided on the command line. Which results
in us diving into set_link_ksettings() with DUPLEX_UNKNOWN which is
not DUPLEX_FULL, so set_link_ksettings() throws an -EINVAL error.
do not return DUPLEX_UNKNOWN to fix the issue.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
index a14a290..d07230c 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
@@ -628,13 +628,10 @@ static int get_link_ksettings(struct net_device *dev,
 	fw_caps_to_lmm(pi->port_type, pi->link_cfg.lpacaps,
 		       link_ksettings->link_modes.lp_advertising);
 
-	if (netif_carrier_ok(dev)) {
-		base->speed = pi->link_cfg.speed;
-		base->duplex = DUPLEX_FULL;
-	} else {
-		base->speed = SPEED_UNKNOWN;
-		base->duplex = DUPLEX_UNKNOWN;
-	}
+	base->speed = (netif_carrier_ok(dev)
+		       ? pi->link_cfg.speed
+		       : SPEED_UNKNOWN);
+	base->duplex = DUPLEX_FULL;
 
 	if (pi->link_cfg.fc & PAUSE_RX) {
 		if (pi->link_cfg.fc & PAUSE_TX) {
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] cxgb4: do not return DUPLEX_UNKNOWN when link is down
  2018-07-13 12:26 [PATCH net-next] cxgb4: do not return DUPLEX_UNKNOWN when link is down Ganesh Goudar
@ 2018-07-16 20:44 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-07-16 20:44 UTC (permalink / raw)
  To: ganeshgr; +Cc: netdev, nirranjan, indranil, venkatesh, leedom

From: Ganesh Goudar <ganeshgr@chelsio.com>
Date: Fri, 13 Jul 2018 17:56:55 +0530

> We were returning DUPLEX_UNKNOWN in get_link_ksettings() when
> the link was down.  Unfortunately, this causes a problem when
> "ethtool -s autoneg on" is issued for a link which is down because
> the ethtool code first reads the settings and then reapplies them
> with only the changes provided on the command line. Which results
> in us diving into set_link_ksettings() with DUPLEX_UNKNOWN which is
> not DUPLEX_FULL, so set_link_ksettings() throws an -EINVAL error.
> do not return DUPLEX_UNKNOWN to fix the issue.
> 
> Signed-off-by: Casey Leedom <leedom@chelsio.com>
> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-16 21:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-13 12:26 [PATCH net-next] cxgb4: do not return DUPLEX_UNKNOWN when link is down Ganesh Goudar
2018-07-16 20:44 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.