From patchwork Thu Jun 11 22:47:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 217820 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, 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 70884C433E0 for ; Thu, 11 Jun 2020 22:47:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 44C1E206D7 for ; Thu, 11 Jun 2020 22:47:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="Hrq5CBGR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726403AbgFKWrs (ORCPT ); Thu, 11 Jun 2020 18:47:48 -0400 Received: from mail-vi1eur05on2064.outbound.protection.outlook.com ([40.107.21.64]:6125 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726254AbgFKWrq (ORCPT ); Thu, 11 Jun 2020 18:47:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WqGIafdk2pZgj+62LlrQ87fPeGUn0gZdASLEXD5Ujsl2yhmANDQMSgfjHl6eEAKHkgJ8JDD1YEG2miB7ANWsIKB+SJoWjXrpeb8kPqrcBB7l0cbk1c5jvMzjzwqGMByQrVzfffelOlSP+QRPAU64ZvmfQnb4caRQ+gtXwobuIbmvICGZYUHi7+J+S2pqKwY1qeN7l/6iTHvhfwWzkeTrco2bxNGGvQGP2xgiU3SleUW2MuYIhew0JrolJdT1ATyM9v3WAAKfl2Wut0KrZUOj1v3IF/3QhBBSCvT1IaglmXs/CcJwJ0CgyffrovN60NTgyrvpUQVEGBc3nnmQ7chWIw== 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=bG/knJJBn1O2FRj5oJL6lPWNtROrhpHUb3vnY70hdtc=; b=eqiA+V4JXsLDsMYW5tjfuFPYt9sTF9i57HM9ea9Fjp2qLLFyDn3j5Wr1/CDvSbSGooiNAXatZruGhFIIb6cHgIsaSG80+k5SHxRsq6jkN8zpJQCUi1KiN19e/H1KoIERZJU93KgJp8k9ZQiP6AbbboSkbDuNeNqMs0oRC5W/Cou1JTZn5A1XY/rKK6Ni2cVR6B/v53puhZaIlYezCtBzX1wdlvU8i4OFMy6RIuOaoyvNhDn50MjehRhLA9Emrf/4+Y5dAuhZfrvwbnwe9rV5tQVxkJ+uOETqk3K9zi2z3PuqKKvyGPDcyChrF9SP5iwj0Ah5tOM8V2mB5UVEnydpkQ== 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=bG/knJJBn1O2FRj5oJL6lPWNtROrhpHUb3vnY70hdtc=; b=Hrq5CBGRgeRRjuMZymW+2mlSK0VAUII9Hq+kfPO5JqEVUKXc6oGkZdG2hWonLIRRb0Z5PvL6ItFYw84gcyDB5XCiBqmYPBDk0WXUhiXJ16d1piUqBJjSCxPsUWKASOQOF2Pncn0OGTVDyihlr9ce4zNYhHrnyfWzh/r+aZ9lFIg= 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 VI1PR05MB4464.eurprd05.prod.outlook.com (2603:10a6:803:44::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.22; Thu, 11 Jun 2020 22:47:41 +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.3088.021; Thu, 11 Jun 2020 22:47:41 +0000 From: Saeed Mahameed To: "David S. Miller" , kuba@kernel.org Cc: netdev@vger.kernel.org, Shay Drory , Moshe Shemesh , Saeed Mahameed Subject: [net 02/10] net/mlx5: Fix fatal error handling during device load Date: Thu, 11 Jun 2020 15:47:00 -0700 Message-Id: <20200611224708.235014-3-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200611224708.235014-1-saeedm@mellanox.com> References: <20200611224708.235014-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR06CA0066.namprd06.prod.outlook.com (2603:10b6:a03:14b::43) 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 BYAPR06CA0066.namprd06.prod.outlook.com (2603:10b6:a03:14b::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.20 via Frontend Transport; Thu, 11 Jun 2020 22:47:39 +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: bd7ec66c-72be-4636-b026-08d80e5972d0 X-MS-TrafficTypeDiagnostic: VI1PR05MB4464: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-Forefront-PRVS: 0431F981D8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yBiqRc5e1qXWbI8+xjWuk+4RjDTsBxgWIJRB8QZ4aqNK+g0V//r1HxcGxdmJyZNBzNu9xPVhRe/ur7w0j6heMdXt2vdypsLOseEm6rO70nP/gOzom5mDVS0EaGlnz2Hxq185QVTpC9irmceB/NOvuVpIE0AQ4JFiEnxAB6KrVnwaQsuiK+JDo/prGbhd9xuL2ZKV6btgBmzpfgaojTXHcJPmdEmATYJEZuA6l5rbe3LNiO8ii9UKg4Wxk+MkmEpFcNo9F40QXhG4ho/jwDqE+fKp3ylWpZfNyn0nqHmcpzViny58nhFci57+L+WsAueH1a+eN6y/JE3y5HQK1ge6nBsuE9GDcT1iRtdHlO2PXlAAyJjhoBqZkAi7WiJuRaw3 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)(39860400002)(376002)(136003)(346002)(396003)(8936002)(16526019)(186003)(4326008)(316002)(8676002)(107886003)(5660300002)(478600001)(26005)(956004)(2616005)(6666004)(66556008)(86362001)(6512007)(6486002)(66946007)(54906003)(1076003)(6506007)(36756003)(66476007)(83380400001)(2906002)(52116002)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 3PXYgU77dFz04JXuTdoon2WNk1J/1bC/Od1S+UcNDIFL2yysmX7BNSA30twxdsNRHrGoEVt2hw62mG6vxHxaCkv1dFYdfoDA67sFEcJDvKYmNS6XKfHKQzle0plnpMwebiLaLYsIXTH1yGpOPPUgxUKFK/hrta6Z4H7pINBsGdf5wL0XalbGGP5Akmmw4TgdTb9oAUMt7W7mlxBqwT88uGOv8RIdzkZeYKC/zFw5ly2RfiCWqysWq/rkx08wAwRXOewsK6K5KzwyAQYJe1Cn+VhHxgfiUcwIZOvwdWwpSAi0RORAfGgT1fEB7CdDTIqSvIt5cI4et/A5mV6ic+lOKLMTV97fVhRzy+A2+sFMyCIsafo7iqa6lePWe3Ysye5iDABhc9cE1mLn9KA7eS+7SsrpWiro673kcuxXvChRwNeHVas+v2tdBE5qaxYl4fIhzP95qhYw/gi51u+5dbhY/rJDOkCNeI7hw8Lphc1GZCY= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd7ec66c-72be-4636-b026-08d80e5972d0 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2020 22:47:41.7440 (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: NXkqoVhZULfnR5mXm/jT2DY0kf2F263TJnOIRI7o2+4Uku2g8vZ6RahSXXE3juLTgcblEID5DqwjGtJadAnGCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4464 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Shay Drory Currently, in case of fatal error during mlx5_load_one(), we cannot enter error state until mlx5_load_one() is finished, what can take several minutes until commands will get timeouts, because these commands can't be processed due to the fatal error. Fix it by setting dev->state as MLX5_DEVICE_STATE_INTERNAL_ERROR before requesting the lock. Fixes: c1d4d2e92ad6 ("net/mlx5: Avoid calling sleeping function by the health poll thread") Signed-off-by: Shay Drory Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/health.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c index c0cfbab15fe9d..b31f769d2df94 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/health.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c @@ -192,15 +192,23 @@ static bool reset_fw_if_needed(struct mlx5_core_dev *dev) void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force) { + bool err_detected = false; + + /* Mark the device as fatal in order to abort FW commands */ + if ((check_fatal_sensors(dev) || force) && + dev->state == MLX5_DEVICE_STATE_UP) { + dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; + err_detected = true; + } mutex_lock(&dev->intf_state_mutex); - if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) - goto unlock; + if (!err_detected && dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) + goto unlock;/* a previous error is still being handled */ if (dev->state == MLX5_DEVICE_STATE_UNINITIALIZED) { dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; goto unlock; } - if (check_fatal_sensors(dev) || force) { + if (check_fatal_sensors(dev) || force) { /* protected state setting */ dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; mlx5_cmd_flush(dev); } From patchwork Thu Jun 11 22:47:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 217819 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 4A2F1C433DF for ; Thu, 11 Jun 2020 22:47:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22228206D7 for ; Thu, 11 Jun 2020 22:47:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="Lrwy/uQs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726444AbgFKWrz (ORCPT ); Thu, 11 Jun 2020 18:47:55 -0400 Received: from mail-vi1eur05on2064.outbound.protection.outlook.com ([40.107.21.64]:6125 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726254AbgFKWrv (ORCPT ); Thu, 11 Jun 2020 18:47:51 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L8PoOvk+hgzRq6yi+v3aHSAIYRW0AnZldljnvjV+I5hNhWiG4jFZCP+Ns1jOWsFJyrxZtkRUEyCs/R0+hFCGrPcMYcfMGwXp52Jm5JcqJsvjkn2xde/3bRqJJXeaQQv5sojLkRpDhzpIg6El/pFGmHaC5R0DS0LizgpeE8wzVZigOJQbYwXOhw7rWVzoLaZoKzf4gsTUsodw4wtrRH8djWUEOZJieXyS0aQrB2HAWGGDBdF14/HOKzwuj2/0C7M/25QC7GIDPWIguN02t0tMtegKofvOQ6Wpa/UXKf6ft9pO8eT8esTK7QfqzMpZo7JmQ9TyRVyN4HyXX4foStfnPQ== 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=bULl49/UVYC/uigU/w+DDBvTmsFkIWTwm3lHO7C0jzo=; b=K/HJxoDTkRvCzYzSyMKYVY/BoC7tcLhTAppHXMZt0lPeA4vFdZtLHIDrZebfqv50xk135D7cypI2E71uspurm2PXZbD+RkWafNcVHKkbSjl+D7ov7Yp9tT2WJEXZm4rR6JI/g4XlMMK3zyeNMdbfo0VKNOumL0qIXDQvJ/ab4FwuzE0/vuYTwJ9Hqh4pGD/jWJKiH11uUTu1RQGXLY+Rwk2MKJkHaZIxlPA+7h7m+wBEutpb0aekifziPQQslnD3nF8rNlLQmH5Q1apGQH/zQDmghhAmt2zSFLK+jAyc3IMxxF97mBYCNy4Z7rTc3w6JLBv/DFrh0NUTp6bgzlAGxw== 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=bULl49/UVYC/uigU/w+DDBvTmsFkIWTwm3lHO7C0jzo=; b=Lrwy/uQsbcXh5GOZlBxsAuRuUc/B/t9Ma4cAuyTG5LN4QuozbitZUaHDotJR2nJWBV8mQCh0y0a22eTrnxguaS7AvsXoShkLhjKjjbw19Erh63EfUOIPph36B9GPZ9RgnsVYrrEB22xSf/MNWj854ga/2qhts1gfB5NUihbp7nY= 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 VI1PR05MB4464.eurprd05.prod.outlook.com (2603:10a6:803:44::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.22; Thu, 11 Jun 2020 22:47:46 +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.3088.021; Thu, 11 Jun 2020 22:47:46 +0000 From: Saeed Mahameed To: "David S. Miller" , kuba@kernel.org Cc: netdev@vger.kernel.org, Maxim Mikityanskiy , Saeed Mahameed Subject: [net 04/10] net/mlx5e: Fix repeated XSK usage on one channel Date: Thu, 11 Jun 2020 15:47:02 -0700 Message-Id: <20200611224708.235014-5-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200611224708.235014-1-saeedm@mellanox.com> References: <20200611224708.235014-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR06CA0066.namprd06.prod.outlook.com (2603:10b6:a03:14b::43) 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 BYAPR06CA0066.namprd06.prod.outlook.com (2603:10b6:a03:14b::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.20 via Frontend Transport; Thu, 11 Jun 2020 22:47:44 +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: b505aea2-5379-4f96-102a-08d80e5975ae X-MS-TrafficTypeDiagnostic: VI1PR05MB4464: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0431F981D8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yNSjR1Czk7OwS6GIMt5XUTX1JCiv24HjMHIdfIYL6G8EyOqdrmyu2cJPLaFRRIitri8d5PBqBwCsThtWgict0mLW8vT2QJTxtKhNGLjs3eQK04ZUBBD/u3LRY1+wjZDCojMbfQyHDpDDxK2rfXMhGC0oHRn7tAHgpWot6s9Cr9FnqpmhTkuo82p5XmaAepFHfE7nep4bfk02gaVP71WJ8gNn0VPi0tfGsGXQ00Yuw/yiVmJunLam3LxLOfvfefuB6L3njlGtgdjS9D5VxX5x+nkRk0O109uQ0i9AhR1zcW0yZnzVMSddcN102fRmeYzLZ4s1TtcwZCZsuSfZAOcqPb2yrJPxh1TT7e3kMiQG4g4XywxD44oL+ojGNCWJm9qE 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)(39860400002)(376002)(136003)(346002)(396003)(8936002)(16526019)(186003)(4326008)(316002)(8676002)(107886003)(5660300002)(478600001)(26005)(956004)(2616005)(6666004)(66556008)(86362001)(6512007)(6486002)(66946007)(54906003)(1076003)(6506007)(36756003)(66476007)(83380400001)(2906002)(52116002)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: tlimI/7kDeAZ+QPDBIxpfmPuEJr3eZ9Qkup7pVdi8S2iioTe4cwAgGesCdKGdDn6W9G8CRumXNr+YJHNd6+bZ+rGILRaNO1a7dR76F7Z+7Y8KzbvpBvi658HxVVYnPsuXwX17Cq2HQT/CsOvvcAzOXenQjfl/cWpxON1eQSANcYWajx9smWBmLPXQcGCd0pH1uQGLo1xTIkewv1LihEo9S42B1vqnqBG2lXgsR1RtJ0aFOx7XB1/QsFEVlsWHEB2bw8GEEgsofdj6MGMc9+oC9BYBE08MYkt4gSUCi5RLUktVsjMWgWAw5cL4ge/ss+JI5mBe9G7b161hmeaOFY5R/nQqQHEtfeOke25iBBMqIL24ViWdkFVJDr8Jq9hrcV92Cg7BDAd7TsDggneGbhNPyMo/xS2KOa9ji7R3EOIphnvdYrBPqhuF2JbkuNQMg8wQ8KTqhKMnavDWP//hDWWmcWqx6MmkS9YKGKdID7q5Qw= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b505aea2-5379-4f96-102a-08d80e5975ae X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2020 22:47:46.6252 (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: m8WFtwhZmAiLDkipE4NYLgwYleeXZTDUy1up+udGnyNbfrurtgNJkOQA+Cswmbaz8sbtxGyJS3KPHGg4uCgSiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4464 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Maxim Mikityanskiy After an XSK is closed, the relevant structures in the channel are not zeroed. If an XSK is opened the second time on the same channel without recreating channels, the stray values in the structures will lead to incorrect operation of queues, which causes CQE errors, and the new socket doesn't work at all. This patch fixes the issue by explicitly zeroing XSK-related structs in the channel on XSK close. Note that those structs are zeroed on channel creation, and usually a configuration change (XDP program is set) happens on XSK open, which leads to recreating channels, so typical XSK usecases don't suffer from this issue. However, if XSKs are opened and closed on the same channel without removing the XDP program, this bug reproduces. Fixes: db05815b36cb ("net/mlx5e: Add XSK zero-copy support") Signed-off-by: Maxim Mikityanskiy Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c index c28cbae423310..2c80205dc939d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c @@ -152,6 +152,10 @@ void mlx5e_close_xsk(struct mlx5e_channel *c) mlx5e_close_cq(&c->xskicosq.cq); mlx5e_close_xdpsq(&c->xsksq); mlx5e_close_cq(&c->xsksq.cq); + + memset(&c->xskrq, 0, sizeof(c->xskrq)); + memset(&c->xsksq, 0, sizeof(c->xsksq)); + memset(&c->xskicosq, 0, sizeof(c->xskicosq)); } void mlx5e_activate_xsk(struct mlx5e_channel *c) From patchwork Thu Jun 11 22:47:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 217818 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 74686C433E0 for ; Thu, 11 Jun 2020 22:48:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4A5CE2075F for ; Thu, 11 Jun 2020 22:48:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="QMdm0Fkt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726482AbgFKWsB (ORCPT ); Thu, 11 Jun 2020 18:48:01 -0400 Received: from mail-vi1eur05on2064.outbound.protection.outlook.com ([40.107.21.64]:6125 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726254AbgFKWr7 (ORCPT ); Thu, 11 Jun 2020 18:47:59 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X9U/FRrs0FRVEUshHFzUly9VCY6o8AChHNFBvHG9gzjPNLG+qUcfCmERcVkVJ+NHS66apq7VYVLhZD2lWTZSrSmzLO7pQLcyujgrMeJUQf0ZYHdhTQTjfr4rhJipkNt5sGcip1K6RdEtpubbjZwBWeLeTC5hBMWJyPIDfWp8Lj0ALcrSJOGZfykMS1UPz0gNgWB5MFcHu9ZA2iPnNjn7uOWSK0DHS0ShHGuobyAqO5TVsB4h4jlLf/ps5HlDllX31uz8mlrcouRkSerynu1Fg3euSy5r8MjuO+1OcpoyGqiRK8QZvy5UiEzi0c90CK9DOBHrkuoZ4hAhqiWa5O0mjA== 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=uZ5vUec3G6kAz9/mnRr0cxYRZhpt7ZEwbGljHQANd7c=; b=LhgYbGqwnTlAIH96HNpK+yQQAGjuKo2JcGb94RjhVzPQx7FR7rFitySfKjvN8J0kajVLZ1XIRCr9V0H8p9nqP88d1tT1Xlvl5UM3erhUua6YoqCA2HRnv2qccWLOQxSncJS+EGpL6UiwM7RYLtJK1bXVL4ZKrmqNqckqHX5p5EGWCEZx5KGeG/YCswsA/VJt/BWaXFX0iLx6fM41rEp43B0jdzYT3V2Rj3/s0N3k89p/94ELhBvmi247Ui5y2cQ2bM+h04ExwFYR3byTiwNvECxvbff+zeQw7Nrrs0X/eFptkQ1AN1A5JG2HBJw4oOsURvPamLuzhtH4Xcacr4Q0PQ== 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=uZ5vUec3G6kAz9/mnRr0cxYRZhpt7ZEwbGljHQANd7c=; b=QMdm0FktXFwJCUd1HR2tVzJGYxrJ6kmvCunXPJ7HJJ/nv0yWA9TnrrMSHIxEa3h+Fj5qPVOp+US340HQoznhJrodBDtGzuHxIIBrQceUEuaSaiftPBDzP+G0pZN1QQ8W4UR3lomAc7Y084u413Y6urAQGh9RCpHxL7Bm6sxIQjo= 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 VI1PR05MB4464.eurprd05.prod.outlook.com (2603:10a6:803:44::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.22; Thu, 11 Jun 2020 22:47:51 +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.3088.021; Thu, 11 Jun 2020 22:47:51 +0000 From: Saeed Mahameed To: "David S. Miller" , kuba@kernel.org Cc: netdev@vger.kernel.org, Parav Pandit , Moshe Shemesh , Saeed Mahameed Subject: [net 06/10] net/mlx5: Disable reload while removing the device Date: Thu, 11 Jun 2020 15:47:04 -0700 Message-Id: <20200611224708.235014-7-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200611224708.235014-1-saeedm@mellanox.com> References: <20200611224708.235014-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR06CA0066.namprd06.prod.outlook.com (2603:10b6:a03:14b::43) 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 BYAPR06CA0066.namprd06.prod.outlook.com (2603:10b6:a03:14b::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.20 via Frontend Transport; Thu, 11 Jun 2020 22:47:49 +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: 062614b7-7733-49ee-ace6-08d80e59784d X-MS-TrafficTypeDiagnostic: VI1PR05MB4464: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-Forefront-PRVS: 0431F981D8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: POJXgYYiD++VUPVYjNreidPOAT4WVwPVgLLDfybZIRyei4MohK8ZFSjSzUj6+xDDiHKYaiNI41VAQIPCht1bmcUVMrlg/NiG/3D7CWFnXaEbVGeRqDTIqrFbxcNiMIqtyupg7SGjaeVrqIB3BPkYP8YGISjHn86myk7sXjSZPDL68E75Uu/l9BKJwY+5sTW3DQ03B/G6ohidElrFmX/pthTjULV/CupOuFiDIgoAedhhE7q70ZH26Pf2s4BpnaSAnhqkp7K6L7pULCF8ERQRmwzVAy9JCwkSVR898s+gwcuri5A8Okzj2HzTTiwPeJvjSz72oLEeRuN1BTw3ILq3cB3nuqFSxGK49bbVooQkPaZOv4CX8iz9eBa2AGkJguv7 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)(39860400002)(376002)(136003)(346002)(396003)(8936002)(16526019)(186003)(4326008)(316002)(8676002)(107886003)(5660300002)(478600001)(26005)(956004)(2616005)(6666004)(66556008)(86362001)(6512007)(6486002)(66946007)(54906003)(1076003)(6506007)(36756003)(66476007)(83380400001)(2906002)(52116002)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: AJYlrTQ3xb32OlxfJk38aK/FhwRrJd6bramQ+ZrMpLlPuW43BjNjheUlNZDlEZldXLMHkjxg6BMySWFTnsSAfhYd7otLBBvRGUTnGEG6Bl5BVn8LZu+juKAFa6X8MlKC1unb3DCXYTQoPOkFAydXiaGTC0svnW4FEDboA/uIRV+nxPxREHix8Z6Lw+IAxW5lE/188yKm4T1PkdWDXAYSbm9taB5EA/t/GJVSWEFshJl++i3yOuDPPeSoSG19x7yyVvPSwOt/5/chH/7WtkZM9HkulSJNd3ycW4rmEbVQ3+g6Xe750uGWHA76q42NR9Da/Zn7AwaQxxUgRv8lGS+/PlqDR5NvHEjWKVNPnQuRwRXEi57EOYJQ50Q/lrbnIfANLouF9ZXns80dVkVmbSw6TPafBTb3dtuqvRdIqbxNNLuvGV+uC4h9fbw0EG9RDo7zas8pLZOx4hX48kBLQo3uylVPwrZYd4F7e8vMAkubOYg= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 062614b7-7733-49ee-ace6-08d80e59784d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2020 22:47:51.0057 (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: zCfFAqi0HxaCtw6Cx1I/5Sr1FP4bfBIm1t80Cn6bUOf3PM8uB6C7QNmD1oHOJJHi12szyt7uUFqsl5jsQgfywQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4464 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Parav Pandit While unregistration is in progress, user might be reloading the interface. This can race with unregistration in below flow which uses the resources which are getting disabled by reload flow. Hence, disable the devlink reloading first when removing the device. CPU0 CPU1 ---- ---- local_pci_remove() devlink_mutex remove_one() devlink_nl_cmd_reload() mlx5_unregister_device() devlink_reload() ops->reload_down() mlx5_unload_one() Fixes: 4383cfcc65e7 ("net/mlx5: Add devlink reload") Signed-off-by: Parav Pandit Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 2 -- drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c index e94f0c4d74a72..a99fe4b02b9b1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c @@ -283,7 +283,6 @@ int mlx5_devlink_register(struct devlink *devlink, struct device *dev) goto params_reg_err; mlx5_devlink_set_params_init_values(devlink); devlink_params_publish(devlink); - devlink_reload_enable(devlink); return 0; params_reg_err: @@ -293,7 +292,6 @@ int mlx5_devlink_register(struct devlink *devlink, struct device *dev) void mlx5_devlink_unregister(struct devlink *devlink) { - devlink_reload_disable(devlink); devlink_params_unregister(devlink, mlx5_devlink_params, ARRAY_SIZE(mlx5_devlink_params)); devlink_unregister(devlink); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 18d6c3752abe8..2729afc13ab48 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -1367,6 +1367,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *id) dev_err(&pdev->dev, "mlx5_crdump_enable failed with error code %d\n", err); pci_save_state(pdev); + devlink_reload_enable(devlink); return 0; err_load_one: @@ -1384,6 +1385,7 @@ static void remove_one(struct pci_dev *pdev) struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct devlink *devlink = priv_to_devlink(dev); + devlink_reload_disable(devlink); mlx5_crdump_disable(dev); mlx5_devlink_unregister(devlink); From patchwork Thu Jun 11 22:47:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 217817 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 585A6C433E0 for ; Thu, 11 Jun 2020 22:48:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30D9B2073E for ; Thu, 11 Jun 2020 22:48:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="j+FXy5Nm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726519AbgFKWsH (ORCPT ); Thu, 11 Jun 2020 18:48:07 -0400 Received: from mail-vi1eur05on2064.outbound.protection.outlook.com ([40.107.21.64]:6125 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726254AbgFKWsE (ORCPT ); Thu, 11 Jun 2020 18:48:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CmpmcEOA54d1nEt1wnpQi/7o1Q+pL17BVPu6p2MRM4DMGqQGD8xA32l8UN3Yqjx0l+mKsmSbV/GXnuCghYuxB5hZQD/aa6L/r4NjaRdNf8evFwj7snw/j7kLSN5AY0kxRasE/xVajbUW0r1nrwjxFzixZG4BQVffF8a7bE8QVpj7dzALooqY87JXRo+oVrSpQj+WvZ6vmq8I1vJ/ARaImQl17AXzzuTkCePcI1yCpOimHFWpXo+Gi55L9OwVxDUESUvKcgtswhLk2wgvjZgx+yXAGIv6G/+0qqeDDaJ4k6ipyKUZdXv232XnmKxvpm7VvaqjXli6CRkKA64uVOAMVQ== 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=0oqwWL6DsMLfWdGRAWRRyOUQDW0ifNDuNSCBToXltNI=; b=iV6OHEbfsi5Oj00Vbr9tHiBuCx04ajvzt4nXvfiSe8OdfPp5ifkhM83TWoQJbrkbdri2BNusSXwdk2VIxYkybWkRFD4RaZBPF27ImdhbMveIbiW17AM0fGuzycBmZ9hzUtzo0wf61Niwg1EnYxDo/FJCY3UQucG9G7srmjsxRj+Z/2bqWh+qTljphroVCZNd2XNbwRCTqQeLwXt+M/zmbxqBlpeKFQrsnKzO/o2VLDrgKo25CtbBKGmExgDkcGeTe8Q6Amotl5hqRRUFZdCsUil+B3/6rgI1Tjyr0Y3TRKh2IDGGL0MIz0BPDzu66+1mCohk4ovgBvLMTZuTQdmt7w== 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=0oqwWL6DsMLfWdGRAWRRyOUQDW0ifNDuNSCBToXltNI=; b=j+FXy5NmR0fy1UUcb7ABTfc2lrdF3Quabu4PJCudMLuIbzsE9Li2WxsDSncghzNx9vsWWskHakiFJ24rhHbVHWs0dhE8LLYWNxiUdYIHda9l0eTukcFmbEBF5goQpH/NJO2+j1AUnvzRPLT+Wfoxf0CMIRcJB7JUv+U5wuJvRyk= 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 VI1PR05MB4464.eurprd05.prod.outlook.com (2603:10a6:803:44::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.22; Thu, 11 Jun 2020 22:47:55 +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.3088.021; Thu, 11 Jun 2020 22:47:55 +0000 From: Saeed Mahameed To: "David S. Miller" , kuba@kernel.org Cc: netdev@vger.kernel.org, Oz Shlomo , Roi Dayan , Saeed Mahameed Subject: [net 08/10] net/mlx5e: CT: Fix ipv6 nat header rewrite actions Date: Thu, 11 Jun 2020 15:47:06 -0700 Message-Id: <20200611224708.235014-9-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200611224708.235014-1-saeedm@mellanox.com> References: <20200611224708.235014-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR06CA0066.namprd06.prod.outlook.com (2603:10b6:a03:14b::43) 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 BYAPR06CA0066.namprd06.prod.outlook.com (2603:10b6:a03:14b::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.20 via Frontend Transport; Thu, 11 Jun 2020 22:47:53 +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: 1258490c-7971-403e-daf2-08d80e597b0c X-MS-TrafficTypeDiagnostic: VI1PR05MB4464: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-Forefront-PRVS: 0431F981D8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5XKy1sNYQD+Btev5NgR2egqmxbjS5/ij7LQ8lXkKLUUI7zefaKbZsxvGBLNVlyUlMWRAGOupDCDd+EtDW8a/5QKOztb7pmpkiCkTiKzlPrEgNj7rxomPUBACrYhci+pRYs3RCZCjyHPYsoBv6sljNbKsermYHxe/nyz6dQIAkxcWLWdxyg/U6oQGqzDDCbeL3TOs1rndmXaHyv3hbT6CG8hCfF8ylVuP05WQtDW/keRxAk+iRXLHdFe2dvsuVZAbKwWLXGpjC91plJH4snzzJ7WpKrnGSz5gUElmu8VS8MM1dyG8j7922/ab0+w/4o2XG+B2qSbtQxS2Y3mMByewdJDxpIuBiDME28LS5Bxu46fFB66+BUDOi1t/L1qSFngm 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)(39860400002)(376002)(136003)(346002)(396003)(8936002)(16526019)(186003)(4326008)(316002)(8676002)(107886003)(5660300002)(478600001)(26005)(956004)(2616005)(6666004)(66556008)(86362001)(6512007)(6486002)(66946007)(54906003)(1076003)(6506007)(36756003)(66476007)(83380400001)(2906002)(52116002)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: BsGx/zEI1LcdpzrUejeCcNWyl6UpCwnc6bd9/DQiKBO+HIMqMOg+Hzmz+tSTdTTMMdl5oZn51Hotd34/cYqVWxhaseUYCGO4XKXV4n2MpWRpxiyEihvrTNf7hrjSKw+PnUkwor5CH8N6ca+mIk6wyb3QKxt8ftxSazvx2c/hGv7D84gQv2od2IGPEW9MM14vtiQyab4oSmqE+qcEpVz4fk5dpPVSguAF4K+zJTM9Xy5jnkYeM1vP4Y2wB8v0hDHHLLd6NSqIHk0LiD+3QathZbyny7eJl93Ex4V3WDo0tblXanfeSWgoPrLbn5TtUhBlYUHqjVygshpJfH3n/w+zQ37kNqSa3+G3Yw0/p3XKyKwhGjscxv86eo3rG3G6Pz2WX45e8Iyz1vdM8dygef8EBZAdPAubE2WpWYZq8OzBeTNP2fXphJ3Mo4et1tj8nVrIoLv5aKHjIty9l3aNCYWYBVkmdCh/MoVEAVltSXsvLEQ= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1258490c-7971-403e-daf2-08d80e597b0c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2020 22:47:55.4002 (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: SviS3pvMvTedcxBJ/nkIssjVslls75fhNNY834ktXkK4o3a21uHj7YHdV9ZNYrOKy9ZgVxeEdLJyDymo/gW3xg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4464 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Oz Shlomo Set the ipv6 word fields according to the hardware definitions. Fixes: ac991b48d43c ("net/mlx5e: CT: Offload established flows") Signed-off-by: Oz Shlomo Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 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 afc19dca1f5f0..430025550fad2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c @@ -328,21 +328,21 @@ mlx5_tc_ct_parse_mangle_to_mod_act(struct flow_action_entry *act, case FLOW_ACT_MANGLE_HDR_TYPE_IP6: MLX5_SET(set_action_in, modact, length, 0); - if (offset == offsetof(struct ipv6hdr, saddr)) + if (offset == offsetof(struct ipv6hdr, saddr) + 12) field = MLX5_ACTION_IN_FIELD_OUT_SIPV6_31_0; - else if (offset == offsetof(struct ipv6hdr, saddr) + 4) - field = MLX5_ACTION_IN_FIELD_OUT_SIPV6_63_32; else if (offset == offsetof(struct ipv6hdr, saddr) + 8) + field = MLX5_ACTION_IN_FIELD_OUT_SIPV6_63_32; + else if (offset == offsetof(struct ipv6hdr, saddr) + 4) field = MLX5_ACTION_IN_FIELD_OUT_SIPV6_95_64; - else if (offset == offsetof(struct ipv6hdr, saddr) + 12) + else if (offset == offsetof(struct ipv6hdr, saddr)) field = MLX5_ACTION_IN_FIELD_OUT_SIPV6_127_96; - else if (offset == offsetof(struct ipv6hdr, daddr)) + else if (offset == offsetof(struct ipv6hdr, daddr) + 12) field = MLX5_ACTION_IN_FIELD_OUT_DIPV6_31_0; - else if (offset == offsetof(struct ipv6hdr, daddr) + 4) - field = MLX5_ACTION_IN_FIELD_OUT_DIPV6_63_32; else if (offset == offsetof(struct ipv6hdr, daddr) + 8) + field = MLX5_ACTION_IN_FIELD_OUT_DIPV6_63_32; + else if (offset == offsetof(struct ipv6hdr, daddr) + 4) field = MLX5_ACTION_IN_FIELD_OUT_DIPV6_95_64; - else if (offset == offsetof(struct ipv6hdr, daddr) + 12) + else if (offset == offsetof(struct ipv6hdr, daddr)) field = MLX5_ACTION_IN_FIELD_OUT_DIPV6_127_96; else return -EOPNOTSUPP; From patchwork Thu Jun 11 22:47:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 217816 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 83D99C433DF for ; Thu, 11 Jun 2020 22:48:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 600062073E for ; Thu, 11 Jun 2020 22:48:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="r108Niyd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726540AbgFKWsM (ORCPT ); Thu, 11 Jun 2020 18:48:12 -0400 Received: from mail-vi1eur05on2064.outbound.protection.outlook.com ([40.107.21.64]:6125 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726254AbgFKWsK (ORCPT ); Thu, 11 Jun 2020 18:48:10 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UkJsot+HDJ6kA8KCXhZ6XgCzi5zI7ZtTToEnOtBPiCzNVEKkeE3D9/JaWGDsmzAlFqPSTtsbxKgeWMvHxzn1AY6r985X+f018JWrRnSyG4MgmYifMHGw4Yq8FN/9lcIzAEh3Kyu8GTNatiRl/zUEUzlrrmdGQSS3XWyYWjR1/r5sZrd1BLeA3z/gutTebTdp6G28NJO74GoDwjs5NpaNKYb4SHD7abAdn0JhAYthiUuByKqAg9sP4uARlwC7Egk+3l+2Z23IPPP7UmIb5IvRdLMvLbwnJk9bk2xlwCwQHWnKG5oM83fPD6RBbupIP0nzpOJ1VyWM970ROzXyaQZ93w== 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=xIq0W/PnAZIi869tPmDsIxtj5H8MskytOaz/voqSNAc=; b=kzGRNoPUhKywnCjyrVuEDh9Iho1ubCWlj679QHAjIL0XTdyDLaZGqPMO7eNLzj+M1F/WA3f0mSiDtxf69Zs93xno7Nlkz/eN0FmLVMlMSdl6LRigpdeF9uwCsRgO4aLtK+hDrXzp4xbgdeRR26U9piWypfP2KvxrCaqLnHruTh4fghgAt4+rTZoVR9JUl6p1jGudFgixI355veu5j9dVheLE2+IXtyMZmDZt/m3Oa22DK/kBAchaZJ1PTadP1uSMahdWH7ZL6QqistYgxROCsHqP8UHNk14+HRgKielnO/7TAj5Kz1x0Qk/52TgYqCnOg5GFMz1B6CWotmDaBrv54w== 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=xIq0W/PnAZIi869tPmDsIxtj5H8MskytOaz/voqSNAc=; b=r108NiydnkmfMFUpDJ/LOWV8TPr6PPoHQUFaty327iaNN9v2OSECYsdiBHJPBWkJtYIT7a9PIzOpRAJOJzgSQodNoGo6k8J7LbulhmIkjMVHMSTgXxMRTDnzXOc+0lXoxIgF/v6+LQEiZGnYuJ8R5gz9CnVfEgFGPukrlyJkBWQ= 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 VI1PR05MB4464.eurprd05.prod.outlook.com (2603:10a6:803:44::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.22; Thu, 11 Jun 2020 22:48:00 +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.3088.021; Thu, 11 Jun 2020 22:48:00 +0000 From: Saeed Mahameed To: "David S. Miller" , kuba@kernel.org Cc: netdev@vger.kernel.org, Dan Carpenter , Saeed Mahameed Subject: [net 10/10] net/mlx5: E-Switch, Fix some error pointer dereferences Date: Thu, 11 Jun 2020 15:47:08 -0700 Message-Id: <20200611224708.235014-11-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200611224708.235014-1-saeedm@mellanox.com> References: <20200611224708.235014-1-saeedm@mellanox.com> X-ClientProxiedBy: BYAPR06CA0066.namprd06.prod.outlook.com (2603:10b6:a03:14b::43) 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 BYAPR06CA0066.namprd06.prod.outlook.com (2603:10b6:a03:14b::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.20 via Frontend Transport; Thu, 11 Jun 2020 22:47:58 +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: 2616f3ba-6844-41b5-d8f5-08d80e597d92 X-MS-TrafficTypeDiagnostic: VI1PR05MB4464: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:576; X-Forefront-PRVS: 0431F981D8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LQ3o9lYDFcsIFDWzDJ4KIK40znIfB8fqwKyYuCqW2LFQyb4rbFvBFtZnEGzCeqAFobYH3kqKLxRpXM0CiK2nB299dRhC4vf/klEMEC3uFzMZvkrBTs8WNNarEVW13BOIBquBP1fMbnp8wtcAVzD3g6FVP+h19zTUIMwc8rls64PFN+BDEiYAbpT8kjg+doMNV+udjWGgtnuxRpnmqPosFlTmseHWXRNcQAYOFC6psE0ctJeORcf4RqQKGgVGPQh6cu+J9CuayImizNCPcH0K1pdGzsaSrjQAKjjqFlfFG0y9Q6BF//EH+wuXIgoOcK8DlozwaauKpToEq97u8Xpgz0AobSp8WT2gZOaGS+RpyvgZ/28rRkGv5+lOOoCMaL2q 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)(39860400002)(376002)(136003)(346002)(396003)(8936002)(16526019)(186003)(4326008)(316002)(8676002)(107886003)(5660300002)(478600001)(26005)(956004)(2616005)(6666004)(66556008)(86362001)(6512007)(6486002)(66946007)(54906003)(1076003)(6506007)(36756003)(66476007)(83380400001)(2906002)(52116002)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: lhtF4NtBb5rEbyr7UN2O8fwbWKfhQX3xON1wBWvgG7Gxnlflxpsv/p+Xw7/6vY4topwKjzBiUBwd9+ULhdEliy0JchdgpZis5R9hq4V2YOMeD5Qru39rTLCO4VwrUSHsBn3dXA+PBJ8YN0bRITOaVKSUszV5m2r8IEvpJGKKTVHfBaSQdLLXLMRmdG5gLoCpcdOsfS/NLlH/gSffrXuwjfcAgZQ1Xz31Do/xZuGbxi0Iug4RSzFA3DInXyEXJjyoWhYmhpJ4XavQgvorruS90ShBrm9tL0xl/TFdQiuJ2dSLQ1Z0Uu+eO5Jvgte7G4o8LGKieTSqSKZ/rnP/BQNUHKNNEKP37PAf8DwDerU6e+aQh3GqLyUIzjPQSUccEYq8HihC66cQ17bsmRhdtwcz/E9ouoXSfYnwP0gcdvEenYOetb7G8lbfhLyENznLWyvX35A0BYQQp0pXVJSoVapPVNHHQY0ltWugtuAbYwR7gcI= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2616f3ba-6844-41b5-d8f5-08d80e597d92 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2020 22:48:00.0975 (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: YvlZcRnFZkfviQBwEe+y3/XTksQ25Aqh2e02p/fBKDgHtPuk5F5qEwdcqmWp/ofdIpraU8XyYma+hs307fdtFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4464 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Dan Carpenter We can't leave "counter" set to an error pointer. Otherwise either it will lead to an error pointer dereference later in the function or it leads to an error pointer dereference when we call mlx5_fc_destroy(). Fixes: 07bab9502641d ("net/mlx5: E-Switch, Refactor eswitch ingress acl codes") Signed-off-by: Dan Carpenter Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c index 9bda4fe2eafa7..5dc335e621c57 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c @@ -162,10 +162,12 @@ int esw_acl_ingress_lgcy_setup(struct mlx5_eswitch *esw, if (MLX5_CAP_ESW_INGRESS_ACL(esw->dev, flow_counter)) { counter = mlx5_fc_create(esw->dev, false); - if (IS_ERR(counter)) + if (IS_ERR(counter)) { esw_warn(esw->dev, "vport[%d] configure ingress drop rule counter failed\n", vport->vport); + counter = NULL; + } vport->ingress.legacy.drop_counter = counter; } @@ -272,7 +274,7 @@ void esw_acl_ingress_lgcy_cleanup(struct mlx5_eswitch *esw, esw_acl_ingress_table_destroy(vport); clean_drop_counter: - if (!IS_ERR_OR_NULL(vport->ingress.legacy.drop_counter)) { + if (vport->ingress.legacy.drop_counter) { mlx5_fc_destroy(esw->dev, vport->ingress.legacy.drop_counter); vport->ingress.legacy.drop_counter = NULL; }