Skip to contentSkip to conversation

driver/net/skge.c: Restart the interface when it's options or pauseparam is set

PATCH In review Xiaoming.Zhang 2 participants 2 messages Aug 7, 2008 – Aug 19, 2008 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver/net/skge.c: Restart the interface when it's options or pauseparam is set

Hi,

We have an issue of the skge driver: The card won't work when it's options are changed. That's the hardware info:

# lspci -v
05:04.0 Ethernet controller: Marvell Technology Group Ltd. 88E8001 Gigabit Ethernet Controller (rev 13)
        Subsystem: Marvell Technology Group Ltd. Marvell RDK-8001
        Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 16
        Memory at d042c000 (32-bit, non-prefetchable) [size=16K]
        I/O ports at d000 [size=256]
        [virtual] Expansion ROM at 20400000 [disabled] [size=128K]
        Capabilities: [48] Power Management version 2
        Capabilities: [50] Vital Product Data

The happens in both Linux-2.6.26(skge version 1.23) and RHEL5.2(skge version 1.6).

For example, at first it is set to "speed 1000 duplex full auto-neg on" and it works, then run
ethtool -s <ethx> autoneg off
or ethtool -s <ethx> speed 100 duplex full autoneg off

Then it will stop working. After that if we restart the interface:
ifconifg <ethx> down
ifconfig <ethx> up
It will work again. And `ethtool -A' has the same issue.

So we think after setting the options, the interface should be restarted. That's the patch, thank you.

skge: Restart the interface when it's options or pauseparam is set.

---

drivers/net/skge.c 2008-08-07 01:29:31.000000000 +0800 renamed from drivers/net/skge.c.orig 2008-08-07 01:26:34.000000000 +0800 +8 -4
diff -uprN linux-2.6.26/drivers/net/skge.c.orig linux-2.6.26/drivers/net/skge.c
@@ -367,8 +367,10 @@ static int skge_set_settings(struct net_
        skge->autoneg = ecmd->autoneg;
        skge->advertising = ecmd->advertising;
 
-       if (netif_running(dev))
-               skge_phy_reset(skge);
+       if (netif_running(dev)) {
+               skge_down(dev);
+               skge_up(dev);
+       }
 
        return (0);
 }
@@ -609,8 +611,10 @@ static int skge_set_pauseparam(struct ne
                        skge->flow_control = FLOW_MODE_NONE;
        }
 
-       if (netif_running(dev))
-               skge_phy_reset(skge);
+       if (netif_running(dev)) {
+               skge_down(dev);
+               skge_up(dev);
+       }
 
        return 0;
 }
Signature · 2 lines
Have fun,
Xiaoming (Mark) Zhang
#1 lore raw

drivers/net/skge.c 2008-08-07 01:29:31.000000000 +0800

Quoted 38 lines · On Thu, 7 Aug 2008 11:02:52 +0800 "Xiaoming.Zhang"…

Hi,

We have an issue of the skge driver: The card won't work when it's options are changed. That's the hardware info:

# lspci -v
05:04.0 Ethernet controller: Marvell Technology Group Ltd. 88E8001 Gigabit Ethernet Controller (rev 13)
        Subsystem: Marvell Technology Group Ltd. Marvell RDK-8001
        Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 16
        Memory at d042c000 (32-bit, non-prefetchable) [size=16K]
        I/O ports at d000 [size=256]
        [virtual] Expansion ROM at 20400000 [disabled] [size=128K]
        Capabilities: [48] Power Management version 2
        Capabilities: [50] Vital Product Data

The happens in both Linux-2.6.26(skge version 1.23) and RHEL5.2(skge version 1.6).

For example, at first it is set to "speed 1000 duplex full auto-neg on" and it works, then run
ethtool -s <ethx> autoneg off
or ethtool -s <ethx> speed 100 duplex full autoneg off

Then it will stop working. After that if we restart the interface:
ifconifg <ethx> down
ifconfig <ethx> up
It will work again. And `ethtool -A' has the same issue.

So we think after setting the options, the interface should be restarted. That's the patch, thank you.

skge: Restart the interface when it's options or pauseparam is set.

---
diff -uprN linux-2.6.26/drivers/net/skge.c.orig linux-2.6.26/drivers/net/skge.c

drivers/net/skge.c 2008-08-07 01:29:31.000000000 +0800 renamed from drivers/net/skge.c.orig 2008-08-07 01:26:34.000000000 +0800 +0 -0

Your email client turns tabs into spaces. I turn spaces back into tabs, but it gets dull after a while.

Quoted 16 lines
drivers/net/skge.c 2008-08-07 01:29:31.000000000 +0800 renamed from drivers/net/skge.c.orig 2008-08-07 01:26:34.000000000 +0800 +4 -2
@@ -367,8 +367,10 @@ static int skge_set_settings(struct net_
        skge->autoneg = ecmd->autoneg;
        skge->advertising = ecmd->advertising;
 
-       if (netif_running(dev))
-               skge_phy_reset(skge);
+       if (netif_running(dev)) {
+               skge_down(dev);
+               skge_up(dev);
+       }
 
        return (0);
 }
@@ -609,8 +611,10 @@ static int skge_set_pauseparam(struct ne
                        skge->flow_control = FLOW_MODE_NONE;
        }

drivers/net/skge.c 2008-08-07 01:29:31.000000000 +0800 static int skge_set_pauseparam(struct ne · line 620

Quoted 10 lines
drivers/net/skge.c 2008-08-07 01:29:31.000000000 +0800 renamed from drivers/net/skge.c.orig 2008-08-07 01:26:34.000000000 +0800 +4 -2
 
-       if (netif_running(dev))
-               skge_phy_reset(skge);
+       if (netif_running(dev)) {
+               skge_down(dev);
+               skge_up(dev);
+       }
 
        return 0;
 }

Seems a bit drastic, although skge_set_ring_param() already does this.

skge_set_ring_param() checks for errors from skge_up(), but the above code does not.

Mysterious code sequences like the above should be commented, IMO.

I suspect this patch will be treated more as a bug report than as a patch. We shall see.