[ovs-dev] [PATCH 6/6] datapath: compat: gso: tighen checks for compat GSO code.
Pravin B Shelar
pshelar at ovn.org
Wed Aug 3 17:08:14 UTC 2016
Few function can be compiled out for non GSO case. This
patch make it bit cleaner to understand GSO compat code.
Signed-off-by: Pravin B Shelar <pshelar at ovn.org>
---
datapath/linux/compat/gso.h | 2 +-
datapath/linux/compat/include/net/udp_tunnel.h | 7 ++++---
datapath/linux/compat/udp_tunnel.c | 2 ++
datapath/linux/compat/vxlan.c | 4 ++++
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/datapath/linux/compat/gso.h b/datapath/linux/compat/gso.h
index e93998c..2e9dbb3 100644
--- a/datapath/linux/compat/gso.h
+++ b/datapath/linux/compat/gso.h
@@ -13,8 +13,8 @@ struct ovs_gso_cb {
#endif
#ifndef USE_UPSTREAM_TUNNEL_GSO
gso_fix_segment_t fix_segment;
-#endif
bool ipv6;
+#endif
#ifndef HAVE_INNER_PROTOCOL
__be16 inner_protocol;
#endif
diff --git a/datapath/linux/compat/include/net/udp_tunnel.h b/datapath/linux/compat/include/net/udp_tunnel.h
index 7fccc12..51415e4 100644
--- a/datapath/linux/compat/include/net/udp_tunnel.h
+++ b/datapath/linux/compat/include/net/udp_tunnel.h
@@ -150,21 +150,22 @@ void ovs_udp_csum_gso(struct sk_buff *skb);
static inline int rpl_udp_tunnel_handle_offloads(struct sk_buff *skb,
bool udp_csum)
{
- int type = 0;
-
void (*fix_segment)(struct sk_buff *);
+ int type = 0;
type |= udp_csum ? SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
+#ifndef USE_UPSTREAM_TUNNEL_GSO
if (!udp_csum)
fix_segment = ovs_udp_gso;
else
fix_segment = ovs_udp_csum_gso;
-#ifndef USE_UPSTREAM_TUNNEL_GSO
/* This functuin is not used by vxlan lan tunnel. On older
* udp offload only supports vxlan, therefore fallback to software
* segmentation.
*/
type = 0;
+#else
+ fix_segment = NULL;
#endif
return ovs_iptunnel_handle_offloads(skb, udp_csum, type, fix_segment);
diff --git a/datapath/linux/compat/udp_tunnel.c b/datapath/linux/compat/udp_tunnel.c
index 9cf7286..8cde425 100644
--- a/datapath/linux/compat/udp_tunnel.c
+++ b/datapath/linux/compat/udp_tunnel.c
@@ -266,6 +266,7 @@ int rpl_udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sock *sk,
}
#endif
+#ifndef USE_UPSTREAM_TUNNEL_GSO
void ovs_udp_gso(struct sk_buff *skb)
{
int udp_offset = skb_transport_offset(skb);
@@ -300,5 +301,6 @@ void ovs_udp_csum_gso(struct sk_buff *skb)
}
}
EXPORT_SYMBOL_GPL(ovs_udp_csum_gso);
+#endif /* USE_UPSTREAM_TUNNEL_GSO */
#endif
diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
index 836d96d..75b811b 100644
--- a/datapath/linux/compat/vxlan.c
+++ b/datapath/linux/compat/vxlan.c
@@ -868,7 +868,11 @@ static int vxlan_build_skb(struct sk_buff *skb, struct dst_entry *dst,
return -ENOMEM;
type |= udp_sum ? SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
+#ifndef USE_UPSTREAM_TUNNEL_GSO
fix_segment = !udp_sum ? ovs_udp_gso : ovs_udp_csum_gso;
+#else
+ fix_segment = NULL;
+#endif
err = ovs_iptunnel_handle_offloads(skb, udp_sum, type, fix_segment);
if (err)
goto out_free;
--
1.9.1
More information about the dev
mailing list