From patchwork Wed Apr 25 14:07:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10363281 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 04AE76038F for ; Wed, 25 Apr 2018 14:08:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2BB7289E3 for ; Wed, 25 Apr 2018 14:08:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D76852890B; Wed, 25 Apr 2018 14:08:11 +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 E1E982890B for ; Wed, 25 Apr 2018 14:08:10 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40WMVK0NnmzF24R for ; Thu, 26 Apr 2018 00:08:09 +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="dP9/v7pa"; 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=2a01:111:f400:fe05::624; helo=eur02-he1-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="dP9/v7pa"; dkim-atps=neutral Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02on0624.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe05::624]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40WMVC0TxDzF24N for ; Thu, 26 Apr 2018 00:08:02 +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=ST2dAVRpV2udehQd9ZlNB0NraDkZe8poZSRxBG02fVY=; b=dP9/v7paqq/Bn2mzqT+R4gvLTKSN77pubnmy1HbskNcW7UX5lPsOAcicw+zV3+741neps1fQOUMFVNj6zWL9IavJAlbAO1XxTHgmG1Qmq7zMuVcmflgdgkoP9q7mN/JHenr3EltLBsd+ncAmQiKH+/V5kCpH7+KbGATKN8ybCQw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (89.177.127.115) by DB7PR05MB4187.eurprd05.prod.outlook.com (2603:10a6:5:18::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.12; Wed, 25 Apr 2018 14:07:55 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v3 3/6] mlxsw: spectrum_switchdev: Publish two functions In-Reply-To: References: Message-Id: Date: Wed, 25 Apr 2018 16:07:49 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [89.177.127.115] X-ClientProxiedBy: DB6PR1001CA0001.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:b7::11) To DB7PR05MB4187.eurprd05.prod.outlook.com (2603:10a6:5:18::28) 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:DB7PR05MB4187; X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4187; 3:Jo6EFkBjHLuXZIuilx7cFktDYmnl7ll7VV7DNdtMgg1YCNtDrvLAq4/R+/yb2ScJ4fKDvEIYMe8qilKod4iTq7csSNvrNjf+Jn53XsgNcOn/R0P9c6pSwNd4gIrb/XV4EsY8acJHjPQc15N+ezKzg+edettR2XlgmMmpYaFKepXBfz/pSX8mHmU71EJOyMKO+SDvk9UC5GFNfaqmDoAoLUlnDipR+N+uHZVa/A/4NqSGCN3SiKmWqHQbKARzfDOE; 25:kUfQuxnZakKAQIBrKF5kqd5I5FGkCPufOM7ejwnvz89bVv5HSgM3IKvXbsMmzJ0qm/+OlBeWPFnAfJSQgpRGAztPVZAGhKqr3udz4KFozhrwc1H8ujHRjk5ZjMLO5xGxKXiYBWyuSg9h6oFVmrB6QdBOyroMxfwCbwkCgcEHnBWnbbwVjaco//oYV4XNigjSp64WLMVuGGOjzGDZEK09b3UINyw3PsK2ubJ3dVhWuAetPmGG9cBD4+HSN3jBDxMuuZLo+rJe+vU+e5DM8gzpZTanxqrDpVHdyrYRhemEmj5KwzecGAM3fvUhVM5V3H6dKPbAcWheusGATQfEvZyYZg==; 31:F8C4FKQEelaXPltj7X8Ij8H73hpgNibxgSZspADe7JavE5MWGkZKUzMX93UU5WpnUiNo8wBl5JFkB/WnNqj7C245RG2i2yrEhwC4ylJs32JzIc1cDg5awN0W2oXDfq0F9M8nOcqO3t+qRlpjAOojJEAGDX6p058nMKJcYc0pEhtOtA4kaFQsYZTzBm9nPlMLomy9RLWSd6eLC29c7u8WuNPQdJcdRLF03uO7rs83eXk= X-MS-TrafficTypeDiagnostic: DB7PR05MB4187: X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4187; 20:IEkV3WtJMyhpY8BF+azc8X/CkvMrjDn2nKyFS6rB7XCeooNNwd+TvxPDvEfq7htQTb+j52SqiGIq7U11z2lvcNQwjYGrIgNRAeBXRiwjgkoorrgQAHI+CBc8vi3PjlczYWpCI2p4zxFEo7dtesbTQ5JDn+/vAVvnMdz7/ag+L/Di8ayN9a5t7GQzqJohW5BL9hSLbAPysz3zg6p3hXdql34zZEzKWH14PYrllvd8lcz3WfGG7FY0KAgDLLEtelv+ZTxeUmcQ5k3C9kVTAmfYiQpSal320kB73P+jTZAqyHLkrCqgknQqtXGkipycP2Diet3ocx/13O9TX8GXJ1o6aI+c54QGX2y8vyeUPhsSSw6hIMczHrEUAAl9ewt012Er5xKSDMXdaGE0e2Fd47lAsJWAtz5WHPhrI+ppMgYkHFInOiSG6kX0pipebeQgqQMj5LZNNGv52/rqU9A6njYgMNCmi2TxvLRAUzl/DPpgrvk1j4lQdNfOpKAX4djzjOTh; 4:K4+t1//aNYeozIk5Tj93BrKrX3XOGVZWLROf7VLuuf4XdK2N5dP/hMr/BWxClzUHjmrqp/1cJBoaAyoMAxdQiBM8Y0wS5V2dMbR/qurFnmGDhVGWtIOUe99B0RzVmgA4zZ778vrwSxiznE2hF4sYl8wQc1FV+6Gy9d2fmNxa4BMr5gfL2zF48rlHpDZJuJX8mWhocOspyLg8oZvoW25FqcxW3KLgsshaUa5dBISvqzFjKlOBpNzc7W5Q6NfO6SQbRIQxFYSBLVZDdpb+gYoblw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231232)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:DB7PR05MB4187; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4187; X-Forefront-PRVS: 06530126A4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(376002)(346002)(39380400002)(39860400002)(189003)(199004)(5660300001)(107886003)(6116002)(4326008)(66066001)(3846002)(2351001)(8936002)(68736007)(36756003)(105586002)(25786009)(53936002)(6486002)(48376002)(2906002)(16586007)(446003)(11346002)(7736002)(50466002)(59450400001)(476003)(2616005)(386003)(956004)(305945005)(6496006)(51416003)(76176011)(486006)(6916009)(52116002)(106356001)(16526019)(6666003)(81166006)(58126008)(97736004)(8676002)(316002)(478600001)(81156014)(118296001)(47776003)(86362001)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4187; 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; DB7PR05MB4187; 23:bnMnH5gLTlUJHGC9hC3cUDUyWuyiP8wOTQc3Nl76l?= =?us-ascii?Q?qgWAPNE9F8uiaG44zXJLKilEH3yldQxTm3Q3QMvF1gNZyUdkyYLB5cfyD6J6?= =?us-ascii?Q?8NdxYvU0ZgYDI2z+esF68Oo5X5uFFLelRwJYf+VVw6CEDzMvaaOh+RQFYI66?= =?us-ascii?Q?heaGtt6pLQEw6Z7I9XIyGlZUMUeedYyzSNSHnpBIVhR4fF+TwEBeQ2y9P/8m?= =?us-ascii?Q?SOHo4nAXTOxvDWfsLnWCKJXA+9eR8SSkC36OomnIQg+wla5QLvm2+fVL1CEZ?= =?us-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2fjW1yZ4Edzd7ugTZoFhcZmadOqUF8J11TgWpH3huuOz+kS3HPkGeQHH1P17k= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB7PR05MB4187; 7:Sc4+nDXOV/w3uZIMesqFAJXZsUb8A4mGdO/NX9BQoUfIOt/2S5RgPHTj7RwxQybXR+zJ/t+LlreTyOuOt/rXDB+BjWiid1obe179z3xF0nnZ286OJ3xW81zNBvxS156RUx+7cdoCGj6aSRgDeWbfJ6u1YtRABk28Jssj2VNjxurubDIfuBGx0g8x7dx9YmWQIdxDwJsoYFi1NrMx8jk4GjqptBRQEq9GEsi6UHQwZ2CFzZk3ap+H9KjRJinQuYl9 X-MS-Office365-Filtering-Correlation-Id: cdb0ee9c-81d5-47d5-336f-08d5aab5f14e X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2018 14:07:55.4686 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cdb0ee9c-81d5-47d5-336f-08d5aab5f14e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4187 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 --- Notes: Changes from v1 to v2: - Fix filename in the license boilerplate. - Explicitly declare struct mlxsw_sp_bridge_port. - Add SPDX tag .../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);