Skip to contentSkip to conversation

QuadEthernet driver broken

DISCUSSION Ludovic Courtès 4 participants 7 messages Apr 12, 2007 – Apr 24, 2007 Network drivers

lore
Share & tools
lore
#1 lore raw

Hi,

Quoted 3 lines · [email protected] (Ludovic Courtès) writes:

The `sunqe' driver appears to be currently broken:

http://lists.debian.org/debian-sparc/2007/04/msg00036.html

To sum up, `sunqe' displays erroneous addresses at initialization time:

sunqe.c:v4.0 June 23, 2006 David S. Miller ([email protected])
eth0: qe channel[0] 00:00:00:00:00:00
eth1: qe channel[1] 00:00:00:00:00:00
eth2: qe channel[2] 00:00:00:00:00:00
eth3: qe channel[3] 00:00:00:00:00:00

Since these are displayed at module initialization time (in `qec_ether_init ()'), couldn't it be due to incorrect accesses to the PROM device tree, somehow related to the recent PROM API change [0]?

Likewise, the oops yielded by rmmod sunqe' apparently stems from the of_unregister_driver ()' call:

kernel BUG at net/core/dev.c:3236!

                \|/ ____ \|/
                "@'/ ,. \`@"
                /_| \__/ |_\
                   \__U_/
  rmmod(3507): Kernel bad trap [#1]
  PSR: 414000c5 PC: f01390c8 NPC: f01390cc Y: 00000000    Not tainted
  PC: <free_netdev+0x48/0x54>
  %%G: fc000000 414000e4  f01d15f8 f1bb1e60  0000000c f022b740  f12e8000 00000000
  %%O: 00000026 f01b7038  00000ca4 00000004  fc000000 00000003  f12e9b58 f01390c0
  RPC: <free_netdev+0x40/0x54>
  %%L: 419000e6 00000010  f0233044 00000010  00000004 00000000  00000000 5002a000
  %%I: f1ce1800 00000004  0000e000 f002f000  f0230c60 f0230c00  f12e9bc0 fe64f0a4

Caller[fe64f0a4]: qec_sbus_remove+0x64/0x70 [sunqe]
Caller[f001b3b0]: of_device_remove+0x2c/0x34
Caller[f0116f70]: __device_release_driver+0x78/0x8c
Caller[f0117308]: driver_detach+0x90/0x274
Caller[f01164c0]: bus_remove_driver+0x7c/0xa0
Caller[f0117524]: driver_unregister+0x10/0x1c
Caller[fe650504]: qec_exit+0x10/0x5c [sunqe]
Caller[f004cd44]: sys_delete_module+0x1cc/0x1f4
Caller[f0011634]: syscall_is_too_hard+0x3c/0x40
Caller[00011220]: 0x11228
Instruction DUMP: 92102ca4 7ffb658c 90122038 <91d02005> c220a174 7fff7a57 91ee21d0 01000000 9de3bf98

Any idea?

Thanks,
Ludovic.

[0] http://article.gmane.org/gmane.linux.ports.sparc/6322

maintainer
#2 lore raw
In reply to Ludovic Courtès

From: [email protected] (Ludovic Courtès)
Date: Tue, 17 Apr 2007 20:45:26 +0200

Quoted 16 lines

Hi,

Quoted 3 lines · [email protected] (Ludovic Courtès) writes:

The `sunqe' driver appears to be currently broken:

http://lists.debian.org/debian-sparc/2007/04/msg00036.html

To sum up, `sunqe' displays erroneous addresses at initialization time:

sunqe.c:v4.0 June 23, 2006 David S. Miller ([email protected])
eth0: qe channel[0] 00:00:00:00:00:00
eth1: qe channel[1] 00:00:00:00:00:00
eth2: qe channel[2] 00:00:00:00:00:00
eth3: qe channel[3] 00:00:00:00:00:00

Quoted 3 lines

Since these are displayed at module initialization time (in `qec_ether_init ()'), couldn't it be due to incorrect accesses to the PROM device tree, somehow related to the recent PROM API change [0]?

I'll look into this bug report, I'm just swamped with about 10 or so other sparc platform bug reports at this time.

Just be patient or figure out the bug yourself and post a patch for me to apply which fixes it :-)

#3 lore raw
In reply to Ludovic Courtès

Hi,

The MAC address assignment at module loading is simply forgotten. The bug at module unloading is caused by an incorrect call.

The bug at module unloading does not only happen for sunqe, sunlance and sunhme (sbus) suffer from it too.

This patch fixes the sunqe driver.
The sunlance and sunhme will follow.

I've tested this on my SS20.
Thanks.

--- linux-2.6.21-rc7-git5-up/drivers/net/sunqe.c.org 2007-02-04
19:44:54.000000000 +0100
+++ linux-2.6.21-rc7-git5-up/drivers/net/sunqe.c 2007-04-21
20:15:08.000000000 +0200
@@ -845,6 +845,8 @@
if (!dev)
return -ENOMEM;

+ memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
+
qe = netdev_priv(dev);

i = of_getintprop_default(sdev->ofdev.node, "channel#", -1);
@@ -960,7 +962,7 @@
struct sunqe *qp = dev_get_drvdata(&dev->dev); struct net_device *net_dev = qp->dev;

- unregister_netdevice(net_dev);
+ unregister_netdev(net_dev);

sbus_iounmap(qp->qcregs, CREG_REG_SIZE);
sbus_iounmap(qp->mregs, MREGS_REG_SIZE);

maintainer
#4 lore raw
In reply to Ludovic Courtès

From: "Marcel van Nies" <[email protected]>
Date: Sat, 21 Apr 2007 20:43:14 +0200

Quoted 6 lines

The MAC address assignment at module loading is simply forgotten. The bug at module unloading is caused by an incorrect call.

The bug at module unloading does not only happen for sunqe, sunlance and sunhme (sbus) suffer from it too.

Quoted 7 lines

This patch fixes the sunqe driver.
The sunlance and sunhme will follow.

I've tested this on my SS20.
Thanks.

If only you tested the patch itself as thoroughly :-)

Your email client adds newlines and other damage to your patches.

I'll fix them up this time but next time I will likely not be so kind :-)

If in doubt, email the patch to yourself and try to apply it. This will save your time as well as mine.

#5 lore raw
In reply to Ludovic Courtès

Hi,

Quoted 1 line · David Miller

Your email client adds newlines and other damage to your patches.

Hmm, I see :(
I used diff -u, but I should have used diff -up. Gmail took care of the rest...

Quoted 2 lines

I'll fix them up this time but next time I will likely not be so kind :-)

Thanks.

Quoted 2 lines

If in doubt, email the patch to yourself and try to apply it. This will save your time as well as mine.

Good point. I'm still learning...

I'll resend the patches as attachments.
Sorry for any inconvenience caused.

drivers/net/sunqe.c renamed from drivers/net/sunqe.c.org +3 -1
@@ -845,6 +845,8 @@ static int __init qec_ether_init(struct 
 	if (!dev)
 		return -ENOMEM;
 
+	memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
+
 	qe = netdev_priv(dev);
 
 	i = of_getintprop_default(sdev->ofdev.node, "channel#", -1);
@@ -960,7 +962,7 @@ static int __devexit qec_sbus_remove(str
 	struct sunqe *qp = dev_get_drvdata(&dev->dev);
 	struct net_device *net_dev = qp->dev;
 
-	unregister_netdevice(net_dev);
+	unregister_netdev(net_dev);
 
 	sbus_iounmap(qp->qcregs, CREG_REG_SIZE);
 	sbus_iounmap(qp->mregs, MREGS_REG_SIZE);
drivers/net/sunlance.c renamed from drivers/net/sunlance.c.org +2 -2
@@ -1550,7 +1550,7 @@ static int __exit sunlance_sun4_remove(v
 	struct lance_private *lp = dev_get_drvdata(&sun4_sdev.ofdev.dev);
 	struct net_device *net_dev = lp->dev;
 
-	unregister_netdevice(net_dev);
+	unregister_netdev(net_dev);
 
 	lance_free_hwresources(lp);
 
@@ -1590,7 +1590,7 @@ static int __devexit sunlance_sbus_remov
 	struct lance_private *lp = dev_get_drvdata(&dev->dev);
 	struct net_device *net_dev = lp->dev;
 
-	unregister_netdevice(net_dev);
+	unregister_netdev(net_dev);
 
 	lance_free_hwresources(lp);
 
drivers/net/sunhme.c renamed from drivers/net/sunhme.c.org +1 -1
@@ -3314,7 +3314,7 @@ static int __devexit hme_sbus_remove(str
 	struct happy_meal *hp = dev_get_drvdata(&dev->dev);
 	struct net_device *net_dev = hp->dev;
 
-	unregister_netdevice(net_dev);
+	unregister_netdev(net_dev);
 
 	/* XXX qfe parent interrupt... */
 
#6 lore raw
In reply to Ludovic Courtès
Quoted 6 lines · David Miller
Quoted 1 line

Your email client adds newlines and other damage to your patches.

Hmm, I see :(
I used diff -u, but I should have used diff -up. Gmail took care of the rest...

-p does not change that. (And if you ask me for a favorite flags combination, try -Ndpru or -Pdpru, depending on what you want.)

Jan