Thread (12 messages) flat view 12 messages, 3 authors, 2012-07-21

Re: [net-next 4/6] e1000: configure and read MDI settings

From: Ben Hutchings <hidden>
Date: 2012-07-20 23:27:44

On Fri, 2012-07-20 at 14:43 -0700, Jeff Kirsher wrote:
quoted hunk ↗ jump to hunk
From: Jesse Brandeburg <redacted>

This is the implementation in e1000 to allow ethtool to force
MDI state, allowing users to work around some improperly
behaving switches.

Current get_settings behavior slightly changes in that now when link is down
get_settings will return the MDI state of the last link because get_settings
needs to succeed to allow the set to work even when link is down.

Forcing in this driver is for now only allowed when auto-neg is enabled.

To use must have the matching version of ethtool app that supports
this functionality.

Signed-off-by: Jesse Brandeburg <redacted>
CC: Tushar Dave <redacted>
Tested-by: Aaron Brown <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
 drivers/net/ethernet/intel/e1000/e1000_ethtool.c |   34 ++++++++++++++++++++++
 drivers/net/ethernet/intel/e1000/e1000_main.c    |    4 +++
 2 files changed, 38 insertions(+)
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index 3103f0b..1d96bda 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -174,6 +174,15 @@ static int e1000_get_settings(struct net_device *netdev,
 
 	ecmd->autoneg = ((hw->media_type == e1000_media_type_fiber) ||
 			 hw->autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
+
+	/* MDI-X => 1; MDI => 0 */
+	if (hw->media_type == e1000_media_type_copper)
+		ecmd->eth_tp_mdix = (!!adapter->phy_info.mdix_mode ?
+							ETH_TP_MDI_X :
+							ETH_TP_MDI);
+	else
+		ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID;
[...]

Why don't you set ecmd->eth_tp_mdix_ctrl here?

If you also leave it as 0, it's impossible for userland to tell whether
the current mode was forced or automatically selected.

Ben.

-- 
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help