Skip to content

Commit

Permalink
datapath: compat: gso: tighen checks for compat GSO code.
Browse files Browse the repository at this point in the history
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@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
  • Loading branch information
pshelar committed Aug 3, 2016
1 parent 2255777 commit b416d16
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion datapath/linux/compat/gso.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions datapath/linux/compat/include/net/udp_tunnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions datapath/linux/compat/udp_tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions datapath/linux/compat/vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b416d16

Please sign in to comment.