aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/netdevice.h1
-rw-r--r--net/core/dev.c10
-rw-r--r--net/ipv4/af_inet.c36
-rw-r--r--net/ipv4/gre_offload.c11
-rw-r--r--net/ipv4/tcp_offload.c6
-rw-r--r--net/ipv4/udp_offload.c6
-rw-r--r--net/ipv6/ip6_offload.c27
-rw-r--r--net/ipv6/tcpv6_offload.c6
-rw-r--r--net/ipv6/udp_offload.c6
-rw-r--r--net/mpls/mpls_gso.c7
10 files changed, 3 insertions, 113 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4354b4307e37..9f5d293a0281 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1911,7 +1911,6 @@ struct packet_type {
1911struct offload_callbacks { 1911struct offload_callbacks {
1912 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1912 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
1913 netdev_features_t features); 1913 netdev_features_t features);
1914 int (*gso_send_check)(struct sk_buff *skb);
1915 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1914 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1916 struct sk_buff *skb); 1915 struct sk_buff *skb);
1917 int (*gro_complete)(struct sk_buff *skb, int nhoff); 1916 int (*gro_complete)(struct sk_buff *skb, int nhoff);
diff --git a/net/core/dev.c b/net/core/dev.c
index db0388607329..e2ced01c01e4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2422,16 +2422,6 @@ struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
2422 rcu_read_lock(); 2422 rcu_read_lock();
2423 list_for_each_entry_rcu(ptype, &offload_base, list) { 2423 list_for_each_entry_rcu(ptype, &offload_base, list) {
2424 if (ptype->type == type && ptype->callbacks.gso_segment) { 2424 if (ptype->type == type && ptype->callbacks.gso_segment) {
2425 if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {
2426 int err;
2427
2428 err = ptype->callbacks.gso_send_check(skb);
2429 segs = ERR_PTR(err);
2430 if (err || skb_gso_ok(skb, features))
2431 break;
2432 __skb_push(skb, (skb->data -
2433 skb_network_header(skb)));
2434 }
2435 segs = ptype->callbacks.gso_segment(skb, features); 2425 segs = ptype->callbacks.gso_segment(skb, features);
2436 break; 2426 break;
2437 } 2427 }
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 72011cc4c13b..28e589c5f32d 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1197,40 +1197,6 @@ int inet_sk_rebuild_header(struct sock *sk)
1197} 1197}
1198EXPORT_SYMBOL(inet_sk_rebuild_header); 1198EXPORT_SYMBOL(inet_sk_rebuild_header);
1199 1199
1200static int inet_gso_send_check(struct sk_buff *skb)
1201{
1202 const struct net_offload *ops;
1203 const struct iphdr *iph;
1204 int proto;
1205 int ihl;
1206 int err = -EINVAL;
1207
1208 if (unlikely(!pskb_may_pull(skb, sizeof(*iph))))
1209 goto out;
1210
1211 iph = ip_hdr(skb);
1212 ihl = iph->ihl * 4;
1213 if (ihl < sizeof(*iph))
1214 goto out;
1215
1216 proto = iph->protocol;
1217
1218 /* Warning: after this point, iph might be no longer valid */
1219 if (unlikely(!pskb_may_pull(skb, ihl)))
1220 goto out;
1221 __skb_pull(skb, ihl);
1222
1223 skb_reset_transport_header(skb);
1224 err = -EPROTONOSUPPORT;
1225
1226 ops = rcu_dereference(inet_offloads[proto]);
1227 if (likely(ops && ops->callbacks.gso_send_check))
1228 err = ops->callbacks.gso_send_check(skb);
1229
1230out:
1231 return err;
1232}
1233
1234static struct sk_buff *inet_gso_segment(struct sk_buff *skb, 1200static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
1235 netdev_features_t features) 1201 netdev_features_t features)
1236{ 1202{
@@ -1655,7 +1621,6 @@ static int ipv4_proc_init(void);
1655static struct packet_offload ip_packet_offload __read_mostly = { 1621static struct packet_offload ip_packet_offload __read_mostly = {
1656 .type = cpu_to_be16(ETH_P_IP), 1622 .type = cpu_to_be16(ETH_P_IP),
1657 .callbacks = { 1623 .callbacks = {
1658 .gso_send_check = inet_gso_send_check,
1659 .gso_segment = inet_gso_segment, 1624 .gso_segment = inet_gso_segment,
1660 .gro_receive = inet_gro_receive, 1625 .gro_receive = inet_gro_receive,
1661 .gro_complete = inet_gro_complete, 1626 .gro_complete = inet_gro_complete,
@@ -1664,7 +1629,6 @@ static struct packet_offload ip_packet_offload __read_mostly = {
1664 1629
1665static const struct net_offload ipip_offload = { 1630static const struct net_offload ipip_offload = {
1666 .callbacks = { 1631 .callbacks = {
1667 .gso_send_check = inet_gso_send_check,
1668 .gso_segment = inet_gso_segment, 1632 .gso_segment = inet_gso_segment,
1669 .gro_receive = inet_gro_receive, 1633 .gro_receive = inet_gro_receive,
1670 .gro_complete = inet_gro_complete, 1634 .gro_complete = inet_gro_complete,
diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
index d3fe2ac05167..a77729503071 100644
--- a/net/ipv4/gre_offload.c
+++ b/net/ipv4/gre_offload.c
@@ -15,13 +15,6 @@
15#include <net/protocol.h> 15#include <net/protocol.h>
16#include <net/gre.h> 16#include <net/gre.h>
17 17
18static int gre_gso_send_check(struct sk_buff *skb)
19{
20 if (!skb->encapsulation)
21 return -EINVAL;
22 return 0;
23}
24
25static struct sk_buff *gre_gso_segment(struct sk_buff *skb, 18static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
26 netdev_features_t features) 19 netdev_features_t features)
27{ 20{
@@ -46,6 +39,9 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
46 SKB_GSO_IPIP))) 39 SKB_GSO_IPIP)))
47 goto out; 40 goto out;
48 41
42 if (!skb->encapsulation)
43 goto out;
44
49 if (unlikely(!pskb_may_pull(skb, sizeof(*greh)))) 45 if (unlikely(!pskb_may_pull(skb, sizeof(*greh))))
50 goto out; 46 goto out;
51 47
@@ -256,7 +252,6 @@ static int gre_gro_complete(struct sk_buff *skb, int nhoff)
256 252
257static const struct net_offload gre_offload = { 253static const struct net_offload gre_offload = {
258 .callbacks = { 254 .callbacks = {
259 .gso_send_check = gre_gso_send_check,
260 .gso_segment = gre_gso_segment, 255 .gso_segment = gre_gso_segment,
261 .gro_receive = gre_gro_receive, 256 .gro_receive = gre_gro_receive,
262 .gro_complete = gre_gro_complete, 257 .gro_complete = gre_gro_complete,
diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
index 7cd12b0458ff..5b90f2f447a5 100644
--- a/net/ipv4/tcp_offload.c
+++ b/net/ipv4/tcp_offload.c
@@ -288,11 +288,6 @@ int tcp_gro_complete(struct sk_buff *skb)
288} 288}
289EXPORT_SYMBOL(tcp_gro_complete); 289EXPORT_SYMBOL(tcp_gro_complete);
290 290
291static int tcp_v4_gso_send_check(struct sk_buff *skb)
292{
293 return 0;
294}
295
296static struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb) 291static struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb)
297{ 292{
298 /* Don't bother verifying checksum if we're going to flush anyway. */ 293 /* Don't bother verifying checksum if we're going to flush anyway. */
@@ -320,7 +315,6 @@ static int tcp4_gro_complete(struct sk_buff *skb, int thoff)
320 315
321static const struct net_offload tcpv4_offload = { 316static const struct net_offload tcpv4_offload = {
322 .callbacks = { 317 .callbacks = {
323 .gso_send_check = tcp_v4_gso_send_check,
324 .gso_segment = tcp4_gso_segment, 318 .gso_segment = tcp4_gso_segment,
325 .gro_receive = tcp4_gro_receive, 319 .gro_receive = tcp4_gro_receive,
326 .gro_complete = tcp4_gro_complete, 320 .gro_complete = tcp4_gro_complete,
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
index 2918cc914824..19ebe6a39ddc 100644
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -25,11 +25,6 @@ struct udp_offload_priv {
25 struct udp_offload_priv __rcu *next; 25 struct udp_offload_priv __rcu *next;
26}; 26};
27 27
28static int udp4_ufo_send_check(struct sk_buff *skb)
29{
30 return 0;
31}
32
33struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb, 28struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
34 netdev_features_t features) 29 netdev_features_t features)
35{ 30{
@@ -346,7 +341,6 @@ static int udp4_gro_complete(struct sk_buff *skb, int nhoff)
346 341
347static const struct net_offload udpv4_offload = { 342static const struct net_offload udpv4_offload = {
348 .callbacks = { 343 .callbacks = {
349 .gso_send_check = udp4_ufo_send_check,
350 .gso_segment = udp4_ufo_fragment, 344 .gso_segment = udp4_ufo_fragment,
351 .gro_receive = udp4_gro_receive, 345 .gro_receive = udp4_gro_receive,
352 .gro_complete = udp4_gro_complete, 346 .gro_complete = udp4_gro_complete,
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
index 9952f3fce30a..9034f76ae013 100644
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -53,31 +53,6 @@ static int ipv6_gso_pull_exthdrs(struct sk_buff *skb, int proto)
53 return proto; 53 return proto;
54} 54}
55 55
56static int ipv6_gso_send_check(struct sk_buff *skb)
57{
58 const struct ipv6hdr *ipv6h;
59 const struct net_offload *ops;
60 int err = -EINVAL;
61
62 if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h))))
63 goto out;
64
65 ipv6h = ipv6_hdr(skb);
66 __skb_pull(skb, sizeof(*ipv6h));
67 err = -EPROTONOSUPPORT;
68
69 ops = rcu_dereference(inet6_offloads[
70 ipv6_gso_pull_exthdrs(skb, ipv6h->nexthdr)]);
71
72 if (likely(ops && ops->callbacks.gso_send_check)) {
73 skb_reset_transport_header(skb);
74 err = ops->callbacks.gso_send_check(skb);
75 }
76
77out:
78 return err;
79}
80
81static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, 56static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
82 netdev_features_t features) 57 netdev_features_t features)
83{ 58{
@@ -306,7 +281,6 @@ out_unlock:
306static struct packet_offload ipv6_packet_offload __read_mostly = { 281static struct packet_offload ipv6_packet_offload __read_mostly = {
307 .type = cpu_to_be16(ETH_P_IPV6), 282 .type = cpu_to_be16(ETH_P_IPV6),
308 .callbacks = { 283 .callbacks = {
309 .gso_send_check = ipv6_gso_send_check,
310 .gso_segment = ipv6_gso_segment, 284 .gso_segment = ipv6_gso_segment,
311 .gro_receive = ipv6_gro_receive, 285 .gro_receive = ipv6_gro_receive,
312 .gro_complete = ipv6_gro_complete, 286 .gro_complete = ipv6_gro_complete,
@@ -315,7 +289,6 @@ static struct packet_offload ipv6_packet_offload __read_mostly = {
315 289
316static const struct net_offload sit_offload = { 290static const struct net_offload sit_offload = {
317 .callbacks = { 291 .callbacks = {
318 .gso_send_check = ipv6_gso_send_check,
319 .gso_segment = ipv6_gso_segment, 292 .gso_segment = ipv6_gso_segment,
320 .gro_receive = ipv6_gro_receive, 293 .gro_receive = ipv6_gro_receive,
321 .gro_complete = ipv6_gro_complete, 294 .gro_complete = ipv6_gro_complete,
diff --git a/net/ipv6/tcpv6_offload.c b/net/ipv6/tcpv6_offload.c
index 96253154db3a..c1ab77105b4c 100644
--- a/net/ipv6/tcpv6_offload.c
+++ b/net/ipv6/tcpv6_offload.c
@@ -15,11 +15,6 @@
15#include <net/ip6_checksum.h> 15#include <net/ip6_checksum.h>
16#include "ip6_offload.h" 16#include "ip6_offload.h"
17 17
18static int tcp_v6_gso_send_check(struct sk_buff *skb)
19{
20 return 0;
21}
22
23static struct sk_buff **tcp6_gro_receive(struct sk_buff **head, 18static struct sk_buff **tcp6_gro_receive(struct sk_buff **head,
24 struct sk_buff *skb) 19 struct sk_buff *skb)
25{ 20{
@@ -71,7 +66,6 @@ struct sk_buff *tcp6_gso_segment(struct sk_buff *skb,
71} 66}
72static const struct net_offload tcpv6_offload = { 67static const struct net_offload tcpv6_offload = {
73 .callbacks = { 68 .callbacks = {
74 .gso_send_check = tcp_v6_gso_send_check,
75 .gso_segment = tcp6_gso_segment, 69 .gso_segment = tcp6_gso_segment,
76 .gro_receive = tcp6_gro_receive, 70 .gro_receive = tcp6_gro_receive,
77 .gro_complete = tcp6_gro_complete, 71 .gro_complete = tcp6_gro_complete,
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c
index e4af6437ea3b..212ebfc7973f 100644
--- a/net/ipv6/udp_offload.c
+++ b/net/ipv6/udp_offload.c
@@ -17,11 +17,6 @@
17#include <net/ip6_checksum.h> 17#include <net/ip6_checksum.h>
18#include "ip6_offload.h" 18#include "ip6_offload.h"
19 19
20static int udp6_ufo_send_check(struct sk_buff *skb)
21{
22 return 0;
23}
24
25static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, 20static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
26 netdev_features_t features) 21 netdev_features_t features)
27{ 22{
@@ -166,7 +161,6 @@ static int udp6_gro_complete(struct sk_buff *skb, int nhoff)
166 161
167static const struct net_offload udpv6_offload = { 162static const struct net_offload udpv6_offload = {
168 .callbacks = { 163 .callbacks = {
169 .gso_send_check = udp6_ufo_send_check,
170 .gso_segment = udp6_ufo_fragment, 164 .gso_segment = udp6_ufo_fragment,
171 .gro_receive = udp6_gro_receive, 165 .gro_receive = udp6_gro_receive,
172 .gro_complete = udp6_gro_complete, 166 .gro_complete = udp6_gro_complete,
diff --git a/net/mpls/mpls_gso.c b/net/mpls/mpls_gso.c
index 6b38d083e1c9..e28ed2ef5b06 100644
--- a/net/mpls/mpls_gso.c
+++ b/net/mpls/mpls_gso.c
@@ -65,15 +65,9 @@ out:
65 return segs; 65 return segs;
66} 66}
67 67
68static int mpls_gso_send_check(struct sk_buff *skb)
69{
70 return 0;
71}
72
73static struct packet_offload mpls_mc_offload = { 68static struct packet_offload mpls_mc_offload = {
74 .type = cpu_to_be16(ETH_P_MPLS_MC), 69 .type = cpu_to_be16(ETH_P_MPLS_MC),
75 .callbacks = { 70 .callbacks = {
76 .gso_send_check = mpls_gso_send_check,
77 .gso_segment = mpls_gso_segment, 71 .gso_segment = mpls_gso_segment,
78 }, 72 },
79}; 73};
@@ -81,7 +75,6 @@ static struct packet_offload mpls_mc_offload = {
81static struct packet_offload mpls_uc_offload = { 75static struct packet_offload mpls_uc_offload = {
82 .type = cpu_to_be16(ETH_P_MPLS_UC), 76 .type = cpu_to_be16(ETH_P_MPLS_UC),
83 .callbacks = { 77 .callbacks = {
84 .gso_send_check = mpls_gso_send_check,
85 .gso_segment = mpls_gso_segment, 78 .gso_segment = mpls_gso_segment,
86 }, 79 },
87}; 80};