From patchwork Fri May 29 06:56:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 218232 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 2B915C433E1 for ; Fri, 29 May 2020 06:57:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 08287204EF for ; Fri, 29 May 2020 06:57:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="DSxLwQK4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726106AbgE2G5X (ORCPT ); Fri, 29 May 2020 02:57:23 -0400 Received: from mail-eopbgr130082.outbound.protection.outlook.com ([40.107.13.82]:44867 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726041AbgE2G5W (ORCPT ); Fri, 29 May 2020 02:57:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yi/OQLgtLDlCcAx0l5/aCMOHT0ip8wc3KfNB/A9Xz0wuZ33ZP/4h2tflIguHhjTGVoMWEKWU4NuSQ23GHYHW6DSrO1BJJ4eL2w6fVQZfRbUcsL46Ba9YKZzaA1quZj43FoBQhIRLV7+CNBToWX6gjTpyV8J+duoz50KBN4a9GIKVCjIo+vk1BR3brggPDAyPm+UQYiN9P7RLu5A4/Hzmn7NOzh7hwMQIBKSTPfiE/GtHSyKJHOgtcVXyUKj6o8B4M5DKNRCoCfy3ogxmRMQj/H637mDlK49f5WXBEjiRpDmoiYM6d5pXCJgCoKIUjFqXAuez0C42U948MT64ZzG2Sg== 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=Bx+BrsDz9hr1TCdq7J2jSPh9lErbDMzKJlkwI7D2s2c=; b=fEhXE4lfWD7xVqR2rFpiFcLXXvlOeG7HrOvsleVff5hxpq+F+mARk1DNr/AADsp8Bi6cXBd+63AewBavJvbKRP/OwwbgKGT1SeH3wxaJgpgxRNcTfhC2f6BQKDuQsb27ETfvK5m6kGqXy/GsUKfeo6YBsJ31hlOK0qC0EM+CSn8/u3UyOeT7stTLIkkYmHlUCFq5iF0fjMO5LZfXthzZOFQolpNBkoIW7avLkSB9TCOm+bxdZlCNQ7tOVkqEhsbHNNfdz8DCZEUNxHJ36psrjVaDRIk0L0uL2+SrmNW7m89tmtcuPfVLcCeCc8zD69azylIoN2Q9mvlgbg+eKC8/Kg== 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=Bx+BrsDz9hr1TCdq7J2jSPh9lErbDMzKJlkwI7D2s2c=; b=DSxLwQK4V/OaHlqdQTEFp2r1wN/EMDVVhjkzQhIlSuAuk+z1b4Mcz08siKB2d9L0dlpEOSF9PoI+ansT7F+86m2cfmPb8obUh/QRuD52Wmjch6nPZh7NmXm2XuRDdJDM5rQvP9Wj/YsJPFoVqoo17gKXEk3Mk8acPp5wQzHi6/4= 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 VI1PR05MB6640.eurprd05.prod.outlook.com (2603:10a6:800:132::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.21; Fri, 29 May 2020 06:57:16 +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.3045.018; Fri, 29 May 2020 06:57:16 +0000 From: Saeed Mahameed To: "David S. Miller" , jakub@kernel.org Cc: netdev@vger.kernel.org, Mark Bloch , Dexuan Cui , Moshe Shemesh , Saeed Mahameed Subject: [net 1/6] net/mlx5: Fix crash upon suspend/resume Date: Thu, 28 May 2020 23:56:40 -0700 Message-Id: <20200529065645.118386-2-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200529065645.118386-1-saeedm@mellanox.com> References: <20200529065645.118386-1-saeedm@mellanox.com> X-ClientProxiedBy: BY5PR03CA0027.namprd03.prod.outlook.com (2603:10b6:a03:1e0::37) 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 BY5PR03CA0027.namprd03.prod.outlook.com (2603:10b6:a03:1e0::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19 via Frontend Transport; Fri, 29 May 2020 06:57:14 +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: fac067db-52d4-4292-727e-08d8039d85c9 X-MS-TrafficTypeDiagnostic: VI1PR05MB6640: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1227; X-Forefront-PRVS: 04180B6720 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OI6BSg0coVslRpnBKAgcOfsq8AbZNX86GxZAwc4xJNFIC2gLFu0NiFo9WzZVbD8inpNyeXXl+SVMvaYHOt/X5yrrhUzDOU0jyykDMjUtCviRD73Q8uqy7JSp9gOc/NLLfp+BdNZyo7nwOhYwNr77JF6fF3Rgm4PWrpFFT2yJoJNRUpzuoX1iFe+Cc6Vk+yQIOwA/Vc+DB/z+YRO1Xr7SkwYkNquJ9VL+3kwnZb/BYewx3lNq9qYECNSBY6ygxaWdh/SAZAGEXSUrl1sVxqFKP74Sitqi2wCXPWLO1sMtUw9AykNj6vyME7titLtIuqjhugaImbYboqTUf++4KSBoO8DUKA6ja26a2lqwVFaBADZFLplf47XVacqmYkf0H+nM 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)(396003)(136003)(39860400002)(366004)(83380400001)(15650500001)(107886003)(2906002)(5660300002)(6486002)(6512007)(86362001)(66946007)(4326008)(1076003)(66556008)(66476007)(6666004)(54906003)(52116002)(8676002)(36756003)(316002)(45080400002)(8936002)(956004)(2616005)(186003)(478600001)(16526019)(6506007)(26005)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Z7CyOzW5JpVewAfk4VihsEp9FXs0rHbs7Cci/+MVkGQYrP9+Fb6W9iPEiVtM4KC7fCvbRLkLHJe+wNoRASyl94OVfexbRBo8ZXlz3YqFx6sy0EMHer3y5wbAX27Qh8iQmimHoKeu9B/BDEnljxoh+OjQE6FLhwM3ToBbV88UrXahL/xW0gZjCdfD8gdcmiesyrdiklUcFfRRtZmepZ7B4MzOxW3raMDfeKWAqYwQy/Ma7M1oacFMbTqD3rTalYcAklYzIl5vnD9mMDvdmGuOeR4OP/JDcFx5XeiE5l6jbC7GHDT+zPuQMVkT+B2T0NFSs9WwGSwovLZC/dwbMuff71EOxA3kWFLTMiJLLIKZpConPB6IWS1DaOzpbkFSzZ/syMkmoxXaO/9JJ496F6kXofdAqSr3VDuMAvc9mkvGImMb1tn2ZuXarWm2zByHxjYOGvbdYKwrfGw6ecJHRRbb6xWAfpyLy8LCZLTgQxW0M+Y= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: fac067db-52d4-4292-727e-08d8039d85c9 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2020 06:57:16.3994 (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: euc77adg3XYlTrrdgmVi8BG93uCpLe71t+1JSKCeO2RyKUpJhaBOz0668CQnuZkEWwrjcJ1UAFVWsGVHCPOSZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB6640 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Mark Bloch Currently a Linux system with the mlx5 NIC always crashes upon hibernation - suspend/resume. Add basic callbacks so the NIC could be suspended and resumed. Fixes: 9603b61de1ee ("mlx5: Move pci device handling from mlx5_ib to mlx5_core") Tested-by: Dexuan Cui Signed-off-by: Mark Bloch Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index c1618b818f3ab..17f818a540903 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -1549,6 +1549,22 @@ static void shutdown(struct pci_dev *pdev) mlx5_pci_disable_device(dev); } +static int mlx5_suspend(struct pci_dev *pdev, pm_message_t state) +{ + struct mlx5_core_dev *dev = pci_get_drvdata(pdev); + + mlx5_unload_one(dev, false); + + return 0; +} + +static int mlx5_resume(struct pci_dev *pdev) +{ + struct mlx5_core_dev *dev = pci_get_drvdata(pdev); + + return mlx5_load_one(dev, false); +} + static const struct pci_device_id mlx5_core_pci_table[] = { { PCI_VDEVICE(MELLANOX, PCI_DEVICE_ID_MELLANOX_CONNECTIB) }, { PCI_VDEVICE(MELLANOX, 0x1012), MLX5_PCI_DEV_IS_VF}, /* Connect-IB VF */ @@ -1592,6 +1608,8 @@ static struct pci_driver mlx5_core_driver = { .id_table = mlx5_core_pci_table, .probe = init_one, .remove = remove_one, + .suspend = mlx5_suspend, + .resume = mlx5_resume, .shutdown = shutdown, .err_handler = &mlx5_err_handler, .sriov_configure = mlx5_core_sriov_configure, From patchwork Fri May 29 06:56: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: 218231 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 AF49FC433E0 for ; Fri, 29 May 2020 06:57:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8505F2074D for ; Fri, 29 May 2020 06:57:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="cvqtSdvy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726398AbgE2G5b (ORCPT ); Fri, 29 May 2020 02:57:31 -0400 Received: from mail-eopbgr70044.outbound.protection.outlook.com ([40.107.7.44]:29351 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725988AbgE2G5a (ORCPT ); Fri, 29 May 2020 02:57:30 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VHMQIij76sSy4MqWN1/76/OVp+Xl8vBDiZxcaYefaqNh4BEMcBy5Ps+IkiMgtWpfkjk+e7ypa9i1c12I3HIVazZT8fHS0yXAy4A4vfnfTr0MR0zXt7wgd0gX8Nl6zDQ7m5jZ+lhobyG1yG7QR7JcyDAjeV97waHZbtIAxdzfMYHPvQ6NOU7lQ2mnM58b0v0nNAPaESDrCUookpyApbPFg9BjjkzPBrJafBkUn67QueuodXwF+26GYYjUJ3VENMCaEfN/CMD+6mrBC2Dh5uMEnhib07Gn6+Bslh+wgPH47MsZ78b9yMvMfGuPytqmtksOAjRh5yInKF5P+bgv3jByXA== 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=UaxE6wmNqatoj+cYpNIoKtsj/UkbrcSshsHd6A8BkDY=; b=Mq8Td6+JU8dMFQzJ6H2HmzRPGJBUDLEDfkSO/3ho1YDlaTUodYk/f8m31XRBGN/bL22jCPBFHaUxNr5P5eKcqJNzgi8npLLqncAknwwJPT2RciHqkNKFhKM1nEdsQjT77sbX5Ll5cGJVn6snL3DyE2mUZ2K6W9NI57axNJk8OEg0obzzaziB3GGDX65tXfu3OEwnEuWL3DtYFVUVcLOZvJgVfOcIMAdU1qLRp4KCZrZ8gVxWxnnMHfzBg6ACkLbz8/VnTNw6OaubGkhWxbZfkDsjI90Kt26YUKgbKuKcMZFarfMTEu/oI0ki7X79uDH2LCaQ1NiZtbdnqRlNxt89cQ== 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=UaxE6wmNqatoj+cYpNIoKtsj/UkbrcSshsHd6A8BkDY=; b=cvqtSdvy8Hq5Zt8PiDqPBkG4SUmfEw8Yy0AHXwVaCIjoS7mMzZNLXAYr5ittJP2JxTxAOyzMCreZjUlX5ctwvW5ogt+lQXSBl7PpBKbUnYWQNGbOef1p0YpeA2q6p2u47htTTzGWEkC8eGfb/cz3qCPs+B9Ypm4JDPNq8krwmqo= 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 VI1PR05MB4189.eurprd05.prod.outlook.com (2603:10a6:803:45::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19; Fri, 29 May 2020 06:57:23 +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.3045.018; Fri, 29 May 2020 06:57:23 +0000 From: Saeed Mahameed To: "David S. Miller" , jakub@kernel.org Cc: netdev@vger.kernel.org, Aya Levin , Tariq Toukan , Saeed Mahameed Subject: [net 4/6] net/mlx5e: Fix arch depending casting issue in FEC Date: Thu, 28 May 2020 23:56:43 -0700 Message-Id: <20200529065645.118386-5-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200529065645.118386-1-saeedm@mellanox.com> References: <20200529065645.118386-1-saeedm@mellanox.com> X-ClientProxiedBy: BY5PR03CA0027.namprd03.prod.outlook.com (2603:10b6:a03:1e0::37) 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 BY5PR03CA0027.namprd03.prod.outlook.com (2603:10b6:a03:1e0::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19 via Frontend Transport; Fri, 29 May 2020 06:57:21 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [73.15.39.150] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3e369f84-bfdc-4202-6e9f-08d8039d89cf X-MS-TrafficTypeDiagnostic: VI1PR05MB4189: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1360; X-Forefront-PRVS: 04180B6720 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lHHHnwzfqCaHIfy4mXOqnVbNoThVvphpHzyNFQxXdHKY8IwgQvxqV1bilkkMOIYbxlo3/UIVt1XwMulErxgKHfj8NEOMVQvmKL3k0EXaBhndXeDsFRP5oK/tZYgtglZlEUUnoXbls2GE1RzpaZI64BUyJQxs417vb1nhXjvSGr8Ebq+Iqr0borkof22ttrp1MdzrrszT8tTlh9xUl8EUeaOTeTs2TY+s5N/Ayo1+H0BLcHL+XCcjsaff77NAN3RPvybxkqwneF4uTkhxfXGjM6gZk1YkbIR0tYdg0zD+cxnHAwJH9fOi/VFrQB2Tje/Pd+KPprQrQy1fuqYkZi3mPASFOO2MF0G0BtEf1RYGn2/V6pevEHu4OWfqnEmQ87yY 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)(346002)(376002)(136003)(396003)(39860400002)(26005)(1076003)(66476007)(8676002)(54906003)(8936002)(66946007)(66556008)(2616005)(107886003)(5660300002)(956004)(83380400001)(6486002)(6512007)(186003)(16526019)(52116002)(4326008)(36756003)(6506007)(2906002)(86362001)(6666004)(478600001)(316002)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: fLQPaZYYyKVxKjURmBLZam8qoyKBj/uqvvoburuiqOkaQyclJx5PuI4o2HF774bw8+xJtYAoBtvFUNKj6TAZnFoiEYsUARgWiYcsXNIFMEaCPQBRwgf3DGUFoEd4hMs593oH8lTfKz4qEJnnFNXF/BDECl13+EeqfqZgHjDB5NXuGSq0R8XQo57KrPqu2ihOh/7ylTFqIEv8Hwp2nJqaqZUbsYjQrAelO/fXCYUk+2doGwBueADablIWjsv8cxGevskXVjBB5uCqnszd8Vf9oe6xKyqYeQTktC1oGFiwhOzr8WJoh/wqBYIcgrBJboeRfpHq+Ks5QoBj2Qgqt6qnFr0mDa300tfm8IO6nGptqq7C2DePhDq2xgCfq7GENsfT7aRmz2+N4V9opqB/lC+msP5xvmB9kVHursTITuD9jNpQrF5hGd9V4C1Sqcc2ULj0jiLypPppOBItY9sFO1xJ9y2LTfyYUyCc9NoCvvLYgPA= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e369f84-bfdc-4202-6e9f-08d8039d89cf X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2020 06:57:23.2275 (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: KGvcPz1heWD+OrVmIWBIH0xmQlr+LUxTIDQm0IwfiQNilCQyMW3j4+kicZGgbzTPCEVroxCit8N9JHwJmaJ00Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4189 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Aya Levin Change type of active_fec to u32 to match the type expected by mlx5e_get_fec_mode. Copy active_fec and configured_fec values to unsigned long before preforming bitwise manipulations. Take the same approach when configuring FEC over 50G link modes: copy the policy into an unsigned long and only than preform bitwise operations. Fixes: 2132b71f78d2 ("net/mlx5e: Advertise globaly supported FEC modes") Signed-off-by: Aya Levin Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/en/port.c | 24 ++++++++++--------- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 20 +++++++++------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/port.c b/drivers/net/ethernet/mellanox/mlx5/core/en/port.c index 2c4a670c8ffd4..2a8950b3056f9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/port.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port.c @@ -369,17 +369,19 @@ enum mlx5e_fec_supported_link_mode { *_policy = MLX5_GET(pplm_reg, _buf, fec_override_admin_##link); \ } while (0) -#define MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY(buf, policy, write, link) \ - do { \ - u16 *__policy = &(policy); \ - bool _write = (write); \ - \ - if (_write && *__policy) \ - *__policy = find_first_bit((u_long *)__policy, \ - sizeof(u16) * BITS_PER_BYTE);\ - MLX5E_FEC_OVERRIDE_ADMIN_POLICY(buf, *__policy, _write, link); \ - if (!_write && *__policy) \ - *__policy = 1 << *__policy; \ +#define MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY(buf, policy, write, link) \ + do { \ + unsigned long policy_long; \ + u16 *__policy = &(policy); \ + bool _write = (write); \ + \ + policy_long = *__policy; \ + if (_write && *__policy) \ + *__policy = find_first_bit(&policy_long, \ + sizeof(policy_long) * BITS_PER_BYTE);\ + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(buf, *__policy, _write, link); \ + if (!_write && *__policy) \ + *__policy = 1 << *__policy; \ } while (0) /* get/set FEC admin field for a given speed */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 6d703ddee4e27..6f582eb83e54f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -665,11 +665,12 @@ static const u32 pplm_fec_2_ethtool_linkmodes[] = { static int get_fec_supported_advertised(struct mlx5_core_dev *dev, struct ethtool_link_ksettings *link_ksettings) { - u_long active_fec = 0; + unsigned long active_fec_long; + u32 active_fec; u32 bitn; int err; - err = mlx5e_get_fec_mode(dev, (u32 *)&active_fec, NULL); + err = mlx5e_get_fec_mode(dev, &active_fec, NULL); if (err) return (err == -EOPNOTSUPP) ? 0 : err; @@ -682,10 +683,11 @@ static int get_fec_supported_advertised(struct mlx5_core_dev *dev, MLX5E_ADVERTISE_SUPPORTED_FEC(MLX5E_FEC_LLRS_272_257_1, ETHTOOL_LINK_MODE_FEC_LLRS_BIT); + active_fec_long = active_fec; /* active fec is a bit set, find out which bit is set and * advertise the corresponding ethtool bit */ - bitn = find_first_bit(&active_fec, sizeof(u32) * BITS_PER_BYTE); + bitn = find_first_bit(&active_fec_long, sizeof(active_fec_long) * BITS_PER_BYTE); if (bitn < ARRAY_SIZE(pplm_fec_2_ethtool_linkmodes)) __set_bit(pplm_fec_2_ethtool_linkmodes[bitn], link_ksettings->link_modes.advertising); @@ -1517,8 +1519,8 @@ static int mlx5e_get_fecparam(struct net_device *netdev, { struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5_core_dev *mdev = priv->mdev; - u16 fec_configured = 0; - u32 fec_active = 0; + u16 fec_configured; + u32 fec_active; int err; err = mlx5e_get_fec_mode(mdev, &fec_active, &fec_configured); @@ -1526,14 +1528,14 @@ static int mlx5e_get_fecparam(struct net_device *netdev, if (err) return err; - fecparam->active_fec = pplm2ethtool_fec((u_long)fec_active, - sizeof(u32) * BITS_PER_BYTE); + fecparam->active_fec = pplm2ethtool_fec((unsigned long)fec_active, + sizeof(unsigned long) * BITS_PER_BYTE); if (!fecparam->active_fec) return -EOPNOTSUPP; - fecparam->fec = pplm2ethtool_fec((u_long)fec_configured, - sizeof(u16) * BITS_PER_BYTE); + fecparam->fec = pplm2ethtool_fec((unsigned long)fec_configured, + sizeof(unsigned long) * BITS_PER_BYTE); return 0; } From patchwork Fri May 29 06:56:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 218230 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 93EE7C433E0 for ; Fri, 29 May 2020 06:57:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 71816204EF for ; Fri, 29 May 2020 06:57:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="M1UsRHhn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726453AbgE2G5j (ORCPT ); Fri, 29 May 2020 02:57:39 -0400 Received: from mail-eopbgr70044.outbound.protection.outlook.com ([40.107.7.44]:29351 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725790AbgE2G5h (ORCPT ); Fri, 29 May 2020 02:57:37 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vyev2Kwa7VMZNRCLKXxwnKM4FxDLAZxlIOb+XzrzLJVdisB00czO+iL/pJT0lxZnqHGVTsw+RpGAAoEo3nUbVBlJpRE9ta64VmemUNOFpw1NIxtgGlcE4lMpWNfegzX7X+NwtI5bZn9038I092wnoZOM0ixeXs8RQG/mjPcIVmvcy1+4CHpajXbdtN1acGEIf89lMGqn32kovO4/F0QBl0fdRvxMEaKMuCBbkdeLGy8OhDZSUFn7XnGieIXcJQjwxJPdyYFl518D2eo9x1YHL2xADueLMNol42ynBz8CY2rdz4cTbk09w8yTF8QIS9XWzZvD2rnqoN71tT3kuRMSpw== 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=BQlWUT61fbhYKqM6r+Haofk/+fdl5bDfZSmt9Y8fXh0=; b=FPm4DV3bnha6KY2tvgWIP9QbGouTqA/7CkDYVoLOctPQg0261jnJ0S+g1Nrc5EsPrR/UdJpc8riUIJTsS4MbbePOIf0wN4IqQrAflbAA0CrHLrL0yrLasAYGlSBztX/Vnz6ubIQoz1ZjqpaL1jVRgWACeXpKFsQVOFR604fMVdW8Rs/1j/eE1J+GvJQS+qEo2CFExig7ZubjqPEhjKi0obWRrYXMyjB69Sns61sko5Rj3c8rNHt14oxUNaV3BITpLFUjxBHCnSJysrXa1tU7RMMc+ApxnnAND0QXBNXZ7d/M9i68iHH/H9YitIua5NQLndNyPaJv08fZd4W6DxMBEA== 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=BQlWUT61fbhYKqM6r+Haofk/+fdl5bDfZSmt9Y8fXh0=; b=M1UsRHhnaqXojDG+HO/mPWifWxyvIgzVFZfNB3qzFtRtrH23BHXxGo2IcXqZ/hRojEnbkFrZ/qSfIEXsyc+4TSRfILXHdTFUT7h8KRhzCLgD/6xvUJYj9pVQiGGQgMuc0GZRsFSEVOtyNHkM6NU8Oy5h5kVMMLBiBT8S4Jg3/R8= 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 VI1PR05MB4189.eurprd05.prod.outlook.com (2603:10a6:803:45::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19; Fri, 29 May 2020 06:57:28 +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.3045.018; Fri, 29 May 2020 06:57:28 +0000 From: Saeed Mahameed To: "David S. Miller" , jakub@kernel.org Cc: netdev@vger.kernel.org, Vlad Buslov , Roi Dayan , Saeed Mahameed Subject: [net 6/6] net/mlx5e: Fix MLX5_TC_CT dependencies Date: Thu, 28 May 2020 23:56:45 -0700 Message-Id: <20200529065645.118386-7-saeedm@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200529065645.118386-1-saeedm@mellanox.com> References: <20200529065645.118386-1-saeedm@mellanox.com> X-ClientProxiedBy: BY5PR03CA0027.namprd03.prod.outlook.com (2603:10b6:a03:1e0::37) 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 BY5PR03CA0027.namprd03.prod.outlook.com (2603:10b6:a03:1e0::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19 via Frontend Transport; Fri, 29 May 2020 06:57:25 +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: be18cc37-bb6d-433a-0796-08d8039d8c9c X-MS-TrafficTypeDiagnostic: VI1PR05MB4189: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:397; X-Forefront-PRVS: 04180B6720 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4do6D6VhCl1CYaDHZqQvXuERLq3rDTOTB1mzoTQWsYonWTqOvkNc+zLNNPG3VdHPIqlS21rHd7t0BEaAetdYYstjGK/1z+akdwwN5E7v8KeVE5o0LqG8i1si7WLsNv5d7zzjGqnp3yPByRYSPjBsOulubRHuQF4yGyLEVSoFnyDj1mq9GvC5TMlsAFTlVdDsGYJfzJMRxhP+2edPdFoLQXAmYyRVReCzXIqjOiPtGYEJ3AiKwmn68f8Utwh6L+jju3HEJwgogwY0Mz5xMNb/d8KMDubIqxw6GTjRwlVtSFLIMmxtKWyav1J9VM6Pu6vvAqnFQw2r/MBdDI/fq3adnTCeDy48R0ofVbWhZSTejoFJv21Eie8Aqv9Dp+5MkpgR 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)(346002)(376002)(136003)(396003)(39860400002)(26005)(1076003)(66476007)(8676002)(54906003)(8936002)(66946007)(66556008)(2616005)(107886003)(5660300002)(956004)(83380400001)(6486002)(6512007)(186003)(16526019)(52116002)(4326008)(36756003)(6506007)(2906002)(86362001)(6666004)(478600001)(316002)(54420400002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 04EuRmXZFmBXAlu2DkPySoEoSmCHvWHpLynCWgWpEU7nVtR4SXJnzb33Q1omenpzPCEwrLHCKNyPqrQSgaOT4mfYHI3vU2Y57EhJvupXiozJlw0biDmDci4bcFmGMj7v6E+qyECC6tjPCPdSpLPbFtchgkgpoLyjr90V1Cpu93Z1wCMMhUz9DcLdfzI4pr6f0IyBlpghOO8a/j9en4sl3WPQj6xH+u5XH9CxlGGeHsHQTZVKSq1408XavbjEmJLZPDtZ7uJ4/e8GQ4G7rHFZvZBbANa2UIr5L9us0wZPX6AhQrCRIV9lNAi/9hERQTSklSufMQTnc8I+/+yzNdL9qK3VMioxY4NfdpupqrTOMzDWtUnIMzSrZqS0OTzH1QDN+xV4FgPaytPV53R4MSmR4WnU8pOvYo3IqBfKrweWG93wA5c/+A/TBd6EWvockPEBMVAc7oQN9T9D0HQgmkr+3ZbAZOeBvWIQ7gm97SaGIZw= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: be18cc37-bb6d-433a-0796-08d8039d8c9c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2020 06:57:27.9678 (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: pj2D7vMyscBdMwYfyew4HH4vktQ0VCKXXBVEUhxxVqa3XXXC2Fg1k1HpQfab93YrEKoJdP5xIPWd/7j0wp+ANA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4189 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vlad Buslov Change MLX5_TC_CT config dependencies to include MLX5_ESWITCH instead of MLX5_CORE_EN && NET_SWITCHDEV, which are already required by MLX5_ESWITCH. Without this change mlx5 fails to compile if user disables MLX5_ESWITCH without also manually disabling MLX5_TC_CT. Fixes: 4c3844d9e97e ("net/mlx5e: CT: Introduce connection tracking") Signed-off-by: Vlad Buslov Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig index 7d69a3061f178..fd375cbe586e1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig +++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig @@ -80,7 +80,7 @@ config MLX5_ESWITCH config MLX5_TC_CT bool "MLX5 TC connection tracking offload support" - depends on MLX5_CORE_EN && NET_SWITCHDEV && NF_FLOW_TABLE && NET_ACT_CT && NET_TC_SKB_EXT + depends on MLX5_ESWITCH && NF_FLOW_TABLE && NET_ACT_CT && NET_TC_SKB_EXT default y help Say Y here if you want to support offloading connection tracking rules