Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp964890pxp; Wed, 16 Mar 2022 22:51:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlYxTo9ncOZVRCm3sj+FEWxvV6+B07uPcN46zefOq1im9jvIVB198YcNpy88yEiyOXP37Y X-Received: by 2002:a17:902:f551:b0:153:b179:291a with SMTP id h17-20020a170902f55100b00153b179291amr3446514plf.13.1647496265543; Wed, 16 Mar 2022 22:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647496265; cv=none; d=google.com; s=arc-20160816; b=n5IMpZM+S5GHIt/Q1AaRxUfvPgb8WfShBkaquzkvL1PEfGRaEk4AuI8MYuS/ukDlld U7Nt70RuIZZ9W8Tm+u3YFi5CgfemMC+QVO4xMmf/Rxf0VmYDxfLv92k7Jb3BE1zt+IqJ IYJqibSCdukB8LcYdNOkA9Rf1Y6YFOwKBmazl4WqlAkRsKUAkoGbBnzRRhxKpsxgf7n+ UWnE6UYBJxue7vyTw7DcL8X2rGCU8iVqDfALQXa9NgHK4abnUXfaYggiLcj+SA14RM7Z VCVtAA3fGZ0u/88/8Zfk+QIOpNA8DrKhCBFqodHAyvhm5wa327ISSTb+McYgE9H8Vtei /j4Q== 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=fyNU2eCNeOLALHX86vTF1cqLP/pZoHeuskOPoJW5eBQ=; b=Q4u9Xkn/AaqWF1TAdu/kuDUXo1Z8PTFcloBz4PlnkG3Bo6Jk2vBx3QHfMjVkuIGoIp HVO/ZPgi1YtLT8RINieSqVpmYSFKyeaaYvO2q0w38QajXsAP2+Eyr/OYAvt57+tGstXW 70h5t8pd9NIgF7IER8WfmezUOnLBGB63xs7ZGiobCmsnVWVbWpkoZ+H4gcyDqK4OFP5g kifKIfYUMA3Srz9rYYTKdQdCEqX5x7oJhlR1wo5fdYi7W6w2QW9UjPDnvvV8s1JFmpQq LajYgMXfwy3ohcBu0IEuPQOgSVEfrdcBsZm7Gx6oUdz0o8iWJXvl1VNtSWtEjDPJ3kzq Ma0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b="SaZEgm/+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z23-20020a63c057000000b003816043f107si1043189pgi.764.2022.03.16.22.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 22:51:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b="SaZEgm/+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0CF2F15B063; Wed, 16 Mar 2022 21:46:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233625AbiCPPK6 (ORCPT + 99 others); Wed, 16 Mar 2022 11:10:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243167AbiCPPKk (ORCPT ); Wed, 16 Mar 2022 11:10:40 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 117795F4DA for ; Wed, 16 Mar 2022 08:09:13 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id o6so3550745ljp.3 for ; Wed, 16 Mar 2022 08:09:12 -0700 (PDT) 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=fyNU2eCNeOLALHX86vTF1cqLP/pZoHeuskOPoJW5eBQ=; b=SaZEgm/+AfZUnWYiV4Xqx27XlyzemoS3E1bma8/EK9tpZdNtBNdj1w2yc9fsINkNai Oze6ugraeS/kRxuYggNuqTzAhx8C48u1y4gR9hSYlVMa44WfrJDbODQ3XS/ASutj+9Bk U3ZxHDTp8cSrqjYs6s5jimFobalz89DT3jzEnYPDzI4+eicm/ex6FwNodql8fw8J7zWx fUL82Pce1n9lWSF9v2SOWtQpzqF5oiVxV4nD2NpVA4RN7Q/KNwysJnG2L07XjdoiX/fH s3pRb/bshI+T17J1QeHRkWJDRoZz3CpuasicvSVecDsbM8/piC9XxQelqzaRngpK+JyO qfMA== 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=fyNU2eCNeOLALHX86vTF1cqLP/pZoHeuskOPoJW5eBQ=; b=4Ia4+olgAXmybftIKbEaR4zD8kgEe2mhKFjFtXswx34dC2VPgP7CZm/ZRMqBEBq/v9 TDO5z/i6Z3+bqxssBplFCF8CoqMzoyMH6JKleTZjkG969V/xGb1I97WpvLIs2r5+fJbC suL5CwbEPtiLCq9kfou/VNf+u+Ct9xJdJDGbXW/CVkZvfHi3Sh229e1NHsZqF/WhaQ1v UQrsDKZHwl1Bl5QV73Epqva/lRPWy01TQVFMMFkYL8Mlqt+IsOIrC19BMzo0zLhm53kl uYusTPJPyw+s0rGWidYWXDTvp5TobR+iOpNvXI9xfXAb2HsWrrD0+HdLMr+o1wY13rD1 Grjw== X-Gm-Message-State: AOAM53235l3nFSeaFjoddtMlgifhG6SPawHQwcnhyfKq2Pob8sLW7H99 a+bdMViIXDNoqgVynPHxgtZpcQ== X-Received: by 2002:a05:651c:1594:b0:247:dce8:b0ec with SMTP id h20-20020a05651c159400b00247dce8b0ecmr79235ljq.404.1647443350883; Wed, 16 Mar 2022 08:09:10 -0700 (PDT) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id d2-20020a194f02000000b00448b915e2d3sm176048lfb.99.2022.03.16.08.09.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 08:09:10 -0700 (PDT) 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 , Petr Machata , Ido Schimmel , Matt Johnston , Cooper Lees , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bridge@lists.linux-foundation.org Subject: [PATCH v5 net-next 04/15] net: bridge: mst: Notify switchdev drivers of MST mode changes Date: Wed, 16 Mar 2022 16:08:46 +0100 Message-Id: <20220316150857.2442916-5-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220316150857.2442916-1-tobias@waldekranz.com> References: <20220316150857.2442916-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,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Trigger a switchdev event whenever the bridge's MST mode is enabled/disabled. This allows constituent ports to either perform any required hardware config, or refuse the change if it not supported. Signed-off-by: Tobias Waldekranz --- include/net/switchdev.h | 2 ++ net/bridge/br_mst.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/net/switchdev.h b/include/net/switchdev.h index 3e424d40fae3..85dd004dc9ad 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -27,6 +27,7 @@ enum switchdev_attr_id { SWITCHDEV_ATTR_ID_BRIDGE_VLAN_PROTOCOL, SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED, SWITCHDEV_ATTR_ID_BRIDGE_MROUTER, + SWITCHDEV_ATTR_ID_BRIDGE_MST, SWITCHDEV_ATTR_ID_MRP_PORT_ROLE, }; @@ -48,6 +49,7 @@ struct switchdev_attr { clock_t ageing_time; /* BRIDGE_AGEING_TIME */ bool vlan_filtering; /* BRIDGE_VLAN_FILTERING */ u16 vlan_protocol; /* BRIDGE_VLAN_PROTOCOL */ + bool mst; /* BRIDGE_MST */ bool mc_disabled; /* MC_DISABLED */ u8 mrp_port_role; /* MRP_PORT_ROLE */ } u; diff --git a/net/bridge/br_mst.c b/net/bridge/br_mst.c index 5c1831c73fc2..43ca6b97c5c3 100644 --- a/net/bridge/br_mst.c +++ b/net/bridge/br_mst.c @@ -7,6 +7,7 @@ */ #include +#include #include "br_private.h" @@ -102,8 +103,14 @@ void br_mst_vlan_init_state(struct net_bridge_vlan *v) int br_mst_set_enabled(struct net_bridge *br, bool on, struct netlink_ext_ack *extack) { + struct switchdev_attr attr = { + .id = SWITCHDEV_ATTR_ID_BRIDGE_MST, + .orig_dev = br->dev, + .u.mst = on, + }; struct net_bridge_vlan_group *vg; struct net_bridge_port *p; + int err; list_for_each_entry(p, &br->port_list, list) { vg = nbp_vlan_group(p); @@ -119,6 +126,10 @@ int br_mst_set_enabled(struct net_bridge *br, bool on, if (br_opt_get(br, BROPT_MST_ENABLED) == on) return 0; + err = switchdev_port_attr_set(br->dev, &attr, extack); + if (err && err != -EOPNOTSUPP) + return err; + if (on) static_branch_enable(&br_mst_used); else -- 2.25.1