From patchwork Sat Mar 18 14:10:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Schultz X-Patchwork-Id: 71612 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp318349wrt; Sat, 18 Mar 2023 07:39:15 -0700 (PDT) X-Google-Smtp-Source: AK7set/orVhoB/DaOKtRi+/XEijawJ3TLho5M54fdduqBYD/3Cmeo5+qTytcY7Wbfa9hsATX+h9E X-Received: by 2002:a17:902:9b8c:b0:1a1:bb4e:4eb8 with SMTP id y12-20020a1709029b8c00b001a1bb4e4eb8mr1253448plp.62.1679150355158; Sat, 18 Mar 2023 07:39:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679150355; cv=none; d=google.com; s=arc-20160816; b=Moj2Lo/fNYB63JjZPzhMfWsjbbHaYZFRHWvm2XVgVpbnGYf5FwZ/e31dm1JFEgmjnG 3jzOABb8xxx1+qV7HmnszOPbn+vACpyghQrKxO7cG/l90H59HvXvlPkFd+gIzbtEN7kA lkMBAq1yJSqQ/nSOpHRJOAeMUdXePWUqlaxrISxCv4AS3wz3+fpglQ8R2KWXC8Et9I7O tYytU37qbR0aJk5+3yM6F2NQ0IhYNn199emjsfbuqrygtFoM1AgoQMie/VkF8gL88Du2 u+cYaAhwmrxFL/1PhjCOXIcPdWBhMXQ08jMCGv4yaDHv/SqlTSdC5myzimNn7Sjw0yl7 wJIA== 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=BbWDgyN+T/IWgpiK28cLuEK8688XpKz2pZch18oBRy8HRspBdNZzk103/aD4yo8vqf xJyrfYa3wJrqU5COvKltw8iq/A6MzzP5Vv7KIk7SXtxYCJ1TdozFCqwDB024hzSizfH5 SWYr7M18j0H3DDBqbiPaxWcLrlvA/idBXSX6jpKsw+XIpdYUI/6OQSiTpPiRtn80s/xy hhItlDH31Llu07If55qtrWBtLClY86npQeTVeTRAYAipZNtxFIPF8ZNSVjuUOS2mXSvq aw2FA2qzApqXezA4ibn4OQmYZvMU7JI3XuTpYkllqbliCSZkryJ3BPs7Fh8/CXzfcm9o TNtQ== 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 s5-20020a63e805000000b00502effd3bb9si5586567pgh.521.2023.03.18.07.38.58; Sat, 18 Mar 2023 07:39:15 -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; 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 S230019AbjCROZB (ORCPT + 99 others); Sat, 18 Mar 2023 10:25:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229978AbjCROYq (ORCPT ); Sat, 18 Mar 2023 10:24:46 -0400 Received: from mailout-taastrup.gigahost.dk (mailout-taastrup.gigahost.dk [46.183.139.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E7B837B78; Sat, 18 Mar 2023 07:24:39 -0700 (PDT) Received: from mailout.gigahost.dk (mailout.gigahost.dk [89.186.169.112]) by mailout-taastrup.gigahost.dk (Postfix) with ESMTP id 8520218839B7; Sat, 18 Mar 2023 14:12:45 +0000 (UTC) Received: from smtp.gigahost.dk (smtp.gigahost.dk [89.186.169.109]) by mailout.gigahost.dk (Postfix) with ESMTP id 7E31C25002BC; Sat, 18 Mar 2023 14:12:45 +0000 (UTC) Received: by smtp.gigahost.dk (Postfix, from userid 1000) id 716189B403E4; Sat, 18 Mar 2023 14:12:45 +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 B03CA9B403E1; Sat, 18 Mar 2023 14:12:44 +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 , AngeloGioacchino Del Regno , Claudiu Manoil , Alexandre Belloni , =?utf-8?b?Q2zDqW1lbnQg?= =?utf-8?b?TMOpZ2Vy?= , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Nikolay Aleksandrov , Shuah Khan , Christian Marangi , Ido Schimmel , 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), linux-kselftest@vger.kernel.org (open list:KERNEL SELFTEST FRAMEWORK) Subject: [PATCH v2 net-next 4/6] net: bridge: ensure FDB offloaded flag is handled as needed Date: Sat, 18 Mar 2023 15:10:08 +0100 Message-Id: <20230318141010.513424-5-netdev@kapio-technology.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230318141010.513424-1-netdev@kapio-technology.com> References: <20230318141010.513424-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?1760716762973275044?= X-GMAIL-MSGID: =?utf-8?q?1760716762973275044?= 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;