All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ATA over Ethernet driver for 2.6.9
Date: Mon, 6 Dec 2004 17:21:53 +0100	[thread overview]
Message-ID: <20041206162153.GH16958@lug-owl.de> (raw)
In-Reply-To: <87acsrqval.fsf@coraid.com>

[-- Attachment #1: Type: text/plain, Size: 5273 bytes --]

On Mon, 2004-12-06 10:51:46 -0500, Ed L Cashin <ecashin@coraid.com>
wrote in message <87acsrqval.fsf@coraid.com>:
> The included patch allows the Linux kernel to use the ATA over
> Ethernet (AoE) network protocol to communicate with any block device
> that handles the AoE protocol.  The Coraid EtherDrive (R) Storage
> Blade is the first hardware using AoE.
> 
> Like IP, AoE is an ethernet-level network protocol, registered with
> the IEEE.  Unlike IP, AoE is not routable.

So AoE is out of scope for many uses...

However, some comments:

> diff -urpN linux-2.6.9/drivers/block/Kconfig linux-2.6.9-aoe/drivers/block/Kconfig
> --- linux-2.6.9/drivers/block/Kconfig	2004-11-30 08:22:33.000000000 -0500
> +++ linux-2.6.9-aoe/drivers/block/Kconfig	2004-12-06 10:40:00.000000000 -0500
> @@ -357,5 +357,6 @@ config LBD
>  	  bigger than 2TB.  Otherwise say N.
>  
>  source "drivers/s390/block/Kconfig"
> +source "drivers/block/aoe/Kconfig"
>  
>  endmenu
> diff -urpN linux-2.6.9/drivers/block/aoe/Kconfig linux-2.6.9-aoe/drivers/block/aoe/Kconfig
> --- linux-2.6.9/drivers/block/aoe/Kconfig	1969-12-31 19:00:00.000000000 -0500
> +++ linux-2.6.9-aoe/drivers/block/aoe/Kconfig	2004-12-06 10:40:00.000000000 -0500
> @@ -0,0 +1,10 @@
> +#
> +# ATA over Ethernet configuration
> +#
> +config ATA_OVER_ETH
> +	tristate "ATA over Ethernet support"
> +	depends on NET
> +	default m
> +	help
> +	This driver provides Support for ATA over Ethernet block
> +	devices like the Coraid EtherDrive (R) Storage Blade.

Since your config only contains a single element, just put it into the
block device Kconfig.

> diff -urpN linux-2.6.9/drivers/block/aoe/all.h linux-2.6.9-aoe/drivers/block/aoe/all.h
> --- linux-2.6.9/drivers/block/aoe/all.h	1969-12-31 19:00:00.000000000 -0500
> +++ linux-2.6.9-aoe/drivers/block/aoe/all.h	2004-12-06 10:40:00.000000000 -0500
[...]
> +#define nil NULL

It's not April 1st today :)

> +#define nelem(A) (sizeof (A) / sizeof (A)[0])

Just use ARRAY_SIZE()

> +#define AOE_MAJOR 152
> +#define ROOT_PATH "/dev/etherd/"
> +#define PATHLEN (strlen(ROOT_PATH) + 8)

Looks strangely hardcoded...

[many typedefs deleted]

Typedefs tend to make the code harder to read and understand. Why don't
you just use the struct xxx notation?

> diff -urpN linux-2.6.9/drivers/block/aoe/aoeblk.c linux-2.6.9-aoe/drivers/block/aoe/aoeblk.c
> --- linux-2.6.9/drivers/block/aoe/aoeblk.c	1969-12-31 19:00:00.000000000 -0500
> +++ linux-2.6.9-aoe/drivers/block/aoe/aoeblk.c	2004-12-06 10:40:00.000000000 -0500

> +static struct block_device_operations aoe_bdops = {
> +	open:			aoeblk_open,
> +	release:		aoeblk_release,
> +	ioctl:			aoeblk_ioctl,
> +	owner:			THIS_MODULE,
> +};

Please use C99 syntax:

	.open = aoeblk_open,

etc.


> +void
> +aoeblk_gdalloc(void *vp)
> +{
> +	if (gd == nil) {

Could be shorter like "if (!gd) {"

> +void
> +aoeblk_exit(void)
> +{
> +	unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
> +}
> +
> +int
> +aoeblk_init(void)
> +{
> +	int n;
> +
> +	n = register_blkdev(AOE_MAJOR, DEVICE_NAME);
> +	if (n < 0) {
> +		printk(KERN_ERR "aoe: aoeblk_init: can't register major\n");
> +		return n;
> +	}
> +	return 0;
> +}

__exit and __init are missing here.

> diff -urpN linux-2.6.9/drivers/block/aoe/aoechr.c linux-2.6.9-aoe/drivers/block/aoe/aoechr.c
> --- linux-2.6.9/drivers/block/aoe/aoechr.c	1969-12-31 19:00:00.000000000 -0500
> +++ linux-2.6.9-aoe/drivers/block/aoe/aoechr.c	2004-12-06 10:40:00.000000000 -0500
> +struct file_operations aoe_fops = {
> +	write:		aoechr_write,
> +	read: 		aoechr_read,
> +	open:		aoechr_open,
> +	release:  	aoechr_rel,
> +	owner:		THIS_MODULE,
> +};

C99

> +u16
> +nhget16(uchar *p)
> +{
> +	u16 n;
> +
> +	n = p[0];
> +	n <<= 8;
> +	return n |= p[1];
> +}
> +
> +u32
> +nhget32(uchar *p)
> +{
> +	u32 n;
> +
> +	n = nhget16(p);
> +	n <<= 16;
> +	return n |= nhget16(p+2);
> +}
> +
> +void
> +hnput16(uchar *p, u16 n)
> +{
> +	p[1] = n;
> +	p[0] = n >>= 8;
> +}
> +
> +void
> +hnput32(uchar *p, u32 n)
> +{
> +	hnput16(p+2, n);
> +	hnput16(p, n >>= 16);
> +}
> +
> +u16
> +lhget16(uchar *p)
> +{
> +	u16 n;
> +
> +	n = p[1];
> +	n <<= 8;
> +	return n |= p[0];
> +}
> +
> +u32
> +lhget32(uchar *p)
> +{
> +	u32 n;
> +
> +	n = lhget16(p+2);
> +	n <<= 16;
> +	return n |= lhget16(p);
> +}
> +
> +u64
> +lhget64(uchar *p)
> +{
> +	u64 n;
> +
> +	n = lhget32(p+4);
> +	n <<= 32;
> +	return n |= lhget32(p);
> +}

There are function available for this, look at the endianess header
files.


After all, especially keeping in mind that AoE isn't routeable, my
thinking is that this had better written as a (E)NBD server process
running in userspace. This way, you'd use the in-kernel NBD driver (or
the ENBD which isn't in the kernel) and you the the routing stuff for
free :)

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2004-12-06 16:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-06 15:51 [PATCH] ATA over Ethernet driver for 2.6.9 Ed L Cashin
2004-12-06 16:14 ` Arjan van de Ven
2004-12-10 16:19   ` Ed L Cashin
2004-12-06 16:21 ` Jan-Benedict Glaw [this message]
2004-12-06 16:11   ` Alan Cox
2004-12-06 17:06   ` Ed L Cashin
2004-12-07 13:00   ` Pavel Machek
2004-12-08 10:02     ` Helge Hafting
2004-12-08 15:44       ` Ed L Cashin
2004-12-08 15:53       ` Pavel Machek
2004-12-06 16:28 ` Adam Heath
2004-12-06 16:45   ` Ed L Cashin
2004-12-06 16:09     ` Alan Cox
2004-12-06 17:10     ` Adam Heath
2004-12-06 21:54 ` Greg KH
2004-12-09 15:48   ` Ed L Cashin
2004-12-09 16:37     ` Greg KH
2004-12-09 15:57   ` Ed L Cashin
2004-12-09 16:40     ` Greg KH
     [not found]   ` <87zn0n5vyd.fsf@coraid.com>
2004-12-09 16:42     ` Greg KH
2004-12-08  9:53 ` Pekka Enberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041206162153.GH16958@lug-owl.de \
    --to=jbglaw@lug-owl.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.