Skip to contentSkip to conversation

m68k: Atari EtherNAT Updates

PATCH In review Geert Uytterhoeven 2 participants 16 messages May 26, 2010 – Jun 8, 2010 Network drivers

lore
Share & tools
lore
#0 lore raw

cover m68k: Atari EtherNAT Updates

Hi Michael,

As the Atari EtherNAT driver no longer compiles in post-2.6.34, I ported all recent changes to the smc91x driver to it.

m68k: Atari EtherNAT - request_irq - Remove unnecessary leading & from sec
m68k: Atari EtherNAT - convert to dev_pm_ops
m68k: Atari EtherNAT - Fix irq flags
m68k: Atari EtherNAT - fix unused flags warnings on UP systems
m68k: Atari EtherNAT - Fix up type mismatch in smc_drv_resume().
m68k: Atari EtherNAT - use netdev_mc_count and netdev_mc_empty when approp
m68k: Atari EtherNAT - convert multiple drivers to use netdev_for_each_mc_
m68k: Atari EtherNAT - remove trailing space in messages
m68k: Atari EtherNAT - include cleanup: slab.h
m68k: Atari EtherNAT - convert multicast list to list_head
m68k: Atari EtherNAT - trans_start cleanups

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#1 lore raw

PATCH 1/11 m68k: Atari EtherNAT - request_irq - Remove unnecessary leading & from second arg

Cfr. commit a0607fd3a25ba1848a63a0d925e36d914735ab47 ("drivers/net: request_irq
- Remove unnecessary leading & from second arg")

---
 drivers/net/atari_91C111.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/atari_91C111.c +1 -1
index 0b92b94..bb28b19 100644
@@ -1981,7 +1981,7 @@ static int __devinit smc_probe(struct net_device *dev, void __iomem *ioaddr,
 	}
 
 	/* Grab the IRQ */
-	retval = request_irq(dev->irq, &atari_ethernat_interrupt, irq_flags, dev->name, dev);
+	retval = request_irq(dev->irq, atari_ethernat_interrupt, irq_flags, dev->name, dev);
 	if (retval)
 		goto err_out;
 
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/11 m68k: Atari EtherNAT - convert to dev_pm_ops

In reply to Geert Uytterhoeven

Cfr. commit 9f950f72e57fe4bf9b16ace67e4cc5ffcee79d00 ("NET: smc91x: convert to dev_pm_ops")

---
 drivers/net/atari_91C111.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)
drivers/net/atari_91C111.c +12 -6
index bb28b19..d902c10 100644
@@ -2365,9 +2365,10 @@ static int __devexit smc_drv_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static int smc_drv_suspend(struct platform_device *dev, pm_message_t state)
+static int smc_drv_suspend(struct device *dev)
 {
-	struct net_device *ndev = platform_get_drvdata(dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct net_device *ndev = platform_get_drvdata(pdev);
 
 	if (ndev) {
 		if (netif_running(ndev)) {
@@ -2379,9 +2380,10 @@ static int smc_drv_suspend(struct platform_device *dev, pm_message_t state)
 	return 0;
 }
 
-static int smc_drv_resume(struct platform_device *dev)
+static int smc_drv_resume(struct device *dev)
 {
-	struct net_device *ndev = platform_get_drvdata(dev);
+	struct platform_device *pdev = to_platform_device(dev);
+	struct net_device *ndev = platform_get_drvdata(pdev);
 
 	if (ndev) {
 		struct smc_local *lp = netdev_priv(ndev);
@@ -2397,14 +2399,18 @@ static int smc_drv_resume(struct platform_device *dev)
 	return 0;
 }
 
+static struct dev_pm_ops smc_drv_pm_ops = {
+	.suspend	= smc_drv_suspend,
+	.resume		= smc_drv_resume,
+};
+
 static struct platform_driver smc_driver = {
 	.probe		= smc_drv_probe,
 	.remove		= __devexit_p(smc_drv_remove),
-	.suspend	= smc_drv_suspend,
-	.resume		= smc_drv_resume,
 	.driver		= {
 		.name	= CARDNAME,
 		.owner	= THIS_MODULE,
+		.pm	= &smc_drv_pm_ops,
 	},
 };
 
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 3/11 m68k: Atari EtherNAT - Fix irq flags

In reply to Geert Uytterhoeven

Cfr. commit d5ccd67bb77ced5249067d05171992a7d5020393 ("NET: smc91x: Fix irq flags")

---
 drivers/net/atari_91C111.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/atari_91C111.c +1 -1
index d902c10..7cfb9d3 100644
@@ -2253,7 +2253,7 @@ static int __devinit smc_drv_probe(struct platform_device *pdev)
 	printk("atari_91C111: IRQ forced to irq=%d\n", ndev->irq);
 	}
 
-	if (ires->flags & IRQF_TRIGGER_MASK)
+	if (irq_flags == -1 || ires->flags & IRQF_TRIGGER_MASK)
 		irq_flags = ires->flags & IRQF_TRIGGER_MASK;
 
 
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH 4/11 m68k: Atari EtherNAT - fix unused flags warnings on UP systems

In reply to Geert Uytterhoeven

Cfr. commit fd0775bfc9feb036e6efb669133d644ae29e12b8 ("smc91x: fix unused flags warnings on UP systems")

---
 drivers/net/atari_91C111.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/atari_91C111.c +3 -3
index 7cfb9d3..40b251c 100644
@@ -586,9 +586,9 @@ static inline void  smc_rcv(struct net_device *dev)
 #define smc_special_lock(lock, flags)		spin_lock_irqsave(lock, flags)
 #define smc_special_unlock(lock, flags) 	spin_unlock_irqrestore(lock, flags)
 #else
-#define smc_special_trylock(lock, flags)	(1)
-#define smc_special_lock(lock, flags)   	do { } while (0)
-#define smc_special_unlock(lock, flags)	do { } while (0)
+#define smc_special_trylock(lock, flags)	(flags == flags)
+#define smc_special_lock(lock, flags)   	do { flags = 0; } while (0)
+#define smc_special_unlock(lock, flags)	do { flags = 0; } while (0)
 #endif
 
 /*
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH 5/11 m68k: Atari EtherNAT - Fix up type mismatch in smc_drv_resume().

In reply to Geert Uytterhoeven

Cfr. commit 5fc3441349936ea6f1f95a1ef17492223c76a695 ("net: smc91x: Fix up type mismatch in smc_drv_resume().")

---
 drivers/net/atari_91C111.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/atari_91C111.c +1 -1
index 40b251c..40a3774 100644
@@ -2387,7 +2387,7 @@ static int smc_drv_resume(struct device *dev)
 
 	if (ndev) {
 		struct smc_local *lp = netdev_priv(ndev);
-		smc_enable_device(dev);
+		smc_enable_device(pdev);
 		if (netif_running(ndev)) {
 			smc_reset(ndev);
 			smc_enable(ndev);
Signature · 1 line
1.7.0.4
#6 lore raw

PATCH 6/11 m68k: Atari EtherNAT - use netdev_mc_count and netdev_mc_empty when appropriate

In reply to Geert Uytterhoeven

Cfr. commit 4cd24eaf0c6ee7f0242e34ee77ec899f255e66b5 ("net: use netdev_mc_count and netdev_mc_empty when appropriate")

---
 drivers/net/atari_91C111.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/atari_91C111.c +3 -3
index 40a3774..f5aeb62 100644
@@ -1451,7 +1451,7 @@ static void smc_set_multicast_list(struct net_device *dev)
 	 * I don't need to zero the multicast table, because the flag is
 	 * checked before the table is
 	 */
-	else if (dev->flags & IFF_ALLMULTI || dev->mc_count > 16) {
+	else if (dev->flags & IFF_ALLMULTI || netdev_mc_count(dev) > 16) {
 		DBG(2, "%s: RCR_ALMUL\n", dev->name);
 		lp->rcr_cur_mode |= RCR_ALMUL;
 	}
@@ -1468,7 +1468,7 @@ static void smc_set_multicast_list(struct net_device *dev)
 	 * the number of the 8 bit register, while the low 3 bits are the bit
 	 * within that register.
 	 */
-	else if (dev->mc_count)  {
+	else if (!netdev_mc_empty(dev)) {
 		int i;
 		struct dev_mc_list *cur_addr;
 
@@ -1479,7 +1479,7 @@ static void smc_set_multicast_list(struct net_device *dev)
 		memset(multicast_table, 0, sizeof(multicast_table));
 
 		cur_addr = dev->mc_list;
-		for (i = 0; i < dev->mc_count; i++, cur_addr = cur_addr->next) {
+		for (i = 0; i < netdev_mc_count(dev); i++, cur_addr = cur_addr->next) {
 			int position;
 
 			/* do we have a pointer here? */
Signature · 1 line
1.7.0.4
#7 lore raw

PATCH 7/11 m68k: Atari EtherNAT - convert multiple drivers to use netdev_for_each_mc_addr

In reply to Geert Uytterhoeven

Cfr. commit 567ec874d15b478c8eda7e9a5d2dcb05f13f1fb5 ("net: convert multiple drivers to use netdev_for_each_mc_addr, part6")

---
 drivers/net/atari_91C111.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/net/atari_91C111.c +1 -6
index f5aeb62..ac15c3f 100644
@@ -1469,7 +1469,6 @@ static void smc_set_multicast_list(struct net_device *dev)
 	 * within that register.
 	 */
 	else if (!netdev_mc_empty(dev)) {
-		int i;
 		struct dev_mc_list *cur_addr;
 
 		/* table for flipping the order of 3 bits */
@@ -1478,13 +1477,9 @@ static void smc_set_multicast_list(struct net_device *dev)
 		/* start with a table of all zeros: reject all */
 		memset(multicast_table, 0, sizeof(multicast_table));
 
-		cur_addr = dev->mc_list;
-		for (i = 0; i < netdev_mc_count(dev); i++, cur_addr = cur_addr->next) {
+		netdev_for_each_mc_addr(cur_addr, dev) {
 			int position;
 
-			/* do we have a pointer here? */
-			if (!cur_addr)
-				break;
 			/* make sure this is a multicast address -
 		   	   shouldn't this be a given if we have it here ? */
 			if (!(*cur_addr->dmi_addr & 1))
Signature · 1 line
1.7.0.4
#8 lore raw

PATCH 8/11 m68k: Atari EtherNAT - remove trailing space in messages

In reply to Geert Uytterhoeven

Cfr. commit 84d57bd61866c06aee5658fabe43292a231a5992 ("net/smc91xx: remove trailing space in messages")

---
 drivers/net/atari_91C111.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/atari_91C111.c +1 -1
index ac15c3f..ce8bd22 100644
@@ -1342,7 +1342,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
 			smc_phy_interrupt(dev);
 		} else if (status & IM_ERCV_INT) {
 			SMC_ACK_INT(lp, IM_ERCV_INT);
-			PRINTK("%s: UNSUPPORTED: ERCV INTERRUPT \n", dev->name);
+			PRINTK("%s: UNSUPPORTED: ERCV INTERRUPT\n", dev->name);
 		}
 	} while (--timeout);
 
Signature · 1 line
1.7.0.4
#9 lore raw

PATCH 9/11 m68k: Atari EtherNAT - include cleanup: slab.h

In reply to Geert Uytterhoeven

Cfr. commit 5a0e3ad6af8660be21ca98a971cd00f331318c05 ("include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h")

---
 drivers/net/atari_91C111.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/net/atari_91C111.c +0 -1
index ce8bd22..ee8e5e9 100644
@@ -70,7 +70,6 @@ static const char version[] =
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
-#include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/errno.h>
Signature · 1 line
1.7.0.4
#10 lore raw

PATCH 10/11 m68k: Atari EtherNAT - convert multicast list to list_head

In reply to Geert Uytterhoeven

Cfr. commit 22bedad3ce112d5ca1eaf043d4990fa2ed698c87 ("net: convert multicast list to list_head")

---
 drivers/net/atari_91C111.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/atari_91C111.c +4 -4
index ee8e5e9..31b4777 100644
@@ -1468,7 +1468,7 @@ static void smc_set_multicast_list(struct net_device *dev)
 	 * within that register.
 	 */
 	else if (!netdev_mc_empty(dev)) {
-		struct dev_mc_list *cur_addr;
+		struct netdev_hw_addr *ha;
 
 		/* table for flipping the order of 3 bits */
 		static const unsigned char invert3[] = {0, 4, 2, 6, 1, 5, 3, 7};
@@ -1476,16 +1476,16 @@ static void smc_set_multicast_list(struct net_device *dev)
 		/* start with a table of all zeros: reject all */
 		memset(multicast_table, 0, sizeof(multicast_table));
 
-		netdev_for_each_mc_addr(cur_addr, dev) {
+		netdev_for_each_mc_addr(ha, dev) {
 			int position;
 
 			/* make sure this is a multicast address -
 		   	   shouldn't this be a given if we have it here ? */
-			if (!(*cur_addr->dmi_addr & 1))
+			if (!(*ha->addr & 1))
 				continue;
 
 			/* only use the low order bits */
-			position = crc32_le(~0, cur_addr->dmi_addr, 6) & 0x3f;
+			position = crc32_le(~0, ha->addr, 6) & 0x3f;
 
 			/* do some messy swapping to put the bit in the right spot */
 			multicast_table[invert3[position&7]] |=
Signature · 1 line
1.7.0.4
#11 lore raw

PATCH 11/11 m68k: Atari EtherNAT - trans_start cleanups

In reply to Geert Uytterhoeven

Cfr. commit 1ae5dc342ac78d7a42965fd1f323815f6f5ef2c1 ("net: trans_start cleanups")

---
 drivers/net/atari_91C111.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/atari_91C111.c +1 -1
index 31b4777..5c10fd9 100644
@@ -1416,7 +1416,7 @@ static void smc_timeout(struct net_device *dev)
 		schedule_work(&lp->phy_configure);
 
 	/* We can accept TX packets again */
-	dev->trans_start = jiffies;
+	dev->trans_start = jiffies; /* prevent tx timeout */
 	netif_wake_queue(dev);
 }
 
Signature · 1 line
1.7.0.4
#12 lore raw
In reply to Geert Uytterhoeven

Geert,

Quoted 4 lines

Hi Michael,

As the Atari EtherNAT driver no longer compiles in post-2.6.34, I ported all recent changes to the smc91x driver to it.

You're an angel! I will pull your tree and try to compile the updated driver. Was my backwards compatibility patch to the kernel ld script ever applied?

Getting the kernel to the Falcon will be a bit of a problem - my new PC has no floppy driver (the old main board was fried when we got a smart power meter installed) and the Falcon isn't currently on the network.

Quoted 11 lines

m68k: Atari EtherNAT - request_irq - Remove unnecessary leading & from sec
m68k: Atari EtherNAT - convert to dev_pm_ops
m68k: Atari EtherNAT - Fix irq flags
m68k: Atari EtherNAT - fix unused flags warnings on UP systems
m68k: Atari EtherNAT - Fix up type mismatch in smc_drv_resume().
m68k: Atari EtherNAT - use netdev_mc_count and netdev_mc_empty when approp
m68k: Atari EtherNAT - convert multiple drivers to use netdev_for_each_mc_
m68k: Atari EtherNAT - remove trailing space in messages
m68k: Atari EtherNAT - include cleanup: slab.h
m68k: Atari EtherNAT - convert multicast list to list_head
m68k: Atari EtherNAT - trans_start cleanups

Lots of patches - much appreciated!

Thanks,

Michael

#13 lore raw
Quoted 1 line · Michael Schmitz

Was my backwards compatibility patch to the kernel ld script ever applied?

No, at that time I didn't have time to look into it, and later you said the (one) computer with that
toolchain had died (so you were going to use a newer one?).

Quoted 12 lines
Quoted 11 lines

      m68k: Atari EtherNAT - request_irq - Remove unnecessary leading & from sec
      m68k: Atari EtherNAT - convert to dev_pm_ops
      m68k: Atari EtherNAT - Fix irq flags
      m68k: Atari EtherNAT - fix unused flags warnings on UP systems
      m68k: Atari EtherNAT - Fix up type mismatch in smc_drv_resume().
      m68k: Atari EtherNAT - use netdev_mc_count and netdev_mc_empty when approp
      m68k: Atari EtherNAT - convert multiple drivers to use netdev_for_each_mc_
      m68k: Atari EtherNAT - remove trailing space in messages
      m68k: Atari EtherNAT - include cleanup: slab.h
      m68k: Atari EtherNAT - convert multicast list to list_head
      m68k: Atari EtherNAT - trans_start cleanups

Quoted 1 line

Lots of patches - much appreciated!

Eventually, the EtherNAT support should be merged with the standard driver anyway,,,

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#14 lore raw

Hi Geert,

Quoted 5 lines
Quoted 1 line

Was my backwards compatibility patch to the kernel ld script ever applied?

No, at that time I didn't have time to look into it, and later you said the (one) computer with that
toolchain had died (so you were going to use a newer one?).

I tried to build a newer one but got stuck (crosstool seems no longer maintained, that's what I used last time). Then the disk with all the m68k stuff on it died. I've found some info on Ubuntus bug pages on getting 4.4 to build as cross compiler, I'll try again using that for starters.

Quoted 4 lines
Quoted 1 line

Lots of patches - much appreciated!

Eventually, the EtherNAT support should be merged with the standard driver anyway,,,

But for the polled interrupt kludge I agree. Last time I checked the interrupt to use for the EtherNAT is beyond what we currently reserve in the Atari interrupt map, so I'd have to change the max number of interrupts - what are the repercussions for doing this?

Michael

#15 lore raw
Quoted 10 lines · Michael Schmitz
Quoted 5 lines
Quoted 1 line

Was my backwards compatibility patch to the kernel ld script ever applied?

No, at that time I didn't have time to look into it, and later you said the (one) computer with that
toolchain had died (so you were going to use a newer one?).

I tried to build a newer one but got stuck (crosstool seems no longer maintained, that's what I used last time). Then the disk with all the m68k stuff on it died. I've found some info on Ubuntus bug pages on getting 4.4 to build as cross compiler, I'll try again using that for starters.

This is what I used (for the 4.1.2 compiler):

http://people.debian.org/~smarenka/m68k/cross-compilers/aaareadme.txt
http://www.xs4all.nl/~zippel/crosscc/crosscc.README

When building on Ubuntu, you have to delete the following lines from gcc-4.1-4.1.1ds2/debian/rules.defs first:

     ifeq ($(distribution),Ubuntu)
       GFDL_INVARIANT_FREE=no
     endif

With some versions of debhelper, the linker cannot find some library. You can work around this bug by prefixing the make command with

     LD_LIBRARY_PATH=/usr/m68k-linux-gnu/lib

Alternatively, Emdebian seems to have some older toolchain binaries, but I never tried them.

Quoted 7 lines
Quoted 2 lines

Eventually, the EtherNAT support should be merged with the standard driver anyway,,,

But for the polled interrupt kludge I agree. Last time I checked the interrupt to use for the EtherNAT is beyond what we currently reserve in the Atari interrupt map, so I'd have to change the max number of interrupts - what are the repercussions for doing this?

VME, Sun 3, and Coldfire already support more interrupts than Atari, so the core code should handle this fine.

Which reminds me we still have to move to the generic hardirq framework...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds