From patchwork Fri Apr 27 23:00:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 10369983 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 60A7F601BE for ; Fri, 27 Apr 2018 23:01:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D76F2958A for ; Fri, 27 Apr 2018 23:01:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45B05295C2; Fri, 27 Apr 2018 23:01:20 +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 403642959A for ; Fri, 27 Apr 2018 23:01:09 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40XqDM2pW2zF25Z for ; Sat, 28 Apr 2018 09:01:07 +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="jeCuAH5L"; 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=40.107.4.81; helo=eur03-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="jeCuAH5L"; dkim-atps=neutral Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40081.outbound.protection.outlook.com [40.107.4.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40XqDG3CPxzF24m for ; Sat, 28 Apr 2018 09:01: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=vWBVCbDLQsywbECt/3IAxhEqvSFgAmzTkZGBFZStZFY=; b=jeCuAH5LzGYFGE1cLumjLf54Ry7FBDFPIezvZRCE0H9bCPmfwEnwheaittny59qZtn0CEE3vRaVrhocoM2z8ALKMFv1EuajuXxqXSmuxUS6CZNDbmrpM9FKz5XmUfSAJSjzibWb7z5jhOHiLZNyQgSY3x71FqEUwmPM2cocoxoM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (89.176.83.59) by VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.15; Fri, 27 Apr 2018 23:00:53 +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: <7610d12b78ca93749eed420419d27062fbc009ba.1524868933.git.petrm@mellanox.com> Date: Sat, 28 Apr 2018 01:00:38 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Originating-IP: [89.176.83.59] X-ClientProxiedBy: DB7PR08CA0026.eurprd08.prod.outlook.com (2603:10a6:5:16::39) To VI1PR05MB4191.eurprd05.prod.outlook.com (2603:10a6:803:4e::17) 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:VI1PR05MB4191; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 3:wG8vskUG+oDAIulQIeNqSB5bEjx0T2pkemzShrc47op/IzgfNwz8gIvPVbI38EM4leU8wE7istNeSWplLLJLQ3XWRcxYu8ZohvO86DWFFMhrw8+Iy8/rk7hOdxz79IHdwYyhB4anJD8Manp2GlStj75ECW3G0cPBZrJGFL/zrEE2siIRIxBYNlhW8ISRRqa+9nN7GDM++kmVEcjDGP/dTmSPuM6ArRWGOq/y/89+z8ArDSFT4MV5YOw8rr4iMwQj; 25:BRH17PmDlhRyI+jfFepuW3bC0d6juIwLf6UEkA3ZW6nr4qaB2yL9jdPNHui29GaY2X00TjTngCh2lX90Qy8MhjlH000kc0DsM9N1HzHZmaFz24ZooIbSH8/IZ9KLxUTmy5jN7ddUzeQhMxtBrGCiAbISiAG8B7+jZ/Rb6gmbPL6+982JEZVJ8DAyE+VJ6M22+Hp9ZZAXgQJuFq/rj+DxCo1iwhILfp1YqaNHwC0J3afi6dGNuA/syamOKdJr75FoAjJAUZfZvak/UuGf3COkaXTiYJ7p/qHWEjkPH7VVltouV040THvqxzHZdp0EOMjNVvftf/8nXimqif8R5/r3Cg==; 31:iFJAIJi9ikIGHCfVug5REpxJDLmFTgO74ZNtay0viNIuZ+fhvgIgnI+I72NP8E6miyxGKcscVC33SM7s8rlwz0BfgvODB4CFG9s+zIaoD3p9NGjj9Z2h+77fwHul1BMPaQVrDpII0Qz0nm5iJzDRGIQaAxsCGsUeGz8wJiGqlBA3XgQppY9b/I7TI8j/0LRT/nN5noRLoKngR5TKePHcR5MvKfVpSEtMFbb6mv1Dfdw= X-MS-TrafficTypeDiagnostic: VI1PR05MB4191: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 20:gMDTucehIUROtZJBExrI4xvFUz4vVdPqLJ4/XcWNgLQ45Pr+YOaw2s8k6aBtLHQeX+NORczBGdD4elW+2+MJgUw6ESCQkxAY/e38wv4C9csRzPO8DvgDhtZTRMtr/OERYN6i9cbfPk/+OMdKHgz8DFCTM1vZTKenhD3B3eQLSo+QduNaxceI18KTAdQfxGkE3qXFhy/DjqqmDQCKalq0MkAlm8VV/fd9FgecoTjQqELktMZoXifGtsGYCpqaF0nzsbGz+CRP8ZYUsOG9Z8v9VnQ9Hd8LKfOVidStue0WSLZwsWaFqwWUH3mU5GsIkavDvk8MbfA7blunOPDZjv5yQF6EJwm3Xzw8TQcuXTu6TFGWOl+W3kwwhIIRKrZywofsDPGAYZslysJJ8SGNuyKYltFNyMTSQ09eLL+zeidgXvu7DJX+4xoDOA3X/NEniL2+l5shKhw6sw9kUCKaQNdmZJeQ8BjUbU7LWf0KIHTN8zAFMBDloFmxx5NwMu9qZouM; 4:mG5cSVhyzlao4Ot9saP8ll1vLzI7hkiS7kci2K+j44brw9WOq9JmO38Da0oJZxwZNRIBoQzb6Yj4ct4N6DObyF/qEs8xATswYuw77ulC3/m5hahCr2d3rGOcA+7TM2NY2ID5d4Yfag11pUukyb33kJCIk3CsFTMNfAi918wDuSphoolL/CC8HFlhVv2UREBa0md2l14FHyFJGHyB1OVf6tLEHvSgD8Ul3u2oFtvtoY+1d4aq9DGQ461bHLwJ1/RAGdepXUpdRuRxh8BPtek7JA== 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)(93006095)(93001095)(10201501046)(3231243)(944501410)(52105095)(3002001)(6055026)(6041310)(20161123562045)(20161123564045)(201703131423095)(201703061421075)(20161123560045)(20161123558120)(6042181)(6072148)(201708071742011); SRVR:VI1PR05MB4191; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4191; X-Forefront-PRVS: 0655F9F006 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(189003)(199004)(476003)(2616005)(5660300001)(6486002)(53936002)(66066001)(486006)(86362001)(97736004)(6916009)(305945005)(26005)(48376002)(105586002)(107886003)(6666003)(50466002)(106356001)(956004)(11346002)(6496006)(446003)(16586007)(2351001)(508600001)(2906002)(4326008)(6116002)(25786009)(51416003)(8936002)(81156014)(36756003)(68736007)(8676002)(118296001)(58126008)(81166006)(59450400001)(386003)(52116002)(47776003)(7736002)(76176011)(3846002)(16526019); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4191; 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; VI1PR05MB4191; 23:7iYbWbGmRDpgwS4GlsHe69oXBXL8ISmU5eq3dqmiW?= =?us-ascii?Q?9/9kScXjNd48ykUYFMBRQcWTXxyxwHpd8b7bIhDNVOK9pzSKKykCP9ispEvR?= =?us-ascii?Q?ZJJ7zzPNfxLOh8/gGG/ZFZyHYtHFlDyMDUw4tZ2L9BAvEyzmhWUFD3EYuDJI?= =?us-ascii?Q?cmSRtJJkWi0221BfBXHb0dcbPZ73f7q2nuuqGg/RlnCnvtQgNc7ukrPA2gR2?= =?us-ascii?Q?N9HhVozuCB68gn0ez/9EP7hfnTYhWwJNoOKQBYZjZEmXfsTaxn3vR13cWryb?= =?us-ascii?Q?/OQwct7pjBy9D0Ekndaz2VrLo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fsITtF/uIAgCNymCu07LJ1fuegTKokHv/ANye5mHB1ccRGLZRdZh+Yjlrlia5nY7WgDOl08pCOEZVy1tHGSwfewp4oXdQ9UQrUOozMNAxdcHhTYcQMAtV1XaotVtuk6PCixcRHMu0tPCiCIkyL2zeRtKbXe7 X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 6:58XPuqKQ1p5hFS3CoHnPliAnKPqo2MrdljQRMg8/P+nADL1YuQNHxnUqanfGuTtht0oXwV1Iy0S1oB3fIDobNkxQFhQv9FhNQrSMMKR+FOEfy8f3AjmOlYykXLzbS3lRB5VsV0WWZwonWDfVJQYz8vycOEFlRdk1LrjEev9Tp+IcGLiqh2mePoBtB4bTmGka0oY9hEQPm+j6vOpe/cPyMfSdLTh0wq1kHtnEgVUMwH4F8kYjlLZuJ4MOI8Q6OQp+wQSISJGgOCWba0fSZNxW3y605tiSUzH7vWE7W+yv1x0WixaueJgDPxXVbFGn3q34Q0fwuXqOJzsc+UAV5RQC+QFnEubG86EhKq5/EYI/YLMmkwTFYoP+40U12ShLhM9c/9pA7uIYxS20g1j36tEubrGXBcTGCYGcQX40n96180uTCKLFGar3102Ersuw4qfFz9wjmQoSulEB/jI3OZVv3g==; 5:MgPT0URpyP8oqm7G4LTC/C9BLP3aWJj78PE5WIcrWxoq7n9MDn4kqwaCDAKkJaXDnMe+fHZFYGgmfpr+g2wwR3CexuSOC/AA3cU277YwPk9yAEkwF5bY9z3xPok5Z72mJ0cKpAF0CG+TQK1h4CC98PgG0lDTgVft2irJP1E8uFw=; 24:zrb2+NwShA8NDIDspFEyKRm9DV+ti02tgeqEhom4NSDrihIh8WHB/mWrsAjOhsTVibm9ZoODrCAj8jUGEFVgdORxBHc79b+EtKPHNZqNq28= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB4191; 7:JxJrduG7PyavrLiNkJh/oFqED0JRZCSGo/dhNHSgtY4QoQB2N9SNgNBQEvRq3AK14Ia8v9T6uGF7SVRkb3UJdEEocdcvpUeX4KoLAEmEa+Pb5pBGr+tGuMex2Gsyj0IY3UILS2q0SX6JO7PAXRBbU9tsuTY/+o+hR9ZgCx/pneXFZT1x9u82WnMnC1cS9Zn9UGiv+JyhIlJn8QcHK2nohWFgnf18imYPhTF/xdKfiEDyZhYh2zaQfImYyqjwnUPN X-MS-Office365-Filtering-Correlation-Id: e5ebf0af-dec7-4c30-3c31-08d5ac92bac9 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2018 23:00:53.7527 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e5ebf0af-dec7-4c30-3c31-08d5ac92bac9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4191 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);