From patchwork Wed Jul 7 15:12:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bodong Wang X-Patchwork-Id: 1501808 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GKjc872rlz9t0k; Thu, 8 Jul 2021 01:13:28 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1m19Eq-0001pf-9W; Wed, 07 Jul 2021 15:13:24 +0000 Received: from mail-il-dmz.mellanox.com ([193.47.165.129] helo=mellanox.co.il) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1m19EZ-0001kV-Lt for kernel-team@lists.ubuntu.com; Wed, 07 Jul 2021 15:13:07 +0000 Received: from Internal Mail-Server by MTLPINE1 (envelope-from bodong@nvidia.com) with SMTP; 7 Jul 2021 18:13:03 +0300 Received: from sw-mtx-016.mtx.labs.mlnx. (sw-mtx-016.mtx.labs.mlnx [10.9.150.102]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 167FCwEg031030; Wed, 7 Jul 2021 18:13:02 +0300 From: Bodong Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][F:linux-bluefield][PATCH v2 2/5] Revert "UBUNTU: SAUCE: netfilter: flowtable: Control flow timeout interval" Date: Wed, 7 Jul 2021 10:12:55 -0500 Message-Id: <1625670778-30586-3-git-send-email-bodong@nvidia.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1625670778-30586-1-git-send-email-bodong@nvidia.com> References: <1625670778-30586-1-git-send-email-bodong@nvidia.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vlad@nvidia.com, ozsh@nvidia.com, danielj@nvidia.com, maord@nvidia.com MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Oz Shlomo BugLink: https://launchpad.net/bugs/1934401 This reverts commit ceec84149d95890b4a78039437b6832e6c345bba. Replaced with upstream series: https://lore.kernel.org/netdev/20210609214523.1678-1-pablo@netfilter.org/ Signed-off-by: Oz Shlomo Signed-off-by: Bodong Wang --- include/net/netfilter/nf_flow_table.h | 8 +------- net/netfilter/nf_flow_table_core.c | 10 ++-------- net/netfilter/nf_flow_table_offload.c | 5 ++--- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h index ba3b58a..acd8507 100644 --- a/include/net/netfilter/nf_flow_table.h +++ b/include/net/netfilter/nf_flow_table.h @@ -74,7 +74,6 @@ struct nf_flowtable { unsigned int flags; struct flow_block flow_block; struct rw_semaphore flow_block_lock; /* Guards flow_block */ - u32 flow_timeout; possible_net_t net; }; @@ -143,7 +142,7 @@ struct flow_offload { struct rcu_head rcu_head; }; -#define NF_DEFAULT_FLOW_TIMEOUT (30 * HZ) +#define NF_FLOW_TIMEOUT (30 * HZ) #define nf_flowtable_time_stamp (u32)jiffies static inline __s32 nf_flow_timeout_delta(unsigned int timeout) @@ -151,11 +150,6 @@ static inline __s32 nf_flow_timeout_delta(unsigned int timeout) return (__s32)(timeout - nf_flowtable_time_stamp); } -static inline __s32 nf_flow_offload_timeout(struct nf_flowtable *flow_table) -{ - return flow_table->flow_timeout; -} - struct nf_flow_route { struct { struct dst_entry *dst; diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c index 2405eac..080dfea 100644 --- a/net/netfilter/nf_flow_table_core.c +++ b/net/netfilter/nf_flow_table_core.c @@ -225,8 +225,7 @@ int flow_offload_add(struct nf_flowtable *flow_table, struct flow_offload *flow) { int err; - flow->timeout = nf_flowtable_time_stamp + - nf_flow_offload_timeout(flow_table); + flow->timeout = nf_flowtable_time_stamp + NF_FLOW_TIMEOUT; err = rhashtable_insert_fast(&flow_table->rhashtable, &flow->tuplehash[0].node, @@ -258,8 +257,7 @@ int flow_offload_add(struct nf_flowtable *flow_table, struct flow_offload *flow) void flow_offload_refresh(struct nf_flowtable *flow_table, struct flow_offload *flow) { - flow->timeout = nf_flowtable_time_stamp + - nf_flow_offload_timeout(flow_table); + flow->timeout = nf_flowtable_time_stamp + NF_FLOW_TIMEOUT; if (likely(!nf_flowtable_hw_offload(flow_table))) return; @@ -511,10 +509,6 @@ int nf_flow_table_init(struct nf_flowtable *flowtable) { int err; - flowtable->flow_timeout = flowtable->flow_timeout ? - flowtable->flow_timeout * HZ : - NF_DEFAULT_FLOW_TIMEOUT; - INIT_DEFERRABLE_WORK(&flowtable->gc_work, nf_flow_offload_work_gc); flow_block_init(&flowtable->flow_block); init_rwsem(&flowtable->flow_block_lock); diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c index ad705ca..afc6cd1 100644 --- a/net/netfilter/nf_flow_table_offload.c +++ b/net/netfilter/nf_flow_table_offload.c @@ -786,7 +786,6 @@ static void flow_offload_tuple_stats(struct flow_offload_work *offload, static void flow_offload_work_stats(struct flow_offload_work *offload) { - u64 flow_timeout = nf_flow_offload_timeout(offload->flowtable); struct flow_stats stats[FLOW_OFFLOAD_DIR_MAX] = {}; u64 lastused; @@ -795,7 +794,7 @@ static void flow_offload_work_stats(struct flow_offload_work *offload) lastused = max_t(u64, stats[0].lastused, stats[1].lastused); offload->flow->timeout = max_t(u64, offload->flow->timeout, - lastused + flow_timeout); + lastused + NF_FLOW_TIMEOUT); /* Clear HW_OFFLOAD right away when hw module is removed. */ if (!lastused) clear_bit(IPS_HW_OFFLOAD_BIT, &offload->flow->ct->status); @@ -897,7 +896,7 @@ void nf_flow_offload_stats(struct nf_flowtable *flowtable, __s32 delta; delta = nf_flow_timeout_delta(flow->timeout); - if ((delta >= (9 * nf_flow_offload_timeout(flowtable)) / 10)) + if ((delta >= (9 * NF_FLOW_TIMEOUT) / 10)) return; offload = nf_flow_offload_work_alloc(flowtable, flow, FLOW_CLS_STATS);