Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA94BC6379F for ; Tue, 14 Feb 2023 21:54:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232746AbjBNVyT (ORCPT ); Tue, 14 Feb 2023 16:54:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232418AbjBNVyP (ORCPT ); Tue, 14 Feb 2023 16:54:15 -0500 X-Greylist: delayed 1200 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 14 Feb 2023 13:54:12 PST Received: from mailout-taastrup.gigahost.dk (mailout-taastrup.gigahost.dk [46.183.139.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96C4B10A; Tue, 14 Feb 2023 13:54:12 -0800 (PST) Received: from mailout.gigahost.dk (mailout.gigahost.dk [89.186.169.112]) by mailout-taastrup.gigahost.dk (Postfix) with ESMTP id 53CD71884412; Tue, 14 Feb 2023 21:16:59 +0000 (UTC) Received: from smtp.gigahost.dk (smtp.gigahost.dk [89.186.169.109]) by mailout.gigahost.dk (Postfix) with ESMTP id 48AD725002E1; Tue, 14 Feb 2023 21:16:59 +0000 (UTC) Received: by smtp.gigahost.dk (Postfix, from userid 1000) id 407DC9B403E3; Tue, 14 Feb 2023 21:16:59 +0000 (UTC) X-Screener-Id: e32ae469fa6e394734d05373d3a705875723cf1e Received: from fujitsu (2-104-116-184-cable.dk.customer.tdc.net [2.104.116.184]) by smtp.gigahost.dk (Postfix) with ESMTPSA id 8F0F391201E3; Tue, 14 Feb 2023 21:16:58 +0000 (UTC) From: Hans Schultz To: Simon Horman Cc: Vladimir Oltean , 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: [PATCH net-next 5/5] net: dsa: mv88e6xxx: implementation of dynamic ATU entries 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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).