* [PATCH (resubmit)]: fix lro_gen_skb() alignment
@ 2007-12-04 19:55 Andrew Gallatin
2007-12-05 10:32 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Gallatin @ 2007-12-04 19:55 UTC (permalink / raw)
To: David Miller; +Cc: Jan-Bernd Themann, netdev
[-- Attachment #1: Type: text/plain, Size: 429 bytes --]
Add a field to the lro_mgr struct so that drivers can specify how much
padding is required to align layer 3 headers when a packet is copied
into a freshly allocated skb by inet_lro.c:lro_gen_skb(). Without
padding, skbs generated by LRO will cause alignment warnings on
architectures which require strict alignment (seen on sparc64).
Myri10GE is updated to use this field.
Signed off by: Andrew Gallatin <gallatin@myri.com>
[-- Attachment #2: lro_align.diff --]
[-- Type: text/plain, Size: 1566 bytes --]
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 0f306dd..8def865 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1979,6 +1979,7 @@ static int myri10ge_open(struct net_devi
lro_mgr->lro_arr = mgp->rx_done.lro_desc;
lro_mgr->get_frag_header = myri10ge_get_frag_header;
lro_mgr->max_aggr = myri10ge_lro_max_pkts;
+ lro_mgr->frag_align_pad = 2;
if (lro_mgr->max_aggr > MAX_SKB_FRAGS)
lro_mgr->max_aggr = MAX_SKB_FRAGS;
diff --git a/include/linux/inet_lro.h b/include/linux/inet_lro.h
index 1246d46..80335b7 100644
--- a/include/linux/inet_lro.h
+++ b/include/linux/inet_lro.h
@@ -91,6 +91,9 @@ #define LRO_F_EXTRACT_VLAN_ID 2 /* Set
int max_desc; /* Max number of LRO descriptors */
int max_aggr; /* Max number of LRO packets to be aggregated */
+ int frag_align_pad; /* Padding required to properly align layer 3
+ * headers in generated skb when using frags */
+
struct net_lro_desc *lro_arr; /* Array of LRO descriptors */
/*
diff --git a/net/ipv4/inet_lro.c b/net/ipv4/inet_lro.c
index ac3b1d3..9a96c27 100644
--- a/net/ipv4/inet_lro.c
+++ b/net/ipv4/inet_lro.c
@@ -401,10 +401,11 @@ static struct sk_buff *lro_gen_skb(struc
int data_len = len;
int hdr_len = min(len, hlen);
- skb = netdev_alloc_skb(lro_mgr->dev, hlen);
+ skb = netdev_alloc_skb(lro_mgr->dev, hlen + lro_mgr->frag_align_pad);
if (!skb)
return NULL;
+ skb_reserve(skb, lro_mgr->frag_align_pad);
skb->len = len;
skb->data_len = len - hdr_len;
skb->truesize += true_size;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH (resubmit)]: fix lro_gen_skb() alignment
2007-12-04 19:55 [PATCH (resubmit)]: fix lro_gen_skb() alignment Andrew Gallatin
@ 2007-12-05 10:32 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2007-12-05 10:32 UTC (permalink / raw)
To: gallatin; +Cc: ossthema, netdev
From: Andrew Gallatin <gallatin@myri.com>
Date: Tue, 04 Dec 2007 14:55:06 -0500
>
> Add a field to the lro_mgr struct so that drivers can specify how much
> padding is required to align layer 3 headers when a packet is copied
> into a freshly allocated skb by inet_lro.c:lro_gen_skb(). Without
> padding, skbs generated by LRO will cause alignment warnings on
> architectures which require strict alignment (seen on sparc64).
>
> Myri10GE is updated to use this field.
>
> Signed off by: Andrew Gallatin <gallatin@myri.com>
Applied, thanks Andrew.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-12-05 10:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-04 19:55 [PATCH (resubmit)]: fix lro_gen_skb() alignment Andrew Gallatin
2007-12-05 10:32 ` David Miller
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.