Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp196880ioo; Thu, 26 May 2022 01:20:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxndCaPpITUcH5llan0RNcA/lIk9zHPcyVRV2Yz8Ss1Sz0UHfIMn0SFUBrWK+onklGm8lJt X-Received: by 2002:a17:907:d86:b0:6ff:1557:a080 with SMTP id go6-20020a1709070d8600b006ff1557a080mr5577072ejc.678.1653553257426; Thu, 26 May 2022 01:20:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653553257; cv=none; d=google.com; s=arc-20160816; b=jR4GuCZOx9/+ifU2YZ0jAe/5cj3R0RY2eWR9fi0jK1xKtubj0P0YnmhdDhUjfEZ/Fp kfPcXLb01yGcen2DKNftp11yoxYPdy9FBycQBSR5c3V+ulBvY+ntswNWbpeZPvsBZWmU nL+IfiLTMkCtYwbfQ1oSPDuMtDn0dGSu2hlZ2d5BfdGQTxkgCmGlKkK1iRogXD4LsK9G Udw64AOVbZlLz0IGjEe1NuQZMcblHEmk34r1xkv8DTbakREW/iXINr0CorplvL73PEXw 3epRDVmfibOIOCUAuPMp7de6nR46pWqMQe41Jnl5wsDFKj54tQAVS4xe2AOlKEoKJc6l g17Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=5L0FJw8nrreK+iWXw2F3MaAOrCQpmilHML/7HPSt5+4=; b=nZb4iPyWJXb5O/SCshfMGG6o/jaGb9nukd5UMlj19lDftEntRh03dhoXk3fmmXE5h2 PkBFoJSeXGZDueF2a0ezs88iUWlRpiy6gRhw4upTz3qPYhklOXaiMBuwvcBzOdpa41bv Vp6DLrqebk7NOEpoPJ5H5AuNgMOcUVcmkAijENRpUr33kIkXCES+Y95sOSQQfYtkgxf5 tYer0DtLKs1lLO+u3bIMPOMb9knw+m5tdJc2Gd15y1dck7AThLoSqAhA4VvB197vY2Ix fCUqTYtV8UXSEhJ43JanXzNE5U1xVPjiiXDp713iIMwSKC/D5zdVZIXKtEU59ZhZwD9S aQMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=azwYnsS6; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm14-20020a170907948e00b006feb7057e87si974631ejc.438.2022.05.26.01.20.28; Thu, 26 May 2022 01:20:57 -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=@gmail.com header.s=20210112 header.b=azwYnsS6; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234671AbiEYIen (ORCPT + 99 others); Wed, 25 May 2022 04:34:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234809AbiEYIej (ORCPT ); Wed, 25 May 2022 04:34:39 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18E0910FC7; Wed, 25 May 2022 01:34:31 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id c19so21767052lfv.5; Wed, 25 May 2022 01:34:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=5L0FJw8nrreK+iWXw2F3MaAOrCQpmilHML/7HPSt5+4=; b=azwYnsS6jJEQvSuK4hoXH6WieSqwBE2dO+Bdu6YXtPBvcuUmTfpC2qwzKvfRSAGzKe AywA5P/AgCEHA+hSDE09wNNIxJeazza54hvRtKsM0KHE9XkEoUECPoherZUTjO/quYLX Ia/SRkqrRtnoKqZUnvfJDwwtnDjK4AWeTkS5oTNe/kttqS2+ML3Ah3K8aCLre0PQ/WsB FLtIyd+3n8Ag8VLjPa5MMsnq6nMbmdQGOMUy8F5fLL1tf6aShTHh97UcbwtSsm4BnOQ0 kr5CBdH2eljtkZpg56jZHdcWO1mU1QK+FEeFMv1xX9ebJkDih3+MTRBgbslM8CaHJyNz Ic+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=5L0FJw8nrreK+iWXw2F3MaAOrCQpmilHML/7HPSt5+4=; b=1CSK69JoRM5hvyRnxfsxL3lPVhZfrKJP87byRvPy7CRydgS8xKuoJbWXXAL159HtuI Dx/y8R0NnyzvxJSKegwdzT7wPBP3eL/BV71HFDYshWjbtOCpwSuaZnXRlHkkYnRzHHTJ ZN2oHSqq5qlnJrD/BNMOn+xY9KRglPYLuaaET47OjQ7vhzX8TBabO7PooyrnVi1XqtrR 38RmrcuOD391hhDcwlz3yAXRVTLlfXHXBwQkpRbXt6Zg75bmI2x0RsxSs4HDj3k9g2Pa 7+MjkOjCTxyJEH9u4tQU/j9cNmM/CH4Vui4OpIDYTkiesVywfFXCWYDvLB8SQ8u+CGpz uKZw== X-Gm-Message-State: AOAM5331Xo+YFIOeLlBkow/c++O9p6Pf4t27ZvGy8AlHpDh68iHSb2MI RDrvip6RsHSqBJ+rMfo746WuWZvRGWRDQA== X-Received: by 2002:ac2:548e:0:b0:477:c2fa:b18e with SMTP id t14-20020ac2548e000000b00477c2fab18emr21744727lfk.269.1653467669317; Wed, 25 May 2022 01:34:29 -0700 (PDT) Received: from wse-c0127 (2-104-116-184-cable.dk.customer.tdc.net. [2.104.116.184]) by smtp.gmail.com with ESMTPSA id i22-20020a2e8096000000b00250664c906asm2972324ljg.133.2022.05.25.01.34.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 May 2022 01:34:28 -0700 (PDT) From: Hans Schultz X-Google-Original-From: Hans Schultz To: Nikolay Aleksandrov , Hans Schultz , davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Eric Dumazet , Paolo Abeni , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Shuah Khan , Daniel Borkmann , Ido Schimmel , linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH V3 net-next 1/4] net: bridge: add fdb flag to extent locked port feature In-Reply-To: References: <20220524152144.40527-1-schultz.hans+netdev@gmail.com> <20220524152144.40527-2-schultz.hans+netdev@gmail.com> <01e6e35c-f5c9-9776-1263-058f84014ed9@blackwall.org> <86zgj6oqa9.fsf@gmail.com> Date: Wed, 25 May 2022 10:34:27 +0200 Message-ID: <86fskyggdo.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 On ons, maj 25, 2022 at 11:06, Nikolay Aleksandrov wrote: > On 24/05/2022 19:21, Hans Schultz wrote: >>> >>> Hi Hans, >>> So this approach has a fundamental problem, f->dst is changed without any synchronization >>> you cannot rely on it and thus you cannot account for these entries properly. We must be very >>> careful if we try to add any new synchronization not to affect performance as well. >>> More below... >>> >>>> @@ -319,6 +326,9 @@ static void fdb_delete(struct net_bridge *br, struct net_bridge_fdb_entry *f, >>>> if (test_bit(BR_FDB_STATIC, &f->flags)) >>>> fdb_del_hw_addr(br, f->key.addr.addr); >>>> >>>> + if (test_bit(BR_FDB_ENTRY_LOCKED, &f->flags) && !test_bit(BR_FDB_OFFLOADED, &f->flags)) >>>> + atomic_dec(&f->dst->locked_entry_cnt); >>> >>> Sorry but you cannot do this for multiple reasons: >>> - f->dst can be NULL >>> - f->dst changes without any synchronization >>> - there is no synchronization between fdb's flags and its ->dst >>> >>> Cheers, >>> Nik >> >> Hi Nik, >> >> if a port is decoupled from the bridge, the locked entries would of >> course be invalid, so maybe if adding and removing a port is accounted >> for wrt locked entries and the count of locked entries, would that not >> work? >> >> Best, >> Hans > > Hi Hans, > Unfortunately you need the correct amount of locked entries per-port if you want > to limit their number per-port, instead of globally. So you need a > consistent Hi Nik, the used dst is a port structure, so it is per-port and not globally. Best, Hans > fdb view with all its attributes when changing its dst in this case, which would > require new locking because you have multiple dependent struct fields and it will > kill roaming/learning scalability. I don't think this use case is worth the complexity it > will bring, so I'd suggest an alternative - you can monitor the number of locked entries > per-port from a user-space agent and disable port learning or some similar solution that > doesn't require any complex kernel changes. Is the limit a requirement to add the feature? > > I have an idea how to do it and to minimize the performance hit if it really is needed > but it'll add a lot of complexity which I'd like to avoid if possible. > > Cheers, > Nik