Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp83677rwb; Wed, 18 Jan 2023 14:31:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXvstlkxkY8Gf3QrXzXVJkeddmKeaR7z4kzQui4mPODdXivSeXFY9/qjt+c8tn8vS48nD20i X-Received: by 2002:a17:90a:e647:b0:229:5b13:d850 with SMTP id ep7-20020a17090ae64700b002295b13d850mr8630328pjb.5.1674081064376; Wed, 18 Jan 2023 14:31:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674081064; cv=none; d=google.com; s=arc-20160816; b=edEkv3SkNGUBhcOgZZYJrmyIjyPl+zPWYl67enSScmKhuksp8XeRQ3I/DgkaGgS7yR IDrVp5VdxQGk+8d+WpjKdRzh2e07dDs2FA9edBQZL+XuSvxe1/xrIZDev2Yx4pwnVny3 BoV+8kANyYe68372W9wgoV25WyQ689hJaGoIxU+mICz+8Q/8cENAtMdNpwHnE+re8B8F ohHt97ys29XWlSHQXRAaLa2mbo7/vMuHMSqP4NE8BT7uicFekOSn41m2jJqBWuD/tsMG SmGWU1x0VxXWQDCSsd102ZUuMRHNH9BcBWY1KFfbzp1GvIJ4auVZQSzhfQF365hMP7Ye 5jYA== 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=cTQgcL8EA+KJ6qskhiBYZhFxfQIcNHSpD8+7n6ObB1s=; b=itBLIIlJsCTiHxhaYuQ5RNf6uYtW5HO3FMt2RArBah7a/DtDB7aiNFRAQZ90ScKesn UaEuOQU8x8V8McLnz2P8iPEbH/x1NIjtKZ/rR4uuCZvIvt3ZNQHEgLkdn/29SeKAqjnG Ib84t9PfuPQpA+lZdXgiO7HlqMfqr7HL7RliMZVFLfAMU5Mzg/a6CJDsLqZDc8HdSthQ K7HtKQdMzNshQ+M88NSPmt/VmsD407PLY6vHT0VSpAbesJpaEhmNc7NwDtaYezVxG96D lRs6qlB2ysuatasbbS0OPZHXN3MBShhc0N9tSQsA+NHSU4N87e6Er8m/JWZU60AvFqNf pg+g== 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 ok5-20020a17090b1d4500b00225df1d0cfdsi3301696pjb.147.2023.01.18.14.30.57; Wed, 18 Jan 2023 14:31: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 S229620AbjARWOH (ORCPT + 44 others); Wed, 18 Jan 2023 17:14:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjARWOF (ORCPT ); Wed, 18 Jan 2023 17:14:05 -0500 Received: from mailout-taastrup.gigahost.dk (mailout-taastrup.gigahost.dk [46.183.139.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2FD864682; Wed, 18 Jan 2023 14:14:02 -0800 (PST) Received: from mailout.gigahost.dk (mailout.gigahost.dk [89.186.169.112]) by mailout-taastrup.gigahost.dk (Postfix) with ESMTP id CB2F818837A5; Wed, 18 Jan 2023 22:14:00 +0000 (UTC) Received: from smtp.gigahost.dk (smtp.gigahost.dk [89.186.169.109]) by mailout.gigahost.dk (Postfix) with ESMTP id BAF2B25003AB; Wed, 18 Jan 2023 22:14:00 +0000 (UTC) Received: by smtp.gigahost.dk (Postfix, from userid 1000) id A73C791201E4; Wed, 18 Jan 2023 22:14:00 +0000 (UTC) X-Screener-Id: 413d8c6ce5bf6eab4824d0abaab02863e8e3f662 MIME-Version: 1.0 Date: Wed, 18 Jan 2023 23:14:00 +0100 From: netdev@kapio-technology.com To: Vladimir Oltean Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, Florian Fainelli , Andrew Lunn , Eric Dumazet , Paolo Abeni , Kurt Kanzenbach , Hauke Mehrtens , Woojung Huh , "maintainer:MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER" , Sean Wang , Landen Chao , DENG Qingfang , Matthias Brugger , Claudiu Manoil , Alexandre Belloni , =?UTF-8?Q?Cl=C3=A9ment_L=C3=A9ger?= , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Nikolay Aleksandrov , Russell King , Christian Marangi , open list , "moderated list:ARM/Mediatek SoC support" , "moderated list:ARM/Mediatek SoC support" , "open list:RENESAS RZ/N1 A5PSW SWITCH DRIVER" , "moderated list:ETHERNET BRIDGE" Subject: Re: [RFC PATCH net-next 1/5] net: bridge: add dynamic flag to switchdev notifier In-Reply-To: <20230117230806.ipwcbnq4jcc4qs7z@skbuf> References: <20230117185714.3058453-1-netdev@kapio-technology.com> <20230117185714.3058453-2-netdev@kapio-technology.com> <20230117230806.ipwcbnq4jcc4qs7z@skbuf> User-Agent: Gigahost Webmail Message-ID: 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 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 2023-01-18 00:08, Vladimir Oltean wrote: > On Tue, Jan 17, 2023 at 07:57:10PM +0100, Hans J. Schultz wrote: >> To be able to add dynamic FDB entries to drivers from userspace, the >> dynamic flag must be added when sending RTM_NEWNEIGH events down. >> >> Signed-off-by: Hans J. Schultz >> --- >> include/net/switchdev.h | 1 + >> net/bridge/br_switchdev.c | 1 + >> 2 files changed, 2 insertions(+) >> >> diff --git a/include/net/switchdev.h b/include/net/switchdev.h >> index ca0312b78294..aaf918d4ba67 100644 >> --- a/include/net/switchdev.h >> +++ b/include/net/switchdev.h >> @@ -249,6 +249,7 @@ struct switchdev_notifier_fdb_info { >> u8 added_by_user:1, >> is_local:1, >> locked:1, >> + is_dyn:1, >> offloaded:1; >> }; >> >> diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c >> index 7eb6fd5bb917..60c05a00a1df 100644 >> --- a/net/bridge/br_switchdev.c >> +++ b/net/bridge/br_switchdev.c >> @@ -136,6 +136,7 @@ static void br_switchdev_fdb_populate(struct >> net_bridge *br, >> item->added_by_user = test_bit(BR_FDB_ADDED_BY_USER, &fdb->flags); >> item->offloaded = test_bit(BR_FDB_OFFLOADED, &fdb->flags); >> item->is_local = test_bit(BR_FDB_LOCAL, &fdb->flags); >> + item->is_dyn = !test_bit(BR_FDB_STATIC, &fdb->flags); > > Why reverse logic? Why not just name this "is_static" and leave any > further interpretations up to the consumer? > My reasoning for this is that the common case is to have static entries, thus is_dyn=false, so whenever someone uses a switchdev_notifier_fdb_info struct the common case does not need to be entered. Otherwise it might also break something when someone uses this struct and if it was 'is_static' and they forget to code is_static=true they will get dynamic entries without wanting it and it can be hard to find such an error. >> item->locked = false; >> item->info.dev = (!p || item->is_local) ? br->dev : p->dev; >> item->info.ctx = ctx; >> -- >> 2.34.1 >>