Skip to content

Commit

Permalink
datapath: compat: get rid of OVS_CB inner header offsets.
Browse files Browse the repository at this point in the history
OVS has GSO compat functionality which needs inner offset
of the packet to segment a packet. older kernel did not
include these offsets in skb, therefore these were stored
in OVS_GSO_CB. Now OVS has dropped support for these
old kernel, So none of the supported kernel needs this
comapt code. Following patch removes it.

Signed-off-by: Pravin B Shelar <[email protected]>
Acked-by: Jesse Gross <[email protected]>
  • Loading branch information
Pravin B Shelar authored and pshelar committed Jul 9, 2016
1 parent 29e7e7d commit c1eb250
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 72 deletions.
3 changes: 1 addition & 2 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,7 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_checksum_start_offset])
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [inner_protocol])
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [inner_protocol_type])
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [inner_mac_header])
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [inner_network_header])
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_inner_transport_offset])
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [kfree_skb_list])
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_scrub_packet.*xnet],
[OVS_DEFINE([HAVE_SKB_SCRUB_PACKET_XNET])])
Expand Down
70 changes: 1 addition & 69 deletions datapath/linux/compat/gso.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ struct ovs_gso_cb {
#ifndef HAVE_INNER_PROTOCOL
__be16 inner_protocol;
#endif
#ifndef HAVE_INNER_MAC_HEADER
unsigned int inner_mac_header;
#endif
#ifndef HAVE_INNER_NETWORK_HEADER
unsigned int inner_network_header;
#endif
#ifndef HAVE_NDO_FILL_METADATA_DST
/* Keep original tunnel info during userspace action execution. */
struct metadata_dst *fill_md_dst;
Expand All @@ -48,59 +42,6 @@ static inline void skb_clear_ovs_gso_cb(struct sk_buff *skb)
}
#endif

#ifndef HAVE_INNER_MAC_HEADER
static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb)
{
return skb->head + OVS_GSO_CB(skb)->inner_mac_header;
}

static inline void skb_set_inner_mac_header(const struct sk_buff *skb,
int offset)
{
OVS_GSO_CB(skb)->inner_mac_header = (skb->data - skb->head) + offset;
}
#endif /* HAVE_INNER_MAC_HEADER */

#ifndef HAVE_INNER_NETWORK_HEADER
static inline unsigned char *skb_inner_network_header(const struct sk_buff *skb)
{
return skb->head + OVS_GSO_CB(skb)->inner_network_header;
}

static inline int skb_inner_network_offset(const struct sk_buff *skb)
{
return skb_inner_network_header(skb) - skb->data;
}

/* We don't actually store the transport offset on backports because
* we don't use it anywhere. Slightly rename this version to avoid
* future users from picking it up accidentially.
*/
static inline int ovs_skb_inner_transport_offset(const struct sk_buff *skb)
{
return 0;
}

static inline void skb_set_inner_network_header(const struct sk_buff *skb,
int offset)
{
OVS_GSO_CB(skb)->inner_network_header = (skb->data - skb->head)
+ offset;
}

static inline void skb_set_inner_transport_header(const struct sk_buff *skb,
int offset)
{ }

#else

static inline int ovs_skb_inner_transport_offset(const struct sk_buff *skb)
{
return skb_inner_transport_header(skb) - skb->data;
}

#endif /* HAVE_INNER_NETWORK_HEADER */

#ifndef HAVE_INNER_PROTOCOL
static inline void ovs_skb_init_inner_protocol(struct sk_buff *skb)
{
Expand Down Expand Up @@ -142,7 +83,7 @@ static inline void ovs_skb_set_inner_protocol(struct sk_buff *skb,
skb->inner_protocol = ethertype;
}
#endif /* ENCAP_TYPE_ETHER */
#endif /* 3.11 */
#endif /* HAVE_INNER_PROTOCOL */

#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
#define ip_local_out rpl_ip_local_out
Expand All @@ -155,15 +96,6 @@ static inline int skb_inner_mac_offset(const struct sk_buff *skb)

#define ip6_local_out rpl_ip6_local_out
int rpl_ip6_local_out(struct sk_buff *skb);

#define skb_reset_inner_headers rpl_skb_reset_inner_headers
static inline void skb_reset_inner_headers(struct sk_buff *skb)
{
BUILD_BUG_ON(sizeof(struct ovs_gso_cb) > FIELD_SIZEOF(struct sk_buff, cb));
skb_set_inner_mac_header(skb, skb_mac_header(skb) - skb->data);
skb_set_inner_network_header(skb, skb_network_offset(skb));
skb_set_inner_transport_header(skb, skb_transport_offset(skb));
}
#endif /* 3.18 */

#ifndef USE_UPSTREAM_TUNNEL
Expand Down
7 changes: 7 additions & 0 deletions datapath/linux/compat/include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,

#endif /* !HAVE_SKB_COPY_FROM_LINEAR_DATA_OFFSET */

#ifndef HAVE_SKB_INNER_TRANSPORT_OFFSET
static inline int skb_inner_transport_offset(const struct sk_buff *skb)
{
return skb_inner_transport_header(skb) - skb->data;
}
#endif

#ifndef HAVE_SKB_RESET_TAIL_POINTER
static inline void skb_reset_tail_pointer(struct sk_buff *skb)
{
Expand Down
2 changes: 1 addition & 1 deletion datapath/linux/compat/skbuff-openvswitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ int rpl_pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,

inner_mac_offset = skb_inner_mac_offset(skb);
inner_nw_offset = skb_inner_network_offset(skb);
inner_transport_offset = ovs_skb_inner_transport_offset(skb);
inner_transport_offset = skb_inner_transport_offset(skb);

#undef pskb_expand_head
err = pskb_expand_head(skb, nhead, ntail, gfp_mask);
Expand Down

0 comments on commit c1eb250

Please sign in to comment.