From patchwork Thu May 23 23:58:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifeng Sun X-Patchwork-Id: 1104546 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; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LrbxmYg0"; 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 4595zt1Khqz9s6w for ; Fri, 24 May 2019 09:58:17 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 55B0EEE5; Thu, 23 May 2019 23:58:14 +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 18E65E52 for ; Thu, 23 May 2019 23:58:13 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 51B6AF4 for ; Thu, 23 May 2019 23:58:12 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id f10so82314wmb.1 for ; Thu, 23 May 2019 16:58:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=EUswtbnpQijvJiJA/92esPCw0LCBJFY96QnSAtfqC4I=; b=LrbxmYg0kYu8gHcBbtatIbg8NJ96OGEuiPueeVQeftzLXHqc3f/O6OjV+/JLQsLqUF q21CtyBS7+Lt/MLxmwO9YVHdWyL/66Ndlz7HPnZveaSJo1uXxG4e5DdaVzqTodMAbFA8 o4crpz2M+l6rf76ZxcE3WrqyuBQbW4lt2yqjlawhSIYYg/zhRwCaSbVKPGODyuhj4Urz tIeAeVxAsZQCLqWP8MSGnGp4U88IlS+8TzlmECGI5qTatZZGYCcL+AV5/VhJYs+aiZ9M fPh2rl2td+eGNOo4P+KBYFYWtFn99gzhbvFYIguQEF/1BnuSt/RLWvKKA6xjXGeqY+WG OIMQ== 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; bh=EUswtbnpQijvJiJA/92esPCw0LCBJFY96QnSAtfqC4I=; b=dXO8OkEGAAVDdpqkBvUCEQKQ8eanA5K0ST+GSac0OFzU6ctm4i85G75/PsAxXF97S1 EfdXBLrEGpoNiElfFSYFr7kZyc7udSEeaPoiw4/k7sfZ5oJ1eqcFnD65JibF83wG6vR0 GjXsMcQKZYlNb5tUoepRtYQ/xnUXjsh0ARwRl22G42nKp+FdLitH6zcutlvRy3bLTkyF vqZXgzwD9j/aT7IO6Eqm7ircuFXmVNC+oqPYS+jGf3yApf8xK9JN/Ty7zpvdW0uqm7xA gEhzMVx8tjp6p1Nk1IMHzVjoAdQA7OZ8dqsyHiljzSoGryip13qRSKrdodJZQxVZSSpK +Oyg== X-Gm-Message-State: APjAAAWyt7jK9on62rPCO3t8VXF5XazuT7A8xBnGJvnQ/M/keJIRP2bB yVspMZmqHEtVBwc6NsKTRdr6CD5e X-Google-Smtp-Source: APXvYqyRiHwcNUKvLiSisevTD7AleihO+XFicshjug0pyNPj2724TwocTxmKBUNFX5qvq4CwSJBvrg== X-Received: by 2002:a05:600c:23d2:: with SMTP id p18mr13395627wmb.66.1558655890208; Thu, 23 May 2019 16:58:10 -0700 (PDT) Received: from kern417.eng.vmware.com ([66.170.99.2]) by smtp.gmail.com with ESMTPSA id x187sm676775wmb.33.2019.05.23.16.58.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 May 2019 16:58:09 -0700 (PDT) From: Yifeng Sun To: dev@openvswitch.org Date: Thu, 23 May 2019 16:58:01 -0700 Message-Id: <1558655881-20597-1-git-send-email-pkusunyifeng@gmail.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v2] datapath: Fix build errors for 4.9.172+ kernels 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 4.9.172+ kernel backported upstream patch 70b095c843266 ("ipv6: remove dependency of nf_defrag_ipv6 on ipv6 module") and this caused compilation errors of OVS kernel module. This patch fixes it by checking and using new functions introduced by the upstream patch. Travis tests passed at https://travis-ci.org/yifsun/ovs-travis/builds/536527230 with latest Linux kernel version. In addition, this patch doesn't introduce failed tests for latest kernels of Ubuntu (bionic, trusty, xenial), fedora, centos 73, rhel (74, 75, 76). Reported-by: Ilya Maximets Signed-off-by: Yifeng Sun --- v1->v2: Fixed at bug that crashes certain kernels. Thanks YiHung! datapath/linux/compat/nf_conntrack_reasm.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/datapath/linux/compat/nf_conntrack_reasm.c b/datapath/linux/compat/nf_conntrack_reasm.c index 9d77d982712c..23904eef08d7 100644 --- a/datapath/linux/compat/nf_conntrack_reasm.c +++ b/datapath/linux/compat/nf_conntrack_reasm.c @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -138,8 +139,12 @@ static void nf_ct_frag6_expire(unsigned long data) #ifdef HAVE_INET_FRAGS_RND ip6_expire_frag_queue(net, fq, &nf_frags); #else +#ifdef HAVE_IPV6_FRAG_H + ip6frag_expire_frag_queue(net, fq); +#else ip6_expire_frag_queue(net, fq); #endif +#endif } #ifdef HAVE_INET_FRAGS_RND @@ -673,6 +678,16 @@ static struct pernet_operations nf_ct_net_ops = { .exit = nf_ct_net_exit, }; +#ifdef HAVE_IPV6_FRAG_H +static const struct rhashtable_params nfct_rhash_params = { + .head_offset = offsetof(struct inet_frag_queue, node), + .hashfn = ip6frag_key_hashfn, + .obj_hashfn = ip6frag_obj_hashfn, + .obj_cmpfn = ip6frag_obj_cmpfn, + .automatic_shrinking = true, +}; +#endif + int rpl_nf_ct_frag6_init(void) { int ret = 0; @@ -683,10 +698,16 @@ int rpl_nf_ct_frag6_init(void) #ifdef HAVE_INET_FRAGS_RND nf_frags.hashfn = nf_hashfn; nf_frags.match = ip6_frag_match; + nf_frags.constructor = ip6_frag_init; +#else +#ifdef HAVE_IPV6_FRAG_H + nf_frags.rhash_params = nfct_rhash_params; + nf_frags.constructor = ip6frag_init; #else nf_frags.rhash_params = ip6_rhash_params; -#endif nf_frags.constructor = ip6_frag_init; +#endif +#endif nf_frags.destructor = NULL; nf_frags.qsize = sizeof(struct frag_queue); nf_frags.frag_expire = nf_ct_frag6_expire;