From patchwork Thu Apr 26 16:32:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10366373 X-Patchwork-Delegate: idosch@idosch.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0BEA06032C for ; Thu, 26 Apr 2018 16:33:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1E88288E2 for ; Thu, 26 Apr 2018 16:33:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFED428BAB; Thu, 26 Apr 2018 16:33:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 47527292C6 for ; Thu, 26 Apr 2018 16:33:02 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40X2g04lqyzF255 for ; Fri, 27 Apr 2018 02:33:00 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="MKaf44mJ"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=104.47.2.55; helo=eur01-db5-obe.outbound.protection.outlook.com; envelope-from=petrm@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="MKaf44mJ"; dkim-atps=neutral Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0055.outbound.protection.outlook.com [104.47.2.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40X2fw1rq3zF252 for ; Fri, 27 Apr 2018 02:32:56 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=vWBVCbDLQsywbECt/3IAxhEqvSFgAmzTkZGBFZStZFY=; b=MKaf44mJdaQu5HDoqU5462yvKu62g9i+BGmyCGy+pJefofI6uBCE2qkAikijiEm3VdgiVSmyn4qx6ouzASLmRGgZU8S6lqIcESspPjteW8CIc7IuCTJHazBDOwIZws6M2DSx5AZeHc+EVWJlfdKvEGfGVx+AHiFj/86fuipLufw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by VI1PR05MB4192.eurprd05.prod.outlook.com (2603:10a6:803:4e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.15; Thu, 26 Apr 2018 16:32:49 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 3/6] mlxsw: spectrum_switchdev: Publish two functions In-Reply-To: References: Message-Id: Date: Thu, 26 Apr 2018 18:32:43 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [78.45.160.211] X-ClientProxiedBy: DB6PR1001CA0035.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:55::21) To VI1PR05MB4192.eurprd05.prod.outlook.com (2603:10a6:803:4e::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4192; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4192; 3:+v/d7sQyPAuoz13z+QkIdXTtfWZ0KNxrxP3hpQXeWpsP8+6LQGMPSyYb1HbVEk83z6WyeIl8I9dfGFtRv2MKAmRirLUDTHevqZyH5v08DbPlDU2z6YVrwgd7l09SqAFBe/8+VhV9oxYw+SHv5AaAURuQBOQ7Meuia0YXJhn+AKAO6a+jCmnnhJKj5Dl95ka503ejS/G/OqaYULGnY9ZwFYW7NZMZqy3DaiT8j3SS+7EPW4Lgu2RsD9M6BCmvJGGu; 25:URAJxpwDUDReKFBM7xYr6+x6IYfUpBwsoYVI50Kz4ppCvnov9HC+S02Ryt4tp9k+XJMj+rD1YZGZs6FrD0mtnEbIZqioyeiU3KUUElw8GrRnfXUN/zc1U5WINNyYQe/Idh0miTTyKw6WEBcZ2UHPEtXXYojNZZudvuW31v9MRfAqP1AlmeWH5ZK/DlCBAW8FWeaKpqgo4thS61rNnRy6VaEESjGY8cnfEPGbrDwi6WaV5BBOyZcwy9J5TQfeJXbDaNY5qHKdt5519Yb1Bqz0qF/LXMioSh3LLoErpB5INOo/tprZzje1JZinNNCzR0r/Anct1CS6u1cDUNpfQUQnhQ==; 31:G6I+SK8FFZHZuO4KB15oTDvpJCFFLGfh5UL5CaI981SHoFIcBwMLxyQifNplXbCDlaBdwDzkTS0aZshg6xrokhoug5xR37xzUUHQG7N7LybT/vh4CoSHWJ0s1OPWtD+irnu4t1Uq3GdDmpdnhnj0Nspwz9JZq3Fub1mTv23j6WXhxAImepA5SnUbXsfjzhswp2p8o1r/nh/sZTTSE3YJAzr0UyPfcJ8u2joEMS4SLo0= X-MS-TrafficTypeDiagnostic: VI1PR05MB4192: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4192; 20:qf15HojJgpIuJ4yhZkVhVKkigTfHDQAjk3EmgCF56Bnk/gSJR4je3Hxw80U7X1VoYcnqnjPOGJPHgT2CUD5qikWZ+4f3oPB83F/TtrZw9UyBtLcjyAquI4EGOPGy78kXwf9f8W3pA856Mi2PmSZ7+nDd5/JSxXmg4avIfhNe3tYvJF603sD+q66jeijyR758uDIFsQYtL+rAAWqUr8EraMSs2HSmD+q5sgT0GNoRqxgCGRwsNhSY5wFy5s3njmDBSFscSI0Jl7j53eb7+QekxWcBe29dyWqB0ZemGikqFEODi10+L67ZQTwN+0JFNfczMOCBIhUauFoVsYRjBa0EEHo1NepCrdNEG9hvWmUtTp0AkKh0Zi1I1KWhyxb86uVzWM5bHK8XYzDi30kv4gRsBE9O8sFRcI5phU/oL9Ox1Yf0R1VTUZceQVR+ljyiCMT5P9FR2Ul3Ue8TlQ0N0PLdpO16wapzSk8GFncj0y+ay9p5nKbTP4k68uayPvIDg6oi; 4:s7e02e1n56zcm3wpnSpoVE3ZpkflJNeQj3DwCowghHAaeG8vdeJXs8ipokdGbQOhAz6xnCeXE6If10LzM1BnuN9wUtd5Ib/6b+EWD/KWiUviVTB2D/I7t9U/ukwVZ9PBhUbtDNc9H1yd22rqlQPlDBBcreNeFtP6R6H5ymayDkqIcWKS7g+Y1eT8Py1sjZDPPzuHv7+LaquKnPOC6nKHWVJpvESYy+3rNeEl2+Iv28AA9RTlm0NzhRb2Dsv1+KpeOnfOyHFvyQoKmHONjv8ulQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231232)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:VI1PR05MB4192; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4192; X-Forefront-PRVS: 0654257CF5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39860400002)(366004)(39380400002)(396003)(189003)(199004)(107886003)(26005)(6666003)(66066001)(68736007)(7736002)(2906002)(51416003)(50466002)(48376002)(3846002)(97736004)(76176011)(47776003)(305945005)(105586002)(6496006)(106356001)(6116002)(478600001)(52116002)(8676002)(5660300001)(25786009)(86362001)(118296001)(2351001)(446003)(11346002)(58126008)(81166006)(386003)(6486002)(6916009)(81156014)(53936002)(956004)(2616005)(8936002)(486006)(16526019)(476003)(316002)(16586007)(36756003)(4326008)(59450400001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4192; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB4192; 23:B5tH+beNFm7TaNHYo9DPjarIS4+Pk6Ai7/mlqwCbi?= =?us-ascii?Q?oHjqhzoNY3F2KE1ieIJgcWbnyBPoh6A6Bsa7den35Y6ufEnyBvmlpOwlb3sA?= =?us-ascii?Q?5eRBDYsVYhEphaGsVS3TdcD0L/Iov6djEKtlyoUTF2SHaO4BAFFQMXy2rSJc?= =?us-ascii?Q?Tr1LP0L3e/OWMimAJp6ldo2pG9XRcsHKO3wtrVLnsjDmNNF5TlqRaFYVXHDO?= =?us-ascii?Q?PKfg397vxLJnuO7NIRDDZB+ucEuVqR2w8GhvjgXiTJyhGw2u9O/JLpDfrYvl?= =?us-asc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Hnvp5MT7G4Jh/hbmW?= =?us-ascii?Q?zb2gNndioGoxWB7ZrWdxz3kIM/xcBDU0R/aut/OpZmK05D/hVHUsyTX0A=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Antispam-Message-Info: tzP8l3zVBAHjtTkiUrmZsrsZvqfTXTEGMQ08lHihyTPevEIsulKNfb6f8rti4p8i/+kx10BUwS/NW489lOeGhspYMhhkK9morU45yb+WQ5fpzeP28fllQh5gZej10xnmVphqdPi1iMdMClQHI3ES0plfJFeqSf5Hd2QrQL56OXYsZ8smY33leIfBLPUhblep X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4192; 6:XpfoP8+nxX4hCNUr5Fk+CUIP0GmmbQWCqinPtN2gyMVSodvoL38Vk5AZmt3Q9l5DHIlWMYQnsDsIhcy+BqssxxCP2jY6KfLY8dUE7NJ5oOXgSfU+XbEbbuCVIOUkP0F1Saev4Em2REooPvTxczDjrHr1ktHRgA24xzC0FeKJVmZltuBNGkGfW91peP4KeHw03F6K0F6ufmYtx9qdDyDmRfZPHDS2CLgNvi9T8P3TNMGFYxHmE2j6PRVHawgncjMcWQtv/DN/NpLCYiIeO0maTAvtyVcFb4Jfap4WSqS0DzlQPbHgV9sVYrjTColtnoC4kxW4wCClK/fDCkC3I1wC2wbu4IkdSBj0iv/uVp2MUaREgwkbaxY2CA1K3Nyn3SdUEBYnZJJp0w15lXPj4hq4RTM+RXhK965K5fpjOkIzqyIBoOm5hv5j3f2weDDMQhcprvLCM9POuXp4facbdViKNw==; 5:vvxrq3zwEpnZn3QYuzf5Rv7R2mWivoW4KSZ3LBySRPDIHOfEVlowwDT7ix1dY6TJ+k+oY+DjOTAYCLn1OP290jf7uiFuAtXq1gW3qvP1hEivjd6wn/mzltDXzVrB21g5zr2+7YNd9U/jqDuqwFHyWUiwEyDQu+CSntmGDpKi9d4=; 24:cDQC5UNQ823ocb1rSYbTIhw25JhARCDmqxemRBmoI/bRECR24DYv6JxJBtaVZmQfkcopnu7H/qAM1ZpjPtLtQyx1Fm8oSdTYWMWbQiGtu2c= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4192; 7:IYbNf/kSrYERwwAnzSg+/2zzsS3pQuwNb4QQlhpLh4AJ/XIU5/NQmRHYk6L40S11ZT5jbKKWGAkw/z8qGgS2XD2u1yq3kNb1TMF/+7s4Uo9jXOTufDFXEUUdlUK1q6ZocYFMzurGYHYsWpeyhaOxzZu0fG/UtgZZnBXunqrbQF93p98V5GfJE4Aux5VC/hUkvql4VToqaSdT5iAkYBoRuhJjXj5UEubqHuH17Qhm8zUhJEkwlTQro5At0Lmpd6fK X-MS-Office365-Filtering-Correlation-Id: 5eacea43-672d-4b57-b3b2-08d5ab9359a4 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2018 16:32:49.1395 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5eacea43-672d-4b57-b3b2-08d5ab9359a4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4192 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-internal@mellanox.com Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org Sender: "Linux-mlxsw" X-Virus-Scanned: ClamAV using ClamSMTP Publish the existing function mlxsw_sp_bridge_port_find(), and add another service accessor mlxsw_sp_bridge_port_stp_state(). Publish both in a new file spectrum_switchdev.h. Signed-off-by: Petr Machata --- .../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 9 ++++- .../ethernet/mellanox/mlxsw/spectrum_switchdev.h | 43 ++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.h diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index c11c9a6..db4aea0 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -50,6 +50,7 @@ #include #include "spectrum_router.h" +#include "spectrum_switchdev.h" #include "spectrum.h" #include "core.h" #include "reg.h" @@ -239,7 +240,7 @@ __mlxsw_sp_bridge_port_find(const struct mlxsw_sp_bridge_device *bridge_device, return NULL; } -static struct mlxsw_sp_bridge_port * +struct mlxsw_sp_bridge_port * mlxsw_sp_bridge_port_find(struct mlxsw_sp_bridge *bridge, struct net_device *brport_dev) { @@ -2297,6 +2298,12 @@ static struct notifier_block mlxsw_sp_switchdev_notifier = { .notifier_call = mlxsw_sp_switchdev_event, }; +u8 +mlxsw_sp_bridge_port_stp_state(struct mlxsw_sp_bridge_port *bridge_port) +{ + return bridge_port->stp_state; +} + static int mlxsw_sp_fdb_init(struct mlxsw_sp *mlxsw_sp) { struct mlxsw_sp_bridge *bridge = mlxsw_sp->bridge; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.h new file mode 100644 index 0000000..bc44d5ef --- /dev/null +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.h @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 + * drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.h + * Copyright (c) 2018 Mellanox Technologies. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the names of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +struct mlxsw_sp_bridge; +struct mlxsw_sp_bridge_port; + +struct mlxsw_sp_bridge_port * +mlxsw_sp_bridge_port_find(struct mlxsw_sp_bridge *bridge, + struct net_device *brport_dev); + +u8 mlxsw_sp_bridge_port_stp_state(struct mlxsw_sp_bridge_port *bridge_port);