From patchwork Fri Dec 8 21:58:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 846466 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GwYFSpCw"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ytmWl4ybbz9sP9 for ; Sat, 9 Dec 2017 09:01:07 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 83AE9D4B; Fri, 8 Dec 2017 21:59:07 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id D7CBDD50 for ; Fri, 8 Dec 2017 21:59:04 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f67.google.com (mail-pg0-f67.google.com [74.125.83.67]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 8E89F403 for ; Fri, 8 Dec 2017 21:59:04 +0000 (UTC) Received: by mail-pg0-f67.google.com with SMTP id w7so7697028pgv.6 for ; Fri, 08 Dec 2017 13:59:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=g+vzTWQ6n1On+HtcTZ9+cQlxh0C8VU224aZTsIOCIwk=; b=GwYFSpCwfQ38MUDx2TNyJlG+5oddDCjMAEdTdv1JsIdm3iDWRXyEBj/NKFLz40Hj4N nvaY5v++rNF5MeYBQaSt0zzu2a2cOP+glzPKNUG4e5zyps0Cw6OaePoOSdW35MzstIGA WR0r6PtXixbnthTwO6qBlQ5i5cVFKBOd3MxgXrO1fCYqO1HRzbFvFgedI4P+kxs+5YMh rKYLc+izG/ccTGWBlqe3bnZ8EbLy+7VE83aRHf7zanYe4qt/jB3qRYz/rnbHGYcZYuOQ vxKGCG/+BL4tNReG4hOEJgLXssrQV2lTqm4XA6Q9uHk4UP7130pQwn5uLt0cWTzzmmpI df4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=g+vzTWQ6n1On+HtcTZ9+cQlxh0C8VU224aZTsIOCIwk=; b=ifj1OpJXCn7TL2iRGES2osE3N76yH2HIs9C57/X1v4+X2wa4/HAmIGcohho08hbFS7 cSUsFtqJ5t/HC2fwDB91j18/KQG/A9eT1dqS5wjuQZ1Cz0l3zXtPyRy53NwFJfGATdtA dqXnZlA6+bKDUxd/sHsDWOcHQNs4WVTigmx5WEX7IZ3bIb1YPVqJgOiuEct1b3zrc95T 0Rt2nhfDMxu9qbIVjMddcNr6Fe7HMJLK6o6GYAOEbCMb6rJoFw1tyBuE1paf5q8vsIIX BcCg9+hgoBnqK0BU3J8SYkPVM1/4gMvhG7e58SiKHqUCpLvVt1K7Byr40n4z8lnliDQo wZTA== X-Gm-Message-State: AKGB3mJuRJqvo8mr6Z6hjj3WGXy7vpfyCTifkAOzG2cJinaZLVUsIl7e kqMaaPTTuCRED71q1Ir/xqrqz4nE X-Google-Smtp-Source: AGs4zMbUEA5/JVGYYSQXB+L94nsnIZiW1gXlHVDzwvaNnejNuom34tJTXie92KCcEnYP1OhJ31YTqA== X-Received: by 10.101.83.13 with SMTP id m13mr24650618pgq.151.1512770343769; Fri, 08 Dec 2017 13:59:03 -0800 (PST) Received: from gizo.domain (67-5-143-47.ptld.qwest.net. [67.5.143.47]) by smtp.gmail.com with ESMTPSA id c11sm3004636pgv.22.2017.12.08.13.59.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Dec 2017 13:59:02 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Fri, 8 Dec 2017 13:58:51 -0800 Message-Id: <1512770333-7105-5-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1512770333-7105-1-git-send-email-gvrose8192@gmail.com> References: <1512770333-7105-1-git-send-email-gvrose8192@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH V3 4/6] datapath: Fix SKB_GSO_UDP usage X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 --- datapath/datapath.c | 9 ++++++--- datapath/linux/compat/stt.c | 11 ++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) 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);