aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/netdevice.h3
-rw-r--r--net/core/dev.c12
2 files changed, 10 insertions, 5 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 864519e585fc..9ee344bc6c13 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -314,6 +314,9 @@ struct napi_struct {
314 spinlock_t poll_lock; 314 spinlock_t poll_lock;
315 int poll_owner; 315 int poll_owner;
316#endif 316#endif
317
318 unsigned int gro_count;
319
317 struct net_device *dev; 320 struct net_device *dev;
318 struct list_head dev_list; 321 struct list_head dev_list;
319 struct sk_buff *gro_list; 322 struct sk_buff *gro_list;
diff --git a/net/core/dev.c b/net/core/dev.c
index 709a9a922258..ae0b66936abe 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2372,6 +2372,7 @@ void napi_gro_flush(struct napi_struct *napi)
2372 napi_gro_complete(skb); 2372 napi_gro_complete(skb);
2373 } 2373 }
2374 2374
2375 napi->gro_count = 0;
2375 napi->gro_list = NULL; 2376 napi->gro_list = NULL;
2376} 2377}
2377EXPORT_SYMBOL(napi_gro_flush); 2378EXPORT_SYMBOL(napi_gro_flush);
@@ -2402,7 +2403,6 @@ int dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2402 struct packet_type *ptype; 2403 struct packet_type *ptype;
2403 __be16 type = skb->protocol; 2404 __be16 type = skb->protocol;
2404 struct list_head *head = &ptype_base[ntohs(type) & PTYPE_HASH_MASK]; 2405 struct list_head *head = &ptype_base[ntohs(type) & PTYPE_HASH_MASK];
2405 int count = 0;
2406 int same_flow; 2406 int same_flow;
2407 int mac_len; 2407 int mac_len;
2408 int ret; 2408 int ret;
@@ -2430,8 +2430,6 @@ int dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2430 NAPI_GRO_CB(skb)->free = 0; 2430 NAPI_GRO_CB(skb)->free = 0;
2431 2431
2432 for (p = napi->gro_list; p; p = p->next) { 2432 for (p = napi->gro_list; p; p = p->next) {
2433 count++;
2434
2435 if (!NAPI_GRO_CB(p)->same_flow) 2433 if (!NAPI_GRO_CB(p)->same_flow)
2436 continue; 2434 continue;
2437 2435
@@ -2457,15 +2455,16 @@ int dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2457 *pp = nskb->next; 2455 *pp = nskb->next;
2458 nskb->next = NULL; 2456 nskb->next = NULL;
2459 napi_gro_complete(nskb); 2457 napi_gro_complete(nskb);
2460 count--; 2458 napi->gro_count--;
2461 } 2459 }
2462 2460
2463 if (same_flow) 2461 if (same_flow)
2464 goto ok; 2462 goto ok;
2465 2463
2466 if (NAPI_GRO_CB(skb)->flush || count >= MAX_GRO_SKBS) 2464 if (NAPI_GRO_CB(skb)->flush || napi->gro_count >= MAX_GRO_SKBS)
2467 goto normal; 2465 goto normal;
2468 2466
2467 napi->gro_count++;
2469 NAPI_GRO_CB(skb)->count = 1; 2468 NAPI_GRO_CB(skb)->count = 1;
2470 skb_shinfo(skb)->gso_size = skb_gro_len(skb); 2469 skb_shinfo(skb)->gso_size = skb_gro_len(skb);
2471 skb->next = napi->gro_list; 2470 skb->next = napi->gro_list;
@@ -2713,6 +2712,7 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
2713 int (*poll)(struct napi_struct *, int), int weight) 2712 int (*poll)(struct napi_struct *, int), int weight)
2714{ 2713{
2715 INIT_LIST_HEAD(&napi->poll_list); 2714 INIT_LIST_HEAD(&napi->poll_list);
2715 napi->gro_count = 0;
2716 napi->gro_list = NULL; 2716 napi->gro_list = NULL;
2717 napi->skb = NULL; 2717 napi->skb = NULL;
2718 napi->poll = poll; 2718 napi->poll = poll;
@@ -2741,6 +2741,7 @@ void netif_napi_del(struct napi_struct *napi)
2741 } 2741 }
2742 2742
2743 napi->gro_list = NULL; 2743 napi->gro_list = NULL;
2744 napi->gro_count = 0;
2744} 2745}
2745EXPORT_SYMBOL(netif_napi_del); 2746EXPORT_SYMBOL(netif_napi_del);
2746 2747
@@ -5246,6 +5247,7 @@ static int __init net_dev_init(void)
5246 queue->backlog.poll = process_backlog; 5247 queue->backlog.poll = process_backlog;
5247 queue->backlog.weight = weight_p; 5248 queue->backlog.weight = weight_p;
5248 queue->backlog.gro_list = NULL; 5249 queue->backlog.gro_list = NULL;
5250 queue->backlog.gro_count = 0;
5249 } 5251 }
5250 5252
5251 dev_boot_phase = 0; 5253 dev_boot_phase = 0;