Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5595719rwb; Tue, 17 Jan 2023 16:15:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXtrj3KfWDdkgXfAJV9YQL2IKAM87WiP31bKhdjDYEM3vGFE97sAf7hynwfIYEkB6GvsCX/6 X-Received: by 2002:a05:6402:1bdd:b0:499:376e:6b35 with SMTP id ch29-20020a0564021bdd00b00499376e6b35mr4851469edb.25.1674000926552; Tue, 17 Jan 2023 16:15:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674000926; cv=none; d=google.com; s=arc-20160816; b=ttk7aUUEBIi0TodechpHtrd0nz/KWvhxeXu1KXSDDz5dDprklBDFvtuOnDlLurykzL ycOw+wezHuDfVt0Ggq0Gu+sOUoZPXuH7hkGe6PYFlwrs4bfluwXQB/q7Cr1fwaiDdSAp 37PvvpK3r3eWwFOqjKO/ocgkx6khZ/Q7wmJu5CYGhbkex3i2SyOcFDgKl/bSD4EAlRWA w/zejtK5ZO+UfGgGx+fTGvZlFk/pl8xnZRq60+AxW38qQgqqx2VGkP5xt5uTvl2CkTBc HPJzBqnlloYPJ/r0T27/iJOc50kNBVClT2ODgynTEmqEUc4TDAaEP7j7ZgGbKSpV9cKw eyaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wzoFsN2BtIwkV7J9p1OybyavGXclmQ9kcPW4uj8vI+4=; b=RjzFzERlLdrTb1UeEEDvJvXYGwkCg4D7XLpXR8nMOVJ/kTYSsJu1GheO3W5JN5aTK8 4SYzTHlaWYa2qoOane+8bNx0HFVdZ1rN347t1rFnN8KIpur1Z8U2FlZT0Xtk7PJ1laza Og+R6WQbMzQx0s285Ee/H6xrqU+tmFAPitgw5t2cPXE2qngJCIFsCl+9M63TcPk0AuJ2 68o/QjPiJOT/5Ten97TFMLvnrF7jTu0DkvR0M5winpJJvXFycjiBx02DzDneDFc4ADCx rbzcMhhiRZL5PZr427pH8ujp+LdM+bJthZ8HeA+sWYstqmS8F4VSHxBvpgVYf+faayR0 6FzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WHkz1zPw; 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 v2-20020a056402348200b0049e29ce0a51si6474762edc.17.2023.01.17.16.15.14; Tue, 17 Jan 2023 16:15:26 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WHkz1zPw; 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 S229585AbjARAFw (ORCPT + 46 others); Tue, 17 Jan 2023 19:05:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbjARAE7 (ORCPT ); Tue, 17 Jan 2023 19:04:59 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1234B46731; Tue, 17 Jan 2023 15:17:55 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id vw16so16006182ejc.12; Tue, 17 Jan 2023 15:17:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=wzoFsN2BtIwkV7J9p1OybyavGXclmQ9kcPW4uj8vI+4=; b=WHkz1zPwXkTNrAiIJUYxeLo3UGJReyuX52LQMNDjwPjA7k3W/kAYzvCsEzteUoEbu4 yPAJWqnKYjN3T9Y0xfzCw8HsGJQdEZTqj4u0qMr0hYP9TSroZy6ZGbd1QX0+RpWNR5h/ OigdrmABYXR+MFv/Ar3o2IjM9bOQZkEATabOuTvlr4F6PSGsFeKKtNt4P6DfO8grzL8a Wlt6QM8UkV7I4gD+iqf96i0VPn97OK4iwvJSA5WSIRl3e3GhvaJZFO4S+kKSuRBvmNOP 8p7Mgj/QnaBU9sQdFLHhnetF3dMl9apL4Ry5w8QJZIcBcBEM2uC+DT6QDtQpH8K0QaS4 1+vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wzoFsN2BtIwkV7J9p1OybyavGXclmQ9kcPW4uj8vI+4=; b=fC08j7fxE3Y4Es1khCDhBEVK9IP2Gmf34rrX5Zhb2ZPZJ3j/6MPd30oIUCSn6Rve6g ll55EOJqBQdfsGc7lQjVqV4qVhX6A7OP4gObgx8fmhJNnWZSLtjI9vFoZH3IQzZCpW5U 2EBIFIIkMvv5Ol8ozl88OAPtlyIxl3YGh8rmruPIotG8A1GvMwfjG50IzDoACxKGmZ08 oV5zRpzvWzH5q4TSzy6KWDzViQOyK9q48vx59z6zs1mu1faQM4IQzGrLA9HT2HMAUIEk GPsl6JwWYW51kc2ANvelxRtlrYe1STSHf4y7dSsyK0jxdeKqfXGWgEQoLfJcROksGilt FccA== X-Gm-Message-State: AFqh2krNA4KUvfv9Omq4Qrt2vffK/nkJBYdEX81AuwXAQtvxprQ+eF4u blkkVKuIBu7rZ66pC0/YTqc= X-Received: by 2002:a17:906:358f:b0:829:6064:bc52 with SMTP id o15-20020a170906358f00b008296064bc52mr4616096ejb.74.1673997473518; Tue, 17 Jan 2023 15:17:53 -0800 (PST) Received: from skbuf ([188.27.184.249]) by smtp.gmail.com with ESMTPSA id g18-20020a1709061c9200b007c1675d2626sm13977440ejh.96.2023.01.17.15.17.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 15:17:53 -0800 (PST) Date: Wed, 18 Jan 2023 01:17:50 +0200 From: Vladimir Oltean To: "Hans J. Schultz" 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?B?Q2zDqW1lbnQgTMOpZ2Vy?= , 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 2/5] net: dsa: propagate flags down towards drivers Message-ID: <20230117231750.r5jr4hwvpadgopmf@skbuf> References: <20230117185714.3058453-1-netdev@kapio-technology.com> <20230117185714.3058453-3-netdev@kapio-technology.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230117185714.3058453-3-netdev@kapio-technology.com> 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 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 Tue, Jan 17, 2023 at 07:57:11PM +0100, Hans J. Schultz wrote: > Dynamic FDB flag needs to be propagated through the DSA layer to be > added to drivers. > Use a u16 for fdb flags for future use, so that other flags can also be > sent the same way without having to change function interfaces. > > Signed-off-by: Hans J. Schultz > --- > @@ -3364,6 +3368,7 @@ static int dsa_slave_fdb_event(struct net_device *dev, > struct dsa_port *dp = dsa_slave_to_port(dev); > bool host_addr = fdb_info->is_local; > struct dsa_switch *ds = dp->ds; > + u16 fdb_flags = 0; > > if (ctx && ctx != dp) > return 0; > @@ -3410,6 +3415,9 @@ static int dsa_slave_fdb_event(struct net_device *dev, > orig_dev->name, fdb_info->addr, fdb_info->vid, > host_addr ? " as host address" : ""); > > + if (fdb_info->is_dyn) > + fdb_flags |= DSA_FDB_FLAG_DYNAMIC; > + Hmm, I don't think this is going to work with the assisted_learning_on_cpu_port feature ("if (switchdev_fdb_is_dynamically_learned(fdb_info))"). The reason being that a "dynamically learned" FDB entry (defined as this): static inline bool switchdev_fdb_is_dynamically_learned(const struct switchdev_notifier_fdb_info *fdb_info) { return !fdb_info->added_by_user && !fdb_info->is_local; } is also dynamic in the DSA_FDB_FLAG_DYNAMIC sense. But we install a static FDB entry for it on the CPU port. And in your follow-up patch 3/5, you make all drivers except mv88e6xxx ignore all DSA_FDB_FLAG_DYNAMIC entries (including the ones snooped from address learning on software interfaces). So this breaks those drivers which don't implement DSA_FDB_FLAG_DYNAMIC but do set ds->assisted_learning_on_cpu_port to true. I think you also want to look at the added_by_user flag to disambiguate between a dynamic FDB entry added from learning (which it's ok to offload as static, because software ageing will remove it) and one added by the user. > INIT_WORK(&switchdev_work->work, dsa_slave_switchdev_event_work); > switchdev_work->event = event; > switchdev_work->dev = dev; > @@ -3418,6 +3426,7 @@ static int dsa_slave_fdb_event(struct net_device *dev, > ether_addr_copy(switchdev_work->addr, fdb_info->addr); > switchdev_work->vid = fdb_info->vid; > switchdev_work->host_addr = host_addr; > + switchdev_work->fdb_flags = fdb_flags; > > dsa_schedule_work(&switchdev_work->work); >