Upstream commit:
    udp: Do not require sock in udp_tunnel_xmit_skb

    The UDP tunnel transmit functions udp_tunnel_xmit_skb and
    udp_tunnel6_xmit_skb include a socket argument. The socket being
    passed to the functions (from VXLAN) is a UDP created for receive
    side. The only thing that the socket is used for in the transmit
    functions is to get the setting for checksum (enabled or zero).
    This patch removes the argument and and adds a nocheck argument
    for checksum setting. This eliminates the unnecessary dependency
    on a UDP socket for UDP tunnel transmit.

    Signed-off-by: Tom Herbert <therb...@google.com>
    Signed-off-by: David S. Miller <da...@davemloft.net>

Upstream: d998f8ef ("udp: Do not require sock in udp_tunnel_xmit_skb")
Signed-off-by: Jesse Gross <je...@nicira.com>
---
 datapath/linux/compat/include/net/udp_tunnel.h | 13 +++++++------
 datapath/linux/compat/udp_tunnel.c             | 16 ++++++++--------
 datapath/linux/compat/vxlan.c                  |  5 +++--
 datapath/vport-lisp.c                          |  5 ++---
 4 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/datapath/linux/compat/include/net/udp_tunnel.h 
b/datapath/linux/compat/include/net/udp_tunnel.h
index 16b150c..8582fb7 100644
--- a/datapath/linux/compat/include/net/udp_tunnel.h
+++ b/datapath/linux/compat/include/net/udp_tunnel.h
@@ -4,7 +4,7 @@
 #include <linux/version.h>
 #include <linux/kconfig.h>
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,20,0)
 #include_next <net/udp_tunnel.h>
 
 static inline struct sk_buff *
@@ -67,10 +67,11 @@ void setup_udp_tunnel_sock(struct net *net, struct socket 
*sock,
                           struct udp_tunnel_sock_cfg *sock_cfg);
 
 /* Transmit the skb using UDP encapsulation. */
-int udp_tunnel_xmit_skb(struct socket *sock, struct rtable *rt,
-                       struct sk_buff *skb, __be32 src, __be32 dst,
-                       __u8 tos, __u8 ttl, __be16 df, __be16 src_port,
-                       __be16 dst_port, bool xnet);
+int udp_tunnel_xmit_skb(struct rtable *rt, struct sk_buff *skb,
+                       __be32 src, __be32 dst, __u8 tos, __u8 ttl,
+                       __be16 df, __be16 src_port, __be16 dst_port,
+                       bool xnet, bool nocheck);
+
 
 void udp_tunnel_sock_release(struct socket *sock);
 
@@ -99,5 +100,5 @@ static inline struct sk_buff 
*udp_tunnel_handle_offloads(struct sk_buff *skb,
 
 #define udp_tunnel_encap_enable(sock) udp_encap_enable()
 
-#endif /* Linux version < 3.18 */
+#endif /* Linux version < 3.20 */
 #endif
diff --git a/datapath/linux/compat/udp_tunnel.c 
b/datapath/linux/compat/udp_tunnel.c
index 1b79ef9..a1c4951 100644
--- a/datapath/linux/compat/udp_tunnel.c
+++ b/datapath/linux/compat/udp_tunnel.c
@@ -1,6 +1,6 @@
 #include <linux/version.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,20,0)
 
 #include <linux/module.h>
 #include <linux/errno.h>
@@ -138,10 +138,10 @@ void ovs_udp_csum_gso(struct sk_buff *skb)
                     skb->len - udp_offset);
 }
 
-int udp_tunnel_xmit_skb(struct socket *sock, struct rtable *rt,
-                       struct sk_buff *skb, __be32 src, __be32 dst,
-                       __u8 tos, __u8 ttl, __be16 df, __be16 src_port,
-                       __be16 dst_port, bool xnet)
+int udp_tunnel_xmit_skb(struct rtable *rt, struct sk_buff *skb,
+                       __be32 src, __be32 dst, __u8 tos, __u8 ttl,
+                       __be16 df, __be16 src_port, __be16 dst_port,
+                       bool xnet, bool nocheck)
 {
        struct udphdr *uh;
 
@@ -153,9 +153,9 @@ int udp_tunnel_xmit_skb(struct socket *sock, struct rtable 
*rt,
        uh->source = src_port;
        uh->len = htons(skb->len);
 
-       udp_set_csum(true, skb, src, dst, skb->len);
+       udp_set_csum(nocheck, skb, src, dst, skb->len);
 
-       return iptunnel_xmit(sock->sk, rt, skb, src, dst, IPPROTO_UDP,
+       return iptunnel_xmit(skb->sk, rt, skb, src, dst, IPPROTO_UDP,
                             tos, ttl, df, xnet);
 }
 
@@ -166,4 +166,4 @@ void udp_tunnel_sock_release(struct socket *sock)
        sk_release_kernel(sock->sk);
 }
 
-#endif /* Linux version < 3.18 */
+#endif /* Linux version < 3.20 */
diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
index d0af92b..ad5e4b4 100644
--- a/datapath/linux/compat/vxlan.c
+++ b/datapath/linux/compat/vxlan.c
@@ -221,8 +221,9 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
 
        ovs_skb_set_inner_protocol(skb, htons(ETH_P_TEB));
 
-       return udp_tunnel_xmit_skb(vs->sock, rt, skb, src, dst, tos,
-                                  ttl, df, src_port, dst_port, xnet);
+       return udp_tunnel_xmit_skb(rt, skb, src, dst, tos,
+                                  ttl, df, src_port, dst_port, xnet,
+                                  true);
 }
 
 static void rcu_free_vs(struct rcu_head *rcu)
diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c
index 29a1afc..293002f 100644
--- a/datapath/vport-lisp.c
+++ b/datapath/vport-lisp.c
@@ -453,10 +453,9 @@ static int lisp_send(struct vport *vport, struct sk_buff 
*skb)
        ovs_skb_set_inner_protocol(skb, skb->protocol);
 
        df = tun_key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
-       sent_len = udp_tunnel_xmit_skb(lisp_port->lisp_rcv_socket, rt, skb,
-                                      saddr, tun_key->ipv4_dst,
+       sent_len = udp_tunnel_xmit_skb(rt, skb, saddr, tun_key->ipv4_dst,
                                       tun_key->ipv4_tos, tun_key->ipv4_ttl,
-                                      df, src_port, dst_port, false);
+                                      df, src_port, dst_port, false, true);
 
        return sent_len > 0 ? sent_len + network_offset : sent_len;
 
-- 
1.9.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to