Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp842165pxb; Wed, 16 Feb 2022 05:42:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwIC4XcNSTWhcPIVUnBTXQRpkfLxjkiD9IgJW7aWFMQCh5DSiqA+Jwyf1Hi5TAV6DY2gg7B X-Received: by 2002:a05:6402:50c6:b0:410:a107:e9f4 with SMTP id h6-20020a05640250c600b00410a107e9f4mr3090820edb.274.1645018961951; Wed, 16 Feb 2022 05:42:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645018961; cv=none; d=google.com; s=arc-20160816; b=gLo0dkhrX5l/zfydtrL6cRVFwmp11+MPSTwEUu0KyE9aDV309xVhRAsnPYILIkDXCA 06SmYLLPUn+QG/WAm9+u64aaWfqprQI44P93T4YvdDKtEyAmqvAjXfbc/oEj5qieNjy1 IcpSR+Fe54JCreUf9KEjTzFUg1N/4pNT4sN/+oVntT0D6YolJpSYyM2rDBZ8Wd1f8xI3 bLfh6xgq3t1lw6mTvWHC+Is5FvmT1Ihe7E1kE6pdi/s5yNJo4XlpZxFT9pCDG0BujBtQ FLTOrIjdWa8/XqoUfXQtHKlK62c0wBqVBP8vg6X099lmE+RylZ/HM/g6g8WCyrAsu6d/ gcNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V1eQh2z2Mp1dVqtDPqG/YccGeTfz3qSetOtmZo+4lcI=; b=0kC1TiFLgM1mcyBcUfAXP52bCR0s5VNLDgTmsioO1ywJQ1fqotch3lFxppJJLzUPSM PQd2LgK0UTX4v/fDpoX0fE7CYMdEImSSEOPYD6zoFwSO/FKpIEu6LE/ghJBxsbA7GhYn E4p7VIQy5okVrdYOrnU/QLCkXUwrA56MD8de8W2uQvqOQHlhMcjrDRAtzgKjj8Kn6dPl Ea5qIP3rcM6ULI+hhiSL6VTM7y+R/EzkDdh7X1PhOqO2Uk/7gFvjP3BNJxAMFsK+5XsN jeoWgjyGyfF5nR5A995H1dB96DERcOyYCi8cdl0YiA2+9E+9/eh26a6zrToP60jY9IpC 9Rvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b=4Z9spyZJ; 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 du4si5637932ejc.658.2022.02.16.05.42.18; Wed, 16 Feb 2022 05:42:41 -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=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b=4Z9spyZJ; 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 S233879AbiBPNbA (ORCPT + 99 others); Wed, 16 Feb 2022 08:31:00 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234345AbiBPNam (ORCPT ); Wed, 16 Feb 2022 08:30:42 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 625EE166E1C for ; Wed, 16 Feb 2022 05:30:30 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id p22so3866269lfu.5 for ; Wed, 16 Feb 2022 05:30:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:organization:content-transfer-encoding; bh=V1eQh2z2Mp1dVqtDPqG/YccGeTfz3qSetOtmZo+4lcI=; b=4Z9spyZJh7I6GdzYp1fUuY70ylRefnQynE2afvnnLFa/c9ru744iYsrV7GcIN6GCIr azVyPHTH8XsrmRbOF/9lSx5VTcSZAfTlNk0LmtMdOvUycpITjHKdm01opJv6+j3Yz5Ro c/ztRs1SefZd5LUk5cDjkz1Vq+TR6PsWDvLGVHZhnLPP8axeyShWStroQAlIxab7MZp1 UwS+th+DXfSoDOp92F7yzPH6Xv/F71AhcnEd0lepnoZ5ry01Sf1xg95Y1uTY779/YcvD vMgLZV5svdBdcAST0pvnBH6TS1vD0+BOGrVJg6VUSR9cMTYLcbrkYGzHSYtxN3geykH+ V/6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:organization:content-transfer-encoding; bh=V1eQh2z2Mp1dVqtDPqG/YccGeTfz3qSetOtmZo+4lcI=; b=sR1ZQ+C6lvBHrsPMRYSBHJ7V/6bcNEheOM4RTnaEiIUnscBXprZVPCEEmvlHTfGDBQ g01pK86SK5unoeYKoqHDuaEuxckUAWYxAFqlxhaGqnu/rWETlvshmx/HoWg+B5vDViDs LPpFqCjOJqSNc1HpxpfmxD8M/WIPskPcAX0px7haAVEJbAbPvJBcl+9WYkyowmI+ECSN 3Gpz9kYnKFWP5QgEoyw2H29Gzh9JjxY4Qyd8Ewy3qZA+TKdbTsCza/mgz8+fmHiCy6/l P3MXVb0zsMZxAiRhSrhZPWJSsWFnx/JbOikrAwZLhYCnsYZUp6vBzUopLvyE5zJkDQC6 EFBg== X-Gm-Message-State: AOAM532c1sjRBvLw4HujQ46TGcFwZ/gG3J2undr2cdAdG0K6FbFEpDA+ Q2meSpNoiMvlIv9YLHdS0ARCiw== X-Received: by 2002:a05:6512:22c5:b0:443:890c:a9e3 with SMTP id g5-20020a05651222c500b00443890ca9e3mr2007506lfu.662.1645018228436; Wed, 16 Feb 2022 05:30:28 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id v6sm234780ljd.86.2022.02.16.05.30.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 05:30:28 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Nikolay Aleksandrov , Russell King , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org Subject: [RFC net-next 5/9] net: dsa: Pass VLAN MST migration notifications to driver Date: Wed, 16 Feb 2022 14:29:30 +0100 Message-Id: <20220216132934.1775649-6-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216132934.1775649-1-tobias@waldekranz.com> References: <20220216132934.1775649-1-tobias@waldekranz.com> MIME-Version: 1.0 Organization: Westermo Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Add the usual trampoline functionality from the generic DSA layer down to the drivers for VLAN MST migrations. Signed-off-by: Tobias Waldekranz --- include/net/dsa.h | 3 +++ net/bridge/br_vlan.c | 2 +- net/dsa/dsa_priv.h | 1 + net/dsa/port.c | 10 ++++++++++ net/dsa/slave.c | 6 ++++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index fd1f62a6e0a8..2aabe7f0b176 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -901,6 +901,9 @@ struct dsa_switch_ops { struct netlink_ext_ack *extack); int (*port_vlan_del)(struct dsa_switch *ds, int port, const struct switchdev_obj_port_vlan *vlan); + int (*vlan_mstid_set)(struct dsa_switch *ds, + const struct switchdev_attr *attr); + /* * Forwarding database */ diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index c45a34c14e10..48b2f5dd277c 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c @@ -173,7 +173,7 @@ static int br_vlan_mst_migrate(struct net_bridge_vlan *v, u16 mstid) old_mst = rtnl_dereference(v->mst); rcu_assign_pointer(v->mst, mst); - if (br_vlan_is_master(v)) { + if (!old_mst || br_vlan_is_master(v)) { struct switchdev_attr attr = { .id = SWITCHDEV_ATTR_ID_VLAN_MSTID, .flags = SWITCHDEV_F_DEFER, diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 2bbfa9efe9f8..43709c005461 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -204,6 +204,7 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering, struct netlink_ext_ack *extack); bool dsa_port_skip_vlan_configuration(struct dsa_port *dp); int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock); +int dsa_port_vlan_mstid(struct dsa_port *dp, const struct switchdev_attr *attr); int dsa_port_mtu_change(struct dsa_port *dp, int new_mtu, bool targeted_match); int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr, diff --git a/net/dsa/port.c b/net/dsa/port.c index bd78192e0e47..4fb2bf2383d9 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -729,6 +729,16 @@ int dsa_port_bridge_flags(struct dsa_port *dp, return 0; } +int dsa_port_vlan_mstid(struct dsa_port *dp, const struct switchdev_attr *attr) +{ + struct dsa_switch *ds = dp->ds; + + if (!ds->ops->vlan_mstid_set) + return -EOPNOTSUPP; + + return ds->ops->vlan_mstid_set(ds, attr); +} + int dsa_port_mtu_change(struct dsa_port *dp, int new_mtu, bool targeted_match) { diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 2f6caf5d037e..0a5e44105add 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -314,6 +314,12 @@ static int dsa_slave_port_attr_set(struct net_device *dev, const void *ctx, ret = dsa_port_bridge_flags(dp, attr->u.brport_flags, extack); break; + case SWITCHDEV_ATTR_ID_VLAN_MSTID: + if (!dsa_port_offloads_bridge_dev(dp, attr->orig_dev)) + return -EOPNOTSUPP; + + ret = dsa_port_vlan_mstid(dp, attr); + break; default: ret = -EOPNOTSUPP; break; -- 2.25.1