WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] netfront: use skb.cb for storing private

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] netfront: use skb.cb for storing private data
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Apr 2007 07:30:26 -0700
Delivery-date: Wed, 18 Apr 2007 14:35:12 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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 <=