mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2.6.11.7] ATA Over Ethernet Root
@ 2005-05-13 17:19 McMullan, Jason
  2005-05-13 17:48 ` randy_dunlap
  0 siblings, 1 reply; 2+ messages in thread
From: McMullan, Jason @ 2005-05-13 17:19 UTC (permalink / raw)
  To: PPC_LINUX, Linux Kernel


[-- Attachment #1.1: Type: text/plain, Size: 223 bytes --]

This patch allows you to use ATA Over Ethernet as your root device,
with 'root=/dev/etherd/eX.Y/disc'

Limited testing, just for ya'lls review.

-- 
Jason McMullan <jason.mcmullan@timesys.com>
TimeSys Corporation


[-- Attachment #1.2: aoe-root.patch --]
[-- Type: text/x-patch, Size: 4283 bytes --]

Description: ATA Over Ethernet root device
	ie 'root=/dev/etherd/e0.0/disc' on the kernel command line
Signed-Off-By: Jason McMullan <jason.mcmullan@timesys.com>

--- linux-orig/drivers/block/Kconfig
+++ linux/drivers/block/Kconfig
@@ -506,4 +506,19 @@
 	This driver provides Support for ATA over Ethernet block
 	devices like the Coraid EtherDrive (R) Storage Blade.
 
+config ATA_OVER_ETH_ROOT
+	bool "ATA over Ethernet root device"
+	depends on ATA_OVER_ETH=y
+	help
+	  If you want to use ATA Over Ethernet as the root device,
+	  set this to 'y'
+
+config ATA_OVER_ETH_ROOT_SHELF
+	int "Shelf ID"
+	depends on ATA_OVER_ETH_ROOT
+	
+config ATA_OVER_ETH_ROOT_SLOT
+	int "Slot ID"
+	depends on ATA_OVER_ETH_ROOT
+
 endmenu
--- linux-orig/drivers/block/aoe/aoe.h
+++ linux/drivers/block/aoe/aoe.h
@@ -153,6 +153,7 @@
 int aoedev_init(void);
 void aoedev_exit(void);
 struct aoedev *aoedev_bymac(unsigned char *);
+struct aoedev *aoedev_bymajor_minor(ulong major, ulong minor);
 void aoedev_downdev(struct aoedev *d);
 struct aoedev *aoedev_set(ulong, unsigned char *, struct net_device *, ulong);
 int aoedev_busy(void);
--- linux-orig/drivers/block/aoe/aoeblk.c
+++ linux/drivers/block/aoe/aoeblk.c
@@ -229,6 +229,7 @@
 	gd->capacity = d->ssize;
 	snprintf(gd->disk_name, sizeof gd->disk_name, "etherd/e%ld.%ld",
 		d->aoemajor, d->aoeminor);
+	strncpy(gd->devfs_name, gd->disk_name, sizeof gd->devfs_name);
 
 	gd->queue = &d->blkq;
 	d->gd = gd;
--- linux-orig/drivers/block/aoe/aoedev.c
+++ linux/drivers/block/aoe/aoedev.c
@@ -28,6 +28,23 @@
 	return d;
 }
 
+struct aoedev *
+aoedev_bymajor_minor(ulong major, ulong minor)
+{
+	struct aoedev *d;
+	ulong flags;
+
+	spin_lock_irqsave(&devlist_lock, flags);
+
+	for (d=devlist; d; d=d->next)
+		if (d->aoemajor == major && d->aoeminor == minor)
+			break;
+
+	spin_unlock_irqrestore(&devlist_lock, flags);
+	return d;
+}
+
+
 /* called with devlist lock held */
 static struct aoedev *
 aoedev_newdev(ulong nframes)
--- linux-orig/drivers/block/aoe/aoemain.c
+++ linux/drivers/block/aoe/aoemain.c
@@ -7,6 +7,13 @@
 #include <linux/hdreg.h>
 #include <linux/blkdev.h>
 #include <linux/module.h>
+#include <linux/devfs_fs_kernel.h>
+#ifdef CONFIG_ATA_OVER_ETH_ROOT
+#include <linux/delay.h>
+#include <linux/rtnetlink.h>
+#include <linux/netdevice.h>
+#include <net/sock.h>
+#endif
 #include "aoe.h"
 
 MODULE_LICENSE("GPL");
@@ -53,6 +60,43 @@
 	}
 }
 
+#ifdef CONFIG_ATA_OVER_ETH_ROOT
+void aoe_root(unsigned long major, unsigned long minor)
+{
+	struct net_device *dev;
+
+	printk(KERN_INFO
+		"aoe: Waiting for root AOE device e%ld.%ld\n", major, minor);
+
+	/* Give hardware a chance to settle */
+	msleep(500);
+
+	rtnl_shlock();
+	/* bring loopback device up first */
+printk("Bring up loopback...\n");
+	if (dev_change_flags(&loopback_dev, loopback_dev.flags | IFF_UP) < 0)
+		printk(KERN_ERR "AOE Root: Failed to open %s\n", loopback_dev.name);
+
+	/* Setup all network devices */
+	for (dev = dev_base; dev ; dev = dev->next) {
+		if (dev == &loopback_dev)
+			continue;
+printk("Bring up %s...\n",dev->name);
+		dev_change_flags(dev, dev->flags | IFF_UP);
+	}
+	rtnl_shunlock();
+
+	/* Give drivers a chance to settle */
+	ssleep(1);
+
+	do {
+		aoecmd_cfg(major, minor);
+		msleep(1);
+	} while (!aoedev_bymajor_minor(CONFIG_ATA_OVER_ETH_ROOT_SHELF,CONFIG_ATA_OVER_ETH_ROOT_SLOT));
+
+}
+#endif
+
 static void
 aoe_exit(void)
 {
@@ -63,6 +107,7 @@
 	aoechr_exit();
 	aoedev_exit();
 	aoeblk_exit();		/* free cache after de-allocating bufs */
+	devfs_remove("etherd");
 }
 
 static int __init
@@ -70,6 +115,8 @@
 {
 	int ret;
 
+	devfs_mk_dir("etherd");
+	        
 	ret = aoedev_init();
 	if (ret)
 		return ret;
@@ -91,6 +138,9 @@
 	printk(KERN_INFO
 	       "aoe: aoe_init: AoE v2.6-%s initialised.\n",
 	       VERSION);
+#ifdef CONFIG_ATA_OVER_ETH_ROOT
+	aoe_root(CONFIG_ATA_OVER_ETH_ROOT_SHELF,CONFIG_ATA_OVER_ETH_ROOT_SLOT);
+#endif
 	discover_timer(TINIT);
 	return 0;
 
@@ -102,6 +152,7 @@
 	aoechr_exit();
  chr_fail:
 	aoedev_exit();
+	devfs_remove("etherd");
 	
 	printk(KERN_INFO "aoe: aoe_init: initialisation failure.\n");
 	return ret;

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH 2.6.11.7] ATA Over Ethernet Root
  2005-05-13 17:19 [PATCH 2.6.11.7] ATA Over Ethernet Root McMullan, Jason
@ 2005-05-13 17:48 ` randy_dunlap
  0 siblings, 0 replies; 2+ messages in thread
From: randy_dunlap @ 2005-05-13 17:48 UTC (permalink / raw)
  To: McMullan, Jason; +Cc: PPC_LINUX, linux-kernel

On Fri, 13 May 2005 13:19:55 -0400 McMullan, Jason wrote:

| This patch allows you to use ATA Over Ethernet as your root device,
| with 'root=/dev/etherd/eX.Y/disc'
| 
| Limited testing, just for ya'lls review.
or                          y'alls


Please make patches against 2.6.12-rcX, not against 2.6.11.z.
(probably doesn't matter in this case)


+struct aoedev *
+aoedev_bymajor_minor(ulong major, ulong minor)
+{

Kernel preferred style is not to split the function definition line.


+#ifdef CONFIG_ATA_OVER_ETH_ROOT
+#include <linux/delay.h>
+#include <linux/rtnetlink.h>
+#include <linux/netdevice.h>
+#include <net/sock.h>
+#endif

Lose the ifdef/endif.  Don't make #includes conditional.

+printk("Bring up loopback...\n");
+	if (dev_change_flags(&loopback_dev, loopback_dev.flags | IFF_UP) < 0)
+		printk(KERN_ERR "AOE Root: Failed to open %s\n", loopback_dev.name);
+
+	/* Setup all network devices */
+	for (dev = dev_base; dev ; dev = dev->next) {
+		if (dev == &loopback_dev)
+			continue;
+printk("Bring up %s...\n",dev->name);

Did you mean to leave these printk()s here?
I think not, but if so, they need a KERN_ level, like KERN_INFO.


It would help readability if you would add some spaces around
'=', after commas, etc., in places like these:

+	for (d=devlist; d; d=d->next)
and
+	} while (!aoedev_bymajor_minor(CONFIG_ATA_OVER_ETH_ROOT_SHELF,CONFIG_ATA_OVER_ETH_ROOT_SLOT));
and
+	aoe_root(CONFIG_ATA_OVER_ETH_ROOT_SHELF,CONFIG_ATA_OVER_ETH_ROOT_SLOT);


Thanks.

---
~Randy

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

end of thread, other threads:[~2005-05-13 17:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-13 17:19 [PATCH 2.6.11.7] ATA Over Ethernet Root McMullan, Jason
2005-05-13 17:48 ` randy_dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®