diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2008-10-07 14:22:33 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-07 14:22:33 -0700 |
commit | 654bed16cf86a9ef94495d9e6131b7ff7840a3dd (patch) | |
tree | 7d64fdb8de3e893b1acf5f420890a503a4e0327f /net/core/skbuff.c | |
parent | c57943a1c96214ee68f3890bb6772841ffbfd606 (diff) | |
download | op-kernel-dev-654bed16cf86a9ef94495d9e6131b7ff7840a3dd.zip op-kernel-dev-654bed16cf86a9ef94495d9e6131b7ff7840a3dd.tar.gz |
net: packet split receive api
Add some packet-split receive hooks.
For one this allows to do NUMA node affine page allocs. Later on these
hooks will be extended to do emergency reserve allocations for
fragments.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/skbuff.c')
-rw-r--r-- | net/core/skbuff.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 8bd248a..7f7bb1a 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -263,6 +263,26 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, return skb; } +struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask) +{ + int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1; + struct page *page; + + page = alloc_pages_node(node, gfp_mask, 0); + return page; +} +EXPORT_SYMBOL(__netdev_alloc_page); + +void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, + int size) +{ + skb_fill_page_desc(skb, i, page, off, size); + skb->len += size; + skb->data_len += size; + skb->truesize += size; +} +EXPORT_SYMBOL(skb_add_rx_frag); + /** * dev_alloc_skb - allocate an skbuff for receiving * @length: length to allocate |