From patchwork Sat Oct 30 00:54:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dexuan Cui X-Patchwork-Id: 12594063 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CEE6C433EF for ; Sat, 30 Oct 2021 00:54:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E613061165 for ; Sat, 30 Oct 2021 00:54:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231520AbhJ3A5K (ORCPT ); Fri, 29 Oct 2021 20:57:10 -0400 Received: from mail-cusazon11021027.outbound.protection.outlook.com ([52.101.62.27]:23128 "EHLO na01-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231286AbhJ3A5J (ORCPT ); Fri, 29 Oct 2021 20:57:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bzgUtaHDrsq6q7+3Mle8pXp1G3iViv52HHLywokl2lKe4qYT0fJscWxKjOgQ5waAU186JWlwa4f39jjusxa32t+kqgcLSZXMemQgVBrsrPhqCSSKuJpqEYZwHOLbCe8xaIoddMU9uPSu/XQvfz2a206epqeQbyWR/QeaYu+i0nJldNel+Chb5SJ2PKE/gFtWgRiQ55ilLy+MlYdY27vGAnLAbS8g6sZyN3HUpiGq+LK0qH0Luy6aBAH6/jtZ7skdu3zPbfKB8MYIn3OSy1tz8lEexlDy0xajDN2fpAP5GTpU7E95NKLmtHmB2/HAFkxxxODNDfEmkrF5Tm9eQVOE+Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tCSF9oJ0wneBcePeooOP0wgTGzUn2QDAqbjau00PpZA=; b=Nn03XZZ29dVwsBfpOaOMprMwfEmFUvYV1OsVC5jaAIB7hwcO4XFikv3y53n4scEFRwSb4KTd6Ukj60re0XGTUX3TsiL3LIbOLtdGcIJG959YR5C8N9Tft+exeHJqJIq60U4rYNPqA47RMrO4Kj0m3A65jW7rT9gSXpUSZKcFKFwnPOEPSyKHnr9Mhubo4DBvBcfnvgWS7esYcAEHK9A5jAjF101Z2CAfrFexHNzF3D+VbAk8122Q4RTqZFTfmX07vbbX4z09UsJA6MVil0kInw5EZWeH30QgNXLlm4D3kctB8g17enml4NAUHoPUjpKN+EhtHbCkcMWXzFgnncM2Og== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tCSF9oJ0wneBcePeooOP0wgTGzUn2QDAqbjau00PpZA=; b=FXD5EQrBRVORih3erEIKesz9iPy0n8JHfdZdPY8TLrGqK9S4cDsJEbuwob74A7ldqE8/RBGudYSQjdNWZQ5g2rVuWfqPLnneZjpcwRJ+mlz5yyfMljFT4fhlGwfAtYq4gyq/1iN5VdE00Cnz+SGrGt3NvE7WqCLo08afd8HK6eQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from DM5PR2101MB1095.namprd21.prod.outlook.com (2603:10b6:4:a2::17) by DM5PR21MB0827.namprd21.prod.outlook.com (2603:10b6:3:a3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.6; Sat, 30 Oct 2021 00:54:30 +0000 Received: from DM5PR2101MB1095.namprd21.prod.outlook.com ([fe80::c0b9:3e28:af1e:a828]) by DM5PR2101MB1095.namprd21.prod.outlook.com ([fe80::c0b9:3e28:af1e:a828%4]) with mapi id 15.20.4649.010; Sat, 30 Oct 2021 00:54:29 +0000 From: Dexuan Cui To: davem@davemloft.net, kuba@kernel.org, gustavoars@kernel.org, haiyangz@microsoft.com, netdev@vger.kernel.org Cc: kys@microsoft.com, stephen@networkplumber.org, wei.liu@kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, shacharr@microsoft.com, paulros@microsoft.com, olaf@aepfle.de, vkuznets@redhat.com, Dexuan Cui Subject: [PATCH net-next 1/4] net: mana: Fix the netdev_err()'s vPort argument in mana_init_port() Date: Fri, 29 Oct 2021 17:54:05 -0700 Message-Id: <20211030005408.13932-2-decui@microsoft.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211030005408.13932-1-decui@microsoft.com> References: <20211030005408.13932-1-decui@microsoft.com> X-ClientProxiedBy: MWHPR22CA0002.namprd22.prod.outlook.com (2603:10b6:300:ef::12) To DM5PR2101MB1095.namprd21.prod.outlook.com (2603:10b6:4:a2::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from decui-u1804.corp.microsoft.com (2001:4898:80e8:f:7661:5dff:fe6a:8a2b) by MWHPR22CA0002.namprd22.prod.outlook.com (2603:10b6:300:ef::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Sat, 30 Oct 2021 00:54:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1bf7f011-8c84-4d92-ff04-08d99b3fd426 X-MS-TrafficTypeDiagnostic: DM5PR21MB0827: X-LD-Processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gAPhdp5rdgDRoEals4jOkiK3BFjgKx0+ogcHuDyhQMKom5FY7yjhElJoKH38K3Y+h69x4ppezr2xUs+g551rzPgF0vNL6VeHjFqBkO/0oImqNgrS7Q9tgjWnL8AGiaDh+voQvMISt6JrgCBPX8/2lgNeJrdK70iugLO2MNGOvfFaxLBqDLwAQxswiFuwM4jr+RK7tcQa2Boq9OmssmzQ68Y3wtLL6lNVLuDI3jwCC3KpHWBpjbmyKjYygOmEnbDfTAyj8I5hGiPjSHQQMVMM306ESUK3Xen8pF9sUZY7cIsNnWAyMtwuNrSZr47V9TTUtQRkeA/1Fu6CtBus8yH5TkDTYzWYT3D9liTWetu/mHC0grvVR8oSftE5jMbrvAoVhRWUp0pPhI7Yp8da5t0U9mBeMZwJ75sl0V/JfrZFbynRvT/vC3/aDv+2Gl7aQ4y6BmLGoEO+ImYeqdIoVtdRV7/TnXqtvUR52hOxmqLZVMGKS95M5AFO7z4OiLYLijgkW+ygsIx7LQpFu1uVDMPy7gDYwzsULRbao77fdg6bD9EPsjuMEidFwr1oaSzJRp+gSbJKuA0YqH1YsZzNLsr7xObSMxdVk/izgWAMfpOyzwOdDuEOvqvDrUTCqa8NxGVtNJoHO1cByAE5J/hdeR28JA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR2101MB1095.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(4744005)(52116002)(7696005)(86362001)(6486002)(1076003)(83380400001)(66556008)(66476007)(4326008)(107886003)(66946007)(8676002)(2616005)(5660300002)(6666004)(10290500003)(38100700002)(82950400001)(82960400001)(7416002)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Z++RIIkLpnOo+R/THQi6KAOMLv6VXj+QXLzhFSZ8CTk6HHSwq2AWg8RzNBsi5ZuVlv9OLPG+JDbu5rJ5EraWbwTzgRAkTpcRmVoIqI7fFVWI/cG3VkEAYuiZRRW9uXFrvoY+Iv2Khd2qExrozONt9UYdfBuB43W2kThSvBhuqcvXeylF3XjBv67wn6v4+hs40DKNdG2Q8seFl8paHGCdqzQQahNrIgnBJoJgtxSPYLrSta1thUt21O9G5XJppn3PzUWQ1TtcUqIbYpGvWODij5TRsN9yeGsTr3XcFSQcIXrJRwN+fhIA85/7dgmjNvSTEY+fsFJrSwiKv4HmM62Mq247iHcJQAMMgSgZo965iUz4T/7oTnfZlrTNvINDonJtCI/+WhfUWMKx7oyPgLx6WEOVVB7wjhHOnxGt0Bsa6ARYucta5w0D7apnDIFJ/D2DoqgGCS5PeCe4lL8cr9BoEuYyFCTL5P+Nx4wYruf2PkK5gq+64Gp52Bh29/i3BXhf08Li8siF59Q1ZES7c1gKQYBTdDSSyTTVSAXxpb/vLlZ7f6FOXeW+Pd1bul2zrk4THRyPWd0Hv2nab8WpphF/bqWIb3ngjcwNzt45vAYv4vjSDS22hzeMl1FCa0RCOlrXD+RZ4/7nect+2snh05E+6YhrsNbVbwG3mQKh8m1y9Yxbw0L23xy1VnI83T70++dv/LBCPSdoFWLabgoj2dtwgsZX3l21kmqoKQBqCOk= X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bf7f011-8c84-4d92-ff04-08d99b3fd426 X-MS-Exchange-CrossTenant-AuthSource: DM5PR2101MB1095.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2021 00:54:29.8063 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qJxM53+vnT+eAeJjMNdy+jdwf2lwV3xdRPgV1qy7rgqK6QlqKL57T66c5x2hhAA3Q6mES9+I89hVAQ92jX/Jew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB0827 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Use the correct port index rather than 0. Signed-off-by: Dexuan Cui Reviewed-by: Haiyang Zhang --- drivers/net/ethernet/microsoft/mana/mana_en.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index 1417d1e72b7b..4ff5a1fc506f 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_en.c +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c @@ -1599,7 +1599,8 @@ static int mana_init_port(struct net_device *ndev) err = mana_query_vport_cfg(apc, port_idx, &max_txq, &max_rxq, &num_indirect_entries); if (err) { - netdev_err(ndev, "Failed to query info for vPort 0\n"); + netdev_err(ndev, "Failed to query info for vPort %d\n", + port_idx); goto reset_apc; } From patchwork Sat Oct 30 00:54:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dexuan Cui X-Patchwork-Id: 12594069 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B63AC433F5 for ; Sat, 30 Oct 2021 00:54:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1485060F4B for ; Sat, 30 Oct 2021 00:54:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231313AbhJ3A5U (ORCPT ); Fri, 29 Oct 2021 20:57:20 -0400 Received: from mail-cusazon11021025.outbound.protection.outlook.com ([52.101.62.25]:32445 "EHLO na01-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231685AbhJ3A5R (ORCPT ); Fri, 29 Oct 2021 20:57:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c9p4iDPzA86Lvvd7Hy3UFRCsgtYL9ZM/H7/8b5uCghPmGR5Cttx+PZzH5J5B4lR6YYOQQwgI3GOduorQNu9PUyUuzeih/u38EwC/pCM4457Hq4XI4vox/QKvxJZ5VbW4Rn0sHMWHdVPlj5/9j7FAGFh8ZYuLkds11Eor+h/IbvcAqnerc9DsIZjWJgxtZdbTotyviY0a1tsRdG1a9gOPCutj15l5ZD3kdrOpHzHYW+TAl81EPhSdUnWIzF8mAQTATg//ZGcXb4LQ3aC7fwnHm0A3PgRsJNzEhkOE0qvW9yZCSseQNXEoj0p6+ogq5Mboy42jS+pv0QX1lKIUTON8bQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=o+enMPXcBAT2/rjRco8lWVaQVZhSs6N8PbzxuoU4WOo=; b=g3U4egVLZruCx9q+tsrk/oJZBSEh6Nye7lAstfbkDv0pZRjWQeEQl2KafDG3JF7GKIEhj6doj5vv9V618Bb9dOSuI8ygIHBFsD6UY+rrghSrvPW+R37DhGsOtfDZbE/0MTErTt1qXCM1OzSUgtCXVx4UILQG2F313n9BrpzjoaxJWUW75lZHfVyoRZWf9ykWzrJmlyQBazzeiedWx3Dn0ESp/spfD+YKyg6VtYe12NumlWRLcddZprmQu+8IA9PqZeHxfE0nBviZzRUZLkGEMf2v2Xs9kLQVBjjV2uWtNwQcIegTjETkQ7GC1kHPJWK4ikHxMEfqto05hnVoNjcpbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o+enMPXcBAT2/rjRco8lWVaQVZhSs6N8PbzxuoU4WOo=; b=fS0E50/c+az/+GGjJ089oiR2dJydepxIqubJrDI9cfoJLZN1BGvRUKW5vdulfcXHk68dE4vESOT69l/HiQXe6ZtYbcjHEhx+2/IrPWKVvnxIawLorjb5NBmBTix8Mm3UnMWdf+4XoQTne50r5lVwgCoupRRLc28JR2/wKvdsRyk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from DM5PR2101MB1095.namprd21.prod.outlook.com (2603:10b6:4:a2::17) by DM5PR21MB0827.namprd21.prod.outlook.com (2603:10b6:3:a3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.6; Sat, 30 Oct 2021 00:54:31 +0000 Received: from DM5PR2101MB1095.namprd21.prod.outlook.com ([fe80::c0b9:3e28:af1e:a828]) by DM5PR2101MB1095.namprd21.prod.outlook.com ([fe80::c0b9:3e28:af1e:a828%4]) with mapi id 15.20.4649.010; Sat, 30 Oct 2021 00:54:31 +0000 From: Dexuan Cui To: davem@davemloft.net, kuba@kernel.org, gustavoars@kernel.org, haiyangz@microsoft.com, netdev@vger.kernel.org Cc: kys@microsoft.com, stephen@networkplumber.org, wei.liu@kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, shacharr@microsoft.com, paulros@microsoft.com, olaf@aepfle.de, vkuznets@redhat.com, Dexuan Cui Subject: [PATCH net-next 2/4] net: mana: Report OS info to the PF driver Date: Fri, 29 Oct 2021 17:54:06 -0700 Message-Id: <20211030005408.13932-3-decui@microsoft.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211030005408.13932-1-decui@microsoft.com> References: <20211030005408.13932-1-decui@microsoft.com> X-ClientProxiedBy: MWHPR22CA0002.namprd22.prod.outlook.com (2603:10b6:300:ef::12) To DM5PR2101MB1095.namprd21.prod.outlook.com (2603:10b6:4:a2::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from decui-u1804.corp.microsoft.com (2001:4898:80e8:f:7661:5dff:fe6a:8a2b) by MWHPR22CA0002.namprd22.prod.outlook.com (2603:10b6:300:ef::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Sat, 30 Oct 2021 00:54:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 23fc68f1-35be-441e-dec7-08d99b3fd4f4 X-MS-TrafficTypeDiagnostic: DM5PR21MB0827: X-LD-Processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6cg1RE6Zrj7J5c/Fn/cIrAVV9n6Y5ouZNZKtf2svuq7iJs5kf4hpeyIRh1e6r90XdfSQeCz8zEhiEgPoSaGpE/FZh2KaC3D0Pl0gQ6ytOMamySMeSh3y3ZGMbqd0qhVFXpj2qHn9KiXtnGfjVCJIFA7JzMbpA7nfZCcuVMMEdSEPmfv2dVc++LOUXWvqJ9BqoBBeOOcIFaTtgMbktFOLuihcJ6+hLwCd9JYd8nRTtdIeXoQOyM5gFjJ7DIrkovm8t5uSehpVKiV22GN7fURFV/Q9VZlBfsjuAZGtmCbb0RGF8dG+9VYt8Ys+UfRiyrsm5TwsSQs3AAsN/YimBxsFWmqYg9+hNbTIZIAvvXCKFNFaBHFT41ESFv+upcWNTBUsfDF8ZB90ssPyhf96HEd9odmaOEPRWVkNeC/Hg7yIFFStv1CE9Ey6ODsmsOOp37KYRr+o6GQjpLwOQcUsbUaL8ZqyKGY9vB5lT6S1WQXJ4sG37CV/FUwRNjOWq2hPFijYY9w+ZdSmC2XqDerlWo1xyIUDUsdl5K3iybmzp2Xjp5BBJqxto8Asc21LhxoBVOiyiWy+IA63cXp2PF9szBYsGrtLeF7EhA53sBHES9YpxCTUVe8Ix2I//8uOrsj7Kg9hErmRNUBlig5XpytaQljIyQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR2101MB1095.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(52116002)(7696005)(86362001)(6486002)(1076003)(83380400001)(66556008)(66476007)(4326008)(107886003)(66946007)(8676002)(2616005)(5660300002)(6666004)(10290500003)(38100700002)(82950400001)(82960400001)(7416002)(36756003)(316002)(2906002)(186003)(8936002)(508600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3xZCLbn1PF0u1E9ZAfd6LXgsjaVOFqIGWjqpwsYxGnrq+KxN0QhWl+TZVjnyFpHVyXHRCFhMJ47lBVAoapHEIBdkjx/jFAJ03LI1gNfjD3LkTvg1RpbKUu2ftmoyEsBwIhYL+ygDgS9VTNOVMizS459npb6oaCqehcn7sRkevRsVrxcAzwHxYX8IeXY1NmWKRCPISwv+s9M+5bxuBfKgO4BdxwAjKcpPif8nMs/MJCYEpcea0CJLEI16o25aZwDv0/iXQu+vboq2xEEdYx0NcS2XGpooI/Z/RWuMKspVOGNhmjA91U3uxoeJd7l8xQbXLWyomd9Q1Ed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vZ1X3Zd3Wo+5h+yS1LHX9H50vr1Nb2quJyWM98DFLK8I+S3u6jcVKSHFw6miMCkC608NYyF1+uRgHK/lSPjA8Mtbhacf9mqrFhGTgVDNJ1z7mZA76Bfeic2qrEuIOTC4YbsqNhpo07A4QfLlB9jeY+0+DA+yYSM+P5GDa6n99G6o26vKTWFqvVKzCsgx3GPlzh/JEB3Z2WI81EbENo0o2rBYx92IVSNlNKtzjJAIYfVXP79eOydDwuqJlPaCEeRfoycs8wsMc4gzN0KLP5/+kDw09sxTa0Gns= X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23fc68f1-35be-441e-dec7-08d99b3fd4f4 X-MS-Exchange-CrossTenant-AuthSource: DM5PR2101MB1095.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2021 00:54:30.8617 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ec5hqzbHelu9fEwsezqawgTy4yP0E2FsZxsQ1Cz17CBJTPgpNIZWNwisO8luhZuPcoFIJvkVzwjAUHe3ASkJfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB0827 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The PF driver might use the OS info for statistical purposes. Signed-off-by: Dexuan Cui Reviewed-by: Haiyang Zhang --- drivers/net/ethernet/microsoft/mana/gdma_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c index cee75b561f59..8a9ee2885f8c 100644 --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c @@ -3,6 +3,8 @@ #include #include +#include +#include #include "mana.h" @@ -848,6 +850,15 @@ int mana_gd_verify_vf_version(struct pci_dev *pdev) req.gd_drv_cap_flags3 = GDMA_DRV_CAP_FLAGS3; req.gd_drv_cap_flags4 = GDMA_DRV_CAP_FLAGS4; + req.drv_ver = 0; /* Unused*/ + req.os_type = 0x10; /* Linux */ + req.os_ver_major = LINUX_VERSION_MAJOR; + req.os_ver_minor = LINUX_VERSION_PATCHLEVEL; + req.os_ver_build = LINUX_VERSION_SUBLEVEL; + strscpy(req.os_ver_str1, utsname()->sysname, sizeof(req.os_ver_str1)); + strscpy(req.os_ver_str2, utsname()->release, sizeof(req.os_ver_str2)); + strscpy(req.os_ver_str3, utsname()->version, sizeof(req.os_ver_str3)); + err = mana_gd_send_request(gc, sizeof(req), &req, sizeof(resp), &resp); if (err || resp.hdr.status) { dev_err(gc->dev, "VfVerifyVersionOutput: %d, status=0x%x\n", From patchwork Sat Oct 30 00:54:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dexuan Cui X-Patchwork-Id: 12594065 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 357D1C433F5 for ; Sat, 30 Oct 2021 00:54:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1BB446115C for ; Sat, 30 Oct 2021 00:54:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231616AbhJ3A5O (ORCPT ); Fri, 29 Oct 2021 20:57:14 -0400 Received: from mail-cusazon11021026.outbound.protection.outlook.com ([52.101.62.26]:8930 "EHLO na01-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231610AbhJ3A5M (ORCPT ); Fri, 29 Oct 2021 20:57:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bca8tdqOaN8NV7/fOidkJUkh6m0+dG5eNoZC4dlhTsKdVlQH0dbhWQcfwjng+baU2URuuxXrsWbrKIgSbzRvqBCPUpNwfXqNRg0aQQh42zFezuiFuh/K7tcjrwVCGNBP/ePwFCUNhgQADmrWItGbTrknh3eLrY1KaIrlQ6ECV79Qn6ygFDLDdTE3btyCpi8QHI1XmSayiNQDL3W9kjGzi7pni1U/oOZ34ec/8KwK3OCo6THyW9p2y/sFotY4XJ1dzoF+0iVDMZssH5Gkb+xJRK/vhcjeugxl6QHP5hhSZgr9K+SMyhWJrOY9RHn/6BGiYKqXfax1FAUWa1a0IBcHUA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FnrhNOax15uLE7n6XSwfpqsmyQVBaNL/OlNqsg20ZjY=; b=G9Jl+QpA+4B/f9hVaY/kzV6k1zK4Nt2UdsaECjpTndXgUG5FbduL8+trwNC79zguePVVR6iAVFGyumHQUN29apRwRg37jgk7lxel2vBMjawe7cFxvUJ2fV/TTbbRJEW6qnOy/DHtPJOcbfzx1HsDWbDUG6OABGuFaVdZHH75iY+YtJs7XUkwRX8OexcDzHFBraqdu01sXyY/cuIDzL3WL5wLhwudqOaKSPoueIbcBoDxTl7DvqpDcB0RGtMzKiRvaNM2Ti7FeCIPjuA+4FAmnZ8YBBPhhWSAMTPppAghMJiHu+z5vDO+Zgl9Mq/lewvcCG2CaFsk61ZXpDwAaDP14g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FnrhNOax15uLE7n6XSwfpqsmyQVBaNL/OlNqsg20ZjY=; b=RRTpA0QW1c8+Cr+XWAkZTT2eGorL48ooBGyPTw08X6plIMeNkIR3t6fgG2ikZCfruQEbYXP3meC3AUXXiLtDupn2WdVeK+BUDtgjMBN2kG31zO7rZT8BMnnsKVh6dzXkbPTKSCohR+g/Nfe8J36XtgahA3YPCPhUOZFNKVG08Fg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from DM5PR2101MB1095.namprd21.prod.outlook.com (2603:10b6:4:a2::17) by DM5PR21MB0827.namprd21.prod.outlook.com (2603:10b6:3:a3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.6; Sat, 30 Oct 2021 00:54:32 +0000 Received: from DM5PR2101MB1095.namprd21.prod.outlook.com ([fe80::c0b9:3e28:af1e:a828]) by DM5PR2101MB1095.namprd21.prod.outlook.com ([fe80::c0b9:3e28:af1e:a828%4]) with mapi id 15.20.4649.010; Sat, 30 Oct 2021 00:54:32 +0000 From: Dexuan Cui To: davem@davemloft.net, kuba@kernel.org, gustavoars@kernel.org, haiyangz@microsoft.com, netdev@vger.kernel.org Cc: kys@microsoft.com, stephen@networkplumber.org, wei.liu@kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, shacharr@microsoft.com, paulros@microsoft.com, olaf@aepfle.de, vkuznets@redhat.com, Dexuan Cui Subject: [PATCH net-next 3/4] net: mana: Improve the HWC error handling Date: Fri, 29 Oct 2021 17:54:07 -0700 Message-Id: <20211030005408.13932-4-decui@microsoft.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211030005408.13932-1-decui@microsoft.com> References: <20211030005408.13932-1-decui@microsoft.com> X-ClientProxiedBy: MWHPR22CA0002.namprd22.prod.outlook.com (2603:10b6:300:ef::12) To DM5PR2101MB1095.namprd21.prod.outlook.com (2603:10b6:4:a2::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from decui-u1804.corp.microsoft.com (2001:4898:80e8:f:7661:5dff:fe6a:8a2b) by MWHPR22CA0002.namprd22.prod.outlook.com (2603:10b6:300:ef::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Sat, 30 Oct 2021 00:54:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 706f88b3-79e8-40f7-fa11-08d99b3fd596 X-MS-TrafficTypeDiagnostic: DM5PR21MB0827: X-LD-Processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wQAb8G4gCxGsPJB+s4g9Jln2IAunem76OaDisBj/EGz1dgfSLEQdYQdE5scEXYmHOgBYEdu4Y77V6Y1gdcWlYYsbA9rnKb5i0GQmzsDWpl0Neu53nB4chjo352nxqzKIWeyUE6NJAByyauF2/OoKgebfUzIPpdzY8hgjiYGDH+Jge5frwDr51GQYCMA81cSw21lO2vzjQ84btyPrgLOgvrnDZ0uQsph7HOW0S4vZrZXMYvZWZIIRdtRpqJ40t3TiRwXDXdPbJY5D1xAlxh6INajwf6U2l2/r9WBvw9jQXWBFhovLa8viYOusNjfPHmpd9pdmL9SK+tisafVhce/LfBBpGNppmiYyUDrYAjmLBN/H00p8awHrAJ3IJMhL68b9fWfyUs/WPLin8AhagE3vfQU3kW+A0RRCMVSeZgl3S1oOUzuvZzFNITlOZvXBhZZxqQpLQBofIe2jkgs8J5OggVukFzTwrekdEGMaWyQ9Ofv6ah3ZCWUaR2HrnFbKPN1e1KMo5gJlcj5DYsoJyfJfF9dMY+LkHaZO5ghkjhoTMQg0gwyMJg1S5FnLHZ6H1MREChqp0CpeHuCJVOYFrhLWW9W9ChBVfaLaYgD9uPpues8bBQ8rN+Hzf/gOXESntv6jsWgD1wFVtCF8C8IwHUkHUw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR2101MB1095.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(52116002)(7696005)(86362001)(6486002)(1076003)(83380400001)(66556008)(66476007)(4326008)(107886003)(66946007)(8676002)(2616005)(5660300002)(6666004)(10290500003)(38100700002)(82950400001)(82960400001)(7416002)(36756003)(316002)(2906002)(186003)(8936002)(508600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5NLPWSE8ahPIykQQSr2daERN6f+R5rHc0N4w0VmqS+MqAM2M0dW/5FxlEMPzrhz7h2EYBRxS3dOQg+Vgt8VmxPVaUr9ia3MQwNKWPwi6XCsTPVUL0ItreD0HJfCajM441p3l2so4fHWnUQ7ebJjNxJdU/Y8rN49X8tIMDg4lSJCBG2i8znp3NG6TFBz04fNe04J4JG8UUPy2VU1ZydD+esDGsOKoMFlki4WPG5VIZikqxLMQk13AqAs+f3l/DJIEgWcXeEFcPY4ua5e2hL9/IJd95jB4dIFZEOg/kUnrFNvhSS/qTexOv49uJ2UNFPeisZkOSr1ly/vZkkHgOrAU4/9GBURoVCAA7iK7kMa2bXPjdcknmLMF9Ffv9aQkgDBwA+FGKHKCF4iiQlkPh02Sd2tWI/hY4P+e6NV8bqfjBNGQOUXYyTyqeFiFduIm/qKnBVsRL9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1Mm5A320x3PDN0YAbGx+XbsbklU7FrSTAHGrHv82/LM+1z6WIjEXVLUkwGHeMwKYNDVYzOWYT76mbncrzTtZzNR4sjabwiEY2JbQ010HNYW/Whz507Fg4gzSrEI36yvlVgtnVdc8UhroYDN+DxB2tRx8Kqj9B7YYt09Sy8S+M= X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 706f88b3-79e8-40f7-fa11-08d99b3fd596 X-MS-Exchange-CrossTenant-AuthSource: DM5PR2101MB1095.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2021 00:54:31.9571 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lgO5GzHUK6H8nLcs334c9JULx87mNDLtk+fef1AURSufYqwrYSSQzi87hWedezgjnYobawFWaZG5pyC2hbaUuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB0827 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Currently when the HWC creation fails, the error handling is flawed, e.g. if mana_hwc_create_channel() -> mana_hwc_establish_channel() fails, the resources acquired in mana_hwc_init_queues() is not released. Enhance mana_hwc_destroy_channel() to do the proper cleanup work and call it accordingly. Signed-off-by: Dexuan Cui Reviewed-by: Haiyang Zhang --- .../net/ethernet/microsoft/mana/gdma_main.c | 4 -- .../net/ethernet/microsoft/mana/hw_channel.c | 71 ++++++++----------- 2 files changed, 31 insertions(+), 44 deletions(-) diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c index 8a9ee2885f8c..599dfd5e6090 100644 --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c @@ -1330,8 +1330,6 @@ static int mana_gd_probe(struct pci_dev *pdev, const struct pci_device_id *ent) clean_up_gdma: mana_hwc_destroy_channel(gc); - vfree(gc->cq_table); - gc->cq_table = NULL; remove_irq: mana_gd_remove_irqs(pdev); unmap_bar: @@ -1354,8 +1352,6 @@ static void mana_gd_remove(struct pci_dev *pdev) mana_remove(&gc->mana); mana_hwc_destroy_channel(gc); - vfree(gc->cq_table); - gc->cq_table = NULL; mana_gd_remove_irqs(pdev); diff --git a/drivers/net/ethernet/microsoft/mana/hw_channel.c b/drivers/net/ethernet/microsoft/mana/hw_channel.c index c1310ea1c216..851de2b81fa4 100644 --- a/drivers/net/ethernet/microsoft/mana/hw_channel.c +++ b/drivers/net/ethernet/microsoft/mana/hw_channel.c @@ -309,9 +309,6 @@ static void mana_hwc_comp_event(void *ctx, struct gdma_queue *q_self) static void mana_hwc_destroy_cq(struct gdma_context *gc, struct hwc_cq *hwc_cq) { - if (!hwc_cq) - return; - kfree(hwc_cq->comp_buf); if (hwc_cq->gdma_cq) @@ -448,9 +445,6 @@ static void mana_hwc_dealloc_dma_buf(struct hw_channel_context *hwc, static void mana_hwc_destroy_wq(struct hw_channel_context *hwc, struct hwc_wq *hwc_wq) { - if (!hwc_wq) - return; - mana_hwc_dealloc_dma_buf(hwc, hwc_wq->msg_buf); if (hwc_wq->gdma_wq) @@ -623,6 +617,7 @@ static int mana_hwc_establish_channel(struct gdma_context *gc, u16 *q_depth, *max_req_msg_size = hwc->hwc_init_max_req_msg_size; *max_resp_msg_size = hwc->hwc_init_max_resp_msg_size; + /* Both were set in mana_hwc_init_event_handler(). */ if (WARN_ON(cq->id >= gc->max_num_cqs)) return -EPROTO; @@ -638,9 +633,6 @@ static int mana_hwc_establish_channel(struct gdma_context *gc, u16 *q_depth, static int mana_hwc_init_queues(struct hw_channel_context *hwc, u16 q_depth, u32 max_req_msg_size, u32 max_resp_msg_size) { - struct hwc_wq *hwc_rxq = NULL; - struct hwc_wq *hwc_txq = NULL; - struct hwc_cq *hwc_cq = NULL; int err; err = mana_hwc_init_inflight_msg(hwc, q_depth); @@ -653,44 +645,32 @@ static int mana_hwc_init_queues(struct hw_channel_context *hwc, u16 q_depth, err = mana_hwc_create_cq(hwc, q_depth * 2, mana_hwc_init_event_handler, hwc, mana_hwc_rx_event_handler, hwc, - mana_hwc_tx_event_handler, hwc, &hwc_cq); + mana_hwc_tx_event_handler, hwc, &hwc->cq); if (err) { dev_err(hwc->dev, "Failed to create HWC CQ: %d\n", err); goto out; } - hwc->cq = hwc_cq; err = mana_hwc_create_wq(hwc, GDMA_RQ, q_depth, max_req_msg_size, - hwc_cq, &hwc_rxq); + hwc->cq, &hwc->rxq); if (err) { dev_err(hwc->dev, "Failed to create HWC RQ: %d\n", err); goto out; } - hwc->rxq = hwc_rxq; err = mana_hwc_create_wq(hwc, GDMA_SQ, q_depth, max_resp_msg_size, - hwc_cq, &hwc_txq); + hwc->cq, &hwc->txq); if (err) { dev_err(hwc->dev, "Failed to create HWC SQ: %d\n", err); goto out; } - hwc->txq = hwc_txq; hwc->num_inflight_msg = q_depth; hwc->max_req_msg_size = max_req_msg_size; return 0; out: - if (hwc_txq) - mana_hwc_destroy_wq(hwc, hwc_txq); - - if (hwc_rxq) - mana_hwc_destroy_wq(hwc, hwc_rxq); - - if (hwc_cq) - mana_hwc_destroy_cq(hwc->gdma_dev->gdma_context, hwc_cq); - - mana_gd_free_res_map(&hwc->inflight_msg_res); + /* mana_hwc_create_channel() will do the cleanup.*/ return err; } @@ -718,6 +698,9 @@ int mana_hwc_create_channel(struct gdma_context *gc) gd->pdid = INVALID_PDID; gd->doorbell = INVALID_DOORBELL; + /* mana_hwc_init_queues() only creates the required data structures, + * and doesn't touch the HWC device. + */ err = mana_hwc_init_queues(hwc, HW_CHANNEL_VF_BOOTSTRAP_QUEUE_DEPTH, HW_CHANNEL_MAX_REQUEST_SIZE, HW_CHANNEL_MAX_RESPONSE_SIZE); @@ -743,42 +726,50 @@ int mana_hwc_create_channel(struct gdma_context *gc) return 0; out: - kfree(hwc); + mana_hwc_destroy_channel(gc); return err; } void mana_hwc_destroy_channel(struct gdma_context *gc) { struct hw_channel_context *hwc = gc->hwc.driver_data; - struct hwc_caller_ctx *ctx; - mana_smc_teardown_hwc(&gc->shm_channel, false); + if (!hwc) + return; + + /* gc->max_num_cqs is set in mana_hwc_init_event_handler(). If it's + * non-zero, the HWC worked and we should tear down the HWC here. + */ + if (gc->max_num_cqs > 0) { + mana_smc_teardown_hwc(&gc->shm_channel, false); + gc->max_num_cqs = 0; + } - ctx = hwc->caller_ctx; - kfree(ctx); + kfree(hwc->caller_ctx); hwc->caller_ctx = NULL; - mana_hwc_destroy_wq(hwc, hwc->txq); - hwc->txq = NULL; + if (hwc->txq) + mana_hwc_destroy_wq(hwc, hwc->txq); - mana_hwc_destroy_wq(hwc, hwc->rxq); - hwc->rxq = NULL; + if (hwc->rxq) + mana_hwc_destroy_wq(hwc, hwc->rxq); - mana_hwc_destroy_cq(hwc->gdma_dev->gdma_context, hwc->cq); - hwc->cq = NULL; + if (hwc->cq) + mana_hwc_destroy_cq(hwc->gdma_dev->gdma_context, hwc->cq); mana_gd_free_res_map(&hwc->inflight_msg_res); hwc->num_inflight_msg = 0; - if (hwc->gdma_dev->pdid != INVALID_PDID) { - hwc->gdma_dev->doorbell = INVALID_DOORBELL; - hwc->gdma_dev->pdid = INVALID_PDID; - } + hwc->gdma_dev->doorbell = INVALID_DOORBELL; + hwc->gdma_dev->pdid = INVALID_PDID; kfree(hwc); gc->hwc.driver_data = NULL; gc->hwc.gdma_context = NULL; + + vfree(gc->cq_table); + gc->cq_table = NULL; } int mana_hwc_send_request(struct hw_channel_context *hwc, u32 req_len, From patchwork Sat Oct 30 00:54:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dexuan Cui X-Patchwork-Id: 12594067 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F9A1C433EF for ; Sat, 30 Oct 2021 00:54:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 609D3610D0 for ; Sat, 30 Oct 2021 00:54:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231610AbhJ3A5R (ORCPT ); Fri, 29 Oct 2021 20:57:17 -0400 Received: from mail-cusazon11021026.outbound.protection.outlook.com ([52.101.62.26]:8930 "EHLO na01-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231286AbhJ3A5N (ORCPT ); Fri, 29 Oct 2021 20:57:13 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ARI66YoTSjJ6YD49jfN57xbQm0mQOfAoV3kNoKdrKke4ycpX2/0J1ddnFNHz9hq5Qvx9N2jLvURY1QHmDlN/IJtblLO6JUtWEIIr+HjBk0lUDHzHRj1V57rPkAOjipAYKAhGOnd3lYVf6+XbyNXyldrKRxptYDNNLKNDB8tGdPgRo/9vK7dU/wnfx8YR9L+GOCNdWzLHDxFW5lE5jVeEE/q81amcJb/+P1mqtOeg5hVMFUTd6ctDi7KGfR/N+YimKht4JyyCs5zYjPeGj9aZPmtRxT6Cd/WE31EBRsptQFUb4NnGT5S7zgpQ34wFmY5sm1QQQCYtIo5gQzKLz3KrHw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WTDZOpUe7oVcTWp2V+NbZNUjY/7Ba5aqmOPBiZeDX7Q=; b=ZSymGO1tHj3M+vaI/4OA3wTTwtH75oBKpq5UXXw9o2m/nwwcknPGPh4rmO38tWJHn8zoec3bOLK7f/ar5BKKbHkE0JnVCSPME8gr0dampUOSF4BIU6ydulq4uTWDLpKOg+/g8oDxHuCsyGf376SLxvRdZwLdeMdl/pdN9S9/EgDN+i/mSQ+rGVRQ+yZtHhpPetCjVdl0AiEc4tL/VvGDT7rJsY8NCTaNw9yxnwHYpjLcs/bhqAho2p8qtXh8x51SzogejladkUFfsDDKbxDhjO59PkAG84w28qFE4z+BaVM/TuhejZJorwLiUxAlgOrUViX23ESW0BklsVg4gStReA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WTDZOpUe7oVcTWp2V+NbZNUjY/7Ba5aqmOPBiZeDX7Q=; b=NvCEGPLPRdm+VBsLNVz4/wOGO/sJLgdqOifwv9nTDW+ZO2d8QwOIDEiTiqEF8MlFTFS8IqjXPCadFHv/H0HNofV0ys/Ws1j5lTddAFFJS7y4hE86CSnqR4dTgLUcVgxZMxK6Lwqvx04GGnn14GJ48Q3+DxcD5wrrJXszOQ7PXf8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from DM5PR2101MB1095.namprd21.prod.outlook.com (2603:10b6:4:a2::17) by DM5PR21MB0827.namprd21.prod.outlook.com (2603:10b6:3:a3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.6; Sat, 30 Oct 2021 00:54:33 +0000 Received: from DM5PR2101MB1095.namprd21.prod.outlook.com ([fe80::c0b9:3e28:af1e:a828]) by DM5PR2101MB1095.namprd21.prod.outlook.com ([fe80::c0b9:3e28:af1e:a828%4]) with mapi id 15.20.4649.010; Sat, 30 Oct 2021 00:54:33 +0000 From: Dexuan Cui To: davem@davemloft.net, kuba@kernel.org, gustavoars@kernel.org, haiyangz@microsoft.com, netdev@vger.kernel.org Cc: kys@microsoft.com, stephen@networkplumber.org, wei.liu@kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, shacharr@microsoft.com, paulros@microsoft.com, olaf@aepfle.de, vkuznets@redhat.com, Dexuan Cui Subject: [PATCH net-next 4/4] net: mana: Support hibernation and kexec Date: Fri, 29 Oct 2021 17:54:08 -0700 Message-Id: <20211030005408.13932-5-decui@microsoft.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211030005408.13932-1-decui@microsoft.com> References: <20211030005408.13932-1-decui@microsoft.com> X-ClientProxiedBy: MWHPR22CA0002.namprd22.prod.outlook.com (2603:10b6:300:ef::12) To DM5PR2101MB1095.namprd21.prod.outlook.com (2603:10b6:4:a2::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from decui-u1804.corp.microsoft.com (2001:4898:80e8:f:7661:5dff:fe6a:8a2b) by MWHPR22CA0002.namprd22.prod.outlook.com (2603:10b6:300:ef::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Sat, 30 Oct 2021 00:54:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9b2478d7-d7ca-40fe-cb21-08d99b3fd63f X-MS-TrafficTypeDiagnostic: DM5PR21MB0827: X-LD-Processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ezEzRpO8IRgwyhvmpLzT3tASJ26vu3889ZOSOixuerxqgqCO9Z7fA8pJde1szTCMgK4lUaKeXlGP7FXUwcVjpY21qJdfz4yMF0RIZcFY276PqDjhEjCqMvob0XrlYcq42Q4xo+ySalGDvmz0YHM/+HwlsSHzaI6DeQAGO8yxFPCXwHykq6HPFsNBrpYYIKuSC6YN+v2mWKlfVbfP0cM3Llc+hXTtAFXhJWbEN2tuGbvTXu3KHiUqyVfnILthCdZ3lVL4u22KkL5q/qUWi5FUD1t1ZFIURwJjYAtMjGQGbqhXa6CdvERG6zG0keVw3l4/zqAukJcAzp/wCZncxg2JAQyRTIN/m7AEMVmXNyyE/t45aEcCHM6Zy3XUMXSgB+hWFBWrK5Lsi6AZyhwXHW5rIu2FCOUGPTnD8QpekwPrVoat+oLiXVI7Qk4srotSmZsQ7ZndCK8/u5MwyVUbl8ReyXWa9OZDmsii0ILVo4sjoxHtgo01zeMouZGH3fY+7J55X6sZt+nJL2FBLalK9AW82YniXxc+8lZODGyzw5Y+aLBKU3j0SVN70g1/5+oIvnlXyjsvkgjzgpF0LYE2dy/E7ntuTgvojal4y2+Ea2mUlmxCfqKBxwz+90e8zsE49TR0y7sHUy9aT8NPgIh1Sx3oXw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR2101MB1095.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(52116002)(7696005)(86362001)(6486002)(1076003)(83380400001)(66556008)(66476007)(4326008)(107886003)(66946007)(8676002)(2616005)(5660300002)(6666004)(10290500003)(38100700002)(82950400001)(82960400001)(7416002)(36756003)(316002)(2906002)(186003)(8936002)(508600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MkywIFrO4eIj75JzxN4ixc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Ms3btqdEctUpU6xNsZNd/NsSBg41JxmMY2oFZhrdKLciFQxJkPbjWnCj2P1qoauNPnUorXuGa0qR393LCboAE2zbaWsa4pKj2Pmly7jSG/DNJl7k5TzLkOfy9sp1MP1ysb03TZG4JFeHgtSsdeWQbOLoJJZbwoYuocUqvOQZBGbweWzy30BaqlYlUgWfx0A0Ff0qSbUN+Bm9l6CG2x4MAzjR0Gv1g4nhYEvAKtHWzccJ6mNzpidazLDyJ0wRQqmfEV/e3G10+agPVnUQqvE+dUniRn/Js49XZF1tHkfI5e+4gFX1Jxgzoe6hHa6bLV4JUGfS9b7zSJz7gCaZDRXRc5Mkod3ifN5WBAlRzGADbxJRUheod5IibvrfzQ/XhN9dhj0LqGLZ8tdPUbtrkiwjgM6bD24930gp8/UEBUVWXJcWjXIKL0gOVEBcpflckBWZGrNHSA9iYycapdiaJDeJI6hm4vwmU0csbSMZ+3kLs26CMBVr3z9fFF4yMrW4MF7oEJNrPm5HynaCFcJScGYAM0Gf8kdk+ccF5Z5emPbA/HS/gKFyEXwDmAbj940M32eQX7NqGZ+k4tqbNP9EKyWqtoyz0g6e3EVi5t3VY= X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b2478d7-d7ca-40fe-cb21-08d99b3fd63f X-MS-Exchange-CrossTenant-AuthSource: DM5PR2101MB1095.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2021 00:54:33.0385 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rQG6wmKkb1C1vn9vR5NCr/su+IDGpBw3CJtjHyPtFqovseg37dM66LFUmW0IKb/0zbUwg74ZNMbEyJV7R4N7TA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB0827 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Implement the suspend/resume/shutdown callbacks for hibernation/kexec. Add mana_gd_setup() and mana_gd_cleanup() for some common code, and use them in the mand_gd_* callbacks. Reuse mana_probe/remove() for the hibernation path. Signed-off-by: Dexuan Cui Reviewed-by: Haiyang Zhang --- .../net/ethernet/microsoft/mana/gdma_main.c | 140 +++++++++++++----- drivers/net/ethernet/microsoft/mana/mana.h | 4 +- drivers/net/ethernet/microsoft/mana/mana_en.c | 72 +++++++-- 3 files changed, 164 insertions(+), 52 deletions(-) diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c index 599dfd5e6090..c96ac81212f7 100644 --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c @@ -1258,6 +1258,52 @@ static void mana_gd_remove_irqs(struct pci_dev *pdev) gc->irq_contexts = NULL; } +static int mana_gd_setup(struct pci_dev *pdev) +{ + struct gdma_context *gc = pci_get_drvdata(pdev); + int err; + + mana_gd_init_registers(pdev); + mana_smc_init(&gc->shm_channel, gc->dev, gc->shm_base); + + err = mana_gd_setup_irqs(pdev); + if (err) + return err; + + err = mana_hwc_create_channel(gc); + if (err) + goto remove_irq; + + err = mana_gd_verify_vf_version(pdev); + if (err) + goto destroy_hwc; + + err = mana_gd_query_max_resources(pdev); + if (err) + goto destroy_hwc; + + err = mana_gd_detect_devices(pdev); + if (err) + goto destroy_hwc; + + return 0; + +destroy_hwc: + mana_hwc_destroy_channel(gc); +remove_irq: + mana_gd_remove_irqs(pdev); + return err; +} + +static void mana_gd_cleanup(struct pci_dev *pdev) +{ + struct gdma_context *gc = pci_get_drvdata(pdev); + + mana_hwc_destroy_channel(gc); + + mana_gd_remove_irqs(pdev); +} + static int mana_gd_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { struct gdma_context *gc; @@ -1287,6 +1333,9 @@ static int mana_gd_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (!gc) goto release_region; + mutex_init(&gc->eq_test_event_mutex); + pci_set_drvdata(pdev, gc); + bar0_va = pci_iomap(pdev, bar, 0); if (!bar0_va) goto free_gc; @@ -1294,47 +1343,23 @@ static int mana_gd_probe(struct pci_dev *pdev, const struct pci_device_id *ent) gc->bar0_va = bar0_va; gc->dev = &pdev->dev; - pci_set_drvdata(pdev, gc); - - mana_gd_init_registers(pdev); - mana_smc_init(&gc->shm_channel, gc->dev, gc->shm_base); - - err = mana_gd_setup_irqs(pdev); + err = mana_gd_setup(pdev); if (err) goto unmap_bar; - mutex_init(&gc->eq_test_event_mutex); - - err = mana_hwc_create_channel(gc); + err = mana_probe(&gc->mana, false); if (err) - goto remove_irq; - - err = mana_gd_verify_vf_version(pdev); - if (err) - goto remove_irq; - - err = mana_gd_query_max_resources(pdev); - if (err) - goto remove_irq; - - err = mana_gd_detect_devices(pdev); - if (err) - goto remove_irq; - - err = mana_probe(&gc->mana); - if (err) - goto clean_up_gdma; + goto cleanup_gd; return 0; -clean_up_gdma: - mana_hwc_destroy_channel(gc); -remove_irq: - mana_gd_remove_irqs(pdev); +cleanup_gd: + mana_gd_cleanup(pdev); unmap_bar: pci_iounmap(pdev, bar0_va); free_gc: + pci_set_drvdata(pdev, NULL); vfree(gc); release_region: pci_release_regions(pdev); @@ -1349,11 +1374,9 @@ static void mana_gd_remove(struct pci_dev *pdev) { struct gdma_context *gc = pci_get_drvdata(pdev); - mana_remove(&gc->mana); + mana_remove(&gc->mana, false); - mana_hwc_destroy_channel(gc); - - mana_gd_remove_irqs(pdev); + mana_gd_cleanup(pdev); pci_iounmap(pdev, gc->bar0_va); @@ -1364,6 +1387,52 @@ static void mana_gd_remove(struct pci_dev *pdev) pci_disable_device(pdev); } +/* The 'state' parameter is not used. */ +static int mana_gd_suspend(struct pci_dev *pdev, pm_message_t state) +{ + struct gdma_context *gc = pci_get_drvdata(pdev); + + mana_remove(&gc->mana, true); + + mana_gd_cleanup(pdev); + + return 0; +} + +/* In case the NIC hardware stops working, the suspend and resume callbacks will + * fail -- if this happens, it's safer to just report an error than try to undo + * what has been done. + */ +static int mana_gd_resume(struct pci_dev *pdev) +{ + struct gdma_context *gc = pci_get_drvdata(pdev); + int err; + + err = mana_gd_setup(pdev); + if (err) + return err; + + err = mana_probe(&gc->mana, true); + if (err) + return err; + + return 0; +} + +/* Quiesce the device for kexec. This is also called upon reboot/shutdown. */ +static void mana_gd_shutdown(struct pci_dev *pdev) +{ + struct gdma_context *gc = pci_get_drvdata(pdev); + + dev_info(&pdev->dev, "Shutdown was calledd\n"); + + mana_remove(&gc->mana, true); + + mana_gd_cleanup(pdev); + + pci_disable_device(pdev); +} + #ifndef PCI_VENDOR_ID_MICROSOFT #define PCI_VENDOR_ID_MICROSOFT 0x1414 #endif @@ -1378,6 +1447,9 @@ static struct pci_driver mana_driver = { .id_table = mana_id_table, .probe = mana_gd_probe, .remove = mana_gd_remove, + .suspend = mana_gd_suspend, + .resume = mana_gd_resume, + .shutdown = mana_gd_shutdown, }; module_pci_driver(mana_driver); diff --git a/drivers/net/ethernet/microsoft/mana/mana.h b/drivers/net/ethernet/microsoft/mana/mana.h index fc98a5ba5ed0..d047ee876f12 100644 --- a/drivers/net/ethernet/microsoft/mana/mana.h +++ b/drivers/net/ethernet/microsoft/mana/mana.h @@ -374,8 +374,8 @@ int mana_alloc_queues(struct net_device *ndev); int mana_attach(struct net_device *ndev); int mana_detach(struct net_device *ndev, bool from_close); -int mana_probe(struct gdma_dev *gd); -void mana_remove(struct gdma_dev *gd); +int mana_probe(struct gdma_dev *gd, bool resuming); +void mana_remove(struct gdma_dev *gd, bool suspending); extern const struct ethtool_ops mana_ethtool_ops; diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index 4ff5a1fc506f..820585d45a61 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_en.c +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c @@ -1828,11 +1828,12 @@ static int mana_probe_port(struct mana_context *ac, int port_idx, return err; } -int mana_probe(struct gdma_dev *gd) +int mana_probe(struct gdma_dev *gd, bool resuming) { struct gdma_context *gc = gd->gdma_context; + struct mana_context *ac = gd->driver_data; struct device *dev = gc->dev; - struct mana_context *ac; + u16 num_ports = 0; int err; int i; @@ -1844,44 +1845,70 @@ int mana_probe(struct gdma_dev *gd) if (err) return err; - ac = kzalloc(sizeof(*ac), GFP_KERNEL); - if (!ac) - return -ENOMEM; + if (!resuming) { + ac = kzalloc(sizeof(*ac), GFP_KERNEL); + if (!ac) + return -ENOMEM; - ac->gdma_dev = gd; - ac->num_ports = 1; - gd->driver_data = ac; + ac->gdma_dev = gd; + gd->driver_data = ac; + } err = mana_create_eq(ac); if (err) goto out; err = mana_query_device_cfg(ac, MANA_MAJOR_VERSION, MANA_MINOR_VERSION, - MANA_MICRO_VERSION, &ac->num_ports); + MANA_MICRO_VERSION, &num_ports); if (err) goto out; + if (!resuming) { + ac->num_ports = num_ports; + } else { + if (ac->num_ports != num_ports) { + dev_err(dev, "The number of vPorts changed: %d->%d\n", + ac->num_ports, num_ports); + err = -EPROTO; + goto out; + } + } + + if (ac->num_ports == 0) + dev_err(dev, "Failed to detect any vPort\n"); + if (ac->num_ports > MAX_PORTS_IN_MANA_DEV) ac->num_ports = MAX_PORTS_IN_MANA_DEV; - for (i = 0; i < ac->num_ports; i++) { - err = mana_probe_port(ac, i, &ac->ports[i]); - if (err) - break; + if (!resuming) { + for (i = 0; i < ac->num_ports; i++) { + err = mana_probe_port(ac, i, &ac->ports[i]); + if (err) + break; + } + } else { + for (i = 0; i < ac->num_ports; i++) { + rtnl_lock(); + err = mana_attach(ac->ports[i]); + rtnl_unlock(); + if (err) + break; + } } out: if (err) - mana_remove(gd); + mana_remove(gd, false); return err; } -void mana_remove(struct gdma_dev *gd) +void mana_remove(struct gdma_dev *gd, bool suspending) { struct gdma_context *gc = gd->gdma_context; struct mana_context *ac = gd->driver_data; struct device *dev = gc->dev; struct net_device *ndev; + int err; int i; for (i = 0; i < ac->num_ports; i++) { @@ -1897,7 +1924,16 @@ void mana_remove(struct gdma_dev *gd) */ rtnl_lock(); - mana_detach(ndev, false); + err = mana_detach(ndev, false); + if (err) + netdev_err(ndev, "Failed to detach vPort %d: %d\n", + i, err); + + if (suspending) { + /* No need to unregister the ndev. */ + rtnl_unlock(); + continue; + } unregister_netdevice(ndev); @@ -1910,6 +1946,10 @@ void mana_remove(struct gdma_dev *gd) out: mana_gd_deregister_device(gd); + + if (suspending) + return; + gd->driver_data = NULL; gd->gdma_context = NULL; kfree(ac);