From patchwork Fri Mar 6 22:37:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 1250646 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.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.a=rsa-sha256 header.s=20161025 header.b=TnZqA/kq; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Z2Yp0RZ5z9sPJ for ; Sat, 7 Mar 2020 09:37:33 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5242B86F50; Fri, 6 Mar 2020 22:37:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eeSuBFht_rhE; Fri, 6 Mar 2020 22:37:29 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id DAD6B86F57; Fri, 6 Mar 2020 22:37:29 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D2AD2C1D8E; Fri, 6 Mar 2020 22:37:29 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 95BEFC013E for ; Fri, 6 Mar 2020 22:37:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 84320228F1 for ; Fri, 6 Mar 2020 22:37:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uAwW4-nBSHrm for ; Fri, 6 Mar 2020 22:37:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by silver.osuosl.org (Postfix) with ESMTPS id 8A7BB22816 for ; Fri, 6 Mar 2020 22:37:27 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id d8so1685631pje.4 for ; Fri, 06 Mar 2020 14:37:27 -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=nFgS2xvboQiozga+zEWc9O0n1XvJItJd+Qxtg+rRGfM=; b=TnZqA/kqz4R5zYwCbxnxzC0DotoGicWB9RBRAEK1KoLrhvG6uedDg6x9FlFlpBQlCc wSQRe+K6MpJG1mzWaHbP0KPAlRRipw6V5rO58vVV89HWTe3fxyEfpdwsqZzH2PbrEnX7 qx5uJokhivHClRY0Cy7nBf77HaigMFCZdPRxAIYCzA3YT/D5FGd7YVcfXnzZh6v9LAe/ PgfiMLTWjWKwnJCyEveuj6ZkWzM7Hp1eYZYZnDusJujghu07Z4cKuQV5d5EpFmSrLoDx /OW/q5Sb+33qSd9hu60vgCndbRd3Zs/SRRae962u/XRq6ho9oATmuBaXSAnYWPsWnDHm G6Uw== 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=nFgS2xvboQiozga+zEWc9O0n1XvJItJd+Qxtg+rRGfM=; b=jbnofdrNCnGDQRIM0FjsPEVFR75s85Ubdzc2wuRBn4X/TZYIF/ltZGIZaZkOQR3KsN AcddlsD6Z1gven41VUGLq7POKLP38qx1hZ2I1t3Kft39Lphn7wVb6i+Efc2Sx19vDZaN 1YVjZLBHTXcXkPyTBosth3JmpZ365AHLFUIsbaLMm8HQwnVUViy2/xT+j9qGTwOIbowy vIX5hOdBu/y83W42xCN3fWft2bPCQk7rq9Df+ki6KA5fuYmB3JVEJKxZPz9kce1jGrpj LrVHoZmG5viD+9mFIxmcMG2jpMxDsSXYeF1K9HximYn+sl3wWURFLKce4jeMbpTqrdwN dgcw== X-Gm-Message-State: ANhLgQ2cjw5vszV9jgnm+4fIkk36ybPIXGPyVvzHEgz8GJq4CcGqImTT BWE1cw/1NrLSZ5wCD3YZcn55zgkZ66U= X-Google-Smtp-Source: ADFU+vuUfvfyo0l9IJY5e16awq4Kn+dL0H/7q5iztG2BQBKfpNEJINrFD3WulOVsMQov8qZ+V4IzLg== X-Received: by 2002:a17:90b:8c9:: with SMTP id ds9mr5972083pjb.11.1583534246658; Fri, 06 Mar 2020 14:37:26 -0800 (PST) Received: from gizo.domain (97-115-106-43.ptld.qwest.net. [97.115.106.43]) by smtp.gmail.com with ESMTPSA id k3sm35939602pgh.34.2020.03.06.14.37.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2020 14:37:26 -0800 (PST) From: Greg Rose To: dev@openvswitch.org Date: Fri, 6 Mar 2020 14:37:14 -0800 Message-Id: <1583534241-16600-3-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> References: <1583534241-16600-1-git-send-email-gvrose8192@gmail.com> Subject: [ovs-dev] [PATCH V4 2/9] compat: Fix up changes to inet frags in 5.1+ X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Since Linux kernel release 5.1 the fragments field of the inet_frag_queue structure is removed and now only the rb_fragments structure with an rb_node pointer is used for both ipv4 and ipv6. In addition, the atomic_sub and atomic_add functions are replaced with their equivalent long counterparts. Acked-by: Yi-Hung Wei Signed-off-by: Greg Rose --- V3 - Use HAVE_CORRECT_MRU_HANDLING instead of less reliable kernel version check for compile time handling of the rb_fragments change. --- acinclude.m4 | 2 ++ datapath/linux/compat/include/net/inet_frag.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 03d3484..3a555ad 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1048,6 +1048,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ [OVS_DEFINE([HAVE_RBTREE_RB_LINK_NODE_RCU])]) OVS_GREP_IFELSE([$KSRC/include/net/dst_ops.h], [bool confirm_neigh], [OVS_DEFINE([HAVE_DST_OPS_CONFIRM_NEIGH])]) + OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [fqdir], + [OVS_DEFINE([HAVE_INET_FRAG_FQDIR])]) if cmp -s datapath/linux/kcompat.h.new \ datapath/linux/kcompat.h >/dev/null 2>&1; then diff --git a/datapath/linux/compat/include/net/inet_frag.h b/datapath/linux/compat/include/net/inet_frag.h index 124c8be..00784da 100644 --- a/datapath/linux/compat/include/net/inet_frag.h +++ b/datapath/linux/compat/include/net/inet_frag.h @@ -12,6 +12,7 @@ #define qp_flags(qp) (qp->q.flags) #endif +#ifndef HAVE_CORRECT_MRU_HANDLING #ifndef HAVE_INET_FRAG_EVICTING static inline bool inet_frag_evicting(struct inet_frag_queue *q) { @@ -22,6 +23,7 @@ static inline bool inet_frag_evicting(struct inet_frag_queue *q) #endif /* HAVE_INET_FRAG_QUEUE_WITH_LIST_EVICTOR */ } #endif /* HAVE_INET_FRAG_EVICTING */ +#endif /* HAVE_CORRECT_MRU_HANDLING */ /* Upstream commit 3fd588eb90bf ("inet: frag: remove lru list") dropped this * function, but we call it from our compat code. Provide a noop version. */ @@ -29,6 +31,10 @@ static inline bool inet_frag_evicting(struct inet_frag_queue *q) #define inet_frag_lru_move(q) #endif +#ifdef HAVE_INET_FRAG_FQDIR +#define netns_frags fqdir +#endif + #ifndef HAVE_SUB_FRAG_MEM_LIMIT_ARG_STRUCT_NETNS_FRAGS #ifdef HAVE_FRAG_PERCPU_COUNTER_BATCH static inline void rpl_sub_frag_mem_limit(struct netns_frags *nf, int i) @@ -45,13 +51,21 @@ static inline void rpl_add_frag_mem_limit(struct netns_frags *nf, int i) #else /* !frag_percpu_counter_batch */ static inline void rpl_sub_frag_mem_limit(struct netns_frags *nf, int i) { +#ifdef HAVE_INET_FRAG_FQDIR + atomic_long_sub(i, &nf->mem); +#else atomic_sub(i, &nf->mem); +#endif } #define sub_frag_mem_limit rpl_sub_frag_mem_limit static inline void rpl_add_frag_mem_limit(struct netns_frags *nf, int i) { +#ifdef HAVE_INET_FRAG_FQDIR + atomic_long_add(i, &nf->mem); +#else atomic_add(i, &nf->mem); +#endif } #define add_frag_mem_limit rpl_add_frag_mem_limit #endif /* frag_percpu_counter_batch */