Skip to contentSkip to conversation

ethtool: Expose MDI-X status

PATCH In review Chaitanya Lala 4 participants 22 messages May 22, 2009 – Jun 10, 2009 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): F169D4F5E1F1974DBFAFABF47F60C10A33527C9D@orsmsx507.amr.corp.intel.com

#1 lore raw

PATCH 1/1 ethtool: Expose MDI-X status

The MDI-X status is a useful tool for diagnosing network connectivity issues. We expose MDI-X status as a tri-state value status which drivers can optionally implement.

---
 ethtool-copy.h |    6 ++++++
 ethtool.c      |   13 +++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
ethtool-copy.h +6 -0
index 3ca4e2c..37bbeaf 100644
@@ -23,6 +23,7 @@ struct ethtool_cmd {
 	__u8	phy_address;
 	__u8	transceiver;	/* Which transceiver to use */
 	__u8	autoneg;	/* Enable or disable autonegotiation */
+	__u8	is_mdix;
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
 	__u16	speed_hi;
@@ -416,6 +417,11 @@ struct ethtool_rxnfc {
 #define AUTONEG_DISABLE		0x00
 #define AUTONEG_ENABLE		0x01
 
+/* Mode MDI or MDI-X */
+#define MDI_INVALID 0x00
+#define MDI         0x01
+#define MDI_X       0x02
+
 /* Wake-On-Lan options. */
 #define WAKE_PHY		(1 << 0)
 #define WAKE_UCAST		(1 << 1)
ethtool.c +13 -0
index 0110682..bf12168 100644
@@ -964,6 +964,19 @@ static int dump_ecmd(struct ethtool_cmd *ep)
 	fprintf(stdout, "	Auto-negotiation: %s\n",
 		(ep->autoneg == AUTONEG_DISABLE) ?
 		"off" : "on");
+
+	switch (ep->is_mdix) {
+	case MDI:
+		fprintf(stdout, "	MDI-X: off\n");
+		break;
+	case MDI_X:
+		fprintf(stdout, "	MDI-X: on\n");
+		break;
+	default:
+		fprintf(stdout, "	MDI-X: Unknown\n");
+		break;
+	}
+
 	return 0;
 }
 
Signature · 1 line
1.6.0.4
#2 lore raw
Quoted 17 lines · On Fri, 22 May 2009 07:54:26 -0700 Chaitanya Lala <[email protected]> wrote:

The MDI-X status is a useful tool for diagnosing network connectivity issues. We expose MDI-X status as a tri-state value status which drivers can optionally implement.

---
 ethtool-copy.h |    6 ++++++
 ethtool.c      |   13 +++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
ethtool-copy.h +0 -0
index 3ca4e2c..37bbeaf 100644

ethtool-copy.h struct ethtool_cmd { · line 29

Quoted 7 lines
ethtool-copy.h +1 -0
@@ -23,6 +23,7 @@ struct ethtool_cmd {
 	__u8	phy_address;
 	__u8	transceiver;	/* Which transceiver to use */
 	__u8	autoneg;	/* Enable or disable autonegotiation */
+	__u8	is_mdix;
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
 	__u16	speed_hi;

Is this an ABI change (or are you just reusing a pad hole)?

#3 lore raw
In reply to Chaitanya Lala
Quoted 16 lines · Chaitanya Lala

The MDI-X status is a useful tool for diagnosing network connectivity issues. We expose MDI-X status as a tri-state value status which drivers can optionally implement.

---
 ethtool-copy.h |    6 ++++++
 ethtool.c      |   13 +++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
ethtool-copy.h +0 -0
index 3ca4e2c..37bbeaf 100644

ethtool-copy.h struct ethtool_cmd { · line 26

Quoted 4 lines
ethtool-copy.h +1 -0
@@ -23,6 +23,7 @@ struct ethtool_cmd {
 	__u8	phy_address;
 	__u8	transceiver;	/* Which transceiver to use */
 	__u8	autoneg;	/* Enable or disable autonegotiation */
+	__u8	is_mdix;

[...]

I have already filled this hole in the structure. See Dave's net-next-2.6 repository and my previously submitted changes to ethtool
<http://thread.gmane.org/gmane.linux.network/127025>.

Ben.

Signature · 3 lines
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.
#4 lore raw

PATCH 1/1 e1000e: Expose MDI-X status via ethtool change

In reply to a message not in the archive

Ethtool is a standard way of getting information about ethernet interfaces. We enhance ethtool kernel interface & e1000e to make the MDI-X status readable via ethtool in userspace.

---
 drivers/net/e1000e/ethtool.c |    8 ++++++++
 include/linux/ethtool.h      |    6 ++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
drivers/net/e1000e/ethtool.c +8 -0
index 4d25ede..8bbade1 100644
@@ -167,6 +167,14 @@ static int e1000_get_settings(struct net_device *netdev,
 
 	ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) ||
 			 hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
+
+	/* MDI-X => 2; MDI =>1; Invalid =>0 */
+	if ((hw->phy.media_type == e1000_media_type_copper) &&
+			!hw->mac.get_link_status)
+		ecmd->is_mdix = hw->phy.is_mdix ? MDI_X : MDI;
+	else
+		ecmd->is_mdix = MDI_INVALID;
+
 	return 0;
 }
 
include/linux/ethtool.h +6 -0
index 380b042..0533d70 100644
@@ -26,6 +26,7 @@ struct ethtool_cmd {
 	__u8	phy_address;
 	__u8	transceiver;	/* Which transceiver to use */
 	__u8	autoneg;	/* Enable or disable autonegotiation */
+	__u8	is_mdix;	/* MDI-X status tri-state value */
 	__u8	mdio_support;
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
@@ -632,6 +633,11 @@ struct ethtool_ops {
 #define AUTONEG_DISABLE		0x00
 #define AUTONEG_ENABLE		0x01
 
+/* Mode MDI or MDI-X */
+#define MDI_INVALID	0x00
+#define MDI		0x01
+#define MDI_X		0x02
+
 /* Wake-On-Lan options. */
 #define WAKE_PHY		(1 << 0)
 #define WAKE_UCAST		(1 << 1)
Signature · 1 line
1.6.0.4
#5 lore raw

Re: [net-next-2.6 PATCH 1/1] e1000e: Expose MDI-X status via ethtool change

Quoted 3 lines · Chaitanya Lala

Ethtool is a standard way of getting information about ethernet interfaces. We enhance ethtool kernel interface & e1000e to make the MDI-X status readable via ethtool in userspace.

[...]

include/linux/ethtool.h struct ethtool_cmd { · line 30

Quoted 10 lines
include/linux/ethtool.h +1 -0
index 380b042..0533d70 100644
@@ -26,6 +26,7 @@ struct ethtool_cmd {
 	__u8	phy_address;
 	__u8	transceiver;	/* Which transceiver to use */
 	__u8	autoneg;	/* Enable or disable autonegotiation */
+	__u8	is_mdix;	/* MDI-X status tri-state value */
 	__u8	mdio_support;

[...]

There's no gap here, so this would move all the following fields and break all older ethtool clients.

Ben.

Signature · 3 lines
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.
#6 lore raw

Re: [net-next-2.6 PATCH 1/1] e1000e: Expose MDI-X status via ethtool change

Quoted 21 lines · Ben Hutchings
Quoted 4 lines · Chaitanya Lala

Ethtool is a standard way of getting information about ethernet interfaces. We enhance ethtool kernel interface & e1000e to make the MDI-X status readable via ethtool in userspace.

[...]

Quoted 11 lines
include/linux/ethtool.h +1 -0
index 380b042..0533d70 100644
@@ -26,6 +26,7 @@ struct ethtool_cmd {
 	__u8	phy_address;
 	__u8	transceiver;	/* Which transceiver to use */
 	__u8	autoneg;	/* Enable or disable autonegotiation */
+	__u8	is_mdix;	/* MDI-X status tri-state value */
 	__u8	mdio_support;
 

[...]

Quoted 6 lines

There's no gap here, so this would move all the following fields and break all older ethtool clients.

Ben.

Then should I move it to the bottom ?

Chaitanya

#7 lore raw

PATCH 1/1 ethtool: Expose MDI-X status

In reply to Ben Hutchings

The MDI-X status is a useful tool for diagnosing network connectivity issues. We expose MDI-X status as a tri-state value status which drivers can optionally implement.

---
 ethtool-copy.h |    6 ++++++
 ethtool.c      |   13 +++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
ethtool-copy.h +6 -0
index 3ca4e2c..d3e1524 100644
@@ -28,6 +28,7 @@ struct ethtool_cmd {
 	__u16	speed_hi;
 	__u16	reserved2;
 	__u32	reserved[3];
+	__u8	is_mdix;	/* Tri-state value to expose MDI-X */
 };
 
 static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
@@ -416,6 +417,11 @@ struct ethtool_rxnfc {
 #define AUTONEG_DISABLE		0x00
 #define AUTONEG_ENABLE		0x01
 
+/* Mode MDI or MDI-X */
+#define MDI_INVALID 0x00
+#define MDI         0x01
+#define MDI_X       0x02
+
 /* Wake-On-Lan options. */
 #define WAKE_PHY		(1 << 0)
 #define WAKE_UCAST		(1 << 1)
ethtool.c +13 -0
index 0110682..bf12168 100644
@@ -964,6 +964,19 @@ static int dump_ecmd(struct ethtool_cmd *ep)
 	fprintf(stdout, "	Auto-negotiation: %s\n",
 		(ep->autoneg == AUTONEG_DISABLE) ?
 		"off" : "on");
+
+	switch (ep->is_mdix) {
+	case MDI:
+		fprintf(stdout, "	MDI-X: off\n");
+		break;
+	case MDI_X:
+		fprintf(stdout, "	MDI-X: on\n");
+		break;
+	default:
+		fprintf(stdout, "	MDI-X: Unknown\n");
+		break;
+	}
+
 	return 0;
 }
 
Signature · 1 line
1.6.0.4
#8 lore raw
Quoted 16 lines · Chaitanya Lala

The MDI-X status is a useful tool for diagnosing network connectivity issues. We expose MDI-X status as a tri-state value status which drivers can optionally implement.

---
 ethtool-copy.h |    6 ++++++
 ethtool.c      |   13 +++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
ethtool-copy.h +0 -0
index 3ca4e2c..d3e1524 100644

ethtool-copy.h struct ethtool_cmd { · line 32

Quoted 5 lines
ethtool-copy.h +1 -0
@@ -28,6 +28,7 @@ struct ethtool_cmd {
 	__u16	speed_hi;
 	__u16	reserved2;
 	__u32	reserved[3];
+	__u8	is_mdix;	/* Tri-state value to expose MDI-X */
 };

[...]

No, you cannot change the size of this structure either.

Ben.

Signature · 3 lines
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.
#9 lore raw
Quoted 26 lines · Ben Hutchings
Quoted 22 lines · Chaitanya Lala

The MDI-X status is a useful tool for diagnosing network connectivity issues. We expose MDI-X status as a tri-state value status which drivers can optionally implement.

---
 ethtool-copy.h |    6 ++++++
 ethtool.c      |   13 +++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
ethtool-copy.h +1 -0
index 3ca4e2c..d3e1524 100644
@@ -28,6 +28,7 @@ struct ethtool_cmd {
 	__u16	speed_hi;
 	__u16	reserved2;
 	__u32	reserved[3];
+	__u8	is_mdix;	/* Tri-state value to expose MDI-X */
 };
 

[...]

Quoted 2 lines

No, you cannot change the size of this structure either.

Hi,

In that case please suggest a way to do this.

Thanks,
Chaitanya

Quoted 3 lines

Ben.

#10 lore raw
Quoted 27 lines · Chaitanya Lala
Quoted 26 lines · Ben Hutchings
Quoted 22 lines · Chaitanya Lala

The MDI-X status is a useful tool for diagnosing network connectivity issues. We expose MDI-X status as a tri-state value status which drivers can optionally implement.

---
 ethtool-copy.h |    6 ++++++
 ethtool.c      |   13 +++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
ethtool-copy.h +1 -0
index 3ca4e2c..d3e1524 100644
@@ -28,6 +28,7 @@ struct ethtool_cmd {
 	__u16	speed_hi;
 	__u16	reserved2;
 	__u32	reserved[3];
+	__u8	is_mdix;	/* Tri-state value to expose MDI-X */
 };
 

[...]

Quoted 5 lines
Quoted 2 lines

No, you cannot change the size of this structure either.

Hi,

In that case please suggest a way to do this.

There are 14 bytes at the end of the structure reserved for future expansion. You could take one of them.

Ben.

Signature · 3 lines
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.
#11 lore raw

PATCH 1/1 ethtool: Expose MDI-X status

The MDI-X status is a useful tool for diagnosing network connectivity issues. We expose MDI-X status as a tri-state value status which drivers can optionally implement.

---
 ethtool-copy.h |    8 +++++++-
 ethtool.c      |   13 +++++++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)
ethtool-copy.h +7 -1
index 3ca4e2c..48fb1d3 100644
@@ -26,7 +26,8 @@ struct ethtool_cmd {
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
 	__u16	speed_hi;
-	__u16	reserved2;
+	__u8	is_mdix;
+	__u8	reserved2;
 	__u32	reserved[3];
 };
 
@@ -416,6 +417,11 @@ struct ethtool_rxnfc {
 #define AUTONEG_DISABLE		0x00
 #define AUTONEG_ENABLE		0x01
 
+/* Mode MDI or MDI-X */
+#define MDI_INVALID 0x00
+#define MDI         0x01
+#define MDI_X       0x02
+
 /* Wake-On-Lan options. */
 #define WAKE_PHY		(1 << 0)
 #define WAKE_UCAST		(1 << 1)
ethtool.c +13 -0
index 0110682..bf12168 100644
@@ -964,6 +964,19 @@ static int dump_ecmd(struct ethtool_cmd *ep)
 	fprintf(stdout, "	Auto-negotiation: %s\n",
 		(ep->autoneg == AUTONEG_DISABLE) ?
 		"off" : "on");
+
+	switch (ep->is_mdix) {
+	case MDI:
+		fprintf(stdout, "	MDI-X: off\n");
+		break;
+	case MDI_X:
+		fprintf(stdout, "	MDI-X: on\n");
+		break;
+	default:
+		fprintf(stdout, "	MDI-X: Unknown\n");
+		break;
+	}
+
 	return 0;
 }
 
Signature · 1 line
1.6.0.4
#12 lore raw

PATCH 1/1 e1000e: Expose MDI-X status via ethtool change

In reply to Ben Hutchings

Ethtool is a standard way of getting information about ethernet interfaces. We enhance ethtool kernel interface & e1000e to make the MDI-X status readable via ethtool in userspace.

---
 drivers/net/e1000e/ethtool.c |    8 ++++++++
 include/linux/ethtool.h      |    8 +++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)
drivers/net/e1000e/ethtool.c +8 -0
index 4d25ede..b6aea6b 100644
@@ -167,6 +167,14 @@ static int e1000_get_settings(struct net_device *netdev,
 
 	ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) ||
 			 hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
+
+	/* MDI-X => 2; MDI =>1; Invalid =>0 */
+	if ((hw->phy.media_type == e1000_media_type_copper) &&
+		!hw->mac.get_link_status)
+		ecmd->is_mdix = hw->phy.is_mdix ? MDI_X : MDI;
+	else
+		ecmd->is_mdix = MDI_INVALID;
+
 	return 0;
 }
 
include/linux/ethtool.h +7 -1
index 380b042..b553bdb 100644
@@ -30,7 +30,8 @@ struct ethtool_cmd {
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
 	__u16	speed_hi;
-	__u16	reserved2;
+	__u8	is_mdix;
+	__u8	reserved2;
 	__u32	lp_advertising;	/* Features the link partner advertises */
 	__u32	reserved[2];
 };
@@ -632,6 +633,11 @@ struct ethtool_ops {
 #define AUTONEG_DISABLE		0x00
 #define AUTONEG_ENABLE		0x01
 
+/* Mode MDI or MDI-X */
+#define MDI_INVALID 0x00
+#define MDI         0x01
+#define MDI_X       0x02
+
 /* Wake-On-Lan options. */
 #define WAKE_PHY		(1 << 0)
 #define WAKE_UCAST		(1 << 1)
Signature · 1 line
1.6.0.4
#13 lore raw

Re: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via ethtool change

Quoted 57 lines · Chaitanya Lala

Ethtool is a standard way of getting information about ethernet interfaces. We enhance ethtool kernel interface & e1000e to make the MDI-X status readable via ethtool in userspace.

---
 drivers/net/e1000e/ethtool.c |    8 ++++++++
 include/linux/ethtool.h      |    8 +++++++-

 2 files changed, 15 insertions(+), 1 deletions(-)
drivers/net/e1000e/ethtool.c +0 -0
index 4d25ede..b6aea6b 100644
@@ -167,6 +167,14 @@ static int e1000_get_settings(struct net_device *netdev,
 

       ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) || hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;

drivers/net/e1000e/ethtool.c +8 -0
+
+       /* MDI-X => 2; MDI =>1; Invalid =>0 */
+       if ((hw->phy.media_type == e1000_media_type_copper) &&
+               !hw->mac.get_link_status)
+               ecmd->is_mdix = hw->phy.is_mdix ? MDI_X : MDI;
+       else
+               ecmd->is_mdix = MDI_INVALID;
+

       return 0;
 }

include/linux/ethtool.h +0 -0
index 380b042..b553bdb 100644
@@ -30,7 +30,8 @@ struct ethtool_cmd {

       __u32   maxtxpkt;       /* Tx pkts before generating tx int */ __u32   maxrxpkt;       /* Rx pkts before generating rx int */ __u16   speed_hi;
-       __u16   reserved2;
+       __u8    is_mdix;
+       __u8    reserved2;
       __u32   lp_advertising; /* Features the link partner advertises */ __u32   reserved[2];
 };

include/linux/ethtool.h +5 -1
@@ -632,6 +633,11 @@ struct ethtool_ops {
  #define AUTONEG_DISABLE                0x00
  #define AUTONEG_ENABLE         0x01
 
+/* Mode MDI or MDI-X */
+#define MDI_INVALID 0x00
+#define MDI         0x01
+#define MDI_X       0x02
+
  /* Wake-On-Lan options. */
  #define WAKE_PHY               (1 << 0)
  #define WAKE_UCAST             (1 << 1)
--
Quoted 2 lines

1.6.0.4

I have pulled this into my queue for testing and submission, thanks.

Signature · 2 lines
Cheers,
Jeff
#14 lore raw

Re: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via ethtool change

In reply to Chaitanya Lala

On Wed, 2009-05-27 at 16:15 -0700, Chaitanya Lala wrote:
[...]

include/linux/ethtool.h struct ethtool_cmd { · line 33

Quoted 10 lines
include/linux/ethtool.h +1 -1
index 380b042..b553bdb 100644
@@ -30,7 +30,8 @@ struct ethtool_cmd {
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
 	__u16	speed_hi;
-	__u16	reserved2;
+	__u8	is_mdix;

Since this is specific to Ethernet over twisted-pair cable, could you please rename this to "eth_tp_mdix".

include/linux/ethtool.h struct ethtool_ops { · line 639

Quoted 12 lines
include/linux/ethtool.h +5 -0
+	__u8	reserved2;
 	__u32	lp_advertising;	/* Features the link partner advertises */
 	__u32	reserved[2];
 };
@@ -632,6 +633,11 @@ struct ethtool_ops {
 #define AUTONEG_DISABLE		0x00
 #define AUTONEG_ENABLE		0x01
 
+/* Mode MDI or MDI-X */
+#define MDI_INVALID 0x00
+#define MDI         0x01
+#define MDI_X       0x02

[...]

Similarly, please add the prefix "ETH_TP_" to these.

Ben.

Signature · 3 lines
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.
#15 lore raw

Re: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via ethtool change

Quoted 18 lines · Ben Hutchings

On Wed, 2009-05-27 at 16:15 -0700, Chaitanya Lala wrote:
[...]

include/linux/ethtool.h struct ethtool_cmd { · line 34

Quoted 11 lines
include/linux/ethtool.h +1 -1
index 380b042..b553bdb 100644
@@ -30,7 +30,8 @@ struct ethtool_cmd {
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
 	__u16	speed_hi;
-	__u16	reserved2;
+	__u8	is_mdix;
 

Since this is specific to Ethernet over twisted-pair cable, could you please rename this to "eth_tp_mdix".

Will do for sure.

Quoted 9 lines
Quoted 9 lines
include/linux/ethtool.h +1 -0
+	__u8	reserved2;
 	__u32	lp_advertising;	/* Features the link partner advertises */
 	__u32	reserved[2];

};

include/linux/ethtool.h +0 -0
@@ -632,6 +633,11 @@ struct ethtool_ops {
 #define AUTONEG_DISABLE		0x00
 #define AUTONEG_ENABLE		0x01
 
Quoted 9 lines

include/linux/ethtool.h struct ethtool_ops {

Quoted 5 lines
include/linux/ethtool.h +4 -0
+/* Mode MDI or MDI-X */
+#define MDI_INVALID 0x00
+#define MDI         0x01
+#define MDI_X       0x02
 

[...]

Similarly, please add the prefix "ETH_TP_" to these.

Sure.

Quoted 3 lines

Ben.

#16 lore raw

Re: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via ethtool change

Quoted 41 lines · Chaitanya Lala
Quoted 5 lines · Ben Hutchings

On Wed, 2009-05-27 at 16:15 -0700, Chaitanya Lala wrote:
[...]

Quoted 1 line
Quoted 15 lines
Quoted 11 lines
include/linux/ethtool.h +0 -0
index 380b042..b553bdb 100644
@@ -30,7 +30,8 @@ struct ethtool_cmd {

       __u32   maxtxpkt;       /* Tx pkts before generating tx int */ __u32   maxrxpkt;       /* Rx pkts before generating rx int */ __u16   speed_hi;
-       __u16   reserved2;
+       __u8    is_mdix;

Since this is specific to Ethernet over twisted-pair cable, could you please rename this to "eth_tp_mdix".

Will do for sure.

Quoted 18 lines
Quoted 15 lines

+       __u8    reserved2;
       __u32   lp_advertising; /* Features the link partner advertises */ __u32   reserved[2];
 };

include/linux/ethtool.h +0 -0
@@ -632,6 +633,11 @@ struct ethtool_ops {
  #define AUTONEG_DISABLE                0x00
  #define AUTONEG_ENABLE         0x01

 +/* Mode MDI or MDI-X */

include/linux/ethtool.h +3 -0
+#define MDI_INVALID 0x00
+#define MDI         0x01
+#define MDI_X       0x02

[...]

Quoted 4 lines
Quoted 2 lines

Similarly, please add the prefix "ETH_TP_" to these.

Sure.

Chaitanya, I have made the requested changes to the patch in my tree.

Signature · 2 lines
Cheers,
Jeff
#17 lore raw

Re: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via ethtool change

Quoted 42 lines · Jeff Kirsher
Quoted 40 lines · Chaitanya Lala
Quoted 4 lines · Ben Hutchings

On Wed, 2009-05-27 at 16:15 -0700, Chaitanya Lala wrote:
[...]

Quoted 16 lines

include/linux/ethtool.h struct ethtool_cmd { · line 35

Quoted 12 lines
include/linux/ethtool.h +1 -1
index 380b042..b553bdb 100644
@@ -30,7 +30,8 @@ struct ethtool_cmd {
       __u32   maxtxpkt;       /* Tx pkts before generating tx int */
       __u32   maxrxpkt;       /* Rx pkts before generating rx int */
       __u16   speed_hi;
-       __u16   reserved2;
+       __u8    is_mdix;
 
 

Since this is specific to Ethernet over twisted-pair cable, could you please rename this to "eth_tp_mdix".

Will do for sure.

Quoted 16 lines
Quoted 14 lines
include/linux/ethtool.h +1 -0
+       __u8    reserved2;
       __u32   lp_advertising; /* Features the link partner advertises */
       __u32   reserved[2];

};

include/linux/ethtool.h +3 -0
@@ -632,6 +633,11 @@ struct ethtool_ops {
 #define AUTONEG_DISABLE                0x00
 #define AUTONEG_ENABLE         0x01
 +/* Mode MDI or MDI-X */
+#define MDI_INVALID 0x00
+#define MDI         0x01
+#define MDI_X       0x02
 
 

[...]

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

Similarly, please add the prefix "ETH_TP_" to these.

Sure.

Chaitanya, I have made the requested changes to the patch in my tree.

Thanks. I am very new to procedure of submitting kernel patches. Just want to make sure if this means that I not need to send another patch to netdev ?

Thanks,
Chaitanya

#18 lore raw

Re: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via ethtool change

Quoted 65 lines · Chaitanya Lala
Quoted 53 lines · Jeff Kirsher
Quoted 49 lines · Chaitanya Lala
Quoted 6 lines · Ben Hutchings

On Wed, 2009-05-27 at 16:15 -0700, Chaitanya Lala wrote:
[...]

Quoted 1 line
Quoted 17 lines
Quoted 5 lines
include/linux/ethtool.h +0 -0
index 380b042..b553bdb 100644
@@ -30,7 +30,8 @@ struct ethtool_cmd {
Quoted 7 lines

      __u32   maxtxpkt;       /* Tx pkts before generating tx int */ __u32   maxrxpkt;       /* Rx pkts before generating rx int */ __u16   speed_hi;
-       __u16   reserved2;
+       __u8    is_mdix;

Since this is specific to Ethernet over twisted-pair cable, could you please rename this to "eth_tp_mdix".

Will do for sure.

Quoted 20 lines
Quoted 17 lines

+       __u8    reserved2;
      __u32   lp_advertising; /* Features the link partner advertises */
      __u32   reserved[2];
 };

include/linux/ethtool.h +0 -0
@@ -632,6 +633,11 @@ struct ethtool_ops {
  #define AUTONEG_DISABLE                0x00
  #define AUTONEG_ENABLE         0x01

 +/* Mode MDI or MDI-X */

include/linux/ethtool.h +3 -0
+#define MDI_INVALID 0x00
+#define MDI         0x01
+#define MDI_X       0x02

[...]

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

Similarly, please add the prefix "ETH_TP_" to these.

Sure.

Chaitanya, I have made the requested changes to the patch in my tree.

Quoted 6 lines

Thanks. I am very new to procedure of submitting kernel patches. Just want to make sure if this means that I not need to send another patch to netdev ?

Thanks,
Chaitanya
--

When there are changes requested on a patch, yes the patch needs to be re-submitted to netdev. Since I will be pushing this patch along with other patches for Intel drivers to Dave once testing has been completed, there is no need for you to re-submit this patch. I have already sucked in the changes that Ben has requested into the patch that is in my tree.

Signature · 2 lines
Cheers,
Jeff
#19 lore raw

Re: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via ethtool change

Quoted 74 lines · Jeff Kirsher
Quoted 64 lines · Chaitanya Lala
Quoted 51 lines · Jeff Kirsher
Quoted 47 lines · Chaitanya Lala
Quoted 5 lines · Ben Hutchings

On Wed, 2009-05-27 at 16:15 -0700, Chaitanya Lala wrote:
[...]

Quoted 18 lines

include/linux/ethtool.h struct ethtool_cmd { · line 36

Quoted 13 lines
include/linux/ethtool.h +1 -1
index 380b042..b553bdb 100644
@@ -30,7 +30,8 @@ struct ethtool_cmd {
      __u32   maxtxpkt;       /* Tx pkts before generating tx int */
      __u32   maxrxpkt;       /* Rx pkts before generating rx int */
      __u16   speed_hi;
-       __u16   reserved2;
+       __u8    is_mdix;
 
 
 

Since this is specific to Ethernet over twisted-pair cable, could you please rename this to "eth_tp_mdix".

Will do for sure.

Quoted 18 lines
Quoted 16 lines
include/linux/ethtool.h +1 -0
+       __u8    reserved2;

__u32 lp_advertising; /* Features the link partner advertises
*/

      __u32   reserved[2];

};

include/linux/ethtool.h +3 -0
@@ -632,6 +633,11 @@ struct ethtool_ops {
 #define AUTONEG_DISABLE                0x00
 #define AUTONEG_ENABLE         0x01
 +/* Mode MDI or MDI-X */
+#define MDI_INVALID 0x00
+#define MDI         0x01
+#define MDI_X       0x02
 
 
 

[...]

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

Similarly, please add the prefix "ETH_TP_" to these.

Sure.

Chaitanya, I have made the requested changes to the patch in my tree.

Quoted 7 lines

Thanks. I am very new to procedure of submitting kernel patches. Just want to make sure if this means that I not need to send another patch to netdev ?

Thanks,
Chaitanya
--

Quoted 8 lines

When there are changes requested on a patch, yes the patch needs to be re-submitted to netdev. Since I will be pushing this patch along with other patches for Intel drivers to Dave once testing has been completed, there is no need for you to re-submit this patch. I have already sucked in the changes that Ben has requested into the patch that is in my tree.

Thanks for the clarification.

Chaitanya

#20 lore raw

Re-submit [PATCH 1/1] ethtool: Expose MDI-X status

In reply to Ben Hutchings

The MDI-X status is a useful tool for diagnosing network connectivity issues. We expose MDI-X status as a tri-state value status which drivers can optionally implement.

---
 ethtool-copy.h |    8 +++++++-
 ethtool.c      |   13 +++++++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)
ethtool-copy.h +7 -1
index 3ca4e2c..48fb1d3 100644
@@ -26,7 +26,8 @@ struct ethtool_cmd {
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
 	__u16	speed_hi;
-	__u16	reserved2;
+	__u8	is_mdix;
+	__u8	reserved2;
 	__u32	reserved[3];
 };
 
@@ -416,6 +417,11 @@ struct ethtool_rxnfc {
 #define AUTONEG_DISABLE		0x00
 #define AUTONEG_ENABLE		0x01
 
+/* Mode MDI or MDI-X */
+#define MDI_INVALID 0x00
+#define MDI         0x01
+#define MDI_X       0x02
+
 /* Wake-On-Lan options. */
 #define WAKE_PHY		(1 << 0)
 #define WAKE_UCAST		(1 << 1)
ethtool.c +13 -0
index 0110682..bf12168 100644
@@ -964,6 +964,19 @@ static int dump_ecmd(struct ethtool_cmd *ep)
 	fprintf(stdout, "	Auto-negotiation: %s\n",
 		(ep->autoneg == AUTONEG_DISABLE) ?
 		"off" : "on");
+
+	switch (ep->is_mdix) {
+	case MDI:
+		fprintf(stdout, "	MDI-X: off\n");
+		break;
+	case MDI_X:
+		fprintf(stdout, "	MDI-X: on\n");
+		break;
+	default:
+		fprintf(stdout, "	MDI-X: Unknown\n");
+		break;
+	}
+
 	return 0;
 }
 
Signature · 1 line
1.6.0.4
#21 lore raw

Re: Re-submit [PATCH 1/1] ethtool: Expose MDI-X status

Quoted 27 lines · Chaitanya Lala

The MDI-X status is a useful tool for diagnosing network connectivity issues. We expose MDI-X status as a tri-state value status which drivers can optionally implement.

---
 ethtool-copy.h |    8 +++++++-
 ethtool.c      |   13 +++++++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)
ethtool-copy.h +2 -1
index 3ca4e2c..48fb1d3 100644
@@ -26,7 +26,8 @@ struct ethtool_cmd {
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
 	__u16	speed_hi;
-	__u16	reserved2;
+	__u8	is_mdix;
+	__u8	reserved2;
 	__u32	reserved[3];
 };
 
@@ -416,6 +417,11 @@ struct ethtool_rxnfc {
 #define AUTONEG_DISABLE		0x00

ethtool-copy.h struct ethtool_rxnfc { · line 427

Quoted 10 lines
ethtool-copy.h +5 -0
 #define AUTONEG_ENABLE		0x01
 
+/* Mode MDI or MDI-X */
+#define MDI_INVALID 0x00
+#define MDI         0x01
+#define MDI_X       0x02
+
 /* Wake-On-Lan options. */
 #define WAKE_PHY		(1 << 0)
 #define WAKE_UCAST		(1 << 1)

[...]

This doesn't match the changes in <linux/ethtool.h>. I'm attaching the patch I applied locally for testing MDI-X reporting in sfc.

Ben.

Signature · 3 lines
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.
Quoted 1 line

From 236be78a8c527aa2ce92e19bc3031635304e30e9 Mon Sep 17 00:00:00 2001

From: Ben Hutchings <[email protected]>
Date: Wed, 10 Jun 2009 16:00:34 +0100
Subject: [PATCH] ethtool: Expose MDI-X status

Based on a patch by Chaitanya Lala <[email protected]>.

The MDI-X status is a useful tool for diagnosing network connectivity issues. We expose MDI-X status as a tri-state value status which drivers can optionally implement.

---
 ethtool-copy.h |    8 +++++++-
 ethtool.c      |   13 +++++++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)
ethtool-copy.h +7 -1
index d9bb957..c2cd082 100644
@@ -30,7 +30,8 @@ struct ethtool_cmd {
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
 	__u16	speed_hi;
-	__u16	reserved2;
+	__u8	eth_tp_mdix;
+	__u8	reserved2;
 	__u32	lp_advertising;	/* Features the link partner advertises */
 	__u32	reserved[2];
 };
@@ -504,6 +505,11 @@ struct ethtool_rxnfc {
 #define AUTONEG_DISABLE		0x00
 #define AUTONEG_ENABLE		0x01
 
+/* Mode MDI or MDI-X */
+#define ETH_TP_MDI_INVALID	0x00
+#define ETH_TP_MDI		0x01
+#define ETH_TP_MDI_X		0x02
+
 /* Wake-On-Lan options. */
 #define WAKE_PHY		(1 << 0)
 #define WAKE_UCAST		(1 << 1)
ethtool.c +13 -0
index a409e02..60c2371 100644
@@ -982,6 +982,19 @@ static int dump_ecmd(struct ethtool_cmd *ep)
 	fprintf(stdout, "	Auto-negotiation: %s\n",
 		(ep->autoneg == AUTONEG_DISABLE) ?
 		"off" : "on");
+
+	switch (ep->eth_tp_mdix) {
+	case ETH_TP_MDI:
+		fprintf(stdout, "	MDI-X: off\n");
+		break;
+	case ETH_TP_MDI_X:
+		fprintf(stdout, "	MDI-X: on\n");
+		break;
+	default:
+		fprintf(stdout, "	MDI-X: Unknown\n");
+		break;
+	}
+
 	return 0;
 }
 
Signature · 1 line
1.5.5
#22 lore raw

PATCH 1/1 e1000e: Expose MDI-X status via ethtool change

In reply to Ben Hutchings

Ethtool is a standard way of getting information about ethernet interfaces. We enhance ethtool kernel interface & e1000e to make the MDI-X status readable via ethtool in userspace.

---
 drivers/net/e1000e/ethtool.c |    8 ++++++++
 include/linux/ethtool.h      |    6 ++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
drivers/net/e1000e/ethtool.c +8 -0
index 4d25ede..8bbade1 100644
@@ -167,6 +167,14 @@ static int e1000_get_settings(struct net_device *netdev,
 
 	ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) ||
 			 hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
+
+	/* MDI-X => 2; MDI =>1; Invalid =>0 */
+	if ((hw->phy.media_type == e1000_media_type_copper) &&
+			!hw->mac.get_link_status)
+		ecmd->is_mdix = hw->phy.is_mdix ? MDI_X : MDI;
+	else
+		ecmd->is_mdix = MDI_INVALID;
+
 	return 0;
 }
 
include/linux/ethtool.h +6 -0
index 380b042..5211f59 100644
@@ -33,6 +33,7 @@ struct ethtool_cmd {
 	__u16	reserved2;
 	__u32	lp_advertising;	/* Features the link partner advertises */
 	__u32	reserved[2];
+	__u8	is_mdix;	/* MDI-X status tri-state value */
 };
 
 static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
@@ -632,6 +633,11 @@ struct ethtool_ops {
 #define AUTONEG_DISABLE		0x00
 #define AUTONEG_ENABLE		0x01
 
+/* Mode MDI or MDI-X */
+#define MDI_INVALID	0x00
+#define MDI		0x01
+#define MDI_X		0x02
+
 /* Wake-On-Lan options. */
 #define WAKE_PHY		(1 << 0)
 #define WAKE_UCAST		(1 << 1)
Signature · 1 line
1.6.0.4