From patchwork Tue Jul 28 19:59:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337985 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=aSJqfePM; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BGSFq4SJrz9s1x for ; Wed, 29 Jul 2020 06:00:15 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729063AbgG1UAO (ORCPT ); Tue, 28 Jul 2020 16:00:14 -0400 Received: from mail-eopbgr00062.outbound.protection.outlook.com ([40.107.0.62]:13198 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728527AbgG1UAN (ORCPT ); Tue, 28 Jul 2020 16:00:13 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N4dlmJBu6WRPzAsHKWkhax+4Wk0sB+ZHs08cOEZ+tphuCwWiIHcax3LHOyld13IRpzQlwA0txzK9ocslk3eygQtcJP/yh2y9qXgsD7JbJ4CmWKZVs9kk6Pq4qVy3d6oNhUK2BALY/sBAmGt/ja+tF2jbDJGi51+QLMLRX3I1d2YbjutwzsggCccy4Y1UnSi5J/XKTbjy0pXrGohmE5O3By3rZh9FSQ6CT2vNfeOYRf6k5M3/6izzukRVMTzgvcyXLNXwRnscMi8JjclwftI66SX6RppnRX506inr1gTMQO9vVCdQPonn0CAkjHtvtBleHzRaY6feY7ABgl3jujOuNQ== 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=J7/1yDK+ivw9ePtT0Eql+6kkxMnJzsGiQRVpRr7tOCM=; b=c+S70Wi/durzdlRvLQvqpgZPKZR1kffPOpEDJ+ikg4gLty4czvc2SEBHXK8urOvKgS2s0yYTi/OHgDGfVbRErMDIqdDIHbwR0hsTzoSttJpN1YlcPSEjjJ9f0hCAaoQqJEi/6J0fW+7VvKCc/x0l8pLB0oxwFOUFUN8aisio0ayj4lOI23UZF+5gUEJu8zfthKg6Ko+sB2Xh7q4s5qN4dJRySJXsFIxGRGr28cl76tUn708saKJW+C+nvySJKx8PY6X9cBKQzwxMAr1jjw/ex2caBRbfr5dBXRm02eM0pl4PNp2LM5KPoDd7gIMYQWElEgbYmbV8sSyQmP5j/n0lAw== 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=J7/1yDK+ivw9ePtT0Eql+6kkxMnJzsGiQRVpRr7tOCM=; b=aSJqfePMD/cf0J79p+BMHsA+LL1YwsliGYAQLv4jMghjH+2MqmJcQmTrI0NsW/k3WzdWuUpEZzEBqdMw8v4YeOXiosdLkmTOlUoUqXn5PsADBcbSwRfEJrZ+iFPUW/rYDGRnWXUOYg1zT/V3BjGaHTAgTNYMQSea7LevbeLuk1g= 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 VI1PR0501MB2592.eurprd05.prod.outlook.com (2603:10a6:800:6f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Tue, 28 Jul 2020 20:00:10 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 20:00:09 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Parav Pandit , Roi Dayan , Saeed Mahameed Subject: [net V2 01/11] net/mlx5: E-switch, Destroy TSAR when fail to enable the mode Date: Tue, 28 Jul 2020 12:59:25 -0700 Message-Id: <20200728195935.155604-2-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728195935.155604-1-saeedm@mellanox.com> References: <20200728195935.155604-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) 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 BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Tue, 28 Jul 2020 20:00:06 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 785fc63d-8672-4c00-351f-08d83330d442 X-MS-TrafficTypeDiagnostic: VI1PR0501MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:576; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zTmOOJapb2zHARIxLAdtD66hROXBr3sj0fLKDgEtAHhslqi279PToQi4zg141BBwhDiYsiuX8xadc273J4+EtPvKqMIpa+jzrmsuZRso6rEzrkKxkPOlKnQOIGd7sUElwH/W1ApSYpLMas1cjgU98acYqPkUldo4ZOGdl4dygXAfLf07xae/4TktvaYfGmtjWP0mq3+aIPb/XvD2U8xexLi3oxXmV4B8eZhUur6QbTmpkVKVa/9YVdK3KUVSg/9mBwKBzejuIbxrnGd0PU0SIlltWUlrweUjsNaldsttyg09iNI1bbd+W10zes30nwEZqQ5zAPZ0PTH0ChJDwCdOpShSSMOZ668+r7EJy9WDIwGFIZ3KxzuPi2GfHXnqx9Fm 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)(366004)(186003)(6486002)(8676002)(83380400001)(498600001)(6506007)(54906003)(110136005)(107886003)(86362001)(36756003)(16526019)(26005)(1076003)(66556008)(52116002)(6666004)(66476007)(4326008)(66946007)(956004)(8936002)(2616005)(5660300002)(2906002)(6512007)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: KI/B8dLxWZ7vAGP7qcD4GUYgH4sk3wMP+kTDyHX8Lui4+bssvok5vNVkIyvHx8L/00rJFQYC+CnMYalnSgKl38oC8BpeFBXAcjE2QaGDk4IX7BU23Zkmd1WYFPfpwlTC4dGWTeaCpvGxEMjxtmpjljTVHAznGYvwvExh8QPAa5Kv0nzlNR7Kg4T9kajlhxkYms4xhIdjpV3jx1+qkKbZP3ZJ9ue78ntJNWjpL4Bm28sCRCg72Ni2R0fSdxyCAYFq0IbBJY2SEXOOWEBd1xTa1DvQ8mUS1LOrjA+YPDG3xzsTOuqFrmtldDhwmDeX8P1tsuwliOTcwMdW49/abf+izo1eUohFbYpFx3JK4nBA2hCHGmKxloxqfbXDw01yU7siAEzTEupf0eIRvWkwNhjNbJuiKSEdMCHRxgG8XoX5RJL1rsUrW0gZ61Vebp7LIuZVg3ogfMohHLQzD07pyg7O/AZ6lju+oSIwm0k9qZhLNOQ= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 785fc63d-8672-4c00-351f-08d83330d442 X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 20:00:09.3141 (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: 5bRyHuqf78pOTGAjo8SVEXcsl7HkSE0Xdem2Ce6QnS+skuY+pbLLeAf6HFbBoPDzdBwHCYMPMnzsarur596RuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2592 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Parav Pandit When either esw_legacy_enable() or esw_offloads_enable() fails, code missed to destroy the created TSAR. Hence, add the missing call to destroy the TSAR. Fixes: 610090ebce92 ("net/mlx5: E-switch, Initialize TSAR Qos hardware block before its user vports") Signed-off-by: Parav Pandit Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 1116ab9bea6c5..9701f0f8be50b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1608,7 +1608,7 @@ int mlx5_eswitch_enable_locked(struct mlx5_eswitch *esw, int mode, int num_vfs) mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_ETH); } - + esw_destroy_tsar(esw); return err; } From patchwork Tue Jul 28 19:59:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337986 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=Ro53VOfu; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BGSFx49yqz9s1x for ; Wed, 29 Jul 2020 06:00:21 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729073AbgG1UAT (ORCPT ); Tue, 28 Jul 2020 16:00:19 -0400 Received: from mail-eopbgr00069.outbound.protection.outlook.com ([40.107.0.69]:51166 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728527AbgG1UAR (ORCPT ); Tue, 28 Jul 2020 16:00:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dvg8l2tHLlhynYRxPeJecECRz4VRETbzXUaLxGUS3YtDWztjTP0Ldl3WTQC5wIwZ60wuhpQ9QLk/Zrwd2iCMJWqpwGiUCevOkZZ5UynwTKNoVtrs14RU+SfxpJ7CCk9Z9mgIeOEyz/w9ztALCHb3Gu5JSoUv/5qlvIc4AiU/3whLg4jPe3D5yV+NKWHGgip2gyF2UdICjlg4sYSGR46pFeca8mO7SLIru7tJOPropKW8Rp6XBDcax1vwqoGGMuqpljDMtS6lO98Qkvsr7NkYDL8RBm/h2dt+QUktJ7zHLcwB7H4NiEdKijbBzYSgZrL3zIlQBP0gmmSq43ghn9Ztug== 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=gXrl47i8PA3EGMT5i4vfMZ74q6UW+TArcbHtIexVBKE=; b=N+lKLpCW9Sxhj62xOFfWFxD2BSEo9X0KPNlrDK+k87/PYG/qtrhTNUWWEX8bh2ID7mIkzPLCfxdzEA5pQG8+73jBprxmlv33PmYQYE7s3e4AED5ErOcAsGsoba8uqQi0w6zNNmMalBwtGlwAyHJ9IgP2kl45eye/UdyJjLZhfBwARAmLqrv2lwSYDUgK/OaqgodA/e43GX/f2JwfksxxNftgmwM5/PExoKtq/9fLCapwCjQiNXQByiov2jM0ln+2cHCxYP6rKe3MC/hlT6MSHqZzGcw8UH/oOPtalwpSxVazrajRVfyqLof+Z9oDjksE6TT8fu9qN+0I3PJyBoES6Q== 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=gXrl47i8PA3EGMT5i4vfMZ74q6UW+TArcbHtIexVBKE=; b=Ro53VOfuKVQ1dqgWhAuaBjJVrqjbUcdDX22yHkW67VmzCtyJGWCYI0KC7Gs7pyNAtuzf7OxYVrd8oEnGIvUcIcTGjZ7nFU+JUl9tg/zlTatGp2gLrvkXM1SNuBKm17/tqATotJic82zjzuuKRzmb+WxBB/K90PsJ8CSAg47FUHU= 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 VI1PR0501MB2592.eurprd05.prod.outlook.com (2603:10a6:800:6f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Tue, 28 Jul 2020 20:00:14 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 20:00:13 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Parav Pandit , Roi Dayan , Saeed Mahameed Subject: [net V2 02/11] net/mlx5: E-switch, Destroy TSAR after reload interface Date: Tue, 28 Jul 2020 12:59:26 -0700 Message-Id: <20200728195935.155604-3-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728195935.155604-1-saeedm@mellanox.com> References: <20200728195935.155604-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) 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 BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Tue, 28 Jul 2020 20:00:10 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bc86fc73-91fa-4c07-c509-08d83330d690 X-MS-TrafficTypeDiagnostic: VI1PR0501MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:79; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A9ZGzD2d76IVL4F5uW98AWNjhhOTN/EWYEs8uvLHPzJ52OzkzlOZ0btAklvIkFcc9oBUtqiyU9gfmk5TpOYZKNqhxx9mCm2EQq9LKWx1TNGvVGloZtSAh2oCFANNudoR6r2rD9V3q3KsS7Eoi2+B+gk2div+gAlgQoqLBgcyfh115g4dd7XWkJDsrgH17Mhwhd5x6f6+cN77m3+3bEbkxeUTcjrxE6m3Y3EAESzBax7BlVdrWE1FJqSzBo9XwWwp4nBrG7AYIw6GLvsS7Y8zpYjLKE+HXhbaOS+N7/OaTa9CX0N93xjsSS7Pv+7lC8UItmD6S/uIcYmAdsSp1+DFHclPPBIFsOWW1JipdBwHwCTr2GbZqgRsp+Y3L224Z65E 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)(366004)(186003)(6486002)(8676002)(83380400001)(498600001)(6506007)(54906003)(110136005)(107886003)(86362001)(36756003)(16526019)(26005)(1076003)(66556008)(52116002)(6666004)(66476007)(4326008)(66946007)(956004)(8936002)(2616005)(5660300002)(2906002)(6512007)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: mgPxZoWMJRuav88qqZ2yrBbV2N7BkkAfCGIwZ/Wkw4kYJjH7PmoQIw+MaU1CXb+7WRsxPGntBSV5C8+SwkkNNFCwTHDH0Z+PQ1AwL8RMkCAu1sw1R/W37mIrTovPOzCWCSRgxpFpHxnAiiYxEKWOOOC9oH8VZhKIDywKn5h4ri6qwzJvzaM/cvJUtPP+6nGDV7onkDHxFril9N02iqUT70K8J2eNrTOhgmH+tYEnRE2n/cSr312ulBrQLhoQnGcgwYYO//gbfw3cKEDuJT5/zwPKak9AwiOv/T+96xT6j8/P73JxsenhhG6y+e5vViz80Q+jd/5fcIb/Ic7Y9/LYa6PfArMZme6IuSB4r9BtM57wT7WWS1OW5FMx81aoJOuoVF9Lkl8jgnniQpW482swG/36AhtLV6u5Z23+te8Lsgi30gKPSkopjoHDHwh5S9ZrrNbqrt3wlQZyQqJqx5NWynMaF3AVmVRP3EBLGVSFHHs= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc86fc73-91fa-4c07-c509-08d83330d690 X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 20:00:13.7174 (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: KbhcwngeR1JSG6fBhlLMC2WRPW+s33njq6z1nxUKFfjV4+XJLCiRbatSC6+DSDKSWQcRPtTRBO4i7XID3uIONw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2592 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Parav Pandit When eswitch offloads is enabled, TSAR is created before reloading the interfaces. However when eswitch offloads mode is disabled, TSAR is disabled before reloading the interfaces. To keep the eswitch enable/disable sequence as mirror, destroy TSAR after reloading the interfaces. Fixes: 1bd27b11c1df ("net/mlx5: Introduce E-switch QoS management") Signed-off-by: Parav Pandit Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 9701f0f8be50b..d9376627584e9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1653,8 +1653,6 @@ void mlx5_eswitch_disable_locked(struct mlx5_eswitch *esw, bool clear_vf) else if (esw->mode == MLX5_ESWITCH_OFFLOADS) esw_offloads_disable(esw); - esw_destroy_tsar(esw); - old_mode = esw->mode; esw->mode = MLX5_ESWITCH_NONE; @@ -1664,6 +1662,8 @@ void mlx5_eswitch_disable_locked(struct mlx5_eswitch *esw, bool clear_vf) mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_ETH); } + esw_destroy_tsar(esw); + if (clear_vf) mlx5_eswitch_clear_vf_vports_info(esw); } From patchwork Tue Jul 28 19:59:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337987 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=mjM7+M67; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BGSG60QQvz9sTX for ; Wed, 29 Jul 2020 06:00:30 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729151AbgG1UA2 (ORCPT ); Tue, 28 Jul 2020 16:00:28 -0400 Received: from mail-eopbgr00081.outbound.protection.outlook.com ([40.107.0.81]:56865 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729088AbgG1UAZ (ORCPT ); Tue, 28 Jul 2020 16:00:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ild2QpRcx3Q53FiXX9QwH5E0Oy2GsPQ7tp4Kl5zU3dayP0DUpY5gUsMHg4kPBkX7aX0T2DM5AWmUfOzohB4alCBCH3leS/5T0s0vuyvAmFfPiaFNpOvh5INecKg17ejYBhknj36bxxTMPERe4pD6z0sbbvY582C3Rez+vr/ORabRdpAJXqHp/SbTIbgXzcaLBJTgif8/ths2u5PlbqFRO40Qy1/MzPEzX/vjQBTKqbNwBDTJUTiUtDqVhHOjUMlcEImo50q0TnUWf9F9MM5ErQ+3X9IkpyUmP2Pbufq+wj2VLz0l5htWCFQcPb6usBPqPIh9W6Vq17XKrfyggB19zA== 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=W8EwSVx2YsOzHa0mWr3FT/EvFj9ZeD3uENoUnVK0Log=; b=T5kGxXBWrVEhNDii/mDhQMlQED/1KZ5OxBeErbilmHVJGAIIVJeo40NjA4DAy+jLJayw06e2v4UU42V7N/nHNAlBJRxk2aHwQd8HZm2rMpqMqAE0oxg4aGMV2rOL3/QpPVEpv249dH/ADQtmZU7HY3vPeHMoZ0KmwbLMyhnDHDlglX4lpA2RSYABirbGjPtMLR+eKs/Mu235shds3gU9bTHYIQvZRpeKqPbhYIuYw62KVpCgYIu6qY0Owr/P4abQ2kwqhV4tQan+YikjApujKp/rtJVwyviRCIzDc684DBrjx7HE+pMhFSxGXrcmjDL3engFfic/uGgHgA9Dc0EYoQ== 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=W8EwSVx2YsOzHa0mWr3FT/EvFj9ZeD3uENoUnVK0Log=; b=mjM7+M67cHh4MHvFin6gSyqFuIn1O5UxYPfB6jF0B3I8SI35ce++SjMQkBxgfnf8a+Sn8zRt2rs+psLF/gd0s0IKLAQgJ6Hfrp0vVLMv5yTf8+As0LK/+gCEgNzjPJ2dF6elRzzSP8rXASMIDYSN+MjYD9spwLJdEeMKWofsbMo= 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 VI1PR0501MB2592.eurprd05.prod.outlook.com (2603:10a6:800:6f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Tue, 28 Jul 2020 20:00:21 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 20:00:21 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Maor Gottlieb , Mark Bloch , Saeed Mahameed Subject: [net V2 03/11] net/mlx5: Fix forward to next namespace Date: Tue, 28 Jul 2020 12:59:27 -0700 Message-Id: <20200728195935.155604-4-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728195935.155604-1-saeedm@mellanox.com> References: <20200728195935.155604-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) 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 BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Tue, 28 Jul 2020 20:00:16 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b48665de-a606-4f3b-acd8-08d83330d9b0 X-MS-TrafficTypeDiagnostic: VI1PR0501MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iy3d5KhDnJ8I5NsxQ3uC0L+tzP5vLWZeNSZBAw31fDTOupd1p3Vn7BB72PSxnqb8V/wbkwgJQ8hvd4A74kJmik69x1ZjeJWlewT+xNnuwtr6g58/AsikvnxZjOxqVUuySHF55fZXEOzFuA2BEF5a92qnS+Yxz8wXXxZkAVky3fLQs5GM6jFiVbiGtdFExxQIo9B7pLQQVvQ3AhKtgjbzN+9MvzQ98AiD6nSEIoSsV3/XWZkq9dBj1khjhu2y/QivRbBZb2qOVyRlYbQ/yZ77bS18Ruo5Xp3NTirQGtBH050hLOiAJRvil3lNcgyqw3I2Sfp0K0Bcw0be70yYbPoVnPBD4khk0BS80+HvQprDxSAp5gGRmiax8gEfNKbGKTyq 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)(366004)(186003)(6486002)(8676002)(83380400001)(498600001)(6506007)(54906003)(110136005)(107886003)(86362001)(36756003)(16526019)(26005)(1076003)(66556008)(52116002)(6666004)(66476007)(4326008)(66946007)(956004)(8936002)(2616005)(5660300002)(2906002)(6512007)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 7Oz03M/bJcjBIwahsaQrrJNODuujB49qHNyNhNbUKkyWpi+U79jolhwWm0JNXe/Nlp72fP7l2ZlCiorMJJiXf5Cdto+ymP9FasfD4OeLr8+zCXTs62jD9J3SSc+Ht4MVMSd+T6A2xjsFTaEwxRNXH6ieF5VpGEiOMEw7QDtpafvgzxNyGwq5u+WV16oC2I21z0fBb5HE9xkMiw17nsDkl67pxYPJRDdodd7rE5znypE5x/aMMuIidWa20doHTPOq0kLrgG7hpetC4kYohe/5QvNTjXRri7hwyZLH1B/bqtFv/Ht2djDHEKHs5+EOaCF20m0Oy9JA7OCwiSzle5bit6F5Um7xmmgZHvdVsJY3yzRHjfEI/Iggcn42KSkfh9ey5zluDLJezsj2j+kMhYskfYuGeKFza+s7qPfTsHG+2wj0GVI6qdGvCUrdYFMH5/JhGbSyJxrYuOi1gU2iyva1hx5KA0DCSoVc8EN3Qg2f5Hw= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b48665de-a606-4f3b-acd8-08d83330d9b0 X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 20:00:20.8512 (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: ZhVRQNKGHSpB+DzmFFG2sj+8mNXCKmQzhi4aEJmFAk0UA1jff+PdSUGEJ26Q4ZcAoofQDziYcxqEQElwmOWHEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2592 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Maor Gottlieb The steering tree is as follow (nic RX as example): --------- |root_ns| --------- | -------------------------------- | | | ---------- ---------- --------- |p(prio)0| | p1 | | pn | ---------- ---------- --------- | | ---------------- --------------- |ns(e.g bypass)| |ns(e.g. lag) | ---------------- --------------- | | | ---- ---- ---- |p0| |p1| |pn| ---- ---- ---- | ---- |FT| ---- find_next_chained_ft(prio) returns the first flow table in the next priority. If prio is a parent of a flow table then it returns the first flow table in the next priority in the same namespace, else if prio is parent of namespace, then it should return the first flow table in the next namespace. Currently if the user requests to forward to next namespace, the code calls to find_next_chained_ft with the prio of the next namespace and not the prio of the namesapce itself. Fixes: 9254f8ed15b6 ("net/mlx5: Add support in forward to namespace") Signed-off-by: Maor Gottlieb Reviewed-by: Mark Bloch Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/fs_core.c | 28 ++++--------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index 13e2fb79c21ae..2569bb6228b65 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -797,7 +797,7 @@ static struct mlx5_flow_table *find_closest_ft_recursive(struct fs_node *root, return ft; } -/* If reverse if false then return the first flow table in next priority of +/* If reverse is false then return the first flow table in next priority of * prio in the tree, else return the last flow table in the previous priority * of prio in the tree. */ @@ -829,34 +829,16 @@ static struct mlx5_flow_table *find_prev_chained_ft(struct fs_prio *prio) return find_closest_ft(prio, true); } -static struct fs_prio *find_fwd_ns_prio(struct mlx5_flow_root_namespace *root, - struct mlx5_flow_namespace *ns) -{ - struct mlx5_flow_namespace *root_ns = &root->ns; - struct fs_prio *iter_prio; - struct fs_prio *prio; - - fs_get_obj(prio, ns->node.parent); - list_for_each_entry(iter_prio, &root_ns->node.children, node.list) { - if (iter_prio == prio && - !list_is_last(&prio->node.children, &iter_prio->node.list)) - return list_next_entry(iter_prio, node.list); - } - return NULL; -} - static struct mlx5_flow_table *find_next_fwd_ft(struct mlx5_flow_table *ft, struct mlx5_flow_act *flow_act) { - struct mlx5_flow_root_namespace *root = find_root(&ft->node); struct fs_prio *prio; + bool next_ns; - if (flow_act->action & MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_NS) - prio = find_fwd_ns_prio(root, ft->ns); - else - fs_get_obj(prio, ft->node.parent); + next_ns = flow_act->action & MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_NS; + fs_get_obj(prio, next_ns ? ft->ns->node.parent : ft->node.parent); - return (prio) ? find_next_chained_ft(prio) : NULL; + return find_next_chained_ft(prio); } static int connect_fts_in_prio(struct mlx5_core_dev *dev, From patchwork Tue Jul 28 19:59:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337988 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=PBn8AP0y; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BGSG84Fqlz9sRW for ; Wed, 29 Jul 2020 06:00:32 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729088AbgG1UAb (ORCPT ); Tue, 28 Jul 2020 16:00:31 -0400 Received: from mail-eopbgr00081.outbound.protection.outlook.com ([40.107.0.81]:56865 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728452AbgG1UA3 (ORCPT ); Tue, 28 Jul 2020 16:00:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FzRIvXfsfERKVRrhiB9/CzHbKAgDFDNAu6ZAQh5ygK3bDKr5+3lnTwfoTt98cSXR+5FtIdNUr/tHwa3e+oEqthllF1WwHYshqmmWmNhrHw7aKnyvL4yakzPMlhaIgIQjd9t12sin0k+7HDS20B2YrineekuKgK5HBj6LM8DZ6y6uwt6B/gWF9Z6NRGVHI5dSztTRTY+nI7gVlexvEN4eNNaen0mV1cxMWdkUMXJNxy5AK6vek6Zx6bynhBiRXD1xX6FoulYp455JfPSCsfERGvR7Cyx4NIxkyXUfOZG/+gY4uU5CrSb3q0ccXFPq2t7PLMxTyh9SBcc9qgb5aAbQCg== 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=VbS4hf242e7gV3+n9hr3DrvbJkJ5Xo4xW1uimBlEXUQ=; b=HgQtOqWWxoQgmJzp3GOrs/qOdcWWkDEzwwC2FqaCxBSnzrE/nZO6OkjEyJHf7IlOlhtPQbcL+To8kqOhvHBFXeLPEck5JZ+peWR09zCuAneYA48/jbA/xAHtgBZEwUZMkLpEsGlTqESeF6OqN/FEfZgctYoIRRdIGioubLVCDUfdAmbiRq0SQneiQ+9XcfS8HkxabNL/yKvwyb+QgNUq7a9+H4sycwXU69gBHp1Xp67DE4cbEo5h83zlEmObYLgQEb5g8qEgw1NNHcUG8HWRnrX3XM0TArrObKscaoNaFs4GlUsb0bsvo4k0DiX6hae5KPW5ULGm9lOSkWx/zln4Xw== 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=VbS4hf242e7gV3+n9hr3DrvbJkJ5Xo4xW1uimBlEXUQ=; b=PBn8AP0ynWNs/thUmqm6SIEcQf+9Rd6YqYmENWTyLzs7GYoMdFtyybcpUIr/174d4nne/+wFGY4+uPv6SxXpItGHXAKgFLMlBYoMh7IfPkHsivl88J5Oc9T2BjJN01DtrGdJWtuXUreNt6iRruhb+w+SkrydSPdM4s1/fjUCVc4= 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 VI1PR0501MB2592.eurprd05.prod.outlook.com (2603:10a6:800:6f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Tue, 28 Jul 2020 20:00:25 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 20:00:24 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Aya Levin , Tariq Toukan , Saeed Mahameed Subject: [net V2 04/11] net/mlx5e: Fix error path of device attach Date: Tue, 28 Jul 2020 12:59:28 -0700 Message-Id: <20200728195935.155604-5-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728195935.155604-1-saeedm@mellanox.com> References: <20200728195935.155604-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) 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 BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Tue, 28 Jul 2020 20:00:21 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 06a33746-d0e3-49f9-6f36-08d83330dcfd X-MS-TrafficTypeDiagnostic: VI1PR0501MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d2d2AkJN9/jzndXVd8/LW8p3aIBpHCvVhMJEMUqxAvm9sJ6WHPCH8GK7BB8tNaX8pzpeHRWCQLyLBw4H+RN/bBSmUa+Il5G+Lhg9DP+9PtcjyBvEpKqQdphdcMVYIu4X0I5eltNzbq5ZIP+cmqDcA+/jEXrgq7O+v2syubbwEjso3qBSVTiGyhO7cPYo/uzpP43Yt8oDSOpmga7DFAqUEMoCOvczztoWYNgdF2qFFWNwrgpB5CPIm8Hhc3vo6YDVchOA5MjTMMbeTcQcOx3Ow0IKR2Db0gzJtRXl252r8kYLiKq3hZJjv53b8shtKhf8Ury+f0p4eAXZ4ZDNc37bL2A/1Ii35NU3aXg7EFQbyL6AlTs4oZdniMr4TYvD6RtG 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)(366004)(186003)(6486002)(8676002)(83380400001)(498600001)(6506007)(54906003)(110136005)(107886003)(86362001)(36756003)(16526019)(26005)(1076003)(66556008)(52116002)(66476007)(4326008)(66946007)(956004)(8936002)(2616005)(5660300002)(2906002)(6512007)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OpaPpJvSxiVgogzQqaMLSTX3F7xElxg6he4Epeh2LK0KdC2HOr04JvA/IX1LkXBj3gVuAalAO3CMCp6JWxSaiDCwo/pW8hQ82AoNDDwR79CHNuBDxhSIOJIX69Er54t0XXJI5URMaz0OSs0IqBHTcUOA6wF4qtgBF1Q7cAg1Ukopr3yQuJbxqY4TQdlWUHByjA9cmJylQafvIoX29lBv9NgbUSNTrANkeawZmOahjK7hurywvydbaN/cDONBOJukUDKqPiylewUvHaKdHFf7mxKdLBY4MRvdGf8Sp59nf3KkFam/y19Iq0sW3ocjmS00fikdJG7r8xqQ08EjoBEcSr+lKU/cy70w2pFmhm6m4osapYwXdvImqwcbpp1FIVLFxZP0ppGpSm1F1mT5zWlORpwWuw1C3UWurj6+UJth9s1SD5SIRVNwEW5J9PyelzLeKZKzwvUETjsqdtjmqNL0+Jk5m/q98MKBhXiSJ2FzOGA= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06a33746-d0e3-49f9-6f36-08d83330dcfd X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 20:00:24.6341 (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: Lpg3wgQUod2ZtUI5fHYmXFKKmeVpPo4pE9YYwVyrMo2ORTdB3taUe920y3UlbaHv+3QIqh9mWthlVGUwcSrYZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2592 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Aya Levin On failure to attach the netdev, fix the rollback by re-setting the device's state back to MLX5E_STATE_DESTROYING. Failing to attach doesn't stop statistics polling via .ndo_get_stats64. In this case, although the device is not attached, it falsely continues to query the firmware for counters. Setting the device's state back to MLX5E_STATE_DESTROYING prevents the firmware counters query. Fixes: 26e59d8077a3 ("net/mlx5e: Implement mlx5e interface attach/detach callbacks") Signed-off-by: Aya Levin Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 081f15074cac4..31f9ecae98df9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -5390,6 +5390,8 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv) profile->cleanup_tx(priv); out: + set_bit(MLX5E_STATE_DESTROYING, &priv->state); + cancel_work_sync(&priv->update_stats_work); return err; } From patchwork Tue Jul 28 19:59:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337989 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=a0br2zeA; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BGSGD1W64z9sRW for ; Wed, 29 Jul 2020 06:00:36 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729194AbgG1UAf (ORCPT ); Tue, 28 Jul 2020 16:00:35 -0400 Received: from mail-eopbgr00081.outbound.protection.outlook.com ([40.107.0.81]:56865 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729136AbgG1UAd (ORCPT ); Tue, 28 Jul 2020 16:00:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QTTA8ac/o/2oH4OSFEGOrvLWNZySUG3mnUgiC0pnMINWPPFigvcs0BS9ur8LYj8vDijU9mxo9TdG9rYYoafSvzSxJ5U2p+MsEtbR85STQnnCDd4CWMjYqsjYz1cYTWzTy4JYHHbXOUwmsp5h6ThAyJuRXtiK+/Dpqx1uOK3ultMgMM+TI6zxJgZ+0yWK6K4Nn2SppINTXGkzM4vZU7Xgpb5XZIORT2K2Guysfa9pe1YPPSOgpSqAP06zzlHTF1pbeShPdEpRUkKhfTmt3AwvfLkaX/vGtJ3noymbWkWTwipThOT+AIuDw5+mF6Z3uZzSumBMHLy57HTcHcp1+hiSrg== 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=ACZeNjH8ov6MHwGPLpRS4RHYgUTvmLXBdaweiNEDfX4=; b=DO1cKENKJPQRLSGHCMDOhmEXaAHzw78NjTATGmSf478fcSULHnjHHXjNfaNRhlDS2KuT+z19IVCVhyuedH+XM1OitK2sV9uaAcw0nAl0s0MTV183PVxgzioZF5C2vQNGQ2aXfBC2J0RFqhnmjGoqrxTHYHMHuBtDw7ckejKM7dp50LZTAwRgLF3/bfi50YO0QY78CzshJpjf5pKr+lFJQ4KP4Tpi2socm7SCJ2KGyImKeJPLVnrYMTLdDD7ywk3V63nFBvp9GRmvLdQEuYtI0i6ef7XPTrXWw6a84QWOFQEOBcAnFkbcZZ+2Po/an+80NkCymzcTBaKcqVB1WIISlQ== 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=ACZeNjH8ov6MHwGPLpRS4RHYgUTvmLXBdaweiNEDfX4=; b=a0br2zeAqSoGce9Bm8YGiaYINXxIPY0DsEXTuPLsnVFOBQNmcCigZvVgqhAgFDeSgomvpWLp9JkNYYQWAJrCJdGQLOhnQ1kpPtIE+jTtYwbPC+MR14TLHKQqwjSBKhdeU+M62x8lw2gjcWsvVOktqKS+3zyHTD5QWly9ZTKnxQM= 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 VI1PR0501MB2592.eurprd05.prod.outlook.com (2603:10a6:800:6f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Tue, 28 Jul 2020 20:00:29 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 20:00:28 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Maor Dickman , Roi Dayan , Vlad Buslov , Saeed Mahameed Subject: [net V2 05/11] net/mlx5e: Fix missing cleanup of ethtool steering during rep rx cleanup Date: Tue, 28 Jul 2020 12:59:29 -0700 Message-Id: <20200728195935.155604-6-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728195935.155604-1-saeedm@mellanox.com> References: <20200728195935.155604-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) 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 BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Tue, 28 Jul 2020 20:00:26 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 66950c8c-b6ca-4fcb-3396-08d83330dfee X-MS-TrafficTypeDiagnostic: VI1PR0501MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:196; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mHpJmD/Ip23jIy0e8HJd2ACGIoencGdexwWIgBM7L0+1PGWTOsrkTAYH0Z4jP7vy+fZVZrXN664PnbgIScBgZ2SF32pKo3PpUIEF02qEUm5Z+12K3CsqYPUSzDGA9mCfOuh79TqhIQOFFXXDZ7CxO5NVix2qDel8PYIoet049fTxGU/Zggf5VHudMGuQgVTfz2FpOrI0bX2dnTNWSoI8rXuG4cf0r4BPPuK2c+bqYaFaktPP3sIddySFy01JkLSrgiKL6ePIl9wMS68qjzGunKyQJJBYWe2Y66XWXOkqzl5GG3VVcK+Es+kqPc2W0Qi8JEN2FXghqdaDmVTy0h9q8qWjvG5mIj7v3DcajAXgXSod7e9n9J8wT0BXcHkP9+TO 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)(366004)(186003)(6486002)(8676002)(498600001)(6506007)(54906003)(110136005)(107886003)(86362001)(36756003)(16526019)(26005)(1076003)(66556008)(52116002)(66476007)(4326008)(66946007)(956004)(8936002)(2616005)(5660300002)(2906002)(6512007)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zf81MW3spAk9CNUTT0An1Gsmk0u9z/877gO5ae3hjHPafHmdV/903ShK2Y4zJ5XkEMR0ID0xnOPPuAsmgpQ6NbdxuaGMlWtytubrrIT7CI0Rtugp5xa6dUNZ6U+4aAgzJNvagm7RTsVB21anin9B2R5BbGoyD2e6UgDj3iKKGgVFgKVq+hMDn2svyNzNvWC3IyXalk94ewqGfQNCDCaSyI0ZrUoPi/Zwq3lVYY1zT/LibIIazW2s6p93EIUmz5wzv7joC99JNiFDVbKOsenLdp02+BMVWsaHuJn1RBzMCdHYUssHfQ51oCHHIcBnNITDBfmIH0MKijLMD+dgC+UVS13S78ijorb6Pqe75aNCzQjsQGgOMQDsgdPK/hQ8qsEM3Zp1YZ3zcfRu+9rvbhWBkOO7/dokHBca6Y0zRE2WXbkJGkN8MnNoH1Ka0xjI/YkG439L95I/Zj5C3xWdkjeQqPLPsaWGTkKD+1smMLcZJO0= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 66950c8c-b6ca-4fcb-3396-08d83330dfee X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 20:00:28.5329 (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: 9Qb2mZDL5MZdKDgQrqURtA7+f3ctHmJBzXCLkfpePyS3fn6+RTpZHciOJ7c3iGfX3MroM7S6N30qf78YKnrYBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2592 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Maor Dickman The cited commit add initialization of ethtool steering during representor rx initializations without cleaning it up in representor rx cleanup, this may cause for stale ethtool flows to remain after moving back from switchdev mode to legacy mode. Fixed by calling ethtool steering cleanup during rep rx cleanup. Fixes: 6783e8b29f63 ("net/mlx5e: Init ethtool steering for representors") Signed-off-by: Maor Dickman Reviewed-by: Roi Dayan Reviewed-by: Vlad Buslov Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 006807e04eda3..8c294ab43f908 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -936,6 +936,7 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv) static void mlx5e_cleanup_rep_rx(struct mlx5e_priv *priv) { + mlx5e_ethtool_cleanup_steering(priv); rep_vport_rx_rule_destroy(priv); mlx5e_destroy_rep_root_ft(priv); mlx5e_destroy_ttc_table(priv, &priv->fs.ttc); From patchwork Tue Jul 28 19:59:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337990 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=kY5mF41P; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BGSGJ19LBz9sRW for ; Wed, 29 Jul 2020 06:00:40 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729231AbgG1UAj (ORCPT ); Tue, 28 Jul 2020 16:00:39 -0400 Received: from mail-eopbgr00081.outbound.protection.outlook.com ([40.107.0.81]:56865 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728267AbgG1UAi (ORCPT ); Tue, 28 Jul 2020 16:00:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O4JatnxAsMiQP1f5BVIRAEL5CWWQevUjt/99dRduwn8JkU/5P139hIrru41QvXj6XqhXDVcFmETVKTNnaG7gyVFDx6hOrEnHdNJxWwS6C9F04+x0vzYbJLItnh3YlwZ9fyQ3WdpVrnzA1w0bmgidZ7LjNVst/b3+y+UnsKNeRvZSdRHNT200dplWV44BndVoT7NEJBXUB/2hJaf5aHd7QUHJqdh5UfiKukSDXKomCWm6NpkborLvhTW6ywUeyTB2lS5mVgvXak/CYKCr21/4Rto/eYcHZM6ecIe5cuAYUNT+t8t3Dit739UQCq3FCMl+HpTNyMeJTXa4VK/r9wV7hQ== 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=VV289PZZjkgGraaKduzqeziAVHzELgEurwDPXhDJgC0=; b=mReGalIYUOMPUGG/Qp9rcYGBl3LgSaVX8EK18AZEstOfGADLZdOEWTmVP0Xuq6F2VYPXBY9fXjDn2kaOf7s5oPgGcUfP99f7T8ayVMmPgiXoLLd7twWcLD54ncNC42V2u4z6F6lV5IdLXqH1/XBHQIbIC7W77wk+AqGJfB7Tzag31h3m9W4cRxaPA+X9LWiq5XRIdeKJapf/4xrhv5YG95R7gKGwNGzcmnd/IsOuuzYdLuny7u83AkEJD0UdL7Ov5b8s2jRGEOeuPfwbbTcTK5pAgtDSgSficsmwNMbj806DRqN8ueHx1we7z37jxO7DsilKscx4lY0bqj1L7w5hGQ== 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=VV289PZZjkgGraaKduzqeziAVHzELgEurwDPXhDJgC0=; b=kY5mF41Pp2fJ2QY0/+JIztkL0PWvgiw87/DxMtCvk7whFggWj2bP6fyvAPLFLimAdybO/5JcgwU+4/g5lHksLzXMt3lsl8ZvlxsRQwk36/XxQzdFmnzg/p/pMPNENahUtYPW4HG9eUytHtdCvmpJk63DL/ua0/A7R+HrgnUduOw= 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 VI1PR0501MB2592.eurprd05.prod.outlook.com (2603:10a6:800:6f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Tue, 28 Jul 2020 20:00:32 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 20:00:32 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Eran Ben Elisha , Ariel Levkovich , Saeed Mahameed Subject: [net V2 06/11] net/mlx5: Fix a bug of using ptp channel index as pin index Date: Tue, 28 Jul 2020 12:59:30 -0700 Message-Id: <20200728195935.155604-7-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728195935.155604-1-saeedm@mellanox.com> References: <20200728195935.155604-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) 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 BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Tue, 28 Jul 2020 20:00:30 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 889636f8-5cdd-4965-7690-08d83330e25a X-MS-TrafficTypeDiagnostic: VI1PR0501MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8OArsqOZ3Ktw/czevLkKA0oJj9yvHaUsys1mIJ5o6muALSWuQYdQZ0+uUPTJCLqkx65u2+jMBg2Dfcqfz+Of96r2aXRiq8Fw/zbo2HVskhct4H0kYqoFgoCickCuMBcwQ6lzn8+es0oKpFfLWxQhav5AYcJXDhCJJzhQg4r+n53D3jK/GLdtmxO2UqLosW9nB2N/5iOVTNmY6slK4sZjo8MuVhCD/Z9WoKofTsixJOIw1mc26wH8acu883lpsVvAzuWV+qUyRU5YhvJLqD47yxu8RwxZcQJ4tGFeB0/e7hXAp7tV2S34+zEMxWJpvn+lC4gj3mNxfuUbBTOhOVijymgoK+x0GW4SBNgzTNu1FP/Btq8cb/aJXZaOTbPpE/WV 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)(366004)(186003)(6486002)(8676002)(83380400001)(498600001)(6506007)(54906003)(110136005)(107886003)(86362001)(36756003)(16526019)(26005)(1076003)(66556008)(52116002)(66476007)(4326008)(66946007)(956004)(8936002)(2616005)(5660300002)(2906002)(6512007)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: r+Uj8w9GJT5eV+dui6fxntFr24s0jXJM6OBHAGucq0KWnQhULynbJW9+8RygoPYyjO5KsWxLWmj+P6bSuoXgmQEpobjqxXkyESe5OjPLzjMZ6gyL+jEyrea0tVRD7or+sj9yXMrKj6fAratwLJfEIHdh/jX9loXqQoOie4nyHHInhWlNHVI523nHTWms7KUs9Vxb2YDEqoD62joOlFKEKpd6FwMX0Ot6ngrT0xo0G5IxLXtArushPRXiUyWQ1MiGEXIK2JcXjjQer3QHAwUz4lenVrNB+CtT2jI+MQt8m5q3mFaPTtG3GhOmYUoZrBaJEdvbc6jaw92o3xFxyDjioI03nOjg3NZBelBQF9vLzSxS+gFr+m9ef0ZeQ0TuBNLaMFP/WN55jtFrAXUW8/PUUXGGDlThUP7cpedHjCW22p58NZIQYqJlhN3oV22C32l00rhZ1B0W+ZGc9rPGbnwJxsoxWBp6TqOhcDuT7Al9khI= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 889636f8-5cdd-4965-7690-08d83330e25a X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 20:00:32.7630 (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: 6VN38YCpGgC/DPhIesBouexMHvq3VUXlTa2Ltz/A70c4apV5DzTeP6sErZc61ui0XPQSx6znfOICS3yYafjPlA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2592 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eran Ben Elisha On PTP mlx5_ptp_enable(on=0) flow, driver mistakenly used channel index as pin index. After ptp patch marked in fixes tag was introduced, driver can freely call ptp_find_pin() as part of the .enable() callback. Fix driver mlx5_ptp_enable(on=0) flow to always use ptp_find_pin(). With that, Driver will use the correct pin index in mlx5_ptp_enable(on=0) flow. In addition, when initializing the pins, always set channel to zero. As all pins can be attached to all channels, let ptp_set_pinfunc() to move them between the channels. For stable branches, this fix to be applied only on kernels that includes both patches in fixes tag. Otherwise, mlx5_ptp_enable(on=0) will be stuck on pincfg_mux. Fixes: 62582a7ee783 ("ptp: Avoid deadlocks in the programmable pin code.") Fixes: ee7f12205abc ("net/mlx5e: Implement 1PPS support") Signed-off-by: Eran Ben Elisha Reviewed-by: Ariel Levkovich Signed-off-by: Saeed Mahameed --- .../ethernet/mellanox/mlx5/core/lib/clock.c | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c index ef0706d15a5b7..c6967e1a560b7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c @@ -273,17 +273,17 @@ static int mlx5_extts_configure(struct ptp_clock_info *ptp, if (rq->extts.index >= clock->ptp_info.n_pins) return -EINVAL; + pin = ptp_find_pin(clock->ptp, PTP_PF_EXTTS, rq->extts.index); + if (pin < 0) + return -EBUSY; + if (on) { - pin = ptp_find_pin(clock->ptp, PTP_PF_EXTTS, rq->extts.index); - if (pin < 0) - return -EBUSY; pin_mode = MLX5_PIN_MODE_IN; pattern = !!(rq->extts.flags & PTP_FALLING_EDGE); field_select = MLX5_MTPPS_FS_PIN_MODE | MLX5_MTPPS_FS_PATTERN | MLX5_MTPPS_FS_ENABLE; } else { - pin = rq->extts.index; field_select = MLX5_MTPPS_FS_ENABLE; } @@ -331,12 +331,12 @@ static int mlx5_perout_configure(struct ptp_clock_info *ptp, if (rq->perout.index >= clock->ptp_info.n_pins) return -EINVAL; - if (on) { - pin = ptp_find_pin(clock->ptp, PTP_PF_PEROUT, - rq->perout.index); - if (pin < 0) - return -EBUSY; + pin = ptp_find_pin(clock->ptp, PTP_PF_PEROUT, + rq->perout.index); + if (pin < 0) + return -EBUSY; + if (on) { pin_mode = MLX5_PIN_MODE_OUT; pattern = MLX5_OUT_PATTERN_PERIODIC; ts.tv_sec = rq->perout.period.sec; @@ -362,7 +362,6 @@ static int mlx5_perout_configure(struct ptp_clock_info *ptp, MLX5_MTPPS_FS_ENABLE | MLX5_MTPPS_FS_TIME_STAMP; } else { - pin = rq->perout.index; field_select = MLX5_MTPPS_FS_ENABLE; } @@ -452,7 +451,7 @@ static int mlx5_init_pin_config(struct mlx5_clock *clock) "mlx5_pps%d", i); clock->ptp_info.pin_config[i].index = i; clock->ptp_info.pin_config[i].func = PTP_PF_NONE; - clock->ptp_info.pin_config[i].chan = i; + clock->ptp_info.pin_config[i].chan = 0; } return 0; From patchwork Tue Jul 28 19:59:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337991 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=TOFdfVdT; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BGSGM0zclz9s1x for ; Wed, 29 Jul 2020 06:00:43 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729243AbgG1UAm (ORCPT ); Tue, 28 Jul 2020 16:00:42 -0400 Received: from mail-eopbgr00081.outbound.protection.outlook.com ([40.107.0.81]:56865 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729136AbgG1UAl (ORCPT ); Tue, 28 Jul 2020 16:00:41 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ig23E4astSC76GYnJfspvhjHvJnoVREGgrCAJOXp2b7QaDMS/kLzv7NA4CN95sl9uf28IkHttDjoTaUTG/0Psm1x4Xl8dYTqJ30ePvGvI50D8IuvFndtD4OICG1lORtHA0/zF7iWEAMibzI7JmHL4OcQmmeydZ39IvUvWwXSsNK4pN7hV0fjYTMfOGv5bvDD619eSsaElFbmsJ++C2nOe3O5pIeZ9XvW6WsIHBrMQ8dM8z/iX2zl/1cdQPivcJFZflCYttWgeBqN6qY5xWF9XeOTcDhTz9pj3gdnDmYyPs2psu1n08bURbRBYc4O1lQ7ess6/u/wRpd5n9uNPG0t9w== 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=yh/WC1RGHuRNGr4ByxZYexAoCoMyD3n91nbAh5l8XQA=; b=Z7PGnu4jMBem3d/GsDfsN8cdfRkqyVLLazErGIRQXkewbQqfWbt4jvxfaH5XHHM9gXGV208XfcjbdXzX6cs6m7ywQV6BOkMltVCVmV5gZBCTwzkdVMXBZC/yX7ofKdsKozeEhmtq+0GCtfILF4qWNME8kblYvtjHSoK3BEHh6BfSOOqwX2tkjiVgCqEQ/XVHLDp+vflloK6BarIu4lV2mSkWXnX3NqPDOe3f/i9ETMhH0VytQ1qTOVJRAvc50uiqinjzHvWEjZ8uCxBido3cLQhyfwf5nHV+hPx6MM/JY3g7KMMU5OU6NXMkbu+tj2HZkbp+23qjQyiXOhPlJNnM4g== 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=yh/WC1RGHuRNGr4ByxZYexAoCoMyD3n91nbAh5l8XQA=; b=TOFdfVdTtc3aXRpLRT3fQBMme/tpwp6TFtSvzbmTXLYjmmY6i4F/SIPPi1408lBTksTr3N7jvHr5x9eEoUcO7GvlVjubecGiz9HACydbRbYvvyAdrrDVEBiaQ7kO68JS7LC7ehyTo0A7tC3og6vZio2gQ41AUgnL41pvX74Ma5E= 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 VI1PR0501MB2592.eurprd05.prod.outlook.com (2603:10a6:800:6f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Tue, 28 Jul 2020 20:00:37 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 20:00:37 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Eran Ben Elisha , Ariel Levkovich , Saeed Mahameed Subject: [net V2 07/11] net/mlx5: Verify Hardware supports requested ptp function on a given pin Date: Tue, 28 Jul 2020 12:59:31 -0700 Message-Id: <20200728195935.155604-8-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728195935.155604-1-saeedm@mellanox.com> References: <20200728195935.155604-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) 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 BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Tue, 28 Jul 2020 20:00:33 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 607b4577-159c-4128-b77c-08d83330e43e X-MS-TrafficTypeDiagnostic: VI1PR0501MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2733; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JWIItAIId51PL33Y9E9BvpiRBqef8m3kHD6yOiWGXIQklzEEqG/GMx+e0Fq9Cp3THEYWTssNBAGLXfZRQ0oV+Am3JfPQng7Lxtad7lruFISLZwM4yip33QlZUK1+hiv3Ej1ZocDNqCiQhNuriyId7ey7pq/cCwbOKiPqQV7UtYs+Lyj6I1+4oPpi6VBvSjIXhry+Sagw68wQmte3+Swj5dDwppk0eyEHw5peBBAG7s300ZlPVbgr7Fp068cg7223cXiaXMlVPtyhlOx08L4YZnmMZncCQ9pw8egSFvO2gr7Mf/OFw24tHVSfMqxucd/C94+D6E4us8YU0qljgsITKyPJzkHQN/jl1vAleSmGy2P1DTopXYZS+MaJcO3Vurbs 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)(366004)(186003)(6486002)(8676002)(83380400001)(498600001)(6506007)(54906003)(110136005)(107886003)(86362001)(36756003)(16526019)(26005)(1076003)(66556008)(52116002)(66476007)(4326008)(66946007)(956004)(8936002)(2616005)(15650500001)(5660300002)(2906002)(6512007)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: jBy4zgF3ZkoAfajRGlL9MpHhbJFNQIaU8Jt6/8tvK8KztlS0N9/ODrI83kRLY82WucR6CId1SW+Lbh3H64jvpppmuRCx9tn1rpirZAXzVmcMivTejq2WKAmtbBYkftnZO9isrI/FjrIKzt37TqP/eBwONXDmME0e3NpDVmjxdffQ8Bo7816ppEwSmNg+bofUfkBIM7y8lOQY1Q3Yr4Q2rZWnG2fHM3eYfl31qADp1B0M8eZHmtyMvYzQCCOnGYMmaqVJBwYXcIlQUjLHv2RPYPETCjiIewnK7+IbardoO85VKbjqj3XZ47Mdrq167weLf08tkzhNCmd6OjPvek3q6oPvlG88jJBnjfxH6RHYKdBfZzkEDZkzFPH/Outx4T4h13zB0ePHIQftuECCZC3+Hrxub/Hgu1roWQMWf8Gx+T6GUjBmrhS6oJzJZ+8UzRnP4ebrdy81fJikFsvEtguh10F7+aUrQK74uqok9L1Jhxc= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 607b4577-159c-4128-b77c-08d83330e43e X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 20:00:37.1629 (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: 8mQqzSkBLE10NK9WC9QRCQd9Hsr4BeQ75KWXC92Xfik4nc6NBTroCvLMpsVHIvkXBCpIjl6wvBW/gd9lyR+3Kw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2592 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eran Ben Elisha Fix a bug where driver did not verify Hardware pin capabilities for PTP functions. Fixes: ee7f12205abc ("net/mlx5e: Implement 1PPS support") Signed-off-by: Eran Ben Elisha Reviewed-by: Ariel Levkovich Signed-off-by: Saeed Mahameed --- .../ethernet/mellanox/mlx5/core/lib/clock.c | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c index c6967e1a560b7..284806e331bd8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c @@ -408,10 +408,31 @@ static int mlx5_ptp_enable(struct ptp_clock_info *ptp, return 0; } +enum { + MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_IN = BIT(0), + MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_OUT = BIT(1), +}; + static int mlx5_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin, enum ptp_pin_function func, unsigned int chan) { - return (func == PTP_PF_PHYSYNC) ? -EOPNOTSUPP : 0; + struct mlx5_clock *clock = container_of(ptp, struct mlx5_clock, + ptp_info); + + switch (func) { + case PTP_PF_NONE: + return 0; + case PTP_PF_EXTTS: + return !(clock->pps_info.pin_caps[pin] & + MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_IN); + case PTP_PF_PEROUT: + return !(clock->pps_info.pin_caps[pin] & + MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_OUT); + default: + return -EOPNOTSUPP; + } + + return -EOPNOTSUPP; } static const struct ptp_clock_info mlx5_ptp_clock_info = { From patchwork Tue Jul 28 19:59:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337992 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=UhPmPbWN; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BGSGS26Qpz9s1x for ; Wed, 29 Jul 2020 06:00:48 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729261AbgG1UAq (ORCPT ); Tue, 28 Jul 2020 16:00:46 -0400 Received: from mail-eopbgr00081.outbound.protection.outlook.com ([40.107.0.81]:56865 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728267AbgG1UAp (ORCPT ); Tue, 28 Jul 2020 16:00:45 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TbPDtX6UESD1pnqYNOkYyYE3UU13U1urb7BySz38tkox+AabwvvjMF8tI3KAZn4bswkLzjO7D0QibyUNpW4Fnx30NPGx/0i8M+ZLcmmkW6h5yuDQ+ptwzYEQ50tk886i46fzkWxzmK72JHD5ulxLl9u5qAHpNhz+TW/FEPFjnAZ8Ppx+093/bHbi+e8eR8IuGwluPccJFmnXxzpwgJLekLhGyVyS6Y3uyfH3xhhpWyItOA5RJOGSa4Io/LaiTLlYlWdKjsFnSOG9iCDT0Ix8O7+4P5k06iLjYG7uDSEjOHl2DwwDAZZIbKJPhI8Xxt83hW8b6Hicr2R6Kkb+jPWhQw== 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=DjhaxaNKOx/o/FA4SHNwtMrUSfbIn3A/PpFldpdRVbg=; b=Rn8r2ZpAeSSoDjiNz+wey+BCTQ0Eara43I2RYrXwfQ7g2zOhZu3k2OoQIrCMF506mbdo8G6g8MFRmtMjGeZB08WO1hHsZz+aNtWJvWkyGQ/j55B3bmXIsxigJMM6eCsbnJyGHuQjP+hYleZZ22Eg3WgHOLu8Vt9bQMiT/L72/p6WaYLdlc1l5VcbQoq71nCcvzon3cxbtTJewpM82tf4PxM5ziYbIeNV8H+qScGURsvsvV/eaaHBD07bySSgsEz7DLZB1d2YWmRY3UtxRJOaprjc8zRFxsRmOt9i8KTr/TBWOX0AdNUFfxHTkao+em8zunKKNnDdPaBtt8eughyaBQ== 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=DjhaxaNKOx/o/FA4SHNwtMrUSfbIn3A/PpFldpdRVbg=; b=UhPmPbWNc1tN8tO9rwtFygZtcYe+PvQDeunoVXKDeLFX5b/l8kuTwsMjCMHAry+Dc7/5c7mggMlseqQOQK7tCTB23Y/Ima+7zUsqi/FeezMfbzyRs/XYKITTo9K79vQIOVVNS/HcWK9l7fAWMQT28cAfocHCBtMG0YD+FxNMu3k= 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 VI1PR0501MB2592.eurprd05.prod.outlook.com (2603:10a6:800:6f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Tue, 28 Jul 2020 20:00:40 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 20:00:40 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Raed Salem , Roi Dayan , Vu Pham , Saeed Mahameed Subject: [net V2 08/11] net/mlx5e: Fix slab-out-of-bounds in mlx5e_rep_is_lag_netdev Date: Tue, 28 Jul 2020 12:59:32 -0700 Message-Id: <20200728195935.155604-9-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728195935.155604-1-saeedm@mellanox.com> References: <20200728195935.155604-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) 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 BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Tue, 28 Jul 2020 20:00:38 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: dddd525f-1dc5-4701-93e5-08d83330e6f8 X-MS-TrafficTypeDiagnostic: VI1PR0501MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q2JU3IVq3szl3MwZbYncTsQYWAJC+oodv138NIwhjM1GCkWwm0fM/auLC+u2JAwZHtJaXpaHRhkgxbmXPVnj9uUr+esPg/xJqhc4eC/9/0muJcRdwO13LD0eM5kHcwZO2oakZqLmirftEN13oSoLmYs0Dyvsfvvjaq1XE/tEjjMsy6vKY2I9vgm1myi1a8cMrw/sJVTSxhMiLvhODIC9SaCrYmkm8hNu73i2ykuErPRYv705t5hBlwReeZ/btkq/XPa9vfMx/Hi+tilV2shBFqAUWWiRCM3GIwpLumMW8bxwdI5oo6vZcfiFmzq1Jtv7nMiH/KQD/X9JXnaoxV7WMKwc50nd68HehXwprg5VYw4J/KGYgTatC+oJT2NfuNRl 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)(366004)(186003)(6486002)(8676002)(83380400001)(498600001)(6506007)(54906003)(110136005)(107886003)(86362001)(36756003)(16526019)(26005)(1076003)(66556008)(52116002)(6666004)(66476007)(4326008)(66946007)(956004)(8936002)(2616005)(5660300002)(2906002)(6512007)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: E82nIQQZjY6JJcaDGxLc0L6AXqDG6dja/HLijIAa7YEdT+fPiR29/y2eI4Ihkdk/V7NPaNzQyDgEGIr1ReG/FxvRGRyH0fRJRWojZHkcThssjZy8JyoGl6sPbEsr/SoSBWswzYvbmCZ2C3pnHfdIsmZ9oOTFXc8urRVefeZ5qquj6OsZfQ62740lbhQr1c4O3WmMT4l3gigbSfk123onQTjr5Z6aIrrBocWeJJ/cGPaZqm5e8sNb4m/3PHYANSHMDIIz7MBHuWenZpAYoSuga134GbRyozqSTwQfe16knZXe4g1WdySib8sWTTd8w1W9QyC8EQAj9SSGlAVnRD4RhSBhdATubc4q+CbIVMLt9snD3KZXylVy+zFwk3uqGfrhmmyyLJpRbGiHb2tkoij9RAOxAMzW30nxNXQGWCA2x/yVJR5hdVa3U4aLWrrz8AHsUV921F0WFiJMDkyLJTI6u5m9luhDEHKlOiUsGyhtVpc= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: dddd525f-1dc5-4701-93e5-08d83330e6f8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 20:00:40.7252 (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: nR+ylVjRBVg9DJSJlgi0HVmdgtRPg6PIE78nx6BNZbjF5V4Sxt09kYxjUkmFe7J3c81yIztOwlD7uPqoxxdxKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2592 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Raed Salem mlx5e_rep_is_lag_netdev is used as first check as part of netdev events handler for bond device of non-uplink representors, this handler can get any netdevice under the same network namespace of mlx5e netdevice. Current code treats the netdev as mlx5e netdev and only later on verifies this, hence causes the following Kasan trace: [15402.744990] ================================================================== [15402.746942] BUG: KASAN: slab-out-of-bounds in mlx5e_rep_is_lag_netdev+0xcb/0xf0 [mlx5_core] [15402.749009] Read of size 8 at addr ffff880391f3f6b0 by task ovs-vswitchd/5347 [15402.752065] CPU: 7 PID: 5347 Comm: ovs-vswitchd Kdump: loaded Tainted: G B O --------- -t - 4.18.0-g3dcc204d291d-dirty #1 [15402.755349] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014 [15402.757600] Call Trace: [15402.758968] dump_stack+0x71/0xab [15402.760427] print_address_description+0x6a/0x270 [15402.761969] kasan_report+0x179/0x2d0 [15402.763445] ? mlx5e_rep_is_lag_netdev+0xcb/0xf0 [mlx5_core] [15402.765121] mlx5e_rep_is_lag_netdev+0xcb/0xf0 [mlx5_core] [15402.766782] mlx5e_rep_esw_bond_netevent+0x129/0x620 [mlx5_core] Fix by deferring the violating access to be post the netdev verify check. Fixes: 7e51891a237f ("net/mlx5e: Use netdev events to set/del egress acl forward-to-vport rule") Signed-off-by: Raed Salem Reviewed-by: Roi Dayan Reviewed-by: Vu Pham Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c index bdb71332cbf2d..3e44e4d820c51 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c @@ -183,13 +183,16 @@ void mlx5e_rep_bond_unslave(struct mlx5_eswitch *esw, static bool mlx5e_rep_is_lag_netdev(struct net_device *netdev) { - struct mlx5e_priv *priv = netdev_priv(netdev); - struct mlx5e_rep_priv *rpriv = priv->ppriv; + struct mlx5e_rep_priv *rpriv; + struct mlx5e_priv *priv; /* A given netdev is not a representor or not a slave of LAG configuration */ if (!mlx5e_eswitch_rep(netdev) || !bond_slave_get_rtnl(netdev)) return false; + priv = netdev_priv(netdev); + rpriv = priv->ppriv; + /* Egress acl forward to vport is supported only non-uplink representor */ return rpriv->rep->vport != MLX5_VPORT_UPLINK; } From patchwork Tue Jul 28 19:59:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337993 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=GJyS1uoE; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BGSGV381Jz9s1x for ; Wed, 29 Jul 2020 06:00:50 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729294AbgG1UAt (ORCPT ); Tue, 28 Jul 2020 16:00:49 -0400 Received: from mail-eopbgr00081.outbound.protection.outlook.com ([40.107.0.81]:56865 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729123AbgG1UAr (ORCPT ); Tue, 28 Jul 2020 16:00:47 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lp0GJk5Hg32jhvHekgS/WVeMPgqLOjIV+J4WUFkLsPUeKKSTfWunnybp6S2edXgtTYWHMfiMcTI1FIsKdyAVtv+2v1p2zyGVGCcLqCkCH5PcJ28H1Q+doZUh/cUoOhl7ZyEZINzjSio5YZFaV2asSJ9G4Lr/QuA5V14U2uHvrZlSmckd+846+XjrawtjVOmLxRwN3KLIv+aqG5q1vEreXUBRkVVpxEcJnq2Qp8Y3OCISiK+/m/O+otLtVVwdP7sl2RhSOWzkIxgFR832H6wHi72/TrQFflxbbGLmEHugteCTFubWMMNq2tsStsNE4PoPr1ue6Z7xSvYEUvKyzJQwEA== 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=3eh8jFVtjX8y2ZaPHudui6VQ5uy62eUgokPfk15A2a0=; b=htnLFAd9x25BLiN1zV/j3OIm3MAZvMmy4y/dwY0J1Rd4zzlJeZNDReDuGOh9cE8Z0ogPB7o9pz8PE1tDXsAXXkYsn1EqX9QP7s3T4xsCgv8QB/3jp8EL6gdaSWtUAZFk/ixpdsGkvqyR4a4D/lderBcmDl6AnXI50AhFVHlZqskFpU4wrHLbcAIzwl3bd1QlHCBIVzPZt6HOAeu3wJVkAH8Z7xN95qCqdFYRoFqp2air3Id1nAslRB/I1uDAPaMLhTv8UokxQTDz5Hlia/qsv2vr9WCpnWw75OiBaCnnj33OSRqUB0FHCpTbjYPjvBYKnnGOf8iqMvFxxiCSzJun8Q== 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=3eh8jFVtjX8y2ZaPHudui6VQ5uy62eUgokPfk15A2a0=; b=GJyS1uoEsVjyZcUWqOip+M5jC2Ap5J+4EVlzQkEizUBk6nyaPO+GwA89A+7wwGeYcE4wTAZvtoIsXCRdfCR4ULMw/sf1IxBXAhEMmNsemtKHZAJq+yLXFJOmPVN+hvekYwgziNGofiEoRtIVdEASJVL1HBldprLr8kak31Y/qbg= 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 VI1PR0501MB2592.eurprd05.prod.outlook.com (2603:10a6:800:6f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Tue, 28 Jul 2020 20:00:44 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 20:00:44 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Eran Ben Elisha , Saeed Mahameed Subject: [net V2 09/11] net/mlx5: Query PPS pin operational status before registering it Date: Tue, 28 Jul 2020 12:59:33 -0700 Message-Id: <20200728195935.155604-10-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728195935.155604-1-saeedm@mellanox.com> References: <20200728195935.155604-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) 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 BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Tue, 28 Jul 2020 20:00:41 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3fd92c02-b84a-404d-10ca-08d83330e8be X-MS-TrafficTypeDiagnostic: VI1PR0501MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IXZgAO1lONKFhFTueS0ThB6+oYe2NL7yjfzL23XX3B1Ig47mectUfWZL15dlnwFAZeZ1vt48j+ot0Hlhl1eCAgfmzC/KJp2WpKI7lwtGKhCdsbt3D1qA+P20pRGbtx6QOu7HTjsfRvkNeatBLuTjyl/ZjlHYiTe+kP84y33CsFhni+n5UfP9vku8UW8HebtricHCvZLwLZYj2JDuupQ35O7RQC8VIRMcmkpjCEDjObK5E8pESQIJa0AvoY1hyS4bnLyI7TsPD01ul7NorqlMuVlsPqUWcN8+U1IEP4FK8PhKp240jQfRJqHF9aw+CeFK2zZ8NxH5U+JAinuUMAz/3AzSRa3aqm/OssIFlYdaDTPb+6A5fvqhYuTvcIieNZlG 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)(366004)(186003)(6486002)(8676002)(83380400001)(498600001)(6506007)(54906003)(110136005)(107886003)(86362001)(36756003)(16526019)(26005)(1076003)(66556008)(52116002)(6666004)(66476007)(4326008)(66946007)(956004)(8936002)(2616005)(5660300002)(2906002)(6512007)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: CdDV/VDMUyK99fQ5FHNdupU4ZDDX0/3SqVhb2E36Loc1KTrZQukt7lSySAtOa6glsfmmaBjn7JKav0Dluoq35Ot7ciltray/y0oeN14p0GvGmO3cS2Xb0Zakz9XU0gE0AroV7nZKRLsUAmvLW2IdBTk/EkwC4Ps/x+zoszo962qEUzA++tSfkAoBCElnP2zZtyqI+f0B4Bwjn+f3xTymGx9fMAKEQiOgRrQ30/z2Fkk9H/T9jL7jg64HC36oX8Q/YyMyB0v+mMu2KyR3TzIPo+Az5sBZOGl8QR2k8vqh7HLP4tGOGCKCWtW78J/12jRMD7bEFyHUrwT807/dJ1MQjAxYpEPl3i6KGtmq3v+mQWjGlckK0eKSZsxVhBaMRBk/1PetwsH3XQwZ9kSCgpi/vDr6VJl+2tJCFZdQs/ZDKaqV4E3AzVavWYjyeXu8DMu6yrrVLfxSR3nJW/8EmzdH1M6Airp9OHOZXt6wpMpjyOo= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3fd92c02-b84a-404d-10ca-08d83330e8be X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 20:00:43.6723 (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: HEZ9afwlw1qNtLvuIqE/jEp+9XtnFPLi10hGlCyjIhn1M83UWXN9nIgdV4arZT3SRuVLEl1ozoderFNRANaqcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2592 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eran Ben Elisha In a special configuration, a ConnectX6-Dx pin pps-out might be activated when driver is loaded. Fix the driver to always read the operational pin mode when registering it, and advertise it accordingly. Fixes: ee7f12205abc ("net/mlx5e: Implement 1PPS support") Signed-off-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed --- .../ethernet/mellanox/mlx5/core/lib/clock.c | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c index 284806e331bd8..2d55b7c22c034 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c @@ -452,6 +452,38 @@ static const struct ptp_clock_info mlx5_ptp_clock_info = { .verify = NULL, }; +static int mlx5_query_mtpps_pin_mode(struct mlx5_core_dev *mdev, u8 pin, + u32 *mtpps, u32 mtpps_size) +{ + u32 in[MLX5_ST_SZ_DW(mtpps_reg)] = {}; + + MLX5_SET(mtpps_reg, in, pin, pin); + + return mlx5_core_access_reg(mdev, in, sizeof(in), mtpps, + mtpps_size, MLX5_REG_MTPPS, 0, 0); +} + +static int mlx5_get_pps_pin_mode(struct mlx5_clock *clock, u8 pin) +{ + struct mlx5_core_dev *mdev = clock->mdev; + u32 out[MLX5_ST_SZ_DW(mtpps_reg)] = {}; + u8 mode; + int err; + + err = mlx5_query_mtpps_pin_mode(mdev, pin, out, sizeof(out)); + if (err || !MLX5_GET(mtpps_reg, out, enable)) + return PTP_PF_NONE; + + mode = MLX5_GET(mtpps_reg, out, pin_mode); + + if (mode == MLX5_PIN_MODE_IN) + return PTP_PF_EXTTS; + else if (mode == MLX5_PIN_MODE_OUT) + return PTP_PF_PEROUT; + + return PTP_PF_NONE; +} + static int mlx5_init_pin_config(struct mlx5_clock *clock) { int i; @@ -471,7 +503,7 @@ static int mlx5_init_pin_config(struct mlx5_clock *clock) sizeof(clock->ptp_info.pin_config[i].name), "mlx5_pps%d", i); clock->ptp_info.pin_config[i].index = i; - clock->ptp_info.pin_config[i].func = PTP_PF_NONE; + clock->ptp_info.pin_config[i].func = mlx5_get_pps_pin_mode(clock, i); clock->ptp_info.pin_config[i].chan = 0; } From patchwork Tue Jul 28 19:59:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337994 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=NciF1jxw; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BGSGY66PCz9s1x for ; Wed, 29 Jul 2020 06:00:53 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729332AbgG1UAx (ORCPT ); Tue, 28 Jul 2020 16:00:53 -0400 Received: from mail-eopbgr00064.outbound.protection.outlook.com ([40.107.0.64]:19686 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729300AbgG1UAv (ORCPT ); Tue, 28 Jul 2020 16:00:51 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KSoBwI18C88lXTFalYJX67AtDx0l6hyDBC854EOUrYbxmLKblpOsy7vffAeqcyFlNLRB60W5k8EBdtKnkr1aAuJh2Qka8MBDiuakXJvl9cD6WDDxUdoKQwJN+ksSxMRUW3DLr2sBV94jJ3J6aE3oySNbAbngvzGuqr4N6tyZnX9hfO4x+pDlOabGhLGYfOeVqveVupPYgrL1GeLGpuuDClMfdruesulsreMokr+8voX1yRStL+WmKMiZ+kSnRCYJzXLSKs4QG8x1rzzN8r7XW+/JxTqhccFMLYBveozgFTbLZ74M0n9NaQX+00qNgII7YCuXSlmEaCW69Fs/usK1vA== 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=h57vDBXZzLrgEn6cIlweyy+lp5zjeQjYWgXwka7Q3bI=; b=fUwA7gd2sh7gY1PiG1HGJ/hieINYQiJR6FhTLZ7/AMVlo7ycuN/9Z3ocTmAR2QqbyEEcUYSrMkwF5kLKCNySVVjnePFpFx416MwOwJWENSdWqLpJRjKqVTgTX4fVmNaS+yDZpTonRP/s50Ujn3nLUTTMdfbHt/MkKiJrO6X3F5EM7M97ndS9DHNWcFVlWAIACslTKU7pIOgmT/1SEoPAlbX2JIdOlXE66hS4QZD1ufH/yYqS4Vfc2OuoVctN6KxtlIPpOxYh/RR5y7SBLOn/juSEbqMlT6+E3RX2IYHOJextDAKUNCxix7SeD36dCDjeAyRshF3R0uxbriAdjJfibQ== 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=h57vDBXZzLrgEn6cIlweyy+lp5zjeQjYWgXwka7Q3bI=; b=NciF1jxw+plL7m07WXjvmKR0Mi16ZdjgLrBhZj+aRTFVuxs29HfGmY9S3jVz0b71SAZzmdR5V7Z8xAqvq+mU37/wMnBdMcs2V+v0Y2it9XLXcZxtfW2li1G93g9zCUD3lEYFUlkOY8+0FtrcZgOOPgni1WOwClszcInpTyir6/s= 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 VI1PR0501MB2592.eurprd05.prod.outlook.com (2603:10a6:800:6f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Tue, 28 Jul 2020 20:00:48 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 20:00:47 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Ron Diskin , Roi Dayan , Moshe Shemesh , Saeed Mahameed Subject: [net V2 10/11] net/mlx5e: Modify uplink state on interface up/down Date: Tue, 28 Jul 2020 12:59:34 -0700 Message-Id: <20200728195935.155604-11-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728195935.155604-1-saeedm@mellanox.com> References: <20200728195935.155604-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) 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 BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Tue, 28 Jul 2020 20:00:45 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f35cd8b9-9419-4969-82f6-08d83330eb10 X-MS-TrafficTypeDiagnostic: VI1PR0501MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1775; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sQaCiIxceshimF7LzLi0UtJxyrXcmBBXMuH1P1MzvT6CQUuWCY8/2Mpo/thThhZUkMLahNA9PTQKKqdUd2Ly2UmUEcXH2tvOIE94gDXrzMLad/nfaQo8NQoeK+jYruwuKDGvlMKCmau5aYD3ZVyguMwdcDj5RoIwBX56dMny7sauyARZNl9dJF2N06tdWOhVfrE5DgGVNiG5AGtCGA4hCI0VDN2aI6TulKNNMKNwVPV3rw4SAjEzn3quEK2x8yM3chwpBzniMW0rY8HYOoU/k2oPtxVU7KF/RfzZy7eVlGyLmWAItpoguTznNHePekYWprTZYwWq9lHIARAjamaHmzcy/6P2tMHVtz05WiCEZqXEpKb6W9UChwugOVY6rHDY 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)(366004)(186003)(6486002)(8676002)(83380400001)(498600001)(6506007)(54906003)(110136005)(107886003)(86362001)(36756003)(16526019)(26005)(1076003)(66556008)(52116002)(6666004)(66476007)(4326008)(66946007)(956004)(8936002)(2616005)(5660300002)(2906002)(6512007)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hYwlVOPhBYZzb6lKMQywVB2d3R6N0bNMCJ4b7H/uguAid4ECnBsGleoaZXtKup7cepbT931Lv8wH7YGd3cTbAQ3/Rkll60wx8xJRytIJxC1Mwhtiuw0iPcptiMxFt+b3Qc/jRt15KMPtAH0UR0KGU01AO+JSFIr5cjNFyd6enqEmlaiTm8sDxsKPpkjvr0tCfjVjfaasWR+KxAiln76jDcgpMLOsC/JB5c2ejKpSnkxaDeMK4iYW4eG5tEFaY0gUamnNYbiOT5qHZUy4gI8NPJff7lOtiH56Jauon9sD+Jx00sUC+obbspUvHehuAALLi5rm9Rp87RiLSJV61u1fdWrMRiY4txy8tgWHpGMJwn4Fi++M/Fq8KUzL5ysR0xPW/6+dpHeaKULldfPYVAuyWZp7sC3OmO+gTmrY/5gBxvPWmJZ65EkDDaEvMsZLRUMdcRfK08pthWboykzURgaeFbbu3E2lErvXDRUYpV0hRIk= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: f35cd8b9-9419-4969-82f6-08d83330eb10 X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 20:00:47.4248 (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: fDNVahwzA2TUrSPu5p6V+l/9PimX37L2AsZ+QBu5B2MKJBGrBgC2cThhmw0Cg+SGwQYYoCnA078qSNojrgJfgw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2592 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ron Diskin When setting the PF interface up/down, notify the firmware to update uplink state via MODIFY_VPORT_STATE, when E-Switch is enabled. This behavior will prevent sending traffic out on uplink port when PF is down, such as sending traffic from a VF interface which is still up. Currently when calling mlx5e_open/close(), the driver only sends PAOS command to notify the firmware to set the physical port state to up/down, however, it is not sufficient. When VF is in "auto" state, it follows the uplink state, which was not updated on mlx5e_open/close() before this patch. When switchdev mode is enabled and uplink representor is first enabled, set the uplink port state value back to its FW default "AUTO". Fixes: 63bfd399de55 ("net/mlx5e: Send PAOS command on interface up/down") Signed-off-by: Ron Diskin Reviewed-by: Roi Dayan Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/en_main.c | 25 ++++++++++++++++--- .../net/ethernet/mellanox/mlx5/core/en_rep.c | 2 ++ .../net/ethernet/mellanox/mlx5/core/eswitch.c | 16 +++++++----- .../net/ethernet/mellanox/mlx5/core/eswitch.h | 2 ++ include/linux/mlx5/mlx5_ifc.h | 1 + 5 files changed, 37 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 31f9ecae98df9..07fdbea7ea13b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3069,6 +3069,25 @@ void mlx5e_timestamp_init(struct mlx5e_priv *priv) priv->tstamp.rx_filter = HWTSTAMP_FILTER_NONE; } +static void mlx5e_modify_admin_state(struct mlx5_core_dev *mdev, + enum mlx5_port_status state) +{ + struct mlx5_eswitch *esw = mdev->priv.eswitch; + int vport_admin_state; + + mlx5_set_port_admin_status(mdev, state); + + if (!MLX5_ESWITCH_MANAGER(mdev) || mlx5_eswitch_mode(esw) == MLX5_ESWITCH_OFFLOADS) + return; + + if (state == MLX5_PORT_UP) + vport_admin_state = MLX5_VPORT_ADMIN_STATE_AUTO; + else + vport_admin_state = MLX5_VPORT_ADMIN_STATE_DOWN; + + mlx5_eswitch_set_vport_state(esw, MLX5_VPORT_UPLINK, vport_admin_state); +} + int mlx5e_open_locked(struct net_device *netdev) { struct mlx5e_priv *priv = netdev_priv(netdev); @@ -3101,7 +3120,7 @@ int mlx5e_open(struct net_device *netdev) mutex_lock(&priv->state_lock); err = mlx5e_open_locked(netdev); if (!err) - mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP); + mlx5e_modify_admin_state(priv->mdev, MLX5_PORT_UP); mutex_unlock(&priv->state_lock); return err; @@ -3135,7 +3154,7 @@ int mlx5e_close(struct net_device *netdev) return -ENODEV; mutex_lock(&priv->state_lock); - mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_DOWN); + mlx5e_modify_admin_state(priv->mdev, MLX5_PORT_DOWN); err = mlx5e_close_locked(netdev); mutex_unlock(&priv->state_lock); @@ -5182,7 +5201,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv) /* Marking the link as currently not needed by the Driver */ if (!netif_running(netdev)) - mlx5_set_port_admin_status(mdev, MLX5_PORT_DOWN); + mlx5e_modify_admin_state(mdev, MLX5_PORT_DOWN); mlx5e_set_netdev_mtu_boundaries(priv); mlx5e_set_dev_port_mtu(priv); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 8c294ab43f908..9519a61bd8ec5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -1081,6 +1081,8 @@ static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv) mlx5e_rep_tc_enable(priv); + mlx5_modify_vport_admin_state(mdev, MLX5_VPORT_STATE_OP_MOD_UPLINK, + 0, 0, MLX5_VPORT_ADMIN_STATE_AUTO); mlx5_lag_add(mdev, netdev); priv->events_nb.notifier_call = uplink_rep_async_event; mlx5_notifier_register(mdev, &priv->events_nb); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index d9376627584e9..71d01143c4556 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1826,6 +1826,8 @@ int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw, u16 vport, int link_state) { struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport); + int opmod = MLX5_VPORT_STATE_OP_MOD_ESW_VPORT; + int other_vport = 1; int err = 0; if (!ESW_ALLOWED(esw)) @@ -1833,15 +1835,17 @@ int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw, if (IS_ERR(evport)) return PTR_ERR(evport); + if (vport == MLX5_VPORT_UPLINK) { + opmod = MLX5_VPORT_STATE_OP_MOD_UPLINK; + other_vport = 0; + vport = 0; + } mutex_lock(&esw->state_lock); - err = mlx5_modify_vport_admin_state(esw->dev, - MLX5_VPORT_STATE_OP_MOD_ESW_VPORT, - vport, 1, link_state); + err = mlx5_modify_vport_admin_state(esw->dev, opmod, vport, other_vport, link_state); if (err) { - mlx5_core_warn(esw->dev, - "Failed to set vport %d link state, err = %d", - vport, err); + mlx5_core_warn(esw->dev, "Failed to set vport %d link state, opmod = %d, err = %d", + vport, opmod, err); goto unlock; } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h index a5175e98c0b34..5785596f13f5b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h @@ -680,6 +680,8 @@ static inline int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int num_vfs) { r static inline void mlx5_eswitch_disable(struct mlx5_eswitch *esw, bool clear_vf) {} static inline bool mlx5_esw_lag_prereq(struct mlx5_core_dev *dev0, struct mlx5_core_dev *dev1) { return true; } static inline bool mlx5_eswitch_is_funcs_handler(struct mlx5_core_dev *dev) { return false; } +static inline +int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw, u16 vport, int link_state) { return 0; } static inline const u32 *mlx5_esw_query_functions(struct mlx5_core_dev *dev) { return ERR_PTR(-EOPNOTSUPP); diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 073b79eacc991..1340e02b14ef2 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -4381,6 +4381,7 @@ struct mlx5_ifc_query_vport_state_out_bits { enum { MLX5_VPORT_STATE_OP_MOD_VNIC_VPORT = 0x0, MLX5_VPORT_STATE_OP_MOD_ESW_VPORT = 0x1, + MLX5_VPORT_STATE_OP_MOD_UPLINK = 0x2, }; struct mlx5_ifc_arm_monitor_counter_in_bits { From patchwork Tue Jul 28 19:59:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1337995 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.a=rsa-sha256 header.s=selector1 header.b=ho2OAxt8; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BGSGd5qL4z9s1x for ; Wed, 29 Jul 2020 06:00:57 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729352AbgG1UA5 (ORCPT ); Tue, 28 Jul 2020 16:00:57 -0400 Received: from mail-eopbgr00066.outbound.protection.outlook.com ([40.107.0.66]:1413 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729300AbgG1UA4 (ORCPT ); Tue, 28 Jul 2020 16:00:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hAhKcylsJCsfHdfDF49bPCNliInZsOgGme+MLIgn64jclxfICb/GcUbVDDLOm+SQ+62/ZPpUrnL/EZTqBV3o62IA9+9Lls7uGFHRjqv0qcDDCBXpj7E/lWjCQxvQU1P/n2JtIj0KVsxRmkSYe5AAa6np/VgRsNJblq8DecB/LDx0di3yYkK257Ql4FG2LXpI/wNjwFL/vPWSh8KKH+Y8pvFQl53bvODWi/XKEiGHIJdPCgnNSDJahXGWCqA3gG8x6eSAmrANu1JCaeXQA5OcbveSuAd/BnHYi3TNrYUVsLI5DQViAAq3LhinNLRxRlWepkqnkE0LnR9kQnlhJqgTdA== 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=PB6A7BOwlbghfua3HcZpWWj9Vo6t8AgAXCfLrMfdU6M=; b=byKSsi9SWf7X0DAeDaSk1VrUMSQlsPzhrVvz4ceHKbXBskB4bC4O1JomNAIXbUuaeB66MAwk3waNB1mMtGtEVBqw754SRrRZQlM4s4v4NN+iYN5wtK7ds4oeFIVDqym2MR0eHjLrZ3bjED/cUQFPzkrLbnH3Ma/Yv5DvNUioYJJLp4YPU3NrhoR9SdH7KAv/bMHMzNq6C8swRAvAGvopQ4huquGFvGCloUIwrMb5EXZVAqissTA8cGHCQCPEAQQLRi13CIdjMQb7DW9DDlrxlZd98LJXh8kR+I1Qk9+VXQ7RPniw9N8PtTandvxb9TC2kJecwPPek/6fE5OhFq8r/A== 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=PB6A7BOwlbghfua3HcZpWWj9Vo6t8AgAXCfLrMfdU6M=; b=ho2OAxt8XvWk2Oh9XT9gbVZeSwVBFPScUIprl8HdCjrasl+eNWkv9XXdZWmN7lRO1q5gD5nVlXEzxJBCyOyd7CFxYNwMKBqXlavQMbwT7c1KByth51I6SbJ4K15qaMgwZCCx/xylc9PGV/ukymW3jn+veBfq46KFr5hrPfncLbw= 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 VI1PR0501MB2592.eurprd05.prod.outlook.com (2603:10a6:800:6f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Tue, 28 Jul 2020 20:00:52 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::508a:d074:ad3a:3529%5]) with mapi id 15.20.3216.034; Tue, 28 Jul 2020 20:00:51 +0000 From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Alaa Hleihel , Roi Dayan , Vlad Buslov , Saeed Mahameed Subject: [net V2 11/11] net/mlx5e: Fix kernel crash when setting vf VLANID on a VF dev Date: Tue, 28 Jul 2020 12:59:35 -0700 Message-Id: <20200728195935.155604-12-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728195935.155604-1-saeedm@mellanox.com> References: <20200728195935.155604-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) 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 BYAPR07CA0058.namprd07.prod.outlook.com (2603:10b6:a03:60::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Tue, 28 Jul 2020 20:00:48 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 84305557-ad00-42d7-76f0-08d83330ed38 X-MS-TrafficTypeDiagnostic: VI1PR0501MB2592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:475; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OzDZPycnfHxeJB33Vvrb8buRuxLuQMU3fyBBfTUIgcCjmi1aVD5xHggaa3wOK/nvXTFyRPiELYpu7Nc6LHcRnnycVODSaZF87pEtkum4ZqWFAOc18gOvotAnctzcGZauBCVPMMJfRMQNYXBmKtk6M8wcte6mCjZack61MPxutRk/gGWg4XlNJs5Hd4E+IwAWHPdSIyxT5rSi8KoSh8PydXu+8ScSByJbQ/9sV6ShFDFpNK2Ov+BD4Q3b/f/ley5/ICu2BJv3iAA0Ey0SopNWm9NZAkMpIB3r0IybiOMBljfj8zPwWFP6J1MA+Y9Hwk82salPJibgR77nFtOM/S3zA4gwZo8FLIx0HvBKNSYeraprTjOttmC/6xv5kUYqKWT9 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)(366004)(186003)(6486002)(8676002)(83380400001)(498600001)(6506007)(54906003)(110136005)(107886003)(86362001)(36756003)(16526019)(26005)(1076003)(66556008)(52116002)(6666004)(66476007)(4326008)(66946007)(956004)(8936002)(2616005)(5660300002)(2906002)(6512007)(54420400002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: TMz2UrfqWnmkYimyx9bhyLwFcoOtHcmcBXwEdzHvQ0Lb0F81AHzGUznGsOeZcSgrF4GwCLwWCCpEnAHVapmfeyzjtuhyBpdIPQljzABO1Qn1jOkPBALc+iqSdjFFwEEVRdhybefgLr6PvzlomorVFhZN04TruY2uQRiLYaNrKGqUd2uCzCrx7Hu7/b5LGbH4WT6EmXum/KFVq6op1AN8KbdzfH+r7wXuxTP29qqtzYU/bOkRx8sCGmxOl3hHk6t1qSm1P+IUyrMitqc2YXYInBQq6D54x4N3Bxw0WXOHt8c63RbO2SlJ1O8JGwcsNiTBSOn4tI5Vfdvky4v0c1RaeCiZCljfoasgRBUpAU0ewn6fvTAWxYEoVKtBsaApZH5+P/HELXaLo1wHxhv1XfQ15UKSzF+k/y5xSTea4wBZi3XdVV9wXuYkjwXVhs02WFNUARIUR6RZoOt4OdMW1SGxa8TicRGnQG56idg7CevoK28= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84305557-ad00-42d7-76f0-08d83330ed38 X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB5102.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 20:00:51.6170 (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: 6X6FSwyWObGKxvjtuyGk/bl7BlVGuxpYQS+ey+w2iZo8E/RAQJE/wmZKCUgi+ojGiGCK0y7IUbxacrpDzjh+5A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2592 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Alaa Hleihel After the cited commit, function 'mlx5_eswitch_set_vport_vlan' started to acquire esw->state_lock. However, esw is not defined for VF devices, hence attempting to set vf VLANID on a VF dev will cause a kernel panic. Fix it by moving up the (redundant) esw validation from function '__mlx5_eswitch_set_vport_vlan' since the rest of the callers now have and use a valid esw. For example with vf device eth4: # ip link set dev eth4 vf 0 vlan 0 Trace of the panic: [ 411.409842] BUG: unable to handle page fault for address: 00000000000011b8 [ 411.449745] #PF: supervisor read access in kernel mode [ 411.452348] #PF: error_code(0x0000) - not-present page [ 411.454938] PGD 80000004189c9067 P4D 80000004189c9067 PUD 41899a067 PMD 0 [ 411.458382] Oops: 0000 [#1] SMP PTI [ 411.460268] CPU: 4 PID: 5711 Comm: ip Not tainted 5.8.0-rc4_for_upstream_min_debug_2020_07_08_22_04 #1 [ 411.462447] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014 [ 411.464158] RIP: 0010:__mutex_lock+0x4e/0x940 [ 411.464928] Code: fd 41 54 49 89 f4 41 52 53 89 d3 48 83 ec 70 44 8b 1d ee 03 b0 01 65 48 8b 04 25 28 00 00 00 48 89 45 c8 31 c0 45 85 db 75 0a <48> 3b 7f 60 0f 85 7e 05 00 00 49 8d 45 68 41 56 41 b8 01 00 00 00 [ 411.467678] RSP: 0018:ffff88841fcd74b0 EFLAGS: 00010246 [ 411.468562] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 [ 411.469715] RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000001158 [ 411.470812] RBP: ffff88841fcd7550 R08: ffffffffa00fa1ce R09: 0000000000000000 [ 411.471835] R10: ffff88841fcd7570 R11: 0000000000000000 R12: 0000000000000002 [ 411.472862] R13: 0000000000001158 R14: ffffffffa00fa1ce R15: 0000000000000000 [ 411.474004] FS: 00007faee7ca6b80(0000) GS:ffff88846fc00000(0000) knlGS:0000000000000000 [ 411.475237] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 411.476129] CR2: 00000000000011b8 CR3: 000000041909c006 CR4: 0000000000360ea0 [ 411.477260] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 411.478340] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 411.479332] Call Trace: [ 411.479760] ? __nla_validate_parse.part.6+0x57/0x8f0 [ 411.482825] ? mlx5_eswitch_set_vport_vlan+0x3e/0xa0 [mlx5_core] [ 411.483804] mlx5_eswitch_set_vport_vlan+0x3e/0xa0 [mlx5_core] [ 411.484733] mlx5e_set_vf_vlan+0x41/0x50 [mlx5_core] [ 411.485545] do_setlink+0x613/0x1000 [ 411.486165] __rtnl_newlink+0x53d/0x8c0 [ 411.486791] ? mark_held_locks+0x49/0x70 [ 411.487429] ? __lock_acquire+0x8fe/0x1eb0 [ 411.488085] ? rcu_read_lock_sched_held+0x52/0x60 [ 411.488998] ? kmem_cache_alloc_trace+0x16d/0x2d0 [ 411.489759] rtnl_newlink+0x47/0x70 [ 411.490357] rtnetlink_rcv_msg+0x24e/0x450 [ 411.490978] ? netlink_deliver_tap+0x92/0x3d0 [ 411.491631] ? validate_linkmsg+0x330/0x330 [ 411.492262] netlink_rcv_skb+0x47/0x110 [ 411.492852] netlink_unicast+0x1ac/0x270 [ 411.493551] netlink_sendmsg+0x336/0x450 [ 411.494209] sock_sendmsg+0x30/0x40 [ 411.494779] ____sys_sendmsg+0x1dd/0x1f0 [ 411.495378] ? copy_msghdr_from_user+0x5c/0x90 [ 411.496082] ___sys_sendmsg+0x87/0xd0 [ 411.496683] ? lock_acquire+0xb9/0x3a0 [ 411.497322] ? lru_cache_add+0x5/0x170 [ 411.497944] ? find_held_lock+0x2d/0x90 [ 411.498568] ? handle_mm_fault+0xe46/0x18c0 [ 411.499205] ? __sys_sendmsg+0x51/0x90 [ 411.499784] __sys_sendmsg+0x51/0x90 [ 411.500341] do_syscall_64+0x59/0x2e0 [ 411.500938] ? asm_exc_page_fault+0x8/0x30 [ 411.501609] ? rcu_read_lock_sched_held+0x52/0x60 [ 411.502350] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 411.503093] RIP: 0033:0x7faee73b85a7 [ 411.503654] Code: Bad RIP value. Fixes: 0e18134f4f9f ("net/mlx5e: Eswitch, use state_lock to synchronize vlan change") Signed-off-by: Alaa Hleihel Reviewed-by: Roi Dayan Reviewed-by: Vlad Buslov Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 71d01143c4556..43005caff09e1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1887,8 +1887,6 @@ int __mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw, struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport); int err = 0; - if (!ESW_ALLOWED(esw)) - return -EPERM; if (IS_ERR(evport)) return PTR_ERR(evport); if (vlan > 4095 || qos > 7) @@ -1916,6 +1914,9 @@ int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw, u8 set_flags = 0; int err; + if (!ESW_ALLOWED(esw)) + return -EPERM; + if (vlan || qos) set_flags = SET_VLAN_STRIP | SET_VLAN_INSERT;