|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] [xen-unstable] netfront: use skb.cb for storing private
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1176812482 -3600
# Node ID 9cf4c575b50935e4c4fd3e42dfa8c7a468bf29fb
# Parent 7b391c27f410d429028ce56db0b37824020821e3
netfront: use skb.cb for storing private data
Netfront's use of nh.raw and h.raw for storing page+offset is a bit
hinky, and it breaks with upcoming network stack updates which reduce
these fields to sub-pointer sizes. Fortunately, skb offers the "cb"
field specifically for stashing this kind of info, so use it.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xxxxxxxxxxxxx>
Cc: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Cc: Chris Wright <chrisw@xxxxxxxxxxxx>
Cc: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
---
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff -r 7b391c27f410 -r 9cf4c575b509
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Tue Apr 17
12:21:33 2007 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Tue Apr 17
13:21:22 2007 +0100
@@ -67,6 +67,13 @@
#include <xen/platform-compat.h>
#endif
+struct netfront_cb {
+ struct page *page;
+ unsigned offset;
+};
+
+#define NETFRONT_SKB_CB(skb) ((struct netfront_cb *)((skb)->cb))
+
/*
* Mutually-exclusive module options to select receive data path:
* rx_copy : Packets are copied by network backend into local memory
@@ -1354,8 +1361,8 @@ err:
}
}
- skb->nh.raw = (void *)skb_shinfo(skb)->frags[0].page;
- skb->h.raw = skb->nh.raw + rx->offset;
+ NETFRONT_SKB_CB(skb)->page = skb_shinfo(skb)->frags[0].page;
+ NETFRONT_SKB_CB(skb)->offset = rx->offset;
len = rx->status;
if (len > RX_COPY_THRESHOLD)
@@ -1439,11 +1446,11 @@ err:
kfree_skb(skb);
while ((skb = __skb_dequeue(&rxq)) != NULL) {
- struct page *page = (struct page *)skb->nh.raw;
+ struct page *page = NETFRONT_SKB_CB(skb)->page;
void *vaddr = page_address(page);
-
- memcpy(skb->data, vaddr + (skb->h.raw - skb->nh.raw),
- skb_headlen(skb));
+ unsigned offset = NETFRONT_SKB_CB(skb)->offset;
+
+ memcpy(skb->data, vaddr + offset, skb_headlen(skb));
if (page != skb_shinfo(skb)->frags[0].page)
__free_page(page);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-changelog] [xen-unstable] netfront: use skb.cb for storing private data,
Xen patchbot-unstable <=
|
|
|
|
|