Commit a8605c60 authored by Ian Campbell's avatar Ian Campbell Committed by David S. Miller

net: add opaque struct around skb frag page

I've split this bit out of the skb frag destructor patch since it helps enforce
the use of the fragment API.
Signed-off-by: default avatarIan Campbell <ian.campbell@citrix.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6a39a16a
...@@ -140,7 +140,9 @@ struct sk_buff; ...@@ -140,7 +140,9 @@ struct sk_buff;
typedef struct skb_frag_struct skb_frag_t; typedef struct skb_frag_struct skb_frag_t;
struct skb_frag_struct { struct skb_frag_struct {
struct page *page; struct {
struct page *p;
} page;
#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536) #if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
__u32 page_offset; __u32 page_offset;
__u32 size; __u32 size;
...@@ -1175,7 +1177,7 @@ static inline void __skb_fill_page_desc(struct sk_buff *skb, int i, ...@@ -1175,7 +1177,7 @@ static inline void __skb_fill_page_desc(struct sk_buff *skb, int i,
{ {
skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
frag->page = page; frag->page.p = page;
frag->page_offset = off; frag->page_offset = off;
skb_frag_size_set(frag, size); skb_frag_size_set(frag, size);
} }
...@@ -1699,7 +1701,7 @@ static inline void netdev_free_page(struct net_device *dev, struct page *page) ...@@ -1699,7 +1701,7 @@ static inline void netdev_free_page(struct net_device *dev, struct page *page)
*/ */
static inline struct page *skb_frag_page(const skb_frag_t *frag) static inline struct page *skb_frag_page(const skb_frag_t *frag)
{ {
return frag->page; return frag->page.p;
} }
/** /**
...@@ -1785,7 +1787,7 @@ static inline void *skb_frag_address_safe(const skb_frag_t *frag) ...@@ -1785,7 +1787,7 @@ static inline void *skb_frag_address_safe(const skb_frag_t *frag)
*/ */
static inline void __skb_frag_set_page(skb_frag_t *frag, struct page *page) static inline void __skb_frag_set_page(skb_frag_t *frag, struct page *page)
{ {
frag->page = page; frag->page.p = page;
} }
/** /**
......
...@@ -668,14 +668,14 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask) ...@@ -668,14 +668,14 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask)
/* skb frags release userspace buffers */ /* skb frags release userspace buffers */
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
put_page(skb_shinfo(skb)->frags[i].page); skb_frag_unref(skb, i);
uarg->callback(uarg); uarg->callback(uarg);
/* skb frags point to kernel buffers */ /* skb frags point to kernel buffers */
for (i = skb_shinfo(skb)->nr_frags; i > 0; i--) { for (i = skb_shinfo(skb)->nr_frags; i > 0; i--) {
skb_shinfo(skb)->frags[i - 1].page_offset = 0; __skb_fill_page_desc(skb, i-1, head, 0,
skb_shinfo(skb)->frags[i - 1].page = head; skb_shinfo(skb)->frags[i - 1].size);
head = (struct page *)head->private; head = (struct page *)head->private;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment