All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] e1000/e1000e/igb MDI-X control implementation
@ 2010-11-17 23:29 Jesse Brandeburg
  2010-11-17 23:29 ` [RFC PATCH 1/3] e1000e: implement MDI-X control Jesse Brandeburg
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jesse Brandeburg @ 2010-11-17 23:29 UTC (permalink / raw)
  To: netdev

this patch series is RFC for implemenation, I've briefly tested
it to make sure I still get link after setting MDI-X and I see
the status change in ethtool.

The basic idea is to fill out the MDI-X read functionality with
some write functionality.

the e1000e patch is actually what drove this change as some users
have found wonky switches that must have MDI/MDI-X forced.

---

Jesse Brandeburg (3):
      e1000: configure and read mdix settings
      igb: update to allow reading/setting mdix
      e1000e: implement MDI-X control


 drivers/net/e1000/e1000.h         |    1 -
 drivers/net/e1000/e1000_ethtool.c |   13 +++++++++++++
 drivers/net/e1000/e1000_main.c    |    2 +-
 drivers/net/e1000e/e1000.h        |    1 -
 drivers/net/e1000e/ethtool.c      |    4 ++++
 drivers/net/e1000e/netdev.c       |    2 +-
 drivers/net/igb/igb.h             |    1 -
 drivers/net/igb/igb_ethtool.c     |   14 ++++++++++++++
 drivers/net/igb/igb_main.c        |    2 +-
 9 files changed, 34 insertions(+), 6 deletions(-)

-- 
jesse.brandeburg@intel.com

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

* [RFC PATCH 1/3] e1000e: implement MDI-X control
  2010-11-17 23:29 [RFC PATCH 0/3] e1000/e1000e/igb MDI-X control implementation Jesse Brandeburg
@ 2010-11-17 23:29 ` Jesse Brandeburg
  2010-11-17 23:29 ` [RFC PATCH 2/3] igb: update to allow reading/setting mdix Jesse Brandeburg
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jesse Brandeburg @ 2010-11-17 23:29 UTC (permalink / raw)
  To: netdev

some users report issues with link failing when connected
to certain switches.  This gives the user the ability to
control the MDI-X state from the driver.

This is in regards to the related ethtool patch and
bugzilla.kernel.org bug 11998

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: bruce.w.allan@intel.com
CC: n.poppelier@xs4all.nl
CC: bastien@durel.org
CC: jsveiga@it.eng.br
---

 drivers/net/e1000e/e1000.h   |    1 -
 drivers/net/e1000e/ethtool.c |    4 ++++
 drivers/net/e1000e/netdev.c  |    2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index fdc67fe..10469b2 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -81,7 +81,6 @@ struct e1000_info;
 /* How many Rx Buffers do we bundle into one write to the hardware ? */
 #define E1000_RX_BUFFER_WRITE		16 /* Must be power of 2 */
 
-#define AUTO_ALL_MODES			0
 #define E1000_EEPROM_APME		0x0400
 
 #define E1000_MNG_VLAN_NONE		(-1)
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 8984d16..f518c9b 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -285,6 +285,10 @@ static int e1000_set_settings(struct net_device *netdev,
 		}
 	}
 
+	/* MDI-X => 2; MDI =>1; Auto =>0 */
+	if (ecmd->eth_tp_mdix && (hw->phy.media_type == e1000_media_type_copper))
+		hw->phy.mdix = ecmd->eth_tp_mdix;
+
 	/* reset the link */
 
 	if (netif_running(adapter->netdev)) {
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 68e79c2..9e7d864 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -5842,7 +5842,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 
 	/* Copper options */
 	if (adapter->hw.phy.media_type == e1000_media_type_copper) {
-		adapter->hw.phy.mdix = AUTO_ALL_MODES;
+		adapter->hw.phy.mdix = ETH_TP_MDI_INVALID;
 		adapter->hw.phy.disable_polarity_correction = 0;
 		adapter->hw.phy.ms_type = e1000_ms_hw_default;
 	}


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

* [RFC PATCH 2/3] igb: update to allow reading/setting mdix
  2010-11-17 23:29 [RFC PATCH 0/3] e1000/e1000e/igb MDI-X control implementation Jesse Brandeburg
  2010-11-17 23:29 ` [RFC PATCH 1/3] e1000e: implement MDI-X control Jesse Brandeburg
@ 2010-11-17 23:29 ` Jesse Brandeburg
  2010-11-17 23:29 ` [RFC PATCH 3/3] e1000: configure and read mdix settings Jesse Brandeburg
  2010-11-18  0:14 ` [RFC PATCH 0/3] e1000/e1000e/igb MDI-X control implementation Ben Hutchings
  3 siblings, 0 replies; 5+ messages in thread
From: Jesse Brandeburg @ 2010-11-17 23:29 UTC (permalink / raw)
  To: netdev

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
CC: Carolyn Wyborny <carolyn.wyborny@intel.com>
---

 drivers/net/igb/igb.h         |    1 -
 drivers/net/igb/igb_ethtool.c |   14 ++++++++++++++
 drivers/net/igb/igb_main.c    |    2 +-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h
index edab9c4..04f7a05 100644
--- a/drivers/net/igb/igb.h
+++ b/drivers/net/igb/igb.h
@@ -120,7 +120,6 @@ struct vf_data_storage {
 /* How many Rx Buffers do we bundle into one write to the hardware ? */
 #define IGB_RX_BUFFER_WRITE	16	/* Must be power of 2 */
 
-#define AUTO_ALL_MODES            0
 #define IGB_EEPROM_APME         0x0400
 
 #ifndef IGB_MASTER_SLAVE
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index a70e16b..bfeee01 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -191,6 +191,15 @@ static int igb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
 	}
 
 	ecmd->autoneg = hw->mac.autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE;
+
+	/* MDI-X => 2; MDI =>1; Invalid =>0 */
+	if ((hw->phy.media_type == e1000_media_type_copper) &&
+	    netif_carrier_ok(netdev))
+		ecmd->eth_tp_mdix = hw->phy.is_mdix ? ETH_TP_MDI_X :
+		                                      ETH_TP_MDI;
+	else
+		ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID;
+
 	return 0;
 }
 
@@ -225,6 +234,11 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
 		}
 	}
 
+	/* MDI-X => 2; MDI =>1; Auto =>0 */
+	if ((ecmd->eth_tp_mdix != -1) &&
+	    (hw->phy.media_type == e1000_media_type_copper))
+		hw->phy.mdix = ecmd->eth_tp_mdix;
+
 	/* reset the link */
 	if (netif_running(adapter->netdev)) {
 		igb_down(adapter);
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 892d196..338825f 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -1838,7 +1838,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
 
 	/* Copper options */
 	if (hw->phy.media_type == e1000_media_type_copper) {
-		hw->phy.mdix = AUTO_ALL_MODES;
+		hw->phy.mdix = ETH_TP_MDI_INVALID;
 		hw->phy.disable_polarity_correction = false;
 		hw->phy.ms_type = e1000_ms_hw_default;
 	}


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

* [RFC PATCH 3/3] e1000: configure and read mdix settings
  2010-11-17 23:29 [RFC PATCH 0/3] e1000/e1000e/igb MDI-X control implementation Jesse Brandeburg
  2010-11-17 23:29 ` [RFC PATCH 1/3] e1000e: implement MDI-X control Jesse Brandeburg
  2010-11-17 23:29 ` [RFC PATCH 2/3] igb: update to allow reading/setting mdix Jesse Brandeburg
@ 2010-11-17 23:29 ` Jesse Brandeburg
  2010-11-18  0:14 ` [RFC PATCH 0/3] e1000/e1000e/igb MDI-X control implementation Ben Hutchings
  3 siblings, 0 replies; 5+ messages in thread
From: Jesse Brandeburg @ 2010-11-17 23:29 UTC (permalink / raw)
  To: netdev

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---

 drivers/net/e1000/e1000.h         |    1 -
 drivers/net/e1000/e1000_ethtool.c |   13 +++++++++++++
 drivers/net/e1000/e1000_main.c    |    2 +-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index a881dd0..e2767ab 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -130,7 +130,6 @@ struct e1000_adapter;
 /* How many Rx Buffers do we bundle into one write to the hardware ? */
 #define E1000_RX_BUFFER_WRITE	16	/* Must be power of 2 */
 
-#define AUTO_ALL_MODES            0
 #define E1000_EEPROM_82544_APM    0x0004
 #define E1000_EEPROM_APME         0x0400
 
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index f4d0922..5e2c83f 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -174,6 +174,14 @@ 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 => 2; MDI =>1; Invalid =>0 */
+	if ((hw->media_type == e1000_media_type_copper) &&
+	    netif_carrier_ok(netdev))
+		ecmd->eth_tp_mdix = hw->mdix;
+	else
+		ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID;
+
 	return 0;
 }
 
@@ -203,6 +211,11 @@ static int e1000_set_settings(struct net_device *netdev,
 			return -EINVAL;
 		}
 
+	/* MDI-X => 2; MDI =>1; Auto =>0 */
+	if ((ecmd->eth_tp_mdix != -1) &&
+	    (hw->media_type == e1000_media_type_copper))
+		hw->mdix = ecmd->eth_tp_mdix;
+
 	/* reset the link */
 
 	if (netif_running(adapter->netdev)) {
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4686c39..0252a01 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -860,7 +860,7 @@ static int e1000_init_hw_struct(struct e1000_adapter *adapter,
 	/* Copper options */
 
 	if (hw->media_type == e1000_media_type_copper) {
-		hw->mdix = AUTO_ALL_MODES;
+		hw->mdix = ETH_TP_MDI_INVALID;
 		hw->disable_polarity_correction = false;
 		hw->master_slave = E1000_MASTER_SLAVE;
 	}


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

* Re: [RFC PATCH 0/3] e1000/e1000e/igb MDI-X control implementation
  2010-11-17 23:29 [RFC PATCH 0/3] e1000/e1000e/igb MDI-X control implementation Jesse Brandeburg
                   ` (2 preceding siblings ...)
  2010-11-17 23:29 ` [RFC PATCH 3/3] e1000: configure and read mdix settings Jesse Brandeburg
@ 2010-11-18  0:14 ` Ben Hutchings
  3 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2010-11-18  0:14 UTC (permalink / raw)
  To: Jesse Brandeburg; +Cc: netdev

On Wed, 2010-11-17 at 15:29 -0800, Jesse Brandeburg wrote:
> this patch series is RFC for implemenation, I've briefly tested
> it to make sure I still get link after setting MDI-X and I see
> the status change in ethtool.
> 
> The basic idea is to fill out the MDI-X read functionality with
> some write functionality.
> 
> the e1000e patch is actually what drove this change as some users
> have found wonky switches that must have MDI/MDI-X forced.
[...]

I object to all these for the reasons explained in my comments on the
changes to the ethtool utility.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


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

end of thread, other threads:[~2010-11-18  0:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-17 23:29 [RFC PATCH 0/3] e1000/e1000e/igb MDI-X control implementation Jesse Brandeburg
2010-11-17 23:29 ` [RFC PATCH 1/3] e1000e: implement MDI-X control Jesse Brandeburg
2010-11-17 23:29 ` [RFC PATCH 2/3] igb: update to allow reading/setting mdix Jesse Brandeburg
2010-11-17 23:29 ` [RFC PATCH 3/3] e1000: configure and read mdix settings Jesse Brandeburg
2010-11-18  0:14 ` [RFC PATCH 0/3] e1000/e1000e/igb MDI-X control implementation Ben Hutchings

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.