udp: Add socket based GRO and config
authorTom Herbert <tom@herbertland.com>
Tue, 5 Apr 2016 15:22:52 +0000 (08:22 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Apr 2016 20:53:29 +0000 (16:53 -0400)
Add gro_receive and  gro_complete to struct udp_tunnel_sock_cfg.

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/udp_tunnel.h
net/ipv4/udp_tunnel.c

index b83114077cee33d184a2bef45da1be686f94a72f..2dcf1de948ac74d9c5b9d5144e413fa12fa5463e 100644 (file)
@@ -64,6 +64,11 @@ static inline int udp_sock_create(struct net *net,
 
 typedef int (*udp_tunnel_encap_rcv_t)(struct sock *sk, struct sk_buff *skb);
 typedef void (*udp_tunnel_encap_destroy_t)(struct sock *sk);
+typedef struct sk_buff **(*udp_tunnel_gro_receive_t)(struct sock *sk,
+                                                    struct sk_buff **head,
+                                                    struct sk_buff *skb);
+typedef int (*udp_tunnel_gro_complete_t)(struct sock *sk, struct sk_buff *skb,
+                                        int nhoff);
 
 struct udp_tunnel_sock_cfg {
        void *sk_user_data;     /* user data used by encap_rcv call back */
@@ -71,6 +76,8 @@ struct udp_tunnel_sock_cfg {
        __u8  encap_type;
        udp_tunnel_encap_rcv_t encap_rcv;
        udp_tunnel_encap_destroy_t encap_destroy;
+       udp_tunnel_gro_receive_t gro_receive;
+       udp_tunnel_gro_complete_t gro_complete;
 };
 
 /* Setup the given (UDP) sock to receive UDP encapsulated packets */
index 96599d1a13184d4ef6d34ae9bff7833420d0ad93..47f12c73d9598bcef8442527f13a434abd6169eb 100644 (file)
@@ -69,6 +69,8 @@ void setup_udp_tunnel_sock(struct net *net, struct socket *sock,
        udp_sk(sk)->encap_type = cfg->encap_type;
        udp_sk(sk)->encap_rcv = cfg->encap_rcv;
        udp_sk(sk)->encap_destroy = cfg->encap_destroy;
+       udp_sk(sk)->gro_receive = cfg->gro_receive;
+       udp_sk(sk)->gro_complete = cfg->gro_complete;
 
        udp_tunnel_encap_enable(sock);
 }