From d7e58913468f5f880722206369340bfdad4f46ee Mon Sep 17 00:00:00 2001 From: Pravin B Shelar Date: Thu, 7 Jul 2016 21:52:24 -0700 Subject: [PATCH] datapath: backport: udp: Add socket based GRO and config Upstream commit: commit 38fd2af24fcfda93f9fea3e53f26e48775ae9e09 Author: Tom Herbert udp: Add socket based GRO and config Add gro_receive and gro_complete to struct udp_tunnel_sock_cfg. Signed-off-by: Tom Herbert Signed-off-by: David S. Miller Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross --- acinclude.m4 | 2 ++ datapath/linux/compat/include/net/udp_tunnel.h | 9 +++++++++ datapath/linux/compat/udp_tunnel.c | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 003ba72c4..ba59e3d92 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -613,6 +613,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_GREP_IFELSE([$KSRC/include/net/udp.h], [udp_v4_check]) OVS_GREP_IFELSE([$KSRC/include/net/udp.h], [udp_set_csum]) OVS_GREP_IFELSE([$KSRC/include/net/udp_tunnel.h], [udp_tunnel_gro_complete]) + OVS_FIND_FIELD_IFELSE([$KSRC/include/net/udp_tunnel.h], [udp_tunnel_sock_cfg], + [gro_receive]) OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [ignore_df], [OVS_DEFINE([HAVE_IGNORE_DF_RENAME])]) diff --git a/datapath/linux/compat/include/net/udp_tunnel.h b/datapath/linux/compat/include/net/udp_tunnel.h index 96a13ec4c..3922e2462 100644 --- a/datapath/linux/compat/include/net/udp_tunnel.h +++ b/datapath/linux/compat/include/net/udp_tunnel.h @@ -74,6 +74,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 */ @@ -81,6 +86,10 @@ struct udp_tunnel_sock_cfg { __u8 encap_type; udp_tunnel_encap_rcv_t encap_rcv; udp_tunnel_encap_destroy_t encap_destroy; +#ifdef HAVE_UDP_TUNNEL_SOCK_CFG_GRO_RECEIVE + udp_tunnel_gro_receive_t gro_receive; + udp_tunnel_gro_complete_t gro_complete; +#endif }; /* Setup the given (UDP) sock to receive UDP encapsulated packets */ diff --git a/datapath/linux/compat/udp_tunnel.c b/datapath/linux/compat/udp_tunnel.c index daa3fa15f..0ad3c2acc 100644 --- a/datapath/linux/compat/udp_tunnel.c +++ b/datapath/linux/compat/udp_tunnel.c @@ -132,6 +132,10 @@ void rpl_setup_udp_tunnel_sock(struct net *net, struct socket *sock, #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0) udp_sk(sk)->encap_destroy = cfg->encap_destroy; #endif +#ifdef HAVE_UDP_TUNNEL_SOCK_CFG_GRO_RECEIVE + udp_sk(sk)->gro_receive = cfg->gro_receive; + udp_sk(sk)->gro_complete = cfg->gro_complete; +#endif udp_tunnel_encap_enable(sock); } -- 2.20.1