aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2014-09-20 17:52:30 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-26 00:22:47 -0400
commit53e50398968d43338c4d932114e68bc099fc5fbd (patch)
treef51fe647dc1d833dedd68f7ed384d0634bc6c143 /net/ipv4
parentf71470b37e79d6eb151debd47364d920b7babd30 (diff)
net: Remove gso_send_check as an offload callback
The send_check logic was only interesting in cases of TCP offload and UDP UFO where the checksum needed to be initialized to the pseudo header checksum. Now we've moved that logic into the related gso_segment functions so gso_send_check is no longer needed. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-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
4 files changed, 3 insertions, 56 deletions
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,