From: Jeff Kirsher <hidden> Date: 2012-07-20 21:43:54
This series contains updates to ethtool, e1000, e1000e and igb with
regards to the new MDI ethtool support patches submitted earlier.
The following are changes since commit fa0afcd10951afad2022dda09777d2bf70cdab3d:
atl1c: fix issue of io access mode for AR8152 v2.1
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next master
Bruce W Allan (1):
e1000e: implement 82577/579 MDI setting support
Jesse Brandeburg (5):
ethtool.h: MDI setting support
igb: implement 580 MDI setting support
e1000: configure and read MDI settings
e1000e: implement MDI/MDI-X control
igb: update to allow reading/setting MDI state
drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 34 +++++++++++++++++++
drivers/net/ethernet/intel/e1000/e1000_main.c | 4 +++
drivers/net/ethernet/intel/e1000e/ethtool.c | 39 +++++++++++++++++++---
drivers/net/ethernet/intel/e1000e/phy.c | 31 +++++++++++++++--
drivers/net/ethernet/intel/igb/e1000_phy.c | 29 ++++++++++++++--
drivers/net/ethernet/intel/igb/e1000_phy.h | 5 +--
drivers/net/ethernet/intel/igb/igb_ethtool.c | 37 ++++++++++++++++++++
drivers/net/ethernet/intel/igb/igb_main.c | 4 +++
include/linux/ethtool.h | 17 ++++++----
9 files changed, 184 insertions(+), 16 deletions(-)
--
1.7.10.4
From: Jeff Kirsher <hidden> Date: 2012-07-20 21:43:54
From: Bruce W Allan <redacted>
in order for e1000e to support MDI setting support via
ethtool this code is needed to allow setting the MDI state
via software.
This is in regards to the related ethtool patch and
fixes bugzilla.kernel.org bug 11998
Signed-off-by: Bruce W Allan <redacted>
Signed-off-by: Jesse Brandeburg <redacted>
Tested-by: Aaron Brown <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/e1000e/phy.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
From: Jeff Kirsher <hidden> Date: 2012-07-20 21:43:54
From: Jesse Brandeburg <redacted>
This change modifies the core ethtool struct to allow a driver to
support setting of MDI/MDI-X state for twisted pair wiring. This
change uses a previously reserved u8 and should not change any
binary compatibility of ethtool.
Also as per Ben Hutchings' suggestion, the capabilities are
stored in a separate byte so the driver can report if it supports
changing settings.
see thread: http://kerneltrap.org/mailarchive/linux-netdev/2010/11/17/6289820/thread
see ethtool patches titled:
ethtool: allow setting MDI-X state
Signed-off-by: Jesse Brandeburg <redacted>
CC: Ben Hutchings <redacted>
Tested-by: Aaron Brown <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
include/linux/ethtool.h | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
@@ -45,8 +45,10 @@ struct ethtool_cmd {*bits)inMbps.Pleaseuse*ethtool_cmd_speed()/_set()to*accessit*/-__u8eth_tp_mdix;-__u8reserved2;+__u8eth_tp_mdix;/* twisted pair MDI-X status */+__u8eth_tp_mdix_ctrl;/* twisted pair MDI-X control, when set,+*linkshouldberenegotiatedifnecessary+*/__u32lp_advertising;/* Features the link partner advertises */__u32reserved[2];};
From: Jeff Kirsher <hidden> Date: 2012-07-20 21:43:55
From: Jesse Brandeburg <redacted>
In order for igb to support MDI setting support via
ethtool this code is needed to allow setting the MDI state
via software.
This is in regards to the related ethtool patch
Signed-off-by: Jesse Brandeburg <redacted>
Tested-by: Jeff Pieper <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/igb/e1000_phy.c | 29 ++++++++++++++++++++++++++--
drivers/net/ethernet/intel/igb/e1000_phy.h | 5 +++--
2 files changed, 30 insertions(+), 4 deletions(-)
From: Jeff Kirsher <hidden> Date: 2012-07-20 21:43:56
From: Jesse Brandeburg <redacted>
Some users report issues with link failing when connected to certain
switches. This gives the user the ability to control the MDI state
from the driver, allowing users to work around some improperly
behaving switches.
Current get_settings behavior slightly changes in that now when link
is down get_settings will return the MDI state of the last link
because get_settings needs to succeed to allow the set to work even
when link is down.
Forcing in this driver is for now only allowed when auto-neg is
enabled.
This is in regards to the related ethtool app patch and
bugzilla.kernel.org bug 11998
Signed-off-by: Jesse Brandeburg <redacted>
CC: bruce.w.allan@intel.com
CC: n.poppelier@xs4all.nl
CC: bastien@durel.org
CC: jsveiga@it.eng.br
Tested-by: Aaron Brown <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/e1000e/ethtool.c | 39 ++++++++++++++++++++++++---
1 file changed, 35 insertions(+), 4 deletions(-)
@@ -241,6 +240,10 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx)default:gotoerr_inval;}++/* clear MDI, MDI(-X) override is only allowed when autoneg enabled */+adapter->hw.phy.mdix=AUTO_ALL_MODES;+return0;err_inval:
@@ -264,6 +267,22 @@ static int e1000_set_settings(struct net_device *netdev,return-EINVAL;}+/*+*MDIsettingisonlyallowedwhenautonegenabledbecause+*somehardwaredoesn'tallowMDIsettingwhenspeedor+*duplexisforced.+*/+if(ecmd->eth_tp_mdix_ctrl){+if(hw->phy.media_type!=e1000_media_type_copper)+return-EOPNOTSUPP;++if((ecmd->eth_tp_mdix_ctrl!=ETH_TP_MDI_AUTO)&&+(ecmd->autoneg!=AUTONEG_ENABLE)){+e_err("forcing MDI/MDI-X state is not supported when link speed and/or duplex are forced\n");+return-EINVAL;+}+}+while(test_and_set_bit(__E1000_RESETTING,&adapter->state))usleep_range(1000,2000);
@@ -282,20 +301,32 @@ static int e1000_set_settings(struct net_device *netdev,hw->fc.requested_mode=e1000_fc_default;}else{u32speed=ethtool_cmd_speed(ecmd);+/* calling this overrides forced MDI setting */if(e1000_set_spd_dplx(adapter,speed,ecmd->duplex)){clear_bit(__E1000_RESETTING,&adapter->state);return-EINVAL;}}+/* MDI-X => 2; MDI => 1; Auto => 3 */+if(ecmd->eth_tp_mdix_ctrl){+/*+*fixupthevalueforauto(3=>0)aszeroismapped+*internallytoauto+*/+if(ecmd->eth_tp_mdix_ctrl==ETH_TP_MDI_AUTO)+hw->phy.mdix=AUTO_ALL_MODES;+else+hw->phy.mdix=ecmd->eth_tp_mdix_ctrl;+}+/* reset the link */if(netif_running(adapter->netdev)){e1000e_down(adapter);e1000e_up(adapter);-}else{+}elsee1000e_reset(adapter);-}clear_bit(__E1000_RESETTING,&adapter->state);return0;
From: Jeff Kirsher <hidden> Date: 2012-07-20 21:43:56
From: Jesse Brandeburg <redacted>
This is the implementation in e1000 to allow ethtool to force
MDI state, allowing users to work around some improperly
behaving switches.
Current get_settings behavior slightly changes in that now when link is down
get_settings will return the MDI state of the last link because get_settings
needs to succeed to allow the set to work even when link is down.
Forcing in this driver is for now only allowed when auto-neg is enabled.
To use must have the matching version of ethtool app that supports
this functionality.
Signed-off-by: Jesse Brandeburg <redacted>
CC: Tushar Dave <redacted>
Tested-by: Aaron Brown <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 34 ++++++++++++++++++++++
drivers/net/ethernet/intel/e1000/e1000_main.c | 4 +++
2 files changed, 38 insertions(+)
@@ -183,6 +192,22 @@ static int e1000_set_settings(struct net_device *netdev,structe1000_adapter*adapter=netdev_priv(netdev);structe1000_hw*hw=&adapter->hw;+/*+*MDIsettingisonlyallowedwhenautonegenabledbecause+*somehardwaredoesn'tallowMDIsettingwhenspeedor+*duplexisforced.+*/+if(ecmd->eth_tp_mdix_ctrl){+if(hw->media_type!=e1000_media_type_copper)+return-EOPNOTSUPP;++if((ecmd->eth_tp_mdix_ctrl!=ETH_TP_MDI_AUTO)&&+(ecmd->autoneg!=AUTONEG_ENABLE)){+e_err(drv,"forcing MDI/MDI-X state is not supported when link speed and/or duplex are forced\n");+return-EINVAL;+}+}+while(test_and_set_bit(__E1000_RESETTING,&adapter->flags))msleep(1);
@@ -199,12 +224,21 @@ static int e1000_set_settings(struct net_device *netdev,ecmd->advertising=hw->autoneg_advertised;}else{u32speed=ethtool_cmd_speed(ecmd);+/* calling this overrides forced MDI setting */if(e1000_set_spd_dplx(adapter,speed,ecmd->duplex)){clear_bit(__E1000_RESETTING,&adapter->flags);return-EINVAL;}}+/* MDI-X => 2; MDI => 1; Auto => 3 */+if(ecmd->eth_tp_mdix_ctrl){+if(ecmd->eth_tp_mdix_ctrl==ETH_TP_MDI_AUTO)+hw->mdix=AUTO_ALL_MODES;+else+hw->mdix=ecmd->eth_tp_mdix_ctrl;+}+/* reset the link */if(netif_running(adapter->netdev)){
From: Jeff Kirsher <hidden> Date: 2012-07-20 21:43:57
From: Jesse Brandeburg <redacted>
This is the implementation for igb to allow forcing MDI state
via ethtool, allowing users to work around some improperly
behaving switches.
get_settings will now return the MDI state of the last link
because get_settings needs to succeed to allow the set to work even
when link is down.
Forcing in this driver is for now only allowed when auto-neg is
enabled.
Signed-off-by: Jesse Brandeburg <redacted>
CC: Carolyn Wyborny <redacted>
Tested-by: Jeff Pieper <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/igb/igb_ethtool.c | 37 ++++++++++++++++++++++++++
drivers/net/ethernet/intel/igb/igb_main.c | 4 +++
2 files changed, 41 insertions(+)
@@ -214,6 +222,22 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)return-EINVAL;}+/*+*MDIsettingisonlyallowedwhenautonegenabledbecause+*somehardwaredoesn'tallowMDIsettingwhenspeedor+*duplexisforced.+*/+if(ecmd->eth_tp_mdix_ctrl){+if(hw->phy.media_type!=e1000_media_type_copper)+return-EOPNOTSUPP;++if((ecmd->eth_tp_mdix_ctrl!=ETH_TP_MDI_AUTO)&&+(ecmd->autoneg!=AUTONEG_ENABLE)){+dev_err(&adapter->pdev->dev,"forcing MDI/MDI-X state is not supported when link speed and/or duplex are forced\n");+return-EINVAL;+}+}+while(test_and_set_bit(__IGB_RESETTING,&adapter->state))msleep(1);
@@ -227,12 +251,25 @@ static int igb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)hw->fc.requested_mode=e1000_fc_default;}else{u32speed=ethtool_cmd_speed(ecmd);+/* calling this overrides forced MDI setting */if(igb_set_spd_dplx(adapter,speed,ecmd->duplex)){clear_bit(__IGB_RESETTING,&adapter->state);return-EINVAL;}}+/* MDI-X => 2; MDI => 1; Auto => 3 */+if(ecmd->eth_tp_mdix_ctrl){+/*+*fixupthevalueforauto(3=>0)aszeroismapped+*internallytoauto+*/+if(ecmd->eth_tp_mdix_ctrl==ETH_TP_MDI_AUTO)+hw->phy.mdix=AUTO_ALL_MODES;+else+hw->phy.mdix=ecmd->eth_tp_mdix_ctrl;+}+/* reset the link */if(netif_running(adapter->netdev)){igb_down(adapter);
From: Ben Hutchings <hidden> Date: 2012-07-20 23:27:44
On Fri, 2012-07-20 at 14:43 -0700, Jeff Kirsher wrote:
quoted hunk
From: Jesse Brandeburg <redacted>
This is the implementation in e1000 to allow ethtool to force
MDI state, allowing users to work around some improperly
behaving switches.
Current get_settings behavior slightly changes in that now when link is down
get_settings will return the MDI state of the last link because get_settings
needs to succeed to allow the set to work even when link is down.
Forcing in this driver is for now only allowed when auto-neg is enabled.
To use must have the matching version of ethtool app that supports
this functionality.
Signed-off-by: Jesse Brandeburg <redacted>
CC: Tushar Dave <redacted>
Tested-by: Aaron Brown <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 34 ++++++++++++++++++++++
drivers/net/ethernet/intel/e1000/e1000_main.c | 4 +++
2 files changed, 38 insertions(+)
[...]
Why don't you set ecmd->eth_tp_mdix_ctrl here?
If you also leave it as 0, it's impossible for userland to tell whether
the current mode was forced or automatically selected.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
Why don't you set ecmd->eth_tp_mdix_ctrl here?
If you also leave it as 0, it's impossible for userland to tell whether
the current mode was forced or automatically selected.
Thanks for the review, right now the get interface (and ethtool display)
doesn't support any way to report if the setting was forced or not. I
didn't think about changing the get because I didn't want to modify the
userland reporting (I also figured it was a simple interface right now,
and didn't need changing, and was focused on the _set_ which is the part
fixing the users' reported bugs.)
I think the patches as they currently stand are okay, do you agree? I
would be glad to submit a followon to implement the new "get" interface if
we can hash out the interface changes, but I see no reason to gate these
patches.
From: Ben Hutchings <hidden> Date: 2012-07-21 15:37:52
On Fri, 2012-07-20 at 18:17 -0700, Brandeburg, Jesse wrote:
On Fri, 20 Jul 2012, Ben Hutchings wrote:
quoted
Why don't you set ecmd->eth_tp_mdix_ctrl here?
If you also leave it as 0, it's impossible for userland to tell whether
the current mode was forced or automatically selected.
Thanks for the review, right now the get interface (and ethtool display)
doesn't support any way to report if the setting was forced or not. I
didn't think about changing the get because I didn't want to modify the
userland reporting (I also figured it was a simple interface right now,
and didn't need changing, and was focused on the _set_ which is the part
fixing the users' reported bugs.)
Everything else you can change with ETHTOOL_SSET is also reported by
ETHTOOL_GSET; why would this be any different?
I think the patches as they currently stand are okay, do you agree? I
would be glad to submit a followon to implement the new "get" interface if
we can hash out the interface changes, but I see no reason to gate these
patches.
You left this for 20 months, what's the hurry now?
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
From: Jeff Kirsher <hidden> Date: 2012-07-21 17:37:16
On Sat, 2012-07-21 at 16:37 +0100, Ben Hutchings wrote:
On Fri, 2012-07-20 at 18:17 -0700, Brandeburg, Jesse wrote:
quoted
On Fri, 20 Jul 2012, Ben Hutchings wrote:
quoted
Why don't you set ecmd->eth_tp_mdix_ctrl here?
If you also leave it as 0, it's impossible for userland to tell
whether
quoted
quoted
the current mode was forced or automatically selected.
Thanks for the review, right now the get interface (and ethtool
display)
quoted
doesn't support any way to report if the setting was forced or not.
I
quoted
didn't think about changing the get because I didn't want to modify
the
quoted
userland reporting (I also figured it was a simple interface right
now,
quoted
and didn't need changing, and was focused on the _set_ which is the
part
quoted
fixing the users' reported bugs.)
Everything else you can change with ETHTOOL_SSET is also reported by
ETHTOOL_GSET; why would this be any different?
quoted
I think the patches as they currently stand are okay, do you agree?
I
quoted
would be glad to submit a followon to implement the new "get"
interface if
quoted
we can hash out the interface changes, but I see no reason to gate
these
quoted
patches.
You left this for 20 months, what's the hurry now?
Since there some changes that are needed in this patch set, I will drop
this series from my tree so that I can continue pushing additional
ixgbe/ixgbevf patches.
From: Jeff Kirsher <hidden> Date: 2012-07-21 17:37:50
On Fri, 2012-07-20 at 14:43 -0700, Kirsher, Jeffrey T wrote:
This series contains updates to ethtool, e1000, e1000e and igb with
regards to the new MDI ethtool support patches submitted earlier.
The following are changes since commit fa0afcd10951afad2022dda09777d2bf70cdab3d:
atl1c: fix issue of io access mode for AR8152 v2.1
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next master
Bruce W Allan (1):
e1000e: implement 82577/579 MDI setting support
Jesse Brandeburg (5):
ethtool.h: MDI setting support
igb: implement 580 MDI setting support
e1000: configure and read MDI settings
e1000e: implement MDI/MDI-X control
igb: update to allow reading/setting MDI state
drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 34 +++++++++++++++++++
drivers/net/ethernet/intel/e1000/e1000_main.c | 4 +++
drivers/net/ethernet/intel/e1000e/ethtool.c | 39 +++++++++++++++++++---
drivers/net/ethernet/intel/e1000e/phy.c | 31 +++++++++++++++--
drivers/net/ethernet/intel/igb/e1000_phy.c | 29 ++++++++++++++--
drivers/net/ethernet/intel/igb/e1000_phy.h | 5 +--
drivers/net/ethernet/intel/igb/igb_ethtool.c | 37 ++++++++++++++++++++
drivers/net/ethernet/intel/igb/igb_main.c | 4 +++
include/linux/ethtool.h | 17 ++++++----
9 files changed, 184 insertions(+), 16 deletions(-)
--
1.7.10.4
Since there some changes that are needed in this patch set, I will drop
this series from my tree so that I can continue pushing additional
ixgbe/ixgbevf patches.