udp: Add GRO functions to UDP socket
This patch adds GRO functions (gro_receive and gro_complete) to UDP sockets. udp_gro_receive is changed to perform socket lookup on a packet. If a socket is found the related GRO functions are called. This features obsoletes using UDP offload infrastructure for GRO (udp_offload). This has the advantage of not being limited to provide offload on a per port basis, GRO is now applied to whatever individual UDP sockets are bound to. This also allows the possbility of "application defined GRO"-- that is we can attach something like a BPF program to a UDP socket to perfrom GRO on an application layer protocol. Signed-off-by: Tom Herbert <tom@herbertland.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
63058308cd
commit
a6024562ff
@@ -153,7 +153,7 @@ static struct sk_buff **udp6_gro_receive(struct sk_buff **head,
|
||||
|
||||
skip:
|
||||
NAPI_GRO_CB(skb)->is_ipv6 = 1;
|
||||
return udp_gro_receive(head, skb, uh);
|
||||
return udp_gro_receive(head, skb, uh, udp6_lib_lookup_skb);
|
||||
|
||||
flush:
|
||||
NAPI_GRO_CB(skb)->flush = 1;
|
||||
@@ -173,7 +173,7 @@ static int udp6_gro_complete(struct sk_buff *skb, int nhoff)
|
||||
skb_shinfo(skb)->gso_type |= SKB_GSO_UDP_TUNNEL;
|
||||
}
|
||||
|
||||
return udp_gro_complete(skb, nhoff);
|
||||
return udp_gro_complete(skb, nhoff, udp6_lib_lookup_skb);
|
||||
}
|
||||
|
||||
static const struct net_offload udpv6_offload = {
|
||||
@@ -184,7 +184,12 @@ static const struct net_offload udpv6_offload = {
|
||||
},
|
||||
};
|
||||
|
||||
int __init udp_offload_init(void)
|
||||
int udpv6_offload_init(void)
|
||||
{
|
||||
return inet6_add_offload(&udpv6_offload, IPPROTO_UDP);
|
||||
}
|
||||
|
||||
int udpv6_offload_exit(void)
|
||||
{
|
||||
return inet6_del_offload(&udpv6_offload, IPPROTO_UDP);
|
||||
}
|
||||
|
Reference in New Issue
Block a user