Skip to contentSkip to conversation

aoe [1/3]: explicitly set minimum packet length to ETH_ZLEN

PATCH In review Ed L. Cashin 3 participants 7 messages Sep 29, 2005 – Sep 30, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 aoe [1/3]: explicitly set minimum packet length to ETH_ZLEN

Explicitly set the minimum packet length to ETH_ZLEN and zero the packet data.

drivers/block/aoe/aoecmd.c +4 -0
diff -u 2.6.14-rc2-aoe/drivers/block/aoe/aoecmd.c 2.6.14-rc2-aoe/drivers/block/aoe/aoecmd.c
@@ -20,6 +20,9 @@
 {
 	struct sk_buff *skb;
 
+	if (len < ETH_ZLEN)
+		len = ETH_ZLEN;
+
 	skb = alloc_skb(len, GFP_ATOMIC);
 	if (skb) {
 		skb->nh.raw = skb->mac.raw = skb->data;
@@ -27,6 +30,7 @@
 		skb->protocol = __constant_htons(ETH_P_AOE);
 		skb->priority = 0;
 		skb_put(skb, len);
+		memset(skb->head, 0, len);
 		skb->next = skb->prev = NULL;
 
 		/* tell the network layer not to perform IP checksums
Signature · 1 line
  Ed L. Cashin <[email protected]>
#1 lore raw

PATCH 1/1 aoe [2/3]: use get_unaligned for accesses in ATA id buffer

Use get_unaligned for possibly-unaligned multi-byte accesses to the ATA device identify response buffer.

drivers/block/aoe/aoecmd.c +8 -7
Index: 2.6.14-rc2-aoe/drivers/block/aoe/aoecmd.c
===================================================================
@@ -8,6 +8,7 @@
 #include <linux/blkdev.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
+#include <asm/unaligned.h>
 #include "aoe.h"
 
 #define TIMERTICK (HZ / 10)
@@ -315,16 +316,16 @@
 	u16 n;
 
 	/* word 83: command set supported */
-	n = le16_to_cpup((__le16 *) &id[83<<1]);
+	n = le16_to_cpu(get_unaligned((__le16 *) &id[83<<1]));
 
 	/* word 86: command set/feature enabled */
-	n |= le16_to_cpup((__le16 *) &id[86<<1]);
+	n |= le16_to_cpu(get_unaligned((__le16 *) &id[86<<1]));
 
 	if (n & (1<<10)) {	/* bit 10: LBA 48 */
 		d->flags |= DEVFL_EXT;
 
 		/* word 100: number lba48 sectors */
-		ssize = le64_to_cpup((__le64 *) &id[100<<1]);
+		ssize = le64_to_cpu(get_unaligned((__le64 *) &id[100<<1]));
 
 		/* set as in ide-disk.c:init_idedisk_capacity */
 		d->geo.cylinders = ssize;
@@ -335,12 +336,12 @@
 		d->flags &= ~DEVFL_EXT;
 
 		/* number lba28 sectors */
-		ssize = le32_to_cpup((__le32 *) &id[60<<1]);
+		ssize = le32_to_cpu(get_unaligned((__le32 *) &id[60<<1]));
 
 		/* NOTE: obsolete in ATA 6 */
-		d->geo.cylinders = le16_to_cpup((__le16 *) &id[54<<1]);
-		d->geo.heads = le16_to_cpup((__le16 *) &id[55<<1]);
-		d->geo.sectors = le16_to_cpup((__le16 *) &id[56<<1]);
+		d->geo.cylinders = le16_to_cpu(get_unaligned((__le16 *) &id[54<<1]));
+		d->geo.heads = le16_to_cpu(get_unaligned((__le16 *) &id[55<<1]));
+		d->geo.sectors = le16_to_cpu(get_unaligned((__le16 *) &id[56<<1]));
 	}
 	d->ssize = ssize;
 	d->geo.start = 0;
Signature · 1 line
  Ed L. Cashin <[email protected]>
#2 lore raw

PATCH 1/1 aoe [3/3]: update to version 14

In reply to Ed L. Cashin

Update driver version number to 14.

drivers/block/aoe/aoe.h +1 -1
Index: 2.6.14-rc2-aoe/drivers/block/aoe/aoe.h
===================================================================
@@ -1,5 +1,5 @@
 /* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
-#define VERSION "12"
+#define VERSION "14"
 #define AOE_MAJOR 152
 #define DEVICE_NAME "aoe"
 
Signature · 1 line
  Ed L. Cashin <[email protected]>
#4 lore raw
Quoted 8 lines · Alan Cox
Quoted 4 lines · Ed L. Cashin

Explicitly set the minimum packet length to ETH_ZLEN and zero the packet data.

You still haven't explained why this is neccessary. The drivers should be doing it for you.

I did respond to your earlier request post, but I forgot to make sure you were in the CC list, sorry. I've quoted my response below.

Quoted 1 line · Ed L Cashin

Alan Cox <[email protected]> writes:

...

Quoted 12 lines
Quoted 2 lines

The network driver is supposed to pad frames if the hardware cannot and to blank the spare bits.

Ah ha.

Quoted 2 lines

If it isn't occurring please try and trace down
the offender.

My colleague Sam observed problems with the e1000 driver in the 2.6.11.4-21.9-smp kernel from Suse 9.3 and also the e1000 driver in 2.6.12-1.1398_FC4smp from Fedora Core 4.

Quoted 6 lines

The problems aren't fully characterized, but AoE ATA read packets appeared to be getting dropped and/or corrupted.

When using the tg3 driver instead of e1000 the problems went away, and making the aoe driver alloc_skb with a minimum length of ETH_ZLEN also made the problems go away.

We suspect that the e1000 driver is misbehaving when given short packets, but we have not had time to pinpoint what part of the e1000 driver is involved or what the specific problem is.

Signature · 1 line
  Ed L Cashin <[email protected]>
#5 lore raw

From: Ed L Cashin <[email protected]>
Date: Thu, 29 Sep 2005 18:31:02 -0400

Quoted 3 lines

We suspect that the e1000 driver is misbehaving when given short packets, but we have not had time to pinpoint what part of the e1000 driver is involved or what the specific problem is.

Then the e1000 driver is where the fix belongs, not the aoe driver.

#6 lore raw
Quoted 9 lines · David S. Miller

From: Ed L Cashin <[email protected]>
Date: Thu, 29 Sep 2005 18:31:02 -0400

Quoted 3 lines

We suspect that the e1000 driver is misbehaving when given short packets, but we have not had time to pinpoint what part of the e1000 driver is involved or what the specific problem is.

Then the e1000 driver is where the fix belongs, not the aoe driver.

OK, then I guess this one of the three patches can be dropped.

Signature · 1 line
  Ed L Cashin <[email protected]>