From mboxrd@z Thu Jan  1 00:00:00 1970
From: Chaitanya Lala <clala@riverbed.com>
Subject: [PATCH 1/1] ethtool: Expose MDI-X status
Date: Fri, 22 May 2009 07:54:26 -0700
Message-ID: <20090522145426.GA8470@clala-laptop>
References: <F169D4F5E1F1974DBFAFABF47F60C10A33527C9D@orsmsx507.amr.corp.intel.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Cc: netdev@vger.kernel.org
To: jgarzik@pobox.com
Return-path: <netdev-owner@vger.kernel.org>
Received: from smtp2.riverbed.com ([206.169.144.7]:1176 "EHLO
	smtp2.riverbed.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1754590AbZEVOxv (ORCPT
	<rfc822;netdev@vger.kernel.org>); Fri, 22 May 2009 10:53:51 -0400
Content-Disposition: inline
In-Reply-To: <F169D4F5E1F1974DBFAFABF47F60C10A33527C9D@orsmsx507.amr.corp.intel.com>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

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.

Signed-off-by: Chaitanya Lala <clala@riverbed.com>
Signed-off-by: Arthur Jones <ajones@riverbed.com>
---
 ethtool-copy.h |    6 ++++++
 ethtool.c      |   13 +++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/ethtool-copy.h b/ethtool-copy.h
index 3ca4e2c..37bbeaf 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -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)
diff --git a/ethtool.c b/ethtool.c
index 0110682..bf12168 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -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;
 }
 
-- 
1.6.0.4


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Chaitanya Lala <clala@riverbed.com>
Subject: [net-next-2.6 PATCH 1/1] e1000e: Expose MDI-X status via ethtool
	change
Date: Fri, 22 May 2009 07:55:44 -0700
Message-ID: <20090522145544.GA8508@clala-laptop>
References: <F169D4F5E1F1974DBFAFABF47F60C10A33527C9D@orsmsx507.amr.corp.intel.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Cc: netdev@vger.kernel.org
To: jesse.brandeburg@intel.com
Return-path: <netdev-owner@vger.kernel.org>
Received: from smtp2.riverbed.com ([206.169.144.7]:62280 "EHLO
	smtp2.riverbed.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1757804AbZEVOzJ (ORCPT
	<rfc822;netdev@vger.kernel.org>); Fri, 22 May 2009 10:55:09 -0400
Content-Disposition: inline
In-Reply-To: <F169D4F5E1F1974DBFAFABF47F60C10A33527C9D@orsmsx507.amr.corp.intel.com>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

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.

Signed-off-by: Chaitanya Lala <clala@riverbed.com>
Signed-off-by: Arthur Jones <ajones@riverbed.com>
---
 drivers/net/e1000e/ethtool.c |    8 ++++++++
 include/linux/ethtool.h      |    6 ++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 4d25ede..8bbade1 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -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;
 }
 
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 380b042..0533d70 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -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)
-- 
1.6.0.4


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Stephen Hemminger <shemminger@vyatta.com>
Subject: Re: [PATCH 1/1] ethtool: Expose MDI-X status
Date: Fri, 22 May 2009 08:02:24 -0700
Message-ID: <20090522080224.73990f8a@nehalam>
References: <F169D4F5E1F1974DBFAFABF47F60C10A33527C9D@orsmsx507.amr.corp.intel.com>
	<20090522145426.GA8470@clala-laptop>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Cc: jgarzik@pobox.com, netdev@vger.kernel.org
To: Chaitanya Lala <clala@riverbed.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from mail.vyatta.com ([76.74.103.46]:52446 "EHLO mail.vyatta.com"
	rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP
	id S1753051AbZEVPC3 (ORCPT <rfc822;netdev@vger.kernel.org>);
	Fri, 22 May 2009 11:02:29 -0400
In-Reply-To: <20090522145426.GA8470@clala-laptop>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

On Fri, 22 May 2009 07:54:26 -0700
Chaitanya Lala <clala@riverbed.com> 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.
> 
> Signed-off-by: Chaitanya Lala <clala@riverbed.com>
> Signed-off-by: Arthur Jones <ajones@riverbed.com>
> ---
>  ethtool-copy.h |    6 ++++++
>  ethtool.c      |   13 +++++++++++++
>  2 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/ethtool-copy.h b/ethtool-copy.h
> index 3ca4e2c..37bbeaf 100644
> --- a/ethtool-copy.h
> +++ b/ethtool-copy.h
> @@ -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)?

-- 

From mboxrd@z Thu Jan  1 00:00:00 1970
From: Ben Hutchings <bhutchings@solarflare.com>
Subject: Re: [PATCH 1/1] ethtool: Expose MDI-X status
Date: Fri, 22 May 2009 16:03:30 +0100
Message-ID: <1243004610.3192.18.camel@achroite>
References: <F169D4F5E1F1974DBFAFABF47F60C10A33527C9D@orsmsx507.amr.corp.intel.com>
	 <20090522145426.GA8470@clala-laptop>
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Cc: jgarzik@pobox.com, netdev@vger.kernel.org
To: Chaitanya Lala <clala@riverbed.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from smarthost03.mail.zen.net.uk ([212.23.3.142]:49551 "EHLO
	smarthost03.mail.zen.net.uk" rhost-flags-OK-OK-OK-OK)
	by vger.kernel.org with ESMTP id S1757209AbZEVPDf (ORCPT
	<rfc822;netdev@vger.kernel.org>); Fri, 22 May 2009 11:03:35 -0400
In-Reply-To: <20090522145426.GA8470@clala-laptop>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

On Fri, 2009-05-22 at 07:54 -0700, Chaitanya Lala 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.
> 
> Signed-off-by: Chaitanya Lala <clala@riverbed.com>
> Signed-off-by: Arthur Jones <ajones@riverbed.com>
> ---
>  ethtool-copy.h |    6 ++++++
>  ethtool.c      |   13 +++++++++++++
>  2 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/ethtool-copy.h b/ethtool-copy.h
> index 3ca4e2c..37bbeaf 100644
> --- a/ethtool-copy.h
> +++ b/ethtool-copy.h
> @@ -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.

-- 
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.


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Ben Hutchings <bhutchings@solarflare.com>
Subject: Re: [net-next-2.6 PATCH 1/1] e1000e: Expose MDI-X status via
	ethtool change
Date: Fri, 22 May 2009 16:05:04 +0100
Message-ID: <1243004704.3192.21.camel@achroite>
References: <F169D4F5E1F1974DBFAFABF47F60C10A33527C9D@orsmsx507.amr.corp.intel.com>
	 <20090522145544.GA8508@clala-laptop>
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Cc: jesse.brandeburg@intel.com, netdev@vger.kernel.org
To: Chaitanya Lala <clala@riverbed.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from smarthost03.mail.zen.net.uk ([212.23.3.142]:33927 "EHLO
	smarthost03.mail.zen.net.uk" rhost-flags-OK-OK-OK-OK)
	by vger.kernel.org with ESMTP id S1750709AbZEVPFE (ORCPT
	<rfc822;netdev@vger.kernel.org>); Fri, 22 May 2009 11:05:04 -0400
In-Reply-To: <20090522145544.GA8508@clala-laptop>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

On Fri, 2009-05-22 at 07:55 -0700, Chaitanya Lala wrote:
> 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.
[...] 
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index 380b042..0533d70 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -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.

-- 
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.


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Chaitanya Lala <clala@riverbed.com>
Subject: Re: [net-next-2.6 PATCH 1/1] e1000e: Expose MDI-X status via	ethtool
 change
Date: Fri, 22 May 2009 08:24:25 -0700
Message-ID: <4A16C3A9.3070402@riverbed.com>
References: <F169D4F5E1F1974DBFAFABF47F60C10A33527C9D@orsmsx507.amr.corp.intel.com>	 <20090522145544.GA8508@clala-laptop> <1243004704.3192.21.camel@achroite>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: "jesse.brandeburg@intel.com" <jesse.brandeburg@intel.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
To: Ben Hutchings <bhutchings@solarflare.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from smtp2.riverbed.com ([206.169.144.7]:59020 "EHLO
	smtp2.riverbed.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1755700AbZEVPXt (ORCPT
	<rfc822;netdev@vger.kernel.org>); Fri, 22 May 2009 11:23:49 -0400
In-Reply-To: <1243004704.3192.21.camel@achroite>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

Ben Hutchings wrote:
> On Fri, 2009-05-22 at 07:55 -0700, Chaitanya Lala wrote:
>   
>> 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.
>>     
> [...] 
>   
>> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
>> index 380b042..0533d70 100644
>> --- a/include/linux/ethtool.h
>> +++ b/include/linux/ethtool.h
>> @@ -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.
>
>   
Then should I move it to the bottom ?

Chaitanya


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Chaitanya Lala <clala@riverbed.com>
Subject: [PATCH 1/1] ethtool: Expose MDI-X status
Date: Fri, 22 May 2009 10:18:50 -0700
Message-ID: <20090522171850.GA16751@clala-laptop>
References: <1243004704.3192.21.camel@achroite>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Cc: netdev@vger.kernel.org
To: jgarzik@pobox.com
Return-path: <netdev-owner@vger.kernel.org>
Received: from smtp1.riverbed.com ([206.169.144.12]:52130 "EHLO
	smtp1.riverbed.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1754985AbZEVRSP (ORCPT
	<rfc822;netdev@vger.kernel.org>); Fri, 22 May 2009 13:18:15 -0400
Content-Disposition: inline
In-Reply-To: <1243004704.3192.21.camel@achroite>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

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.

Signed-off-by: Chaitanya Lala <clala@riverbed.com>
Signed-off-by: Arthur Jones <ajones@riverbed.com>
---
 ethtool-copy.h |    6 ++++++
 ethtool.c      |   13 +++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/ethtool-copy.h b/ethtool-copy.h
index 3ca4e2c..d3e1524 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -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)
diff --git a/ethtool.c b/ethtool.c
index 0110682..bf12168 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -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;
 }
 
-- 
1.6.0.4


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Chaitanya Lala <clala@riverbed.com>
Subject: [net-next-2.6 PATCH 1/1] e1000e: Expose MDI-X status via ethtool
	change
Date: Fri, 22 May 2009 10:20:33 -0700
Message-ID: <20090522172033.GA16787@clala-laptop>
References: <1243004704.3192.21.camel@achroite>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Cc: netdev@vger.kernel.org
To: jeffrey.t.kirsher@intel.com
Return-path: <netdev-owner@vger.kernel.org>
Received: from smtp2.riverbed.com ([206.169.144.7]:29332 "EHLO
	smtp2.riverbed.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1755700AbZEVRT6 (ORCPT
	<rfc822;netdev@vger.kernel.org>); Fri, 22 May 2009 13:19:58 -0400
Content-Disposition: inline
In-Reply-To: <1243004704.3192.21.camel@achroite>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

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.

Signed-off-by: Chaitanya Lala <clala@riverbed.com>
Signed-off-by: Arthur Jones <ajones@riverbed.com>
---
 drivers/net/e1000e/ethtool.c |    8 ++++++++
 include/linux/ethtool.h      |    6 ++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 4d25ede..8bbade1 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -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;
 }
 
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 380b042..5211f59 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -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)
-- 
1.6.0.4


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Ben Hutchings <bhutchings@solarflare.com>
Subject: Re: [PATCH 1/1] ethtool: Expose MDI-X status
Date: Sat, 23 May 2009 02:04:37 +0100
Message-ID: <1243040677.16597.52.camel@deadeye>
References: <1243004704.3192.21.camel@achroite>
	 <20090522171850.GA16751@clala-laptop>
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Cc: jgarzik@pobox.com, netdev@vger.kernel.org
To: Chaitanya Lala <clala@riverbed.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:53104 "EHLO
	shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK)
	by vger.kernel.org with ESMTP id S1753764AbZEWBEp (ORCPT
	<rfc822;netdev@vger.kernel.org>); Fri, 22 May 2009 21:04:45 -0400
In-Reply-To: <20090522171850.GA16751@clala-laptop>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

On Fri, 2009-05-22 at 10:18 -0700, Chaitanya Lala 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.
> 
> Signed-off-by: Chaitanya Lala <clala@riverbed.com>
> Signed-off-by: Arthur Jones <ajones@riverbed.com>
> ---
>  ethtool-copy.h |    6 ++++++
>  ethtool.c      |   13 +++++++++++++
>  2 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/ethtool-copy.h b/ethtool-copy.h
> index 3ca4e2c..d3e1524 100644
> --- a/ethtool-copy.h
> +++ b/ethtool-copy.h
> @@ -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.

-- 
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.

From mboxrd@z Thu Jan  1 00:00:00 1970
From: Chaitanya Lala <clala@riverbed.com>
Subject: Re: [PATCH 1/1] ethtool: Expose MDI-X status
Date: Tue, 26 May 2009 08:34:52 -0700
Message-ID: <4A1C0C1C.8040401@riverbed.com>
References: <1243004704.3192.21.camel@achroite>	 <20090522171850.GA16751@clala-laptop> <1243040677.16597.52.camel@deadeye>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: "jgarzik@pobox.com" <jgarzik@pobox.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
To: Ben Hutchings <bhutchings@solarflare.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from smtp1.riverbed.com ([206.169.144.12]:18807 "EHLO
	smtp1.riverbed.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1750883AbZEZPeK (ORCPT
	<rfc822;netdev@vger.kernel.org>); Tue, 26 May 2009 11:34:10 -0400
In-Reply-To: <1243040677.16597.52.camel@deadeye>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

Ben Hutchings wrote:
> On Fri, 2009-05-22 at 10:18 -0700, Chaitanya Lala 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.
>>
>> Signed-off-by: Chaitanya Lala <clala@riverbed.com>
>> Signed-off-by: Arthur Jones <ajones@riverbed.com>
>> ---
>>  ethtool-copy.h |    6 ++++++
>>  ethtool.c      |   13 +++++++++++++
>>  2 files changed, 19 insertions(+), 0 deletions(-)
>>
>> diff --git a/ethtool-copy.h b/ethtool-copy.h
>> index 3ca4e2c..d3e1524 100644
>> --- a/ethtool-copy.h
>> +++ b/ethtool-copy.h
>> @@ -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.
>   
Hi,

In that case please suggest a way to do this.

Thanks,
Chaitanya
> Ben.
>
>   


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Ben Hutchings <bhutchings@solarflare.com>
Subject: Re: [PATCH 1/1] ethtool: Expose MDI-X status
Date: Tue, 26 May 2009 17:02:48 +0100
Message-ID: <1243353768.3188.2.camel@achroite>
References: <1243004704.3192.21.camel@achroite>
	 <20090522171850.GA16751@clala-laptop> <1243040677.16597.52.camel@deadeye>
	 <4A1C0C1C.8040401@riverbed.com>
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Cc: "jgarzik@pobox.com" <jgarzik@pobox.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
To: Chaitanya Lala <clala@riverbed.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from smarthost03.mail.zen.net.uk ([212.23.3.142]:39695 "EHLO
	smarthost03.mail.zen.net.uk" rhost-flags-OK-OK-OK-OK)
	by vger.kernel.org with ESMTP id S1751044AbZEZQCw (ORCPT
	<rfc822;netdev@vger.kernel.org>); Tue, 26 May 2009 12:02:52 -0400
In-Reply-To: <4A1C0C1C.8040401@riverbed.com>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

On Tue, 2009-05-26 at 08:34 -0700, Chaitanya Lala wrote:
> Ben Hutchings wrote:
> > On Fri, 2009-05-22 at 10:18 -0700, Chaitanya Lala 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.
> >>
> >> Signed-off-by: Chaitanya Lala <clala@riverbed.com>
> >> Signed-off-by: Arthur Jones <ajones@riverbed.com>
> >> ---
> >>  ethtool-copy.h |    6 ++++++
> >>  ethtool.c      |   13 +++++++++++++
> >>  2 files changed, 19 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/ethtool-copy.h b/ethtool-copy.h
> >> index 3ca4e2c..d3e1524 100644
> >> --- a/ethtool-copy.h
> >> +++ b/ethtool-copy.h
> >> @@ -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.
> >   
> 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.

-- 
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.


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Chaitanya Lala <clala@riverbed.com>
Subject: [PATCH 1/1] ethtool: Expose MDI-X status
Date: Wed, 27 May 2009 16:13:41 -0700
Message-ID: <20090527231341.GA19632@clala-laptop>
References: <1243353768.3188.2.camel@achroite>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Cc: netdev@vger.kernel.org
To: jgarzik@pobox.com
Return-path: <netdev-owner@vger.kernel.org>
Received: from smtp1.riverbed.com ([206.169.144.12]:28425 "EHLO
	smtp1.riverbed.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1752469AbZE0XM4 (ORCPT
	<rfc822;netdev@vger.kernel.org>); Wed, 27 May 2009 19:12:56 -0400
Content-Disposition: inline
In-Reply-To: <1243353768.3188.2.camel@achroite>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

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.

Signed-off-by: Chaitanya Lala <clala@riverbed.com>
Signed-off-by: Arthur Jones <ajones@riverbed.com>
---
 ethtool-copy.h |    8 +++++++-
 ethtool.c      |   13 +++++++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/ethtool-copy.h b/ethtool-copy.h
index 3ca4e2c..48fb1d3 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -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)
diff --git a/ethtool.c b/ethtool.c
index 0110682..bf12168 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -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;
 }
 
-- 
1.6.0.4


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Chaitanya Lala <clala@riverbed.com>
Subject: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via ethtool
	change
Date: Wed, 27 May 2009 16:15:42 -0700
Message-ID: <20090527231542.GA19664@clala-laptop>
References: <1243353768.3188.2.camel@achroite>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Cc: netdev@vger.kernel.org
To: jeffrey.t.kirsher@intel.com
Return-path: <netdev-owner@vger.kernel.org>
Received: from smtp1.riverbed.com ([206.169.144.12]:39935 "EHLO
	smtp1.riverbed.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1756456AbZE0XO4 (ORCPT
	<rfc822;netdev@vger.kernel.org>); Wed, 27 May 2009 19:14:56 -0400
Content-Disposition: inline
In-Reply-To: <1243353768.3188.2.camel@achroite>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

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.

Signed-off-by: Chaitanya Lala <clala@riverbed.com>
Signed-off-by: Arthur Jones <ajones@riverbed.com>
---
 drivers/net/e1000e/ethtool.c |    8 ++++++++
 include/linux/ethtool.h      |    8 +++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 4d25ede..b6aea6b 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -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;
 }
 
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 380b042..b553bdb 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -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)
-- 
1.6.0.4


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: Re: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via ethtool
	change
Date: Tue, 2 Jun 2009 16:02:23 -0700
Message-ID: <9929d2390906021602o34ad0814u129c97e9b84886d2@mail.gmail.com>
References: <1243353768.3188.2.camel@achroite>
	 <20090527231542.GA19664@clala-laptop>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: QUOTED-PRINTABLE
Cc: netdev@vger.kernel.org
To: Chaitanya Lala <clala@riverbed.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from an-out-0708.google.com ([209.85.132.248]:10779 "EHLO
	an-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1754318AbZFBXCX convert rfc822-to-8bit (ORCPT
	<rfc822;netdev@vger.kernel.org>); Tue, 2 Jun 2009 19:02:23 -0400
Received: by an-out-0708.google.com with SMTP id d40so17479474and.1
        for <netdev@vger.kernel.org>; Tue, 02 Jun 2009 16:02:24 -0700 (PDT)
In-Reply-To: <20090527231542.GA19664@clala-laptop>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

On Wed, May 27, 2009 at 4:15 PM, Chaitanya Lala <clala@riverbed.com> wr=
ote:
> 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.
>
> Signed-off-by: Chaitanya Lala <clala@riverbed.com>
> Signed-off-by: Arthur Jones <ajones@riverbed.com>
> ---
> =C2=A0drivers/net/e1000e/ethtool.c | =C2=A0 =C2=A08 ++++++++
> =C2=A0include/linux/ethtool.h =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A08 ++=
+++++-
> =C2=A02 files changed, 15 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtoo=
l.c
> index 4d25ede..b6aea6b 100644
> --- a/drivers/net/e1000e/ethtool.c
> +++ b/drivers/net/e1000e/ethtool.c
> @@ -167,6 +167,14 @@ static int e1000_get_settings(struct net_device =
*netdev,
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0ecmd->autoneg =3D ((hw->phy.media_type =3D=
=3D e1000_media_type_fiber) ||
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
> +
> + =C2=A0 =C2=A0 =C2=A0 /* MDI-X =3D> 2; MDI =3D>1; Invalid =3D>0 */
> + =C2=A0 =C2=A0 =C2=A0 if ((hw->phy.media_type =3D=3D e1000_media_typ=
e_copper) &&
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 !hw->mac.get_link_=
status)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ecmd->is_mdix =3D =
hw->phy.is_mdix ? MDI_X : MDI;
> + =C2=A0 =C2=A0 =C2=A0 else
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ecmd->is_mdix =3D =
MDI_INVALID;
> +
> =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
> =C2=A0}
>
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index 380b042..b553bdb 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -30,7 +30,8 @@ struct ethtool_cmd {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0__u32 =C2=A0 maxtxpkt; =C2=A0 =C2=A0 =C2=A0=
 /* Tx pkts before generating tx int */
> =C2=A0 =C2=A0 =C2=A0 =C2=A0__u32 =C2=A0 maxrxpkt; =C2=A0 =C2=A0 =C2=A0=
 /* Rx pkts before generating rx int */
> =C2=A0 =C2=A0 =C2=A0 =C2=A0__u16 =C2=A0 speed_hi;
> - =C2=A0 =C2=A0 =C2=A0 __u16 =C2=A0 reserved2;
> + =C2=A0 =C2=A0 =C2=A0 __u8 =C2=A0 =C2=A0is_mdix;
> + =C2=A0 =C2=A0 =C2=A0 __u8 =C2=A0 =C2=A0reserved2;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0__u32 =C2=A0 lp_advertising; /* Features t=
he link partner advertises */
> =C2=A0 =C2=A0 =C2=A0 =C2=A0__u32 =C2=A0 reserved[2];
> =C2=A0};
> @@ -632,6 +633,11 @@ struct ethtool_ops {
> =C2=A0#define AUTONEG_DISABLE =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A00x00
> =C2=A0#define AUTONEG_ENABLE =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x01
>
> +/* Mode MDI or MDI-X */
> +#define MDI_INVALID 0x00
> +#define MDI =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x01
> +#define MDI_X =C2=A0 =C2=A0 =C2=A0 0x02
> +
> =C2=A0/* Wake-On-Lan options. */
> =C2=A0#define WAKE_PHY =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 (1 << 0)
> =C2=A0#define WAKE_UCAST =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (1=
 << 1)
> --
> 1.6.0.4
>

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

--=20
Cheers,
Jeff

From mboxrd@z Thu Jan  1 00:00:00 1970
From: Ben Hutchings <bhutchings@solarflare.com>
Subject: Re: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via
	ethtool change
Date: Wed, 03 Jun 2009 18:34:22 +0100
Message-ID: <1244050462.3191.14.camel@achroite>
References: <1243353768.3188.2.camel@achroite>
	 <20090527231542.GA19664@clala-laptop>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: QUOTED-PRINTABLE
Cc: jeffrey.t.kirsher@intel.com, netdev@vger.kernel.org
To: Chaitanya Lala <clala@riverbed.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from smarthost01.mail.zen.net.uk ([212.23.3.140]:34096 "EHLO
	smarthost01.mail.zen.net.uk" rhost-flags-OK-OK-OK-OK)
	by vger.kernel.org with ESMTP id S1753082AbZFCRe0 (ORCPT
	<rfc822;netdev@vger.kernel.org>); Wed, 3 Jun 2009 13:34:26 -0400
In-Reply-To: <20090527231542.GA19664@clala-laptop>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

On Wed, 2009-05-27 at 16:15 -0700, Chaitanya Lala wrote:
[...]
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index 380b042..b553bdb 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -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=EF=BB=BF twisted-pair cable, co=
uld you
please rename this to "eth_tp_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
> =20
> +/* 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.

--=20
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.


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Chaitanya Lala <clala@riverbed.com>
Subject: Re: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via	ethtool
 change
Date: Wed, 03 Jun 2009 10:45:32 -0700
Message-ID: <4A26B6BC.40605@riverbed.com>
References: <1243353768.3188.2.camel@achroite>	 <20090527231542.GA19664@clala-laptop> <1244050462.3191.14.camel@achroite>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8;
	format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE
Cc: "jeffrey.t.kirsher@intel.com" <jeffrey.t.kirsher@intel.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
To: Ben Hutchings <bhutchings@solarflare.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from smtp2.riverbed.com ([206.169.144.7]:36622 "EHLO
	smtp2.riverbed.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1750958AbZFCRok (ORCPT
	<rfc822;netdev@vger.kernel.org>); Wed, 3 Jun 2009 13:44:40 -0400
In-Reply-To: <1244050462.3191.14.camel@achroite>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

Ben Hutchings wrote:
> On Wed, 2009-05-27 at 16:15 -0700, Chaitanya Lala wrote:
> [...]
>  =20
>> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
>> index 380b042..b553bdb 100644
>> --- a/include/linux/ethtool.h
>> +++ b/include/linux/ethtool.h
>> @@ -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;
>>    =20
>
> Since this is specific to Ethernet over=EF=BB=BF twisted-pair cable, =
could you
> please rename this to "eth_tp_mdix".
>  =20
Will do for sure.
>  =20
>> +	__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
>> =20
>> +/* Mode MDI or MDI-X */
>> +#define MDI_INVALID 0x00
>> +#define MDI         0x01
>> +#define MDI_X       0x02
>>    =20
> [...]
>
> Similarly, please add the prefix "ETH_TP_" to these.
>  =20
Sure.
> Ben.
>
>  =20


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: Re: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via ethtool
	change
Date: Wed, 3 Jun 2009 14:04:27 -0700
Message-ID: <9929d2390906031404j51d9d158i319ba84121212a6e@mail.gmail.com>
References: <1243353768.3188.2.camel@achroite>
	 <20090527231542.GA19664@clala-laptop>
	 <1244050462.3191.14.camel@achroite> <4A26B6BC.40605@riverbed.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: QUOTED-PRINTABLE
Cc: Ben Hutchings <bhutchings@solarflare.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
To: Chaitanya Lala <clala@riverbed.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from yw-out-2324.google.com ([74.125.46.31]:61651 "EHLO
	yw-out-2324.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1752614AbZFCVE0 convert rfc822-to-8bit (ORCPT
	<rfc822;netdev@vger.kernel.org>); Wed, 3 Jun 2009 17:04:26 -0400
Received: by yw-out-2324.google.com with SMTP id 5so144821ywb.1
        for <netdev@vger.kernel.org>; Wed, 03 Jun 2009 14:04:28 -0700 (PDT)
In-Reply-To: <4A26B6BC.40605@riverbed.com>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

On Wed, Jun 3, 2009 at 10:45 AM, Chaitanya Lala <clala@riverbed.com> wr=
ote:
> Ben Hutchings wrote:
>>
>> On Wed, 2009-05-27 at 16:15 -0700, Chaitanya Lala wrote:
>> [...]
>>
>>>
>>> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
>>> index 380b042..b553bdb 100644
>>> --- a/include/linux/ethtool.h
>>> +++ b/include/linux/ethtool.h
>>> @@ -30,7 +30,8 @@ struct ethtool_cmd {
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0__u32 =C2=A0 maxtxpkt; =C2=A0 =C2=A0 =C2=
=A0 /* Tx pkts before generating tx int */
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0__u32 =C2=A0 maxrxpkt; =C2=A0 =C2=A0 =C2=
=A0 /* Rx pkts before generating rx int */
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0__u16 =C2=A0 speed_hi;
>>> - =C2=A0 =C2=A0 =C2=A0 __u16 =C2=A0 reserved2;
>>> + =C2=A0 =C2=A0 =C2=A0 __u8 =C2=A0 =C2=A0is_mdix;
>>>
>>
>> Since this is specific to Ethernet over=EF=BB=BF twisted-pair cable,=
 could you
>> please rename this to "eth_tp_mdix".
>>
>
> Will do for sure.
>>
>>
>>>
>>> + =C2=A0 =C2=A0 =C2=A0 __u8 =C2=A0 =C2=A0reserved2;
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0__u32 =C2=A0 lp_advertising; /* Features=
 the link partner advertises */
>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0__u32 =C2=A0 reserved[2];
>>> =C2=A0};
>>> @@ -632,6 +633,11 @@ struct ethtool_ops {
>>> =C2=A0#define AUTONEG_DISABLE =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A00x00
>>> =C2=A0#define AUTONEG_ENABLE =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x01
>>> =C2=A0+/* Mode MDI or MDI-X */
>>> +#define MDI_INVALID 0x00
>>> +#define MDI =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x01
>>> +#define MDI_X =C2=A0 =C2=A0 =C2=A0 0x02
>>>
>>
>> [...]
>>
>> Similarly, please add the prefix "ETH_TP_" to these.
>>
>
> Sure.

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

--=20
Cheers,
Jeff

From mboxrd@z Thu Jan  1 00:00:00 1970
From: Chaitanya Lala <clala@riverbed.com>
Subject: Re: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via ethtool
 	change
Date: Wed, 03 Jun 2009 14:19:11 -0700
Message-ID: <4A26E8CF.50700@riverbed.com>
References: <1243353768.3188.2.camel@achroite>	 <20090527231542.GA19664@clala-laptop>	 <1244050462.3191.14.camel@achroite> <4A26B6BC.40605@riverbed.com> <9929d2390906031404j51d9d158i319ba84121212a6e@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8;
	format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE
Cc: Ben Hutchings <bhutchings@solarflare.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from smtp1.riverbed.com ([206.169.144.12]:46185 "EHLO
	smtp1.riverbed.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1752512AbZFCVSQ (ORCPT
	<rfc822;netdev@vger.kernel.org>); Wed, 3 Jun 2009 17:18:16 -0400
In-Reply-To: <9929d2390906031404j51d9d158i319ba84121212a6e@mail.gmail.com>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

Jeff Kirsher wrote:
> On Wed, Jun 3, 2009 at 10:45 AM, Chaitanya Lala <clala@riverbed.com> =
wrote:
>  =20
>> Ben Hutchings wrote:
>>    =20
>>> On Wed, 2009-05-27 at 16:15 -0700, Chaitanya Lala wrote:
>>> [...]
>>>
>>>      =20
>>>> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
>>>> index 380b042..b553bdb 100644
>>>> --- a/include/linux/ethtool.h
>>>> +++ b/include/linux/ethtool.h
>>>> @@ -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;
>>>>
>>>>        =20
>>> Since this is specific to Ethernet over=EF=BB=BF twisted-pair cable=
, could you
>>> please rename this to "eth_tp_mdix".
>>>
>>>      =20
>> Will do for sure.
>>    =20
>>>      =20
>>>> +       __u8    reserved2;
>>>>        __u32   lp_advertising; /* Features the link partner advert=
ises */
>>>>        __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
>>>>
>>>>        =20
>>> [...]
>>>
>>> Similarly, please add the prefix "ETH_TP_" to these.
>>>
>>>      =20
>> Sure.
>>    =20
>
> Chaitanya, I have made the requested changes to the patch in my tree.
>
>  =20
Thanks. I am very new to procedure of submitting kernel patches. Just=20
want to make sure if this means that I not need to send another patch t=
o=20
netdev ?

Thanks,
Chaitanya

From mboxrd@z Thu Jan  1 00:00:00 1970
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: Re: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via ethtool
	change
Date: Wed, 3 Jun 2009 14:31:32 -0700
Message-ID: <9929d2390906031431t44de3203rf35500024af541aa@mail.gmail.com>
References: <1243353768.3188.2.camel@achroite>
	 <20090527231542.GA19664@clala-laptop>
	 <1244050462.3191.14.camel@achroite> <4A26B6BC.40605@riverbed.com>
	 <9929d2390906031404j51d9d158i319ba84121212a6e@mail.gmail.com>
	 <4A26E8CF.50700@riverbed.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: QUOTED-PRINTABLE
Cc: Ben Hutchings <bhutchings@solarflare.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
To: Chaitanya Lala <clala@riverbed.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from an-out-0708.google.com ([209.85.132.248]:13401 "EHLO
	an-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1751237AbZFCVbb convert rfc822-to-8bit (ORCPT
	<rfc822;netdev@vger.kernel.org>); Wed, 3 Jun 2009 17:31:31 -0400
Received: by an-out-0708.google.com with SMTP id d40so376239and.1
        for <netdev@vger.kernel.org>; Wed, 03 Jun 2009 14:31:32 -0700 (PDT)
In-Reply-To: <4A26E8CF.50700@riverbed.com>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

On Wed, Jun 3, 2009 at 2:19 PM, Chaitanya Lala <clala@riverbed.com> wro=
te:
> Jeff Kirsher wrote:
>>
>> On Wed, Jun 3, 2009 at 10:45 AM, Chaitanya Lala <clala@riverbed.com>
>> wrote:
>>
>>>
>>> Ben Hutchings wrote:
>>>
>>>>
>>>> On Wed, 2009-05-27 at 16:15 -0700, Chaitanya Lala wrote:
>>>> [...]
>>>>
>>>>
>>>>>
>>>>> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
>>>>> index 380b042..b553bdb 100644
>>>>> --- a/include/linux/ethtool.h
>>>>> +++ b/include/linux/ethtool.h
>>>>> @@ -30,7 +30,8 @@ struct ethtool_cmd {
>>>>> =C2=A0 =C2=A0 =C2=A0 __u32 =C2=A0 maxtxpkt; =C2=A0 =C2=A0 =C2=A0 =
/* Tx pkts before generating tx int */
>>>>> =C2=A0 =C2=A0 =C2=A0 __u32 =C2=A0 maxrxpkt; =C2=A0 =C2=A0 =C2=A0 =
/* Rx pkts before generating rx int */
>>>>> =C2=A0 =C2=A0 =C2=A0 __u16 =C2=A0 speed_hi;
>>>>> - =C2=A0 =C2=A0 =C2=A0 __u16 =C2=A0 reserved2;
>>>>> + =C2=A0 =C2=A0 =C2=A0 __u8 =C2=A0 =C2=A0is_mdix;
>>>>>
>>>>>
>>>>
>>>> Since this is specific to Ethernet over=EF=BB=BF twisted-pair cabl=
e, could you
>>>> please rename this to "eth_tp_mdix".
>>>>
>>>>
>>>
>>> Will do for sure.
>>>
>>>>
>>>>
>>>>>
>>>>> + =C2=A0 =C2=A0 =C2=A0 __u8 =C2=A0 =C2=A0reserved2;
>>>>> =C2=A0 =C2=A0 =C2=A0 __u32 =C2=A0 lp_advertising; /* Features the=
 link partner advertises
>>>>> */
>>>>> =C2=A0 =C2=A0 =C2=A0 __u32 =C2=A0 reserved[2];
>>>>> =C2=A0};
>>>>> @@ -632,6 +633,11 @@ struct ethtool_ops {
>>>>> =C2=A0#define AUTONEG_DISABLE =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A00x00
>>>>> =C2=A0#define AUTONEG_ENABLE =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x01
>>>>> =C2=A0+/* Mode MDI or MDI-X */
>>>>> +#define MDI_INVALID 0x00
>>>>> +#define MDI =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x01
>>>>> +#define MDI_X =C2=A0 =C2=A0 =C2=A0 0x02
>>>>>
>>>>>
>>>>
>>>> [...]
>>>>
>>>> Similarly, please add the prefix "ETH_TP_" to these.
>>>>
>>>>
>>>
>>> Sure.
>>>
>>
>> Chaitanya, I have made the requested changes to the patch in my tree=
=2E
>>
>>
>
> 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 n=
etdev ?
>
> 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.

--=20
Cheers,
Jeff

From mboxrd@z Thu Jan  1 00:00:00 1970
From: Chaitanya Lala <clala@riverbed.com>
Subject: Re: [PATCH net-next-2.6 1/1] e1000e: Expose MDI-X status via ethtool
 	change
Date: Wed, 03 Jun 2009 14:41:50 -0700
Message-ID: <4A26EE1E.7070402@riverbed.com>
References: <1243353768.3188.2.camel@achroite>	 <20090527231542.GA19664@clala-laptop>	 <1244050462.3191.14.camel@achroite> <4A26B6BC.40605@riverbed.com>	 <9929d2390906031404j51d9d158i319ba84121212a6e@mail.gmail.com>	 <4A26E8CF.50700@riverbed.com> <9929d2390906031431t44de3203rf35500024af541aa@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8;
	format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE
Cc: Ben Hutchings <bhutchings@solarflare.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from smtp1.riverbed.com ([206.169.144.12]:39008 "EHLO
	smtp1.riverbed.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1755298AbZFCVlH (ORCPT
	<rfc822;netdev@vger.kernel.org>); Wed, 3 Jun 2009 17:41:07 -0400
In-Reply-To: <9929d2390906031431t44de3203rf35500024af541aa@mail.gmail.com>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

Jeff Kirsher wrote:
> On Wed, Jun 3, 2009 at 2:19 PM, Chaitanya Lala <clala@riverbed.com> w=
rote:
>  =20
>> Jeff Kirsher wrote:
>>    =20
>>> On Wed, Jun 3, 2009 at 10:45 AM, Chaitanya Lala <clala@riverbed.com=
>
>>> wrote:
>>>
>>>      =20
>>>> Ben Hutchings wrote:
>>>>
>>>>        =20
>>>>> On Wed, 2009-05-27 at 16:15 -0700, Chaitanya Lala wrote:
>>>>> [...]
>>>>>
>>>>>
>>>>>          =20
>>>>>> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
>>>>>> index 380b042..b553bdb 100644
>>>>>> --- a/include/linux/ethtool.h
>>>>>> +++ b/include/linux/ethtool.h
>>>>>> @@ -30,7 +30,8 @@ struct ethtool_cmd {
>>>>>>       __u32   maxtxpkt;       /* Tx pkts before generating tx in=
t */
>>>>>>       __u32   maxrxpkt;       /* Rx pkts before generating rx in=
t */
>>>>>>       __u16   speed_hi;
>>>>>> -       __u16   reserved2;
>>>>>> +       __u8    is_mdix;
>>>>>>
>>>>>>
>>>>>>            =20
>>>>> Since this is specific to Ethernet over=EF=BB=BF twisted-pair cab=
le, could you
>>>>> please rename this to "eth_tp_mdix".
>>>>>
>>>>>
>>>>>          =20
>>>> Will do for sure.
>>>>
>>>>        =20
>>>>>          =20
>>>>>> +       __u8    reserved2;
>>>>>>       __u32   lp_advertising; /* Features the link partner adver=
tises
>>>>>> */
>>>>>>       __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
>>>>>>
>>>>>>
>>>>>>            =20
>>>>> [...]
>>>>>
>>>>> Similarly, please add the prefix "ETH_TP_" to these.
>>>>>
>>>>>
>>>>>          =20
>>>> Sure.
>>>>
>>>>        =20
>>> Chaitanya, I have made the requested changes to the patch in my tre=
e.
>>>
>>>
>>>      =20
>> Thanks. I am very new to procedure of submitting kernel patches. Jus=
t want
>> to make sure if this means that I not need to send another patch to =
netdev ?
>>
>> Thanks,
>> Chaitanya
>> --
>>    =20
>
> When there are changes requested on a patch, yes the patch needs to b=
e
> re-submitted to netdev.  Since I will be pushing this patch along wit=
h
> 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.
>
>  =20
Thanks for the clarification.

Chaitanya


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Chaitanya Lala <clala@riverbed.com>
Subject: Re-submit [PATCH 1/1] ethtool: Expose MDI-X status
Date: Wed, 10 Jun 2009 12:11:07 -0700
Message-ID: <20090610191106.GA5930@clala-laptop>
References: <1243353768.3188.2.camel@achroite>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Cc: jeff@garzik.org, netdev@vger.kernel.org
To: jgarzik@redhat.com
Return-path: <netdev-owner@vger.kernel.org>
Received: from smtp2.riverbed.com ([206.169.144.7]:38536 "EHLO
	smtp2.riverbed.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1755123AbZFJTKB (ORCPT
	<rfc822;netdev@vger.kernel.org>); Wed, 10 Jun 2009 15:10:01 -0400
Content-Disposition: inline
In-Reply-To: <1243353768.3188.2.camel@achroite>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>

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.

Signed-off-by: Chaitanya Lala <clala@riverbed.com>
Signed-off-by: Arthur Jones <ajones@riverbed.com>
---
 ethtool-copy.h |    8 +++++++-
 ethtool.c      |   13 +++++++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/ethtool-copy.h b/ethtool-copy.h
index 3ca4e2c..48fb1d3 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -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)
diff --git a/ethtool.c b/ethtool.c
index 0110682..bf12168 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -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;
 }
 
-- 
1.6.0.4


From mboxrd@z Thu Jan  1 00:00:00 1970
From: Ben Hutchings <bhutchings@solarflare.com>
Subject: Re: Re-submit [PATCH 1/1] ethtool: Expose MDI-X status
Date: Wed, 10 Jun 2009 20:22:15 +0100
Message-ID: <1244661735.2848.21.camel@achroite>
References: <1243353768.3188.2.camel@achroite>
	 <20090610191106.GA5930@clala-laptop>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="=-2Yd5+5N+QQSzhlhYXN7E"
Cc: jgarzik@redhat.com, jeff@garzik.org, netdev@vger.kernel.org
To: Chaitanya Lala <clala@riverbed.com>
Return-path: <netdev-owner@vger.kernel.org>
Received: from smarthost02.mail.zen.net.uk ([212.23.3.141]:41437 "EHLO
	smarthost02.mail.zen.net.uk" rhost-flags-OK-OK-OK-OK)
	by vger.kernel.org with ESMTP id S1755123AbZFJTW1 (ORCPT
	<rfc822;netdev@vger.kernel.org>); Wed, 10 Jun 2009 15:22:27 -0400
In-Reply-To: <20090610191106.GA5930@clala-laptop>
Sender: netdev-owner@vger.kernel.org
List-ID: <netdev.vger.kernel.org>


--=-2Yd5+5N+QQSzhlhYXN7E
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Wed, 2009-06-10 at 12:11 -0700, Chaitanya Lala 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.
> 
> Signed-off-by: Chaitanya Lala <clala@riverbed.com>
> Signed-off-by: Arthur Jones <ajones@riverbed.com>
> ---
>  ethtool-copy.h |    8 +++++++-
>  ethtool.c      |   13 +++++++++++++
>  2 files changed, 20 insertions(+), 1 deletions(-)
> 
> diff --git a/ethtool-copy.h b/ethtool-copy.h
> index 3ca4e2c..48fb1d3 100644
> --- a/ethtool-copy.h
> +++ b/ethtool-copy.h
> @@ -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)
[...]

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.

-- 
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.

--=-2Yd5+5N+QQSzhlhYXN7E
Content-Disposition: attachment; filename=0001-ethtool-Expose-MDI-X-status.patch
Content-Type: application/mbox; name=0001-ethtool-Expose-MDI-X-status.patch
Content-Transfer-Encoding: 7bit

>>From 236be78a8c527aa2ce92e19bc3031635304e30e9 Mon Sep 17 00:00:00 2001
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Wed, 10 Jun 2009 16:00:34 +0100
Subject: [PATCH] ethtool: Expose MDI-X status

Based on a patch by Chaitanya Lala <clala@riverbed.com>.

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.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 ethtool-copy.h |    8 +++++++-
 ethtool.c      |   13 +++++++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/ethtool-copy.h b/ethtool-copy.h
index d9bb957..c2cd082 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -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)
diff --git a/ethtool.c b/ethtool.c
index a409e02..60c2371 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -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;
 }
 
-- 
1.5.5


--=-2Yd5+5N+QQSzhlhYXN7E--


