[ovs-dev,4/6] datapath: Fix SKB_GSO_UDP usage

Message ID 1512518481-5944-5-git-send-email-gvrose8192@gmail.com
State New
Headers show
Series
  • Enable OVS on Linux 4.14 kernel
Related show

Commit Message

Greg Rose Dec. 6, 2017, 12:01 a.m.
Using SKB_GSO_UDP breaks the compilation on Linux 4.14. Check for
the HAVE_SKB_GSO_UDP compiler #define.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 datapath/datapath.c         |  9 ++++++---
 datapath/linux/compat/stt.c | 11 ++++++++++-
 2 files changed, 16 insertions(+), 4 deletions(-)

Patch

diff --git a/datapath/datapath.c b/datapath/datapath.c
index 1780819..a3fdd8f 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -339,8 +339,10 @@  static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb,
 			     const struct dp_upcall_info *upcall_info,
 				 uint32_t cutlen)
 {
+#ifdef HAVE_SKB_GSO_UDP
 	unsigned short gso_type = skb_shinfo(skb)->gso_type;
 	struct sw_flow_key later_key;
+#endif
 	struct sk_buff *segs, *nskb;
 	struct ovs_skb_cb ovs_cb;
 	int err;
@@ -352,7 +354,7 @@  static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb,
 		return PTR_ERR(segs);
 	if (segs == NULL)
 		return -EINVAL;
-
+#ifdef HAVE_SKB_GSO_UDP
 	if (gso_type & SKB_GSO_UDP) {
 		/* The initial flow key extracted by ovs_flow_key_extract()
 		 * in this case is for a first fragment, so we need to
@@ -361,14 +363,15 @@  static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb,
 		later_key = *key;
 		later_key.ip.frag = OVS_FRAG_TYPE_LATER;
 	}
-
+#endif
 	/* Queue all of the segments. */
 	skb = segs;
 	do {
 		*OVS_CB(skb) = ovs_cb;
+#ifdef HAVE_SKB_GSO_UDP
 		if (gso_type & SKB_GSO_UDP && skb != segs)
 			key = &later_key;
-
+#endif
 		err = queue_userspace_packet(dp, skb, key, upcall_info, cutlen);
 		if (err)
 			break;
diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c
index 37d5f4b..66a97f2 100644
--- a/datapath/linux/compat/stt.c
+++ b/datapath/linux/compat/stt.c
@@ -81,8 +81,13 @@  struct stt_dev {
 #define STT_PROTO_TCP		BIT(3)
 #define STT_PROTO_TYPES		(STT_PROTO_IPV4 | STT_PROTO_TCP)
 
+#ifdef HAVE_SKB_GSO_UDP
 #define SUPPORTED_GSO_TYPES (SKB_GSO_TCPV4 | SKB_GSO_UDP | SKB_GSO_DODGY | \
 			     SKB_GSO_TCPV6)
+#else
+#define SUPPORTED_GSO_TYPES (SKB_GSO_TCPV4 | SKB_GSO_DODGY | \
+			     SKB_GSO_TCPV6)
+#endif
 
 /* The length and offset of a fragment are encoded in the sequence number.
  * STT_SEQ_LEN_SHIFT is the left shift needed to store the length.
@@ -1310,7 +1315,7 @@  static bool validate_checksum(struct sk_buff *skb)
 static bool set_offloads(struct sk_buff *skb)
 {
 	struct stthdr *stth = stt_hdr(skb);
-	unsigned short gso_type;
+	unsigned short gso_type = 0;
 	int l3_header_size;
 	int l4_header_size;
 	u16 csum_offset;
@@ -1351,7 +1356,9 @@  static bool set_offloads(struct sk_buff *skb)
 	case STT_PROTO_IPV4:
 		/* UDP/IPv4 */
 		csum_offset = offsetof(struct udphdr, check);
+#ifdef HAVE_SKB_GSO_UDP
 		gso_type = SKB_GSO_UDP;
+#endif
 		l3_header_size = sizeof(struct iphdr);
 		l4_header_size = sizeof(struct udphdr);
 		skb->protocol = htons(ETH_P_IP);
@@ -1359,7 +1366,9 @@  static bool set_offloads(struct sk_buff *skb)
 	default:
 		/* UDP/IPv6 */
 		csum_offset = offsetof(struct udphdr, check);
+#ifdef HAVE_SKB_GSO_UDP
 		gso_type = SKB_GSO_UDP;
+#endif
 		l3_header_size = sizeof(struct ipv6hdr);
 		l4_header_size = sizeof(struct udphdr);
 		skb->protocol = htons(ETH_P_IPV6);