提交 804cf14e 编写于 作者: I Ian Campbell 提交者: David S. Miller

net: xfrm: convert to SKB frag APIs

Signed-off-by: NIan Campbell <ian.campbell@citrix.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 408dadf0
...@@ -70,26 +70,29 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) ...@@ -70,26 +70,29 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb)
while ((scratch += len, dlen -= len) > 0) { while ((scratch += len, dlen -= len) > 0) {
skb_frag_t *frag; skb_frag_t *frag;
struct page *page;
err = -EMSGSIZE; err = -EMSGSIZE;
if (WARN_ON(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) if (WARN_ON(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS))
goto out; goto out;
frag = skb_shinfo(skb)->frags + skb_shinfo(skb)->nr_frags; frag = skb_shinfo(skb)->frags + skb_shinfo(skb)->nr_frags;
frag->page = alloc_page(GFP_ATOMIC); page = alloc_page(GFP_ATOMIC);
err = -ENOMEM; err = -ENOMEM;
if (!frag->page) if (!page)
goto out; goto out;
__skb_frag_set_page(frag, page);
len = PAGE_SIZE; len = PAGE_SIZE;
if (dlen < len) if (dlen < len)
len = dlen; len = dlen;
memcpy(page_address(frag->page), scratch, len);
frag->page_offset = 0; frag->page_offset = 0;
frag->size = len; frag->size = len;
memcpy(skb_frag_address(frag), scratch, len);
skb->truesize += len; skb->truesize += len;
skb->data_len += len; skb->data_len += len;
skb->len += len; skb->len += len;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册