From patchwork Tue Jan 17 18:57:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Schultz X-Patchwork-Id: 44798 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1976902wrn; Tue, 17 Jan 2023 12:57:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXv1/tPwc+mbv9MrgWIj6R69/FfRXu+Eos1nElvwIRe2Qx4fNF8+hEu7uDN+INbnXI6i08pV X-Received: by 2002:a17:902:a70f:b0:192:751d:b2e4 with SMTP id w15-20020a170902a70f00b00192751db2e4mr4732126plq.48.1673989024860; Tue, 17 Jan 2023 12:57:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673989024; cv=none; d=google.com; s=arc-20160816; b=err47k+ShROQAnd5YZ032TWn4GVj6v487jsim8QMOTGx+oihbSjvLQNF42zpz6l0mi EXTRjsf7B+g3cEW4O7v0ybWMHJrY4SJb7WW/s0KZBhypSoi/0hBrUrvWuPanF5XdMFsy Mq4/YLhPxn3umYWAXD/YFD/UTQgNOg4ClDwPEwehN9MUrPaGQPWf3yPtUvz/w2WdxA+V w46RYxN0H4yYfBicgb6gVLBvhonWi3WYGDRIWJmf7Z8P6O+U2G4JCdtvRejjEbYXKbQt tdlwJFm+2+gAzPak6FbCCb1wzgfcLrjl/AW57iCw/rVnWoLq1xu5167XDzr8FnJHWfqg wOaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=kr7hOd6c8hT924R9Kmj87tFZQb5RQTTidtVqB6Z9AKQ=; b=Xz7FhDFPKbT/Uo/t4BM6HVqyGYLRNvtyvUrojxC/ps/htl38CcDUh87peMyL9yoe1p 8W5wu7Xr0mkwgYKMhjZpCNC2qrcpbRrnZtGLRu7gGrcDLJRifTBkhh09owkmIZtCfYG6 tI2bdXIwGbrs+liKd0dsDXOt58KmfACuL1vIGTwOwgk89A2k9xhwe9mMV6pFBxs+PmUC i96g4d4VT+HzO4atV5H8zGQFht3J0FI4alZ6b538wQ+xZeXR4hPr6zdrgC1aqYyAlwWo NZXjI1zWQriOKOsQG6UUXcc0gMYwLQCmZq5tu0U8Dp18EWmZBpjhMiRW2Dv1dx6KaF1B qJeQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i9-20020a170902c94900b001948b5c904bsi9872145pla.314.2023.01.17.12.56.53; Tue, 17 Jan 2023 12:57:04 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229517AbjAQU4K (ORCPT + 99 others); Tue, 17 Jan 2023 15:56:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231338AbjAQUxY (ORCPT ); Tue, 17 Jan 2023 15:53:24 -0500 Received: from mailout-taastrup.gigahost.dk (mailout-taastrup.gigahost.dk [46.183.139.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1FC1683F5; Tue, 17 Jan 2023 11:25:42 -0800 (PST) Received: from mailout.gigahost.dk (mailout.gigahost.dk [89.186.169.112]) by mailout-taastrup.gigahost.dk (Postfix) with ESMTP id F2A8418836BA; Tue, 17 Jan 2023 18:59:14 +0000 (UTC) Received: from smtp.gigahost.dk (smtp.gigahost.dk [89.186.169.109]) by mailout.gigahost.dk (Postfix) with ESMTP id E0A58250007B; Tue, 17 Jan 2023 18:59:14 +0000 (UTC) Received: by smtp.gigahost.dk (Postfix, from userid 1000) id D3B309EC000B; Tue, 17 Jan 2023 18:59:14 +0000 (UTC) X-Screener-Id: 413d8c6ce5bf6eab4824d0abaab02863e8e3f662 Received: from fujitsu.vestervang (2-104-116-184-cable.dk.customer.tdc.net [2.104.116.184]) by smtp.gigahost.dk (Postfix) with ESMTPSA id 325C791201E3; Tue, 17 Jan 2023 18:59:14 +0000 (UTC) From: "Hans J. Schultz" To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, "Hans J. Schultz" , Florian Fainelli , Andrew Lunn , Vladimir Oltean , Eric Dumazet , Paolo Abeni , Kurt Kanzenbach , Hauke Mehrtens , Woojung Huh , UNGLinuxDriver@microchip.com (maintainer:MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER), Sean Wang , Landen Chao , DENG Qingfang , Matthias Brugger , Claudiu Manoil , Alexandre Belloni , =?utf-8?b?Q2zDqW1lbnQg?= =?utf-8?b?TMOpZ2Vy?= , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Nikolay Aleksandrov , Russell King , Christian Marangi , linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support), linux-renesas-soc@vger.kernel.org (open list:RENESAS RZ/N1 A5PSW SWITCH DRIVER), bridge@lists.linux-foundation.org (moderated list:ETHERNET BRIDGE) Subject: [RFC PATCH net-next 4/5] net: bridge: ensure FDB offloaded flag is handled as needed Date: Tue, 17 Jan 2023 19:57:13 +0100 Message-Id: <20230117185714.3058453-5-netdev@kapio-technology.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230117185714.3058453-1-netdev@kapio-technology.com> References: <20230117185714.3058453-1-netdev@kapio-technology.com> MIME-Version: 1.0 Organization: Westermo Network Technologies AB X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755304715664768583?= X-GMAIL-MSGID: =?utf-8?q?1755304715664768583?= Since user added entries in the bridge FDB will get the BR_FDB_OFFLOADED flag set, we do not want the bridge to age those entries and we want the entries to be deleted in the bridge upon an SWITCHDEV_FDB_DEL_TO_BRIDGE event. Signed-off-by: Hans J. Schultz --- net/bridge/br_fdb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index e69a872bfc1d..b0c23a72bc76 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -537,6 +537,7 @@ void br_fdb_cleanup(struct work_struct *work) unsigned long this_timer = f->updated + delay; if (test_bit(BR_FDB_STATIC, &f->flags) || + test_bit(BR_FDB_OFFLOADED, &f->flags) || test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &f->flags)) { if (test_bit(BR_FDB_NOTIFY, &f->flags)) { if (time_after(this_timer, now)) @@ -1465,7 +1466,9 @@ int br_fdb_external_learn_del(struct net_bridge *br, struct net_bridge_port *p, spin_lock_bh(&br->hash_lock); fdb = br_fdb_find(br, addr, vid); - if (fdb && test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags)) + if (fdb && + (test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags) || + test_bit(BR_FDB_OFFLOADED, &fdb->flags))) fdb_delete(br, fdb, swdev_notify); else err = -ENOENT;