aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/netdevice.h3
-rw-r--r--net/8021q/vlan_core.c39
-rw-r--r--net/core/dev.c76
3 files changed, 59 insertions, 59 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index dd8a35b3e8b2..20419508eec1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1375,12 +1375,15 @@ extern int netif_receive_skb(struct sk_buff *skb);
1375extern void napi_gro_flush(struct napi_struct *napi); 1375extern void napi_gro_flush(struct napi_struct *napi);
1376extern int dev_gro_receive(struct napi_struct *napi, 1376extern int dev_gro_receive(struct napi_struct *napi,
1377 struct sk_buff *skb); 1377 struct sk_buff *skb);
1378extern int napi_skb_finish(int ret, struct sk_buff *skb);
1378extern int napi_gro_receive(struct napi_struct *napi, 1379extern int napi_gro_receive(struct napi_struct *napi,
1379 struct sk_buff *skb); 1380 struct sk_buff *skb);
1380extern void napi_reuse_skb(struct napi_struct *napi, 1381extern void napi_reuse_skb(struct napi_struct *napi,
1381 struct sk_buff *skb); 1382 struct sk_buff *skb);
1382extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi, 1383extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi,
1383 struct napi_gro_fraginfo *info); 1384 struct napi_gro_fraginfo *info);
1385extern int napi_frags_finish(struct napi_struct *napi,
1386 struct sk_buff *skb, int ret);
1384extern int napi_gro_frags(struct napi_struct *napi, 1387extern int napi_gro_frags(struct napi_struct *napi,
1385 struct napi_gro_fraginfo *info); 1388 struct napi_gro_fraginfo *info);
1386extern void netif_nit_deliver(struct sk_buff *skb); 1389extern void netif_nit_deliver(struct sk_buff *skb);
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index e9db889d6222..2eb057a74654 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -98,22 +98,7 @@ drop:
98int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, 98int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
99 unsigned int vlan_tci, struct sk_buff *skb) 99 unsigned int vlan_tci, struct sk_buff *skb)
100{ 100{
101 int err = NET_RX_SUCCESS; 101 return napi_skb_finish(vlan_gro_common(napi, grp, vlan_tci, skb), skb);
102
103 switch (vlan_gro_common(napi, grp, vlan_tci, skb)) {
104 case -1:
105 return netif_receive_skb(skb);
106
107 case 2:
108 err = NET_RX_DROP;
109 /* fall through */
110
111 case 1:
112 kfree_skb(skb);
113 break;
114 }
115
116 return err;
117} 102}
118EXPORT_SYMBOL(vlan_gro_receive); 103EXPORT_SYMBOL(vlan_gro_receive);
119 104
@@ -121,27 +106,11 @@ int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
121 unsigned int vlan_tci, struct napi_gro_fraginfo *info) 106 unsigned int vlan_tci, struct napi_gro_fraginfo *info)
122{ 107{
123 struct sk_buff *skb = napi_fraginfo_skb(napi, info); 108 struct sk_buff *skb = napi_fraginfo_skb(napi, info);
124 int err = NET_RX_DROP;
125 109
126 if (!skb) 110 if (!skb)
127 goto out; 111 return NET_RX_DROP;
128
129 err = NET_RX_SUCCESS;
130
131 switch (vlan_gro_common(napi, grp, vlan_tci, skb)) {
132 case -1:
133 return netif_receive_skb(skb);
134
135 case 2:
136 err = NET_RX_DROP;
137 /* fall through */
138
139 case 1:
140 napi_reuse_skb(napi, skb);
141 break;
142 }
143 112
144out: 113 return napi_frags_finish(napi, skb,
145 return err; 114 vlan_gro_common(napi, grp, vlan_tci, skb));
146} 115}
147EXPORT_SYMBOL(vlan_gro_frags); 116EXPORT_SYMBOL(vlan_gro_frags);
diff --git a/net/core/dev.c b/net/core/dev.c
index e61b95c11fc0..cd23ae15a1d5 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -135,6 +135,14 @@
135/* This should be increased if a protocol with a bigger head is added. */ 135/* This should be increased if a protocol with a bigger head is added. */
136#define GRO_MAX_HEAD (MAX_HEADER + 128) 136#define GRO_MAX_HEAD (MAX_HEADER + 128)
137 137
138enum {
139 GRO_MERGED,
140 GRO_MERGED_FREE,
141 GRO_HELD,
142 GRO_NORMAL,
143 GRO_DROP,
144};
145
138/* 146/*
139 * The list of packet types we will receive (as opposed to discard) 147 * The list of packet types we will receive (as opposed to discard)
140 * and the routines to invoke. 148 * and the routines to invoke.
@@ -2369,7 +2377,7 @@ int dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2369 int count = 0; 2377 int count = 0;
2370 int same_flow; 2378 int same_flow;
2371 int mac_len; 2379 int mac_len;
2372 int free; 2380 int ret;
2373 2381
2374 if (!(skb->dev->features & NETIF_F_GRO)) 2382 if (!(skb->dev->features & NETIF_F_GRO))
2375 goto normal; 2383 goto normal;
@@ -2412,7 +2420,7 @@ int dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2412 goto normal; 2420 goto normal;
2413 2421
2414 same_flow = NAPI_GRO_CB(skb)->same_flow; 2422 same_flow = NAPI_GRO_CB(skb)->same_flow;
2415 free = NAPI_GRO_CB(skb)->free; 2423 ret = NAPI_GRO_CB(skb)->free ? GRO_MERGED_FREE : GRO_MERGED;
2416 2424
2417 if (pp) { 2425 if (pp) {
2418 struct sk_buff *nskb = *pp; 2426 struct sk_buff *nskb = *pp;
@@ -2435,12 +2443,13 @@ int dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2435 skb_shinfo(skb)->gso_size = skb->len; 2443 skb_shinfo(skb)->gso_size = skb->len;
2436 skb->next = napi->gro_list; 2444 skb->next = napi->gro_list;
2437 napi->gro_list = skb; 2445 napi->gro_list = skb;
2446 ret = GRO_HELD;
2438 2447
2439ok: 2448ok:
2440 return free; 2449 return ret;
2441 2450
2442normal: 2451normal:
2443 return -1; 2452 return GRO_NORMAL;
2444} 2453}
2445EXPORT_SYMBOL(dev_gro_receive); 2454EXPORT_SYMBOL(dev_gro_receive);
2446 2455
@@ -2456,18 +2465,30 @@ static int __napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2456 return dev_gro_receive(napi, skb); 2465 return dev_gro_receive(napi, skb);
2457} 2466}
2458 2467
2459int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) 2468int napi_skb_finish(int ret, struct sk_buff *skb)
2460{ 2469{
2461 switch (__napi_gro_receive(napi, skb)) { 2470 int err = NET_RX_SUCCESS;
2462 case -1: 2471
2472 switch (ret) {
2473 case GRO_NORMAL:
2463 return netif_receive_skb(skb); 2474 return netif_receive_skb(skb);
2464 2475
2465 case 1: 2476 case GRO_DROP:
2477 err = NET_RX_DROP;
2478 /* fall through */
2479
2480 case GRO_MERGED_FREE:
2466 kfree_skb(skb); 2481 kfree_skb(skb);
2467 break; 2482 break;
2468 } 2483 }
2469 2484
2470 return NET_RX_SUCCESS; 2485 return err;
2486}
2487EXPORT_SYMBOL(napi_skb_finish);
2488
2489int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2490{
2491 return napi_skb_finish(__napi_gro_receive(napi, skb), skb);
2471} 2492}
2472EXPORT_SYMBOL(napi_gro_receive); 2493EXPORT_SYMBOL(napi_gro_receive);
2473 2494
@@ -2520,29 +2541,36 @@ out:
2520} 2541}
2521EXPORT_SYMBOL(napi_fraginfo_skb); 2542EXPORT_SYMBOL(napi_fraginfo_skb);
2522 2543
2523int napi_gro_frags(struct napi_struct *napi, struct napi_gro_fraginfo *info) 2544int napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb, int ret)
2524{ 2545{
2525 struct sk_buff *skb = napi_fraginfo_skb(napi, info); 2546 int err = NET_RX_SUCCESS;
2526 int err = NET_RX_DROP;
2527
2528 if (!skb)
2529 goto out;
2530 2547
2531 err = NET_RX_SUCCESS; 2548 switch (ret) {
2532 2549 case GRO_NORMAL:
2533 switch (__napi_gro_receive(napi, skb)) {
2534 case -1:
2535 return netif_receive_skb(skb); 2550 return netif_receive_skb(skb);
2536 2551
2537 case 0: 2552 case GRO_DROP:
2538 goto out; 2553 err = NET_RX_DROP;
2539 } 2554 /* fall through */
2540 2555
2541 napi_reuse_skb(napi, skb); 2556 case GRO_MERGED_FREE:
2557 napi_reuse_skb(napi, skb);
2558 break;
2559 }
2542 2560
2543out:
2544 return err; 2561 return err;
2545} 2562}
2563EXPORT_SYMBOL(napi_frags_finish);
2564
2565int napi_gro_frags(struct napi_struct *napi, struct napi_gro_fraginfo *info)
2566{
2567 struct sk_buff *skb = napi_fraginfo_skb(napi, info);
2568
2569 if (!skb)
2570 return NET_RX_DROP;
2571
2572 return napi_frags_finish(napi, skb, __napi_gro_receive(napi, skb));
2573}
2546EXPORT_SYMBOL(napi_gro_frags); 2574EXPORT_SYMBOL(napi_gro_frags);
2547 2575
2548static int process_backlog(struct napi_struct *napi, int quota) 2576static int process_backlog(struct napi_struct *napi, int quota)