All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] m68k/atari: Add ARAnyM support
@ 2011-02-06 10:51 Geert Uytterhoeven
  2011-02-06 10:51 ` [PATCH 1/4] m68k/atari: Initial " Geert Uytterhoeven
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2011-02-06 10:51 UTC (permalink / raw)
  To: linux-m68k, linux-kernel, cz-bobek-lists-aranym

This patch series add improved support for running under the ARAnyM emulator
(Atari Running on Any Machine - http://aranym.org/).
Without these patches, you can run a Linux/m68k kernel with Atari support
under ARAnyM (it emulates the IDE interface), but you can't have network and
console access.

This support has been in active use for several years. In fact some Debian
build daemons run under ARAnyM, as it's the fastest m68k platform around.

  [1/4] m68k/atari: Initial ARAnyM support
  [2/4] m68k/atari: ARAnyM - Add support for block access
  [3/4] m68k/atari: ARAnyM - Add support for console access
  [4/4] m68k/atari: ARAnyM - Add support for network access

Questions:
  - Who should be listed as author for patches 1 and 4?
  - Can I please have Signed-off-by's from the ARAnyM people?

 arch/m68k/Kconfig               |   31 +++++
 arch/m68k/Makefile              |    1 +
 arch/m68k/emu/Makefile          |    9 ++
 arch/m68k/emu/natfeat.c         |   78 +++++++++++
 arch/m68k/emu/nfblock.c         |  195 ++++++++++++++++++++++++++++
 arch/m68k/emu/nfcon.c           |  162 +++++++++++++++++++++++
 arch/m68k/emu/nfeth.c           |  272 +++++++++++++++++++++++++++++++++++++++
 arch/m68k/include/asm/natfeat.h |   22 +++
 arch/m68k/kernel/setup.c        |    5 +
 9 files changed, 775 insertions(+), 0 deletions(-)

Thanks in advance!

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

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

* [PATCH 1/4] m68k/atari: Initial ARAnyM support
  2011-02-06 10:51 [PATCH 0/4] m68k/atari: Add ARAnyM support Geert Uytterhoeven
@ 2011-02-06 10:51 ` Geert Uytterhoeven
  2011-02-06 12:26   ` Petr Stehlik
  2011-02-06 10:51 ` [PATCH 2/4] m68k/atari: ARAnyM - Add support for block access Geert Uytterhoeven
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Geert Uytterhoeven @ 2011-02-06 10:51 UTC (permalink / raw)
  To: linux-m68k, linux-kernel, cz-bobek-lists-aranym
  Cc: Michael Schmitz, Geert Uytterhoeven, Petr Stehlik

From: Michael Schmitz <schmitz@opal.biophys.uni-duesseldorf.de>

Should be signed off by Petr, really.

[geert] Cleanups and updates
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Petr Stehlik <pstehlik@sophics.cz>

---
Changelog:
  - Export native feature API,
  - Remove bogus line from Kconfig help.
---
 arch/m68k/Kconfig               |    7 +++
 arch/m68k/Makefile              |    1 +
 arch/m68k/emu/Makefile          |    5 ++
 arch/m68k/emu/natfeat.c         |   78 +++++++++++++++++++++++++++++++++++++++
 arch/m68k/include/asm/natfeat.h |   22 +++++++++++
 arch/m68k/kernel/setup.c        |    5 ++
 6 files changed, 118 insertions(+), 0 deletions(-)
 create mode 100644 arch/m68k/emu/Makefile
 create mode 100644 arch/m68k/emu/natfeat.c
 create mode 100644 arch/m68k/include/asm/natfeat.h

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index cbe8b18..f668a58 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -240,6 +240,13 @@ config SUN3
 
 	  If you don't want to compile a kernel exclusively for a Sun 3, say N.
 
+config NATFEAT
+	bool "ARAnyM emulator support"
+	depends on ATARI
+	help
+	  This option enables support for ARAnyM native features, such as
+	  access to a disk image as /dev/hda.
+
 comment "Processor type"
 
 config M68020
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index b06a7e3..b793163 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -76,6 +76,7 @@ core-$(CONFIG_MVME16x)		+= arch/m68k/mvme16x/
 core-$(CONFIG_BVME6000)		+= arch/m68k/bvme6000/
 core-$(CONFIG_SUN3X)		+= arch/m68k/sun3x/	arch/m68k/sun3/
 core-$(CONFIG_SUN3)		+= arch/m68k/sun3/	arch/m68k/sun3/prom/
+core-$(CONFIG_NATFEAT)		+= arch/m68k/emu/
 core-$(CONFIG_M68040)		+= arch/m68k/fpsp040/
 core-$(CONFIG_M68060)		+= arch/m68k/ifpsp060/
 core-$(CONFIG_M68KFPU_EMU)	+= arch/m68k/math-emu/
diff --git a/arch/m68k/emu/Makefile b/arch/m68k/emu/Makefile
new file mode 100644
index 0000000..34cfa34
--- /dev/null
+++ b/arch/m68k/emu/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for Linux arch/m68k/emu source directory
+#
+
+obj-y			+= natfeat.o
diff --git a/arch/m68k/emu/natfeat.c b/arch/m68k/emu/natfeat.c
new file mode 100644
index 0000000..2291a7d
--- /dev/null
+++ b/arch/m68k/emu/natfeat.c
@@ -0,0 +1,78 @@
+/*
+ * natfeat.c - ARAnyM hardware support via Native Features (natfeats)
+ *
+ * Copyright (c) 2005 Petr Stehlik of ARAnyM dev team
+ *
+ * Reworked for Linux by Roman Zippel <zippel@linux-m68k.org>
+ *
+ * This software may be used and distributed according to the terms of
+ * the GNU General Public License (GPL), incorporated herein by reference.
+ */
+
+#include <linux/types.h>
+#include <linux/console.h>
+#include <linux/string.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/io.h>
+#include <asm/machdep.h>
+#include <asm/natfeat.h>
+
+asm("\n"
+"	.global nf_get_id,nf_call\n"
+"nf_get_id:\n"
+"	.short	0x7300\n"
+"	rts\n"
+"nf_call:\n"
+"	.short	0x7301\n"
+"	rts\n"
+"1:	moveq.l	#0,%d0\n"
+"	rts\n"
+"	.section __ex_table,\"a\"\n"
+"	.long	nf_get_id,1b\n"
+"	.long	nf_call,1b\n"
+"	.previous");
+EXPORT_SYMBOL_GPL(nf_get_id);
+EXPORT_SYMBOL_GPL(nf_call);
+
+void nfprint(const char *fmt, ...)
+{
+	static char buf[256];
+	va_list ap;
+	int n;
+
+	va_start(ap, fmt);
+	n = vsnprintf(buf, 256, fmt, ap);
+	nf_call(nf_get_id("NF_STDERR"), buf);
+	va_end(ap);
+}
+
+static void nf_poweroff(void)
+{
+	long id = nf_get_id("NF_SHUTDOWN");
+
+	if (id)
+		nf_call(id);
+}
+
+void nf_init(void)
+{
+	unsigned long id, version;
+	char buf[256];
+
+	id = nf_get_id("NF_VERSION");
+	if (!id)
+		return;
+	version = nf_call(id);
+
+	id = nf_get_id("NF_NAME");
+	if (!id)
+		return;
+	nf_call(id, buf, 256);
+	buf[255] = 0;
+
+	pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16,
+		version & 0xffff);
+
+	mach_power_off = nf_poweroff;
+}
diff --git a/arch/m68k/include/asm/natfeat.h b/arch/m68k/include/asm/natfeat.h
new file mode 100644
index 0000000..a3521b8
--- /dev/null
+++ b/arch/m68k/include/asm/natfeat.h
@@ -0,0 +1,22 @@
+/*
+ * ARAnyM hardware support via Native Features (natfeats)
+ *
+ * Copyright (c) 2005 Petr Stehlik of ARAnyM dev team
+ *
+ * This software may be used and distributed according to the terms of
+ * the GNU General Public License (GPL), incorporated herein by reference.
+ */
+
+#ifndef _NATFEAT_H
+#define _NATFEAT_H
+
+long nf_get_id(const char *feature_name);
+long nf_call(long id, ...);
+
+void nf_init(void);
+void nf_shutdown(void);
+
+void nfprint(const char *fmt, ...)
+	__attribute__ ((format (printf, 1, 2)));
+
+# endif /* _NATFEAT_H */
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index b3963ab..334d836 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -42,6 +42,7 @@
 #ifdef CONFIG_SUN3X
 #include <asm/dvma.h>
 #endif
+#include <asm/natfeat.h>
 
 #if !FPSTATESIZE || !NR_IRQS
 #warning No CPU/platform type selected, your kernel will not work!
@@ -324,6 +325,10 @@ void __init setup_arch(char **cmdline_p)
 		panic("No configuration setup");
 	}
 
+#ifdef CONFIG_NATFEAT
+	nf_init();
+#endif
+
 	paging_init();
 
 #ifndef CONFIG_SUN3
-- 
1.7.0.4


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

* [PATCH 2/4] m68k/atari: ARAnyM - Add support for block access
  2011-02-06 10:51 [PATCH 0/4] m68k/atari: Add ARAnyM support Geert Uytterhoeven
  2011-02-06 10:51 ` [PATCH 1/4] m68k/atari: Initial " Geert Uytterhoeven
@ 2011-02-06 10:51 ` Geert Uytterhoeven
  2011-02-06 12:27   ` Petr Stehlik
  2011-02-06 10:51 ` [PATCH 3/4] m68k/atari: ARAnyM - Add support for console access Geert Uytterhoeven
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Geert Uytterhoeven @ 2011-02-06 10:51 UTC (permalink / raw)
  To: linux-m68k, linux-kernel, cz-bobek-lists-aranym
  Cc: Roman Zippel, Geert Uytterhoeven, Petr Stehlik

From: Roman Zippel <zippel@linux-m68k.org>

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
[geert] Cleanups and updates
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Petr Stehlik <pstehlik@sophics.cz>

---
Changelog:
  - Wrap natfeat calls

    Add wrappers with proper prototypes for the natfeat calls in nfblock.
    This fixes the problem where sector_t was pushed on the stack as a 64-bit
    value if CONFIG_LBDAF=y, while all parameters of the nf_call() varargs
    function are 32-bit.

  - Update for v2.6.31 block layer changes,
  - nfblock needs <linux/slab.h>,
  - Make needlessly global functions static,
  - Make struct block_device_operations const,
  - Use pr_*(),
  - Propagate error code from register_blkdev().
---
 arch/m68k/Kconfig       |    8 ++
 arch/m68k/emu/Makefile  |    2 +
 arch/m68k/emu/nfblock.c |  195 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 205 insertions(+), 0 deletions(-)
 create mode 100644 arch/m68k/emu/nfblock.c

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index f668a58..2c890b5 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -247,6 +247,14 @@ config NATFEAT
 	  This option enables support for ARAnyM native features, such as
 	  access to a disk image as /dev/hda.
 
+config NFBLOCK
+	tristate "NatFeat block device support"
+	depends on BLOCK && NATFEAT
+	help
+	  Say Y to include support for the ARAnyM NatFeat block device
+	  which allows direct access to the hard drives without using
+	  the hardware emulation.
+
 comment "Processor type"
 
 config M68020
diff --git a/arch/m68k/emu/Makefile b/arch/m68k/emu/Makefile
index 34cfa34..fc4f77a 100644
--- a/arch/m68k/emu/Makefile
+++ b/arch/m68k/emu/Makefile
@@ -3,3 +3,5 @@
 #
 
 obj-y			+= natfeat.o
+
+obj-$(CONFIG_NFBLOCK)	+= nfblock.o
diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c
new file mode 100644
index 0000000..48e50f8
--- /dev/null
+++ b/arch/m68k/emu/nfblock.c
@@ -0,0 +1,195 @@
+/*
+ * ARAnyM block device driver
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/init.h>
+
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/types.h>
+#include <linux/genhd.h>
+#include <linux/blkdev.h>
+#include <linux/hdreg.h>
+#include <linux/slab.h>
+
+#include <asm/natfeat.h>
+
+static long nfhd_id;
+
+enum {
+	/* emulation entry points */
+	NFHD_READ_WRITE = 10,
+	NFHD_GET_CAPACITY = 14,
+
+	/* skip ACSI devices */
+	NFHD_DEV_OFFSET = 8,
+};
+
+static inline s32 nfhd_read_write(u32 major, u32 minor, u32 rwflag, u32 recno,
+				  u32 count, u32 buf)
+{
+	return nf_call(nfhd_id + NFHD_READ_WRITE, major, minor, rwflag, recno,
+		       count, buf);
+}
+
+static inline s32 nfhd_get_capacity(u32 major, u32 minor, u32 *blocks,
+				    u32 *blocksize)
+{
+	return nf_call(nfhd_id + NFHD_GET_CAPACITY, major, minor, blocks,
+		       blocksize);
+}
+
+static LIST_HEAD(nfhd_list);
+
+static int major_num;
+module_param(major_num, int, 0);
+
+struct nfhd_device {
+	struct list_head list;
+	int id;
+	u32 blocks, bsize;
+	int bshift;
+	struct request_queue *queue;
+	struct gendisk *disk;
+};
+
+static int nfhd_make_request(struct request_queue *queue, struct bio *bio)
+{
+	struct nfhd_device *dev = queue->queuedata;
+	struct bio_vec *bvec;
+	int i, dir, len, shift;
+	sector_t sec = bio->bi_sector;
+
+	dir = bio_data_dir(bio);
+	shift = dev->bshift;
+	bio_for_each_segment(bvec, bio, i) {
+		len = bvec->bv_len;
+		len >>= 9;
+		nfhd_read_write(dev->id, 0, dir, sec >> shift, len >> shift,
+				bvec_to_phys(bvec));
+		sec += len;
+	}
+	bio_endio(bio, 0);
+	return 0;
+}
+
+static int nfhd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
+{
+	struct nfhd_device *dev = bdev->bd_disk->private_data;
+
+	geo->cylinders = dev->blocks >> (6 - dev->bshift);
+	geo->heads = 4;
+	geo->sectors = 16;
+
+	return 0;
+}
+
+static const struct block_device_operations nfhd_ops = {
+	.owner	= THIS_MODULE,
+	.getgeo	= nfhd_getgeo,
+};
+
+static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
+{
+	struct nfhd_device *dev;
+	int dev_id = id - NFHD_DEV_OFFSET;
+
+	pr_info("nfhd%u: found device with %u blocks (%u bytes)\n", dev_id,
+		blocks, bsize);
+
+	if (bsize < 512 || (bsize & (bsize - 1))) {
+		pr_warn("nfhd%u: invalid block size\n", dev_id);
+		return -EINVAL;
+	}
+
+	dev = kmalloc(sizeof(struct nfhd_device), GFP_KERNEL);
+	if (!dev)
+		goto out;
+
+	dev->id = id;
+	dev->blocks = blocks;
+	dev->bsize = bsize;
+	dev->bshift = ffs(bsize) - 10;
+
+	dev->queue = blk_alloc_queue(GFP_KERNEL);
+	if (dev->queue == NULL)
+		goto free_dev;
+
+	dev->queue->queuedata = dev;
+	blk_queue_make_request(dev->queue, nfhd_make_request);
+	blk_queue_logical_block_size(dev->queue, bsize);
+
+	dev->disk = alloc_disk(16);
+	if (!dev->disk)
+		goto free_queue;
+
+	dev->disk->major = major_num;
+	dev->disk->first_minor = dev_id * 16;
+	dev->disk->fops = &nfhd_ops;
+	dev->disk->private_data = dev;
+	sprintf(dev->disk->disk_name, "nfhd%u", dev_id);
+	set_capacity(dev->disk, (sector_t)blocks * (bsize / 512));
+	dev->disk->queue = dev->queue;
+
+	add_disk(dev->disk);
+
+	list_add_tail(&dev->list, &nfhd_list);
+
+	return 0;
+
+free_queue:
+	blk_cleanup_queue(dev->queue);
+free_dev:
+	kfree(dev);
+out:
+	return -ENOMEM;
+}
+
+static int __init nfhd_init(void)
+{
+	u32 blocks, bsize;
+	int i;
+
+	nfhd_id = nf_get_id("XHDI");
+	if (!nfhd_id)
+		return -ENODEV;
+
+	major_num = register_blkdev(major_num, "nfhd");
+	if (major_num <= 0) {
+		pr_warn("nfhd: unable to get major number\n");
+		return major_num;
+	}
+
+	for (i = NFHD_DEV_OFFSET; i < 24; i++) {
+		if (nfhd_get_capacity(i, 0, &blocks, &bsize))
+			continue;
+		nfhd_init_one(i, blocks, bsize);
+	}
+
+	return 0;
+}
+
+static void __exit nfhd_exit(void)
+{
+	struct nfhd_device *dev, *next;
+
+	list_for_each_entry_safe(dev, next, &nfhd_list, list) {
+		list_del(&dev->list);
+		del_gendisk(dev->disk);
+		put_disk(dev->disk);
+		blk_cleanup_queue(dev->queue);
+		kfree(dev);
+	}
+	unregister_blkdev(major_num, "nfhd");
+}
+
+module_init(nfhd_init);
+module_exit(nfhd_exit);
+
+MODULE_LICENSE("GPL");
-- 
1.7.0.4


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

* [PATCH 3/4] m68k/atari: ARAnyM - Add support for console access
  2011-02-06 10:51 [PATCH 0/4] m68k/atari: Add ARAnyM support Geert Uytterhoeven
  2011-02-06 10:51 ` [PATCH 1/4] m68k/atari: Initial " Geert Uytterhoeven
  2011-02-06 10:51 ` [PATCH 2/4] m68k/atari: ARAnyM - Add support for block access Geert Uytterhoeven
@ 2011-02-06 10:51 ` Geert Uytterhoeven
  2011-02-06 12:28   ` Petr Stehlik
  2011-02-06 10:51 ` [PATCH 4/4] m68k/atari: ARAnyM - Add support for network access Geert Uytterhoeven
  2011-02-06 12:24 ` [Aranym-dev] [PATCH 0/4] m68k/atari: Add ARAnyM support Petr Stehlik
  4 siblings, 1 reply; 14+ messages in thread
From: Geert Uytterhoeven @ 2011-02-06 10:51 UTC (permalink / raw)
  To: linux-m68k, linux-kernel, cz-bobek-lists-aranym
  Cc: Roman Zippel, Geert Uytterhoeven, Petr Stehlik

From: Roman Zippel <zippel@linux-m68k.org>

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
[geert] Cleanups and updates
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Petr Stehlik <pstehlik@sophics.cz>

---
Changelog:
  - early_param() does not exist in the modular case,
  - Break too long lines,
  - Make needlessly global functions static,
  - Use pr_*(),
  - Extract nfputs(), to avoid code duplication in nfcon_write() and
    nfcon_tty_write().
---
 arch/m68k/Kconfig      |    8 +++
 arch/m68k/emu/Makefile |    1 +
 arch/m68k/emu/nfcon.c  |  162 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 171 insertions(+), 0 deletions(-)
 create mode 100644 arch/m68k/emu/nfcon.c

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 2c890b5..6719c56 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -255,6 +255,14 @@ config NFBLOCK
 	  which allows direct access to the hard drives without using
 	  the hardware emulation.
 
+config NFCON
+	tristate "NatFeat console driver"
+	depends on NATFEAT
+	help
+	  Say Y to include support for the ARAnyM NatFeat console driver
+	  which allows the console output to be redirected to the stderr
+	  output of ARAnyM.
+
 comment "Processor type"
 
 config M68020
diff --git a/arch/m68k/emu/Makefile b/arch/m68k/emu/Makefile
index fc4f77a..a83ef1e 100644
--- a/arch/m68k/emu/Makefile
+++ b/arch/m68k/emu/Makefile
@@ -5,3 +5,4 @@
 obj-y			+= natfeat.o
 
 obj-$(CONFIG_NFBLOCK)	+= nfblock.o
+obj-$(CONFIG_NFCON)	+= nfcon.o
diff --git a/arch/m68k/emu/nfcon.c b/arch/m68k/emu/nfcon.c
new file mode 100644
index 0000000..ab20dc0
--- /dev/null
+++ b/arch/m68k/emu/nfcon.c
@@ -0,0 +1,162 @@
+/*
+ * ARAnyM console driver
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/console.h>
+#include <linux/tty.h>
+#include <linux/tty_driver.h>
+#include <linux/tty_flip.h>
+#include <linux/slab.h>
+#include <linux/err.h>
+#include <linux/uaccess.h>
+
+#include <asm/natfeat.h>
+
+static int stderr_id;
+static struct tty_driver *nfcon_tty_driver;
+
+static void nfputs(const char *str, unsigned int count)
+{
+	char buf[68];
+
+	buf[64] = 0;
+	while (count > 64) {
+		memcpy(buf, str, 64);
+		nf_call(stderr_id, buf);
+		str += 64;
+		count -= 64;
+	}
+	memcpy(buf, str, count);
+	buf[count] = 0;
+	nf_call(stderr_id, buf);
+}
+
+static void nfcon_write(struct console *con, const char *str,
+			unsigned int count)
+{
+	nfputs(str, count);
+}
+
+static struct tty_driver *nfcon_device(struct console *con, int *index)
+{
+	*index = 0;
+	return (con->flags & CON_ENABLED) ? nfcon_tty_driver : NULL;
+}
+
+static struct console nf_console = {
+	.name	= "nfcon",
+	.write	= nfcon_write,
+	.device	= nfcon_device,
+	.flags	= CON_PRINTBUFFER,
+	.index	= -1,
+};
+
+
+static int nfcon_tty_open(struct tty_struct *tty, struct file *filp)
+{
+	return 0;
+}
+
+static void nfcon_tty_close(struct tty_struct *tty, struct file *filp)
+{
+}
+
+static int nfcon_tty_write(struct tty_struct *tty, const unsigned char *buf,
+			   int count)
+{
+	nfputs(buf, count);
+	return count;
+}
+
+static int nfcon_tty_put_char(struct tty_struct *tty, unsigned char ch)
+{
+	char temp[2] = { ch, 0 };
+
+	nf_call(stderr_id, temp);
+	return 1;
+}
+
+static int nfcon_tty_write_room(struct tty_struct *tty)
+{
+	return 64;
+}
+
+static const struct tty_operations nfcon_tty_ops = {
+	.open		= nfcon_tty_open,
+	.close		= nfcon_tty_close,
+	.write		= nfcon_tty_write,
+	.put_char	= nfcon_tty_put_char,
+	.write_room	= nfcon_tty_write_room,
+};
+
+#ifndef MODULE
+
+static int __init nf_debug_setup(char *arg)
+{
+	if (strcmp(arg, "nfcon"))
+		return 0;
+
+	stderr_id = nf_get_id("NF_STDERR");
+	if (stderr_id) {
+		nf_console.flags |= CON_ENABLED;
+		register_console(&nf_console);
+	}
+
+	return 0;
+}
+
+early_param("debug", nf_debug_setup);
+
+#endif /* !MODULE */
+
+static int __init nfcon_init(void)
+{
+	int res;
+
+	stderr_id = nf_get_id("NF_STDERR");
+	if (!stderr_id)
+		return -ENODEV;
+
+	nfcon_tty_driver = alloc_tty_driver(1);
+	if (!nfcon_tty_driver)
+		return -ENOMEM;
+
+	nfcon_tty_driver->owner = THIS_MODULE;
+	nfcon_tty_driver->driver_name = "nfcon";
+	nfcon_tty_driver->name = "nfcon";
+	nfcon_tty_driver->type = TTY_DRIVER_TYPE_SYSTEM;
+	nfcon_tty_driver->subtype = SYSTEM_TYPE_TTY;
+	nfcon_tty_driver->init_termios = tty_std_termios;
+	nfcon_tty_driver->flags = TTY_DRIVER_REAL_RAW;
+
+	tty_set_operations(nfcon_tty_driver, &nfcon_tty_ops);
+	res = tty_register_driver(nfcon_tty_driver);
+	if (res) {
+		pr_err("failed to register nfcon tty driver\n");
+		put_tty_driver(nfcon_tty_driver);
+		return res;
+	}
+
+	if (!(nf_console.flags & CON_ENABLED))
+		register_console(&nf_console);
+
+	return 0;
+}
+
+static void __exit nfcon_exit(void)
+{
+	unregister_console(&nf_console);
+	tty_unregister_driver(nfcon_tty_driver);
+	put_tty_driver(nfcon_tty_driver);
+}
+
+module_init(nfcon_init);
+module_exit(nfcon_exit);
+
+MODULE_LICENSE("GPL");
-- 
1.7.0.4


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

* [PATCH 4/4] m68k/atari: ARAnyM - Add support for network access
  2011-02-06 10:51 [PATCH 0/4] m68k/atari: Add ARAnyM support Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2011-02-06 10:51 ` [PATCH 3/4] m68k/atari: ARAnyM - Add support for console access Geert Uytterhoeven
@ 2011-02-06 10:51 ` Geert Uytterhoeven
  2011-02-06 12:30   ` Petr Stehlik
                     ` (2 more replies)
  2011-02-06 12:24 ` [Aranym-dev] [PATCH 0/4] m68k/atari: Add ARAnyM support Petr Stehlik
  4 siblings, 3 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2011-02-06 10:51 UTC (permalink / raw)
  To: linux-m68k, linux-kernel, cz-bobek-lists-aranym
  Cc: Michael Schmitz, Geert Uytterhoeven, Petr Stehlik, Milan Jurik, netdev

From: Michael Schmitz <schmitz@opal.biophys.uni-duesseldorf.de>

Should be signed off by Milan and Petr, really.

[geert] Cleanups and updates
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Petr Stehlik <pstehlik@sophics.cz>
Cc: Milan Jurik <M.Jurik@sh.cvut.cz>
Cc: netdev@vger.kernel.org

---
Changelog:
  - Convert to net_device_ops,
  - nfeth doesn't need obsolete <net/ieee80211.h>,
  - Convert print_mac to %pM,
  - Break too long lines,
  - Make needlessly global functions static,
  - Make version[] const,
  - Use pr_*(),
  - Use net_device_stats from struct net_device instead of our own,
  - Propagate error code from request_irq(),
  - Remove unused variable "handled".
---
 arch/m68k/Kconfig      |    8 ++
 arch/m68k/emu/Makefile |    1 +
 arch/m68k/emu/nfeth.c  |  272 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 281 insertions(+), 0 deletions(-)
 create mode 100644 arch/m68k/emu/nfeth.c

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 6719c56..80df6ee 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -263,6 +263,14 @@ config NFCON
 	  which allows the console output to be redirected to the stderr
 	  output of ARAnyM.
 
+config NFETH
+	tristate "NatFeat Ethernet support"
+	depends on NET_ETHERNET && NATFEAT
+	help
+	  Say Y to include support for the ARAnyM NatFeat network device
+	  which will emulate a regular ethernet device while presenting an
+	  ethertap device to the host system.
+
 comment "Processor type"
 
 config M68020
diff --git a/arch/m68k/emu/Makefile b/arch/m68k/emu/Makefile
index a83ef1e..7dc2010 100644
--- a/arch/m68k/emu/Makefile
+++ b/arch/m68k/emu/Makefile
@@ -6,3 +6,4 @@ obj-y			+= natfeat.o
 
 obj-$(CONFIG_NFBLOCK)	+= nfblock.o
 obj-$(CONFIG_NFCON)	+= nfcon.o
+obj-$(CONFIG_NFETH)	+= nfeth.o
diff --git a/arch/m68k/emu/nfeth.c b/arch/m68k/emu/nfeth.c
new file mode 100644
index 0000000..5b2a33d
--- /dev/null
+++ b/arch/m68k/emu/nfeth.c
@@ -0,0 +1,272 @@
+/*
+ * atari_nfeth.c - ARAnyM ethernet card driver for GNU/Linux
+ *
+ * Copyright (c) 2005 Milan Jurik, Petr Stehlik of ARAnyM dev team
+ *
+ * Based on ARAnyM driver for FreeMiNT written by Standa Opichal
+ *
+ * This software may be used and distributed according to the terms of
+ * the GNU General Public License (GPL), incorporated herein by reference.
+ */
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/module.h>
+#include <asm/natfeat.h>
+#include <asm/virtconvert.h>
+
+enum {
+	GET_VERSION = 0,/* no parameters, return NFAPI_VERSION in d0 */
+	XIF_INTLEVEL,	/* no parameters, return Interrupt Level in d0 */
+	XIF_IRQ,	/* acknowledge interrupt from host */
+	XIF_START,	/* (ethX), called on 'ifup', start receiver thread */
+	XIF_STOP,	/* (ethX), called on 'ifdown', stop the thread */
+	XIF_READLENGTH,	/* (ethX), return size of network data block to read */
+	XIF_READBLOCK,	/* (ethX, buffer, size), read block of network data */
+	XIF_WRITEBLOCK,	/* (ethX, buffer, size), write block of network data */
+	XIF_GET_MAC,	/* (ethX, buffer, size), return MAC HW addr in buffer */
+	XIF_GET_IPHOST,	/* (ethX, buffer, size), return IP address of host */
+	XIF_GET_IPATARI,/* (ethX, buffer, size), return IP address of atari */
+	XIF_GET_NETMASK	/* (ethX, buffer, size), return IP netmask */
+};
+
+#define DRV_NAME	"nfeth"
+#define DRV_VERSION	"0.3"
+#define DRV_RELDATE	"10/12/2005"
+
+#define MAX_UNIT	8
+
+/* These identify the driver base version and may not be removed. */
+static const char version[] __devinitdata =
+	KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE
+	" S.Opichal, M.Jurik, P.Stehlik\n"
+	KERN_INFO " http://aranym.atari.org/\n";
+
+MODULE_AUTHOR("Milan Jurik");
+MODULE_DESCRIPTION("Atari NFeth driver");
+MODULE_LICENSE("GPL");
+/*
+MODULE_PARM(nfeth_debug, "i");
+MODULE_PARM_DESC(nfeth_debug, "nfeth_debug level (1-2)");
+*/
+
+
+static long nfEtherID;
+static int nfEtherIRQ;
+
+struct nfeth_private {
+	int ethX;
+};
+
+static struct net_device *nfeth_dev[MAX_UNIT];
+
+static int nfeth_open(struct net_device *dev)
+{
+	struct nfeth_private *priv = netdev_priv(dev);
+	int res;
+
+	res = nf_call(nfEtherID + XIF_START, priv->ethX);
+
+	pr_debug(DRV_NAME ": open %d\n", res);
+
+	/* Ready for data */
+	netif_start_queue(dev);
+
+	return 0;
+}
+
+static int nfeth_stop(struct net_device *dev)
+{
+	struct nfeth_private *priv = netdev_priv(dev);
+
+	/* No more data */
+	netif_stop_queue(dev);
+
+	nf_call(nfEtherID + XIF_STOP, priv->ethX);
+
+	return 0;
+}
+
+/*
+ * Read a packet out of the adapter and pass it to the upper layers
+ */
+static inline void recv_packet(struct net_device *dev)
+{
+	struct nfeth_private *priv = netdev_priv(dev);
+	unsigned short pktlen;
+	struct sk_buff *skb;
+
+	/* read packet length (excluding 32 bit crc) */
+	pktlen = nf_call(nfEtherID + XIF_READLENGTH, priv->ethX);
+
+	pr_debug(DRV_NAME ": recv_packet: %i\n", pktlen);
+
+	if (!pktlen) {
+		pr_debug(DRV_NAME ": recv_packet: pktlen == 0\n");
+		dev->stats.rx_errors++;
+		return;
+	}
+
+	skb = dev_alloc_skb(pktlen + 2);
+	if (!skb) {
+		pr_debug(DRV_NAME
+			 ": recv_packet: out of mem (buf_alloc failed)\n");
+		dev->stats.rx_dropped++;
+		return;
+	}
+
+	skb->dev = dev;
+	skb_reserve(skb, 2);		/* 16 Byte align  */
+	skb_put(skb, pktlen);		/* make room */
+	nf_call(nfEtherID + XIF_READBLOCK, priv->ethX, virt_to_phys(skb->data),
+		pktlen);
+
+	skb->protocol = eth_type_trans(skb, dev);
+	netif_rx(skb);
+	dev->last_rx = jiffies;
+	dev->stats.rx_packets++;
+	dev->stats.rx_bytes += pktlen;
+
+	/* and enqueue packet */
+	return;
+}
+
+static irqreturn_t nfeth_interrupt(int irq, void *dev_id)
+{
+	int i, m, mask;
+
+	mask = nf_call(nfEtherID + XIF_IRQ, 0);
+	for (i = 0, m = 1; i < MAX_UNIT; m <<= 1, i++) {
+		if (mask & m && nfeth_dev[i]) {
+			recv_packet(nfeth_dev[i]);
+			nf_call(nfEtherID + XIF_IRQ, m);
+		}
+	}
+	return IRQ_HANDLED;
+}
+
+static int nfeth_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+	int len;
+	char *data, shortpkt[ETH_ZLEN];
+	struct nfeth_private *priv = netdev_priv(dev);
+
+	data = skb->data;
+	len = skb->len;
+	if (len < ETH_ZLEN) {
+		memset(shortpkt, 0, ETH_ZLEN);
+		memcpy(shortpkt, data, len);
+		data = shortpkt;
+		len = ETH_ZLEN;
+	}
+
+	dev->trans_start = jiffies;
+
+	pr_debug(DRV_NAME ": send %d bytes\n", len);
+	nf_call(nfEtherID + XIF_WRITEBLOCK, priv->ethX, virt_to_phys(data),
+		len);
+
+	dev->stats.tx_packets++;
+	dev->stats.tx_bytes += len;
+
+	dev_kfree_skb(skb);
+	return 0;
+}
+
+static void nfeth_tx_timeout(struct net_device *dev)
+{
+	dev->stats.tx_errors++;
+	netif_wake_queue(dev);
+}
+
+static const struct net_device_ops nfeth_netdev_ops = {
+	.ndo_open		= nfeth_open,
+	.ndo_stop		= nfeth_stop,
+	.ndo_start_xmit		= nfeth_xmit,
+	.ndo_tx_timeout		= nfeth_tx_timeout,
+	.ndo_validate_addr	= eth_validate_addr,
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_set_mac_address	= eth_mac_addr,
+};
+
+static struct net_device * __init nfeth_probe(int unit)
+{
+	struct net_device *dev;
+	struct nfeth_private *priv;
+	char mac[ETH_ALEN], host_ip[32], local_ip[32];
+	int err;
+
+	if (!nf_call(nfEtherID + XIF_GET_MAC, unit, mac, ETH_ALEN))
+		return NULL;
+
+	dev = alloc_etherdev(sizeof(struct nfeth_private));
+	if (!dev)
+		return NULL;
+
+	dev->irq = nfEtherIRQ;
+	dev->netdev_ops = &nfeth_netdev_ops;
+
+	dev->flags |= NETIF_F_NO_CSUM;
+	memcpy(dev->dev_addr, mac, ETH_ALEN);
+
+	priv = netdev_priv(dev);
+	priv->ethX = unit;
+
+	err = register_netdev(dev);
+	if (err) {
+		free_netdev(dev);
+		return NULL;
+	}
+
+	nf_call(nfEtherID + XIF_GET_IPHOST, unit,
+		host_ip, sizeof(host_ip));
+	nf_call(nfEtherID + XIF_GET_IPATARI, unit,
+		local_ip, sizeof(local_ip));
+
+	pr_info("%s: nfeth addr:%s (%s) HWaddr:%pM\n", dev->name, host_ip,
+		local_ip, mac);
+
+	return dev;
+}
+
+static int __init nfeth_init(void)
+{
+	long ver;
+	int error, i;
+
+	nfEtherID = nf_get_id("ETHERNET");
+	if (!nfEtherID)
+		return -ENODEV;
+
+	ver = nf_call(nfEtherID + GET_VERSION);
+	pr_info("nfeth API %lu\n", ver);
+
+	nfEtherIRQ = nf_call(nfEtherID + XIF_INTLEVEL);
+	error = request_irq(nfEtherIRQ, nfeth_interrupt, IRQF_SHARED,
+			    "eth emu", nfeth_interrupt);
+	if (error) {
+		pr_err("nfeth: request for irq %d failed", nfEtherIRQ);
+		return error;
+	}
+
+	for (i = 0; i < MAX_UNIT; i++)
+		nfeth_dev[i] = nfeth_probe(i);
+
+	return 0;
+}
+
+static void __exit nfeth_cleanup(void)
+{
+	int i;
+
+	for (i = 0; i < MAX_UNIT; i++) {
+		if (nfeth_dev[i]) {
+			unregister_netdev(nfeth_dev[0]);
+			free_netdev(nfeth_dev[0]);
+		}
+	}
+	free_irq(nfEtherIRQ, nfeth_interrupt);
+}
+
+module_init(nfeth_init);
+module_exit(nfeth_cleanup);
-- 
1.7.0.4


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

* Re: [Aranym-dev] [PATCH 0/4] m68k/atari: Add ARAnyM support
  2011-02-06 10:51 [PATCH 0/4] m68k/atari: Add ARAnyM support Geert Uytterhoeven
                   ` (3 preceding siblings ...)
  2011-02-06 10:51 ` [PATCH 4/4] m68k/atari: ARAnyM - Add support for network access Geert Uytterhoeven
@ 2011-02-06 12:24 ` Petr Stehlik
  4 siblings, 0 replies; 14+ messages in thread
From: Petr Stehlik @ 2011-02-06 12:24 UTC (permalink / raw)
  To: aranym; +Cc: linux-m68k, linux-kernel

Geert Uytterhoeven píše v Ne 06. 02. 2011 v 11:51 +0100:
> Questions:
>   - Who should be listed as author for patches 1 and 4?

initial authors are

1 - Petr Stehlik
4 - Milan Jurik, Petr Stehlik

but of course Michael Schmitz a Roman Zippel updated and reworked the
ARAnyM support in the linux kernel significantly which should be
mentioned somewhere as well. And the network patch was based on Standa
Opichal's FreeMiNT driver.

>   - Can I please have Signed-off-by's from the ARAnyM people?

Signed-off-by: Petr Stehlik <pstehlik@sophics.cz>

Thanks, looking forward to running vanilla linux kernel on ARAnyM :-)

Petr



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

* Re: [PATCH 1/4] m68k/atari: Initial ARAnyM support
  2011-02-06 10:51 ` [PATCH 1/4] m68k/atari: Initial " Geert Uytterhoeven
@ 2011-02-06 12:26   ` Petr Stehlik
  0 siblings, 0 replies; 14+ messages in thread
From: Petr Stehlik @ 2011-02-06 12:26 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-m68k, linux-kernel, cz-bobek-lists-aranym, Michael Schmitz

Geert Uytterhoeven píše v Ne 06. 02. 2011 v 11:51 +0100:
> From: Michael Schmitz <schmitz@opal.biophys.uni-duesseldorf.de>
> 
> Should be signed off by Petr, really.

Signed-off-by: Petr Stehlik <pstehlik@sophics.cz>

Petr



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

* Re: [PATCH 2/4] m68k/atari: ARAnyM - Add support for block access
  2011-02-06 10:51 ` [PATCH 2/4] m68k/atari: ARAnyM - Add support for block access Geert Uytterhoeven
@ 2011-02-06 12:27   ` Petr Stehlik
  0 siblings, 0 replies; 14+ messages in thread
From: Petr Stehlik @ 2011-02-06 12:27 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-m68k, linux-kernel, cz-bobek-lists-aranym, Roman Zippel

Geert Uytterhoeven píše v Ne 06. 02. 2011 v 11:51 +0100:
> From: Roman Zippel <zippel@linux-m68k.org>
> 
> Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
> [geert] Cleanups and updates
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Petr Stehlik <pstehlik@sophics.cz>

Signed-off-by: Petr Stehlik <pstehlik@sophics.cz>

Petr



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

* Re: [PATCH 3/4] m68k/atari: ARAnyM - Add support for console access
  2011-02-06 10:51 ` [PATCH 3/4] m68k/atari: ARAnyM - Add support for console access Geert Uytterhoeven
@ 2011-02-06 12:28   ` Petr Stehlik
  0 siblings, 0 replies; 14+ messages in thread
From: Petr Stehlik @ 2011-02-06 12:28 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-m68k, linux-kernel, cz-bobek-lists-aranym, Roman Zippel

Geert Uytterhoeven píše v Ne 06. 02. 2011 v 11:51 +0100:
> From: Roman Zippel <zippel@linux-m68k.org>
> 
> Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
> [geert] Cleanups and updates
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Petr Stehlik <pstehlik@sophics.cz>

Signed-off-by: Petr Stehlik <pstehlik@sophics.cz>

Petr



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

* Re: [PATCH 4/4] m68k/atari: ARAnyM - Add support for network access
  2011-02-06 10:51 ` [PATCH 4/4] m68k/atari: ARAnyM - Add support for network access Geert Uytterhoeven
@ 2011-02-06 12:30   ` Petr Stehlik
  2011-02-06 12:52     ` Milan Jurik
  2011-02-06 19:17   ` David Miller
  2 siblings, 0 replies; 14+ messages in thread
From: Petr Stehlik @ 2011-02-06 12:30 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-m68k, linux-kernel, cz-bobek-lists-aranym, Michael Schmitz,
	Milan Jurik, netdev

Geert Uytterhoeven píše v Ne 06. 02. 2011 v 11:51 +0100:
> From: Michael Schmitz <schmitz@opal.biophys.uni-duesseldorf.de>
> 
> Should be signed off by Milan and Petr, really.
> 
> [geert] Cleanups and updates
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Petr Stehlik <pstehlik@sophics.cz>

Signed-off-by: Petr Stehlik <pstehlik@sophics.cz>

Petr

P.S. you might want to update the URL - ARAnyM got its own domain:

> +	" S.Opichal, M.Jurik, P.Stehlik\n"
> +	KERN_INFO " http://aranym.atari.org/\n";

+	KERN_INFO " http://aranym.org/\n";



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

* Re: [Aranym-dev] [PATCH 4/4] m68k/atari: ARAnyM - Add support for network access
  2011-02-06 10:51 ` [PATCH 4/4] m68k/atari: ARAnyM - Add support for network access Geert Uytterhoeven
@ 2011-02-06 12:52     ` Milan Jurik
  2011-02-06 12:52     ` Milan Jurik
  2011-02-06 19:17   ` David Miller
  2 siblings, 0 replies; 14+ messages in thread
From: Milan Jurik @ 2011-02-06 12:52 UTC (permalink / raw)
  To: aranym
  Cc: linux-m68k, linux-kernel, cz-bobek-lists-aranym, Milan Jurik,
	Michael Schmitz, netdev, Geert Uytterhoeven

Hi,

Signed-off-by: Milan Jurik <milan.jurik@xylab.cz>

The original e-mail address is dead for some time.

Best regards,

Milan

Geert Uytterhoeven píše v ne 06. 02. 2011 v 11:51 +0100:
> From: Michael Schmitz <schmitz@opal.biophys.uni-duesseldorf.de>
> 
> Should be signed off by Milan and Petr, really.
> 
> [geert] Cleanups and updates
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Petr Stehlik <pstehlik@sophics.cz>
> Cc: Milan Jurik <M.Jurik@sh.cvut.cz>
> Cc: netdev@vger.kernel.org
> 
> ---
> Changelog:
>   - Convert to net_device_ops,
>   - nfeth doesn't need obsolete <net/ieee80211.h>,
>   - Convert print_mac to %pM,
>   - Break too long lines,
>   - Make needlessly global functions static,
>   - Make version[] const,
>   - Use pr_*(),
>   - Use net_device_stats from struct net_device instead of our own,
>   - Propagate error code from request_irq(),
>   - Remove unused variable "handled".
> ---
>  arch/m68k/Kconfig      |    8 ++
>  arch/m68k/emu/Makefile |    1 +
>  arch/m68k/emu/nfeth.c  |  272 ++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 281 insertions(+), 0 deletions(-)
>  create mode 100644 arch/m68k/emu/nfeth.c
> 
> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
> index 6719c56..80df6ee 100644
> --- a/arch/m68k/Kconfig
> +++ b/arch/m68k/Kconfig
> @@ -263,6 +263,14 @@ config NFCON
>  	  which allows the console output to be redirected to the stderr
>  	  output of ARAnyM.
>  
> +config NFETH
> +	tristate "NatFeat Ethernet support"
> +	depends on NET_ETHERNET && NATFEAT
> +	help
> +	  Say Y to include support for the ARAnyM NatFeat network device
> +	  which will emulate a regular ethernet device while presenting an
> +	  ethertap device to the host system.
> +
>  comment "Processor type"
>  
>  config M68020
> diff --git a/arch/m68k/emu/Makefile b/arch/m68k/emu/Makefile
> index a83ef1e..7dc2010 100644
> --- a/arch/m68k/emu/Makefile
> +++ b/arch/m68k/emu/Makefile
> @@ -6,3 +6,4 @@ obj-y			+= natfeat.o
>  
>  obj-$(CONFIG_NFBLOCK)	+= nfblock.o
>  obj-$(CONFIG_NFCON)	+= nfcon.o
> +obj-$(CONFIG_NFETH)	+= nfeth.o
> diff --git a/arch/m68k/emu/nfeth.c b/arch/m68k/emu/nfeth.c
> new file mode 100644
> index 0000000..5b2a33d
> --- /dev/null
> +++ b/arch/m68k/emu/nfeth.c
> @@ -0,0 +1,272 @@
> +/*
> + * atari_nfeth.c - ARAnyM ethernet card driver for GNU/Linux
> + *
> + * Copyright (c) 2005 Milan Jurik, Petr Stehlik of ARAnyM dev team
> + *
> + * Based on ARAnyM driver for FreeMiNT written by Standa Opichal
> + *
> + * This software may be used and distributed according to the terms of
> + * the GNU General Public License (GPL), incorporated herein by reference.
> + */
> +
> +#include <linux/netdevice.h>
> +#include <linux/etherdevice.h>
> +#include <linux/module.h>
> +#include <asm/natfeat.h>
> +#include <asm/virtconvert.h>
> +
> +enum {
> +	GET_VERSION = 0,/* no parameters, return NFAPI_VERSION in d0 */
> +	XIF_INTLEVEL,	/* no parameters, return Interrupt Level in d0 */
> +	XIF_IRQ,	/* acknowledge interrupt from host */
> +	XIF_START,	/* (ethX), called on 'ifup', start receiver thread */
> +	XIF_STOP,	/* (ethX), called on 'ifdown', stop the thread */
> +	XIF_READLENGTH,	/* (ethX), return size of network data block to read */
> +	XIF_READBLOCK,	/* (ethX, buffer, size), read block of network data */
> +	XIF_WRITEBLOCK,	/* (ethX, buffer, size), write block of network data */
> +	XIF_GET_MAC,	/* (ethX, buffer, size), return MAC HW addr in buffer */
> +	XIF_GET_IPHOST,	/* (ethX, buffer, size), return IP address of host */
> +	XIF_GET_IPATARI,/* (ethX, buffer, size), return IP address of atari */
> +	XIF_GET_NETMASK	/* (ethX, buffer, size), return IP netmask */
> +};
> +
> +#define DRV_NAME	"nfeth"
> +#define DRV_VERSION	"0.3"
> +#define DRV_RELDATE	"10/12/2005"
> +
> +#define MAX_UNIT	8
> +
> +/* These identify the driver base version and may not be removed. */
> +static const char version[] __devinitdata =
> +	KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE
> +	" S.Opichal, M.Jurik, P.Stehlik\n"
> +	KERN_INFO " http://aranym.atari.org/\n";
> +
> +MODULE_AUTHOR("Milan Jurik");
> +MODULE_DESCRIPTION("Atari NFeth driver");
> +MODULE_LICENSE("GPL");
> +/*
> +MODULE_PARM(nfeth_debug, "i");
> +MODULE_PARM_DESC(nfeth_debug, "nfeth_debug level (1-2)");
> +*/
> +
> +
> +static long nfEtherID;
> +static int nfEtherIRQ;
> +
> +struct nfeth_private {
> +	int ethX;
> +};
> +
> +static struct net_device *nfeth_dev[MAX_UNIT];
> +
> +static int nfeth_open(struct net_device *dev)
> +{
> +	struct nfeth_private *priv = netdev_priv(dev);
> +	int res;
> +
> +	res = nf_call(nfEtherID + XIF_START, priv->ethX);
> +
> +	pr_debug(DRV_NAME ": open %d\n", res);
> +
> +	/* Ready for data */
> +	netif_start_queue(dev);
> +
> +	return 0;
> +}
> +
> +static int nfeth_stop(struct net_device *dev)
> +{
> +	struct nfeth_private *priv = netdev_priv(dev);
> +
> +	/* No more data */
> +	netif_stop_queue(dev);
> +
> +	nf_call(nfEtherID + XIF_STOP, priv->ethX);
> +
> +	return 0;
> +}
> +
> +/*
> + * Read a packet out of the adapter and pass it to the upper layers
> + */
> +static inline void recv_packet(struct net_device *dev)
> +{
> +	struct nfeth_private *priv = netdev_priv(dev);
> +	unsigned short pktlen;
> +	struct sk_buff *skb;
> +
> +	/* read packet length (excluding 32 bit crc) */
> +	pktlen = nf_call(nfEtherID + XIF_READLENGTH, priv->ethX);
> +
> +	pr_debug(DRV_NAME ": recv_packet: %i\n", pktlen);
> +
> +	if (!pktlen) {
> +		pr_debug(DRV_NAME ": recv_packet: pktlen == 0\n");
> +		dev->stats.rx_errors++;
> +		return;
> +	}
> +
> +	skb = dev_alloc_skb(pktlen + 2);
> +	if (!skb) {
> +		pr_debug(DRV_NAME
> +			 ": recv_packet: out of mem (buf_alloc failed)\n");
> +		dev->stats.rx_dropped++;
> +		return;
> +	}
> +
> +	skb->dev = dev;
> +	skb_reserve(skb, 2);		/* 16 Byte align  */
> +	skb_put(skb, pktlen);		/* make room */
> +	nf_call(nfEtherID + XIF_READBLOCK, priv->ethX, virt_to_phys(skb->data),
> +		pktlen);
> +
> +	skb->protocol = eth_type_trans(skb, dev);
> +	netif_rx(skb);
> +	dev->last_rx = jiffies;
> +	dev->stats.rx_packets++;
> +	dev->stats.rx_bytes += pktlen;
> +
> +	/* and enqueue packet */
> +	return;
> +}
> +
> +static irqreturn_t nfeth_interrupt(int irq, void *dev_id)
> +{
> +	int i, m, mask;
> +
> +	mask = nf_call(nfEtherID + XIF_IRQ, 0);
> +	for (i = 0, m = 1; i < MAX_UNIT; m <<= 1, i++) {
> +		if (mask & m && nfeth_dev[i]) {
> +			recv_packet(nfeth_dev[i]);
> +			nf_call(nfEtherID + XIF_IRQ, m);
> +		}
> +	}
> +	return IRQ_HANDLED;
> +}
> +
> +static int nfeth_xmit(struct sk_buff *skb, struct net_device *dev)
> +{
> +	int len;
> +	char *data, shortpkt[ETH_ZLEN];
> +	struct nfeth_private *priv = netdev_priv(dev);
> +
> +	data = skb->data;
> +	len = skb->len;
> +	if (len < ETH_ZLEN) {
> +		memset(shortpkt, 0, ETH_ZLEN);
> +		memcpy(shortpkt, data, len);
> +		data = shortpkt;
> +		len = ETH_ZLEN;
> +	}
> +
> +	dev->trans_start = jiffies;
> +
> +	pr_debug(DRV_NAME ": send %d bytes\n", len);
> +	nf_call(nfEtherID + XIF_WRITEBLOCK, priv->ethX, virt_to_phys(data),
> +		len);
> +
> +	dev->stats.tx_packets++;
> +	dev->stats.tx_bytes += len;
> +
> +	dev_kfree_skb(skb);
> +	return 0;
> +}
> +
> +static void nfeth_tx_timeout(struct net_device *dev)
> +{
> +	dev->stats.tx_errors++;
> +	netif_wake_queue(dev);
> +}
> +
> +static const struct net_device_ops nfeth_netdev_ops = {
> +	.ndo_open		= nfeth_open,
> +	.ndo_stop		= nfeth_stop,
> +	.ndo_start_xmit		= nfeth_xmit,
> +	.ndo_tx_timeout		= nfeth_tx_timeout,
> +	.ndo_validate_addr	= eth_validate_addr,
> +	.ndo_change_mtu		= eth_change_mtu,
> +	.ndo_set_mac_address	= eth_mac_addr,
> +};
> +
> +static struct net_device * __init nfeth_probe(int unit)
> +{
> +	struct net_device *dev;
> +	struct nfeth_private *priv;
> +	char mac[ETH_ALEN], host_ip[32], local_ip[32];
> +	int err;
> +
> +	if (!nf_call(nfEtherID + XIF_GET_MAC, unit, mac, ETH_ALEN))
> +		return NULL;
> +
> +	dev = alloc_etherdev(sizeof(struct nfeth_private));
> +	if (!dev)
> +		return NULL;
> +
> +	dev->irq = nfEtherIRQ;
> +	dev->netdev_ops = &nfeth_netdev_ops;
> +
> +	dev->flags |= NETIF_F_NO_CSUM;
> +	memcpy(dev->dev_addr, mac, ETH_ALEN);
> +
> +	priv = netdev_priv(dev);
> +	priv->ethX = unit;
> +
> +	err = register_netdev(dev);
> +	if (err) {
> +		free_netdev(dev);
> +		return NULL;
> +	}
> +
> +	nf_call(nfEtherID + XIF_GET_IPHOST, unit,
> +		host_ip, sizeof(host_ip));
> +	nf_call(nfEtherID + XIF_GET_IPATARI, unit,
> +		local_ip, sizeof(local_ip));
> +
> +	pr_info("%s: nfeth addr:%s (%s) HWaddr:%pM\n", dev->name, host_ip,
> +		local_ip, mac);
> +
> +	return dev;
> +}
> +
> +static int __init nfeth_init(void)
> +{
> +	long ver;
> +	int error, i;
> +
> +	nfEtherID = nf_get_id("ETHERNET");
> +	if (!nfEtherID)
> +		return -ENODEV;
> +
> +	ver = nf_call(nfEtherID + GET_VERSION);
> +	pr_info("nfeth API %lu\n", ver);
> +
> +	nfEtherIRQ = nf_call(nfEtherID + XIF_INTLEVEL);
> +	error = request_irq(nfEtherIRQ, nfeth_interrupt, IRQF_SHARED,
> +			    "eth emu", nfeth_interrupt);
> +	if (error) {
> +		pr_err("nfeth: request for irq %d failed", nfEtherIRQ);
> +		return error;
> +	}
> +
> +	for (i = 0; i < MAX_UNIT; i++)
> +		nfeth_dev[i] = nfeth_probe(i);
> +
> +	return 0;
> +}
> +
> +static void __exit nfeth_cleanup(void)
> +{
> +	int i;
> +
> +	for (i = 0; i < MAX_UNIT; i++) {
> +		if (nfeth_dev[i]) {
> +			unregister_netdev(nfeth_dev[0]);
> +			free_netdev(nfeth_dev[0]);
> +		}
> +	}
> +	free_irq(nfEtherIRQ, nfeth_interrupt);
> +}
> +
> +module_init(nfeth_init);
> +module_exit(nfeth_cleanup);



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

* Re: [Aranym-dev] [PATCH 4/4] m68k/atari: ARAnyM - Add support for network access
@ 2011-02-06 12:52     ` Milan Jurik
  0 siblings, 0 replies; 14+ messages in thread
From: Milan Jurik @ 2011-02-06 12:52 UTC (permalink / raw)
  Cc: linux-m68k, linux-kernel, cz-bobek-lists-aranym, Milan Jurik,
	Michael Schmitz, netdev, Geert Uytterhoeven

Hi,

Signed-off-by: Milan Jurik <milan.jurik@xylab.cz>

The original e-mail address is dead for some time.

Best regards,

Milan

Geert Uytterhoeven píše v ne 06. 02. 2011 v 11:51 +0100:
> From: Michael Schmitz <schmitz@opal.biophys.uni-duesseldorf.de>
> 
> Should be signed off by Milan and Petr, really.
> 
> [geert] Cleanups and updates
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Petr Stehlik <pstehlik@sophics.cz>
> Cc: Milan Jurik <M.Jurik@sh.cvut.cz>
> Cc: netdev@vger.kernel.org
> 
> ---
> Changelog:
>   - Convert to net_device_ops,
>   - nfeth doesn't need obsolete <net/ieee80211.h>,
>   - Convert print_mac to %pM,
>   - Break too long lines,
>   - Make needlessly global functions static,
>   - Make version[] const,
>   - Use pr_*(),
>   - Use net_device_stats from struct net_device instead of our own,
>   - Propagate error code from request_irq(),
>   - Remove unused variable "handled".
> ---
>  arch/m68k/Kconfig      |    8 ++
>  arch/m68k/emu/Makefile |    1 +
>  arch/m68k/emu/nfeth.c  |  272 ++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 281 insertions(+), 0 deletions(-)
>  create mode 100644 arch/m68k/emu/nfeth.c
> 
> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
> index 6719c56..80df6ee 100644
> --- a/arch/m68k/Kconfig
> +++ b/arch/m68k/Kconfig
> @@ -263,6 +263,14 @@ config NFCON
>  	  which allows the console output to be redirected to the stderr
>  	  output of ARAnyM.
>  
> +config NFETH
> +	tristate "NatFeat Ethernet support"
> +	depends on NET_ETHERNET && NATFEAT
> +	help
> +	  Say Y to include support for the ARAnyM NatFeat network device
> +	  which will emulate a regular ethernet device while presenting an
> +	  ethertap device to the host system.
> +
>  comment "Processor type"
>  
>  config M68020
> diff --git a/arch/m68k/emu/Makefile b/arch/m68k/emu/Makefile
> index a83ef1e..7dc2010 100644
> --- a/arch/m68k/emu/Makefile
> +++ b/arch/m68k/emu/Makefile
> @@ -6,3 +6,4 @@ obj-y			+= natfeat.o
>  
>  obj-$(CONFIG_NFBLOCK)	+= nfblock.o
>  obj-$(CONFIG_NFCON)	+= nfcon.o
> +obj-$(CONFIG_NFETH)	+= nfeth.o
> diff --git a/arch/m68k/emu/nfeth.c b/arch/m68k/emu/nfeth.c
> new file mode 100644
> index 0000000..5b2a33d
> --- /dev/null
> +++ b/arch/m68k/emu/nfeth.c
> @@ -0,0 +1,272 @@
> +/*
> + * atari_nfeth.c - ARAnyM ethernet card driver for GNU/Linux
> + *
> + * Copyright (c) 2005 Milan Jurik, Petr Stehlik of ARAnyM dev team
> + *
> + * Based on ARAnyM driver for FreeMiNT written by Standa Opichal
> + *
> + * This software may be used and distributed according to the terms of
> + * the GNU General Public License (GPL), incorporated herein by reference.
> + */
> +
> +#include <linux/netdevice.h>
> +#include <linux/etherdevice.h>
> +#include <linux/module.h>
> +#include <asm/natfeat.h>
> +#include <asm/virtconvert.h>
> +
> +enum {
> +	GET_VERSION = 0,/* no parameters, return NFAPI_VERSION in d0 */
> +	XIF_INTLEVEL,	/* no parameters, return Interrupt Level in d0 */
> +	XIF_IRQ,	/* acknowledge interrupt from host */
> +	XIF_START,	/* (ethX), called on 'ifup', start receiver thread */
> +	XIF_STOP,	/* (ethX), called on 'ifdown', stop the thread */
> +	XIF_READLENGTH,	/* (ethX), return size of network data block to read */
> +	XIF_READBLOCK,	/* (ethX, buffer, size), read block of network data */
> +	XIF_WRITEBLOCK,	/* (ethX, buffer, size), write block of network data */
> +	XIF_GET_MAC,	/* (ethX, buffer, size), return MAC HW addr in buffer */
> +	XIF_GET_IPHOST,	/* (ethX, buffer, size), return IP address of host */
> +	XIF_GET_IPATARI,/* (ethX, buffer, size), return IP address of atari */
> +	XIF_GET_NETMASK	/* (ethX, buffer, size), return IP netmask */
> +};
> +
> +#define DRV_NAME	"nfeth"
> +#define DRV_VERSION	"0.3"
> +#define DRV_RELDATE	"10/12/2005"
> +
> +#define MAX_UNIT	8
> +
> +/* These identify the driver base version and may not be removed. */
> +static const char version[] __devinitdata =
> +	KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE
> +	" S.Opichal, M.Jurik, P.Stehlik\n"
> +	KERN_INFO " http://aranym.atari.org/\n";
> +
> +MODULE_AUTHOR("Milan Jurik");
> +MODULE_DESCRIPTION("Atari NFeth driver");
> +MODULE_LICENSE("GPL");
> +/*
> +MODULE_PARM(nfeth_debug, "i");
> +MODULE_PARM_DESC(nfeth_debug, "nfeth_debug level (1-2)");
> +*/
> +
> +
> +static long nfEtherID;
> +static int nfEtherIRQ;
> +
> +struct nfeth_private {
> +	int ethX;
> +};
> +
> +static struct net_device *nfeth_dev[MAX_UNIT];
> +
> +static int nfeth_open(struct net_device *dev)
> +{
> +	struct nfeth_private *priv = netdev_priv(dev);
> +	int res;
> +
> +	res = nf_call(nfEtherID + XIF_START, priv->ethX);
> +
> +	pr_debug(DRV_NAME ": open %d\n", res);
> +
> +	/* Ready for data */
> +	netif_start_queue(dev);
> +
> +	return 0;
> +}
> +
> +static int nfeth_stop(struct net_device *dev)
> +{
> +	struct nfeth_private *priv = netdev_priv(dev);
> +
> +	/* No more data */
> +	netif_stop_queue(dev);
> +
> +	nf_call(nfEtherID + XIF_STOP, priv->ethX);
> +
> +	return 0;
> +}
> +
> +/*
> + * Read a packet out of the adapter and pass it to the upper layers
> + */
> +static inline void recv_packet(struct net_device *dev)
> +{
> +	struct nfeth_private *priv = netdev_priv(dev);
> +	unsigned short pktlen;
> +	struct sk_buff *skb;
> +
> +	/* read packet length (excluding 32 bit crc) */
> +	pktlen = nf_call(nfEtherID + XIF_READLENGTH, priv->ethX);
> +
> +	pr_debug(DRV_NAME ": recv_packet: %i\n", pktlen);
> +
> +	if (!pktlen) {
> +		pr_debug(DRV_NAME ": recv_packet: pktlen == 0\n");
> +		dev->stats.rx_errors++;
> +		return;
> +	}
> +
> +	skb = dev_alloc_skb(pktlen + 2);
> +	if (!skb) {
> +		pr_debug(DRV_NAME
> +			 ": recv_packet: out of mem (buf_alloc failed)\n");
> +		dev->stats.rx_dropped++;
> +		return;
> +	}
> +
> +	skb->dev = dev;
> +	skb_reserve(skb, 2);		/* 16 Byte align  */
> +	skb_put(skb, pktlen);		/* make room */
> +	nf_call(nfEtherID + XIF_READBLOCK, priv->ethX, virt_to_phys(skb->data),
> +		pktlen);
> +
> +	skb->protocol = eth_type_trans(skb, dev);
> +	netif_rx(skb);
> +	dev->last_rx = jiffies;
> +	dev->stats.rx_packets++;
> +	dev->stats.rx_bytes += pktlen;
> +
> +	/* and enqueue packet */
> +	return;
> +}
> +
> +static irqreturn_t nfeth_interrupt(int irq, void *dev_id)
> +{
> +	int i, m, mask;
> +
> +	mask = nf_call(nfEtherID + XIF_IRQ, 0);
> +	for (i = 0, m = 1; i < MAX_UNIT; m <<= 1, i++) {
> +		if (mask & m && nfeth_dev[i]) {
> +			recv_packet(nfeth_dev[i]);
> +			nf_call(nfEtherID + XIF_IRQ, m);
> +		}
> +	}
> +	return IRQ_HANDLED;
> +}
> +
> +static int nfeth_xmit(struct sk_buff *skb, struct net_device *dev)
> +{
> +	int len;
> +	char *data, shortpkt[ETH_ZLEN];
> +	struct nfeth_private *priv = netdev_priv(dev);
> +
> +	data = skb->data;
> +	len = skb->len;
> +	if (len < ETH_ZLEN) {
> +		memset(shortpkt, 0, ETH_ZLEN);
> +		memcpy(shortpkt, data, len);
> +		data = shortpkt;
> +		len = ETH_ZLEN;
> +	}
> +
> +	dev->trans_start = jiffies;
> +
> +	pr_debug(DRV_NAME ": send %d bytes\n", len);
> +	nf_call(nfEtherID + XIF_WRITEBLOCK, priv->ethX, virt_to_phys(data),
> +		len);
> +
> +	dev->stats.tx_packets++;
> +	dev->stats.tx_bytes += len;
> +
> +	dev_kfree_skb(skb);
> +	return 0;
> +}
> +
> +static void nfeth_tx_timeout(struct net_device *dev)
> +{
> +	dev->stats.tx_errors++;
> +	netif_wake_queue(dev);
> +}
> +
> +static const struct net_device_ops nfeth_netdev_ops = {
> +	.ndo_open		= nfeth_open,
> +	.ndo_stop		= nfeth_stop,
> +	.ndo_start_xmit		= nfeth_xmit,
> +	.ndo_tx_timeout		= nfeth_tx_timeout,
> +	.ndo_validate_addr	= eth_validate_addr,
> +	.ndo_change_mtu		= eth_change_mtu,
> +	.ndo_set_mac_address	= eth_mac_addr,
> +};
> +
> +static struct net_device * __init nfeth_probe(int unit)
> +{
> +	struct net_device *dev;
> +	struct nfeth_private *priv;
> +	char mac[ETH_ALEN], host_ip[32], local_ip[32];
> +	int err;
> +
> +	if (!nf_call(nfEtherID + XIF_GET_MAC, unit, mac, ETH_ALEN))
> +		return NULL;
> +
> +	dev = alloc_etherdev(sizeof(struct nfeth_private));
> +	if (!dev)
> +		return NULL;
> +
> +	dev->irq = nfEtherIRQ;
> +	dev->netdev_ops = &nfeth_netdev_ops;
> +
> +	dev->flags |= NETIF_F_NO_CSUM;
> +	memcpy(dev->dev_addr, mac, ETH_ALEN);
> +
> +	priv = netdev_priv(dev);
> +	priv->ethX = unit;
> +
> +	err = register_netdev(dev);
> +	if (err) {
> +		free_netdev(dev);
> +		return NULL;
> +	}
> +
> +	nf_call(nfEtherID + XIF_GET_IPHOST, unit,
> +		host_ip, sizeof(host_ip));
> +	nf_call(nfEtherID + XIF_GET_IPATARI, unit,
> +		local_ip, sizeof(local_ip));
> +
> +	pr_info("%s: nfeth addr:%s (%s) HWaddr:%pM\n", dev->name, host_ip,
> +		local_ip, mac);
> +
> +	return dev;
> +}
> +
> +static int __init nfeth_init(void)
> +{
> +	long ver;
> +	int error, i;
> +
> +	nfEtherID = nf_get_id("ETHERNET");
> +	if (!nfEtherID)
> +		return -ENODEV;
> +
> +	ver = nf_call(nfEtherID + GET_VERSION);
> +	pr_info("nfeth API %lu\n", ver);
> +
> +	nfEtherIRQ = nf_call(nfEtherID + XIF_INTLEVEL);
> +	error = request_irq(nfEtherIRQ, nfeth_interrupt, IRQF_SHARED,
> +			    "eth emu", nfeth_interrupt);
> +	if (error) {
> +		pr_err("nfeth: request for irq %d failed", nfEtherIRQ);
> +		return error;
> +	}
> +
> +	for (i = 0; i < MAX_UNIT; i++)
> +		nfeth_dev[i] = nfeth_probe(i);
> +
> +	return 0;
> +}
> +
> +static void __exit nfeth_cleanup(void)
> +{
> +	int i;
> +
> +	for (i = 0; i < MAX_UNIT; i++) {
> +		if (nfeth_dev[i]) {
> +			unregister_netdev(nfeth_dev[0]);
> +			free_netdev(nfeth_dev[0]);
> +		}
> +	}
> +	free_irq(nfEtherIRQ, nfeth_interrupt);
> +}
> +
> +module_init(nfeth_init);
> +module_exit(nfeth_cleanup);

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

* Re: [PATCH 4/4] m68k/atari: ARAnyM - Add support for network access
  2011-02-06 10:51 ` [PATCH 4/4] m68k/atari: ARAnyM - Add support for network access Geert Uytterhoeven
  2011-02-06 12:30   ` Petr Stehlik
  2011-02-06 12:52     ` Milan Jurik
@ 2011-02-06 19:17   ` David Miller
  2011-02-10  8:37     ` Geert Uytterhoeven
  2 siblings, 1 reply; 14+ messages in thread
From: David Miller @ 2011-02-06 19:17 UTC (permalink / raw)
  To: geert
  Cc: linux-m68k, linux-kernel, cz-bobek-lists-aranym, schmitz,
	pstehlik, M.Jurik, netdev

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Sun,  6 Feb 2011 11:51:09 +0100

> +	dev->trans_start = jiffies;

Device drivers no longer make this operation, the generic code
does it (see net/core/dev.c:dev_hard_start_xmit() and how it
invokes txq_trans_update() on ->ndo_start_xmit() success).

Therefore, please remove this line.

> +	pr_debug(DRV_NAME ": send %d bytes\n", len);

For consistency with other network drivers, add an appropriate CPP
define for "pr_fmt" and use netdev_info(), netdev_debug(), etc.

In situations where a netdev pointer is not available
(ie. pre-register_netdev()), use "dev_*()" instead.

Thanks.

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

* Re: [PATCH 4/4] m68k/atari: ARAnyM - Add support for network access
  2011-02-06 19:17   ` David Miller
@ 2011-02-10  8:37     ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2011-02-10  8:37 UTC (permalink / raw)
  To: David Miller
  Cc: linux-m68k, linux-kernel, aranym, schmitz, pstehlik, milan.jurik, netdev

On Sun, Feb 6, 2011 at 20:17, David Miller <davem@davemloft.net> wrote:
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Date: Sun,  6 Feb 2011 11:51:09 +0100
>
>> +     dev->trans_start = jiffies;
>
> Device drivers no longer make this operation, the generic code
> does it (see net/core/dev.c:dev_hard_start_xmit() and how it
> invokes txq_trans_update() on ->ndo_start_xmit() success).
>
> Therefore, please remove this line.

Will do.

(180 more to go in drivers/net/?)

>> +     pr_debug(DRV_NAME ": send %d bytes\n", len);
>
> For consistency with other network drivers, add an appropriate CPP
> define for "pr_fmt" and use netdev_info(), netdev_debug(), etc.
>
> In situations where a netdev pointer is not available
> (ie. pre-register_netdev()), use "dev_*()" instead.

Will fix.

Thanks for reviewing!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

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

end of thread, other threads:[~2011-02-10  8:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-06 10:51 [PATCH 0/4] m68k/atari: Add ARAnyM support Geert Uytterhoeven
2011-02-06 10:51 ` [PATCH 1/4] m68k/atari: Initial " Geert Uytterhoeven
2011-02-06 12:26   ` Petr Stehlik
2011-02-06 10:51 ` [PATCH 2/4] m68k/atari: ARAnyM - Add support for block access Geert Uytterhoeven
2011-02-06 12:27   ` Petr Stehlik
2011-02-06 10:51 ` [PATCH 3/4] m68k/atari: ARAnyM - Add support for console access Geert Uytterhoeven
2011-02-06 12:28   ` Petr Stehlik
2011-02-06 10:51 ` [PATCH 4/4] m68k/atari: ARAnyM - Add support for network access Geert Uytterhoeven
2011-02-06 12:30   ` Petr Stehlik
2011-02-06 12:52   ` [Aranym-dev] " Milan Jurik
2011-02-06 12:52     ` Milan Jurik
2011-02-06 19:17   ` David Miller
2011-02-10  8:37     ` Geert Uytterhoeven
2011-02-06 12:24 ` [Aranym-dev] [PATCH 0/4] m68k/atari: Add ARAnyM support Petr Stehlik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.