[<prev] [next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.63.0607182221170.27600@chino.corp.google.com>
Date: Tue, 18 Jul 2006 22:28:51 -0700 (PDT)
From: dave rientjes <rientjes@...gle.com>
To: linux-kernel@...r.kernel.org
cc: christophe@...gle.com
Subject: [PATCH] net1080 inherent pad length
For your consideration in 2.6.18-rc2.
The size of struct nc_trailer is inherently the newtailroom pad.
David
Signed-off-by: David Rientjes <rientjes@...gle.com>
diff -ru a/drivers/usb/net/net1080.c b/drivers/usb/net/net1080.c
--- a/drivers/usb/net/net1080.c 2006-07-18 22:19:59.396393000 -0700
+++ b/drivers/usb/net/net1080.c 2006-07-18 22:19:47.772577000 -0700
@@ -498,25 +498,24 @@
static struct sk_buff *
net1080_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
{
- int padlen;
struct sk_buff *skb2;
struct nc_header *header = NULL;
struct nc_trailer *trailer = NULL;
+ int padlen = sizeof (struct nc_trailer);
int len = skb->len;
- padlen = ((len + sizeof (struct nc_header)
- + sizeof (struct nc_trailer)) & 0x01) ? 0 : 1;
+ if (!((len + padlen + sizeof (struct nc_header)) & 0x01))
+ padlen++;
if (!skb_cloned(skb)) {
int headroom = skb_headroom(skb);
int tailroom = skb_tailroom(skb);
- if ((padlen + sizeof (struct nc_trailer)) <= tailroom
- && sizeof (struct nc_header) <= headroom)
+ if (padlen <= tailroom && sizeof (struct nc_header) <=
+ headroom)
/* There's enough head and tail room */
goto encapsulate;
- if ((sizeof (struct nc_header) + padlen
- + sizeof (struct nc_trailer)) <
+ if ((sizeof (struct nc_header) + padlen) <
(headroom + tailroom)) {
/* There's enough total room, so just readjust */
skb->data = memmove(skb->head
@@ -530,7 +529,7 @@
/* Create a new skb to use with the correct size */
skb2 = skb_copy_expand(skb,
sizeof (struct nc_header),
- sizeof (struct nc_trailer) + padlen,
+ padlen,
flags);
dev_kfree_skb_any(skb);
if (!skb2)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists