From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51C55C4321E for ; Wed, 2 Nov 2022 18:52:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231682AbiKBSwY (ORCPT ); Wed, 2 Nov 2022 14:52:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231336AbiKBSwV (ORCPT ); Wed, 2 Nov 2022 14:52:21 -0400 Received: from mail.netfilter.org (mail.netfilter.org [217.70.188.207]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9B196CEF; Wed, 2 Nov 2022 11:52:20 -0700 (PDT) Date: Wed, 2 Nov 2022 19:52:14 +0100 From: Pablo Neira Ayuso To: Michael Lilja Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Jozsef Kadlecsik , Florian Westphal , netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org Subject: Re: [PATCH] Periodically flow expire from flow offload tables Message-ID: References: <20221023171658.69761-1-michael.lilja@gmail.com> <381FF5B6-4FEF-45E9-92D6-6FE927A5CC2D@gmail.com> <25246B91-B5BE-43CA-9D98-67950F17F0A1@gmail.com> <03E5D5FA-5A0D-4E5A-BA32-3FE51764C02E@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <03E5D5FA-5A0D-4E5A-BA32-3FE51764C02E@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 26, 2022 at 09:40:11PM +0200, Michael Lilja wrote: > Hi, > > I just quickly tried following the flow_offload_teardown() path instead of clearing IPS_OFFLOAD in flow_offload_del() and it does have some side effects. The flow is added again before the HW has actually reported it to be NF_FLOW_HW_DEAD. > > The sequence with my patch is: > : Retire -> Remove from hw tables -> Remove from sw tables -> kfree(flow) -> flow_offload_add() > > But if flow_offload_teardown() is called on expire I see: > : Retire -> Remove from hw tables -> flow_offload_add() -> Remove from sw tables -> kfree(flow) > > I need to investigate why this happens, maybe the IPS_OFFLOAD flag is cleared too early and should not be cleared until the flow is actually removed, like I do? Maybe the issue is not seen before because on timeout or flow_is_dying() no packet arrive to create the flow again prematurely? Hm, IPS_OFFLOAD should be cleared from flow_offload_del() then, it is cleared too early. I'll post a fix for nf.git first then I propose to follow up on this flowtable feature. I'll keep you on Cc.