diff mbox

[ovs-dev,v2,11/24] datapath: backport: udp: Add socket based GRO and config

Message ID 1467274002-61390-11-git-send-email-pshelar@ovn.org
State Superseded
Headers show

Commit Message

Pravin Shelar June 30, 2016, 8:06 a.m. UTC
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>
---
 acinclude.m4                                   | 2 ++
 datapath/linux/compat/include/net/udp_tunnel.h | 9 +++++++++
 datapath/linux/compat/udp_tunnel.c             | 4 ++++
 3 files changed, 15 insertions(+)

Comments

Jesse Gross June 30, 2016, 8:48 p.m. UTC | #1
On Thu, Jun 30, 2016 at 1:06 AM, Pravin B Shelar <pshelar@ovn.org> wrote:
> 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>
diff mbox

Patch

diff --git a/acinclude.m4 b/acinclude.m4
index dd453bf..f2099bc 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -614,6 +614,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 3f02c79..7086216 100644
--- a/datapath/linux/compat/include/net/udp_tunnel.h
+++ b/datapath/linux/compat/include/net/udp_tunnel.h
@@ -73,6 +73,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 */
@@ -80,6 +85,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 4e2c64d..d5dbad1 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);
 }