From patchwork Tue Apr 24 23:08:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10361187 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 E0FF5601BE for ; Tue, 24 Apr 2018 23:09:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D069028D53 for ; Tue, 24 Apr 2018 23:09:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C538628E86; Tue, 24 Apr 2018 23:09:16 +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 0641628E81 for ; Tue, 24 Apr 2018 23:09:16 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40VzY62xkZzF24h for ; Wed, 25 Apr 2018 09:09:14 +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="qnSdt15d"; 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.0.46; helo=eur01-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="qnSdt15d"; dkim-atps=neutral Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0046.outbound.protection.outlook.com [104.47.0.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40VzY06f1kzDqRk for ; Wed, 25 Apr 2018 09:09:08 +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=qnSdt15d9WZHirXQinKlShdncqhdba5p+ggcAT0XNwm1c61chKLO8nrCXsPRk79tJOsKaPYJ6uWGeJgExVAzF6ldH+3DHfJMtI2jEBFh3LkraXhehNIFgjtOVjwEFCxinKHyRwLcPGpopS2SC7EbzFzIbx5mQcaWvpltJ5RVq2U= Received: from t540p (89.177.127.115) by AM0PR05MB4180.eurprd05.prod.outlook.com (2603:10a6:208:57::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.15; Tue, 24 Apr 2018 23:09:02 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 3/7] mlxsw: spectrum_switchdev: Publish two functions In-Reply-To: References: Message-Id: <8338e90555e111ed5eb2eddb70f417b8c726b7ec.1524610426.git.petrm@mellanox.com> Date: Wed, 25 Apr 2018 01:08:57 +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: CWLP265CA0047.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:11::35) To AM0PR05MB4180.eurprd05.prod.outlook.com (2603:10a6:208:57::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4180; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4180; 3:gMGq4dHOt2bPc2sI/0+EWjgiWo9nhZVcOoJoRrt2NYYIzm94iBblNuxx3ZysFC+g6Up3kU9LVn4/C9QkRuB3Adcw1KAwuQqe1Eg1zR874OiIGu42/8u0T6gyfxk2zKZbPWUG8ffRQibEKd4aZA19lLOqwaxGG8+Yt5p+csyFjb96CsAonuRnq0dc4oAL+HjHWVyiCRFTW4P+mb41RjWXNy/Ca4Q7mWkdQZG629LUPtgWdRklgxDu3Fhxgxcn/3FS; 25:ZZqGYEzZlz3k4VMafz9OCbnhew8/AARTh4yEuvrJODUd1jjgcSNsksQt79HEJdgmEIOQIjfQ4U2oTNnfkGFma40xykmSpSzd3qjq0vLo8RdCmfJgRyhe5SFYaKu3BnFgQJYk7fjQvewFpt7UvTqwrbRAys9WmFAv+OjBluC70J1q7kQL0OANE0pkfLvqSNciPmkANkGDwoQ+8oB6LQKZeh2+0ulfokMKU91VzFPFFHG05pRAKJcSbIcfNLhe7OsBM/vhsIwe27vnKY9wqnGT2bcLqq7VZV4HJ9X4MIIIXa/Xbq1bSkokc2OWJsKqQ492MD7Vka49Uhgx/LpRCy6KUw==; 31:KYZw/qSJo0+0Gb/IJH+EjGO8UAe8jxDsTS3B9Ibn4lMY1/70O4xVLEk5DhmRAz5k44t6CBzR7cPTsg9fzyZV5dLgEmIpmAJOzhpDFRNEJI4wL4nDeGcJx90MxVzoIAyHHp9uOhyypPafJ1+h3xMHP6gHgWl7jYkVdoHFdWXh4yOpmFzfxNP93x/fgW2B0oucjhEerI1ag59++uLjIewyOLJNLzyUJ5MtNPmtdc/S4WI= X-MS-TrafficTypeDiagnostic: AM0PR05MB4180: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4180; 20:1C262hTXrchI4lyqOC+PCLBzNVJw0gNb02ijqdD/wifY1NOR5pyHeC1HzNSs+/AEW1mN7CuZuItlMG3zwh/OmATUZSB3Qr8YkCuWTUUj5cNWfdy2n9sfmwLSktBDKi52tqs6O63eo/8gzE8OAhHDOoS0+DW9mnVP8MLYfGD2m79tM2NrQ43jB3QsYQi8sS9DWFfULnviYQvYwbvmoYNNofMDGD+EN5eIdxNuG48Q40fzCYEM4/PZQcGKtOLvE7zxqsOzBQM+C2dDQhi0C3zKkU2dR8lLn+d+jeMZ790I0tr6wRSAFmp8hrf2ucj0YOjwzgW/jIRFYUs5wQwI2hntzWMcbcycGerH6QYBq2nVm8pcWpgr+EVvnPMRxrZ+9xi9UWPelBqnxTLIB40CVMMN0H9PjU7+isXuLOmF8Q2pDkG2fFGH8gcdR0/8EeNTCnROBvtQpdbtQLdHq1lk9f6cblTw8ezyd016LL8Jg8oIGovXRkh4WuMCm3/3pmdfoTWK; 4:Tirp1BrOC2LYJ7Uh5iY6AlWWigA0+v8uNVTY0Q8SMe2qZbf0eaNxVeuiNdciHLKSnoFqsIrSTPwO6AHJ6gniJE8caiYIpZjEPcr6HIqLmGVy0KirNN6pLwVOMoRUI+EJejseZRFzkS5y9Rvfx6bK++fLTdK32H+p90TPW9EjaENcmfXFuNHsfqseF2ysWBF6uIqwIAOy8TwXl58e6mvkFIBdQIAQ8HKKzXAX6nzWKwymVROrItYZLueBbsW9Q0vqlhle7u+XL4ZMw70UZ+zBtg== 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)(93006095)(93001095)(3231232)(944501410)(52105095)(10201501046)(3002001)(6055026)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:AM0PR05MB4180; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4180; X-Forefront-PRVS: 0652EA5565 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(346002)(366004)(396003)(39380400002)(199004)(189003)(6666003)(8676002)(68736007)(48376002)(6916009)(4326008)(8936002)(81156014)(2906002)(25786009)(81166006)(5660300001)(486006)(956004)(11346002)(446003)(476003)(52116002)(386003)(118296001)(16586007)(478600001)(50466002)(316002)(76176011)(2616005)(86362001)(6116002)(59450400001)(3846002)(58126008)(51416003)(36756003)(47776003)(66066001)(97736004)(6496006)(105586002)(106356001)(2351001)(53936002)(6486002)(7736002)(305945005)(26005)(16526019)(107886003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4180; H:t540p; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR05MB4180; 23:8SwzDNB9daTNhyJUWLTFiN9jVfB9ZHkbmYOQ6cDm7?= =?us-ascii?Q?Mqqn21zRp8nV+dQwpFK4gLbfqQyTUi5EXkGbDhkCGu2lQ0o+Ze5GIRgA295l?= =?us-ascii?Q?ve/quqN5JGwW8PCNqxQJWY69U+XL4qwfjej1QeeLsegC+L67GXGh8SIsZYLn?= =?us-ascii?Q?NHntXs8j6XAwjBes8hm2NCHk9QVkjqeMSQdS2CVqsZ/VuZuf6AAKh2S2scNH?= =?us-ascii?Q?xLXRVUgc0vM+2ipVaCK9S7D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/yghMwk7sZXuIdpwNf8Y0nQ6SLi4rtLrHbp60ShRb1ASg2INB9c6SOYpD8J5qXE5IXy1ac3WXqQQ2KGI9B41eJjbnoVfmvz+o= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4180; 7:mi/CTARgYgy+zcDaoz9LSd7JMfMAXtsbFwTFg0eg856rQEwLvVABx/uqyh6/zEcYkphIrv3K3ZO9jezXsGy6yNE8hUv/nktELHwBgLqThpORYY9VJ+iUy6tcfBrqkXqCQ25HyF6XVb0UO38KE0SgNcXr0UykQzeyxCoMFheMRC/zshLOeP7iFRmDF59xfbEqbYy002eZtvNnNGXeqyhR1Vi57AAaYEuV0vZtsvMLqUFZ4BfTD/Evudg7ElpNpS3I X-MS-Office365-Filtering-Correlation-Id: 7de20db2-d263-4a50-5c96-08d5aa385efa X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2018 23:09:02.8649 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7de20db2-d263-4a50-5c96-08d5aa385efa X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4180 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);