From patchwork Sat May 23 00:40:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 218660 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 289D0C433DF for ; Sat, 23 May 2020 00:41:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0094B20663 for ; Sat, 23 May 2020 00:41:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="MB0H05pC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387472AbgEWAlP (ORCPT ); Fri, 22 May 2020 20:41:15 -0400 Received: from mail-eopbgr70075.outbound.protection.outlook.com ([40.107.7.75]:1415 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387413AbgEWAlO (ORCPT ); Fri, 22 May 2020 20:41:14 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jJqiEDZ9E5kNCUZc2ksugZoxgmy429WlGeWHMklLge+IiNuz3Gqyr+Q7Bwv4BwTKYQ4r/iV+6b68nN0Um70bIjYzXEfwVIrE9Qi8xZIP+HI8InDLwAyR1lxWWC2afaHnmem5g8G+2AKKrBzTQ0xryXd9OQzmTSK72iSwVBhFZKWI+TCP8+YU6De2yzZmSXmIMdc4SqrGpqGeBj0rTNJDhspMHqBm2o6j/RKA/K1x6wjhytUAzoQKWJnybj9ScU6XMjP4a5eLWlSU6SfTHnOKSftjTPWIZn7GL2D80Dw1rnooFwGavBGE/j/yV/BoH9spov9TTS6irsq+C7ZXe/7qQg== 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=IwIUsbM+UtO69Xoyyw9GBTNFlJ7Q3t9gOyYHXh9fwAk=; b=f0Jh8JcBPgRzsypZy36DyB4rkwqEPHu2taFEGLUGOCFuOfobxTzlhrVey92pQVxBfh/CvbjBfSEiPamPgHzcfxetJKbnsEbmHsvsJXD6cmyGJVYdDvR+sPfR+I3O/NCBkCua1bx7hFKx0gXKRLLLFp1M6hQ6H4KPSy+/BhvUMLMjXPNoTKQi5t/vrKOuNyYTUGkSkoa4TTR8/yOOPYVNN1xXl7qvMOqgX5HoVpDMvvODMy/S5Jailyl2oz5s2TkwDg11b27c04V8KUZFvH3RbLWKQlFCDJ5+RHVYTXfbeZtHUn9qtT+F8SIcZK9TLideQJ+uR4WXbHmyaj/fJQHqbg== 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=IwIUsbM+UtO69Xoyyw9GBTNFlJ7Q3t9gOyYHXh9fwAk=; b=MB0H05pCC6KS3RdZXHdr67dKfZAi3GNHkLbCpyCyrdlRxVJ+gc3tvGM8HOEqSN8YVMGTDrd2lsJBuWp3I2KlOoq699PK05Y8voSsunvK+UTJEoyRqJruahya5/aJ+I7h6U4uv1tObAvy2Hm0wrtKQQXnGssBC7MHoivft4ucjao= 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 VI1PR05MB5391.eurprd05.prod.outlook.com (2603:10a6:803:95::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24; Sat, 23 May 2020 00:41:08 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::2405:4594:97a:13c]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::2405:4594:97a:13c%2]) with mapi id 15.20.3021.026; Sat, 23 May 2020 00:41:08 +0000 From: Saeed Mahameed To: "David S. Miller" , kuba@kernel.org Cc: netdev@vger.kernel.org, Moshe Shemesh , Eran Ben Elisha , Saeed Mahameed Subject: [net 01/13] net/mlx5: Add command entry handling completion Date: Fri, 22 May 2020 17:40:37 -0700 Message-Id: <20200523004049.34832-2-saeedm@mellanox.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200523004049.34832-1-saeedm@mellanox.com> References: <20200523004049.34832-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR08CA0042.namprd08.prod.outlook.com (2603:10b6:a03:117::19) 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 BYAPR08CA0042.namprd08.prod.outlook.com (2603:10b6:a03:117::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 00:41:06 +0000 X-Mailer: git-send-email 2.25.4 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 035ff3dd-245f-48ce-e6dc-08d7feb1fbd6 X-MS-TrafficTypeDiagnostic: VI1PR05MB5391: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:359; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NYrSuVr5QvEg3BmOr6dbxQoHuq9YdbfUU+hRUuT0gEGOy06xjTsssGUxj2IAbOOfOr62jSFNQCni6GmNPmOOkCTpuYTjKNDZ3VSjIjo/gvrSXKNH7rRNS10or/xhud4HCcTN1nHgkjC7mVNm+uOm50J5F8d+fCeG4znc2ZK9k9fAFzna29jzhCxLnkH65AZzLR9bQwtXv3ewwj6wjPxhM1WGK4csFV6mbpRALthDp3tlEdNn8yKZtIOAB2+hEH386uL8/HKDgoACkgzidku7+wNskIArnpvUJ2HKjpUNbelQBOg8ncrjAOOy0TL6kahWT89+D2OTmAly3QGCunB4BM0kXG555CuzRSDBiKcstwYPw7S/P2Pu7i+tREhjNbLx 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)(346002)(376002)(366004)(396003)(39860400002)(136003)(1076003)(8676002)(2616005)(956004)(4326008)(52116002)(186003)(26005)(16526019)(478600001)(6666004)(86362001)(6506007)(6512007)(107886003)(36756003)(316002)(5660300002)(8936002)(6486002)(66946007)(54906003)(66476007)(2906002)(66556008)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: N+zOTE9N7I7S4rbybcFCYPyH2eISI/lSr7qvEJiCJ7XSvAqRLC/PQoEz7WdzmNrpTr+Qdo0RcOhcqP1sMprs15JygtnPe9FasGlaCp7troB4uY3IWeWgCFp3mXseBseNN2PA9ydmQoN/2ospFmLnFlQziDfsN6HDY0F+LlpKVJOrBaYJfHE+5xvBOkPrKCeFsLBF+iqbGMpQ04qddS8p1UflXJHYWiFPTQNzdAZStHrEN1LVI2XaDvEKwMVg60hDpn0AoEV3Yme5oEui54VOGzoOo/z/uEpBOVAxXaXmUhg4t9b2ycFzusAoiO1sENTz2bG0USM6Ep1n5OicVcgVg4uaHYupLOAZPImgtH1fj0vzZ08JahMdZOaCK0NdM+sDJdlrbMEU6vP8CLwhIEDaPxVBHFupBVnFeEsxbTkubukV0PNPQ523TK7pJWiZcVWmlUpuxXy4Gdnqivy0yc0lUCDXrFp2TbNhlyt/eTEn1hc= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 035ff3dd-245f-48ce-e6dc-08d7feb1fbd6 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 00:41:08.5964 (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: PvvRvjHCEo2/hoLwDcEZ9Vt1D2lkkS8Nhf0bIYcCvNGKiUEoERxrHRF+yZZ1dQrKLaH5cjGhuuJu55x6B/0PZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5391 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Moshe Shemesh When FW response to commands is very slow and all command entries in use are waiting for completion we can have a race where commands can get timeout before they get out of the queue and handled. Timeout completion on uninitialized command will cause releasing command's buffers before accessing it for initialization and then we will get NULL pointer exception while trying access it. It may also cause releasing buffers of another command since we may have timeout completion before even allocating entry index for this command. Add entry handling completion to avoid this race. Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters") Signed-off-by: Moshe Shemesh Signed-off-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 14 ++++++++++++++ include/linux/mlx5/driver.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index cede5bdfd598..d695b75bc0af 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -861,6 +861,7 @@ static void cmd_work_handler(struct work_struct *work) int alloc_ret; int cmd_mode; + complete(&ent->handling); sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem; down(sem); if (!ent->page_queue) { @@ -978,6 +979,11 @@ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) struct mlx5_cmd *cmd = &dev->cmd; int err; + if (!wait_for_completion_timeout(&ent->handling, timeout) && + cancel_work_sync(&ent->work)) { + ent->ret = -ECANCELED; + goto out_err; + } if (cmd->mode == CMD_MODE_POLLING || ent->polling) { wait_for_completion(&ent->done); } else if (!wait_for_completion_timeout(&ent->done, timeout)) { @@ -985,12 +991,17 @@ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true); } +out_err: err = ent->ret; if (err == -ETIMEDOUT) { mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n", mlx5_command_str(msg_to_opcode(ent->in)), msg_to_opcode(ent->in)); + } else if (err == -ECANCELED) { + mlx5_core_warn(dev, "%s(0x%x) canceled on out of queue timeout.\n", + mlx5_command_str(msg_to_opcode(ent->in)), + msg_to_opcode(ent->in)); } mlx5_core_dbg(dev, "err %d, delivery status %s(%d)\n", err, deliv_status_to_str(ent->status), ent->status); @@ -1026,6 +1037,7 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, ent->token = token; ent->polling = force_polling; + init_completion(&ent->handling); if (!callback) init_completion(&ent->done); @@ -1045,6 +1057,8 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, err = wait_func(dev, ent); if (err == -ETIMEDOUT) goto out; + if (err == -ECANCELED) + goto out_free; ds = ent->ts2 - ent->ts1; op = MLX5_GET(mbox_in, in->first.data, opcode); diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 6f8f79ef829b..9b1f29f26c27 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h @@ -743,6 +743,7 @@ struct mlx5_cmd_work_ent { struct delayed_work cb_timeout_work; void *context; int idx; + struct completion handling; struct completion done; struct mlx5_cmd *cmd; struct work_struct work; From patchwork Sat May 23 00:40:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 218659 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC028C433E0 for ; Sat, 23 May 2020 00:41:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A039E20738 for ; Sat, 23 May 2020 00:41:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="fbak5FMS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387482AbgEWAlY (ORCPT ); Fri, 22 May 2020 20:41:24 -0400 Received: from mail-eopbgr70075.outbound.protection.outlook.com ([40.107.7.75]:1415 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387465AbgEWAlX (ORCPT ); Fri, 22 May 2020 20:41:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F/m4dsQXfYAHtciDqIPHB3/sF51kSqqFI8YHVRUc7jb0eAJoo5Cbxv0dSmAEB9wHQWxsbfWODiPsrsqqOHu/h0leDU7/jtjilugOWW5o5cQQ+Q7fXqNuhiNHuXVKEX3EKc7/XXixLIzvplzZrITPg6i4II9Ps3HiFRppRM8jn3dlrGaIawdBMWIWCBt7+M9y1sR8x8YqTQvzEPzRrevtCwOLV5yCfNnh/NsFuwOA6gw1D/ZhptLqsRAPFa/0gyjtig8HrFLEUepVj02VR1YmEYWhQ6IsDwv+96PsoquCgq3kYFxS3e1+S1ZPKfmwBCRjR14nM22sYHEY4esFBiHXGA== 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=JO2RtBPSUpQciy4VF2zBGLdOCSrMW1ZmdW7DKjt4YFw=; b=nWmQRSxU+vQjeo9Q8uJmNMers5eN8DzpOAvFhG+zWXYajbi+T9/hJJV7s6hx5H1BdRvsH5t1TOr5u5QfBlCiOkVozPSD3LG0LEeaoqyhyimwxYg5q4PMsr1+xYAuTtDWdKVt0wAU+o7A5zVmrFqsljKdzx19P+1yWjZHugLCtm4c9tIRV9HhoubbP/TjrW8ur2EWHZrwOPk04sjiryq9cCU5XIEPhm8wlnW8iF3f8kLB/i0D6u6uO+qjAuZ0+8JesQq4NxBVX9N3wtvpOgElw4zvn0gsOYfHZG8PCsAQky5Xj5bphy9aeE/HwTub0hTgxCiSAz0YjdLimYqDeZxNOA== 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=JO2RtBPSUpQciy4VF2zBGLdOCSrMW1ZmdW7DKjt4YFw=; b=fbak5FMSvINgNCp/jq0HV22ReLF2bRM/NtXH7zdUsO3aPHWSNTzcm+Iwgj6m8KiwMcaMY4Xxjhsdib8T5GZUWvgmW6b+fnErhDwsOihaWoPuYG0Tfc+mneUxdyDYvNfXSa03SB6kBBoooohwNbVoDRJyr8XpkRBxMJE4xUeguak= 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 VI1PR05MB5391.eurprd05.prod.outlook.com (2603:10a6:803:95::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24; Sat, 23 May 2020 00:41:13 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::2405:4594:97a:13c]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::2405:4594:97a:13c%2]) with mapi id 15.20.3021.026; Sat, 23 May 2020 00:41:13 +0000 From: Saeed Mahameed To: "David S. Miller" , kuba@kernel.org Cc: netdev@vger.kernel.org, Eran Ben Elisha , Moshe Shemesh , Saeed Mahameed Subject: [net 03/13] net/mlx5: Avoid processing commands before cmdif is ready Date: Fri, 22 May 2020 17:40:39 -0700 Message-Id: <20200523004049.34832-4-saeedm@mellanox.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200523004049.34832-1-saeedm@mellanox.com> References: <20200523004049.34832-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR08CA0042.namprd08.prod.outlook.com (2603:10b6:a03:117::19) 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 BYAPR08CA0042.namprd08.prod.outlook.com (2603:10b6:a03:117::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 00:41:11 +0000 X-Mailer: git-send-email 2.25.4 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1df9311f-b636-4057-3628-08d7feb1feaa X-MS-TrafficTypeDiagnostic: VI1PR05MB5391: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:337; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I/2QhBmgnVwzLzxgA9a9kPQUjWU9nlvDMc18LMSkqCHmc5vK3PA4Bsu6ZZCCjQzPV5hwNCQiEZ9QzqIcJSdAsVSpzH4AU6h9ArSzTyE4YJiAxoSmf0ewojJhP5ycB6SPK0bVRh+SaZueq+6iJbFXYTz4Lmjr3tntFFP2jdhh4O1Zpy+0o0D649jOzifh/C9PExYtUx9Rl2ww1diNRO9hNitaLUB2IPEjLoCKZ6RRikCpDKfW+Th848ufjEUu/zI6DwPjEgpZZE5yJf+WLoDmtXY7ImvZvOYi1LTXQLDDdu5EYyBWEIyHNqMwbMdkzOh1nvmEh8tnI0f6MhMRn8/BFX6TB9CWaPmeu8WtkqynQPX0KmZh1jqvEoajHjvrqbne 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)(346002)(376002)(366004)(396003)(39860400002)(136003)(1076003)(8676002)(2616005)(956004)(4326008)(52116002)(186003)(26005)(16526019)(478600001)(6666004)(86362001)(6506007)(6512007)(107886003)(36756003)(316002)(5660300002)(8936002)(6486002)(66946007)(54906003)(66476007)(2906002)(66556008)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hOuGB9nADQDGCpBzahH7Ws9bCP4O/3c39sto/YokMtzVHBCDLhVj9iiRg3Tqxxw3Ymwmr2QxAH2G//k87+bL/DCY8dOekzQcJ2yG+PgJWCSmO4m5nfxLX9ALxlySATrIjldMaLJknlCvd5GpILCwlVg3xZxhJ4sTlWHr3tnHazJVvnp7MO8FC9t/+DMihaO7TkIXEGgKWbKsu/jRqxyfKjwh48KiiteBqc251cB6AIzqybxK+kEijkYVFnaHtQisM23oUmqDzHkSj+7bofsdwJI+pbTVrt2cQc4XKfCtvbrQxYpuqhkTVs63CpR9dyAR6uCFtzeLyMNUFPqsUXEUWk37og3qzlbVD8Tfr1GPFoM2++YpcooqUknZxd7A7HEz0gIU7t4zZx4e00bDFFhMz4x9vJz2zgU4A/zLyUtTBA0B3SyYZ1Mw2tnRSvTyT+iOYdQKQxaBwR7G4CdZMiMypSKPL3UUwtrR5p7/o+9IzSg= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1df9311f-b636-4057-3628-08d7feb1feaa X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 00:41:13.4037 (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: e5aQDusUqT1hVoNKKU7FiI+LTsEvHS/DjaFd8Bv2puPUFvw8F2p+EITPuq2p8SnNcT+lAqMzCM/gpWGZC4B9AQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5391 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eran Ben Elisha When driver is reloading during recovery flow, it can't get new commands till command interface is up again. Otherwise we may get to null pointer trying to access non initialized command structures. Add cmdif state to avoid processing commands while cmdif is not ready. Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters") Signed-off-by: Eran Ben Elisha Signed-off-by: Moshe Shemesh Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 10 ++++++++++ drivers/net/ethernet/mellanox/mlx5/core/main.c | 4 ++++ include/linux/mlx5/driver.h | 9 +++++++++ 3 files changed, 23 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index 2f3cafdc3b1f..7a77fe40af3a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -923,6 +923,7 @@ static void cmd_work_handler(struct work_struct *work) /* Skip sending command to fw if internal error */ if (pci_channel_offline(dev->pdev) || dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR || + cmd->state != MLX5_CMDIF_STATE_UP || !opcode_allowed(&dev->cmd, ent->op)) { u8 status = 0; u32 drv_synd; @@ -1712,6 +1713,7 @@ static int cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out, opcode = MLX5_GET(mbox_in, in, opcode); if (pci_channel_offline(dev->pdev) || dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR || + dev->cmd.state != MLX5_CMDIF_STATE_UP || !opcode_allowed(&dev->cmd, opcode)) { err = mlx5_internal_err_ret_value(dev, opcode, &drv_synd, &status); MLX5_SET(mbox_out, out, status, status); @@ -1977,6 +1979,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) goto err_free_page; } + cmd->state = MLX5_CMDIF_STATE_DOWN; cmd->checksum_disabled = 1; cmd->max_reg_cmds = (1 << cmd->log_sz) - 1; cmd->bitmask = (1UL << cmd->max_reg_cmds) - 1; @@ -2054,3 +2057,10 @@ void mlx5_cmd_cleanup(struct mlx5_core_dev *dev) dma_pool_destroy(cmd->pool); } EXPORT_SYMBOL(mlx5_cmd_cleanup); + +void mlx5_cmd_set_state(struct mlx5_core_dev *dev, + enum mlx5_cmdif_state cmdif_state) +{ + dev->cmd.state = cmdif_state; +} +EXPORT_SYMBOL(mlx5_cmd_set_state); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 7af4210c1b96..a61e473db7e1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -965,6 +965,8 @@ static int mlx5_function_setup(struct mlx5_core_dev *dev, bool boot) goto err_cmd_cleanup; } + mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_UP); + err = mlx5_core_enable_hca(dev, 0); if (err) { mlx5_core_err(dev, "enable hca failed\n"); @@ -1026,6 +1028,7 @@ static int mlx5_function_setup(struct mlx5_core_dev *dev, bool boot) err_disable_hca: mlx5_core_disable_hca(dev, 0); err_cmd_cleanup: + mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_DOWN); mlx5_cmd_cleanup(dev); return err; @@ -1043,6 +1046,7 @@ static int mlx5_function_teardown(struct mlx5_core_dev *dev, bool boot) } mlx5_reclaim_startup_pages(dev); mlx5_core_disable_hca(dev, 0); + mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_DOWN); mlx5_cmd_cleanup(dev); return 0; diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index c03778c75dfa..8397b6558dc7 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h @@ -213,6 +213,12 @@ enum mlx5_port_status { MLX5_PORT_DOWN = 2, }; +enum mlx5_cmdif_state { + MLX5_CMDIF_STATE_UNINITIALIZED, + MLX5_CMDIF_STATE_UP, + MLX5_CMDIF_STATE_DOWN, +}; + struct mlx5_cmd_first { __be32 data[4]; }; @@ -258,6 +264,7 @@ struct mlx5_cmd_stats { struct mlx5_cmd { struct mlx5_nb nb; + enum mlx5_cmdif_state state; void *cmd_alloc_buf; dma_addr_t alloc_dma; int alloc_size; @@ -882,6 +889,8 @@ enum { int mlx5_cmd_init(struct mlx5_core_dev *dev); void mlx5_cmd_cleanup(struct mlx5_core_dev *dev); +void mlx5_cmd_set_state(struct mlx5_core_dev *dev, + enum mlx5_cmdif_state cmdif_state); void mlx5_cmd_use_events(struct mlx5_core_dev *dev); void mlx5_cmd_use_polling(struct mlx5_core_dev *dev); void mlx5_cmd_allowed_opcode(struct mlx5_core_dev *dev, u16 opcode); From patchwork Sat May 23 00:40:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 218658 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 621C3C433DF for ; Sat, 23 May 2020 00:41:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 393D820663 for ; Sat, 23 May 2020 00:41:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="eKtjRd/G" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387493AbgEWAlb (ORCPT ); Fri, 22 May 2020 20:41:31 -0400 Received: from mail-eopbgr70075.outbound.protection.outlook.com ([40.107.7.75]:1415 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387484AbgEWAla (ORCPT ); Fri, 22 May 2020 20:41:30 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n0nzwuSgP/3Y4yHpkiS8ilKrz1CjEGzvpfS4B8BML1Pfe23Yngn0tXU4FIaY/sKj3KiXTfCM7aBGDnMFebD7y3Pl67kszA0F2VuffcrSxtFfwUJyBpE9zYksS2Ctqf4SVsE62Jry+FQTk0nBFJvbaRnpvwCF58d07j9KHFwf1ffwPPxztHsLuTFwARq8Tg1nc/qADB4Rejlldi8bVXpzMMYdU0E+7SJIGL0TaYqkUXBS+t+Vrx9QnyIdi/69YcXgcMfrYfnc9LtJEb0CWTFipFPJfdX73yCLcaxz2meDyNeMOsrzoEs17Oq+4mYfcA2H8UomwbIunUNB2/rJE65o4Q== 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=AXSUdohoApKl2kx2/Wmz0//oLVkqZuDgXhLcuRJvKdY=; b=IO7GizsGqlpHJ5ordDtd8a7iuQMNwOv92dQLQ9j2H/oaWc3elQMBFvXHfCeBdTHp5BHV1sKffZa0fk1cB94MQkyxv/WYmGayFK+dLxc1an76KhvkYyyuSbh2BLfF08P87VMecocHjNs6+l9cd8YRqsTlutdFJZsguMVTtqWvOwu3i8gQLzMe62FIJ8Xaq/B3aYD8vQPVXfrYCL+PI/pOCgITV/zW6LwdQhg/eJFhu07Gjxgf7xnNYZQp/H9iFzrL2v0ZVP87BFETuiXnSk/uSokYeQs/ZtxeMArUot/8IdbPviY1cOe/u+0pMEKUPvmelpqK1sWFD/jCRnmp4GIoww== 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=AXSUdohoApKl2kx2/Wmz0//oLVkqZuDgXhLcuRJvKdY=; b=eKtjRd/G8jN6quYbOPY7+LOGPpO7iNDZvvAmAsgNXqE45mbn1gJc/vghs3rwAPITqnqOjhgSfalxX9YdvzM8dfSXdRuZbQuGCC6JCBu1YY+hz7IY46Sc2ei/6UdyltXo05Mo/qZumLWaZd+q2ICpBVjD05mJE1JWntNbpCPMxbs= 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 VI1PR05MB5391.eurprd05.prod.outlook.com (2603:10a6:803:95::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24; Sat, 23 May 2020 00:41:18 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::2405:4594:97a:13c]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::2405:4594:97a:13c%2]) with mapi id 15.20.3021.026; Sat, 23 May 2020 00:41:17 +0000 From: Saeed Mahameed To: "David S. Miller" , kuba@kernel.org Cc: netdev@vger.kernel.org, Tariq Toukan , Boris Pismenny , Saeed Mahameed Subject: [net 05/13] net/mlx5e: kTLS, Destroy key object after destroying the TIS Date: Fri, 22 May 2020 17:40:41 -0700 Message-Id: <20200523004049.34832-6-saeedm@mellanox.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200523004049.34832-1-saeedm@mellanox.com> References: <20200523004049.34832-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR08CA0042.namprd08.prod.outlook.com (2603:10b6:a03:117::19) 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 BYAPR08CA0042.namprd08.prod.outlook.com (2603:10b6:a03:117::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 00:41:16 +0000 X-Mailer: git-send-email 2.25.4 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9d4e70ff-9118-4271-6b33-08d7feb20143 X-MS-TrafficTypeDiagnostic: VI1PR05MB5391: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:86; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4z4LhdX4TC3kdC/gpRpkS4hhxRXBsCN319egISOO+uqDDdwc6T5zfN1NYgK8vX140J83TrvqkvDkFxMoBEreeXlQ5cD5hWkdJrq5O9OYMfi2GWGYDQ+u4JQMFA26VkkrZCmzVH815zr4MIfmjkAlRys14v4pBCJkmXyx1b8TAOBLrIgJijxl0GSKzXcQcUbUd7wakKr7RFGuC19k0TT8u7OXmiZZytZsvNBUNVIS7xaCaVzuuKZpWHkusE9yqxe4TsG3i6afUciYkgeC61fDKz6hxuJoTDi+U9mQtZgzTfkAQjA4g6RcyFsWiMFaBixX1QMDC15AMt6+u74bC8IVnSN5PlJ6OwMV68laKue/JJ/RvivBUQaxUBlgjOuGd+GT 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)(346002)(376002)(366004)(396003)(39860400002)(136003)(1076003)(8676002)(2616005)(956004)(4326008)(52116002)(186003)(26005)(16526019)(478600001)(6666004)(86362001)(6506007)(6512007)(107886003)(36756003)(316002)(5660300002)(8936002)(6486002)(66946007)(54906003)(66476007)(2906002)(66556008)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: uog7olrfe9VYfmFsm59rQ+wgrcHy0eIq2oFxErsYjfNSJ4udryz/tALaShcGw1BkxrkmOLpz7HoOQGELyjuwkQTh4m9bdD47iLohu2KeVytKAkPpmKYRDAJVKijdW2Ek8rjOV7nlrlsNo1QmljAPk3sn8ZS0fqNeKZ5M5ttdGWKvxHqjlHGRyBr2qfS59qt3byCzyuEYMyB8D0i0tGfjsQqHnMQI26zgjZZaAVbaIkA7t3LpHStJkhynH0nUVh5Cp1dU5wxoTjrNHXtg0T0I14clyBckaS3+nCrzDm5+9AEMyE7ltWr1cUJ5MnSlEpD2lflXV6erGpvdmeUjaHL6bavhQSEmj5Nh/iaoJAOhDEBe9P/AV1vMutZQIGRDAdx1AKw6i91/liWFwlFmyf9n+qZ7LVNREM7Z/P3wZ7cyZra08WNluszpX5BdkuKNEMj1Qvp1n+SKvsvoyY96DzO+a11y1SA+JS3z2Xq7ye44fAU= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d4e70ff-9118-4271-6b33-08d7feb20143 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 00:41:17.8891 (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: azv/8ff5MDyKXx3+pYrYSQ8tDNxMLIT3g+TnmK7vhOvJ/WRiPIM3lBKixO8BCNBKj0Cc45JE5GFGRP/4+OsX7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5391 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Tariq Toukan The TLS TIS object contains the dek/key ID. By destroying the key first, the TIS would contain an invalid non-existing key ID. Reverse the destroy order, this also acheives the desired assymetry between the destroy and the create flows. Fixes: d2ead1f360e8 ("net/mlx5e: Add kTLS TX HW offload support") Signed-off-by: Tariq Toukan Reviewed-by: Boris Pismenny Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c index 46725cd743a3..7d1985fa0d4f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c @@ -69,8 +69,8 @@ static void mlx5e_ktls_del(struct net_device *netdev, struct mlx5e_ktls_offload_context_tx *tx_priv = mlx5e_get_ktls_tx_priv_ctx(tls_ctx); - mlx5_ktls_destroy_key(priv->mdev, tx_priv->key_id); mlx5e_destroy_tis(priv->mdev, tx_priv->tisn); + mlx5_ktls_destroy_key(priv->mdev, tx_priv->key_id); kvfree(tx_priv); } From patchwork Sat May 23 00:40:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 218654 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0199EC433E0 for ; Sat, 23 May 2020 00:44:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF2C320663 for ; Sat, 23 May 2020 00:44:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="UZ3YX9WY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731231AbgEWAoJ (ORCPT ); Fri, 22 May 2020 20:44:09 -0400 Received: from mail-eopbgr70075.outbound.protection.outlook.com ([40.107.7.75]:1415 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387489AbgEWAoJ (ORCPT ); Fri, 22 May 2020 20:44:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QLx7WMT86W0+UaEYcQUr0QYRxVIloeigu9a8yjaXt2ncMx0//qp+BNEkZWTV6LILuo6yxicyVo6CMbLTLzzqonXkIc/Yj6aksMm23MPlxzjz1NTfnVhj0siZJJ9he8owlfndHgj6qT0TkCQ2SyoLWUT3BbeKWuB/pzg4oufdx8tiabnWM3dqj7hG/+LlK49ePpVsUHGXpzLaP8wEOL/agO43gTN8OpjOqd1Z9rhRc4IMiskJfPAwzytO25w2yP3sChyzOJD9AxW5DALIrB5H8oqKAiqFtZcH6dFzODX6Tvld5pKZkqQoMD68SSHOIwy7PUAZeZiYElNfulCAWhdgKg== 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=oz6IXNQVTcqzXnhTpzSD99Yd2zaIQVtHPxCmJQPedxg=; b=Kql+qiK2Qk77tVgSE4+t6YRjkCZV4zpNEz0j9krA3niMTaKQCBZDoyiBvZhM4wLi9v/3rLH7w/f9vus970KaEjeA+n6w27r5J/VXLKRqYdh1XBkeCeTJMM4ja8k3FmqjI7TuoNCBFN503IwzLmiKaKhJAfMkYM3At5Gl9Vm4QQWl+E+x61PwLPxKCbAeiXPw/qfcu0HseSuyNaGAfnDaZq+qZu8qD+h5eHI+lN7pRu75x86xpj3WF4I61PMzmH1V3jNwqSRZ0diAmQHR1va78qqU6e5QCloZLYirh+E3RLaW3lhQX/HhI580pH140paJXwQcA4I7BafTbDmeTPMnFQ== 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=oz6IXNQVTcqzXnhTpzSD99Yd2zaIQVtHPxCmJQPedxg=; b=UZ3YX9WYD8Bgegx04+OCe8yrI/AVibgzbazkNDG8Whk6kMVvm0FFkOv0GeTXWdt3qqTrrPYrRgokgjUMlym6oZRFXjkFERJsI+aFTbmB+YJkcHLRhJF5jQyE5KrCdodUZRxUffped4DMehO66knDm4eiJzvp/vjFC19jgpFLkCQ= 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 VI1PR05MB5391.eurprd05.prod.outlook.com (2603:10a6:803:95::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24; Sat, 23 May 2020 00:41:24 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::2405:4594:97a:13c]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::2405:4594:97a:13c%2]) with mapi id 15.20.3021.026; Sat, 23 May 2020 00:41:24 +0000 From: Saeed Mahameed To: "David S. Miller" , kuba@kernel.org Cc: netdev@vger.kernel.org, Roi Dayan , Vlad Buslov , Saeed Mahameed Subject: [net 06/13] net/mlx5e: Fix inner tirs handling Date: Fri, 22 May 2020 17:40:42 -0700 Message-Id: <20200523004049.34832-7-saeedm@mellanox.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200523004049.34832-1-saeedm@mellanox.com> References: <20200523004049.34832-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR08CA0042.namprd08.prod.outlook.com (2603:10b6:a03:117::19) 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 BYAPR08CA0042.namprd08.prod.outlook.com (2603:10b6:a03:117::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 00:41:18 +0000 X-Mailer: git-send-email 2.25.4 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d57b2083-1d81-42b4-15c1-08d7feb202a3 X-MS-TrafficTypeDiagnostic: VI1PR05MB5391: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:172; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4uIrpLxjZMu4ZvcewA3ERl27XbBHeczoO9dg9OuUN/94J45w03+Tj/EojgpAlY2iamkzP4jg4cpArnW5pBrGsGlXGiQyIx7QcDKT3pLhWLAWNmpk2324sTU1V33I7+Jeb6U3IH6tp2VhCUtWNczJAFY6ib9XYeirvgWziQe01bSb3wHPa2nj/QYpSeYxQKcuK0snBeYJBZ/a6YELG9137YFwn/XR4g5gXk4L8m5PqzvVG2yerdjxHar2svR5zxUAjrTS3XWSdNfECLufsRcYI0+maOrmHgcKbfNrg4AsRK9rMWiQHuu0yqVDD9ezGFgGqJ0b7Zr4U9i8a0A+CiQvFDZoJS2Ygdp9YnIcz19ng0S7slb6g2McD4AQ2L/ahMnT 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)(346002)(376002)(366004)(396003)(39860400002)(136003)(1076003)(8676002)(2616005)(956004)(4326008)(52116002)(186003)(26005)(16526019)(478600001)(6666004)(86362001)(6506007)(6512007)(107886003)(36756003)(316002)(5660300002)(8936002)(6486002)(66946007)(54906003)(66476007)(2906002)(66556008)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ttc2FubxIP/fWwtK0ZVzkeUvM8Kp+k6XkkhmhFU0ccisaGvm0t2Rvwvzhrboyaqg/eUsU3iledP/f9cSBZIaoutKh5Y41X9SzDkQuEV5IdTXAmnzuIXgvxCbSS5NVOhcZzTE8pGFO1Fws8yFcschzZz8ETL9SwXf/tr3DiXcFzaVm+kiq+lGpp0Tg14K1crLQcRd//HNldJK8+l/5aEtvOeF8zKmiGAqkxGSoFTyloEXJZEiRVeoKE2q/OCTeaf1YbniGQr3FzgtR56v39NkojdhTRhBRA6vkgNptbSs9hUuDVKBmf/zWVrl34MiWyWA5ek7XIv/56FgeekJB/XhKGr6eyshoO+ojystyq51raycao0d3Df6W4BvUCgx7VzsC5nPqjKMdcg79cdF8OFYhsHElFY0/5dPOy07c46ZOkyQaNM2FemHh6PwV2OysA47EHRZpV2EpKyihLqH16uao6eMqCKskTY0FFizJsb7cAg= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d57b2083-1d81-42b4-15c1-08d7feb202a3 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 00:41:20.1098 (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: W/9CqqNNZeRSoL3wuJDw8AjbHqpw65pI/GH5qePq+Qqle4tLbQC1l6G8fP7C2Jp96gykyfuESPrhichfO5QWHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5391 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Roi Dayan In the cited commit inner_tirs argument was added to create and destroy inner tirs, and no indication was added to mlx5e_modify_tirs_hash() function. In order to have a consistent handling, use inner_indir_tir[0].tirn in tirs destroy/modify function as an indication to whether inner tirs are created. Inner tirs are not created for representors and before this commit, a call to mlx5e_modify_tirs_hash() was sending HW commands to modify non-existent inner tirs. Fixes: 46dc933cee82 ("net/mlx5e: Provide explicit directive if to create inner indirect tirs") Signed-off-by: Roi Dayan Reviewed-by: Vlad Buslov Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 12 +++++++----- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 4 ++-- .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 23701c0e36ec..59745402747b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -1121,7 +1121,7 @@ void mlx5e_close_drop_rq(struct mlx5e_rq *drop_rq); int mlx5e_create_indirect_rqt(struct mlx5e_priv *priv); int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc); -void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc); +void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv); int mlx5e_create_direct_rqts(struct mlx5e_priv *priv, struct mlx5e_tir *tirs); void mlx5e_destroy_direct_rqts(struct mlx5e_priv *priv, struct mlx5e_tir *tirs); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index b314adf438da..c6b83042d431 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -2717,7 +2717,8 @@ void mlx5e_modify_tirs_hash(struct mlx5e_priv *priv, void *in, int inlen) mlx5_core_modify_tir(mdev, priv->indir_tir[tt].tirn, in, inlen); } - if (!mlx5e_tunnel_inner_ft_supported(priv->mdev)) + /* Verify inner tirs resources allocated */ + if (!priv->inner_indir_tir[0].tirn) return; for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) { @@ -3408,14 +3409,15 @@ int mlx5e_create_direct_tirs(struct mlx5e_priv *priv, struct mlx5e_tir *tirs) return err; } -void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc) +void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv) { int i; for (i = 0; i < MLX5E_NUM_INDIR_TIRS; i++) mlx5e_destroy_tir(priv->mdev, &priv->indir_tir[i]); - if (!inner_ttc || !mlx5e_tunnel_inner_ft_supported(priv->mdev)) + /* Verify inner tirs resources allocated */ + if (!priv->inner_indir_tir[0].tirn) return; for (i = 0; i < MLX5E_NUM_INDIR_TIRS; i++) @@ -5123,7 +5125,7 @@ static int mlx5e_init_nic_rx(struct mlx5e_priv *priv) err_destroy_direct_tirs: mlx5e_destroy_direct_tirs(priv, priv->direct_tir); err_destroy_indirect_tirs: - mlx5e_destroy_indirect_tirs(priv, true); + mlx5e_destroy_indirect_tirs(priv); err_destroy_direct_rqts: mlx5e_destroy_direct_rqts(priv, priv->direct_tir); err_destroy_indirect_rqts: @@ -5142,7 +5144,7 @@ static void mlx5e_cleanup_nic_rx(struct mlx5e_priv *priv) mlx5e_destroy_direct_tirs(priv, priv->xsk_tir); mlx5e_destroy_direct_rqts(priv, priv->xsk_tir); mlx5e_destroy_direct_tirs(priv, priv->direct_tir); - mlx5e_destroy_indirect_tirs(priv, true); + mlx5e_destroy_indirect_tirs(priv); mlx5e_destroy_direct_rqts(priv, priv->direct_tir); mlx5e_destroy_rqt(priv, &priv->indir_rqt); mlx5e_close_drop_rq(&priv->drop_rq); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index cdecf4280e86..4a8e0dfdc5f2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -1743,7 +1743,7 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv) err_destroy_direct_tirs: mlx5e_destroy_direct_tirs(priv, priv->direct_tir); err_destroy_indirect_tirs: - mlx5e_destroy_indirect_tirs(priv, false); + mlx5e_destroy_indirect_tirs(priv); err_destroy_direct_rqts: mlx5e_destroy_direct_rqts(priv, priv->direct_tir); err_destroy_indirect_rqts: @@ -1761,7 +1761,7 @@ static void mlx5e_cleanup_rep_rx(struct mlx5e_priv *priv) mlx5e_destroy_rep_root_ft(priv); mlx5e_destroy_ttc_table(priv, &priv->fs.ttc); mlx5e_destroy_direct_tirs(priv, priv->direct_tir); - mlx5e_destroy_indirect_tirs(priv, false); + mlx5e_destroy_indirect_tirs(priv); mlx5e_destroy_direct_rqts(priv, priv->direct_tir); mlx5e_destroy_rqt(priv, &priv->indir_rqt); mlx5e_close_drop_rq(&priv->drop_rq); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c index 673aaa815f57..505cf6eeae25 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c @@ -396,7 +396,7 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv) err_destroy_direct_tirs: mlx5e_destroy_direct_tirs(priv, priv->direct_tir); err_destroy_indirect_tirs: - mlx5e_destroy_indirect_tirs(priv, true); + mlx5e_destroy_indirect_tirs(priv); err_destroy_direct_rqts: mlx5e_destroy_direct_rqts(priv, priv->direct_tir); err_destroy_indirect_rqts: @@ -412,7 +412,7 @@ static void mlx5i_cleanup_rx(struct mlx5e_priv *priv) { mlx5i_destroy_flow_steering(priv); mlx5e_destroy_direct_tirs(priv, priv->direct_tir); - mlx5e_destroy_indirect_tirs(priv, true); + mlx5e_destroy_indirect_tirs(priv); mlx5e_destroy_direct_rqts(priv, priv->direct_tir); mlx5e_destroy_rqt(priv, &priv->indir_rqt); mlx5e_close_drop_rq(&priv->drop_rq); From patchwork Sat May 23 00:40:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 218657 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B1C0C433E0 for ; Sat, 23 May 2020 00:41:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 275D120663 for ; Sat, 23 May 2020 00:41:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="ggKOAaZI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387503AbgEWAlm (ORCPT ); Fri, 22 May 2020 20:41:42 -0400 Received: from mail-eopbgr40071.outbound.protection.outlook.com ([40.107.4.71]:51206 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387463AbgEWAll (ORCPT ); Fri, 22 May 2020 20:41:41 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nD75zP6cMynHL6YlSsLMYqVWeGwFgz42DsarLL8uXYL0a1D85MDWLoaOL9vW1WxChm+NSJWO6oXYW7ZAYtbJ4d5ywt/DH+PI6I58/xfrplytjeE8MYKpKQQw55BVMQZ0AM9C6dlBqNQK9ScVYE7lZEfVqZTYYLpRX+tyxKD8hxHY58p58b3ZDO/ivM7R3AajDyaBqiz8K4h9674I1l/YOwNoeIsT6hXc/RKGy+PD2670RxpmVxWV9BuI0PiaWXt1rUB1gyt5z5kqYpJhCvDZlrXfRAk2tqu0Q2i999VUBda4UpFzIY2SgIQdgWdVhTTI9EB8WAknNXaJqpHLgqRrCg== 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=d2sa5VWp+IfretuqkGR3hatVbGu6VFNtas5GnKvZdmQ=; b=CVvogx5yZdC01/TXaeL0fiN7u09JAFERd0oRhB/NlYKyyLvFhabrRoheca8GW13UvSeD5XT6CsLhg+CoXdbapd0Z5rzYWUIN36YcnXRFtABWiCKfkh7W+7Vx+hnscZ35djERR0sY6Ir+i1oz4jsx5VUpEA7EkS9Ti1WGLTTEQKFB53KaBgREqHJb0hQRQg6aOv5+8tIUPD5j1WhqgAFAGm5K1ACPkvyBWZje5BQw+wMLfMDorVkLaDHV2x3KL2Lp5imejslD8YMJ98bOAs3bN2nqXIbzGsgRwlHCAbVLTCkm6tqMUxeu5KgFZyaaM+1/0n76d1aQ+3HHd65qqD7vXg== 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=d2sa5VWp+IfretuqkGR3hatVbGu6VFNtas5GnKvZdmQ=; b=ggKOAaZIj/Y6XBJDLQz6z56OHoAtPPWh2G8fznWdlsW6cvT7CohLyhE1CxIdHyeaNpT7iyptvOe52k8r2L+1BwLJ5C352oLGcEb+ZwQDrdimE4106SCa0py+2CrbwAnDAT8EUll/oTB6auJ12hBKHdmYEF43U1jHf0MGECnAfPA= 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 VI1PR05MB5391.eurprd05.prod.outlook.com (2603:10a6:803:95::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24; Sat, 23 May 2020 00:41:25 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::2405:4594:97a:13c]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::2405:4594:97a:13c%2]) with mapi id 15.20.3021.026; Sat, 23 May 2020 00:41:25 +0000 From: Saeed Mahameed To: "David S. Miller" , kuba@kernel.org Cc: netdev@vger.kernel.org, Moshe Shemesh , Tariq Toukan , Saeed Mahameed Subject: [net 07/13] net/mlx5: Fix memory leak in mlx5_events_init Date: Fri, 22 May 2020 17:40:43 -0700 Message-Id: <20200523004049.34832-8-saeedm@mellanox.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200523004049.34832-1-saeedm@mellanox.com> References: <20200523004049.34832-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR08CA0042.namprd08.prod.outlook.com (2603:10b6:a03:117::19) 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 BYAPR08CA0042.namprd08.prod.outlook.com (2603:10b6:a03:117::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 00:41:24 +0000 X-Mailer: git-send-email 2.25.4 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6529b7e0-bfc6-4d1f-d9a7-08d7feb205f9 X-MS-TrafficTypeDiagnostic: VI1PR05MB5391: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CYm5F4tXh5APUSqGY85QjTKK1sT/6ueOczNMaTz62F0jJOq0pidYwykeBCyKh4erkew6KSOzxywqHILsMbxzoh/2h4HbXgrpnC3WinP+BDNNraJibi+87ZZeO6xDWNra5AR5BKJWoW4CILLH3hHSvmZI8Kuxk8i+JMTlEw7P3wA8MyCXmMU1ApPF0pDCP9ifVSyVuI5WxEEXgTxDHNHoHwfXBJea/xt+t2gZ7+aKOgtTkji3k/yotJNVdPI+UHLt/yD7Kb+DwbvioU0TAKlqU1OEC270b3s745r6CIaBM6cn0WGWJZJPfDnpP6zTmokhI6XlZlMvCyq24GHkRLvolD6Tul0BEKRS+LyZ3WKUM9DkYEUSpFogPkqmAX74fV+l 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)(346002)(376002)(366004)(396003)(39860400002)(136003)(1076003)(8676002)(2616005)(956004)(4326008)(52116002)(186003)(26005)(16526019)(478600001)(6666004)(86362001)(6506007)(6512007)(107886003)(36756003)(316002)(5660300002)(8936002)(6486002)(66946007)(54906003)(66476007)(2906002)(66556008)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 7KMVKOptzMRXDrMewbpSnJgAEFrrQtsUccPHRMDHXZ2BeUBlgFr8hxCiYGqp+NSep1MZ/7vNX0Zj7oUJcufxKE0ow7ICkterg520+++RnDTRkvIUm72d8Qrnc0OYEoookGybYDNMwt2F/C6vs6YBzI6MURWA6QSLzwpntZ3DjYFtoiZdKoomJXEVuQWBUR8IZiATlvE3TdJEhFp6wVi94kjFc0SW1kVjhMcSMGQ5SOH/Zu66a0we8sGU22DyjB3nAgxkZ4jjTqpTauFh9RapEuJFbg10qnYQwfr2RH13BzwnPpTbDwKzx0HvAhK0uzxtTuY+CLZXsGUTVwWxZLIDZom7AM46bec8jS7mYGgUDO/S8PRmDjGL4mNF0XkGe1w6JfSg0Lo2PNYAVqhWoa0+QpaDINfAz+N7mVUyQf8gDVX+UM95kz/IIEnsAqqP/30hBHQf+sBvyzkq1VKEWZwCv7TkrseLvFEzO9hkpd18DFw= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6529b7e0-bfc6-4d1f-d9a7-08d7feb205f9 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 00:41:25.8176 (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: xFjSOMFqr6bA8DfbHedi6sqBBJu6Bz0llHhfoAY6jksykq5iM3XPked0Rnl9pLEsfpn/if0wKl5Sc0YL6g4CUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5391 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Moshe Shemesh Fix memory leak in mlx5_events_init(), in case create_single_thread_workqueue() fails, events struct should be freed. Fixes: 5d3c537f9070 ("net/mlx5: Handle event of power detection in the PCIE slot") Signed-off-by: Moshe Shemesh Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/events.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/events.c b/drivers/net/ethernet/mellanox/mlx5/core/events.c index 8bcf3426b9c6..3ce17c3d7a00 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/events.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/events.c @@ -346,8 +346,10 @@ int mlx5_events_init(struct mlx5_core_dev *dev) events->dev = dev; dev->priv.events = events; events->wq = create_singlethread_workqueue("mlx5_events"); - if (!events->wq) + if (!events->wq) { + kfree(events); return -ENOMEM; + } INIT_WORK(&events->pcie_core_work, mlx5_pcie_event); return 0; From patchwork Sat May 23 00:40:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 218656 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47D58C433DF for ; Sat, 23 May 2020 00:41:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 244D720738 for ; Sat, 23 May 2020 00:41:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="WxGZKUNw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387514AbgEWAlr (ORCPT ); Fri, 22 May 2020 20:41:47 -0400 Received: from mail-eopbgr40071.outbound.protection.outlook.com ([40.107.4.71]:51206 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387463AbgEWAlp (ORCPT ); Fri, 22 May 2020 20:41:45 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N3Cdchn37qucmm3lWaOWb2szD1NHSOko6zeoyY5O67R96weNf95mAxs+X7UiR021S82EuaRLiJGZ6q0DVHq+ClZ+SsGdWXbnImIeKV5cpYmimA0r+QKm6N2YIPz0Ylmoyd1hvqy6w0Mo/UyXu+vvuogdBKDeCtbHz+9hyLmDZk3fXaJemh8mj9ZB9NjtmALrcwtu9MCtVgARNVPNfm6G3Aj0dtZ2a8b9l6NV1IESxEnU64uiOKs+m9tSUO9B8FXp7CxGQ3uuqr8Df1ASCndasyjNi71/I5gSilNKrGzckbltF8rohUduklzud3UpIpe+4Jp2opXxSB+N/JhQVL5+lQ== 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=PbSR8cb6jxFav1CDMrqHEhPBV3UHiqomq/BGF2oDGMI=; b=WJC0z6DUDq2zr07mvNi8pXWXcsK8O4GUTXp7MmktAqjrePKDSdDG+7eqdGCe2FnGp3ITW9MIUTB2sOPl2JWMVMOr1LLfzq5GmlQuPGZPULiiql4dIzT4bghmcza8aZBxR+DfmOKYctl9YgA5VPHCgBIU9KhsZiuVjCJhuGX0mx9XeE68Kc7zqt7E2rxFnZXmD6R/quXk2R2l5ZDkDsDkn7eUo+8V4u3CdBp92YDrF5QEddqZ2rnh397D1h5XDyZk79xyeOPo9YcxAWsZjdVI+mt2xcasM06wjZoJWnfQ6+fd4OeSf18TSBRnpN6ZvI9egVIi5I+AkN9oWPm6yB8ylQ== 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=PbSR8cb6jxFav1CDMrqHEhPBV3UHiqomq/BGF2oDGMI=; b=WxGZKUNwLxfAmUJd2XNoYVbRyMyjApD/azEqncdQEvdUDTuapaUwuKIpWvo7zduDwIGW61v1IzZfrVtP3GzQoItiJUJUnPu/PJ+30+UAzLYvI8o0tiPr7MaMzK9nNW6yNTHTO7umxWKsS8XAitdgUB4UpDCrnd4UQpHgVWrRVQc= 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 VI1PR05MB5391.eurprd05.prod.outlook.com (2603:10a6:803:95::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24; Sat, 23 May 2020 00:41:32 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::2405:4594:97a:13c]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::2405:4594:97a:13c%2]) with mapi id 15.20.3021.026; Sat, 23 May 2020 00:41:32 +0000 From: Saeed Mahameed To: "David S. Miller" , kuba@kernel.org Cc: netdev@vger.kernel.org, Roi Dayan , Mark Bloch , Saeed Mahameed Subject: [net 10/13] net/mlx5: Annotate mutex destroy for root ns Date: Fri, 22 May 2020 17:40:46 -0700 Message-Id: <20200523004049.34832-11-saeedm@mellanox.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200523004049.34832-1-saeedm@mellanox.com> References: <20200523004049.34832-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR08CA0042.namprd08.prod.outlook.com (2603:10b6:a03:117::19) 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 BYAPR08CA0042.namprd08.prod.outlook.com (2603:10b6:a03:117::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 00:41:30 +0000 X-Mailer: git-send-email 2.25.4 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7f3ce03d-fce3-447e-0945-08d7feb20a15 X-MS-TrafficTypeDiagnostic: VI1PR05MB5391: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:200; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /4chigfAhielXkJ848ojh0ToG8IdkOc6iMTtaEPdb/3dqxgfwJzgKe5dg0iH5FT/fTS0FYaLuF1PDaiDPaXcKov3sE1h15EapmoNuiYrFm0gvQSD3uKaQCVU/47c438Wxup0wpb14UOenQv1HR6xzacbgUdik70wfUgUC7j6y3SNyXbXJXxcOTon7LNQT5QMzTgykNpOO95YfTwjiQ0dll+UZniFHW8BW0mjkEGt8ai7qrDuERhQozFVOKhbimBQCccezMLJ4EmH4CiZrmYwH44SUpSTfnxvZseIjdhdfLKq2yPMTxwHWj7NIbXS+T5T8GqNQHEUWf7X/T2pkKu7AcAxFxU4lrRJUOs+hhc7GjwbaghKYqMjHbAHDGDMl/o4 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)(346002)(376002)(366004)(396003)(39860400002)(136003)(1076003)(8676002)(2616005)(956004)(4326008)(52116002)(186003)(26005)(16526019)(478600001)(6666004)(86362001)(6506007)(6512007)(107886003)(36756003)(316002)(5660300002)(8936002)(6486002)(66946007)(54906003)(66476007)(2906002)(66556008)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ArYnp1fONJnH9YQ3n4e2+EFLuh4b6c88g81NkDu2efQ0ABCxUkmMknhCGEbWgC64kb8UzYO6A4YEnQmsOZy2rgRx4TymNwxMvvrajRreQ/Z50PZXbI2XSlHaG32Y0aAkDHSgGg/8E4+MWo4I/v/zTLiM0TJVWUDjgWoUWL7RlbuZDIlpBDOtjW5VsRvWryaWR8ZLIRTyzMccmfjD6a0GREpsZzhOFjsUEbUIFT4YV5dAd8kkeE3pK993ziY5RG7fU/OXbo534bKXiFcg/SywLpbsAtrdE3BRQ7tew3l/Wgk0MDnZd9ERDdJYCPcdEIpMJXuQWQuMB1rVbJ9RfcvDV+jYrRGUHeQ34qMIxqyyc9SrnpLZH6tN2J/gJRHaxmsY4u40+gfRjzZBKFoEe7KHGMa/We5fYOwKGxNz9ItQIDo7dlwYjm7QBnsyruPJysNaZKCsZ0Vu2rW0faeV+6j9Oyo9cJUiDg5GHaUb9DmAVIE= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f3ce03d-fce3-447e-0945-08d7feb20a15 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 00:41:32.6477 (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: 6hTftqKd98mxrv/duhe8OR3RCsgCpI5BrCrXJsU5/PSQLbL5UB3Kzvgc5UtuMyKzmel7daO7AQIKPrmA1JLFSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5391 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Roi Dayan Invoke mutex_destroy() to catch any errors. Fixes: 2cc43b494a6c ("net/mlx5_core: Managing root flow table") Signed-off-by: Roi Dayan Reviewed-by: Mark Bloch Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index 02d0f94eaaad..9620c8650e13 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -2350,6 +2350,12 @@ static int init_root_tree(struct mlx5_flow_steering *steering, static void del_sw_root_ns(struct fs_node *node) { + struct mlx5_flow_root_namespace *root_ns; + struct mlx5_flow_namespace *ns; + + fs_get_obj(ns, node); + root_ns = container_of(ns, struct mlx5_flow_root_namespace, ns); + mutex_destroy(&root_ns->chain_lock); kfree(node); } From patchwork Sat May 23 00:40:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 218655 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 682D6C433E0 for ; Sat, 23 May 2020 00:41:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3DF9020738 for ; Sat, 23 May 2020 00:41:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="D6zsKeRH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387524AbgEWAlx (ORCPT ); Fri, 22 May 2020 20:41:53 -0400 Received: from mail-eopbgr40071.outbound.protection.outlook.com ([40.107.4.71]:51206 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387463AbgEWAlw (ORCPT ); Fri, 22 May 2020 20:41:52 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XTiiqDgzdwKIfPsw6fL6wUI4kJ7fkO8U7fZrHYlzsbYqVADYuS82aqgrVOG2k6cTpYRe/OVLlAlcEXvcjYykfv0o+5FAGFZwXy961so7X5zFQFhz3Rai8lF4MciFV/9HqXpr6PTFVFJXsIRRK+YIMR9mvMIEOVwI+coXR4pYPpASHJENp96jN6i/M1BYO37nsK4OWHMPKsS6ekPU8k4E/fZFrybRvW7bpYpSUa4JfP4a5m8xybinF3HHCasNhbj/Zsbt/mgVFPaQ2ki7ykGDoon7clQqxsnNOCgTlhuUcAjFkCLFz/PUg3vI68/nQPowS0yKpO4VpwnoyyUHGgN94g== 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=HhBtJzEnAo2xU8X/jPL7D6Ch39OwtfNTd13jZYoaujs=; b=PNFxJfcDiq4l70+skcZJY5nEsnlWUKsvQfa7+ZobUHJikLmSP/XiBCMni3aV3hHIvwMPNCmAcPzlKmfXpPZk7hqD97UkNEVLeLRSjH5G034T1VIr3M5KEEeiSb3xx2JQ7xCs/c7FE3cM2TjZL7yXOyGChXthmbOQw/1bbji29/zIRwtRBtHrUWhVwkr47onsr5AoOJi5nDLe7Yr/Rs1j6Y2LXxBS88PTU7asNZwLBpr3EnPN0GCscNdq5vhynPiva9yfTvity46fcURxmKQG0XDeC2jPBr57lvWbGMxfd7iS2tX3GWpUd7Qk2E2Dq2VTcw1tw0nAf8cxYs1H73VuTQ== 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=HhBtJzEnAo2xU8X/jPL7D6Ch39OwtfNTd13jZYoaujs=; b=D6zsKeRHVMLsVuEG0QnWEe0lguAeLm3fAjIiLWtoULVDNoe+SzeMReBQzYN7i2zbWVX7qA6gVElgvJWQGXm7SqVdh+Uup/YPPYqlAIbXhw2VkL8SDF9DtYqBmj1LFuWrM582aJbZ1FGF9Bfc45wWvo2SDy17IFbSDwsmmdBng9E= 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 VI1PR05MB5391.eurprd05.prod.outlook.com (2603:10a6:803:95::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.24; Sat, 23 May 2020 00:41:36 +0000 Received: from VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::2405:4594:97a:13c]) by VI1PR05MB5102.eurprd05.prod.outlook.com ([fe80::2405:4594:97a:13c%2]) with mapi id 15.20.3021.026; Sat, 23 May 2020 00:41:36 +0000 From: Saeed Mahameed To: "David S. Miller" , kuba@kernel.org Cc: netdev@vger.kernel.org, Roi Dayan , Oz Shlomo , Saeed Mahameed Subject: [net 12/13] net/mlx5e: CT: Correctly get flow rule Date: Fri, 22 May 2020 17:40:48 -0700 Message-Id: <20200523004049.34832-13-saeedm@mellanox.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200523004049.34832-1-saeedm@mellanox.com> References: <20200523004049.34832-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR08CA0042.namprd08.prod.outlook.com (2603:10b6:a03:117::19) 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 BYAPR08CA0042.namprd08.prod.outlook.com (2603:10b6:a03:117::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Sat, 23 May 2020 00:41:35 +0000 X-Mailer: git-send-email 2.25.4 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 40062619-34b5-4e34-f5f0-08d7feb20c99 X-MS-TrafficTypeDiagnostic: VI1PR05MB5391: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1468; X-Forefront-PRVS: 0412A98A59 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gHri5PqzN/BYCMX78paZtwmfdgkX4eRS5LejuYbDZ7sYqhK+vbkrx8NIyFklxokP2hqelXkqKSQkU/lVkcfmJpLh5egWRznpAyFZaP85rVk6DwjFEvzV9KA49KlLx87Ad706Wt3cbGujC2CYbINqow3rAyc24G9RAX9I2POi6UknyOpsbK4OGNe7ysX4hRLa4OlIpNFoT1KGOEzOq2w8aDGAPA5UcDoQ3W3tPKCAneZqlvku3aLSs3XYuQJILYGdYdxcLvsq5+ujZMS1h5nxHs6rIUt73UKeCqjlhl73NL9YsU2oiH4HBvPYANm4W4s9k8J2ovXbgoKN+9+pXlg07s5EwdDzx2p/wOAbQdPgINpsMfA5gVO74wGzbJ5FLUPC 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)(346002)(376002)(366004)(396003)(39860400002)(136003)(1076003)(8676002)(2616005)(956004)(4326008)(52116002)(186003)(26005)(16526019)(478600001)(6666004)(86362001)(6506007)(6512007)(107886003)(36756003)(316002)(5660300002)(8936002)(6486002)(66946007)(54906003)(66476007)(2906002)(66556008)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: SQk2yitR2Ec0NFsSNYx62WYBAytQiSn2jhdomiedYIevv7IBF7XKzhVv5PCJd0faTZvQ79+P6Oazaz1V63jujVWVcNZ579EEQpYaEEJ3Z3AKRe0uoInqydrJ+N2GBKE4My7cMYxK9xnimITwvdKu++Gi+xq1XSlsWEDJnLxa2afRWN5j4ZVsqz7bpzq/NSV1BsQyWAoYZjhkV0mxX1kMVQAyY1JbZwMhjmtIsqF52qazX4JavIxzBsHTDoOlhK3PA5yxJWlY1Y8kWHZgU5ZkTN8Dj3THfIqxcb0rXGJzkqFqagNvmtq016WFgKgtRBQs/Bm7Vat36J98RmbENoqWVXhTFE3m1ZMt7yIhEXZk6v30+8bHasd3rjnD0geuBbarCkSwlYst7u/k1/Qsn1GooqDtYTo7BX+lYEA7oX5YMmInK8vzlgKnKc5wKz7/y/+Lo8bbVvMhP5pVKN0BHOnxXoStDeb0pn/rHN2La3aRhQc= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40062619-34b5-4e34-f5f0-08d7feb20c99 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2020 00:41:36.7163 (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: Yzf3qTI3XrUYgivvh+6ZeTbbYQGRUg129ZPgKghYLl7Wp+v3sDnOMOuGpkx4ZTcdQSg25RZH3Z5JzDD4gpDMXg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5391 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Roi Dayan The correct way is to us the flow_cls_offload_flow_rule() wrapper instead of f->rule directly. Fixes: 4c3844d9e97e ("net/mlx5e: CT: Introduce connection tracking") Signed-off-by: Roi Dayan Reviewed-by: Oz Shlomo Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 5 +++-- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c index a172c5e39710..4eb305af0106 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c @@ -699,6 +699,7 @@ mlx5_tc_ct_parse_match(struct mlx5e_priv *priv, struct netlink_ext_ack *extack) { struct mlx5_tc_ct_priv *ct_priv = mlx5_tc_ct_get_ct_priv(priv); + struct flow_rule *rule = flow_cls_offload_flow_rule(f); struct flow_dissector_key_ct *mask, *key; bool trk, est, untrk, unest, new; u32 ctstate = 0, ctstate_mask = 0; @@ -706,7 +707,7 @@ mlx5_tc_ct_parse_match(struct mlx5e_priv *priv, u16 ct_state, ct_state_mask; struct flow_match_ct match; - if (!flow_rule_match_key(f->rule, FLOW_DISSECTOR_KEY_CT)) + if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CT)) return 0; if (!ct_priv) { @@ -715,7 +716,7 @@ mlx5_tc_ct_parse_match(struct mlx5e_priv *priv, return -EOPNOTSUPP; } - flow_rule_match_ct(f->rule, &match); + flow_rule_match_ct(rule, &match); key = match.key; mask = match.mask; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h index 091d305b633e..626f6c04882e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h @@ -130,7 +130,9 @@ mlx5_tc_ct_parse_match(struct mlx5e_priv *priv, struct flow_cls_offload *f, struct netlink_ext_ack *extack) { - if (!flow_rule_match_key(f->rule, FLOW_DISSECTOR_KEY_CT)) + struct flow_rule *rule = flow_cls_offload_flow_rule(f); + + if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CT)) return 0; NL_SET_ERR_MSG_MOD(extack, "mlx5 tc ct offload isn't enabled.");