From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 675C841058 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C1C33400CB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zi/ZoGN1SblsS/jhCzhzSMKV09ufYuVioFiWZkglVTc=; b=JDaGpm+Ln2IYzhv4JR4GRXpx12NELGAuhAc2bHdmJIkkB3Vnr50MuLdccrI301kti3oT8KCiXa1WMq3/NAvpjgbuUY25p98I/+wHvwB5eOG3ov28Qw8VlhH/ot8J/2p6QkWkbm6nF5pauZpfay1PYtgGKzTseQxNBi5nY+SRxXQ= Date: Fri, 3 Feb 2023 09:20:22 +0100 From: Simon Horman Message-ID: References: <20230130173429.3577450-1-netdev@kapio-technology.com> <20230130173429.3577450-6-netdev@kapio-technology.com> <9b12275969a204739ccfab972d90f20f@kapio-technology.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9b12275969a204739ccfab972d90f20f@kapio-technology.com> MIME-Version: 1.0 Subject: Re: [Bridge] [PATCH net-next 5/5] net: dsa: mv88e6xxx: implementation of dynamic ATU entries List-Id: Linux Ethernet Bridging List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: netdev@kapio-technology.com Cc: Andrew Lunn , Alexandre Belloni , Nikolay Aleksandrov , Kurt Kanzenbach , Eric Dumazet , Ivan Vecera , Florian Fainelli , "moderated list:ETHERNET BRIDGE" , Russell King , Roopa Prabhu , kuba@kernel.org, Paolo Abeni , =?utf-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= , Christian Marangi , Woojung Huh , Landen Chao , Jiri Pirko , Hauke Mehrtens , Sean Wang , DENG Qingfang , Claudiu Manoil , "moderated list:ARM/Mediatek SoC support" , Matthias Brugger , "moderated list:ARM/Mediatek SoC support" , netdev@vger.kernel.org, open list , "maintainer:MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER" , "open list:RENESAS RZ/N1 A5PSW SWITCH DRIVER" , Vladimir Oltean , davem@davemloft.net On Thu, Feb 02, 2023 at 06:00:00PM +0100, netdev@kapio-technology.com wrote: > On 2023-01-31 19:56, Simon Horman wrote: > > > --- a/drivers/net/dsa/mv88e6xxx/chip.c > > > +++ b/drivers/net/dsa/mv88e6xxx/chip.c > > > @@ -42,6 +42,7 @@ > > > #include "ptp.h" > > > #include "serdes.h" > > > #include "smi.h" > > > +#include "switchdev.h" > > > > > > static void assert_reg_lock(struct mv88e6xxx_chip *chip) > > > { > > > @@ -2726,18 +2727,25 @@ static int mv88e6xxx_port_fdb_add(struct > > > dsa_switch *ds, int port, > > > const unsigned char *addr, u16 vid, > > > u16 fdb_flags, struct dsa_db db) > > > { > > > + bool is_dynamic = !!(fdb_flags & DSA_FDB_FLAG_DYNAMIC); > > > struct mv88e6xxx_chip *chip = ds->priv; > > > + u8 state; > > > int err; > > > > > > - /* Ignore entries with flags set */ > > > - if (fdb_flags) > > > - return 0; > > > + state = MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC; > > > + if (is_dynamic) > > > + state = MV88E6XXX_G1_ATU_DATA_STATE_UC_AGE_7_NEWEST; > > > > What if flags other than DSA_FDB_FLAG_DYNAMIC are set (in future)? > > They will have to be caught and handled here if there is support for it, > e.g. something like... > > else if (someflag) > dosomething(); > > For now only one flag will actually be set and they are mutually exclusive, > as they will not make sense together with the potential flags I know, but > that can change at some time of course. Yes, I see that is workable. I do feel that checking for other flags would be a bit more robust. But as you say, there are none. So whichever approach you prefer is fine by me. > > > > > + else > > > + if (fdb_flags) > > > > nit: else if (fdb_flags) > > > > > + return 0; > > > > > > > ...