netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 08/26] e1000: Deprecate mii-tool SIOCMIIREG ioctl
  2006-08-29 16:41 [PATCH 00/26] e100, e1000, ixgb updates Kok, Auke
@ 2006-08-29 16:44 ` Kok, Auke
  2006-08-29 20:49   ` Jeff Garzik
  0 siblings, 1 reply; 4+ messages in thread
From: Kok, Auke @ 2006-08-29 16:44 UTC (permalink / raw)
  To: Garzik, Jeff
  Cc: netdev, akpm, Brandeburg, Jesse, Kok, Auke, Kok, Auke,
	Ronciak, John


Deprecate mii-tool SIOCMIIREG ioctl. This ioctl is broken in e1000 and
ethtool has this functionality in working order.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---

 drivers/net/e1000/e1000_main.c |   69 ----------------------------------------
 1 files changed, 0 insertions(+), 69 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index c128f62..70d0acd 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -4263,9 +4263,6 @@ e1000_mii_ioctl(struct net_device *netde
 {
 	struct e1000_adapter *adapter = netdev_priv(netdev);
 	struct mii_ioctl_data *data = if_mii(ifr);
-	int retval;
-	uint16_t mii_reg;
-	uint16_t spddplx;
 	unsigned long flags;
 
 	if (adapter->hw.media_type != e1000_media_type_copper)
@@ -4287,72 +4284,6 @@ e1000_mii_ioctl(struct net_device *netde
 		spin_unlock_irqrestore(&adapter->stats_lock, flags);
 		break;
 	case SIOCSMIIREG:
-		if (!capable(CAP_NET_ADMIN))
-			return -EPERM;
-		if (data->reg_num & ~(0x1F))
-			return -EFAULT;
-		mii_reg = data->val_in;
-		spin_lock_irqsave(&adapter->stats_lock, flags);
-		if (e1000_write_phy_reg(&adapter->hw, data->reg_num,
-					mii_reg)) {
-			spin_unlock_irqrestore(&adapter->stats_lock, flags);
-			return -EIO;
-		}
-		if (adapter->hw.media_type == e1000_media_type_copper) {
-			switch (data->reg_num) {
-			case PHY_CTRL:
-				if (mii_reg & MII_CR_POWER_DOWN)
-					break;
-				if (mii_reg & MII_CR_AUTO_NEG_EN) {
-					adapter->hw.autoneg = 1;
-					adapter->hw.autoneg_advertised = 0x2F;
-				} else {
-					if (mii_reg & 0x40)
-						spddplx = SPEED_1000;
-					else if (mii_reg & 0x2000)
-						spddplx = SPEED_100;
-					else
-						spddplx = SPEED_10;
-					spddplx += (mii_reg & 0x100)
-						   ? DUPLEX_FULL :
-						   DUPLEX_HALF;
-					retval = e1000_set_spd_dplx(adapter,
-								    spddplx);
-					if (retval) {
-						spin_unlock_irqrestore(
-							&adapter->stats_lock,
-							flags);
-						return retval;
-					}
-				}
-				if (netif_running(adapter->netdev))
-					e1000_reinit_locked(adapter);
-				else
-					e1000_reset(adapter);
-				break;
-			case M88E1000_PHY_SPEC_CTRL:
-			case M88E1000_EXT_PHY_SPEC_CTRL:
-				if (e1000_phy_reset(&adapter->hw)) {
-					spin_unlock_irqrestore(
-						&adapter->stats_lock, flags);
-					return -EIO;
-				}
-				break;
-			}
-		} else {
-			switch (data->reg_num) {
-			case PHY_CTRL:
-				if (mii_reg & MII_CR_POWER_DOWN)
-					break;
-				if (netif_running(adapter->netdev))
-					e1000_reinit_locked(adapter);
-				else
-					e1000_reset(adapter);
-				break;
-			}
-		}
-		spin_unlock_irqrestore(&adapter->stats_lock, flags);
-		break;
 	default:
 		return -EOPNOTSUPP;
 	}



---
Auke Kok <auke-jan.h.kok@intel.com>

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

* Re: [PATCH 08/26] e1000: Deprecate mii-tool SIOCMIIREG ioctl
  2006-08-29 16:44 ` [PATCH 08/26] e1000: Deprecate mii-tool SIOCMIIREG ioctl Kok, Auke
@ 2006-08-29 20:49   ` Jeff Garzik
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2006-08-29 20:49 UTC (permalink / raw)
  To: Kok, Auke; +Cc: netdev, akpm, Brandeburg, Jesse, Kok, Auke, Ronciak, John

Kok, Auke wrote:
> Deprecate mii-tool SIOCMIIREG ioctl. This ioctl is broken in e1000 and
> ethtool has this functionality in working order.
> 
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>

This doesn't "deprecated" anything, it changes the ABI on a user's 
machine by _removing_ ioctl handling code that used to be there.

What's broken, and what is needed to fix?  Perhaps e1000 should instead 
be limited to 10/100 networks/speeds?

	Jeff




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

* RE: [PATCH 08/26] e1000: Deprecate mii-tool SIOCMIIREG ioctl
@ 2006-08-30  4:21 Brandeburg, Jesse
  2006-08-31 21:17 ` Auke Kok
  0 siblings, 1 reply; 4+ messages in thread
From: Brandeburg, Jesse @ 2006-08-30  4:21 UTC (permalink / raw)
  To: Jeff Garzik, Kok, Auke-jan H; +Cc: netdev, akpm, Kok, Auke, Ronciak, John

Jeff Garzik wrote:
> Kok, Auke wrote:
>> Deprecate mii-tool SIOCMIIREG ioctl. This ioctl is broken in e1000
>> and ethtool has this functionality in working order.
>> 
>> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
> 
> This doesn't "deprecated" anything, it changes the ABI on a
> user's machine by _removing_ ioctl handling code that used to be
> there. 
> 
> What's broken, and what is needed to fix?  Perhaps e1000
> should instead be limited to 10/100 networks/speeds?

mii-tool is broken because it doesn't understand GMII phys.  We ended up
having a mess of code trying to implement the shim layer to support the
PHY write ioctls, among others.
mii-tool always reports 100 Mbps link when you actually have 1Gbps link.
Using mii-tool to set options didn't work very well to begin with, so
rather than continue to dump time into a dead end, just remove the
incomplete/non-working code and force the user to use ethtool if they
want to do set operations. 

Mii-tool is already marked in its man page to be obsolete

<quote from RHEL4>
NOTE
       This program is obsolete. Valid  media  are  only  100baseT4,
100baseTx-FD,100baseTx-HD,  10baseT-FD  and
       10baseT-HD ethernet cards. For replacement check eth-tool.
</quote>

We intentionally left the read code in to not break any user space
programs that are using that IOCTL to read link status etc.  With some
recent improvements to ethtool, it has the exact same functionality as
mii-tool.

While I appreciate the "don't break user space" position, in this case
it never really worked right, and when it did work the user was just
lucky because they probably weren't getting what they wanted.

Jesse

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

* Re: [PATCH 08/26] e1000: Deprecate mii-tool SIOCMIIREG ioctl
  2006-08-30  4:21 [PATCH 08/26] e1000: Deprecate mii-tool SIOCMIIREG ioctl Brandeburg, Jesse
@ 2006-08-31 21:17 ` Auke Kok
  0 siblings, 0 replies; 4+ messages in thread
From: Auke Kok @ 2006-08-31 21:17 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Brandeburg, Jesse, Kok, Auke-jan H, netdev, akpm, Kok, Auke,
	Ronciak, John

Brandeburg, Jesse wrote:
> Jeff Garzik wrote:
>> Kok, Auke wrote:
>>> Deprecate mii-tool SIOCMIIREG ioctl. This ioctl is broken in e1000
>>> and ethtool has this functionality in working order.
>>>
>>> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>>> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
>> This doesn't "deprecated" anything, it changes the ABI on a
>> user's machine by _removing_ ioctl handling code that used to be
>> there. 
>>
>> What's broken, and what is needed to fix?  Perhaps e1000
>> should instead be limited to 10/100 networks/speeds?
> 
> mii-tool is broken because it doesn't understand GMII phys.  We ended up
> having a mess of code trying to implement the shim layer to support the
> PHY write ioctls, among others.
> mii-tool always reports 100 Mbps link when you actually have 1Gbps link.
> Using mii-tool to set options didn't work very well to begin with, so
> rather than continue to dump time into a dead end, just remove the
> incomplete/non-working code and force the user to use ethtool if they
> want to do set operations. 
> 
> Mii-tool is already marked in its man page to be obsolete
> 
> <quote from RHEL4>
> NOTE
>        This program is obsolete. Valid  media  are  only  100baseT4,
> 100baseTx-FD,100baseTx-HD,  10baseT-FD  and
>        10baseT-HD ethernet cards. For replacement check eth-tool.
> </quote>
> 
> We intentionally left the read code in to not break any user space
> programs that are using that IOCTL to read link status etc.  With some
> recent improvements to ethtool, it has the exact same functionality as
> mii-tool.
> 
> While I appreciate the "don't break user space" position, in this case
> it never really worked right, and when it did work the user was just
> lucky because they probably weren't getting what they wanted.

I'm dropping this patch from our stack, it seems (irony) that we might have 
some use for this ioctl after all and we need to re-evaluate what to do with 
it. It doesn't hurt (much) to leave it in there for now.

Jeff, I'll repost a summary of the changes I made to the queue on our gitserver 
in a second.

Cheers,

Auke

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

end of thread, other threads:[~2006-08-31 21:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-30  4:21 [PATCH 08/26] e1000: Deprecate mii-tool SIOCMIIREG ioctl Brandeburg, Jesse
2006-08-31 21:17 ` Auke Kok
  -- strict thread matches above, loose matches on Subject: below --
2006-08-29 16:41 [PATCH 00/26] e100, e1000, ixgb updates Kok, Auke
2006-08-29 16:44 ` [PATCH 08/26] e1000: Deprecate mii-tool SIOCMIIREG ioctl Kok, Auke
2006-08-29 20:49   ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).