Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3053753rwe; Mon, 29 Aug 2022 05:12:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR5WXOIBDjLKtULKvxSWgDtQwoxklKkLnjhmOGl6/1r2IVzgA9eYbJ+KnyzbbH2yRshROSFl X-Received: by 2002:a63:1546:0:b0:42c:50dc:2115 with SMTP id 6-20020a631546000000b0042c50dc2115mr1510438pgv.613.1661775141126; Mon, 29 Aug 2022 05:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661775141; cv=none; d=google.com; s=arc-20160816; b=anVUbrt44ZShyUmeHaIUnQCBKwnrXaLWZuRpnwhXBfwO8gqxrkjGIFUglUqtzYKB0Y bECit7JzpgNjej0bi0VXlYQozbGHkoNjCQXdSI8ZiPHt7u9L+dAMhxSyfeQiXAYkfJpS 0zfBj1RQvUGZOtEAIvidujYFpXVXp8YcnSw5mdb0Z0I73MkuZPfEHcei6DeJmcVLrAeh hcftZdeYBFmN3hiwdcwEXrTb0ch9lF3hZ8eRblJdrBjJ7eyQJB9U1UqnaoitJbDUWJw5 xwmXt93yGDNnXwBnF8/n2FhXC78JYsHesc67SlHnBaRv+i60GhkosKjUqcadikkNTTz9 GkQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/Irw2iY3xCdd0TxloP0DHica/HlsH44m7vhSepS8qUg=; b=LgYGmGcFFGtwOq9k4vMt3/CPaCU3NP2Ioth0a77EMZlgmjSZhxoNDA/SvCCP/6Ct3T 6tPiGckL0Nu7Efq/jxSukwDPDaSXeznheWTCw0w5Cdr231AHrzpfUikCpiBXNPDFT81/ IFrE586IOAcpRVqoLlRt9JEvKSh7qUEaJ7q0BXqnUh6vhT2AmVEmJKBrdUglI2YZOBHf 3wLgPg9XPN9V/z4ytor684rqUUdgrptLX/0BE1t116Eu8ilxo9MMIgIywf0IG5rRVXJK ji3R8JXv2LYf036EOrB9GYU1pCtVCpxvJQAnHGD59TOk3sasW6H8zXOml1dwvV+uUO6Q kzkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D4zo4Azb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o4-20020a17090a0a0400b001fb86ec7febsi8852622pjo.134.2022.08.29.05.12.01; Mon, 29 Aug 2022 05:12:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D4zo4Azb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231980AbiH2LZT (ORCPT + 99 others); Mon, 29 Aug 2022 07:25:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231899AbiH2LXj (ORCPT ); Mon, 29 Aug 2022 07:23:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2051D21B0; Mon, 29 Aug 2022 04:14:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1C66BB80FAF; Mon, 29 Aug 2022 11:14:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71E3EC433D6; Mon, 29 Aug 2022 11:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771685; bh=DB3AT2IlIwSAIYhJM/lAlW92OBQo093rsc1IbSXg7mY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D4zo4AzbNvO0XdmzT/M9rsMYoWs7Nu9iPb5iKzlSsd88lazycSH/gNeVNbtYNtN03 3kI6tp6hkbZhIiukkabZkNvmKhm5BLervgek2h1J5n+ejeaScbHeKenEhr8KKtti3A FmQGDrPoLhxu0zwkJRzQkWO7CO0wTbPXv6pNB5lU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.19 063/158] netfilter: flowtable: add function to invoke garbage collection immediately Date: Mon, 29 Aug 2022 12:58:33 +0200 Message-Id: <20220829105811.360293628@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105808.828227973@linuxfoundation.org> References: <20220829105808.828227973@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pablo Neira Ayuso [ Upstream commit 759eebbcfafcefa23b59e912396306543764bd3c ] Expose nf_flow_table_gc_run() to force a garbage collector run from the offload infrastructure. Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- include/net/netfilter/nf_flow_table.h | 1 + net/netfilter/nf_flow_table_core.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h index 64daafd1fc41c..32c25122ab184 100644 --- a/include/net/netfilter/nf_flow_table.h +++ b/include/net/netfilter/nf_flow_table.h @@ -270,6 +270,7 @@ void flow_offload_refresh(struct nf_flowtable *flow_table, struct flow_offload_tuple_rhash *flow_offload_lookup(struct nf_flowtable *flow_table, struct flow_offload_tuple *tuple); +void nf_flow_table_gc_run(struct nf_flowtable *flow_table); void nf_flow_table_gc_cleanup(struct nf_flowtable *flowtable, struct net_device *dev); void nf_flow_table_cleanup(struct net_device *dev); diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c index f2def06d10709..18453fa25199c 100644 --- a/net/netfilter/nf_flow_table_core.c +++ b/net/netfilter/nf_flow_table_core.c @@ -442,12 +442,17 @@ static void nf_flow_offload_gc_step(struct nf_flowtable *flow_table, } } +void nf_flow_table_gc_run(struct nf_flowtable *flow_table) +{ + nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, NULL); +} + static void nf_flow_offload_work_gc(struct work_struct *work) { struct nf_flowtable *flow_table; flow_table = container_of(work, struct nf_flowtable, gc_work.work); - nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, NULL); + nf_flow_table_gc_run(flow_table); queue_delayed_work(system_power_efficient_wq, &flow_table->gc_work, HZ); } @@ -606,10 +611,11 @@ void nf_flow_table_free(struct nf_flowtable *flow_table) cancel_delayed_work_sync(&flow_table->gc_work); nf_flow_table_iterate(flow_table, nf_flow_table_do_cleanup, NULL); - nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, NULL); + nf_flow_table_gc_run(flow_table); nf_flow_table_offload_flush(flow_table); if (nf_flowtable_hw_offload(flow_table)) - nf_flow_table_iterate(flow_table, nf_flow_offload_gc_step, NULL); + nf_flow_table_gc_run(flow_table); + rhashtable_destroy(&flow_table->rhashtable); } EXPORT_SYMBOL_GPL(nf_flow_table_free); -- 2.35.1