aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-01-04 19:13:40 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-04 19:13:40 -0500
commit5d38a079ce3971f932bbdc0dc5b887806fabd5dc (patch)
tree79d948098add1f6c52ecd42c151ce6b6fa1dbc5a /include/linux/netdevice.h
parentb530256d2e0f1a75fab31f9821129fff1bb49faa (diff)
gro: Add page frag support
This patch allows GRO to merge page frags (skb_shinfo(skb)->frags) in one skb, rather than using the less efficient frag_list. It also adds a new interface, napi_gro_frags to allow drivers to inject page frags directly into the stack without allocating an skb. This is intended to be the GRO equivalent for LRO's lro_receive_frags interface. The existing GSO interface can already handle page frags with or without an appended frag_list so nothing needs to be changed there. The merging itself is rather simple. We store any new frag entries after the last existing entry, without checking whether the first new entry can be merged with the last existing entry. Making this check would actually be easy but since no existing driver can produce contiguous frags anyway it would just be mental masturbation. If the total number of entries would exceed the capacity of a single skb, we simply resort to using frag_list as we do now. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 41e1224651cf..c28bbba3c23d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -313,10 +313,11 @@ struct napi_struct {
313#ifdef CONFIG_NETPOLL 313#ifdef CONFIG_NETPOLL
314 spinlock_t poll_lock; 314 spinlock_t poll_lock;
315 int poll_owner; 315 int poll_owner;
316 struct net_device *dev;
317#endif 316#endif
317 struct net_device *dev;
318 struct list_head dev_list; 318 struct list_head dev_list;
319 struct sk_buff *gro_list; 319 struct sk_buff *gro_list;
320 struct sk_buff *skb;
320}; 321};
321 322
322enum 323enum
@@ -990,6 +991,9 @@ struct napi_gro_cb {
990 991
991 /* Number of segments aggregated. */ 992 /* Number of segments aggregated. */
992 int count; 993 int count;
994
995 /* Free the skb? */
996 int free;
993}; 997};
994 998
995#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) 999#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
@@ -1011,6 +1015,14 @@ struct packet_type {
1011 struct list_head list; 1015 struct list_head list;
1012}; 1016};
1013 1017
1018struct napi_gro_fraginfo {
1019 skb_frag_t frags[MAX_SKB_FRAGS];
1020 unsigned int nr_frags;
1021 unsigned int ip_summed;
1022 unsigned int len;
1023 __wsum csum;
1024};
1025
1014#include <linux/interrupt.h> 1026#include <linux/interrupt.h>
1015#include <linux/notifier.h> 1027#include <linux/notifier.h>
1016 1028
@@ -1363,6 +1375,8 @@ extern int netif_receive_skb(struct sk_buff *skb);
1363extern void napi_gro_flush(struct napi_struct *napi); 1375extern void napi_gro_flush(struct napi_struct *napi);
1364extern int napi_gro_receive(struct napi_struct *napi, 1376extern int napi_gro_receive(struct napi_struct *napi,
1365 struct sk_buff *skb); 1377 struct sk_buff *skb);
1378extern int napi_gro_frags(struct napi_struct *napi,
1379 struct napi_gro_fraginfo *info);
1366extern void netif_nit_deliver(struct sk_buff *skb); 1380extern void netif_nit_deliver(struct sk_buff *skb);
1367extern int dev_valid_name(const char *name); 1381extern int dev_valid_name(const char *name);
1368extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1382extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);