aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/udp_offload.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/udp_offload.c')
-rw-r--r--net/ipv6/udp_offload.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c
index 0ae3d98f83e0..b13e377e9c53 100644
--- a/net/ipv6/udp_offload.c
+++ b/net/ipv6/udp_offload.c
@@ -10,6 +10,7 @@
10 * UDPv6 GSO support 10 * UDPv6 GSO support
11 */ 11 */
12#include <linux/skbuff.h> 12#include <linux/skbuff.h>
13#include <linux/netdevice.h>
13#include <net/protocol.h> 14#include <net/protocol.h>
14#include <net/ipv6.h> 15#include <net/ipv6.h>
15#include <net/udp.h> 16#include <net/udp.h>
@@ -127,10 +128,42 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
127out: 128out:
128 return segs; 129 return segs;
129} 130}
131
132static struct sk_buff **udp6_gro_receive(struct sk_buff **head,
133 struct sk_buff *skb)
134{
135 struct udphdr *uh = udp_gro_udphdr(skb);
136
137 /* Don't bother verifying checksum if we're going to flush anyway. */
138 if (unlikely(!uh) ||
139 (!NAPI_GRO_CB(skb)->flush &&
140 skb_gro_checksum_validate_zero_check(skb, IPPROTO_UDP, uh->check,
141 ip6_gro_compute_pseudo))) {
142 NAPI_GRO_CB(skb)->flush = 1;
143 return NULL;
144 }
145
146 return udp_gro_receive(head, skb, uh);
147}
148
149int udp6_gro_complete(struct sk_buff *skb, int nhoff)
150{
151 const struct ipv6hdr *ipv6h = ipv6_hdr(skb);
152 struct udphdr *uh = (struct udphdr *)(skb->data + nhoff);
153
154 if (uh->check)
155 uh->check = ~udp_v6_check(skb->len - nhoff, &ipv6h->saddr,
156 &ipv6h->daddr, 0);
157
158 return udp_gro_complete(skb, nhoff);
159}
160
130static const struct net_offload udpv6_offload = { 161static const struct net_offload udpv6_offload = {
131 .callbacks = { 162 .callbacks = {
132 .gso_send_check = udp6_ufo_send_check, 163 .gso_send_check = udp6_ufo_send_check,
133 .gso_segment = udp6_ufo_fragment, 164 .gso_segment = udp6_ufo_fragment,
165 .gro_receive = udp6_gro_receive,
166 .gro_complete = udp6_gro_complete,
134 }, 167 },
135}; 168};
136 169