From patchwork Wed Apr 29 22:54:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 220278 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E1B4C83007 for ; Wed, 29 Apr 2020 22:55:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 48AB1208E0 for ; Wed, 29 Apr 2020 22:55:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="q1I9D04+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727041AbgD2WzU (ORCPT ); Wed, 29 Apr 2020 18:55:20 -0400 Received: from mail-eopbgr10044.outbound.protection.outlook.com ([40.107.1.44]:62734 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726921AbgD2WzT (ORCPT ); Wed, 29 Apr 2020 18:55:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TV66nJ6ieitJXLrjqWOl+uaBthEhdKpbgzDbg10s9tK8HKonqcokbr+uTKGhlCge4fErbIrG5DIiX55tDota2i/Y596D4XlP0bQqH+l0LlcC5IsJ4VXJIMtGy2vXqooTB22O0U+Ja2RlUqaQCOYJjc8fkaO4OCaQQI53Se8H/LfvYUy7swEK4ekg28+jKhJqcvJOyg/Hs3H7mZLOSbJyVfJn3kwKltytI+YHC1PsmzS0fTpGV/AKd5M7pfo29JEidixJCejbdSk+b1cWssWwzxjidPG73X20kd+jHK4iz93oiYGr4C2uW9CXN3o0fTUFGcd/b0N9dclTIHLmR0DExQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SvHeERn0eXqOMzXM7akpVNlcZYNngzJx4qJAga6mxKA=; b=lfocPlP9Y7NWl13mVWXKOSOgLNcDk3gnTfcZVN13s0CTzb77P9kHrPELie3yRtx/qrS7oeDuh7I8hF/gtyQOrLqOuQXRpT9ggBTwqDalWg8hBIS3oY1VHFxCYI6ksOkap70gzGS5TzQzakWMycy9rdiw299ggi98QOHPeRccQOJ+A5njToZNNfthEZqGh2rkcPFZdq1SVqzY+9pwdgti2QiQLNBSFaDUnorn1hLUKHNObdUErA8BQQveti22bHrNiL7Gbv46X14JEmNMGsDvenG338lSkPxlOXNh2X8gcQawASgOqKt08QI6Zs8Pr2jykUQLt8c971xelhLzepTlDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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:X-MS-Exchange-SenderADCheck; bh=SvHeERn0eXqOMzXM7akpVNlcZYNngzJx4qJAga6mxKA=; b=q1I9D04+MmBFE4nrjly0yOKJrlpWFF/xAwzktGJmCNqtRB36/O7WZgd+HByXbv6lQwY79wG2iMIsydz9yWsXfJPTakOswTkePpEUI5+jjWgAG3jSQd/OJbO2FQ1vbW9HYQnRfCsXQ3qbcnJs4UPlquHgOJZXIuqiIM6o+4z/Af0= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none; davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB5247.eurprd05.prod.outlook.com (2603:10a6:803:ae::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.22; Wed, 29 Apr 2020 22:55:12 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::9d19:a564:b84e:7c19]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::9d19:a564:b84e:7c19%7]) with mapi id 15.20.2937.028; Wed, 29 Apr 2020 22:55:12 +0000 From: Saeed Mahameed To: "David S. Miller" Cc: netdev@vger.kernel.org, Parav Pandit , Roi Dayan , Saeed Mahameed Subject: [net 1/8] net/mlx5: E-switch, Fix error unwinding flow for steering init failure Date: Wed, 29 Apr 2020 15:54:42 -0700 Message-Id: <20200429225449.60664-2-saeedm@mellanox.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200429225449.60664-1-saeedm@mellanox.com> References: <20200429225449.60664-1-saeedm@mellanox.com> X-ClientProxiedBy: BY5PR04CA0022.namprd04.prod.outlook.com (2603:10b6:a03:1d0::32) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY5PR04CA0022.namprd04.prod.outlook.com (2603:10b6:a03:1d0::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Wed, 29 Apr 2020 22:55:11 +0000 X-Mailer: git-send-email 2.25.4 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d766c940-b92d-4193-a0cd-08d7ec905ff6 X-MS-TrafficTypeDiagnostic: VI1PR05MB5247:|VI1PR05MB5247: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:304; X-Forefront-PRVS: 03883BD916 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR05MB5102.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(39860400002)(366004)(136003)(346002)(376002)(54906003)(478600001)(6512007)(2906002)(66556008)(6916009)(66476007)(316002)(107886003)(6486002)(52116002)(6506007)(66946007)(6666004)(2616005)(186003)(8676002)(16526019)(26005)(86362001)(8936002)(36756003)(1076003)(5660300002)(4326008)(956004)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: owkiFY35RLEuj+QrTOXuk9mpb4g0l/ATgWJgQs1kLEo+t9cQgulJWlbwdecuJdji5sFWWQ8sGCuR9Dq20bU9xHeFQxTBNV4ob5OL9ns/NVktZQbaplyijkxGQPv5wNtcEdeM9JFNRa2dliy82Oex4DZ0I4+xyyV8Js+UR3zWR616cy1x++KtocEYjRn9dDGMaqGmIlB/5fydP2wOM3tHauiZX7O5SIzsM3wTAlVJ8IjBq96UHayMFFljH9gapsDdm7XFq2WK0mEivfybwvwIjrfgd48KnkvlLDbtE4SuitbyXzgnG2plBInpAiFFQau1QSGgjqX793lZC69pMS62CTS4ULZ0k5yqkgLX3u1mONCylDARe62RAo3rBdhetsjVd1o83yCDNaClTNFTyk2GFS2vZjQWVEkBp+AD57umCBS6gGMAY1HwBwJM67OXbj3BreOYH3EfLbJ1f6eccXxMNmDOvCLP/W0V9d1skIQ5XYbyEhDG/FvrXMR6VUXINGbe X-MS-Exchange-AntiSpam-MessageData: G4KfxygI/3A2+l6+G4/O+ar+kLOK/MiXLlhX0pQppbNmAR+NIB8sSCooUf27OoTwcjWU6/XC0jh1/WAbEpccicEu1+VRKyf0bEcEQr/3BGntFSa60prQFW8cjRWtKYiUcui/GUNQBnbsoVaNVPPBdkBRHINgcH79NiAWXF1/LWqcXZgPKoimqcjBx+jCwYJZCF7VRhl+WfL6e0pAf7KKRuSUIvHr5/fZ4M1xBU0sN5zMRXqZ2En8IvA2skHCFStvvz9/yiM+LBq/dimCj8mP3HqSC349grEHB4q9ELoHZ0QnqiAEkxTmb8378pl9nEVxKdrBQtEzZgym9d6Ay9w/1h9LTgtWw+qWYjtrwGJAAVuqGApXx1jDnkDABxG6xybRXN1GU1Rze7dFS77/yPHvXsY6FhDYMa7Nun0ESZw6wCjGXdv/YGXvcsGrPLVvE0GXaYE/m8RO6iDJfOTBKfEm6gQtMVS1dLFDie5ix7gwhRDgIWjdW2dUP5311oykqaXVy/EcxPT8GFAqiXFhtZUGgBFnv3PUwNzW89IfuwAVTxeUUVG4523X8m5EHenEneyyeSVnHakhQ/CCR9/sHcnFvtV60Hhn9DYudtT2NKC+Pw2cy3O743T6Bk6BKI2nfe7Q5IM+cd18IkObrki++NRNjXIJIKvzta3ffrF4VdKNfoJWLcw0VNIUW0WsmLvVz64Enz1SrKZAEK52Df7c0cCuGNJgjQY2pyndQUI4QYuryog0gXqDKLOkBS2KSwF18D/6x7m3Rz4s8bmLf/n+yvwYeJIPmgNADFrZq9gkdlDmXOQ= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d766c940-b92d-4193-a0cd-08d7ec905ff6 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2020 22:55:12.7987 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yPfSIj+4UDUMxkQdh+QCV09Z6Fkz719Zc5eJohl668cTqp7wUvBxS/FSUHflqwfw9bcdjmx7vG1At64YGlVBhg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5247 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Parav Pandit Error unwinding is done incorrectly in the cited commit. When steering init fails, there is no need to perform steering cleanup. When vport error exists, error cleanup should be mirror of the setup routine, i.e. to perform steering cleanup before metadata cleanup. This avoids the call trace in accessing uninitialized objects which are skipped during steering_init() due to failure in steering_init(). Call trace: mlx5_cmd_modify_header_alloc:805:(pid 21128): too many modify header actions 1, max supported 0 E-Switch: Failed to create restore mod header BUG: kernel NULL pointer dereference, address: 00000000000000d0 [ 677.263079] mlx5_destroy_flow_group+0x13/0x80 [mlx5_core] [ 677.268921] esw_offloads_steering_cleanup+0x51/0xf0 [mlx5_core] [ 677.275281] esw_offloads_enable+0x1a5/0x800 [mlx5_core] [ 677.280949] mlx5_eswitch_enable_locked+0x155/0x860 [mlx5_core] [ 677.287227] mlx5_devlink_eswitch_mode_set+0x1af/0x320 [ 677.293741] devlink_nl_cmd_eswitch_set_doit+0x41/0xb0 [ 677.299217] genl_rcv_msg+0x1eb/0x430 Fixes: 7983a675ba65 ("net/mlx5: E-Switch, Enable chains only if regs loopback is enabled") Signed-off-by: Parav Pandit Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index b2e38e0cde97..94d6c91a8612 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -2377,9 +2377,9 @@ int esw_offloads_enable(struct mlx5_eswitch *esw) err_vports: esw_offloads_unload_rep(esw, MLX5_VPORT_UPLINK); err_uplink: - esw_set_passing_vport_metadata(esw, false); -err_steering_init: esw_offloads_steering_cleanup(esw); +err_steering_init: + esw_set_passing_vport_metadata(esw, false); err_vport_metadata: mlx5_rdma_disable_roce(esw->dev); mutex_destroy(&esw->offloads.termtbl_mutex); From patchwork Wed Apr 29 22:54:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 220277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BDC5C83000 for ; Wed, 29 Apr 2020 22:55:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 536D02083B for ; Wed, 29 Apr 2020 22:55:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="Kciuv5l0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727101AbgD2Wz0 (ORCPT ); Wed, 29 Apr 2020 18:55:26 -0400 Received: from mail-eopbgr10044.outbound.protection.outlook.com ([40.107.1.44]:62734 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726921AbgD2WzZ (ORCPT ); Wed, 29 Apr 2020 18:55:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OFaxs+nHBb1AlIwJ2CaoNITP8yAt0NT8/iFh+1YFwbO70OMH7un/IU2qCAk5HQNuMMBzV2oMfnwf2LH9nvbc8FFa2hkPNO3AnWhXGvXxinijwSdPWx6yLn7RSK/UUQuqxjgbndSwcs26GvwFHAuC7eexYlYlB2NG7pR/qmruUOJH6ZQIWOLtVTEHe9JMwwFAsv4Q10TJi+rGn2mKcNaJBAe/QA1SUkV2MTaxCCxCzl5iFxngHzYAg5Fa6+UyDnhBuybUtopztZK5xi4S+PFJYQ81EUzkdckzSdE2pDc482lEFMKJi5qfSHrLGT9oQbfAjTO+S3J8ybDO3xvHjVT5nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FnnRGl9JJjbJXFUaHUNhM5ruYj30IC5ttZn/9ec7tss=; b=nM8M4OTkD0zv6u0Ptlg3NZmDc+P8ayWJ9K9wXiqHevnKe6weZCogPxqUysIfAzStgzyQElyXn472ahj9c7CWuljMeKQOYSwveA2GqOirIQQQRt2zypcXf7MytUAdzm30ioawnQhDGcMkMwVDk9QLruOMGiXD+yLV0D1mAOr/eg2zQms119D+Ao8uYEkMbXfaSb/+cAnnpDKl7YPVVeHmQYKbdrLDxAaijwTiuBeqXwyaMCEs3l/XM8eDO4f63eBnA9c7YnaLyeIoC3qu3kuD2zAO6tnLWH2FaWNv7FhEGzST95cluzSTXq0KksQNZvfQSwY80nx86MG6gndhCfR0eQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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:X-MS-Exchange-SenderADCheck; bh=FnnRGl9JJjbJXFUaHUNhM5ruYj30IC5ttZn/9ec7tss=; b=Kciuv5l0LTVSRRxyDhPbfB6AWuKT4/1oSOOTmBouZ69kmauh7soGoDJHASZEE1FCccuRin6V9Gi8yykcnHFzX7o2/iru0EAhHoHlUCsFDBv+D+G401lePY512Iui54UcoC8CovKnxuI7KGqGhvxwawx9OK9hPFnnnoToQCbDC4k= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none; davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB5247.eurprd05.prod.outlook.com (2603:10a6:803:ae::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.22; Wed, 29 Apr 2020 22:55:17 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::9d19:a564:b84e:7c19]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::9d19:a564:b84e:7c19%7]) with mapi id 15.20.2937.028; Wed, 29 Apr 2020 22:55:17 +0000 From: Saeed Mahameed To: "David S. Miller" Cc: netdev@vger.kernel.org, Parav Pandit , Roi Dayan , Eli Cohen , Saeed Mahameed Subject: [net 3/8] net/mlx5: E-switch, Fix mutex init order Date: Wed, 29 Apr 2020 15:54:44 -0700 Message-Id: <20200429225449.60664-4-saeedm@mellanox.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200429225449.60664-1-saeedm@mellanox.com> References: <20200429225449.60664-1-saeedm@mellanox.com> X-ClientProxiedBy: BY5PR04CA0022.namprd04.prod.outlook.com (2603:10b6:a03:1d0::32) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY5PR04CA0022.namprd04.prod.outlook.com (2603:10b6:a03:1d0::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Wed, 29 Apr 2020 22:55:15 +0000 X-Mailer: git-send-email 2.25.4 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: dde5075c-3e46-4e31-914c-08d7ec906282 X-MS-TrafficTypeDiagnostic: VI1PR05MB5247:|VI1PR05MB5247: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2043; X-Forefront-PRVS: 03883BD916 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR05MB5102.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(39860400002)(366004)(136003)(346002)(376002)(54906003)(478600001)(6512007)(2906002)(66556008)(6916009)(66476007)(316002)(107886003)(6486002)(52116002)(6506007)(66946007)(6666004)(2616005)(186003)(8676002)(16526019)(26005)(86362001)(8936002)(36756003)(1076003)(5660300002)(4326008)(956004)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: L9XsMEJJIuNIRl/6/gPIIouJIlaYcDKwjcUngU6pDg47ucrh+SusWD6QEZ7t1RWugMCR08jv27New7WkUL7JZiv+UiW9rIfW6I12ETQ32bNfA61co1t1pNe2cqvgAEfjgqm0O9YZRNxnhzVtX3SHXpDB1/nmHDb0VFEwgDtcx0J+ZlonQNuHykZKGgFBFJYJPOAN2unY3c1VcPyMM6x9tw/07nJXSvqyvaCNn4cY6oo9IZQniK8nVMZusOyUppWIvZN5wP/YlUVolpPVObzP07c+J7ai7pTDZNru7pgX0JtZhY/93x9GsasnZaauH/PzbAApOzGSVQf4Te+7wfkoBwtxpfGDLTUbmAxw1Wn5BnbSnPWY8jXYLJMqO1FxnvFvGKIqmCyTGfl9WQJKOQkSZ/Y+XK9yVMmLoUA6qQtQ602mc0yUEy7+aPXU/cdw+TQujQx/yF/WjwwM3CVhP3MTRu575ADYKpQG49p6J77Eyzt8C+ZXXqhaGYSCitMxS0q1 X-MS-Exchange-AntiSpam-MessageData: a+YeogfRYlf+wzsFbxa6F+aZlH6x47uegrs9dwWi8CRQXCManF10GR3xZEOuGgloII3bPB67hYhOO4KklmcLM6dx68XEI4DCfj/YPNsMa/U2T6RlZiu819HGWWeL9SxLdgS+vs73uEK2iOoV25HSp1fmS9d+laq4sBZZLNDsJRi0jz9oqn4X1Z0dAzWmbrMEn9ykMfUa8S65fl7WOYWrE5zwdXapiJmb2jIz75vJGXRXiEhFcrb7TaMw+pTT3iuWOnNtr/MeTZvSpTUk3/+47b+GeEa0FAPM3jCTyfRyI6HtnV9Uz6L2wRGU2kaKIPPwmEVFYgiZpzxeeqg4VcZYY+qao38Rfi++GRoi4Ud1q/1tOUInLCAz3sTJa0fmmRJ8vNTq4rNyyeOx1+w6GtDtdfEAPNzJPu8JfkOUPZ6DLkYWGGwnSGiOe+5ziLg3EBurDeZ+9paxpJuBfuD0LNOx24QBkpqH8NBu39Oy962qaAF8fI8iEhtjfTZpM2fMHJckBzaTt8f/H8q+O6QsZ38LRf4exQKM/7Zu6McAHQYYtw3MLTIKbAOZmoKSxZpyjhD9Ypir7om4DRQNpgzXQ/U3CSf4hi/nQVICCLtICXkEdBRpUABbFpesRA/kd4UYp5hunxeckpLANw2oRf8l6HNe6kiAAcHnqHzn+b+7dDzPv58eOmISATzC1P2kpLrN35OBBV3yqo/3epy7S0TMXlR5yRe+yJ+ilqqwWtrRKn21dXSfrB4dFPekfGEs3KR7eeCEq5DAToJynvjnO0pRkyTaAx319RLQlCbIHja4ab9rt5A= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: dde5075c-3e46-4e31-914c-08d7ec906282 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2020 22:55:17.0483 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Setb+W4C81N+lU4xI4zKOF8FdoUk+NxIeBulDfL4Goy76v9E0uyJ1HsfwcWwQcGUQ6c3lu0/ko+CzBaBkEy+cw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5247 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Parav Pandit In cited patch mutex is initialized after its used. Below call trace is observed. Fix the order to initialize the mutex early enough. Similarly follow mirror sequence during cleanup. kernel: DEBUG_LOCKS_WARN_ON(lock->magic != lock) kernel: WARNING: CPU: 5 PID: 45916 at kernel/locking/mutex.c:938 __mutex_lock+0x7d6/0x8a0 kernel: Call Trace: kernel: ? esw_vport_tbl_get+0x3b/0x250 [mlx5_core] kernel: ? mark_held_locks+0x55/0x70 kernel: ? __slab_free+0x274/0x400 kernel: ? lockdep_hardirqs_on+0x140/0x1d0 kernel: esw_vport_tbl_get+0x3b/0x250 [mlx5_core] kernel: ? mlx5_esw_chains_create_fdb_prio+0xa57/0xc20 [mlx5_core] kernel: mlx5_esw_vport_tbl_get+0x88/0xf0 [mlx5_core] kernel: mlx5_esw_chains_create+0x2f3/0x3e0 [mlx5_core] kernel: esw_create_offloads_fdb_tables+0x11d/0x580 [mlx5_core] kernel: esw_offloads_enable+0x26d/0x540 [mlx5_core] kernel: mlx5_eswitch_enable_locked+0x155/0x860 [mlx5_core] kernel: mlx5_devlink_eswitch_mode_set+0x1af/0x320 [mlx5_core] kernel: devlink_nl_cmd_eswitch_set_doit+0x41/0xb0 Fixes: 96e326878fa5 ("net/mlx5e: Eswitch, Use per vport tables for mirroring") Signed-off-by: Parav Pandit Reviewed-by: Roi Dayan Reviewed-by: Eli Cohen Signed-off-by: Saeed Mahameed --- .../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 8289af360e8d..5d9def18ae3a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -2219,10 +2219,12 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw) total_vports = num_vfs + MLX5_SPECIAL_VPORTS(esw->dev); memset(&esw->fdb_table.offloads, 0, sizeof(struct offloads_fdb)); + mutex_init(&esw->fdb_table.offloads.vports.lock); + hash_init(esw->fdb_table.offloads.vports.table); err = esw_create_uplink_offloads_acl_tables(esw); if (err) - return err; + goto create_acl_err; err = esw_create_offloads_table(esw, total_vports); if (err) @@ -2240,9 +2242,6 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw) if (err) goto create_fg_err; - mutex_init(&esw->fdb_table.offloads.vports.lock); - hash_init(esw->fdb_table.offloads.vports.table); - return 0; create_fg_err: @@ -2253,18 +2252,19 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw) esw_destroy_offloads_table(esw); create_offloads_err: esw_destroy_uplink_offloads_acl_tables(esw); - +create_acl_err: + mutex_destroy(&esw->fdb_table.offloads.vports.lock); return err; } static void esw_offloads_steering_cleanup(struct mlx5_eswitch *esw) { - mutex_destroy(&esw->fdb_table.offloads.vports.lock); esw_destroy_vport_rx_group(esw); esw_destroy_offloads_fdb_tables(esw); esw_destroy_restore_table(esw); esw_destroy_offloads_table(esw); esw_destroy_uplink_offloads_acl_tables(esw); + mutex_destroy(&esw->fdb_table.offloads.vports.lock); } static void From patchwork Wed Apr 29 22:54:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 220276 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5E81C83004 for ; Wed, 29 Apr 2020 22:55:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9FC572083B for ; Wed, 29 Apr 2020 22:55:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="LWW9DIH2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727119AbgD2Wzd (ORCPT ); Wed, 29 Apr 2020 18:55:33 -0400 Received: from mail-eopbgr10044.outbound.protection.outlook.com ([40.107.1.44]:62734 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726921AbgD2Wzc (ORCPT ); Wed, 29 Apr 2020 18:55:32 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B6k7hikvIsSsIp8jDl9FKukCSmX1Ad0FS8qWtEtFntpJcrK+h8t8kqX/r/9I0EXCd6wzYghjAi48CxXgiO0PLnAqS9AY6slJOCSIz5qGJV2SEwSl+OQNdPeOKEFOMSzBN5UPvuhz5kZ6ET3gbkFL7o5ps9boaW3CvDAF6iFE5Vh1FomJaXumSbj1IAAwzfQ+C41TtHEH18J2Yr9XYua89pmvUsguWbGxz2ivt4vtawpxyszpF9/b6z9hycu2RcSL6N2eIHtJAeRVPuR/28SkC0AHqeqCDJz8i1GjtyXqY3B2FjFxwAcY4qlDSdmoEOtz61RvtfYshQAEI8vMXSjjqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jDTnDYg6sA4HUMMHwJEE5tyBd3AUT5vrm+p3jaCPNVM=; b=h31457/oL9tR+s7Me/Mym5+Q31r2LoLrjy19KRdnf5Sn1eCeKUbaNeJ0nAox6JhCuCn7DMkRMT5Vh84UcxQKbujSy+qrdmiooUWf4c73G0lrInPXxP+WiMp5cGnhIIKD0ZwAQlsI19l7SA05zdYJy0nDCpF8jktL/hH7CzjBnK7MSqDmIX8QUlHsQU3PHDZTDSMmqIxc0A9CvBSL1i6qGnpNd+TNLcO7D/qmpHiHrJ0aULarGBX01iu5UIfKaR30u935R+Jto/caEfFQJm/aI1FljXidkE8XpekPv/R+1OJinkQ/Bm9pnsj6mfl6sHAbat4ClMK2wuyk8cSGDqu5ig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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:X-MS-Exchange-SenderADCheck; bh=jDTnDYg6sA4HUMMHwJEE5tyBd3AUT5vrm+p3jaCPNVM=; b=LWW9DIH27mfpz5VHb0zMBdIfCL8mZABpL4giDispn71vNaadb6N7lSc0IfT/mq6ADILo7KZcUiv2PIFrxjGvWn3jfcvPiUtYKx9kWxzDJXSr/x2kYQwfHonJGmHBv4RS5Gm+QIjGB8mcUtHXpxdEeB0K+SBJ3GDZEo4B+0d8EgY= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none; davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB5247.eurprd05.prod.outlook.com (2603:10a6:803:ae::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.22; Wed, 29 Apr 2020 22:55:21 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::9d19:a564:b84e:7c19]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::9d19:a564:b84e:7c19%7]) with mapi id 15.20.2937.028; Wed, 29 Apr 2020 22:55:21 +0000 From: Saeed Mahameed To: "David S. Miller" Cc: netdev@vger.kernel.org, Moshe Shemesh , Eran Ben Elisha , Saeed Mahameed Subject: [net 5/8] net/mlx5: Fix forced completion access non initialized command entry Date: Wed, 29 Apr 2020 15:54:46 -0700 Message-Id: <20200429225449.60664-6-saeedm@mellanox.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200429225449.60664-1-saeedm@mellanox.com> References: <20200429225449.60664-1-saeedm@mellanox.com> X-ClientProxiedBy: BY5PR04CA0022.namprd04.prod.outlook.com (2603:10b6:a03:1d0::32) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY5PR04CA0022.namprd04.prod.outlook.com (2603:10b6:a03:1d0::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Wed, 29 Apr 2020 22:55:19 +0000 X-Mailer: git-send-email 2.25.4 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 414020ef-9050-4e1f-eac1-08d7ec906502 X-MS-TrafficTypeDiagnostic: VI1PR05MB5247:|VI1PR05MB5247: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3968; X-Forefront-PRVS: 03883BD916 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR05MB5102.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(39860400002)(366004)(136003)(346002)(376002)(54906003)(478600001)(6512007)(2906002)(66556008)(6916009)(66476007)(316002)(107886003)(6486002)(52116002)(6506007)(66946007)(6666004)(2616005)(186003)(8676002)(16526019)(26005)(86362001)(8936002)(36756003)(1076003)(5660300002)(4326008)(956004)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nIViieUlXOLdOMwMpprid5hLTf0ZhbE+SWhNae4NqVoPDz6bWxiFaT78uFJkFpKVq49EUPK9kt2eZoyGNR+T199IbypbrXsPifNqUPhKS4MwufeEoxBDdXkKFXXKHivXjJFH5vYCs1tCEMzM7yInnEgR/ZhydgEVZOTTqznANfstGJo0PYCiy2XV8FOaZs3ycMyS6lWrXC2wFmJ/T22oLye8Nzl5LHtfswDdzSKlXJkrRH8f37bD5lqdF4+MMNsXx86PQfUkblpw+LKKTZCmo21L0blz9I1B6XFaznQ01a1YKYtgPmZ1yjkUWJNOs+bGi1mJQkPO8VAzf96goYWOamJpSoVOuAWSZuXPh6FJXGgram2nloEF68acfi37zb1XkhuviB41c+XDC42ZChGP04QQw2Ys3Eci5oU3vxMZSAFD/9obwaHZ/hGGaHCY2Uv8yJtUmB7NqVmLjyYuqMnplbiypJdUuclhDqpI/WkEXnwKv0M3b55ckzR/zStEejVi X-MS-Exchange-AntiSpam-MessageData: ++pmPzQ7RDASESVWHqxQaAAmRMA8KtXrAvCUEl0Cnm6MvmMEQTaei3CMN8XhexMG88reZ5bDMJG5AZky6jpGkoCZZBU/Ay+c4mvqTLxiKtL+baTRjx6Z61i4OxeS4EfkOUcE292hX6uT3x4RBeLwSBOiXLNSAERibpFD51KLRk3gFjZwi7obnpKW21dHs/a2rh8zy02uokhhdpEGwHEf/46BgbkVzZxL/9PN4r3FYh87qRCgoQa7Bg9Vm7/Ndg9QqOaPnGAjHeSfrRKN7v7RH9M2HOZUvW2eZbXlVmwmky6Rp3DsJMJ8LMT5JisOA/C9TWqwKRPnDFsyUCfR5i4TK1faKR15kTEs1EtgoBlaZpdPWRZrQ9kWQmJP7tVh3estTUoJ5U2GYqD573N3tVwxRcqfvOaMGbV6XEfYkNKM30NZXxwWumW+sf1WqFE0Y8FuglHIihrx17WtPZWdg3gBXZzQqWiSsZDOFxWM6YlLZBBykGqicaxeqCUFZSCzrNMJFRrFYKYq7ZNMmXCKAUWZHqoE6c8miHOv+aZ81CIElW95D4sVYh9ND5pY72nhjFBgCvCJcNOFxb3Comm0SUnYy/q6OMayePO6786FSTx1d7vliUKe2z/jW+aNgracojPgdZ3B9axLUBMEhzOvoDN0AGG+MHB8NZ7jIi/KC8GgDpNgp3HzFM/BDm3yuf646kB4Bl68IPi+8zVISmSSaB8mWKPaFxTEtONb8mb9zBJ6kMxf9F3zWOAKlodjYD3nKcGIEXhiRxsPLINmouwXEsnn4lM8JulFiKDrzdhVsZOkxWg= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 414020ef-9050-4e1f-eac1-08d7ec906502 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2020 22:55:21.2329 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UqoqYLuxlIbiF0RmVXO78YFcymp8P5BnSW5LgmQnkqH8mSuz2134WEGYeTwaGIU3nh8/3mdQ4UIgYLSPp4bVTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5247 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Moshe Shemesh mlx5_cmd_flush() will trigger forced completions to all valid command entries. Triggered by an asynch event such as fast teardown it can happen at any stage of the command, including command initialization. It will trigger forced completion and that can lead to completion on an uninitialized command entry. Setting MLX5_CMD_ENT_STATE_PENDING_COMP only after command entry is initialized will ensure force completion is treated only if command entry is initialized. Fixes: 73dd3a4839c1 ("net/mlx5: Avoid using pending command interface slots") Signed-off-by: Moshe Shemesh Signed-off-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index 34cba97f7bf4..d7470f8d355e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -888,7 +888,6 @@ static void cmd_work_handler(struct work_struct *work) } cmd->ent_arr[ent->idx] = ent; - set_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state); lay = get_inst(cmd, ent->idx); ent->lay = lay; memset(lay, 0, sizeof(*lay)); @@ -910,6 +909,7 @@ static void cmd_work_handler(struct work_struct *work) if (ent->callback) schedule_delayed_work(&ent->cb_timeout_work, cb_timeout); + set_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state); /* Skip sending command to fw if internal error */ if (pci_channel_offline(dev->pdev) || From patchwork Wed Apr 29 22:54:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 220275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98226C83004 for ; Wed, 29 Apr 2020 22:55:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6C8C8208E0 for ; Wed, 29 Apr 2020 22:55:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="WjZfglOW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727780AbgD2Wzj (ORCPT ); Wed, 29 Apr 2020 18:55:39 -0400 Received: from mail-eopbgr10044.outbound.protection.outlook.com ([40.107.1.44]:62734 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727122AbgD2Wzi (ORCPT ); Wed, 29 Apr 2020 18:55:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mAkxO5bza//HO3JuVksKmSUh7uZXOULEhcwf2WtqBYc9S9wXeyxOsciPLae9t7jVWvp8Iws2pVPxvBYLI7ixBjb/GBCw0uj0SvL4I3voHzzoKd/2FUmlKdwrEfV7aEF2jm6YJMpnYyXbfhFAXgRx8NdK7fpf6F1z5tVpSvFHOyovuLMvAd6yEaXtBUAhhZUAa72wiLJDyVtsRtIJzDYcE2RwwB6w9cgj2v4bGBcrv3QkhQEnXqx/eg3YMoaCW8Z6Ln0Z4ZNP3COu0dCHgQHYcq4QquoFM+Cxjv+V/JcNekOM/DAaKBKI6tnLXvY5FC5OffrDc+HHSDQtAYCP9FWJKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2AAhFgVc2ZVICs48Ge6eX4rh1r93rthSxi81KUUQU30=; b=MLibtTc9nixrLQjd891b4td7D+5XleSSO8rp1sYODWtJ4EHY2WHvy01cjByNO5Gjc1kAHnWQKnZ+l8VobXO7O9OQqSGmMNfW1nCMuMMAJS58M3NP97/zUZUTW9+J7DQlBnfLIGI/QSHaOkqNLLfWJos8VMBz6zi9xlu9Yss70bfXvWx/abKMMU3s6bSEKKobfY2/0sz+PKgIvvJPu0yJbgoXY+2MC0TEcpwdKJDdV+vbQ1eSuwcak/ruPKx8wdUBMD3fTtyv8IUfiBccF0sIyWZNUdzn88BZzGvyNUkRmz3do89fRnV/ic7Bkg8PFADxjSDkSKw258PVEQoym9ZM+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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:X-MS-Exchange-SenderADCheck; bh=2AAhFgVc2ZVICs48Ge6eX4rh1r93rthSxi81KUUQU30=; b=WjZfglOW0BJE/5sodhoif6PIbiAfSrBqp7nbWhGK5dmbbi6mDLcQVL7sHVKf6V2wgo9ZINms8M6JbNgJYjyncb1kLXq3B26jBZht+1kDRvTY7AoVH5fZMx45ixDhhGfEKl6cvh+HL/8WSzgOrNWyYhrK2FNqlsVuL0n9GYGtVfc= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none; davemloft.net; dmarc=none action=none header.from=mellanox.com; Received: from VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) by VI1PR05MB5247.eurprd05.prod.outlook.com (2603:10a6:803:ae::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.22; Wed, 29 Apr 2020 22:55:25 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::9d19:a564:b84e:7c19]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::9d19:a564:b84e:7c19%7]) with mapi id 15.20.2937.028; Wed, 29 Apr 2020 22:55:25 +0000 From: Saeed Mahameed To: "David S. Miller" Cc: netdev@vger.kernel.org, Roi Dayan , Vlad Buslov , Saeed Mahameed Subject: [net 7/8] net/mlx5e: Fix q counters on uplink representors Date: Wed, 29 Apr 2020 15:54:48 -0700 Message-Id: <20200429225449.60664-8-saeedm@mellanox.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200429225449.60664-1-saeedm@mellanox.com> References: <20200429225449.60664-1-saeedm@mellanox.com> X-ClientProxiedBy: BY5PR04CA0022.namprd04.prod.outlook.com (2603:10b6:a03:1d0::32) To VI1PR05MB5102.eurprd05.prod.outlook.com (2603:10a6:803:5e::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from smtp.office365.com (73.15.39.150) by BY5PR04CA0022.namprd04.prod.outlook.com (2603:10b6:a03:1d0::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Wed, 29 Apr 2020 22:55:23 +0000 X-Mailer: git-send-email 2.25.4 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a4d07e70-57bb-4a6f-e765-08d7ec90675d X-MS-TrafficTypeDiagnostic: VI1PR05MB5247:|VI1PR05MB5247: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:514; X-Forefront-PRVS: 03883BD916 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR05MB5102.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(39860400002)(366004)(136003)(346002)(376002)(54906003)(478600001)(6512007)(2906002)(66556008)(6916009)(66476007)(316002)(107886003)(6486002)(52116002)(6506007)(66946007)(6666004)(2616005)(186003)(8676002)(16526019)(26005)(86362001)(8936002)(36756003)(1076003)(5660300002)(4326008)(956004)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rejNYiKxWrCoIba7QXntTxhZBWqoq+Y0kKqJk4MqkT9o1k93zMrLkgUX1g9qhYslLe6R19Gxw+Tikl+QbHfJRUbo4otl75cfteSqOW4UZLqSmIzZanngXxRGWDsiIfkx9wto+F3HdZVJM/6PtHn9aKsqWEvsTHsCAS3ixHKH2vz35vbFk4ziT/4xSjedQAwZHYX1TKg1F5VBfcbcMO6yz/mA90Ea8HOhke+I682rie7Bfq1Lz9XBuQQIQi+ogemEcYBWCp+BYkbgzvnuY7oN4tb0CugMTYVSZAxnv4XF4AsJ0twgHBhPpOj77FdkFdesY4JZekGMvZis6CeGjo4mA++WkEgra5Dn8Nlyprvtej/hApbMDgFYfJvjldURYlGq0ypNRGO8wCj4F5oL3e0O/+qZQ86EYxw8hEjzfn+1/Hh0TCaNPt1a+CM/urFUy7EVuJJJ52KnGrX8p8W3K+L8wk2NtgcyVAL9lzMrKixFlPTdEKdQwwYwSkFsAdT3ul9S X-MS-Exchange-AntiSpam-MessageData: A98w95YJ1VmTYRZucQWvSU46U/bEKPHowKYlOtn8a4AicKiD3VmkdQKBNbhKg6nGgEyiXn3Pz+zYLXe8tRxwDhDY+KJfp+91CkAG6xFOnX1Tp+aZIsu56vymJWLzrePPw56jlDgtGG7/g502O3Vk1jjYpY4B0Zy5cYWCGScAU0NrNu4zC+ht67SqOzLQLxbCq83GopX3GawN5gQjutpEUUc8d5IoEeRozcPj4+lrNRs0y/BrybKN6qeV84twexIWyTVHoTh+u9rCIuaUwiajGTTi7e1ZmjSP0by4HuTcZWrDeLsgWEACN8Fx/QkYv+c3BtWZaGU22pc3+5QZ4+6ietrbEjCg/MfwrAty2RfhdEgj/ng8L+M7aLcxmigVAYX4ySH0RmImF2xyeqsGrMxQDxNQpKX+TB06LKFIMIe8f16zfSjQBJn+DJaaw10oqWY4V5j/THTi/jXN0wTQQ7brV2qwWNxfU7OU/uONDmsJ18GMpZNZ2QrnrtqaKCDdUkIAqnfd3uPFYxX+LEd52d38qDxGzks3J37pSkFXIKQi6FLpSKIFceZG0F9WcSy0FLjOURwtWTTuXgRWK5lBdIoMHSbYs9FmSQeqk2n+0XFEP+WdxyGszs2mwR1TwkC/o/rkuNqqc+I/cJiGpYQDhMwl8tZ3tZIAfmxqXEf3/LAelzg4lqhvIlIf2liZ3GnRvu2mhi6SkuOLm1MNW5jpndLtA0TugZtp0Ol8zyNVOIAdPvUKjcEATPjk7gyd55VjfZ43+r7SMPjX6HqF7pbNmB403xj4Z0Naak9HxnRmS75mIvE= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4d07e70-57bb-4a6f-e765-08d7ec90675d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2020 22:55:25.3455 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Wfgn8MwDIGpMUOpY9pQmCq/QuYhMZ0TgnXK7KB5N6ArLOpIDq968CYFCPoy6LcLoiRB4NC5wbv/y49Z81RAkqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5247 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Roi Dayan Need to allocate the q counters before init_rx which needs them when creating the rq. Fixes: 8520fa57a4e9 ("net/mlx5e: Create q counters on uplink representors") Signed-off-by: Roi Dayan Reviewed-by: Vlad Buslov Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 55457f268495..f372e94948fd 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -1773,19 +1773,14 @@ static void mlx5e_cleanup_rep_rx(struct mlx5e_priv *priv) static int mlx5e_init_ul_rep_rx(struct mlx5e_priv *priv) { - int err = mlx5e_init_rep_rx(priv); - - if (err) - return err; - mlx5e_create_q_counters(priv); - return 0; + return mlx5e_init_rep_rx(priv); } static void mlx5e_cleanup_ul_rep_rx(struct mlx5e_priv *priv) { - mlx5e_destroy_q_counters(priv); mlx5e_cleanup_rep_rx(priv); + mlx5e_destroy_q_counters(priv); } static int mlx5e_init_uplink_rep_tx(struct mlx5e_rep_priv *rpriv)