summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPravin B Shelar <pshelar@ovn.org>2016-07-07 21:52:24 -0700
committerPravin B Shelar <pshelar@ovn.org>2016-07-08 19:27:49 -0700
commitd7e58913468f5f880722206369340bfdad4f46ee (patch)
tree406e2c06a814a293047afd669f33e9d6abf2afc9
parentf45a3684fe0eec7672c8c5b0cdadb8308cca3708 (diff)
downloadopenvswitch-d7e58913468f5f880722206369340bfdad4f46ee.tar.gz
datapath: backport: udp: Add socket based GRO and config
Upstream commit: commit 38fd2af24fcfda93f9fea3e53f26e48775ae9e09 Author: Tom Herbert <tom@herbertland.com> udp: Add socket based GRO and config 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> Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Jesse Gross <jesse@kernel.org>
-rw-r--r--acinclude.m42
-rw-r--r--datapath/linux/compat/include/net/udp_tunnel.h9
-rw-r--r--datapath/linux/compat/udp_tunnel.c4
3 files changed, 15 insertions, 0 deletions
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);
}