linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.18-rc4] aoe [02/13]: update copyright date
       [not found] <E1GE8K3-0008Jn-00@kokone.coraid.com>
@ 2006-08-18 17:38 ` Ed L. Cashin
  2006-08-18 22:54   ` Alan Cox
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [03/13]: remove unused NARGS enum Ed L. Cashin
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 17:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: ecashin, Greg K-H

Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>

Update the copyright year to 2006.

diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoe.h 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h
--- 2.6.18-rc4-orig/drivers/block/aoe/aoe.h	2006-08-17 16:45:33.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h	2006-08-17 16:45:34.000000000 -0400
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 #define VERSION "22"
 #define AOE_MAJOR 152
 #define DEVICE_NAME "aoe"
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoeblk.c 2.6.18-rc4-aoe/drivers/block/aoe/aoeblk.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoeblk.c	2006-08-17 16:45:33.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoeblk.c	2006-08-17 16:45:34.000000000 -0400
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 /*
  * aoeblk.c
  * block device routines
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoechr.c 2.6.18-rc4-aoe/drivers/block/aoe/aoechr.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoechr.c	2006-08-17 16:45:33.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoechr.c	2006-08-17 16:45:34.000000000 -0400
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 /*
  * aoechr.c
  * AoE character device driver
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:33.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 /*
  * aoecmd.c
  * Filesystem request handling methods
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoedev.c 2.6.18-rc4-aoe/drivers/block/aoe/aoedev.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoedev.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoedev.c	2006-08-17 16:45:34.000000000 -0400
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 /*
  * aoedev.c
  * AoE device utility functions; maintains device list.
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoemain.c 2.6.18-rc4-aoe/drivers/block/aoe/aoemain.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoemain.c	2006-08-17 16:45:33.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoemain.c	2006-08-17 16:45:34.000000000 -0400
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 /*
  * aoemain.c
  * Module initialization routines, discover timer
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoenet.c 2.6.18-rc4-aoe/drivers/block/aoe/aoenet.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoenet.c	2006-08-17 16:45:33.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoenet.c	2006-08-17 16:45:34.000000000 -0400
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 /*
  * aoenet.c
  * Ethernet portion of AoE driver


-- 
  "Ed L. Cashin" <ecashin@coraid.com>

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

* [PATCH 2.6.18-rc4] aoe [03/13]: remove unused NARGS enum
       [not found] <E1GE8K3-0008Jn-00@kokone.coraid.com>
  2006-08-18 17:38 ` [PATCH 2.6.18-rc4] aoe [02/13]: update copyright date Ed L. Cashin
@ 2006-08-18 17:39 ` Ed L. Cashin
  2006-08-18 22:54   ` Alan Cox
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [04/13]: zero copy write 1 of 2 Ed L. Cashin
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 17:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: ecashin, Greg K-H

Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>

The NARGS enum is left over from older code versions.

diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoechr.c 2.6.18-rc4-aoe/drivers/block/aoe/aoechr.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoechr.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoechr.c	2006-08-17 16:45:34.000000000 -0400
@@ -15,7 +15,6 @@ enum {
 	MINOR_INTERFACES,
 	MINOR_REVALIDATE,
 	MSGSZ = 2048,
-	NARGS = 10,
 	NMSG = 100,		/* message backlog to retain */
 };
 


-- 
  "Ed L. Cashin" <ecashin@coraid.com>

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

* [PATCH 2.6.18-rc4] aoe [04/13]: zero copy write 1 of 2
       [not found] <E1GE8K3-0008Jn-00@kokone.coraid.com>
  2006-08-18 17:38 ` [PATCH 2.6.18-rc4] aoe [02/13]: update copyright date Ed L. Cashin
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [03/13]: remove unused NARGS enum Ed L. Cashin
@ 2006-08-18 17:39 ` Ed L. Cashin
  2006-08-19 10:18   ` Alan Cox
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [05/13]: jumbo frame support " Ed L. Cashin
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 17:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: ecashin, Greg K-H

Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>

Avoid memory copy on writes.
(This patch depends on fixes in patch 9 to follow.)

diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoe.h 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h
--- 2.6.18-rc4-orig/drivers/block/aoe/aoe.h	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h	2006-08-17 16:45:34.000000000 -0400
@@ -107,11 +107,7 @@ struct frame {
 	ulong waited;
 	struct buf *buf;
 	char *bufaddr;
-	int writedatalen;
-	int ndata;
-
-	/* largest possible */
-	unsigned char data[sizeof(struct aoe_hdr) + sizeof(struct aoe_atahdr)];
+	struct sk_buff *skb;
 };
 
 struct aoedev {
@@ -157,6 +153,7 @@ void aoecmd_cfg(ushort aoemajor, unsigne
 void aoecmd_ata_rsp(struct sk_buff *);
 void aoecmd_cfg_rsp(struct sk_buff *);
 void aoecmd_sleepwork(void *vp);
+struct sk_buff *new_skb(ulong);
 
 int aoedev_init(void);
 void aoedev_exit(void);
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
@@ -17,15 +17,14 @@
 #define MAXTIMER (HZ << 1)
 #define MAXWAIT (60 * 3)	/* After MAXWAIT seconds, give up and fail dev */
 
-static struct sk_buff *
-new_skb(struct net_device *if_dev, ulong len)
+struct sk_buff *
+new_skb(ulong len)
 {
 	struct sk_buff *skb;
 
 	skb = alloc_skb(len, GFP_ATOMIC);
 	if (skb) {
 		skb->nh.raw = skb->mac.raw = skb->data;
-		skb->dev = if_dev;
 		skb->protocol = __constant_htons(ETH_P_AOE);
 		skb->priority = 0;
 		skb_put(skb, len);
@@ -40,29 +39,6 @@ new_skb(struct net_device *if_dev, ulong
 	return skb;
 }
 
-static struct sk_buff *
-skb_prepare(struct aoedev *d, struct frame *f)
-{
-	struct sk_buff *skb;
-	char *p;
-
-	skb = new_skb(d->ifp, f->ndata + f->writedatalen);
-	if (!skb) {
-		printk(KERN_INFO "aoe: skb_prepare: failure to allocate skb\n");
-		return NULL;
-	}
-
-	p = skb->mac.raw;
-	memcpy(p, f->data, f->ndata);
-
-	if (f->writedatalen) {
-		p += sizeof(struct aoe_hdr) + sizeof(struct aoe_atahdr);
-		memcpy(p, f->bufaddr, f->writedatalen);
-	}
-
-	return skb;
-}
-
 static struct frame *
 getframe(struct aoedev *d, int tag)
 {
@@ -129,10 +105,11 @@ aoecmd_ata_rw(struct aoedev *d, struct f
 		bcnt = MAXATADATA;
 
 	/* initialize the headers & frame */
-	h = (struct aoe_hdr *) f->data;
+	skb = f->skb;
+	h = (struct aoe_hdr *) skb->mac.raw;
 	ah = (struct aoe_atahdr *) (h+1);
-	f->ndata = sizeof *h + sizeof *ah;
-	memset(h, 0, f->ndata);
+	skb->len = sizeof *h + sizeof *ah;
+	memset(h, 0, skb->len);
 	f->tag = aoehdr_atainit(d, h);
 	f->waited = 0;
 	f->buf = buf;
@@ -155,11 +132,13 @@ aoecmd_ata_rw(struct aoedev *d, struct f
 	}
 
 	if (bio_data_dir(buf->bio) == WRITE) {
+		skb_fill_page_desc(skb, 0, virt_to_page(f->bufaddr),
+			offset_in_page(f->bufaddr), bcnt);
 		ah->aflags |= AOEAFL_WRITE;
-		f->writedatalen = bcnt;
 	} else {
+		skb_shinfo(skb)->nr_frags = 0;
+		skb->len = ETH_ZLEN;
 		writebit = 0;
-		f->writedatalen = 0;
 	}
 
 	ah->cmdstat = WIN_READ | writebit | extbit;
@@ -179,15 +158,14 @@ aoecmd_ata_rw(struct aoedev *d, struct f
 		buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset;
 	}
 
-	skb = skb_prepare(d, f);
-	if (skb) {
-		skb->next = NULL;
-		if (d->sendq_hd)
-			d->sendq_tl->next = skb;
-		else
-			d->sendq_hd = skb;
-		d->sendq_tl = skb;
-	}
+	skb->dev = d->ifp;
+	skb_get(skb);
+	skb->next = NULL;
+	if (d->sendq_hd)
+		d->sendq_tl->next = skb;
+	else
+		d->sendq_hd = skb;
+	d->sendq_tl = skb;
 }
 
 /* some callers cannot sleep, and they can call this function,
@@ -209,11 +187,12 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigne
 		if (!is_aoe_netif(ifp))
 			continue;
 
-		skb = new_skb(ifp, sizeof *h + sizeof *ch);
+		skb = new_skb(sizeof *h + sizeof *ch);
 		if (skb == NULL) {
 			printk(KERN_INFO "aoe: aoecmd_cfg: skb alloc failure\n");
 			continue;
 		}
+		skb->dev = ifp;
 		if (sl_tail == NULL)
 			sl_tail = skb;
 		h = (struct aoe_hdr *) skb->mac.raw;
@@ -283,21 +262,21 @@ rexmit(struct aoedev *d, struct frame *f
 		d->aoemajor, d->aoeminor, f->tag, jiffies, n);
 	aoechr_error(buf);
 
-	h = (struct aoe_hdr *) f->data;
+	skb = f->skb;
+	h = (struct aoe_hdr *) skb->mac.raw;
 	f->tag = n;
 	h->tag = cpu_to_be32(n);
 	memcpy(h->dst, d->addr, sizeof h->dst);
 	memcpy(h->src, d->ifp->dev_addr, sizeof h->src);
 
-	skb = skb_prepare(d, f);
-	if (skb) {
-		skb->next = NULL;
-		if (d->sendq_hd)
-			d->sendq_tl->next = skb;
-		else
-			d->sendq_hd = skb;
-		d->sendq_tl = skb;
-	}
+	skb->dev = d->ifp;
+	skb_get(skb);
+	skb->next = NULL;
+	if (d->sendq_hd)
+		d->sendq_tl->next = skb;
+	else
+		d->sendq_hd = skb;
+	d->sendq_tl = skb;
 }
 
 static int
@@ -514,7 +493,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 	calc_rttavg(d, tsince(f->tag));
 
 	ahin = (struct aoe_atahdr *) (hin+1);
-	ahout = (struct aoe_atahdr *) (f->data + sizeof(struct aoe_hdr));
+	ahout = (struct aoe_atahdr *) (f->skb->mac.raw + sizeof(struct aoe_hdr));
 	buf = f->buf;
 
 	if (ahout->cmdstat == WIN_IDENTIFY)
@@ -620,20 +599,21 @@ aoecmd_ata_id(struct aoedev *d)
 	}
 
 	/* initialize the headers & frame */
-	h = (struct aoe_hdr *) f->data;
+	skb = f->skb;
+	h = (struct aoe_hdr *) skb->mac.raw;
 	ah = (struct aoe_atahdr *) (h+1);
-	f->ndata = sizeof *h + sizeof *ah;
-	memset(h, 0, f->ndata);
+	skb->len = sizeof *h + sizeof *ah;
+	memset(h, 0, skb->len);
 	f->tag = aoehdr_atainit(d, h);
 	f->waited = 0;
-	f->writedatalen = 0;
 
 	/* set up ata header */
 	ah->scnt = 1;
 	ah->cmdstat = WIN_IDENTIFY;
 	ah->lba3 = 0xa0;
 
-	skb = skb_prepare(d, f);
+	skb->dev = d->ifp;
+	skb_get(skb);
 
 	d->rttavg = MAXTIMER;
 	d->timer.function = rexmit_timer;
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoedev.c 2.6.18-rc4-aoe/drivers/block/aoe/aoedev.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoedev.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoedev.c	2006-08-17 16:45:34.000000000 -0400
@@ -63,22 +63,32 @@ aoedev_newdev(ulong nframes)
 	struct frame *f, *e;
 
 	d = kzalloc(sizeof *d, GFP_ATOMIC);
-	if (d == NULL)
-		return NULL;
 	f = kcalloc(nframes, sizeof *f, GFP_ATOMIC);
-	if (f == NULL) {
-		kfree(d);
+ 	switch (!d || !f) {
+ 	case 0:
+ 		d->nframes = nframes;
+ 		d->frames = f;
+ 		e = f + nframes;
+ 		for (; f<e; f++) {
+ 			f->tag = FREETAG;
+ 			f->skb = new_skb(ETH_ZLEN);
+ 			if (!f->skb)
+ 				break;
+ 		}
+ 		if (f == e)
+ 			break;
+ 		while (f > d->frames) {
+ 			f--;
+ 			dev_kfree_skb(f->skb);
+ 		}
+ 	default:
+ 		if (f)
+ 			kfree(f);
+ 		if (d)
+ 			kfree(d);
 		return NULL;
 	}
-
 	INIT_WORK(&d->work, aoecmd_sleepwork, d);
-
-	d->nframes = nframes;
-	d->frames = f;
-	e = f + nframes;
-	for (; f<e; f++)
-		f->tag = FREETAG;
-
 	spin_lock_init(&d->lock);
 	init_timer(&d->timer);
 	d->timer.data = (ulong) d;
@@ -160,11 +170,19 @@ aoedev_by_sysminor_m(ulong sysminor, ulo
 static void
 aoedev_freedev(struct aoedev *d)
 {
+	struct frame *f, *e;
+
 	if (d->gd) {
 		aoedisk_rm_sysfs(d);
 		del_gendisk(d->gd);
 		put_disk(d->gd);
 	}
+	f = d->frames;
+	e = f + d->nframes;
+	for (; f<e; f++) {
+		skb_shinfo(f->skb)->nr_frags = 0;
+		dev_kfree_skb(f->skb);
+	}
 	kfree(d->frames);
 	if (d->bufpool)
 		mempool_destroy(d->bufpool);


-- 
  "Ed L. Cashin" <ecashin@coraid.com>

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

* [PATCH 2.6.18-rc4] aoe [05/13]: jumbo frame support 1 of 2
       [not found] <E1GE8K3-0008Jn-00@kokone.coraid.com>
                   ` (2 preceding siblings ...)
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [04/13]: zero copy write 1 of 2 Ed L. Cashin
@ 2006-08-18 17:39 ` Ed L. Cashin
  2006-08-18 22:56   ` Alan Cox
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [06/13]: clean up printks via macros Ed L. Cashin
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 17:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: ecashin, Greg K-H

Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>

Add support for jumbo ethernet frames.
(This patch depends on patch 7 to follow.)

diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoe.h 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h
--- 2.6.18-rc4-orig/drivers/block/aoe/aoe.h	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h	2006-08-17 16:45:34.000000000 -0400
@@ -65,7 +65,7 @@ struct aoe_atahdr {
 struct aoe_cfghdr {
 	__be16 bufcnt;
 	__be16 fwver;
-	unsigned char res;
+	unsigned char scnt;
 	unsigned char aoeccmd;
 	unsigned char cslen[2];
 };
@@ -78,12 +78,13 @@ enum {
 	DEVFL_GDALLOC = (1<<4),	/* need to alloc gendisk */
 	DEVFL_PAUSE = (1<<5),
 	DEVFL_NEWSIZE = (1<<6),	/* need to update dev size in block layer */
+	DEVFL_MAXBCNT = (1<<7), /* d->maxbcnt is not changeable */
 
 	BUFFL_FAIL = 1,
 };
 
 enum {
-	MAXATADATA = 1024,
+	DEFAULTBCNT = 2 * 512,	/* 2 sectors */
 	NPERSHELF = 16,		/* number of slots per shelf address */
 	FREETAG = -1,
 	MIN_BUFS = 8,
@@ -107,6 +108,8 @@ struct frame {
 	ulong waited;
 	struct buf *buf;
 	char *bufaddr;
+	ulong bcnt;
+	sector_t lba;
 	struct sk_buff *skb;
 };
 
@@ -120,6 +123,7 @@ struct aoedev {
 	ulong nopen;		/* (bd_openers isn't available without sleeping) */
 	ulong rttavg;		/* round trip average of requests/responses */
 	u16 fw_ver;		/* version of blade's firmware */
+	u16 maxbcnt;
 	struct work_struct work;/* disk create work struct */
 	struct gendisk *gd;
 	request_queue_t blkq;
@@ -134,7 +138,8 @@ struct aoedev {
 	struct list_head bufq;	/* queue of bios to work on */
 	struct buf *inprocess;	/* the one we're currently working on */
 	ulong lasttag;		/* last tag sent */
-	ulong nframes;		/* number of frames below */
+	ushort lostjumbo;
+	ushort nframes;		/* number of frames below */
 	struct frame *frames;
 };
 
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoechr.c 2.6.18-rc4-aoe/drivers/block/aoe/aoechr.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoechr.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoechr.c	2006-08-17 16:45:34.000000000 -0400
@@ -89,6 +89,7 @@ revalidate(const char __user *str, size_
 		return -EINVAL;
 
 	spin_lock_irqsave(&d->lock, flags);
+	d->flags &= ~DEVFL_MAXBCNT;
 	d->flags |= DEVFL_PAUSE;
 	spin_unlock_irqrestore(&d->lock, flags);
 	aoecmd_cfg(major, minor);
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
@@ -83,6 +83,17 @@ aoehdr_atainit(struct aoedev *d, struct 
 	return host_tag;
 }
 
+static inline void
+put_lba(struct aoe_atahdr *ah, sector_t lba)
+{
+	ah->lba0 = lba;
+	ah->lba1 = lba >>= 8;
+	ah->lba2 = lba >>= 8;
+	ah->lba3 = lba >>= 8;
+	ah->lba4 = lba >>= 8;
+	ah->lba5 = lba >>= 8;
+}
+
 static void
 aoecmd_ata_rw(struct aoedev *d, struct frame *f)
 {
@@ -101,8 +112,8 @@ aoecmd_ata_rw(struct aoedev *d, struct f
 
 	sector = buf->sector;
 	bcnt = buf->bv_resid;
-	if (bcnt > MAXATADATA)
-		bcnt = MAXATADATA;
+	if (bcnt > d->maxbcnt)
+		bcnt = d->maxbcnt;
 
 	/* initialize the headers & frame */
 	skb = f->skb;
@@ -114,17 +125,14 @@ aoecmd_ata_rw(struct aoedev *d, struct f
 	f->waited = 0;
 	f->buf = buf;
 	f->bufaddr = buf->bufaddr;
+	f->bcnt = bcnt;
+	f->lba = sector;
 
 	/* set up ata header */
 	ah->scnt = bcnt >> 9;
-	ah->lba0 = sector;
-	ah->lba1 = sector >>= 8;
-	ah->lba2 = sector >>= 8;
-	ah->lba3 = sector >>= 8;
+	put_lba(ah, sector);
 	if (d->flags & DEVFL_EXT) {
 		ah->aflags |= AOEAFL_EXT;
-		ah->lba4 = sector >>= 8;
-		ah->lba5 = sector >>= 8;
 	} else {
 		extbit = 0;
 		ah->lba3 &= 0x0f;
@@ -251,6 +259,7 @@ rexmit(struct aoedev *d, struct frame *f
 {
 	struct sk_buff *skb;
 	struct aoe_hdr *h;
+	struct aoe_atahdr *ah;
 	char buf[128];
 	u32 n;
 
@@ -264,11 +273,27 @@ rexmit(struct aoedev *d, struct frame *f
 
 	skb = f->skb;
 	h = (struct aoe_hdr *) skb->mac.raw;
+	ah = (struct aoe_atahdr *) (h+1);
 	f->tag = n;
 	h->tag = cpu_to_be32(n);
 	memcpy(h->dst, d->addr, sizeof h->dst);
 	memcpy(h->src, d->ifp->dev_addr, sizeof h->src);
 
+	n = DEFAULTBCNT / 512;
+	if (ah->scnt > n) {
+		ah->scnt = n;
+		if (ah->aflags & AOEAFL_WRITE)
+			skb_fill_page_desc(skb, 0, virt_to_page(f->bufaddr),
+				offset_in_page(f->bufaddr), DEFAULTBCNT);
+		if (++d->lostjumbo > (d->nframes << 1))
+		if (d->maxbcnt != DEFAULTBCNT) {
+			printk(KERN_INFO "aoe: rexmit: too many lost jumbo.  "
+				"dropping back to 1KB frames.\n");
+			d->maxbcnt = DEFAULTBCNT;
+			d->flags |= DEVFL_MAXBCNT;
+		}
+	}
+
 	skb->dev = d->ifp;
 	skb_get(skb);
 	skb->next = NULL;
@@ -506,10 +531,10 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 		if (buf)
 			buf->flags |= BUFFL_FAIL;
 	} else {
+		n = ahout->scnt << 9;
 		switch (ahout->cmdstat) {
 		case WIN_READ:
 		case WIN_READ_EXT:
-			n = ahout->scnt << 9;
 			if (skb->len - sizeof *hin - sizeof *ahin < n) {
 				printk(KERN_CRIT "aoe: aoecmd_ata_rsp: runt "
 					"ata data size in read.  skb->len=%d\n",
@@ -521,6 +546,22 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 			memcpy(f->bufaddr, ahin+1, n);
 		case WIN_WRITE:
 		case WIN_WRITE_EXT:
+			if (f->bcnt -= n) {
+				f->bufaddr += n;
+				put_lba(ahout, f->lba += ahout->scnt);
+				n = f->bcnt > DEFAULTBCNT ? DEFAULTBCNT : f->bcnt;
+				ahout->scnt = n >> 9;
+				if (ahout->aflags & AOEAFL_WRITE)
+					skb_fill_page_desc(f->skb, 0, virt_to_page(f->bufaddr),
+						offset_in_page(f->bufaddr), n);
+				skb_get(f->skb);
+				f->skb->next = NULL;
+				spin_unlock_irqrestore(&d->lock, flags);
+				aoenet_xmit(f->skb);
+				return;
+			}
+			if (n > DEFAULTBCNT)
+				d->lostjumbo = 0;
 			break;
 		case WIN_IDENTIFY:
 			if (skb->len - sizeof *hin - sizeof *ahin < 512) {
@@ -628,9 +669,9 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
 	struct aoe_hdr *h;
 	struct aoe_cfghdr *ch;
 	ulong flags, sysminor, aoemajor;
-	u16 bufcnt;
 	struct sk_buff *sl;
 	enum { MAXFRAMES = 16 };
+	u16 n;
 
 	h = (struct aoe_hdr *) skb->mac.raw;
 	ch = (struct aoe_cfghdr *) (h+1);
@@ -654,11 +695,11 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
 		return;
 	}
 
-	bufcnt = be16_to_cpu(ch->bufcnt);
-	if (bufcnt > MAXFRAMES)	/* keep it reasonable */
-		bufcnt = MAXFRAMES;
+	n = be16_to_cpu(ch->bufcnt);
+	if (n > MAXFRAMES)	/* keep it reasonable */
+		n = MAXFRAMES;
 
-	d = aoedev_by_sysminor_m(sysminor, bufcnt);
+	d = aoedev_by_sysminor_m(sysminor, n);
 	if (d == NULL) {
 		printk(KERN_INFO "aoe: aoecmd_cfg_rsp: device sysminor_m failure\n");
 		return;
@@ -669,6 +710,14 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
 	/* permit device to migrate mac and network interface */
 	d->ifp = skb->dev;
 	memcpy(d->addr, h->src, sizeof d->addr);
+	if (!(d->flags & DEVFL_MAXBCNT)) {
+		n = d->ifp->mtu;
+		n -= sizeof (struct aoe_hdr) + sizeof (struct aoe_atahdr);
+		n /= 512;
+		if (n > ch->scnt)
+			n = ch->scnt;
+		d->maxbcnt = n ? n * 512 : DEFAULTBCNT;
+	}
 
 	/* don't change users' perspective */
 	if (d->nopen && !(d->flags & DEVFL_PAUSE)) {


-- 
  "Ed L. Cashin" <ecashin@coraid.com>

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

* [PATCH 2.6.18-rc4] aoe [06/13]: clean up printks via macros
       [not found] <E1GE8K3-0008Jn-00@kokone.coraid.com>
                   ` (3 preceding siblings ...)
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [05/13]: jumbo frame support " Ed L. Cashin
@ 2006-08-18 17:39 ` Ed L. Cashin
  2006-08-18 19:29   ` Arnd Bergmann
  2006-08-18 22:57   ` Alan Cox
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [07/13]: jumbo frame support 2 of 2 Ed L. Cashin
                   ` (6 subsequent siblings)
  11 siblings, 2 replies; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 17:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: ecashin, Greg K-H

Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>

Use simple macros to clean up the printks.

diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoe.h 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h
--- 2.6.18-rc4-orig/drivers/block/aoe/aoe.h	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h	2006-08-17 16:45:34.000000000 -0400
@@ -10,6 +10,11 @@
 #define AOE_PARTITIONS (16)
 #endif
 
+#define xprintk(L, fmt, arg...) printk(L "aoe: " "%s: " fmt, __func__, ## arg) 
+#define iprintk(fmt, arg...) xprintk(KERN_INFO, fmt, ## arg)
+#define eprintk(fmt, arg...) xprintk(KERN_ERR, fmt, ## arg)
+#define dprintk(fmt, arg...) xprintk(KERN_DEBUG, fmt, ## arg)
+
 #define SYSMINOR(aoemajor, aoeminor) ((aoemajor) * NPERSHELF + (aoeminor))
 #define AOEMAJOR(sysminor) ((sysminor) / NPERSHELF)
 #define AOEMINOR(sysminor) ((sysminor) % NPERSHELF)
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoeblk.c 2.6.18-rc4-aoe/drivers/block/aoe/aoeblk.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoeblk.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoeblk.c	2006-08-17 16:45:34.000000000 -0400
@@ -132,8 +132,7 @@ aoeblk_make_request(request_queue_t *q, 
 	d = bio->bi_bdev->bd_disk->private_data;
 	buf = mempool_alloc(d->bufpool, GFP_NOIO);
 	if (buf == NULL) {
-		printk(KERN_INFO "aoe: aoeblk_make_request: buf allocation "
-			"failure\n");
+		iprintk("buf allocation failure\n");
 		bio_endio(bio, bio->bi_size, -ENOMEM);
 		return 0;
 	}
@@ -150,8 +149,7 @@ aoeblk_make_request(request_queue_t *q, 
 	spin_lock_irqsave(&d->lock, flags);
 
 	if ((d->flags & DEVFL_UP) == 0) {
-		printk(KERN_INFO "aoe: aoeblk_make_request: device %ld.%ld is not up\n",
-			d->aoemajor, d->aoeminor);
+		iprintk("device %ld.%ld is not up\n", d->aoemajor, d->aoeminor);
 		spin_unlock_irqrestore(&d->lock, flags);
 		mempool_free(buf, d->bufpool);
 		bio_endio(bio, bio->bi_size, -ENXIO);
@@ -176,7 +174,7 @@ aoeblk_getgeo(struct block_device *bdev,
 	struct aoedev *d = bdev->bd_disk->private_data;
 
 	if ((d->flags & DEVFL_UP) == 0) {
-		printk(KERN_ERR "aoe: aoeblk_ioctl: disk not up\n");
+		eprintk("disk not up\n");
 		return -ENODEV;
 	}
 
@@ -203,8 +201,8 @@ aoeblk_gdalloc(void *vp)
 
 	gd = alloc_disk(AOE_PARTITIONS);
 	if (gd == NULL) {
-		printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate disk "
-			"structure for %ld.%ld\n", d->aoemajor, d->aoeminor);
+		eprintk("cannot allocate disk structure for %ld.%ld\n",
+			d->aoemajor, d->aoeminor);
 		spin_lock_irqsave(&d->lock, flags);
 		d->flags &= ~DEVFL_GDALLOC;
 		spin_unlock_irqrestore(&d->lock, flags);
@@ -213,8 +211,8 @@ aoeblk_gdalloc(void *vp)
 
 	d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache);
 	if (d->bufpool == NULL) {
-		printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate bufpool "
-			"for %ld.%ld\n", d->aoemajor, d->aoeminor);
+		eprintk("cannot allocate bufpool for %ld.%ld\n",
+			d->aoemajor, d->aoeminor);
 		put_disk(gd);
 		spin_lock_irqsave(&d->lock, flags);
 		d->flags &= ~DEVFL_GDALLOC;
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoechr.c 2.6.18-rc4-aoe/drivers/block/aoe/aoechr.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoechr.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoechr.c	2006-08-17 16:45:34.000000000 -0400
@@ -55,9 +55,7 @@ static int
 interfaces(const char __user *str, size_t size)
 {
 	if (set_aoe_iflist(str, size)) {
-		printk(KERN_CRIT
-		       "%s: could not set interface list: %s\n",
-		       __FUNCTION__, "too many interfaces");
+		eprintk("could not set interface list: too many interfaces\n");
 		return -EINVAL;
 	}
 	return 0;
@@ -80,8 +78,7 @@ revalidate(const char __user *str, size_
 	/* should be e%d.%d format */
 	n = sscanf(buf, "e%d.%d", &major, &minor);
 	if (n != 2) {
-		printk(KERN_ERR "aoe: %s: invalid device specification\n",
-			__FUNCTION__);
+		eprintk("invalid device specification\n");
 		return -EINVAL;
 	}
 	d = aoedev_by_aoeaddr(major, minor);
@@ -116,7 +113,7 @@ bail:		spin_unlock_irqrestore(&emsgs_loc
 
 	mp = kmalloc(n, GFP_ATOMIC);
 	if (mp == NULL) {
-		printk(KERN_CRIT "aoe: aoechr_error: allocation failure, len=%ld\n", n);
+		eprintk("allocation failure, len=%ld\n", n);
 		goto bail;
 	}
 
@@ -141,7 +138,7 @@ aoechr_write(struct file *filp, const ch
 
 	switch ((unsigned long) filp->private_data) {
 	default:
-		printk(KERN_INFO "aoe: aoechr_write: can't write to that file.\n");
+		iprintk("can't write to that file.\n");
 		break;
 	case MINOR_DISCOVER:
 		ret = discover();
@@ -250,7 +247,7 @@ aoechr_init(void)
 
 	n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
 	if (n < 0) { 
-		printk(KERN_ERR "aoe: aoechr_init: can't register char device\n");
+		eprintk("can't register char device\n");
 		return n;
 	}
 	sema_init(&emsgs_sema, 0);
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
@@ -155,7 +155,7 @@ aoecmd_ata_rw(struct aoedev *d, struct f
 	buf->nframesout += 1;
 	buf->bufaddr += bcnt;
 	buf->bv_resid -= bcnt;
-/* printk(KERN_INFO "aoe: bv_resid=%ld\n", buf->bv_resid); */
+/* dprintk("bv_resid=%ld\n", buf->bv_resid); */
 	buf->resid -= bcnt;
 	buf->sector += bcnt >> 9;
 	if (buf->resid == 0) {
@@ -197,7 +197,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigne
 
 		skb = new_skb(sizeof *h + sizeof *ch);
 		if (skb == NULL) {
-			printk(KERN_INFO "aoe: aoecmd_cfg: skb alloc failure\n");
+			iprintk("skb alloc failure\n");
 			continue;
 		}
 		skb->dev = ifp;
@@ -247,7 +247,7 @@ loop:
 			return;
 		buf = container_of(d->bufq.next, struct buf, bufs);
 		list_del(d->bufq.next);
-/*printk(KERN_INFO "aoecmd_work: bi_size=%ld\n", buf->bio->bi_size); */
+/*dprintk("bi_size=%ld\n", buf->bio->bi_size); */
 		d->inprocess = buf;
 	}
 	aoecmd_ata_rw(d, f);
@@ -287,8 +287,7 @@ rexmit(struct aoedev *d, struct frame *f
 				offset_in_page(f->bufaddr), DEFAULTBCNT);
 		if (++d->lostjumbo > (d->nframes << 1))
 		if (d->maxbcnt != DEFAULTBCNT) {
-			printk(KERN_INFO "aoe: rexmit: too many lost jumbo.  "
-				"dropping back to 1KB frames.\n");
+			iprintk("too many lost jumbo - using 1KB frames.\n");
 			d->maxbcnt = DEFAULTBCNT;
 			d->flags |= DEVFL_MAXBCNT;
 		}
@@ -435,8 +434,8 @@ ataid_complete(struct aoedev *d, unsigne
 	}
 
 	if (d->ssize != ssize)
-		printk(KERN_INFO "aoe: %012llx e%lu.%lu v%04x has %llu "
-			"sectors\n", (unsigned long long)mac_addr(d->addr),
+		iprintk("%012llx e%lu.%lu v%04x has %llu sectors\n",
+			(unsigned long long)mac_addr(d->addr),
 			d->aoemajor, d->aoeminor,
 			d->fw_ver, (long long)ssize);
 	d->ssize = ssize;
@@ -446,11 +445,9 @@ ataid_complete(struct aoedev *d, unsigne
 		d->flags |= DEVFL_NEWSIZE;
 	} else {
 		if (d->flags & DEVFL_GDALLOC) {
-			printk(KERN_INFO "aoe: %s: %s e%lu.%lu, %s\n",
-			       __FUNCTION__,
-			       "can't schedule work for",
+			eprintk("can't schedule work for e%lu.%lu, %s\n",
 			       d->aoemajor, d->aoeminor,
-			       "it's already on! (This really shouldn't happen).\n");
+			       "it's already on!  This shouldn't happen.\n");
 			return;
 		}
 		d->flags |= DEVFL_GDALLOC;
@@ -524,8 +521,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 	if (ahout->cmdstat == WIN_IDENTIFY)
 		d->flags &= ~DEVFL_PAUSE;
 	if (ahin->cmdstat & 0xa9) {	/* these bits cleared on success */
-		printk(KERN_CRIT "aoe: aoecmd_ata_rsp: ata error cmd=%2.2Xh "
-			"stat=%2.2Xh from e%ld.%ld\n", 
+		eprintk("ata error cmd=%2.2Xh stat=%2.2Xh from e%ld.%ld\n", 
 			ahout->cmdstat, ahin->cmdstat,
 			d->aoemajor, d->aoeminor);
 		if (buf)
@@ -536,8 +532,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 		case WIN_READ:
 		case WIN_READ_EXT:
 			if (skb->len - sizeof *hin - sizeof *ahin < n) {
-				printk(KERN_CRIT "aoe: aoecmd_ata_rsp: runt "
-					"ata data size in read.  skb->len=%d\n",
+				eprintk("runt data size in read.  skb->len=%d\n",
 					skb->len);
 				/* fail frame f?  just returning will rexmit. */
 				spin_unlock_irqrestore(&d->lock, flags);
@@ -549,10 +544,13 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 			if (f->bcnt -= n) {
 				f->bufaddr += n;
 				put_lba(ahout, f->lba += ahout->scnt);
-				n = f->bcnt > DEFAULTBCNT ? DEFAULTBCNT : f->bcnt;
+				n = f->bcnt;
+				if (n > DEFAULTBCNT)
+					n = DEFAULTBCNT;
 				ahout->scnt = n >> 9;
 				if (ahout->aflags & AOEAFL_WRITE)
-					skb_fill_page_desc(f->skb, 0, virt_to_page(f->bufaddr),
+					skb_fill_page_desc(f->skb, 0, 
+						virt_to_page(f->bufaddr),
 						offset_in_page(f->bufaddr), n);
 				skb_get(f->skb);
 				f->skb->next = NULL;
@@ -565,19 +563,18 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 			break;
 		case WIN_IDENTIFY:
 			if (skb->len - sizeof *hin - sizeof *ahin < 512) {
-				printk(KERN_INFO "aoe: aoecmd_ata_rsp: runt data size "
-					"in ataid.  skb->len=%d\n", skb->len);
+				iprintk("runt data size in ataid.  skb->len=%d\n",
+					skb->len);
 				spin_unlock_irqrestore(&d->lock, flags);
 				return;
 			}
 			ataid_complete(d, (char *) (ahin+1));
 			break;
 		default:
-			printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized "
-			       "outbound ata command %2.2Xh for %d.%d\n", 
-			       ahout->cmdstat,
-			       be16_to_cpu(hin->major),
-			       hin->minor);
+			iprintk("unrecognized ata command %2.2Xh for %d.%d\n",
+				ahout->cmdstat,
+				be16_to_cpu(hin->major),
+				hin->minor);
 		}
 	}
 
@@ -634,8 +631,7 @@ aoecmd_ata_id(struct aoedev *d)
 
 	f = getframe(d, FREETAG);
 	if (f == NULL) {
-		printk(KERN_CRIT "aoe: aoecmd_ata_id: can't get a frame.  "
-			"This shouldn't happen.\n");
+		eprintk("can't get a frame. This shouldn't happen.\n");
 		return NULL;
 	}
 
@@ -682,15 +678,14 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
 	 */
 	aoemajor = be16_to_cpu(h->major);
 	if (aoemajor == 0xfff) {
-		printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf "
-			"address is all ones.  Check shelf dip switches\n");
+		eprintk("Warning: shelf address is all ones.  "
+			"Check shelf dip switches.\n");
 		return;
 	}
 
 	sysminor = SYSMINOR(aoemajor, h->minor);
 	if (sysminor * AOE_PARTITIONS + AOE_PARTITIONS > MINORMASK) {
-		printk(KERN_INFO
-			"aoe: e%ld.%d: minor number too large\n", 
+		iprintk("e%ld.%d: minor number too large\n", 
 			aoemajor, (int) h->minor);
 		return;
 	}
@@ -701,7 +696,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
 
 	d = aoedev_by_sysminor_m(sysminor, n);
 	if (d == NULL) {
-		printk(KERN_INFO "aoe: aoecmd_cfg_rsp: device sysminor_m failure\n");
+		iprintk("device sysminor_m failure\n");
 		return;
 	}
 
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoedev.c 2.6.18-rc4-aoe/drivers/block/aoe/aoedev.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoedev.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoedev.c	2006-08-17 16:45:34.000000000 -0400
@@ -155,7 +155,7 @@ aoedev_by_sysminor_m(ulong sysminor, ulo
 		d = aoedev_newdev(bufcnt);
 	 	if (d == NULL) {
 			spin_unlock_irqrestore(&devlist_lock, flags);
-			printk(KERN_INFO "aoe: aoedev_set: aoedev_newdev failure.\n");
+			iprintk("aoedev_newdev failure.\n");
 			return NULL;
 		}
 		d->sysminor = sysminor;
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoemain.c 2.6.18-rc4-aoe/drivers/block/aoe/aoemain.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoemain.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoemain.c	2006-08-17 16:45:34.000000000 -0400
@@ -84,13 +84,11 @@ aoe_init(void)
 		goto net_fail;
 	ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
 	if (ret < 0) {
-		printk(KERN_ERR "aoe: aoeblk_init: can't register major\n");
+		eprintk("can't register major\n");
 		goto blkreg_fail;
 	}
 
-	printk(KERN_INFO
-	       "aoe: aoe_init: AoE v%s initialised.\n",
-	       VERSION);
+	iprintk("AoE v%s initialised.\n", VERSION);
 	discover_timer(TINIT);
 	return 0;
 
@@ -103,7 +101,7 @@ aoe_init(void)
  chr_fail:
 	aoedev_exit();
 	
-	printk(KERN_INFO "aoe: aoe_init: initialisation failure.\n");
+	iprintk("initialisation failure.\n");
 	return ret;
 }
 
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoenet.c 2.6.18-rc4-aoe/drivers/block/aoe/aoenet.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoenet.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoenet.c	2006-08-17 16:45:34.000000000 -0400
@@ -74,7 +74,7 @@ set_aoe_iflist(const char __user *user_s
 		return -EINVAL;
 
 	if (copy_from_user(aoe_iflist, user_str, size)) {
-		printk(KERN_INFO "aoe: %s: copy from user failed\n", __FUNCTION__);
+		iprintk("copy from user failed\n");
 		return -EFAULT;
 	}
 	aoe_iflist[size] = 0x00;
@@ -132,8 +132,7 @@ aoenet_rcv(struct sk_buff *skb, struct n
 		if (n > NECODES)
 			n = 0;
 		if (net_ratelimit())
-			printk(KERN_ERR "aoe: aoenet_rcv: error packet from %d.%d; "
-			       "ecode=%d '%s'\n",
+			eprintk("error packet from %d.%d; ecode=%d '%s'\n",
 			       be16_to_cpu(h->major), h->minor, 
 			       h->err, aoe_errlist[n]);
 		goto exit;
@@ -147,7 +146,7 @@ aoenet_rcv(struct sk_buff *skb, struct n
 		aoecmd_cfg_rsp(skb);
 		break;
 	default:
-		printk(KERN_INFO "aoe: aoenet_rcv: unknown cmd %d\n", h->cmd);
+		iprintk("unknown cmd %d\n", h->cmd);
 	}
 exit:
 	dev_kfree_skb(skb);


-- 
  "Ed L. Cashin" <ecashin@coraid.com>

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

* [PATCH 2.6.18-rc4] aoe [07/13]: jumbo frame support 2 of 2
       [not found] <E1GE8K3-0008Jn-00@kokone.coraid.com>
                   ` (4 preceding siblings ...)
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [06/13]: clean up printks via macros Ed L. Cashin
@ 2006-08-18 17:39 ` Ed L. Cashin
  2006-08-18 22:58   ` Alan Cox
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [08/13]: improve retransmission heuristics Ed L. Cashin
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 17:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: ecashin, Greg K-H

Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>

Add support for jumbo ethernet frames.
(This patch follows patch 5.)

diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
@@ -28,7 +28,7 @@ new_skb(ulong len)
 		skb->protocol = __constant_htons(ETH_P_AOE);
 		skb->priority = 0;
 		skb_put(skb, len);
-		memset(skb->head, 0, len);
+		memset(skb->head, 0, ETH_ZLEN);
 		skb->next = skb->prev = NULL;
 
 		/* tell the network layer not to perform IP checksums
@@ -475,7 +475,7 @@ void
 aoecmd_ata_rsp(struct sk_buff *skb)
 {
 	struct aoedev *d;
-	struct aoe_hdr *hin;
+	struct aoe_hdr *hin, *hout;
 	struct aoe_atahdr *ahin, *ahout;
 	struct frame *f;
 	struct buf *buf;
@@ -515,7 +515,8 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 	calc_rttavg(d, tsince(f->tag));
 
 	ahin = (struct aoe_atahdr *) (hin+1);
-	ahout = (struct aoe_atahdr *) (f->skb->mac.raw + sizeof(struct aoe_hdr));
+	hout = (struct aoe_hdr *) f->skb->mac.raw;
+	ahout = (struct aoe_atahdr *) (hout+1);
 	buf = f->buf;
 
 	if (ahout->cmdstat == WIN_IDENTIFY)
@@ -552,6 +553,9 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 					skb_fill_page_desc(f->skb, 0, 
 						virt_to_page(f->bufaddr),
 						offset_in_page(f->bufaddr), n);
+				f->tag = newtag(d);
+				hout->tag = cpu_to_be32(f->tag);
+				skb->dev = d->ifp;
 				skb_get(f->skb);
 				f->skb->next = NULL;
 				spin_unlock_irqrestore(&d->lock, flags);


-- 
  "Ed L. Cashin" <ecashin@coraid.com>

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

* [PATCH 2.6.18-rc4] aoe [08/13]: improve retransmission heuristics
       [not found] <E1GE8K3-0008Jn-00@kokone.coraid.com>
                   ` (5 preceding siblings ...)
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [07/13]: jumbo frame support 2 of 2 Ed L. Cashin
@ 2006-08-18 17:39 ` Ed L. Cashin
  2006-08-18 23:02   ` Alan Cox
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [09/13]: zero copy write 2 of 2 Ed L. Cashin
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 17:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: ecashin, Greg K-H

Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>

Add a dynamic minimum timer for better retransmission behavior.

diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoe.h 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h
--- 2.6.18-rc4-orig/drivers/block/aoe/aoe.h	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h	2006-08-17 16:45:34.000000000 -0400
@@ -125,8 +125,10 @@ struct aoedev {
 	ulong sysminor;
 	ulong aoemajor;
 	ulong aoeminor;
-	ulong nopen;		/* (bd_openers isn't available without sleeping) */
-	ulong rttavg;		/* round trip average of requests/responses */
+	u16 nopen;		/* (bd_openers isn't available without sleeping) */
+	u16 lasttag;		/* last tag sent */
+	u16 rttavg;		/* round trip average of requests/responses */
+	u16 mintimer;
 	u16 fw_ver;		/* version of blade's firmware */
 	u16 maxbcnt;
 	struct work_struct work;/* disk create work struct */
@@ -142,7 +144,6 @@ struct aoedev {
 	mempool_t *bufpool;	/* for deadlock-free Buf allocation */
 	struct list_head bufq;	/* queue of bios to work on */
 	struct buf *inprocess;	/* the one we're currently working on */
-	ulong lasttag;		/* last tag sent */
 	ushort lostjumbo;
 	ushort nframes;		/* number of frames below */
 	struct frame *frames;
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
@@ -461,8 +461,15 @@ calc_rttavg(struct aoedev *d, int rtt)
 	register long n;
 
 	n = rtt;
-	if (n < MINTIMER)
-		n = MINTIMER;
+	if (n < 0) {
+		n = -rtt;
+		if (n < MINTIMER)
+			n = MINTIMER;
+		else if (n > MAXTIMER)
+			n = MAXTIMER;
+		d->mintimer += (n - d->mintimer) >> 1;
+	} else if (n < d->mintimer)
+		n = d->mintimer;
 	else if (n > MAXTIMER)
 		n = MAXTIMER;
 
@@ -498,8 +505,10 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 
 	spin_lock_irqsave(&d->lock, flags);
 
-	f = getframe(d, be32_to_cpu(hin->tag));
+	n = be32_to_cpu(hin->tag);
+	f = getframe(d, n);
 	if (f == NULL) {
+		calc_rttavg(d, -tsince(n));
 		spin_unlock_irqrestore(&d->lock, flags);
 		snprintf(ebuf, sizeof ebuf,
 			"%15s e%d.%d    tag=%08x@%08lx\n",
@@ -724,6 +733,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
 		return;
 	}
 	d->flags |= DEVFL_PAUSE;	/* force pause */
+	d->mintimer = MINTIMER;
 	d->fw_ver = be16_to_cpu(ch->fwver);
 
 	/* check for already outstanding ataid */


-- 
  "Ed L. Cashin" <ecashin@coraid.com>

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

* [PATCH 2.6.18-rc4] aoe [09/13]: zero copy write 2 of 2
       [not found] <E1GE8K3-0008Jn-00@kokone.coraid.com>
                   ` (6 preceding siblings ...)
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [08/13]: improve retransmission heuristics Ed L. Cashin
@ 2006-08-18 17:39 ` Ed L. Cashin
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [10/13]: module parameter for device timeout Ed L. Cashin
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 17:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: ecashin, Greg K-H

Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>

Avoid memory copy on writes.
(This patch follows patch 4.)

diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoe.h 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h
--- 2.6.18-rc4-orig/drivers/block/aoe/aoe.h	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h	2006-08-17 16:45:34.000000000 -0400
@@ -84,6 +84,7 @@ enum {
 	DEVFL_PAUSE = (1<<5),
 	DEVFL_NEWSIZE = (1<<6),	/* need to update dev size in block layer */
 	DEVFL_MAXBCNT = (1<<7), /* d->maxbcnt is not changeable */
+	DEVFL_KICKME = (1<<8),
 
 	BUFFL_FAIL = 1,
 };
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
@@ -120,7 +120,7 @@ aoecmd_ata_rw(struct aoedev *d, struct f
 	h = (struct aoe_hdr *) skb->mac.raw;
 	ah = (struct aoe_atahdr *) (h+1);
 	skb->len = sizeof *h + sizeof *ah;
-	memset(h, 0, skb->len);
+	memset(h, 0, ETH_ZLEN);
 	f->tag = aoehdr_atainit(d, h);
 	f->waited = 0;
 	f->buf = buf;
@@ -143,8 +143,9 @@ aoecmd_ata_rw(struct aoedev *d, struct f
 		skb_fill_page_desc(skb, 0, virt_to_page(f->bufaddr),
 			offset_in_page(f->bufaddr), bcnt);
 		ah->aflags |= AOEAFL_WRITE;
+		skb->len += bcnt;
+		skb->data_len = bcnt;
 	} else {
-		skb_shinfo(skb)->nr_frags = 0;
 		skb->len = ETH_ZLEN;
 		writebit = 0;
 	}
@@ -167,8 +168,9 @@ aoecmd_ata_rw(struct aoedev *d, struct f
 	}
 
 	skb->dev = d->ifp;
-	skb_get(skb);
-	skb->next = NULL;
+	skb = skb_clone(skb, GFP_ATOMIC);
+	if (skb == NULL)	
+		return;
 	if (d->sendq_hd)
 		d->sendq_tl->next = skb;
 	else
@@ -224,6 +226,29 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigne
 	return sl;
 }
 
+static struct frame *
+freeframe(struct aoedev *d)
+{
+	struct frame *f, *e;
+	int n = 0;
+
+	f = d->frames;
+	e = f + d->nframes;
+	for (; f<e; f++) {
+		if (f->tag != FREETAG)
+			continue;
+		if (atomic_read(&skb_shinfo(f->skb)->dataref) == 1) {
+			skb_shinfo(f->skb)->nr_frags = f->skb->data_len = 0;
+			return f;
+		}
+		n++;
+	}
+	if (n == d->nframes)	/* wait for network layer */
+		d->flags |= DEVFL_KICKME;
+
+	return NULL;
+}
+
 /* enters with d->lock held */
 void
 aoecmd_work(struct aoedev *d)
@@ -239,7 +264,7 @@ aoecmd_work(struct aoedev *d)
 	}
 
 loop:
-	f = getframe(d, FREETAG);
+	f = freeframe(d);
 	if (f == NULL)
 		return;
 	if (d->inprocess == NULL) {
@@ -282,20 +307,25 @@ rexmit(struct aoedev *d, struct frame *f
 	n = DEFAULTBCNT / 512;
 	if (ah->scnt > n) {
 		ah->scnt = n;
-		if (ah->aflags & AOEAFL_WRITE)
+		if (ah->aflags & AOEAFL_WRITE) {
 			skb_fill_page_desc(skb, 0, virt_to_page(f->bufaddr),
 				offset_in_page(f->bufaddr), DEFAULTBCNT);
+			skb->len = sizeof *h + sizeof *ah + DEFAULTBCNT;
+			skb->data_len = DEFAULTBCNT;
+		}
 		if (++d->lostjumbo > (d->nframes << 1))
 		if (d->maxbcnt != DEFAULTBCNT) {
-			iprintk("too many lost jumbo - using 1KB frames.\n");
+			iprintk("e%ld.%ld: too many lost jumbo on %s - using 1KB frames.\n",
+				d->aoemajor, d->aoeminor, d->ifp->name);
 			d->maxbcnt = DEFAULTBCNT;
 			d->flags |= DEVFL_MAXBCNT;
 		}
 	}
 
 	skb->dev = d->ifp;
-	skb_get(skb);
-	skb->next = NULL;
+	skb = skb_clone(skb, GFP_ATOMIC);
+	if (skb == NULL)
+		return;
 	if (d->sendq_hd)
 		d->sendq_tl->next = skb;
 	else
@@ -350,6 +380,10 @@ rexmit_timer(ulong vp)
 			rexmit(d, f);
 		}
 	}
+	if (d->flags & DEVFL_KICKME) {
+		d->flags &= ~DEVFL_KICKME;
+		aoecmd_work(d);
+	}
 
 	sl = d->sendq_hd;
 	d->sendq_hd = d->sendq_tl = NULL;
@@ -552,23 +586,27 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 		case WIN_WRITE:
 		case WIN_WRITE_EXT:
 			if (f->bcnt -= n) {
+				skb = f->skb;
 				f->bufaddr += n;
 				put_lba(ahout, f->lba += ahout->scnt);
 				n = f->bcnt;
 				if (n > DEFAULTBCNT)
 					n = DEFAULTBCNT;
 				ahout->scnt = n >> 9;
-				if (ahout->aflags & AOEAFL_WRITE)
-					skb_fill_page_desc(f->skb, 0, 
+				if (ahout->aflags & AOEAFL_WRITE) {
+					skb_fill_page_desc(skb, 0, 
 						virt_to_page(f->bufaddr),
 						offset_in_page(f->bufaddr), n);
+					skb->len = sizeof *hout + sizeof *ahout + n;
+					skb->data_len = n;
+				}
 				f->tag = newtag(d);
 				hout->tag = cpu_to_be32(f->tag);
 				skb->dev = d->ifp;
-				skb_get(f->skb);
-				f->skb->next = NULL;
+				skb = skb_clone(skb, GFP_ATOMIC);
 				spin_unlock_irqrestore(&d->lock, flags);
-				aoenet_xmit(f->skb);
+				if (skb)
+					aoenet_xmit(skb);
 				return;
 			}
 			if (n > DEFAULTBCNT)
@@ -642,7 +680,7 @@ aoecmd_ata_id(struct aoedev *d)
 	struct frame *f;
 	struct sk_buff *skb;
 
-	f = getframe(d, FREETAG);
+	f = freeframe(d);
 	if (f == NULL) {
 		eprintk("can't get a frame. This shouldn't happen.\n");
 		return NULL;
@@ -652,8 +690,8 @@ aoecmd_ata_id(struct aoedev *d)
 	skb = f->skb;
 	h = (struct aoe_hdr *) skb->mac.raw;
 	ah = (struct aoe_atahdr *) (h+1);
-	skb->len = sizeof *h + sizeof *ah;
-	memset(h, 0, skb->len);
+	skb->len = ETH_ZLEN;
+	memset(h, 0, ETH_ZLEN);
 	f->tag = aoehdr_atainit(d, h);
 	f->waited = 0;
 
@@ -663,12 +701,11 @@ aoecmd_ata_id(struct aoedev *d)
 	ah->lba3 = 0xa0;
 
 	skb->dev = d->ifp;
-	skb_get(skb);
 
 	d->rttavg = MAXTIMER;
 	d->timer.function = rexmit_timer;
 
-	return skb;
+	return skb_clone(skb, GFP_ATOMIC);
 }
  
 void
@@ -724,7 +761,12 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
 		n /= 512;
 		if (n > ch->scnt)
 			n = ch->scnt;
-		d->maxbcnt = n ? n * 512 : DEFAULTBCNT;
+		n = n ? n * 512 : DEFAULTBCNT;
+		if (n != d->maxbcnt) {
+			iprintk("e%ld.%ld: setting %d byte data frames on %s\n",
+				d->aoemajor, d->aoeminor, n, d->ifp->name);
+			d->maxbcnt = n;
+		}
 	}
 
 	/* don't change users' perspective */
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoedev.c 2.6.18-rc4-aoe/drivers/block/aoe/aoedev.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoedev.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoedev.c	2006-08-17 16:45:34.000000000 -0400
@@ -121,6 +121,7 @@ aoedev_downdev(struct aoedev *d)
 			mempool_free(buf, d->bufpool);
 			bio_endio(bio, bio->bi_size, -EIO);
 		}
+		skb_shinfo(f->skb)->nr_frags = f->skb->data_len = 0;
 	}
 	d->inprocess = NULL;
 


-- 
  "Ed L. Cashin" <ecashin@coraid.com>

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

* [PATCH 2.6.18-rc4] aoe [10/13]: module parameter for device timeout
       [not found] <E1GE8K3-0008Jn-00@kokone.coraid.com>
                   ` (7 preceding siblings ...)
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [09/13]: zero copy write 2 of 2 Ed L. Cashin
@ 2006-08-18 17:39 ` Ed L. Cashin
  2006-08-18 23:03   ` Alan Cox
  2006-08-18 17:40 ` [PATCH 2.6.18-rc4] aoe [11/13]: use bio->bi_idx Ed L. Cashin
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 17:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: ecashin, Greg K-H

Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>

The aoe_deadsecs module parameter sets the number of seconds that
elapse before a nonresponsive AoE device is marked as dead.

diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
@@ -15,7 +15,10 @@
 #define TIMERTICK (HZ / 10)
 #define MINTIMER (2 * TIMERTICK)
 #define MAXTIMER (HZ << 1)
-#define MAXWAIT (60 * 3)	/* After MAXWAIT seconds, give up and fail dev */
+
+static int aoe_deadsecs = 60 * 3;
+module_param(aoe_deadsecs, int, 0644);
+MODULE_PARM_DESC(aoe_deadsecs, "After aoe_deadsecs seconds, give up and fail dev.");
 
 struct sk_buff *
 new_skb(ulong len)
@@ -373,7 +376,7 @@ rexmit_timer(ulong vp)
 		if (f->tag != FREETAG && tsince(f->tag) >= timeout) {
 			n = f->waited += timeout;
 			n /= HZ;
-			if (n > MAXWAIT) { /* waited too long.  device failure. */
+			if (n > aoe_deadsecs) { /* waited too long for response */
 				aoedev_downdev(d);
 				break;
 			}


-- 
  "Ed L. Cashin" <ecashin@coraid.com>

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

* [PATCH 2.6.18-rc4] aoe [11/13]: use bio->bi_idx
       [not found] <E1GE8K3-0008Jn-00@kokone.coraid.com>
                   ` (8 preceding siblings ...)
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [10/13]: module parameter for device timeout Ed L. Cashin
@ 2006-08-18 17:40 ` Ed L. Cashin
  2006-08-18 17:40 ` [PATCH 2.6.18-rc4] aoe [12/13]: remove sysfs comment Ed L. Cashin
  2006-08-18 17:40 ` [PATCH 2.6.18-rc4] aoe [13/13]: update driver version Ed L. Cashin
  11 siblings, 0 replies; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 17:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: ecashin, Greg K-H

Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>

Instead of starting with bio->bi_io_vec, use the offset in bio->bi_idx.

diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoeblk.c 2.6.18-rc4-aoe/drivers/block/aoe/aoeblk.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoeblk.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoeblk.c	2006-08-17 16:45:34.000000000 -0400
@@ -142,7 +142,8 @@ aoeblk_make_request(request_queue_t *q, 
 	buf->bio = bio;
 	buf->resid = bio->bi_size;
 	buf->sector = bio->bi_sector;
-	buf->bv = buf->bio->bi_io_vec;
+	buf->bv = &bio->bi_io_vec[bio->bi_idx];
+	WARN_ON(buf->bv->bv_len == 0);
 	buf->bv_resid = buf->bv->bv_len;
 	buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset;
 
diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
@@ -166,6 +166,7 @@ aoecmd_ata_rw(struct aoedev *d, struct f
 		d->inprocess = NULL;
 	} else if (buf->bv_resid == 0) {
 		buf->bv++;
+		WARN_ON(buf->bv->bv_len == 0);
 		buf->bv_resid = buf->bv->bv_len;
 		buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset;
 	}


-- 
  "Ed L. Cashin" <ecashin@coraid.com>

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

* [PATCH 2.6.18-rc4] aoe [12/13]: remove sysfs comment
       [not found] <E1GE8K3-0008Jn-00@kokone.coraid.com>
                   ` (9 preceding siblings ...)
  2006-08-18 17:40 ` [PATCH 2.6.18-rc4] aoe [11/13]: use bio->bi_idx Ed L. Cashin
@ 2006-08-18 17:40 ` Ed L. Cashin
  2006-08-18 17:40 ` [PATCH 2.6.18-rc4] aoe [13/13]: update driver version Ed L. Cashin
  11 siblings, 0 replies; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 17:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: ecashin, Greg K-H

Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>

Remove unecessary comment.

diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoeblk.c 2.6.18-rc4-aoe/drivers/block/aoe/aoeblk.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoeblk.c	2006-08-17 11:32:22.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoeblk.c	2006-08-17 15:38:55.000000000 -0400
@@ -14,7 +14,6 @@
 
 static kmem_cache_t *buf_pool_cache;
 
-/* add attributes for our block devices in sysfs */
 static ssize_t aoedisk_show_state(struct gendisk * disk, char *page)
 {
 	struct aoedev *d = disk->private_data;


-- 
  "Ed L. Cashin" <ecashin@coraid.com>

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

* [PATCH 2.6.18-rc4] aoe [13/13]: update driver version
       [not found] <E1GE8K3-0008Jn-00@kokone.coraid.com>
                   ` (10 preceding siblings ...)
  2006-08-18 17:40 ` [PATCH 2.6.18-rc4] aoe [12/13]: remove sysfs comment Ed L. Cashin
@ 2006-08-18 17:40 ` Ed L. Cashin
  11 siblings, 0 replies; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 17:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: ecashin, Greg K-H

Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>

Update aoe driver version number to 32.

diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoe.h 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h
--- 2.6.18-rc4-orig/drivers/block/aoe/aoe.h	2006-08-17 16:45:34.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoe.h	2006-08-17 16:45:35.000000000 -0400
@@ -1,5 +1,5 @@
 /* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
-#define VERSION "22"
+#define VERSION "32"
 #define AOE_MAJOR 152
 #define DEVICE_NAME "aoe"
 


-- 
  "Ed L. Cashin" <ecashin@coraid.com>

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

* Re: [PATCH 2.6.18-rc4] aoe [06/13]: clean up printks via macros
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [06/13]: clean up printks via macros Ed L. Cashin
@ 2006-08-18 19:29   ` Arnd Bergmann
  2006-08-18 22:23     ` Ed L. Cashin
  2006-08-18 22:57   ` Alan Cox
  1 sibling, 1 reply; 30+ messages in thread
From: Arnd Bergmann @ 2006-08-18 19:29 UTC (permalink / raw)
  To: Ed L. Cashin; +Cc: linux-kernel, Greg K-H

On Friday 18 August 2006 19:39, Ed L. Cashin wrote:
> 
> +#define xprintk(L, fmt, arg...) printk(L "aoe: " "%s: " fmt, __func__, ## arg) 
> +#define iprintk(fmt, arg...) xprintk(KERN_INFO, fmt, ## arg)
> +#define eprintk(fmt, arg...) xprintk(KERN_ERR, fmt, ## arg)
> +#define dprintk(fmt, arg...) xprintk(KERN_DEBUG, fmt, ## arg)
> +

Can't you use the dev_{info,error,dbg}() functions instead?

	Arnd <><

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

* Re: [PATCH 2.6.18-rc4] aoe [06/13]: clean up printks via macros
  2006-08-18 19:29   ` Arnd Bergmann
@ 2006-08-18 22:23     ` Ed L. Cashin
  0 siblings, 0 replies; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 22:23 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel, Greg K-H

On Fri, Aug 18, 2006 at 09:29:45PM +0200, Arnd Bergmann wrote:
> On Friday 18 August 2006 19:39, Ed L. Cashin wrote:
> > 
> > +#define xprintk(L, fmt, arg...) printk(L "aoe: " "%s: " fmt, __func__, ## arg) 
> > +#define iprintk(fmt, arg...) xprintk(KERN_INFO, fmt, ## arg)
> > +#define eprintk(fmt, arg...) xprintk(KERN_ERR, fmt, ## arg)
> > +#define dprintk(fmt, arg...) xprintk(KERN_DEBUG, fmt, ## arg)
> > +
> 
> Can't you use the dev_{info,error,dbg}() functions instead?

That's a good thought, but I don't think so.  The dev_* macros don't
add the function name to the printed message, and we don't have a
struct device pointer in all our contexts.  Even if we did, it would
be kind of forced to do that just to try to get the prefix "aoe: " and
the function name into the printks, which the new macros do nicely.

-- 
  Ed L Cashin <ecashin@coraid.com>

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

* Re: [PATCH 2.6.18-rc4] aoe [02/13]: update copyright date
  2006-08-18 17:38 ` [PATCH 2.6.18-rc4] aoe [02/13]: update copyright date Ed L. Cashin
@ 2006-08-18 22:54   ` Alan Cox
  0 siblings, 0 replies; 30+ messages in thread
From: Alan Cox @ 2006-08-18 22:54 UTC (permalink / raw)
  To: Ed L. Cashin; +Cc: linux-kernel, Greg K-H

Ar Gwe, 2006-08-18 am 13:38 -0400, ysgrifennodd Ed L. Cashin:
> Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>
> 
> Update the copyright year to 2006.

Acked-by: Alan Cox <alan@redhat.com>


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

* Re: [PATCH 2.6.18-rc4] aoe [03/13]: remove unused NARGS enum
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [03/13]: remove unused NARGS enum Ed L. Cashin
@ 2006-08-18 22:54   ` Alan Cox
  0 siblings, 0 replies; 30+ messages in thread
From: Alan Cox @ 2006-08-18 22:54 UTC (permalink / raw)
  To: Ed L. Cashin; +Cc: linux-kernel, Greg K-H

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:
> Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>
> 
> The NARGS enum is left over from older code versions.
> 

Acked-by: Alan Cox <alan@redhat.com>


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

* Re: [PATCH 2.6.18-rc4] aoe [05/13]: jumbo frame support 1 of 2
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [05/13]: jumbo frame support " Ed L. Cashin
@ 2006-08-18 22:56   ` Alan Cox
  0 siblings, 0 replies; 30+ messages in thread
From: Alan Cox @ 2006-08-18 22:56 UTC (permalink / raw)
  To: Ed L. Cashin; +Cc: linux-kernel, Greg K-H

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:
> Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>
> 
> Add support for jumbo ethernet frames.
> (This patch depends on patch 7 to follow.)

Acked-by: Alan Cox <alan@redhat.com>

(but please keep changes that need each other and are small together so
you don't cause pain when binary searching for errors)


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

* Re: [PATCH 2.6.18-rc4] aoe [06/13]: clean up printks via macros
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [06/13]: clean up printks via macros Ed L. Cashin
  2006-08-18 19:29   ` Arnd Bergmann
@ 2006-08-18 22:57   ` Alan Cox
  1 sibling, 0 replies; 30+ messages in thread
From: Alan Cox @ 2006-08-18 22:57 UTC (permalink / raw)
  To: Ed L. Cashin; +Cc: linux-kernel, Greg K-H

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:
> Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>
> 
> Use simple macros to clean up the printks.

This isn't a clean up. Well it is to you but its a confusion to anyone
else meeting the code. We eschew unneccessary obfuscation when macros
are involved.

The older code is longer winded but its *obvious* what it does and it
looks like the rest of the kernel.


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

* Re: [PATCH 2.6.18-rc4] aoe [07/13]: jumbo frame support 2 of 2
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [07/13]: jumbo frame support 2 of 2 Ed L. Cashin
@ 2006-08-18 22:58   ` Alan Cox
  2006-08-18 23:04     ` Ed L. Cashin
  0 siblings, 1 reply; 30+ messages in thread
From: Alan Cox @ 2006-08-18 22:58 UTC (permalink / raw)
  To: Ed L. Cashin; +Cc: linux-kernel, Greg K-H

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:
> Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>
> 
> Add support for jumbo ethernet frames.
> (This patch follows patch 5.)
> 
> diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
> --- 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
> +++ 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c	2006-08-17 16:45:34.000000000 -0400
> @@ -28,7 +28,7 @@ new_skb(ulong len)
>  		skb->protocol = __constant_htons(ETH_P_AOE);
>  		skb->priority = 0;
>  		skb_put(skb, len);
> -		memset(skb->head, 0, len);
> +		memset(skb->head, 0, ETH_ZLEN);

You realise the tail of a short packet is cleared by the network drivers
either in software or hardware ?


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

* Re: [PATCH 2.6.18-rc4] aoe [08/13]: improve retransmission heuristics
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [08/13]: improve retransmission heuristics Ed L. Cashin
@ 2006-08-18 23:02   ` Alan Cox
  0 siblings, 0 replies; 30+ messages in thread
From: Alan Cox @ 2006-08-18 23:02 UTC (permalink / raw)
  To: Ed L. Cashin; +Cc: linux-kernel, Greg K-H

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:
> Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>
> 
> Add a dynamic minimum timer for better retransmission behavior.

Acked-by: Alan Cox <alan@redhat.com>

"those who fail to learn from TCP are doomed to re-invent it, badly, at
the wrong level." - Tim Wright


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

* Re: [PATCH 2.6.18-rc4] aoe [10/13]: module parameter for device timeout
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [10/13]: module parameter for device timeout Ed L. Cashin
@ 2006-08-18 23:03   ` Alan Cox
  2006-08-18 23:10     ` Ed L. Cashin
  0 siblings, 1 reply; 30+ messages in thread
From: Alan Cox @ 2006-08-18 23:03 UTC (permalink / raw)
  To: Ed L. Cashin; +Cc: linux-kernel, Greg K-H

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:
> Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>
> 
> The aoe_deadsecs module parameter sets the number of seconds that
> elapse before a nonresponsive AoE device is marked as dead.
> 

Isn't this a) per link dependant and b) needing to be runtime tuned
(sysfs say ?)


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

* Re: [PATCH 2.6.18-rc4] aoe [07/13]: jumbo frame support 2 of 2
  2006-08-18 22:58   ` Alan Cox
@ 2006-08-18 23:04     ` Ed L. Cashin
  2006-08-19  0:08       ` Alan Cox
  0 siblings, 1 reply; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 23:04 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel, Greg K-H

On Fri, Aug 18, 2006 at 11:58:32PM +0100, Alan Cox wrote:
> Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:
...
> > @@ -28,7 +28,7 @@ new_skb(ulong len)
> >  		skb->protocol = __constant_htons(ETH_P_AOE);
> >  		skb->priority = 0;
> >  		skb_put(skb, len);
> > -		memset(skb->head, 0, len);
> > +		memset(skb->head, 0, ETH_ZLEN);
> 
> You realise the tail of a short packet is cleared by the network drivers
> either in software or hardware ?

Yes, I think that the patch author is used to doing ETH_ZLEN because
of a bug in the e1000 driver where the short packets weren't getting
padded.  I don't think I ever heard of a resolution to that issue, but
I could change it back to "len" here.

-- 
  Ed L Cashin <ecashin@coraid.com>

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

* Re: [PATCH 2.6.18-rc4] aoe [10/13]: module parameter for device timeout
  2006-08-18 23:03   ` Alan Cox
@ 2006-08-18 23:10     ` Ed L. Cashin
  2006-08-19  0:09       ` Alan Cox
  0 siblings, 1 reply; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-18 23:10 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel, Greg K-H

On Sat, Aug 19, 2006 at 12:03:07AM +0100, Alan Cox wrote:
> Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:
> > Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>
> > 
> > The aoe_deadsecs module parameter sets the number of seconds that
> > elapse before a nonresponsive AoE device is marked as dead.
> > 
> 
> Isn't this a) per link dependant and b) needing to be runtime tuned
> (sysfs say ?)

No, this is just for users who need very fast failure.  The default
three minutes is good for things like short network interruptions and
even quick AoE device reboots, but users who aren't interested in that
kind of flexibility and want a fast failure generally want it always
and on every link.

-- 
  Ed L Cashin <ecashin@coraid.com>

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

* Re: [PATCH 2.6.18-rc4] aoe [07/13]: jumbo frame support 2 of 2
  2006-08-18 23:04     ` Ed L. Cashin
@ 2006-08-19  0:08       ` Alan Cox
  0 siblings, 0 replies; 30+ messages in thread
From: Alan Cox @ 2006-08-19  0:08 UTC (permalink / raw)
  To: Ed L. Cashin; +Cc: linux-kernel, Greg K-H

Ar Gwe, 2006-08-18 am 19:04 -0400, ysgrifennodd Ed L. Cashin:
> On Fri, Aug 18, 2006 at 11:58:32PM +0100, Alan Cox wrote:
> Yes, I think that the patch author is used to doing ETH_ZLEN because
> of a bug in the e1000 driver where the short packets weren't getting
> padded.  I don't think I ever heard of a resolution to that issue, but
> I could change it back to "len" here.

It should have been resolved as uncleared packet tails are a security
hole. If not it needs fixing not aoe


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

* Re: [PATCH 2.6.18-rc4] aoe [10/13]: module parameter for device timeout
  2006-08-18 23:10     ` Ed L. Cashin
@ 2006-08-19  0:09       ` Alan Cox
  2006-08-21 22:45         ` Ed L. Cashin
  0 siblings, 1 reply; 30+ messages in thread
From: Alan Cox @ 2006-08-19  0:09 UTC (permalink / raw)
  To: Ed L. Cashin; +Cc: linux-kernel, Greg K-H

Ar Gwe, 2006-08-18 am 19:10 -0400, ysgrifennodd Ed L. Cashin:
> No, this is just for users who need very fast failure.  The default
> three minutes is good for things like short network interruptions and
> even quick AoE device reboots, but users who aren't interested in that
> kind of flexibility and want a fast failure generally want it always
> and on every link.

Ok, but it should still be runtime settable.


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

* Re: [PATCH 2.6.18-rc4] aoe [04/13]: zero copy write 1 of 2
  2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [04/13]: zero copy write 1 of 2 Ed L. Cashin
@ 2006-08-19 10:18   ` Alan Cox
  2006-08-22 21:21     ` Ed L. Cashin
  0 siblings, 1 reply; 30+ messages in thread
From: Alan Cox @ 2006-08-19 10:18 UTC (permalink / raw)
  To: Ed L. Cashin; +Cc: linux-kernel, Greg K-H

Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:
> Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>

> +	skb->len = sizeof *h + sizeof *ah;
> +	memset(h, 0, skb->len);

Never play with skb->len directly. Use skb_put/skb_trim



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

* Re: [PATCH 2.6.18-rc4] aoe [10/13]: module parameter for device timeout
  2006-08-19  0:09       ` Alan Cox
@ 2006-08-21 22:45         ` Ed L. Cashin
  0 siblings, 0 replies; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-21 22:45 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel, Greg K-H

On Sat, Aug 19, 2006 at 01:09:11AM +0100, Alan Cox wrote:
> Ar Gwe, 2006-08-18 am 19:10 -0400, ysgrifennodd Ed L. Cashin:
> > No, this is just for users who need very fast failure.  The default
> > three minutes is good for things like short network interruptions and
> > even quick AoE device reboots, but users who aren't interested in that
> > kind of flexibility and want a fast failure generally want it always
> > and on every link.
> 
> Ok, but it should still be runtime settable.

You know, it occurs to me that it is, just by virtue of sysfs, and a
little test shows that to be the case.

-- 
  Ed L Cashin <ecashin@coraid.com>

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

* Re: [PATCH 2.6.18-rc4] aoe [04/13]: zero copy write 1 of 2
  2006-08-19 10:18   ` Alan Cox
@ 2006-08-22 21:21     ` Ed L. Cashin
  2006-08-23 15:03       ` Alan Cox
  0 siblings, 1 reply; 30+ messages in thread
From: Ed L. Cashin @ 2006-08-22 21:21 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel, Greg K-H

On Sat, Aug 19, 2006 at 11:18:12AM +0100, Alan Cox wrote:
> Ar Gwe, 2006-08-18 am 13:39 -0400, ysgrifennodd Ed L. Cashin:
> > Signed-off-by: "Ed L. Cashin" <ecashin@coraid.com>
> 
> > +	skb->len = sizeof *h + sizeof *ah;
> > +	memset(h, 0, skb->len);
> 
> Never play with skb->len directly. Use skb_put/skb_trim

These are skbs pre-allocated by the aoe driver that will always have
enough room to accomodate this much data, and we are really setting
the packet header length.

To use skb_put here seems awkward.  We'd have to do things like shown
below throughout the driver instead of just setting the length.  Is
that what you'd like to see?

diff -upr 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c
--- 2.6.18-rc4-orig/drivers/block/aoe/aoecmd.c	2006-08-22 12:48:18.000000000 -0400
+++ 2.6.18-rc4-aoe/drivers/block/aoe/aoecmd.c	2006-08-22 17:03:23.000000000 -0400
@@ -314,7 +315,9 @@ rexmit(struct aoedev *d, struct frame *f
 		if (ah->aflags & AOEAFL_WRITE) {
 			skb_fill_page_desc(skb, 0, virt_to_page(f->bufaddr),
 				offset_in_page(f->bufaddr), DEFAULTBCNT);
-			skb->len = sizeof *h + sizeof *ah + DEFAULTBCNT;
+			skb->data_len = 0;
+			skb_trim(skb, 0);
+			skb_put(skb, sizeof *h + sizeof *ah + DEFAULTBCNT);
 			skb->data_len = DEFAULTBCNT;
 		}
 		if (++d->lostjumbo > (d->nframes << 1))


-- 
  Ed L Cashin <ecashin@coraid.com>

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

* Re: [PATCH 2.6.18-rc4] aoe [04/13]: zero copy write 1 of 2
  2006-08-22 21:21     ` Ed L. Cashin
@ 2006-08-23 15:03       ` Alan Cox
  0 siblings, 0 replies; 30+ messages in thread
From: Alan Cox @ 2006-08-23 15:03 UTC (permalink / raw)
  To: Ed L. Cashin; +Cc: linux-kernel, Greg K-H

Ar Maw, 2006-08-22 am 17:21 -0400, ysgrifennodd Ed L. Cashin:
> These are skbs pre-allocated by the aoe driver that will always have
> enough room to accomodate this much data, and we are really setting
> the packet header length.

The skb structure has other fields and if you fiddle with them by hand
you break those and you end up breaking if the skb internals change.

Eg if you set skb->len you must set skb->tail. Functions like
skb_addd_data, skb_put, skb_trim, etc do the right thing in all cases.

> To use skb_put here seems awkward.  We'd have to do things like shown
> below throughout the driver instead of just setting the length.  Is
> that what you'd like to see?

Yes. It might take a clock or two longer but it sets skb->tail right and
is rather more future proof.


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

* Re: [PATCH 2.6.18-rc4] aoe [04/13]: zero copy write 1 of 2
@ 2006-09-14 19:50 Ed L. Cashin
  0 siblings, 0 replies; 30+ messages in thread
From: Ed L. Cashin @ 2006-09-14 19:50 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel, Greg K-H

f5d@coraid.com> <1155982692.4051.9.camel@localhost.localdomain> <20060822212150.
GQ6196@coraid.com> <1156345386.3007.24.camel@localhost.localdomain>
In-Reply-To: <1156345386.3007.24.camel@localhost.localdomain>
User-Agent: Mutt/1.5.11+cvs20060126

Hi.  Back in August I sent out some patches for the aoe driver, and
Alan objected to the direct setting of skb->len in one of them.  I
asked whether he was suggesting that we use something like this
instead of setting skb->len:

	skb->data_len = 0;
	skb_trim(skb, 0);
	skb_put(skb, sizeof *h + sizeof *ah + DEFAULTBCNT);

... and Alan said that was acceptible because it takes care of
skb->tail, checks for overflow, and is more future proof.

So I took some time to implement the necessary changes, but then it
became apparent that there was a problem.

The skb_trim and skb_put macros are only for non-linear skbuffs, but
we are only using the area inside the skbuff itself for packet
headers, not data.

When we do something like this:

	if (bio_data_dir(buf->bio) == WRITE) {
		skb_fill_page_desc(skb, 0, bv->bv_page, buf->bv_off, bcnt);
		ah.aflags |= AOEAFL_WRITE;
		skb->len += bcnt;
		skb->data_len = bcnt;
		t->wpkts++;

... skb->tail isn't really relevant, because we are only using the
pre-allocated part of the skbuff for headers, and the headers aren't
expanding here.  Other parts of the kernel that aren't putting data in
the skbuff itself set the skb->len directly.

  e1000_main.c
  ip_output.c
  tcp.c
  ip6_output.c

So is it correct for the callers of skb_fill_page_desc to set skb->len
or is another interface needed besides skb_put/skb_trim?  Such a new
interface would be able to maintain the consistency of the skbuff
fields without assuming that the data is in the skbuff itself.

If a new interface is needed, then it seems like we should set
skb->len in this patch until the new interface is ready.

-- 
  Ed L Cashin <ecashin@coraid.com>

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

end of thread, other threads:[~2006-09-14 20:07 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E1GE8K3-0008Jn-00@kokone.coraid.com>
2006-08-18 17:38 ` [PATCH 2.6.18-rc4] aoe [02/13]: update copyright date Ed L. Cashin
2006-08-18 22:54   ` Alan Cox
2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [03/13]: remove unused NARGS enum Ed L. Cashin
2006-08-18 22:54   ` Alan Cox
2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [04/13]: zero copy write 1 of 2 Ed L. Cashin
2006-08-19 10:18   ` Alan Cox
2006-08-22 21:21     ` Ed L. Cashin
2006-08-23 15:03       ` Alan Cox
2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [05/13]: jumbo frame support " Ed L. Cashin
2006-08-18 22:56   ` Alan Cox
2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [06/13]: clean up printks via macros Ed L. Cashin
2006-08-18 19:29   ` Arnd Bergmann
2006-08-18 22:23     ` Ed L. Cashin
2006-08-18 22:57   ` Alan Cox
2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [07/13]: jumbo frame support 2 of 2 Ed L. Cashin
2006-08-18 22:58   ` Alan Cox
2006-08-18 23:04     ` Ed L. Cashin
2006-08-19  0:08       ` Alan Cox
2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [08/13]: improve retransmission heuristics Ed L. Cashin
2006-08-18 23:02   ` Alan Cox
2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [09/13]: zero copy write 2 of 2 Ed L. Cashin
2006-08-18 17:39 ` [PATCH 2.6.18-rc4] aoe [10/13]: module parameter for device timeout Ed L. Cashin
2006-08-18 23:03   ` Alan Cox
2006-08-18 23:10     ` Ed L. Cashin
2006-08-19  0:09       ` Alan Cox
2006-08-21 22:45         ` Ed L. Cashin
2006-08-18 17:40 ` [PATCH 2.6.18-rc4] aoe [11/13]: use bio->bi_idx Ed L. Cashin
2006-08-18 17:40 ` [PATCH 2.6.18-rc4] aoe [12/13]: remove sysfs comment Ed L. Cashin
2006-08-18 17:40 ` [PATCH 2.6.18-rc4] aoe [13/13]: update driver version Ed L. Cashin
2006-09-14 19:50 [PATCH 2.6.18-rc4] aoe [04/13]: zero copy write 1 of 2 Ed L. Cashin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).