Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3044585rwe; Mon, 29 Aug 2022 05:04:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Q0aVCP10okHv8n8unwAURSXjju/XwcsQbKrRALeamZeH4qVbfgDio708AXiC+ePf/bjIL X-Received: by 2002:a17:906:9b86:b0:73d:72cf:72af with SMTP id dd6-20020a1709069b8600b0073d72cf72afmr13547857ejc.440.1661774691772; Mon, 29 Aug 2022 05:04:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661774691; cv=none; d=google.com; s=arc-20160816; b=n2dzsYLylQR7S/SJJzFIUpoBflh+L1xz55M1k/1AmtEFd6/tP4hEZQzRONlpnNYYg+ abZZ7upKg+QZ8AyVLnCaa53fM1LUUijispx1/lob4twA24GPmptkUWUS7pTMRayNNf1w k5wQ6WgVbgLd6c0M0cX+ZYEei9FPRA0tFeY4+0p5e1gYjkq0voQtx/8SIcVgxRgfV/GM 1aCY1z2jCAsKCJCUEehfB/8wDmi8VwKRmvk4lZyNit67qgj4W9Ep+Bhsx9XmqJ47LMRY ZKiEZnMay5gI7DSKVkl7eKt+G464sWZEbyUW1M+ekBkAz7dotaCRUYQ+RqPxcDnRkwl5 WJkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version; bh=r5hKr+vpYAGFnRnjaCcClWM6PHOrBvKMYyDAZpDfF6k=; b=MSbz9SxvBgbeAueSRAYCChbwsoOtdhPdOucwv8qHxmMMr6JLYo263aLEu4CTmzwQJS +oOBJJIaf9Z2w1046dFiUbIDEqhX37hbird0LjipyovnsS8XhCayGwnAt1egWgbgTBXZ Zwd1PkW+JCiWUcW5oZbob4d8dBCa7IvGAEX8MMc+qZsgizeIJe6pWvuIE0xiHDDuYwiY lhtd8yBiaMeT9Keh6AGus501dxwLvd6PyOzelHD1Oi82dkpAhGW6t8VtItwOjkMWO80D 0D8p32e8k8xaSy5D0PGByyEH+GJydFiYgacLvCJxXooo2oNEr++aYqxJ1f1C3GYWyKYO SZbQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a056402190c00b00445f21c2b32si8256484edz.132.2022.08.29.05.04.26; Mon, 29 Aug 2022 05:04:51 -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 S230030AbiH2LCW (ORCPT + 99 others); Mon, 29 Aug 2022 07:02:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230033AbiH2LBv (ORCPT ); Mon, 29 Aug 2022 07:01:51 -0400 Received: from mailout-taastrup.gigahost.dk (mailout-taastrup.gigahost.dk [46.183.139.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B87CE1D0C1; Mon, 29 Aug 2022 04:01:31 -0700 (PDT) Received: from mailout.gigahost.dk (mailout.gigahost.dk [89.186.169.112]) by mailout-taastrup.gigahost.dk (Postfix) with ESMTP id 24F0C1884980; Mon, 29 Aug 2022 11:01:29 +0000 (UTC) Received: from smtp.gigahost.dk (smtp.gigahost.dk [89.186.169.109]) by mailout.gigahost.dk (Postfix) with ESMTP id 0C5DA25032B7; Mon, 29 Aug 2022 11:01:29 +0000 (UTC) Received: by smtp.gigahost.dk (Postfix, from userid 1000) id E0ADE9EC0003; Mon, 29 Aug 2022 11:01:28 +0000 (UTC) X-Screener-Id: 413d8c6ce5bf6eab4824d0abaab02863e8e3f662 MIME-Version: 1.0 Date: Mon, 29 Aug 2022 13:01:28 +0200 From: netdev@kapio-technology.com To: Ido Schimmel Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, Florian Fainelli , Andrew Lunn , Vivien Didelot , Vladimir Oltean , Eric Dumazet , Paolo Abeni , Kurt Kanzenbach , Hauke Mehrtens , Woojung Huh , UNGLinuxDriver@microchip.com, Sean Wang , Landen Chao , DENG Qingfang , Matthias Brugger , Claudiu Manoil , Alexandre Belloni , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Nikolay Aleksandrov , Shuah Khan , Christian Marangi , Daniel Borkmann , Yuwei Wang , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, bridge@lists.linux-foundation.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v5 net-next 1/6] net: bridge: add locked entry fdb flag to extend locked port feature In-Reply-To: References: <20220826114538.705433-1-netdev@kapio-technology.com> <20220826114538.705433-2-netdev@kapio-technology.com> User-Agent: Gigahost Webmail Message-ID: <63c78aabe2683b9639717c1a74dbdacc@kapio-technology.com> X-Sender: netdev@kapio-technology.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,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 On 2022-08-27 17:19, Ido Schimmel wrote: > On Fri, Aug 26, 2022 at 01:45:33PM +0200, Hans Schultz wrote: How about this? diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index 1064a5b2d478..82bb50851716 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c @@ -103,8 +103,19 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb br_fdb_find_rcu(br, eth_hdr(skb)->h_source, vid); if (!fdb_src || READ_ONCE(fdb_src->dst) != p || - test_bit(BR_FDB_LOCAL, &fdb_src->flags)) + test_bit(BR_FDB_LOCAL, &fdb_src->flags) || + test_bit(BR_FDB_ENTRY_LOCKED, &fdb_src->flags)) { + if (!fdb_src || ((READ_ONCE(fdb_src->dst) != p) && + (!unlikely(test_bit(BR_FDB_LOCAL, &fdb_src->flags))))) { + unsigned long flags = 0; + + if (p->flags & BR_PORT_MAB) { + __set_bit(BR_FDB_ENTRY_LOCKED, &flags); + br_fdb_update(br, p, eth_hdr(skb)->h_source, vid, flags); + } + } goto drop; + } } nbp_switchdev_frame_mark(p, skb); It will allow roaming to a MAB enabled port (no roaming to a simply locked port should be allowed of course), and it will not change a local entry and not rely on 'learning on' on the locked port of course. Roaming to an unlocked port will also be allowed, and the locked flag will be removed in this case according to code in br_fdb_update().