From patchwork Thu Apr 26 16:32: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: 10366375 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 BE0C260225 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 B133B28A9C for ; Thu, 26 Apr 2018 16:33:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A595028B70; Thu, 26 Apr 2018 16:33:33 +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 C6B212904E for ; Thu, 26 Apr 2018 16:33:06 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40X2g50pVjzF255 for ; Fri, 27 Apr 2018 02:33:05 +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="raEI1D98"; 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:fe02::617; 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="raEI1D98"; dkim-atps=neutral Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0617.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe02::617]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40X2fz4L5QzF24t for ; Fri, 27 Apr 2018 02:32:59 +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=Ma/KISoKsb00j9yr5BYbaZKhK1EIKEN3FtUuNg93TR0=; b=raEI1D98DAIa4J/EM4joeA891aUunn8ivr1wktnlzxCGjQ5KfFM1TtgWEnYuOX+iCbeqsBRhtOLIYnC3rqTbInmryalCG97+6A3GMPgh19Viy5/cGBYebbSucBZ0S4Oo9pJtt35jFZtca+UOfMSujtc0tfGJhpVvnPhu7XUbhVg= Received: from t540p (78.45.160.211) by AM0PR05MB4177.eurprd05.prod.outlook.com (2603:10a6:208:57::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.18; Thu, 26 Apr 2018 16:32:53 +0000 From: Petr Machata To: Subject: [PATCH net-next mlxsw v2 4/6] mlxsw: spectrum: Register SPAN before switchdev In-Reply-To: References: Message-Id: <46203c40b781806a7ef972c6a6325681ea155ed2.1524759641.git.petrm@mellanox.com> Date: Thu, 26 Apr 2018 18:32:49 +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: DB6PR07CA0001.eurprd07.prod.outlook.com (2603:10a6:6:2d::11) To AM0PR05MB4177.eurprd05.prod.outlook.com (2603:10a6:208:57::26) 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:AM0PR05MB4177; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4177; 3:QPCkJBddQ/HeYGyeJOKF4e+aNdTxMVz1nhCCfiRtqL/FTgrR7SdAnK0B+Y29Oc5z2WPPO1BaMO/ZnzIrhheGdvyFnrnyJ8r65NXnQkh+p33u7OulovFgvG7qsSrGpSAcsHUOasx3pTEEGxcaRhHL9RZjmz2rtcP3eEvnzHYHP4CwtU1vtGCKld76lG8N4NqV/lgCJkfw49zKODYrvU8gaWn7pBV5j6Oi/V01yDFUsUFYegrr3dIxOAYr32duI3El; 25:PgBpame6vbEkxMwZ6Axt1KB9faQvgfky9zLBRAREzr4fwReuRm6/j29oSjaB7wycGZhMz6VuaxgSfZU9PCkgm5CxFqeugm7Ubm9uZgrIOK2+uqsjT5nSZ5Ulzathe64mSYB2Sfcx/UjXYNkcx+w8mm+DBdSvXzIW5Wu9plLOdSzlo1GSqlZJjTlFcpNmB4sOe9vrdTAweGJS2BvuAjiVwzzXqrwIsvRT3sUYWSz2n3PIFWYGr6wF8/t0+jH5RzAODvJkwVFu07IZnDIii0noSN9j44FTK9Hr6c40pwaCAiJdL8kRwv2atzucCvAx9pQbAypqGd2Hs96uXmBetcMadw==; 31:1oAB0ic9EYic96mf0a1nCuSb41sD7UIKEHrIoe9b6Ko3J2lwF4tqArreqd6atZv9q0YQW6O2ms8VOHKIcNZGThz+YgbmTrbBPz+Fu5q4SoQYfk96GO8CYLK603UxK/S80iA8oyTeyperAVb0d+DSuPc4FBQnNya/jUz/MvyFYq7DzeNJfMOeG/AMYBlGpS8wpB+B9aDSOF2U0Hf5LoV0jBdk1pcqaqPYII0JjdVSk2I= X-MS-TrafficTypeDiagnostic: AM0PR05MB4177: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4177; 20:eVvGYcZxq1JSOBko7034x669lpoQeGgKWWX0EhwZiRI1EJfmF6NbgVN7dl6p2ZbYb88nBKeMiXATjoUiICAaqIbq215wlR7ukTM2LhsNc0X9zLA6nJpwtfn0ISWV59BIZvozwdyBnDXTC32Oiqh+KDCj/GI8DmHtaWRKDViooY5RtH02VKGgYHqFPZ8rBChs4DYoHn2UwUEvsvBwxgjVIy/64wsCQQxNhcLdLsGGmQ/kJ+9uklznAdd09BKcIyyUw3ZX53jLGjwAW7uMCom3VX1HjIre+K1k3SkJyV6wu0Od1IsHLpWBeC78zj/fvhsAkyOz/EU16CYSLtnU8A5RZhlN9sCK2ixj+okpxY5NYOVoa0BPYwPLgVP+e0v4UMUrFQxsG8MNOyNscYFfddU47Ubs0V/wWXtqsJztKrwlLGWspB3y6Zwxq9r1OaiB8f1lMKDVbLcpxgCYIwvGfgFr8daXe4LvGWOMV9undEk/SQ9KoEpu4zQiuA7ubctZKSDc; 4:lIwchJUk0cKd0awMkEMCGeDYpQ88pduff0RpGecWw8532m/Pl7LiKmmRPg3DaJd32PhY9A6jhk0z0QPTcmw0wMEzoS9k+z3R6J3ZoyaHxPBzWFhvMMcuPqYB20S98s0xsjSMl9rBC83InYUmqTwQohg1U6CHLjhunQwYsu3hOKXQeXXympHeZdDNbF//a3x8Q/7hjUwHYZ9kT/50tAwdWrzIvAh9kenT2/1HOrVHp163gKFxItrZ9SrUI1zltdwGUR8L038waYfQPHwV5ObjQg== 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)(10201501046)(93006095)(93001095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:AM0PR05MB4177; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4177; X-Forefront-PRVS: 0654257CF5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39380400002)(366004)(39860400002)(376002)(396003)(199004)(189003)(386003)(53936002)(25786009)(478600001)(76176011)(51416003)(7736002)(6496006)(16526019)(52116002)(36756003)(26005)(486006)(446003)(86362001)(956004)(11346002)(2616005)(476003)(68736007)(16586007)(316002)(48376002)(105586002)(58126008)(106356001)(107886003)(4326008)(6486002)(305945005)(2351001)(81156014)(8676002)(81166006)(2906002)(118296001)(50466002)(97736004)(6916009)(66066001)(47776003)(5660300001)(3846002)(6116002)(8936002)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4177; 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; AM0PR05MB4177; 23:0DSW55FbZHlw4VW7SAt9vbEyXdAR6o6CgXHIIBP0r?= =?us-ascii?Q?pE4f76IrurURK8N/5eujNq2nTfEabKJiWixmVAGOZc8N0GUZERzHTRn+d2Rm?= =?us-ascii?Q?Nxax7YdwqctWjWLNXswEORZINoAoWemvFiiDTq4jI6KxFNKXHB1RdHlayAS2?= =?us-ascii?Q?AF/LC5TcyIG3B0TORf3eKAfPAnuN/Sn06A2T1K8bINwX8fXBc1hAuaf+GlEp?= =?us-ascii?Q?4dV3rgXOCzQ/AMYv1aOKVwIeRZbng3fVAGLbqWdWuca23IJDkiJEv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fW3ZJgzacaGug6OTL7BK+YvI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR05MB4177; 7:fUxNUPXyBJux89WeCRjKbG1ngsxmWDGEaWRUViA/QWAxjZGOvvRIGMx7tE2j3uVktZRQyA6svKHEhsU1/y55YNnSTwX0iAuQLy6yLptrx5Qtx2QbhBVmzlMe04CAmtswI3J+EnKpeo4TFbxcUCk7+Z9LmIog55XEi6Ia7XCXEmivM4oAn8mVL7O9/P5aeMIA12E5MJHQWzL4KeLBX6+sJCvR6YyDT4llJkRNDCAwFAL8TDj7q7lYHXzfSRpe9TV2 X-MS-Office365-Filtering-Correlation-Id: 43996273-d3f6-4c86-417e-08d5ab935c64 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2018 16:32:53.8597 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43996273-d3f6-4c86-417e-08d5ab935c64 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4177 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 Since switchdev events can trigger SPAN respin, it is necessary that the data structures are available. Register SPAN first, with a commentary on what the dependencies are. Signed-off-by: Petr Machata --- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 7317fb8..94132f6 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -3666,6 +3666,15 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core, goto err_lag_init; } + /* Initialize SPAN before router and switchdev, so that those components + * can call mlxsw_sp_span_respin(). + */ + err = mlxsw_sp_span_init(mlxsw_sp); + if (err) { + dev_err(mlxsw_sp->bus_info->dev, "Failed to init span system\n"); + goto err_span_init; + } + err = mlxsw_sp_switchdev_init(mlxsw_sp); if (err) { dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize switchdev\n"); @@ -3684,15 +3693,6 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core, goto err_afa_init; } - err = mlxsw_sp_span_init(mlxsw_sp); - if (err) { - dev_err(mlxsw_sp->bus_info->dev, "Failed to init span system\n"); - goto err_span_init; - } - - /* Initialize router after SPAN is initialized, so that the FIB and - * neighbor event handlers can issue SPAN respin. - */ err = mlxsw_sp_router_init(mlxsw_sp); if (err) { dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize router\n"); @@ -3739,14 +3739,14 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core, err_netdev_notifier: mlxsw_sp_router_fini(mlxsw_sp); err_router_init: - mlxsw_sp_span_fini(mlxsw_sp); -err_span_init: mlxsw_sp_afa_fini(mlxsw_sp); err_afa_init: mlxsw_sp_counter_pool_fini(mlxsw_sp); err_counter_pool_init: mlxsw_sp_switchdev_fini(mlxsw_sp); err_switchdev_init: + mlxsw_sp_span_fini(mlxsw_sp); +err_span_init: mlxsw_sp_lag_fini(mlxsw_sp); err_lag_init: mlxsw_sp_buffers_fini(mlxsw_sp); @@ -3768,10 +3768,10 @@ static void mlxsw_sp_fini(struct mlxsw_core *mlxsw_core) mlxsw_sp_acl_fini(mlxsw_sp); unregister_netdevice_notifier(&mlxsw_sp->netdevice_nb); mlxsw_sp_router_fini(mlxsw_sp); - mlxsw_sp_span_fini(mlxsw_sp); mlxsw_sp_afa_fini(mlxsw_sp); mlxsw_sp_counter_pool_fini(mlxsw_sp); mlxsw_sp_switchdev_fini(mlxsw_sp); + mlxsw_sp_span_fini(mlxsw_sp); mlxsw_sp_lag_fini(mlxsw_sp); mlxsw_sp_buffers_fini(mlxsw_sp); mlxsw_sp_traps_fini(mlxsw_sp);