From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 54B7581394 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 11A5481295 From: Hans Schultz In-Reply-To: References: <20230130173429.3577450-1-netdev@kapio-technology.com> <20230130173429.3577450-6-netdev@kapio-technology.com> <9b12275969a204739ccfab972d90f20f@kapio-technology.com> <20230203204422.4wrhyathxfhj6hdt@skbuf> <4abbe32d007240b9c3aea9c8ca936fa3@kapio-technology.com> Date: Tue, 14 Feb 2023 22:14:55 +0100 Message-ID: <87fsb83q5s.fsf@kapio-technology.com> MIME-Version: 1.0 Content-Type: text/plain 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: Simon Horman 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?Q?Cl=C3=A9ment_L=C3=A9ger?= , 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 Mon, Feb 06, 2023 at 17:02, Simon Horman wrote: > > Just to clarify my suggestion one last time, it would be along the lines > of the following (completely untested!). I feel that it robustly covers > all cases for fdb_flags. And as a bonus doesn't need to be modified > if other (unsupported) flags are added in future. > > if (fdb_flags & ~(DSA_FDB_FLAG_DYNAMIC)) > return -EOPNOTSUPP; > > is_dynamic = !!(fdb_flags & DSA_FDB_FLAG_DYNAMIC) > if (is_dynamic) > state = MV88E6XXX_G1_ATU_DATA_STATE_UC_AGE_7_NEWEST; > > > And perhaps for other drivers: > > if (fdb_flags & ~(DSA_FDB_FLAG_DYNAMIC)) > return -EOPNOTSUPP; > if (fdb_flags) > return 0; > > Perhaps a helper would be warranted for the above. How would such a helper look? Inline function is not clean. > > But in writing this I think that, perhaps drivers could return -EOPNOTSUPP > for the DSA_FDB_FLAG_DYNAMIC case and the caller can handle, rather tha > propagate, -EOPNOTSUPP. I looked at that, but changing the caller is also a bit ugly. > > Returning -EOPNOTSUPP is the normal way to drivers to respond to requests > for unsupported hardware offloads. Sticking to that may be clearner > in the long run. That said, I do agree your current patch is correct > given the flag that is defined (by your patchset).