udp: additional GRO support
Implement GRO for UDPv6. Add UDP checksum verification in gro_receive for both UDP4 and UDP6 calling skb_gro_checksum_validate_zero_check. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
149d0774a7
commit
57c67ff4bd
@@ -10,6 +10,7 @@
|
||||
* UDPv6 GSO support
|
||||
*/
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <net/protocol.h>
|
||||
#include <net/ipv6.h>
|
||||
#include <net/udp.h>
|
||||
@@ -127,10 +128,42 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
|
||||
out:
|
||||
return segs;
|
||||
}
|
||||
|
||||
static struct sk_buff **udp6_gro_receive(struct sk_buff **head,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct udphdr *uh = udp_gro_udphdr(skb);
|
||||
|
||||
/* Don't bother verifying checksum if we're going to flush anyway. */
|
||||
if (unlikely(!uh) ||
|
||||
(!NAPI_GRO_CB(skb)->flush &&
|
||||
skb_gro_checksum_validate_zero_check(skb, IPPROTO_UDP, uh->check,
|
||||
ip6_gro_compute_pseudo))) {
|
||||
NAPI_GRO_CB(skb)->flush = 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return udp_gro_receive(head, skb, uh);
|
||||
}
|
||||
|
||||
int udp6_gro_complete(struct sk_buff *skb, int nhoff)
|
||||
{
|
||||
const struct ipv6hdr *ipv6h = ipv6_hdr(skb);
|
||||
struct udphdr *uh = (struct udphdr *)(skb->data + nhoff);
|
||||
|
||||
if (uh->check)
|
||||
uh->check = ~udp_v6_check(skb->len - nhoff, &ipv6h->saddr,
|
||||
&ipv6h->daddr, 0);
|
||||
|
||||
return udp_gro_complete(skb, nhoff);
|
||||
}
|
||||
|
||||
static const struct net_offload udpv6_offload = {
|
||||
.callbacks = {
|
||||
.gso_send_check = udp6_ufo_send_check,
|
||||
.gso_segment = udp6_ufo_fragment,
|
||||
.gro_receive = udp6_gro_receive,
|
||||
.gro_complete = udp6_gro_complete,
|
||||
},
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user