From patchwork Thu Jul 23 20:09:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 74691 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 155E5A0518; Thu, 23 Jul 2020 22:09:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 406141C001; Thu, 23 Jul 2020 22:09:36 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80083.outbound.protection.outlook.com [40.107.8.83]) by dpdk.org (Postfix) with ESMTP id 7E6C41BFEE for ; Thu, 23 Jul 2020 22:09:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IkxsN7IKPHCX1HlGErObBddZX0P0zMUWpLl4r/e6aRR3yTK1okqU8KZ5bi+hHWkWijhTtsAo2wAA+h39N6jDPsaaDMKfNBheWNPrBx0YO2L7ahmxi8QE2bk+s5zZW8qb2pvDa1tYGEHPFOnp3AQFX4FaYjCr0uAp0tGx0CLC4RfNMbUfvrcAqckod77amAwzLwG6ADFJoMpxtqBIoIuD2ohKdakxS/Bl2fOlz7KEAKBp3zS8XlFRAE/FsMQ/AUVONqyb/uTsar2+2a+WprMzZvvZbQfZIwrQ7pXIpcUvpM8cPN6JPFvX1bsETyzdVik2srfGwHoUXL9srq2AePEXqw== 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=3Ly9h1mQuauz3VX/u1iQIlVYZ3tpQhYiVkJlTZ8VXos=; b=VCsMQFwE1s3AYm5o0cZaSBf4wJGaTDIhjg+DE9tl7Hk2nt049KTk1ou/sLyxxLyr05NxtrPuzyf/+59nJtETkmxzsdEKs3XuzS1vIDw0nXeGr3NozjZCUtFC61nljl7zcMao4OKgXmofzI4BhF7JQiinhAC+l+au3YFKQb31DdJaAEp2pmycsE9+RNX2UeVj1ptIgmkJ/AkEMfPjfQS5/VZd70Nu+aiwEZDNPtWEu+H25ul/XjYP92NgT9mwYK7jASWQpzwTXrAQQma1sKk5cGmorQGl5ifRs0FIPwRwklO3x4osUzCPdu31slgAZsu9gHnill0WIl67BRgOZW1u/Q== 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=3Ly9h1mQuauz3VX/u1iQIlVYZ3tpQhYiVkJlTZ8VXos=; b=jxZNvbZpFP+d2RO4gR53nd1+HRvU4R1A+7XwZ1mWBppZDe+L0M8ABr30HXnA+ToLgT6Zhq2vDbdFYKOHW3iIMlgAxCfQ7TRJAyxDRwEDQRSUsgAJkJuULu9dLPBHWYy5jvrsykTHlVHMSyLWXlx2vFqTIJKAuWwVUHHHH3IkdX0= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) by DB7PR05MB5558.eurprd05.prod.outlook.com (2603:10a6:10:5c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Thu, 23 Jul 2020 20:09:32 +0000 Received: from DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293]) by DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293%5]) with mapi id 15.20.3216.022; Thu, 23 Jul 2020 20:09:32 +0000 From: Parav Pandit To: dev@dpdk.org, grive@u256.net, ferruh.yigit@intel.com, thomas@monjalon.net Cc: rasland@mellanox.com, orika@mellanox.com, matan@mellanox.com, joyce.kong@arm.com, Parav Pandit , =?utf-8?q?Morten_Br?= =?utf-8?q?=C3=B8rup?= Date: Thu, 23 Jul 2020 23:09:01 +0300 Message-Id: <20200723200910.376581-2-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200723200910.376581-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200723200910.376581-1-parav@mellanox.com> X-ClientProxiedBy: DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) To DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw-mtx-036.mtx.labs.mlnx (208.176.44.194) by DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Thu, 23 Jul 2020 20:09:30 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [208.176.44.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 88006555-0ee8-4d3c-010e-08d82f444fbe X-MS-TrafficTypeDiagnostic: DB7PR05MB5558: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:843; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M3wWyFs1PfZYPEysB9HQDxjPJhR37LqW+bViN913ZaC6Zr/0Ojg/VsmFXBmB9s8C+vw14fwtokrRNdzFqeo676WktWfTgHD90kOANGjaxkes+USE4XRTsqvoiAamQ+ibcPPPGWGiIgdCEgzfKqIINE7M/JjoY+6S8ytflDr01R9HOQmRmre2jabS+XfQXKoavJDqc5eEDvZPTkJ/3UPEOfcKCI5uQohQJ3WcKCOAsYburO4fpA0fXoOiZiYbJPmfdv4ZenDLgQ+JH8zJRi4t24pts6bICnXfddCdrl51WJU98TnBcym84nHdfS4T9cA800Gct1J7Wc59X2FeyAWyfQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR05MB4876.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(366004)(396003)(136003)(39860400002)(6506007)(8676002)(8936002)(26005)(52116002)(2906002)(54906003)(4326008)(478600001)(66946007)(66476007)(66556008)(36756003)(5660300002)(2616005)(6486002)(86362001)(956004)(4744005)(1076003)(6512007)(6666004)(186003)(16526019)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: YFun4DOMUbDWtLO27EPas3BKdeIZuS+6/myT+KUrHF5MazpHZWRXlM7z4pxvaJpwxQRXZ76v86B7iwRXszyVVfcY5JbMxLclXH+7pKwIeaUJOOwxXSvUfb7QJbEifk/llIG/yzNlE7ociMBbF/clV+/o5at6gx60iMLrHfymc4fDsfNQX1hnpOU8PgX84NmUuKR4tAOUp6gUF7R8U4aDBjPLBcrbBr/7sFN4G5GlKftdhvIJFzg6rUtsWxqD4/RhvPS3Bc3mmJxnyjT9dRQvx6oR/VJr4Q30I0+17pMh2iUOzdFGTKjXa2x8+bVKzslQVLkZJv2t2aMxNKqwOQgw72rDrmwyu8crCOKZjaDl0tNmEZ7EWsV42KJiSWgog68JcHpOHgy2FIBL5qen/6SqMl3UoAF7kbPalzJksTHfe8iD3kXGG8KL+cKwF8JPO1NnU0damZ4UFBB4on8HaeJIsTdoCxUwKAGyWEF4bl3AiXS71ohx5DAULFA4AQkjIuzs X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88006555-0ee8-4d3c-010e-08d82f444fbe X-MS-Exchange-CrossTenant-AuthSource: DB7PR05MB4876.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2020 20:09:31.8676 (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: fpYJIwp/uFema/hk0k7Ojn3QiWRLie17gyxrfgoA+s8dYinTO2iRgcXFpjdXjnzT/cvgk4ZjUd2ETE2QS2rT1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5558 Subject: [dpdk-dev] [PATCH v8 01/10] eal: introduce macro for bit definition X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" There are several drivers which duplicate bit generation macro. Introduce a generic bit macros so that such drivers avoid redefining same in multiple drivers. Signed-off-by: Parav Pandit Acked-by: Matan Azrad Acked-by: Morten Brørup --- lib/librte_eal/include/rte_bitops.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/librte_eal/include/rte_bitops.h b/lib/librte_eal/include/rte_bitops.h index 740927f3b..ca46a110f 100644 --- a/lib/librte_eal/include/rte_bitops.h +++ b/lib/librte_eal/include/rte_bitops.h @@ -17,6 +17,14 @@ #include #include +/** + * Get the uint64_t value for a specified bit set. + * + * @param nr + * The bit number in range of 0 to 63. + */ +#define RTE_BIT64(nr) (UINT64_C(1) << (nr)) + /*------------------------ 32-bit relaxed operations ------------------------*/ /** From patchwork Thu Jul 23 20:09:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 74692 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1D66DA0518; Thu, 23 Jul 2020 22:09:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 61D5D1C02C; Thu, 23 Jul 2020 22:09:39 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130082.outbound.protection.outlook.com [40.107.13.82]) by dpdk.org (Postfix) with ESMTP id 773BD1C00F for ; Thu, 23 Jul 2020 22:09:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P4vNAYMklkUfHIBiaJuWs2oKRhY2lIPyDc18MA13HmEVI0nroNJmkDeo5OJlsc0WrQos9m/WXQhbRLtJAxwemFX9ICYq8SJlN3uFkYwoC5UUHLCZiOceMBq9Fiw+XhcScglyMWjgCxAxF0Ig+W2MsRvv2zc3Jiw6cUeSWOWILXjqjn/eRf+htpcegIOnSu9Cd/0dO8XAmNjftGqMoUUramnLOJG9yoFU00NE+XSN4qGRsnLmOTiP0R6cRydYg0ZMpWaJlYQMJnNEWgxA87CfXJsdAeGhu0HzNVazEPcbUcwoE86Ch4G8qVwXWUG7mJe+yrYhsaxdFh0Bk+Bd0FOZmg== 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=h7mJb4MTR9ks8/vfWUBn2i5vBoFRKjchQezVZ44+DJU=; b=K2m2byM5Nf+xUlaFxKeUr30TO0LndArvgy6pQaeyg3d9DgMG26qz1yIzHBlV14xPNYNW/wRW8rJLiNzqb1CarYSHZxIJciXzrsI0rqNv8pgEj9g8ax2sXJSjBXXOPC2gF26tx++h3IfRkIogQmSRC9hAM13lxBnbc5H0c1cpv7GZKrnlxh9naH5ZpomGJIAAVnjcan5ONzp7HQQNVnvtu6qQ/lnmLMmYjcGQT/hzxaHcp0uJozgSs84bpUdyfU8yODzEx0EG+gcxiHvnXjPPz2vOlWtmmr4FT99n59QXA/USlUGV90SvsWBmg8nc0m/Xqfy0kSEIxp9gzneyZrdcNg== 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=h7mJb4MTR9ks8/vfWUBn2i5vBoFRKjchQezVZ44+DJU=; b=jR5d5ZWu7AQf8lWHLESHfAWLcTV/ZwnVI+SzBdsjppbTL2XxY46sHEFn8WIKPePTvX1DglxjVyToVTX1PTpQpyuew3v91/nxWq51xscXNqqKiKvYnu1VZAr1iT9fd/Cl2MSy2bLd5YalU2WdcuJbSina5kLVfhbf3O2ZLDjy2FY= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) by DB7PR05MB5558.eurprd05.prod.outlook.com (2603:10a6:10:5c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Thu, 23 Jul 2020 20:09:33 +0000 Received: from DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293]) by DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293%5]) with mapi id 15.20.3216.022; Thu, 23 Jul 2020 20:09:33 +0000 From: Parav Pandit To: dev@dpdk.org, grive@u256.net, ferruh.yigit@intel.com, thomas@monjalon.net Cc: rasland@mellanox.com, orika@mellanox.com, matan@mellanox.com, joyce.kong@arm.com Date: Thu, 23 Jul 2020 23:09:02 +0300 Message-Id: <20200723200910.376581-3-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200723200910.376581-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200723200910.376581-1-parav@mellanox.com> X-ClientProxiedBy: DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) To DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw-mtx-036.mtx.labs.mlnx (208.176.44.194) by DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Thu, 23 Jul 2020 20:09:32 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [208.176.44.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 760bd67e-933e-46b4-0f07-08d82f4450e0 X-MS-TrafficTypeDiagnostic: DB7PR05MB5558: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E8kB+3uG29quQLu69hfUtdl9T/4jXGswUbDfPlY3F0DT0Jt6lGgK0rjV6s9BIu0/oYdCe5dHxGRvk2pH+Irl/WUDAJvf7uu5dAPwcJef+NTUByBBcf6WvwV+7iPeKNywVoEfsQwAJOkYP0/RyBiP1o9q8Si/BI1t9G4OOhdSw9g9qFkEnfg7gnoSWWqe9zn6RELoBOmOs3OjTTHkkVFMIebIVwPsiaH+GV8S1jmLyNPMyhqb69GQXu5xQ3RDCNYmsqzdq6GE2Afrwf9oChEdoqVWVrA3KYAgEcyE4HeIFNlkc9uympt3R0dyiUd88irhLurY1fm5I7c2JZcqZuxifQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR05MB4876.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(366004)(396003)(136003)(39860400002)(6506007)(8676002)(8936002)(26005)(52116002)(2906002)(4326008)(478600001)(66946007)(66476007)(66556008)(83380400001)(36756003)(5660300002)(2616005)(6486002)(86362001)(956004)(1076003)(6512007)(6666004)(186003)(16526019)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: iCAQLANxwpInH+mjlDYE49qMI/tdxLfhr3MvFgLVx0Wg38T1aw6q0gIzu0XXjofVQ5QF6O+ARA7mvXoA7Kb1qs6K6kNkkR/MxajRzPM2CAP+cVVoQ5UoE6/4ofsOkmbcgYB2T6N/waI7v1/nfWoCl4K26458aGwNYDxBTQTRZO/AYUgZ/iVNei4FKF9TNvokck4xdpLBi+3xI8Xw16nEVFZBZ0IiJhY2GS4owFl8c+m7H83S6IXCJFeY9PnRSlERUW5H1rs0hPuwbfijftzRmHGI94rQT2SfH93OCqnBShwkECsAvzYtD6Z0EjNJa0BcHzyBnEUd38Ip6FNEDA9HEcUt9oxpDwFTKtetgFubk2/RVpvyHntCq4L1ppWHs2VqFDDK8TQ9jjqma23vdgjJAvD573jXtXj5TJUMJM5Y0ofW792avD0mQv39PP7QK7mBeKpfrxTujJRSL+nP5MA9QEKwN2T3nija22zw0YxTtH28RMQopHA8ZxJgLCj9rqv5 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 760bd67e-933e-46b4-0f07-08d82f4450e0 X-MS-Exchange-CrossTenant-AuthSource: DB7PR05MB4876.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2020 20:09:33.5517 (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: OWT3h7VWOBe4by6Qg/3eztPZcEc7+toK/2pjX4++/55V2s020vEVyVHRxa6LQzRT47idM6auiWcMabPbUDSO1A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5558 Subject: [dpdk-dev] [PATCH v8 02/10] drivers: fix indent of directory list X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Thomas Monjalon Define each sub-directory on its own line ended with a comma, and use a simple indent. Signed-off-by: Thomas Monjalon Acked-by: Bruce Richardson Reviewed-by: David Marchand --- drivers/meson.build | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/meson.build b/drivers/meson.build index e76ebddfa..e2aeba931 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -2,17 +2,19 @@ # Copyright(c) 2017-2019 Intel Corporation # Defines the order in which the drivers are buit. -dpdk_driver_classes = ['common', - 'bus', - 'mempool', # depends on common and bus. - 'net', # depends on common, bus, mempool - 'raw', # depends on common, bus and net. - 'crypto', # depends on common, bus and mempool (net in future). - 'compress', # depends on common, bus, mempool. - 'regex', # depends on common, bus, regexdev. - 'vdpa', # depends on common, bus and mempool. - 'event', # depends on common, bus, mempool and net. - 'baseband'] # depends on common and bus. +dpdk_driver_classes = [ + 'common', + 'bus', + 'mempool', # depends on common and bus. + 'net', # depends on common, bus, mempool + 'raw', # depends on common, bus and net. + 'crypto', # depends on common, bus and mempool (net in future). + 'compress', # depends on common, bus, mempool. + 'regex', # depends on common, bus, regexdev. + 'vdpa', # depends on common, bus and mempool. + 'event', # depends on common, bus, mempool and net. + 'baseband', # depends on common and bus. +] disabled_drivers = run_command(list_dir_globs, get_option('disable_drivers'), ).stdout().split() From patchwork Thu Jul 23 20:09:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 74693 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6260DA0518; Thu, 23 Jul 2020 22:10:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C82F01C034; Thu, 23 Jul 2020 22:09:40 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130082.outbound.protection.outlook.com [40.107.13.82]) by dpdk.org (Postfix) with ESMTP id AC0571C010 for ; Thu, 23 Jul 2020 22:09:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kbXOEkqveqq9LHyXrntCw1kEtC1wrX8xN6z4PV0VJWwemTxEFDW4qrKsKn4uwrumGUoQ3CNgpo2sXS38ZC/TywQiIHREcjrRcPWnlS5irlA+eybshBMcfz2YkvJs+peaEUTM/cj870TR6zpoDjnSoci+5/6Q3/lhrHajCc4QNZGPOSHYu4Mh2aHFevrBuF5Wr7mI2XPXZwh5Zs9i03b37kplR1loxstWToYXdX4IIDwOh3foLxaahY5LT4n9qXHIT4LZWRHreeLkgoTeXKm+eczIfO2ePO2JeW2ZWkGq9W/6ZSiNeJh0AcsW+dUzlXzTutiDHi8aJGqWB5OTSRgeTw== 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=MjNOGm4Tsp53oTLnQVKVXYU2P5oIovtR4NTCvdLei3M=; b=c4oEFyQHGIAk8JsZz2QPZWC3pg4p+jVnuqVafPAK0kImVgpwzQd+IINPY2duawzITXeUivaho9RM9LQBSgISk1s+wZCU97X6fFK8kfow208D7Rplu2gPUIHRGZFH3MWqz0s4pk6R0cNFhc5M4yyjvMEZL88x2BpkPnn+qCaIoQaVQyLEpaZsm93xD7kkTpmG2sdZtDdJvT7Djlf+ywBuEFYJa99x1QH5VemeIyxdHIQfPtbp2iTpDNxezEe0rRAFZD5xxQqvAbjfb1AgfPL63gA7opccbAVIznx3xzX6jmLjNZAYXGxo9jqgew8rj//GREckp15e8Na1v9/HCzSoYg== 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=MjNOGm4Tsp53oTLnQVKVXYU2P5oIovtR4NTCvdLei3M=; b=YdsuCJBUz91L30+NoJ/mZmA+PknCu7OE+LijAwDgitlxLKtNMfAHRPkLO+bdPO8qju5jIN/zo+nEa5gWL6hQmJ9VkLiqyt5wywiEihciBdCXyfoyBSpeeFnZjrArhD1I32J2a0aXyy1FF5J9N1X9ZA5yE+8FgCLuN7NYNSar3aw= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) by DB7PR05MB5558.eurprd05.prod.outlook.com (2603:10a6:10:5c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Thu, 23 Jul 2020 20:09:36 +0000 Received: from DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293]) by DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293%5]) with mapi id 15.20.3216.022; Thu, 23 Jul 2020 20:09:36 +0000 From: Parav Pandit To: dev@dpdk.org, grive@u256.net, ferruh.yigit@intel.com, thomas@monjalon.net Cc: rasland@mellanox.com, orika@mellanox.com, matan@mellanox.com, joyce.kong@arm.com Date: Thu, 23 Jul 2020 23:09:03 +0300 Message-Id: <20200723200910.376581-4-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200723200910.376581-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200723200910.376581-1-parav@mellanox.com> X-ClientProxiedBy: DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) To DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw-mtx-036.mtx.labs.mlnx (208.176.44.194) by DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Thu, 23 Jul 2020 20:09:33 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [208.176.44.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4b44ede1-fe16-4ee9-9182-08d82f4451ce X-MS-TrafficTypeDiagnostic: DB7PR05MB5558: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C7WWIcFzntKKW2V6AUgn8eGvyLWLoL/e9s6VWjci9N400h6/DrEmEKCDN0eUIVIelN7GhoANjVU81wGzDTddI0IyAa8/E8QMDHmPvprM1hsUWhbGbgtN17KfT7rC4HOcmEYc5QkD45FRrqQlLVsGjGBxHGUr4f+7AiVgADXepqD8QSmhUMUHhsC53jW5+EKzNZtQdUiwG2Vmkvtnqqd4xIPayRR6Gjl7jNtLEUQy5PLBKx77OO2pbyMUbKW1FlxF/Lgp/QnUR4qmHfu4pMII5+aHzJhT7tiZiBLUY0q4Lkh38pqozVz9Ql8znoJsHVSmaKWXB+qnLgk65f3uB9iFgQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR05MB4876.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(366004)(396003)(136003)(39860400002)(6506007)(8676002)(8936002)(26005)(52116002)(2906002)(4326008)(478600001)(66946007)(66476007)(66556008)(83380400001)(36756003)(5660300002)(2616005)(6486002)(86362001)(956004)(1076003)(6512007)(6666004)(186003)(16526019)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 3ht+hPDMQQzo79R4AuiLDsC860V8JalK3K5iaB/lnPVuBQTC6OiGgA4XTDCc4ZeJf8TzT7/CDUL5nu1+RpkPEMmUVczjQnkUIAKZYWs0P0Z88qbfEYESl4tqQhNOM36ydyeqZQyg/LJsX1e/BI4ViL+QCQu8XolP8LY+uG6dJIrfJhPKW1nHhf2piBWOMuTjvGfd0v7L4yNGv5ReCxukispTOCx7ClFKxFZQ1ggVFiW5PcvFfnbE6iBUux63Ydva8mwCGeWC7Hx+FsyscosviXuGzN1R0Poq8twT3yitXECqozrm6G37W3rNkT/+R0cVTwsN06JroZ4SB+l0iG/lb2Et5gNy/LXQDXZmE2IZMZ2TehDLjAZqLZbU68GqYmjI4dhJ9GghDXZFRL8RWmM/ittjg/SpuQqMewT6JKIRLsncqndhbsERJFZXk1UwgMv0E+SyzlQFqvb2etljGpnjvqLRbbgHRZ4fng6Jw5pygn6erOnSu1fDfdyJ4yWaE8kH X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b44ede1-fe16-4ee9-9182-08d82f4451ce X-MS-Exchange-CrossTenant-AuthSource: DB7PR05MB4876.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2020 20:09:35.1607 (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: faXKUij/AbAidAf9qpztt5AivksGbOw6gwJlMgasD7UFYKE+JyBokYUmUlVRP0rbqEJNFSLkaIGMjVcXcY42aw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5558 Subject: [dpdk-dev] [PATCH v8 03/10] drivers: relax dependency order X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Thomas Monjalon Drivers dependencies are evaluated in the order defined per their parent directory (also called class). This strict ordering prevent from having 2 different drivers of the same class with different dependencies ordering. This problem occurs if drivers/common/mlx5 depends on drivers/bus/pci, while drivers/bus/dpaa depends on drivers/common/dpaax. Having a strict ordering between directories bus and common is too much restrictive. That's why it is made possible to have a more fine-grain directory list, adding a driver sub-directory in the list. In this case, the isolated driver must be removed from its class list, and added directly in drivers/meson.build. Also, the per-class variables must be duplicated in the isolated driver, because the call "subdir(class)" is skipped in the isolated driver case. Signed-off-by: Thomas Monjalon Acked-by: Bruce Richardson Reviewed-by: David Marchand --- drivers/meson.build | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/meson.build b/drivers/meson.build index e2aeba931..e6d0409aa 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -1,8 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2019 Intel Corporation -# Defines the order in which the drivers are buit. -dpdk_driver_classes = [ +# Defines the order of dependencies evaluation +subdirs = [ 'common', 'bus', 'mempool', # depends on common and bus. @@ -27,7 +27,7 @@ if cc.has_argument('-Wno-format-truncation') default_cflags += '-Wno-format-truncation' endif -foreach class:dpdk_driver_classes +foreach subpath:subdirs drivers = [] std_deps = [] config_flag_fmt = '' # format string used to set the value in dpdk_conf @@ -35,8 +35,22 @@ foreach class:dpdk_driver_classes # the library, the dependency and to find the # version file for linking - subdir(class) - class_drivers = [] + # subpath can be either "class" or "class/driver" + if subpath.contains('/') + driver_path = subpath.split('/') + class = driver_path[0] + drivers += driver_path[1] + else + class = subpath + subdir(class) + endif + + # save class name on first occurence + if not dpdk_driver_classes.contains(class) + dpdk_driver_classes += class + endif + # get already enabled drivers of the same class + enabled_drivers = get_variable(class + '_drivers', []) foreach drv:drivers drv_path = join_paths(class, drv) @@ -96,7 +110,7 @@ foreach class:dpdk_driver_classes '_disable_reason', reason) endif else - class_drivers += name + enabled_drivers += name if fmt_name == '' fmt_name = name @@ -203,5 +217,5 @@ foreach class:dpdk_driver_classes endif # build endforeach - set_variable(class + '_drivers', class_drivers) + set_variable(class + '_drivers', enabled_drivers) endforeach From patchwork Thu Jul 23 20:09:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 74694 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0BAE6A0518; Thu, 23 Jul 2020 22:10:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4EA551C042; Thu, 23 Jul 2020 22:09:44 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130049.outbound.protection.outlook.com [40.107.13.49]) by dpdk.org (Postfix) with ESMTP id B8C5E1C02A for ; Thu, 23 Jul 2020 22:09:38 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fr3UlYOkK/HV011VdImqJpE0DuyLiUS73pgRLI5Zp6ZKTod/ZntIetsCoNxSI9gP9dNP876Ev8kbT+btLhsH0/85jk+zxpLNm5Up5yLMzp8gmeOVuLM2EkwppLV+xKRpnDnQ3GrApMEVmL9A0PrORFTYercmyojqhTXB9R3ZxzmrHLp+YRBRJF+LsW+2+eqxDHKfTiMNrTLjtza3EVbPvq6Adj+6b+91ZJzuxdCanBY41lb3RSY0KQgBOR5+g1bT+oZLb4uG31j6B6vrHJbVKU6HVh2JpP7sUPQErYYN8WWJGlFapPSjWgwOL2DnmYBuyVxH48NNgGHYhbrcHEgHlg== 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=01RK3otJaGVDPbIDqEEVdRcMZyh2Bq2eBK9blqoZY4s=; b=RAlqTcnQGE77vv9wGkzvmTE5uQNozQYHj9kZFLt04rREQjOAfCwWwwechswSJnDv4Ps6cN+29qFt5VuFnx/hlyP0JzBbn5RAxu5omNjeB6KfOtUTt87cH7epYZ8GRm0UGmf+SKMASM+0tVHk7SOT7zKe3mRA4ldJsVRMTrzt1+kf4JI7f/m/QoI5TRkUXGrHsFZ8YkDDocv02QENGMm+yjfysH5v8AL2WzSTTay64g2MuUmHd8/JyQBkfrz0LLZIrrzbqwMSfxQWZoK/KF5SKhl0GitUoUHGia4QzOMGWQoCik/9K8kKGw1b1DaZ0Crsz2vcYGX9LD229OXHorb0HQ== 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=01RK3otJaGVDPbIDqEEVdRcMZyh2Bq2eBK9blqoZY4s=; b=GSzyWtXN7POFYBAjT9dwlZlQ6rMFuuRXriqw+qJdGVn54r88vKYeg4FaYvaXXhTB3Picgc0Gt9hgsuYGCNRDMuoB3DNCHI9c27Va3bfmXryoF3V9DERTzkxG44x0UXaUOYEClGEnP/PsqSD0LMvIQWFKeWmM4UKivYaRElsnvwA= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) by DB7PR05MB5558.eurprd05.prod.outlook.com (2603:10a6:10:5c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Thu, 23 Jul 2020 20:09:37 +0000 Received: from DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293]) by DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293%5]) with mapi id 15.20.3216.022; Thu, 23 Jul 2020 20:09:37 +0000 From: Parav Pandit To: dev@dpdk.org, grive@u256.net, ferruh.yigit@intel.com, thomas@monjalon.net Cc: rasland@mellanox.com, orika@mellanox.com, matan@mellanox.com, joyce.kong@arm.com, Parav Pandit Date: Thu, 23 Jul 2020 23:09:04 +0300 Message-Id: <20200723200910.376581-5-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200723200910.376581-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200723200910.376581-1-parav@mellanox.com> X-ClientProxiedBy: DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) To DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw-mtx-036.mtx.labs.mlnx (208.176.44.194) by DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Thu, 23 Jul 2020 20:09:35 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [208.176.44.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bbd3984b-dd38-42c6-de39-08d82f4452d4 X-MS-TrafficTypeDiagnostic: DB7PR05MB5558: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:327; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b31N4APWGiTjPXelI4WK4prWC2poVSOGc7xyZP4GGQnOkwhst/jM1E5alKZ85T1H2VN06oicKFjXkGnB0yHBwV387yY6DRBMJnGbzsm2KB2I6bZvC87P8GGVXLqxOhdKEuKnBH277Pcu7Vwm+vXuRu17wrlvv6HxF/Wmg/U0A+JltfCfSnYc6Zg11WDM0VU+7rJGO7Nwqg7thbno5+ohwC3v+pi66gNpSs2fnAPqQ5lmrCZh1irEyw0mIn3HM/wJLsar6LwO3yMOIdBXd/Hh/tQgEq361W32MxwOBwPE26y+EE/gLGaTBjCC7P5yV7f+ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR05MB4876.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(366004)(396003)(136003)(39860400002)(6506007)(8676002)(8936002)(26005)(52116002)(2906002)(4326008)(478600001)(66946007)(66476007)(66556008)(83380400001)(36756003)(5660300002)(2616005)(6486002)(86362001)(956004)(1076003)(6512007)(6666004)(107886003)(186003)(16526019)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: /93eQg+W5TlNLgyTSOTtgdpdw13YPxOIOux+Bu35r3SzZu0ByMgaAufc27BGnWzY6p6YZo+marUVdLoLBXKr5TWWbnOzxmwn1CCmNvQGeKdwkf8WwODdsx4Y2d6USsM57pPr6uPjMhC4JbgNo+dCElW16dcJRSA2ZXYxsOdMO9Tj66N2II8PTS6p79fQbIxR3ShO7IQoRMzUo0yebnUKoEOzrJxKyhmopFdQQW6mU9QBt0Q2EYBW/yy69oBpP9E1HhADNCsIibwONMptE1ZsQy7GV5S4++PtW7IuOSeBswVCcYy6VoIC6nOFNjwujq7U7pqGwBAZ7ydhv3wXWMok0xN44W3GNbDZuvfukwAFIfDs4IsB0H8rYLgW0PUeETwZttBSv2kg8U6Ava1r6u+KBy3vlyvVbOTna9drDVVbMTQCqDJP53kMhEfLXtxl1g11NFKSUe5fKdk0rkDo4LXjtPNfrTVnc9J0kAVRZrS6t0kjp0RCKKkjWnIiANfkb3kd X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: bbd3984b-dd38-42c6-de39-08d82f4452d4 X-MS-Exchange-CrossTenant-AuthSource: DB7PR05MB4876.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2020 20:09:36.8328 (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: GrOXEQWQhLKsDA0NTs/7yIdtccn9P9H+3WjjVd/YKXJsQzGwj8zzdrJ8zM+YCEFQAFSdBXScvT3m5FWj5FneIw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5558 Subject: [dpdk-dev] [PATCH v8 04/10] common/mlx5: fix void parameters in glue wrappers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Following two errors are reported when compiled with gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5). drivers/common/mlx5/linux/mlx5_glue.h:188:2: error: function declaration isn't a prototype [-Werror=strict-prototypes] drivers/common/mlx5/linux/mlx5_glue.h:188:2: error: function declaration isn't a prototype [-Werror=strict-prototypes] Fix them by adding void data type in empty argument list. Fixes: 34fa7c0268e7 ("net/mlx5: add drop action to Direct Verbs E-Switch") Fixes: 400d985eb586 ("net/mlx5: add VLAN push/pop DR commands to glue") Signed-off-by: Parav Pandit Acked-by: Matan Azrad --- drivers/common/mlx5/linux/mlx5_glue.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_glue.h b/drivers/common/mlx5/linux/mlx5_glue.h index c4f9b006a..734ace2a3 100644 --- a/drivers/common/mlx5/linux/mlx5_glue.h +++ b/drivers/common/mlx5/linux/mlx5_glue.h @@ -185,11 +185,11 @@ struct mlx5_glue { void *(*dr_create_flow_action_dest_flow_tbl)(void *tbl); void *(*dr_create_flow_action_dest_port)(void *domain, uint32_t port); - void *(*dr_create_flow_action_drop)(); + void *(*dr_create_flow_action_drop)(void); void *(*dr_create_flow_action_push_vlan) (struct mlx5dv_dr_domain *domain, rte_be32_t vlan_tag); - void *(*dr_create_flow_action_pop_vlan)(); + void *(*dr_create_flow_action_pop_vlan)(void); void *(*dr_create_flow_tbl)(void *domain, uint32_t level); int (*dr_destroy_flow_tbl)(void *tbl); void *(*dr_create_domain)(struct ibv_context *ctx, From patchwork Thu Jul 23 20:09:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 74695 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0C6DEA0518; Thu, 23 Jul 2020 22:10:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BE7091C065; Thu, 23 Jul 2020 22:09:45 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80087.outbound.protection.outlook.com [40.107.8.87]) by dpdk.org (Postfix) with ESMTP id 320271C032 for ; Thu, 23 Jul 2020 22:09:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N/NkK5cWHOjEXwF8Xqjry0UsHPYSMHnVCrmHpCamhlet4tpo0VIevfrjGhG351APMRBn/kcgIbNShQx5/sHUuHxuT4GrT+2ZUrS/vllpKMNdoAfBtlosvj7NMGmkoYQELkl+I47oRyJorM04VWmRx56QCzNUOx2LyeMGJN+MnV26PnXg8Pl9asxqKBZaNJAjF51H/Ur1AVzlYq/Ht8J7k53KuoFMHoUfMFPGVeXcFBuD1fk1qgC9RAKjx/hTzeVAjSSQffjgW+RaAqv/MjVnrxfVModV32iwnXLSdcOIgwH5UrbrDSC5cd/V/gV5f8Qz/1181p0ErYuws0rwVQ9Hvw== 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=jBckSGlVRAelxJZdaG8qEr/r4MZiBz6gqZABQJD0T2M=; b=Zki6YueuRBeCsv+eubTFN9m0qq7dFXPESF6lGUSKtswCHkcmZLpceK8e6g8o9y3qXfkPpTEfmP1HKRtRAg9rg0aZICdv7GkdPwVNrLR/bl5H5ApWWtVwC74dRXNflGgKgk/Ayqd/Muk64FGE3LsSrUAe8VtJRJ/BQSOWr06ZtstyNn5m9CPljgVCtK/6FvmMrkmaS3DqHKJ3DddevVBtRiPTuYTz6bBNmgQczm6QG+k6d1kjMdsG6FzkfXjtVz1Jrs5LPCegFzrk2+JqK36BoDANUKWS2dNpMYsgpQkX91RZRJuICiJyqO85k1iXr+6C6RDK9LzpxhdxcDH7TRpEdA== 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=jBckSGlVRAelxJZdaG8qEr/r4MZiBz6gqZABQJD0T2M=; b=r1/5AOPg8sSXJKXsUBmtRDXzL5aJbj/ZY7qB79PfM0pPNTkgWJD96ej1TvFb3QSADByYFk4O4ZqVOFipToUoegC0E/ihOZwnqpDZAq/m4uxGFhY+WMC5LRUMIv6QED8DVCa0Zy8apDnTfnHGBU5byyfkWZLWplWEzHARqZKhCIA= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) by DB7PR05MB5558.eurprd05.prod.outlook.com (2603:10a6:10:5c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Thu, 23 Jul 2020 20:09:38 +0000 Received: from DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293]) by DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293%5]) with mapi id 15.20.3216.022; Thu, 23 Jul 2020 20:09:38 +0000 From: Parav Pandit To: dev@dpdk.org, grive@u256.net, ferruh.yigit@intel.com, thomas@monjalon.net Cc: rasland@mellanox.com, orika@mellanox.com, matan@mellanox.com, joyce.kong@arm.com, Parav Pandit Date: Thu, 23 Jul 2020 23:09:05 +0300 Message-Id: <20200723200910.376581-6-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200723200910.376581-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200723200910.376581-1-parav@mellanox.com> X-ClientProxiedBy: DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) To DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw-mtx-036.mtx.labs.mlnx (208.176.44.194) by DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Thu, 23 Jul 2020 20:09:37 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [208.176.44.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8c705c86-477e-4b87-6ce6-08d82f4453cf X-MS-TrafficTypeDiagnostic: DB7PR05MB5558: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1360; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5lgadj30aZLwrBthr3YC4kUBh59FQ3X9Z0ZD51bqpqzUSCzbRSWL68PlxsWLc+7YlAjrvKpgbPUZpyt9AauyZix3hI8xYfqFCoy9R3PCracrZFhQs+149FKsLketSUAZ3fMKxofo3NBVCSvS34Mqrw+0wBrbE76wURnw1kGi/w7IN1XTI9Fi/A/7+gHqg3LwxajBGgAFGz6wHXjSXySOHIfnh3iidJc01GJueQ8ST0L7NZf+O/pbkzCCzZ/9SS0oeU1t/HvGhOxIl1VAyER/9GRCcSEy5ia4EvipGzR+L97r3R7HX7aisFFBeiKiS26SgL9DuFw6ccUpi+tNcLpwGg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR05MB4876.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(366004)(396003)(136003)(39860400002)(6506007)(8676002)(8936002)(26005)(52116002)(2906002)(4326008)(478600001)(66946007)(66476007)(66556008)(83380400001)(36756003)(5660300002)(2616005)(6486002)(86362001)(956004)(1076003)(6512007)(6666004)(107886003)(186003)(16526019)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: RxZXTjgwz3YeIBcy2WFo7qfF07FYUdjpwh6AHlnsOP68/rUgBP6BEIcwavAq1nKZ+4cF2tB1pWAlRgxusmAOx5p/7kOr9VwoWxxlNa5g8Rn4LmQJZG/kPCB6KfQ0QnbLPmTIA2a3+06GnIoUlJ/lEnTePXLV5K2TFjus3WDOWdHUEL4DQv6BPG9gc1h4wNBuVgnWa0u2fJanBV1nhJaYUX+wCjKd5Btww4iE7Vk/oK6j0CqcFpDpUk+XR+Rr7x5up+jm2ur19snm1y6TZavD4TfJLJiBsMbankGyWwOCn2Mm4nXEJ3oyRn7TGmKthaB5k28wvYGf+pvuzu8jFwWGme16weAZ1NUGxAgSpWBR+MVxgpfICpYqHtn6K9O+aos8N0QKd+LxGM6uNHU3NiHgH418fEdyzm8iV88VPmT4K6B67LpU1ZJUPAihO5mzymycKOHuVB9onJnrVFLjK3NcZ+EZ+PzpktlRIcGAV/glWkolo85RBR/RSzT1feYJ5tsx X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c705c86-477e-4b87-6ce6-08d82f4453cf X-MS-Exchange-CrossTenant-AuthSource: DB7PR05MB4876.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2020 20:09:38.4738 (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: 9zl1jx3N3UFfkKUwX9Q5yHq1Rf9sEICy+wZdnnEhj5doCDHXpxTgYdZa0lkYfKA4mZgDcOsHnbmRPOrhpgAU7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5558 Subject: [dpdk-dev] [PATCH v8 05/10] regex/mlx5: fix segmentation fault during error unwinding X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When fail to initialize the device, avoid segmentation fault while accessing unintialized priv. Fixes: cfc672a90b74 ("regex/mlx5: support probing") Signed-off-by: Parav Pandit --- drivers/regex/mlx5/mlx5_regex.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c index 1ca5bfe9b..36ae9f809 100644 --- a/drivers/regex/mlx5/mlx5_regex.c +++ b/drivers/regex/mlx5/mlx5_regex.c @@ -137,17 +137,17 @@ mlx5_regex_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, if (ret) { DRV_LOG(ERR, "Unable to read HCA capabilities."); rte_errno = ENOTSUP; - goto error; + goto dev_error; } else if (!attr.regex || attr.regexp_num_of_engines == 0) { DRV_LOG(ERR, "Not enough capabilities to support RegEx, maybe " "old FW/OFED version?"); rte_errno = ENOTSUP; - goto error; + goto dev_error; } if (mlx5_regex_engines_status(ctx, 2)) { DRV_LOG(ERR, "RegEx engine error."); rte_errno = ENOMEM; - goto error; + goto dev_error; } priv = rte_zmalloc("mlx5 regex device private", sizeof(*priv), RTE_CACHE_LINE_SIZE); @@ -200,6 +200,7 @@ mlx5_regex_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, mlx5_glue->devx_free_uar(priv->uar); if (priv->regexdev) rte_regexdev_unregister(priv->regexdev); +dev_error: if (ctx) mlx5_glue->close_device(ctx); if (priv) From patchwork Thu Jul 23 20:09:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 74696 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DB1B1A0518; Thu, 23 Jul 2020 22:10:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 50AB51C068; Thu, 23 Jul 2020 22:09:47 +0200 (CEST) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40056.outbound.protection.outlook.com [40.107.4.56]) by dpdk.org (Postfix) with ESMTP id A35541C038 for ; Thu, 23 Jul 2020 22:09:41 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K4qx156qsZF4QNy5sAc1+G8DObZK7SXf1BjCO9Q8DQgIQMNUyo1IoR7yWBjCSvAqTXiizVfUGxTOi2Z7SqunQZhuZSLMRkGyquzocNQaL0B/LTeh4rcsijxt3UmZ2ILvDrlVtL/nHNvpg3VOqtL5c902xKTvqwswld7lCazUGFe+K2QTrHmCY80ZPQgDeG6izm0v1lCRyYp1ObhitMkF2ONwFrVkQpiJYkyMTQw8a2ncJoWEBuNwK9FGXyqI4KngMOBU9d+q57Umf/8B3oqg5afKT6nWflHnS4gwq97PJQ3jfU7jolNf1qNDm6lRgXQVeT9nGHPwszE4u8E18aUWOw== 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=XJ9S1SO1hCF3mj7i5BBl3nsJewJ1eZ8gJCyFvn3c5Ao=; b=oBoZ7IAVd3snWbxlRwjEg4C/yCLeLo8p6UR2LSooUgKaDfta21OOPMb1bzsgKI0Fh+7mChn6bGjEDny5EawfyOFFps1Yb89DlomwgXP31vmrjg588IHu09YL2KBSeKGCrUeOvUCVCL/+o0e7hZ5bYNy6+9WhJDRxnUhr93grjjbvl9eObEWiLN/ulDnXnWtoYvVml7J1WxmCEj1KUsKT+xgdFgs/YY+7dn3PhtVH8O5+0fidjnGUV8klwEMKjqsmrHxIDoHU15bDL1uNZS3CmLtBAocFHMf3xyxsjN1gG1DVVAd81o8IjEzg/40R+b0/I+NknK8qOFPssEmMnXvsdw== 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=XJ9S1SO1hCF3mj7i5BBl3nsJewJ1eZ8gJCyFvn3c5Ao=; b=oXy9h8g9P9Aa4tv+J5NnB7PeQ6KXAAmpJYiWS/EoibTW0LV+7/HvCgr21+RdTlbfFODqX4J/4UE2nnhyopLiSNCnJQ/Eh1CEjkeTl9PUir/Mu7uwtd3fMSGsZV+9SjzuAqtCf8AJSSTKdETle/n7Qkb0JeQ3ZNQZp04dRZOHi0E= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) by DB7PR05MB5558.eurprd05.prod.outlook.com (2603:10a6:10:5c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Thu, 23 Jul 2020 20:09:40 +0000 Received: from DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293]) by DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293%5]) with mapi id 15.20.3216.022; Thu, 23 Jul 2020 20:09:40 +0000 From: Parav Pandit To: dev@dpdk.org, grive@u256.net, ferruh.yigit@intel.com, thomas@monjalon.net Cc: rasland@mellanox.com, orika@mellanox.com, matan@mellanox.com, joyce.kong@arm.com, Parav Pandit Date: Thu, 23 Jul 2020 23:09:06 +0300 Message-Id: <20200723200910.376581-7-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200723200910.376581-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200723200910.376581-1-parav@mellanox.com> X-ClientProxiedBy: DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) To DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw-mtx-036.mtx.labs.mlnx (208.176.44.194) by DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Thu, 23 Jul 2020 20:09:38 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [208.176.44.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 93acba2f-dab3-4daf-cb85-08d82f4454cd X-MS-TrafficTypeDiagnostic: DB7PR05MB5558: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:216; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TcK4LAPC0B9eLmseKwQRppIj2ET6i2ZiJOxrwR7OuHbwk4Yzen/WdWNihitnV1pk4DMrNfiu8oDH/ctvlcAOvo10tbS6GH1QLi0BGs6j6o3oDe5YW0bAtKh3nYhy/CY4FkbHi0ZS0tpvbVklx+meFigzYz1NJyWb854nT6mWLL+bg+8ugqjx04u97Jy5Y+OMrwqQtv9HO6g2CWW1BdFn/rv71i6ZkPRdIJLJcoBa/oLKPl7lGld5kp0y49OnU1SFR1/JiXkXkdrPqjXZMwDbjyh86uvNmp3MoSPQyF4pGiatNj9Vh4+XTkjI+KDMk0iL X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR05MB4876.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(366004)(396003)(136003)(39860400002)(6506007)(8676002)(8936002)(26005)(52116002)(2906002)(4326008)(478600001)(66946007)(66476007)(66556008)(83380400001)(36756003)(5660300002)(2616005)(6486002)(86362001)(956004)(1076003)(6512007)(6666004)(107886003)(186003)(16526019)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ciWrHAA7SfodA5K1eALm+Mrho76+H/DSlHugZba+uj94NolGq08RNgD1d7nvm9HAD+8yqhSuzRVuR9rZtjquw7Z6bb+UOLkyvZhFpnhgPn6iH6vAfyAeUPCGmEKobxJZg98PDpUxXbfjaV9i3M+tYLZ4Q+DkR73oxu36zORqfkENDUfo6l/NnsI1kTUG5QAsUDIFSuKVjAfkQJ4RZ/8NslX+DsoQgE6siOg//wJnM+FlnR72N8tszdTx8lYXBvKr2n8wmRV+gcTsRXvHHejlg7rg/myXESMglFGujyCihrFzjn7wM3RLt0kTclgHyFTPE28fgA843xmZ1L1NQetr0bT7wd8WeBFKtslNf4y3lZ2qpAgPSkMmYYmIIpSTQdgIprxJYrmG1nF3HsT5tSpX6bdWICGkBjrxqKQOthusl3mJOuSpbGW2wKaZA0P3DzvUZL53XrPEbAapN1WMJ1HrGTfWo7Xva3JFF5SVe2IzgGevaBIc3BcFbw4PZgaLy1DM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93acba2f-dab3-4daf-cb85-08d82f4454cd X-MS-Exchange-CrossTenant-AuthSource: DB7PR05MB4876.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2020 20:09:40.1249 (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: 29doLLbj/PZI6PK6k6fYpIPn/alQEJ6Oninn26y7hBogy9JQDjgf0C932Gpp9zwmLLebOyCbXbDYAZSlvhmaBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5558 Subject: [dpdk-dev] [PATCH v8 06/10] common/mlx5: avoid using class constructor priority X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" mlx5_common is shared library between mlx5 net, VDPA and regex PMD. It is better to use common initialization helper instead of using RTE_INIT_CLASS priority. Signed-off-by: Parav Pandit Reviewed-by: David Marchand --- drivers/common/mlx5/mlx5_common.c | 13 +++++++++++-- drivers/common/mlx5/mlx5_common.h | 3 +++ drivers/common/mlx5/rte_common_mlx5_version.map | 1 + drivers/net/mlx5/mlx5.c | 1 + drivers/regex/mlx5/mlx5_regex.c | 1 + drivers/vdpa/mlx5/mlx5_vdpa.c | 1 + 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index 1a67a1b16..2b336bb2d 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -86,12 +86,21 @@ RTE_INIT_PRIO(mlx5_log_init, LOG) rte_log_set_level(mlx5_common_logtype, RTE_LOG_NOTICE); } +static bool mlx5_common_initialized; + /** - * Initialization routine for run-time dependency on glue library. + * One time innitialization routine for run-time dependency on glue library + * for multiple PMDs. Each mlx5 PMD that depends on mlx5_common module, + * must invoke in its constructor. */ -RTE_INIT_PRIO(mlx5_glue_init, CLASS) +void +mlx5_common_init(void) { + if (mlx5_common_initialized) + return; + mlx5_glue_constructor(); + mlx5_common_initialized = true; } /** diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index a811eb6c9..ebe4e9ced 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -260,4 +260,7 @@ int32_t mlx5_release_dbr(struct mlx5_dbr_page_list *head, uint32_t umem_id, uint64_t offset); extern uint8_t haswell_broadwell_cpu; +__rte_internal +void mlx5_common_init(void); + #endif /* RTE_PMD_MLX5_COMMON_H_ */ diff --git a/drivers/common/mlx5/rte_common_mlx5_version.map b/drivers/common/mlx5/rte_common_mlx5_version.map index 132a0695f..65f25252a 100644 --- a/drivers/common/mlx5/rte_common_mlx5_version.map +++ b/drivers/common/mlx5/rte_common_mlx5_version.map @@ -3,6 +3,7 @@ INTERNAL { mlx5_class_get; + mlx5_common_init; mlx5_common_verbs_reg_mr; mlx5_common_verbs_dereg_mr; diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 647ada339..037703d2e 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -2111,6 +2111,7 @@ RTE_LOG_REGISTER(mlx5_logtype, pmd.net.mlx5, NOTICE) */ RTE_INIT(rte_mlx5_pmd_init) { + mlx5_common_init(); /* Build the static tables for Verbs conversion. */ mlx5_set_ptype_table(); mlx5_set_cksum_table(); diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c index 36ae9f809..4e0367052 100644 --- a/drivers/regex/mlx5/mlx5_regex.c +++ b/drivers/regex/mlx5/mlx5_regex.c @@ -258,6 +258,7 @@ static struct rte_pci_driver mlx5_regex_driver = { RTE_INIT(rte_mlx5_regex_init) { + mlx5_common_init(); if (mlx5_glue) rte_pci_register(&mlx5_regex_driver); } diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c index 67e77b11a..85dbcf956 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c @@ -846,6 +846,7 @@ RTE_LOG_REGISTER(mlx5_vdpa_logtype, pmd.vdpa.mlx5, NOTICE) */ RTE_INIT(rte_mlx5_vdpa_init) { + mlx5_common_init(); if (mlx5_glue) rte_pci_register(&mlx5_vdpa_driver); } From patchwork Thu Jul 23 20:09:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 74697 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1C3CAA0518; Thu, 23 Jul 2020 22:10:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B9F121C07E; Thu, 23 Jul 2020 22:09:49 +0200 (CEST) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40071.outbound.protection.outlook.com [40.107.4.71]) by dpdk.org (Postfix) with ESMTP id 45B341C038 for ; Thu, 23 Jul 2020 22:09:43 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jqiM6irhxjjVHItgtW4v+TAWJsBmJCS8bnqG9RRPOmdfl9ppdz6ZfwZRZG247yAcAAxfAhwz+CKFPznTXAexFN6NqGXETlzyKWC2jpN3YiH7v8UiHR191kVspqZZvCvOT01vPBjyP1qI1EgTbe25Z7NGwXmp/ZTBbxJRsGxMedEqEib3cajzlGOoUPxSkpxRZKQjFYDKFpMstxMXPtK8gCoX9BiArJjGDbRyfnp5oynLz6pjzunTxYxqQcjoecIu5bevMkbODGUOxhUV1aW/bcpkX4fqUcb03rI3idLSuRf4Ff3F4YX264YAEG0r8vdELyW/Oufz/jnQNCQOHYibpw== 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=iDHLqTwUYU/7FPloKGlnwZSF3pDrjOjLBNLHPvDO9y4=; b=BeKetGWAI8vtvt0p0OBRFmIiUqqfyMxHX/Zo/d899hqfXHJmd4NeVppxCsx/FaQUyv4NZsT3FZIB0PD2aY/4cu3Zk7eFkDet1iJ+posXt28DgzQWNCauokTQNYrBI22+JU4D8vBVuDrK3N3t0/qOGNChQTh4+A9Fl0PF9MldiyNFN2m3X2XF4SlP4hZ0cdBsIu5t0y+X2RLjavfwOwL42IBn5B8lii7dDqzjB0mlC1xjK9lBKERGfZqwD+gBF/wY8GnTJyfg1C6eqOUatCC08EffDc/7jx1zIj4M2M+8Sc/3JSc4mW+HFyp3IYES4NpGo2LCdFJ2MnhPz9MxaWNLVQ== 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=iDHLqTwUYU/7FPloKGlnwZSF3pDrjOjLBNLHPvDO9y4=; b=kPTMzAFYHEoI/maA6rllWdt95asvPPNVoKfA14YGopg/bik2a1Fp+c+xDRIF5be6Ra6HWgXLKOz3pbz4QJr53F/gqWdKYzguSJ4C0zo84AkZdY8EdoqQvGuiMrBnTnfTfbylfl8t5K4jPNoPXAEcRTwlsWON4UzqFujDjFL+D5U= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) by DB7PR05MB5558.eurprd05.prod.outlook.com (2603:10a6:10:5c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Thu, 23 Jul 2020 20:09:42 +0000 Received: from DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293]) by DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293%5]) with mapi id 15.20.3216.022; Thu, 23 Jul 2020 20:09:42 +0000 From: Parav Pandit To: dev@dpdk.org, grive@u256.net, ferruh.yigit@intel.com, thomas@monjalon.net Cc: rasland@mellanox.com, orika@mellanox.com, matan@mellanox.com, joyce.kong@arm.com, Parav Pandit Date: Thu, 23 Jul 2020 23:09:07 +0300 Message-Id: <20200723200910.376581-8-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200723200910.376581-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200723200910.376581-1-parav@mellanox.com> X-ClientProxiedBy: DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) To DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw-mtx-036.mtx.labs.mlnx (208.176.44.194) by DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Thu, 23 Jul 2020 20:09:40 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [208.176.44.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 718e695f-6ed1-49c5-8e09-08d82f4455cb X-MS-TrafficTypeDiagnostic: DB7PR05MB5558: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1079; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GVIdlAdkWtYaVypuNm1LCwUi1fkU5DfuKDrW5DoiNYgRs91mhcPDQ+BN7A18r9+Nnw5GQL2HZ8LsvDAFSvFjCFwchNlLkKS4lGcxyVReQQ4uVQ8gPG9kSYAOFum56GNvJaNxXHTD97vgVCaQg0EfO48tWqUwhqx2dje85KBVNhpoN1GJSjkTRUoXXXk3iJttOe8ry8eQCUIIzcmzIFVX/8zv76kleAE55uu3kC+kfQ2HKU3hXEBYXR/HxjSPaZK8jxFZHfyj/sXayfajG1BvNw4td3QYW4B7bYTxhcQLi6NSdtH506eWKfUiFfbOZmRRIUIMig+Pxe4zPSi53JMp1Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR05MB4876.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(366004)(396003)(136003)(39860400002)(6506007)(8676002)(8936002)(26005)(52116002)(2906002)(4326008)(478600001)(66946007)(66476007)(66556008)(83380400001)(36756003)(5660300002)(2616005)(6486002)(86362001)(956004)(1076003)(6512007)(6666004)(107886003)(186003)(16526019)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: FR/zUmhrkmU91HH3emua20W5DWKtFzEBMq5lMDCwxavQqiVNFf5G7sDLykAmWSXS5nP5kpctE7lNFuo/uRb66eEFNAPS4et4Phk7REOpM5ERXt3PVFfwuofMgVKF+mbSOmuye3rcZW7eFCdit8KnUJtKLkpM7m6ZQ/8hClo1eiSBZZWovDWwA72E5vGds8U94QXkg/YcVziIoDZkALOZVRK2CZM7Tw56EegxNK+jK8AWTKKMKgJU49wVYcjUB75cUFE5ox8qgfVUWrz+23Qa45GbTLp9sfxkoNxiHBFpjXYdx3HXQiHl9dAXMVMuGIqhl3U5Ofop7QwtypJpPoG8PjaHcWrTyfbeyyqybzFaYhqQdaqSWj63LKch0K4AiWS96Q3bNa3LkmT2KqGOUF/CNeWg/zgAzmSr35fZ+7TSSfrF4taBPrKTldQduX6n9n6SsRk2UOat3gLssLM9m2aSSX34idg6HvS9dHlzhI0yGjbqNjh0f+GF2cmHwrkp/Fru X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 718e695f-6ed1-49c5-8e09-08d82f4455cb X-MS-Exchange-CrossTenant-AuthSource: DB7PR05MB4876.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2020 20:09:41.9468 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: w+m5fxdw8JO5IzoWJItCR2zxq+nTgxJGuTxM0s0ewxGQghxvh5pfdzV7kgale8OpCk+tgTCnk0tq3K1x1tV/qw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5558 Subject: [dpdk-dev] [PATCH v8 07/10] common/mlx5: change class values as bits X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" mlx5 PCI Device supports multiple classes of devices such as net, vdpa, and/or regex. To support these multiple classes, change mlx5_class to a bitmap values so that if users asks to enable multiple of them, all supported classes can be parsed. Signed-off-by: Parav Pandit Acked-by: Matan Azrad --- drivers/common/mlx5/mlx5_common.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index ebe4e9ced..864e82ff0 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -13,6 +13,7 @@ #include #include #include +#include #include "mlx5_prm.h" #include "mlx5_devx_cmds.h" @@ -208,10 +209,10 @@ int mlx5_get_ifname_sysfs(const char *ibdev_path, char *ifname); #define MLX5_CLASS_ARG_NAME "class" enum mlx5_class { - MLX5_CLASS_NET, - MLX5_CLASS_VDPA, - MLX5_CLASS_REGEX, MLX5_CLASS_INVALID, + MLX5_CLASS_NET = RTE_BIT64(0), + MLX5_CLASS_VDPA = RTE_BIT64(1), + MLX5_CLASS_REGEX = RTE_BIT64(2), }; #define MLX5_DBR_SIZE RTE_CACHE_LINE_SIZE From patchwork Thu Jul 23 20:09:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 74698 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9EDEBA0518; Thu, 23 Jul 2020 22:10:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 143061C0B2; Thu, 23 Jul 2020 22:09:51 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130089.outbound.protection.outlook.com [40.107.13.89]) by dpdk.org (Postfix) with ESMTP id 8AD001C000 for ; Thu, 23 Jul 2020 22:09:46 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e0foKv1tuk18lbOlphG20Dwy69M9GYH4IQX5Owmk+tjOeI1LWsOqzrEgCTlIsWRxNiPe9Wg3mRIKjeGT7BW/6yperW/9fLPSGoxo9rD9wOejJRm2RwQVSjI2ddCCqwnrb/G0azel3zmz5iBlVsbEJ+V4bt3izXl6T1GRLL/2/MSEMkvUk3Mahlxua8FQU/yLvZhRmOaueCmtr0QWWf4NbbFXN0oOCs52O6rQJqaB7HJJt3nZKruhon5wafZzuYiuYc6B7ErSxwzzp2Sk/mB+QrndEqW8SDQFUoZ3CdE8MkuiehjPfPsXDndVh6ZmWnaSqIPnWT+xOQOeywTvRi5OCg== 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=o8hauFXDFJda5hDlL67i08cuhrtGnJzOo/C1D6NGCAM=; b=k46ScDetdxZSTj0YFEGP/PpK5XpcLg+KOE9efDhyRd4Nx8Sz1glh6WFgrVQ2//hsCVXKMvdkH4WWkFwn5eE5juGOEAu6XSAAJzqO5t0j1sAQHSgEDtnPsKm6ZrhfRaK+vTOu8q1PN4qK+cB/buofUHUb/UeFz62rRNVeBU1iYcK6aUsiLjcm7+gwSGN9jhwHJS4eRqVtURZs+FOs9feHVuq6Wls5+0TB0DY2ztaaFKaSYswgZnWxqfpyk8eyXdkkOZDanyJt9+OacvteZxeFG4roI/4ZMxQpHgda9jeU++MULyLBOZhGqjKfiCQ6QgFiCjNfIp3QPSz2mDfAEX758g== 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=o8hauFXDFJda5hDlL67i08cuhrtGnJzOo/C1D6NGCAM=; b=k2VPnXC2BDuWeaPg2AxL1uMvGGuiOOxOixNThUmOFzR5JUtXB7uNs3y6AWJ7o4u/Z92S3HfrXA1YglqsQTsVKhFUK0jv3qzKSJi7WT7V5rl45to6tEho3LZEZfWxBt+oIGsopDv8Q3OGNrqh5X1hsMr9I4LUxkhJaWzVEKb2Yiw= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) by DB7PR05MB5558.eurprd05.prod.outlook.com (2603:10a6:10:5c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Thu, 23 Jul 2020 20:09:44 +0000 Received: from DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293]) by DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293%5]) with mapi id 15.20.3216.022; Thu, 23 Jul 2020 20:09:44 +0000 From: Parav Pandit To: dev@dpdk.org, grive@u256.net, ferruh.yigit@intel.com, thomas@monjalon.net Cc: rasland@mellanox.com, orika@mellanox.com, matan@mellanox.com, joyce.kong@arm.com, Parav Pandit Date: Thu, 23 Jul 2020 23:09:08 +0300 Message-Id: <20200723200910.376581-9-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200723200910.376581-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200723200910.376581-1-parav@mellanox.com> X-ClientProxiedBy: DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) To DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw-mtx-036.mtx.labs.mlnx (208.176.44.194) by DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Thu, 23 Jul 2020 20:09:42 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [208.176.44.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 83b894f3-5acd-4d21-6829-08d82f4456ea X-MS-TrafficTypeDiagnostic: DB7PR05MB5558: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1051; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5NMAY7aJ1eTEu9tsHgZqnG5a3vQnXuuthSHHLc2xvzy5Q+z/oHtKRYjBHm+JEpeKN2GkkLhNbd6xNQlXWqIZJTHNOCy9Abxzjp6AmoJ18sDxoWl6yM5g2JmZ4LW0vTLQRCxmouhIuHeXV+LXmT9VcnRC+NfA2qJovtOJ4ivHzfWm9uvRNdhOWbCqg5aP/Dv/TCxxtTGPaFsmbvukYCq0PJ6plPoTizDIoirRIF8RNXfmO8iIg2J0ZTeSSYOpDLfJovT+3MnpkTsQIfPkyfkLJiAPcoKIn1BGS3WMEW28+mPzeXRJNIcM/CtuKBeVam5K X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR05MB4876.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(366004)(396003)(136003)(39860400002)(6506007)(8676002)(8936002)(26005)(52116002)(2906002)(4326008)(478600001)(66946007)(66476007)(66556008)(83380400001)(36756003)(5660300002)(2616005)(6486002)(86362001)(956004)(1076003)(6512007)(6666004)(107886003)(186003)(16526019)(316002)(30864003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: lHuCh5nkQNzQsUzW7PGAveHP+JNU1lpcRp3NQiCEDD1n8pNqE//i972Wib1zVecUoaKl7R9E8VCQQjuNxQsBjBRm7TenSkznfFZzKBrmIjvFqbQNIIqw8UB5KunZUB18D8Vhh9cEqz/9ckgEyvTmANj3UacYiNmj36smdOXlsbSY05LVHJjURSYiBEnvt+39iBMaGLB80lgHWXvxwRowMsYTg7O8wKs19xeRiFVH+NwPSOpLWZVR+9YiPNfWuymd2ka8lauuwa1D2ZQbLAE8/WeIj7iZsKGmCD9IMd4Z3Dgyov941D9mga8FBNif5aGASmENXbpEfE2GoM4ucHFLHjFQa3LMbZl/q8EogALJKvXN0qq1/MO4MhPrlN3M85eb16MCMzkvd6piAuf/e037E7ARidmq1mSBriEX4LiSdGQbKoDUzhzdu+p0pk+eJ5TgeMxu0z3cuG808ZSBhgjUZxGU1Zyh1ixGSqpfKBvJkFWMxkrEm4sHYQvMuWQC7JlS X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83b894f3-5acd-4d21-6829-08d82f4456ea X-MS-Exchange-CrossTenant-AuthSource: DB7PR05MB4876.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2020 20:09:44.2895 (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: ZAsFdhWQY8Avcn4it1yMzIAdd0awJl4ExGrilM/eTAAtgtC0znJ+wPrOZqzlmPRNkD1AaENTA61hEl2jNgZMJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5558 Subject: [dpdk-dev] [PATCH v8 08/10] common/mlx5: introduce layer to support multiple class drivers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Thomas Monjalon Add generic mlx5 PCI PMD layer as part of existing common_mlx5 module. This enables multiple classes (net, regex, vdpa) PMDs to be supported at same time. Signed-off-by: Parav Pandit Acked-by: Matan Azrad Reviewed-by: David Marchand --- drivers/Makefile | 10 +- drivers/common/Makefile | 4 - drivers/common/meson.build | 2 +- drivers/common/mlx5/Makefile | 1 + drivers/common/mlx5/meson.build | 9 +- drivers/common/mlx5/mlx5_common.c | 2 + drivers/common/mlx5/mlx5_common_pci.c | 541 ++++++++++++++++++ drivers/common/mlx5/mlx5_common_pci.h | 77 +++ .../common/mlx5/rte_common_mlx5_version.map | 2 + drivers/meson.build | 1 + 10 files changed, 638 insertions(+), 11 deletions(-) create mode 100644 drivers/common/mlx5/mlx5_common_pci.c create mode 100644 drivers/common/mlx5/mlx5_common_pci.h diff --git a/drivers/Makefile b/drivers/Makefile index 1551272ef..7f06162dc 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -8,8 +8,12 @@ DIRS-y += bus DEPDIRS-bus := common DIRS-y += mempool DEPDIRS-mempool := common bus +ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)$(CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD)),y) +DIRS-y += common/mlx5 +DEPDIRS-common/mlx5 := bus +endif DIRS-y += net -DEPDIRS-net := common bus mempool +DEPDIRS-net := common bus mempool common/mlx5 DIRS-$(CONFIG_RTE_LIBRTE_BBDEV) += baseband DEPDIRS-baseband := common bus mempool DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto @@ -19,9 +23,9 @@ DEPDIRS-common/qat := bus mempool DIRS-$(CONFIG_RTE_LIBRTE_COMPRESSDEV) += compress DEPDIRS-compress := bus mempool DIRS-$(CONFIG_RTE_LIBRTE_REGEXDEV) += regex -DEPDIRS-regex := common bus +DEPDIRS-regex := common bus common/mlx5 DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += vdpa -DEPDIRS-vdpa := common bus mempool +DEPDIRS-vdpa := common bus mempool common/mlx5 DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event DEPDIRS-event := common bus mempool net crypto DIRS-$(CONFIG_RTE_LIBRTE_RAWDEV) += raw diff --git a/drivers/common/Makefile b/drivers/common/Makefile index cbc71077c..cfb6b4dc8 100644 --- a/drivers/common/Makefile +++ b/drivers/common/Makefile @@ -36,8 +36,4 @@ ifneq (,$(findstring y,$(IAVF-y))) DIRS-y += iavf endif -ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)$(CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD)),y) -DIRS-y += mlx5 -endif - include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/meson.build b/drivers/common/meson.build index 5db7e29b1..9ed4c04ba 100644 --- a/drivers/common/meson.build +++ b/drivers/common/meson.build @@ -6,6 +6,6 @@ if is_windows endif std_deps = ['eal'] -drivers = ['cpt', 'dpaax', 'iavf', 'mlx5', 'mvep', 'octeontx', 'octeontx2', 'qat'] +drivers = ['cpt', 'dpaax', 'iavf', 'mvep', 'octeontx', 'octeontx2', 'qat'] config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' driver_name_fmt = 'rte_common_@0@' diff --git a/drivers/common/mlx5/Makefile b/drivers/common/mlx5/Makefile index 6b89a6c85..eaabb8c10 100644 --- a/drivers/common/mlx5/Makefile +++ b/drivers/common/mlx5/Makefile @@ -22,6 +22,7 @@ SRCS-y += linux/mlx5_common_verbs.c SRCS-y += mlx5_common_mp.c SRCS-y += mlx5_common_mr.c SRCS-y += mlx5_malloc.c +SRCS-y += mlx5_common_pci.c ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y) INSTALL-y-lib += $(LIB_GLUE) endif diff --git a/drivers/common/mlx5/meson.build b/drivers/common/mlx5/meson.build index 70e2c1c32..8e5608703 100644 --- a/drivers/common/mlx5/meson.build +++ b/drivers/common/mlx5/meson.build @@ -1,19 +1,22 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright 2019 Mellanox Technologies, Ltd -if not (is_linux or is_windows) +if not is_linux build = false - reason = 'only supported on Linux and Windows' + reason = 'only supported on Linux' subdir_done() endif -deps += ['hash', 'pci', 'net', 'eal', 'kvargs'] +config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' +driver_name_fmt = 'rte_common_@0@' +deps += ['hash', 'pci', 'bus_pci', 'net', 'eal', 'kvargs'] sources += files( 'mlx5_devx_cmds.c', 'mlx5_common.c', 'mlx5_common_mp.c', 'mlx5_common_mr.c', 'mlx5_malloc.c', + 'mlx5_common_pci.c', ) cflags_options = [ diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index 2b336bb2d..fd818ef24 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -14,6 +14,7 @@ #include "mlx5_common_os.h" #include "mlx5_common_utils.h" #include "mlx5_malloc.h" +#include "mlx5_common_pci.h" int mlx5_common_logtype; @@ -100,6 +101,7 @@ mlx5_common_init(void) return; mlx5_glue_constructor(); + mlx5_common_pci_init(); mlx5_common_initialized = true; } diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c new file mode 100644 index 000000000..b42f7469f --- /dev/null +++ b/drivers/common/mlx5/mlx5_common_pci.c @@ -0,0 +1,541 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020 Mellanox Technologies Ltd + */ + +#include +#include +#include "mlx5_common_utils.h" +#include "mlx5_common_pci.h" + +struct mlx5_pci_device { + struct rte_pci_device *pci_dev; + TAILQ_ENTRY(mlx5_pci_device) next; + uint32_t classes_loaded; +}; + +/* Head of list of drivers. */ +static TAILQ_HEAD(mlx5_pci_bus_drv_head, mlx5_pci_driver) drv_list = + TAILQ_HEAD_INITIALIZER(drv_list); + +/* Head of mlx5 pci devices. */ +static TAILQ_HEAD(mlx5_pci_devices_head, mlx5_pci_device) devices_list = + TAILQ_HEAD_INITIALIZER(devices_list); + +static const struct { + const char *name; + unsigned int driver_class; +} mlx5_classes[] = { + { .name = "vdpa", .driver_class = MLX5_CLASS_VDPA }, + { .name = "net", .driver_class = MLX5_CLASS_NET }, + { .name = "regex", .driver_class = MLX5_CLASS_REGEX }, +}; + +static const unsigned int mlx5_class_combinations[] = { + MLX5_CLASS_NET, + MLX5_CLASS_VDPA, + MLX5_CLASS_REGEX, + /* New class combination should be added here. + * For example a new multi class device combination + * can be MLX5_CLASS_FOO | MLX5_CLASS_BAR. + */ +}; + +static int +class_name_to_value(const char *class_name) +{ + unsigned int i; + + for (i = 0; i < RTE_DIM(mlx5_classes); i++) { + if (strcmp(class_name, mlx5_classes[i].name) == 0) + return mlx5_classes[i].driver_class; + } + return -EINVAL; +} + +static struct mlx5_pci_driver * +driver_get(uint32_t class) +{ + struct mlx5_pci_driver *driver; + + TAILQ_FOREACH(driver, &drv_list, next) { + if (driver->driver_class == class) + return driver; + } + return NULL; +} + +static int +bus_cmdline_options_handler(__rte_unused const char *key, + const char *class_names, void *opaque) +{ + int *ret = opaque; + char *nstr_org; + int class_val; + char *found; + char *nstr; + + *ret = 0; + nstr = strdup(class_names); + if (!nstr) { + *ret = -ENOMEM; + return *ret; + } + nstr_org = nstr; + while (nstr) { + /* Extract each individual class name. Multiple + * class key,value is supplied as class=net:vdpa:foo:bar. + */ + found = strsep(&nstr, ":"); + if (!found) + continue; + /* Check if its a valid class. */ + class_val = class_name_to_value(found); + if (class_val < 0) { + *ret = -EINVAL; + goto err; + } + *ret |= class_val; + } +err: + free(nstr_org); + if (*ret < 0) + DRV_LOG(ERR, "Invalid mlx5 class options %s." + " Maybe typo in device class argument setting?", + class_names); + return *ret; +} + +static int +parse_class_options(const struct rte_devargs *devargs) +{ + const char *key = MLX5_CLASS_ARG_NAME; + struct rte_kvargs *kvlist; + int ret = 0; + + if (devargs == NULL) + return 0; + kvlist = rte_kvargs_parse(devargs->args, NULL); + if (kvlist == NULL) + return 0; + if (rte_kvargs_count(kvlist, key)) + rte_kvargs_process(kvlist, key, bus_cmdline_options_handler, + &ret); + rte_kvargs_free(kvlist); + return ret; +} + +static bool +mlx5_bus_match(const struct mlx5_pci_driver *drv, + const struct rte_pci_device *pci_dev) +{ + const struct rte_pci_id *id_table; + + for (id_table = drv->pci_driver.id_table; id_table->vendor_id != 0; + id_table++) { + /* Check if device's ids match the class driver's ids. */ + if (id_table->vendor_id != pci_dev->id.vendor_id && + id_table->vendor_id != PCI_ANY_ID) + continue; + if (id_table->device_id != pci_dev->id.device_id && + id_table->device_id != PCI_ANY_ID) + continue; + if (id_table->subsystem_vendor_id != + pci_dev->id.subsystem_vendor_id && + id_table->subsystem_vendor_id != PCI_ANY_ID) + continue; + if (id_table->subsystem_device_id != + pci_dev->id.subsystem_device_id && + id_table->subsystem_device_id != PCI_ANY_ID) + continue; + if (id_table->class_id != pci_dev->id.class_id && + id_table->class_id != RTE_CLASS_ANY_ID) + continue; + return true; + } + return false; +} + +static int +is_valid_class_combination(uint32_t user_classes) +{ + unsigned int i; + + /* Verify if user specified valid supported combination. */ + for (i = 0; i < RTE_DIM(mlx5_class_combinations); i++) { + if (mlx5_class_combinations[i] == user_classes) + return 0; + } + /* Not found any valid class combination. */ + return -EINVAL; +} + +static struct mlx5_pci_device * +pci_to_mlx5_device(const struct rte_pci_device *pci_dev) +{ + struct mlx5_pci_device *dev; + + TAILQ_FOREACH(dev, &devices_list, next) { + if (dev->pci_dev == pci_dev) + return dev; + } + return NULL; +} + +static bool +device_class_enabled(const struct mlx5_pci_device *device, uint32_t class) +{ + return (device->classes_loaded & class) ? true : false; +} + +static void +dev_release(struct mlx5_pci_device *dev) +{ + TAILQ_REMOVE(&devices_list, dev, next); + rte_free(dev); +} + +static int +drivers_remove(struct mlx5_pci_device *dev, uint32_t enabled_classes) +{ + struct mlx5_pci_driver *driver; + int local_ret = -ENODEV; + unsigned int i = 0; + int ret = 0; + + enabled_classes &= dev->classes_loaded; + while (enabled_classes) { + driver = driver_get(RTE_BIT64(i)); + if (driver) { + local_ret = driver->pci_driver.remove(dev->pci_dev); + if (!local_ret) + dev->classes_loaded &= ~RTE_BIT64(i); + else if (ret == 0) + ret = local_ret; + } + enabled_classes &= ~RTE_BIT64(i); + i++; + } + if (local_ret) + ret = local_ret; + return ret; +} + +static int +drivers_probe(struct mlx5_pci_device *dev, struct rte_pci_driver *pci_drv, + struct rte_pci_device *pci_dev, uint32_t user_classes) +{ + struct mlx5_pci_driver *driver; + uint32_t enabled_classes = 0; + bool already_loaded; + int ret; + + TAILQ_FOREACH(driver, &drv_list, next) { + if ((driver->driver_class & user_classes) == 0) + continue; + if (!mlx5_bus_match(driver, pci_dev)) + continue; + already_loaded = dev->classes_loaded & driver->driver_class; + if (already_loaded && + !(driver->pci_driver.drv_flags & RTE_PCI_DRV_PROBE_AGAIN)) { + DRV_LOG(ERR, "Device %s is already probed\n", + pci_dev->device.name); + ret = -EEXIST; + goto probe_err; + } + ret = driver->pci_driver.probe(pci_drv, pci_dev); + if (ret < 0) { + DRV_LOG(ERR, "Failed to load driver = %s.\n", + driver->pci_driver.driver.name); + goto probe_err; + } + enabled_classes |= driver->driver_class; + } + dev->classes_loaded |= enabled_classes; + return 0; +probe_err: + /* Only unload drivers which are enabled which were enabled + * in this probe instance. + */ + drivers_remove(dev, enabled_classes); + return ret; +} + +/** + * DPDK callback to register to probe multiple drivers for a PCI device. + * + * @param[in] pci_drv + * PCI driver structure. + * @param[in] dev + * PCI device information. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +static int +mlx5_common_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, + struct rte_pci_device *pci_dev) +{ + struct mlx5_pci_device *dev; + uint32_t user_classes = 0; + bool new_device = false; + int ret; + + ret = parse_class_options(pci_dev->device.devargs); + if (ret < 0) + return ret; + user_classes = ret; + if (user_classes) { + /* Validate combination here. */ + ret = is_valid_class_combination(user_classes); + if (ret) { + DRV_LOG(ERR, "Unsupported mlx5 classes supplied."); + return ret; + } + } else { + /* Default to net class. */ + user_classes = MLX5_CLASS_NET; + } + dev = pci_to_mlx5_device(pci_dev); + if (!dev) { + dev = rte_zmalloc("mlx5_pci_device", sizeof(*dev), 0); + if (!dev) + return -ENOMEM; + dev->pci_dev = pci_dev; + TAILQ_INSERT_HEAD(&devices_list, dev, next); + new_device = true; + } + ret = drivers_probe(dev, pci_drv, pci_dev, user_classes); + if (ret) + goto class_err; + return 0; +class_err: + if (new_device) + dev_release(dev); + return ret; +} + +/** + * DPDK callback to remove one or more drivers for a PCI device. + * + * This function removes all drivers probed for a given PCI device. + * + * @param[in] pci_dev + * Pointer to the PCI device. + * + * @return + * 0 on success, the function cannot fail. + */ +static int +mlx5_common_pci_remove(struct rte_pci_device *pci_dev) +{ + struct mlx5_pci_device *dev; + int ret; + + dev = pci_to_mlx5_device(pci_dev); + if (!dev) + return -ENODEV; + /* Matching device found, cleanup and unload drivers. */ + ret = drivers_remove(dev, dev->classes_loaded); + if (!ret) + dev_release(dev); + return ret; +} + +static int +mlx5_common_pci_dma_map(struct rte_pci_device *pci_dev, void *addr, + uint64_t iova, size_t len) +{ + struct mlx5_pci_driver *driver = NULL; + struct mlx5_pci_driver *temp; + struct mlx5_pci_device *dev; + int ret = -EINVAL; + + dev = pci_to_mlx5_device(pci_dev); + if (!dev) + return -ENODEV; + TAILQ_FOREACH(driver, &drv_list, next) { + if (device_class_enabled(dev, driver->driver_class) && + driver->pci_driver.dma_map) { + ret = driver->pci_driver.dma_map(pci_dev, addr, + iova, len); + if (ret) + goto map_err; + } + } + return ret; +map_err: + TAILQ_FOREACH(temp, &drv_list, next) { + if (temp == driver) + break; + if (device_class_enabled(dev, temp->driver_class) && + temp->pci_driver.dma_map && temp->pci_driver.dma_unmap) + temp->pci_driver.dma_unmap(pci_dev, addr, iova, len); + } + return ret; +} + +static int +mlx5_common_pci_dma_unmap(struct rte_pci_device *pci_dev, void *addr, + uint64_t iova, size_t len) +{ + struct mlx5_pci_driver *driver; + struct mlx5_pci_device *dev; + int local_ret = -EINVAL; + int ret; + + dev = pci_to_mlx5_device(pci_dev); + if (!dev) + return -ENODEV; + ret = 0; + /* There is no unmap error recovery in current implementation. */ + TAILQ_FOREACH_REVERSE(driver, &drv_list, mlx5_pci_bus_drv_head, next) { + if (device_class_enabled(dev, driver->driver_class) && + driver->pci_driver.dma_unmap) { + local_ret = driver->pci_driver.dma_unmap(pci_dev, addr, + iova, len); + if (local_ret && (ret == 0)) + ret = local_ret; + } + } + if (local_ret) + ret = local_ret; + return ret; +} + +/* PCI ID table is build dynamically based on registered mlx5 drivers. */ +static struct rte_pci_id *mlx5_pci_id_table; + +static struct rte_pci_driver mlx5_pci_driver = { + .driver = { + .name = "mlx5_pci", + }, + .probe = mlx5_common_pci_probe, + .remove = mlx5_common_pci_remove, + .dma_map = mlx5_common_pci_dma_map, + .dma_unmap = mlx5_common_pci_dma_unmap, +}; + +static int +pci_id_table_size_get(const struct rte_pci_id *id_table) +{ + int table_size = 0; + + for (; id_table->vendor_id != 0; id_table++) + table_size++; + return table_size; +} + +static bool +pci_id_exists(const struct rte_pci_id *id, const struct rte_pci_id *table, + int next_idx) +{ + int current_size = next_idx - 1; + int i; + + for (i = 0; i < current_size; i++) { + if (id->device_id == table[i].device_id && + id->vendor_id == table[i].vendor_id && + id->subsystem_vendor_id == table[i].subsystem_vendor_id && + id->subsystem_device_id == table[i].subsystem_device_id) + return true; + } + return false; +} + +static void +pci_id_insert(struct rte_pci_id *new_table, int *next_idx, + const struct rte_pci_id *id_table) +{ + /* Traverse the id_table, check if entry exists in new_table; + * Add non duplicate entries to new table. + */ + for (; id_table->vendor_id != 0; id_table++) { + if (!pci_id_exists(id_table, new_table, *next_idx)) { + /* New entry; add to the table. */ + new_table[*next_idx] = *id_table; + (*next_idx)++; + } + } +} + +static int +pci_ids_table_update(const struct rte_pci_id *driver_id_table) +{ + const struct rte_pci_id *id_iter; + struct rte_pci_id *updated_table; + struct rte_pci_id *old_table; + int num_ids = 0; + int i = 0; + + old_table = mlx5_pci_id_table; + if (old_table) + num_ids = pci_id_table_size_get(old_table); + num_ids += pci_id_table_size_get(driver_id_table); + /* Increase size by one for the termination entry of vendor_id = 0. */ + num_ids += 1; + updated_table = calloc(num_ids, sizeof(*updated_table)); + if (!updated_table) + return -ENOMEM; + if (TAILQ_EMPTY(&drv_list)) { + /* Copy the first driver's ID table. */ + for (id_iter = driver_id_table; id_iter->vendor_id != 0; + id_iter++, i++) + updated_table[i] = *id_iter; + } else { + /* First copy existing table entries. */ + for (id_iter = old_table; id_iter->vendor_id != 0; + id_iter++, i++) + updated_table[i] = *id_iter; + /* New id to be added at the end of current ID table. */ + pci_id_insert(updated_table, &i, driver_id_table); + } + /* Terminate table with empty entry. */ + updated_table[i].vendor_id = 0; + mlx5_pci_driver.id_table = updated_table; + mlx5_pci_id_table = updated_table; + if (old_table) + free(old_table); + return 0; +} + +void +mlx5_pci_driver_register(struct mlx5_pci_driver *driver) +{ + int ret; + + ret = pci_ids_table_update(driver->pci_driver.id_table); + if (ret) + return; + mlx5_pci_driver.drv_flags |= driver->pci_driver.drv_flags; + TAILQ_INSERT_TAIL(&drv_list, driver, next); +} + +void mlx5_common_pci_init(void) +{ + const struct rte_pci_id empty_table[] = { + { + .vendor_id = 0 + }, + }; + + /* All mlx5 PMDs constructor runs at same priority. So any of the PMD + * including this one can register the PCI table first. If any other + * PMD(s) have registered the PCI ID table, No need to register an empty + * default one. + */ + if (mlx5_pci_id_table == NULL && pci_ids_table_update(empty_table)) + return; + rte_pci_register(&mlx5_pci_driver); +} + +RTE_FINI(mlx5_common_pci_finish) +{ + if (mlx5_pci_id_table != NULL) { + /* Constructor doesn't register with PCI bus if it failed + * to build the table. + */ + rte_pci_unregister(&mlx5_pci_driver); + free(mlx5_pci_id_table); + } +} +RTE_PMD_EXPORT_NAME(mlx5_common_pci, __COUNTER__); diff --git a/drivers/common/mlx5/mlx5_common_pci.h b/drivers/common/mlx5/mlx5_common_pci.h new file mode 100644 index 000000000..41b73e17a --- /dev/null +++ b/drivers/common/mlx5/mlx5_common_pci.h @@ -0,0 +1,77 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020 Mellanox Technologies, Ltd + */ + +#ifndef _MLX5_COMMON_PCI_H_ +#define _MLX5_COMMON_PCI_H_ + +/** + * @file + * + * RTE Mellanox PCI Driver Interface + * Mellanox ConnectX PCI device supports multiple class (net/vdpa/regex) + * devices. This layer enables creating such multiple class of devices on a + * single PCI device by allowing to bind multiple class specific device + * driver to attach to mlx5_pci driver. + * + * ----------- ------------ ------------- + * | mlx5 | | mlx5 | | mlx5 | + * | net pmd | | vdpa pmd | | regex pmd | + * ----------- ------------ ------------- + * \ | / + * \ | / + * \ -------------- / + * \______| mlx5 |_____ / + * | pci common | + * -------------- + * | + * ----------- + * | mlx5 | + * | pci dev | + * ----------- + * + * - mlx5 pci driver binds to mlx5 PCI devices defined by PCI + * ID table of all related mlx5 PCI devices. + * - mlx5 class driver such as net, vdpa, regex PMD defines its + * specific PCI ID table and mlx5 bus driver probes matching + * class drivers. + * - mlx5 pci bus driver is cental place that validates supported + * class combinations. + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include + +#include + +void mlx5_common_pci_init(void); + +/** + * A structure describing a mlx5 pci driver. + */ +struct mlx5_pci_driver { + struct rte_pci_driver pci_driver; /**< Inherit core pci driver. */ + uint32_t driver_class; /**< Class of this driver, enum mlx5_class */ + TAILQ_ENTRY(mlx5_pci_driver) next; +}; + +/** + * Register a mlx5_pci device driver. + * + * @param driver + * A pointer to a mlx5_pci_driver structure describing the driver + * to be registered. + */ +__rte_internal +void +mlx5_pci_driver_register(struct mlx5_pci_driver *driver); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _MLX5_COMMON_PCI_H_ */ diff --git a/drivers/common/mlx5/rte_common_mlx5_version.map b/drivers/common/mlx5/rte_common_mlx5_version.map index 65f25252a..73cf72548 100644 --- a/drivers/common/mlx5/rte_common_mlx5_version.map +++ b/drivers/common/mlx5/rte_common_mlx5_version.map @@ -91,5 +91,7 @@ INTERNAL { mlx5_malloc; mlx5_realloc; mlx5_free; + + mlx5_pci_driver_register; }; diff --git a/drivers/meson.build b/drivers/meson.build index e6d0409aa..95df7ef1d 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -5,6 +5,7 @@ subdirs = [ 'common', 'bus', + 'common/mlx5', # depends on bus. 'mempool', # depends on common and bus. 'net', # depends on common, bus, mempool 'raw', # depends on common, bus and net. From patchwork Thu Jul 23 20:09:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 74699 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1B95BA0518; Thu, 23 Jul 2020 22:11:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 77FA51C0B6; Thu, 23 Jul 2020 22:09:52 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130059.outbound.protection.outlook.com [40.107.13.59]) by dpdk.org (Postfix) with ESMTP id 87F411C07B for ; Thu, 23 Jul 2020 22:09:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aJN9ZiPxSgP0j/2O63DttjjbjXFrb0K56qy5xPOL5qmKqerRlXRgB0/Jf2RvdcqRO3Xh94V921+mGUkcL5PwvuGxaylLasWcDT/HI1Fpucn/s0AJr2Br7u/DrvqjZSci9vxqACOtPoQYYM6VP2eEqcfNEqxH2LTIviNDZPnabnU3MRy9sYA0uEP2risIBgnMiwzD94ltLctG9deVg9JiS/FAbWxWTrmAC5MzcCrbBKeBwz3mdO1raSpelASUnZ88v+ZjjmN9RIs27qkv4BMcI0bHL2vwsp+i83WCSiX7/k7hm3zcSiXF4ptxd1y7tnCVLDQdui7rn4YBMkFtelYisA== 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=vLrSxmT5xWorrV5RyxNTSvE9IGBzBoraLUJ5ThEln/w=; b=c3rewZ91IY4FOLQK873rAJdkCfrPaqY9XeufVCiwZ0dvb6z3ltfFmW57DZnFDL2DiQ7VmNKCJtXOxIgc00qqkM4ctQG2dGqzVruvEWPyHki7531hSbPV6EsBoniBWEIqvug1eHrl5fReOgrcBX3TTP74YnD8HEeoXVqIDoQdr9xXgtL8MDOnhvV7x4cATnW5ce+nDlfCKSQBT4L6N7AqZgv1F8IJtzsHe8gIWAt0RQeruWloe1Ua6+DOnNTOYcljHTX3q0aJFIgCNaxDWyWzDsckZK3WXwLfptOTI5UJBDAn4+WnLQGMtPFJ7cmD2CKhgrdO/7S4iTsNIhjOVBKRww== 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=vLrSxmT5xWorrV5RyxNTSvE9IGBzBoraLUJ5ThEln/w=; b=dMu+SVLtfnDt3zdEvKH/UmSFJsAN2IfdlR7RG+WQnd2kYVICaxd2J3qFtoHShsfGXkw3B8/At7vOkQVNXYO1HtoEAXPEOTT73sCRoYYdmYgneMZpDMuNytMWrWTcvFtZHzd06SMHqa55FgdU/fK2W61bsNDDdaDDvhszMKaantI= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) by DB7PR05MB5558.eurprd05.prod.outlook.com (2603:10a6:10:5c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Thu, 23 Jul 2020 20:09:46 +0000 Received: from DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293]) by DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293%5]) with mapi id 15.20.3216.022; Thu, 23 Jul 2020 20:09:46 +0000 From: Parav Pandit To: dev@dpdk.org, grive@u256.net, ferruh.yigit@intel.com, thomas@monjalon.net Cc: rasland@mellanox.com, orika@mellanox.com, matan@mellanox.com, joyce.kong@arm.com, Parav Pandit Date: Thu, 23 Jul 2020 23:09:09 +0300 Message-Id: <20200723200910.376581-10-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200723200910.376581-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200723200910.376581-1-parav@mellanox.com> X-ClientProxiedBy: DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) To DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw-mtx-036.mtx.labs.mlnx (208.176.44.194) by DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Thu, 23 Jul 2020 20:09:44 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [208.176.44.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e07fd763-1131-482a-2f15-08d82f445860 X-MS-TrafficTypeDiagnostic: DB7PR05MB5558: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:284; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Rgd9i82qViOuGpJku8l/goMTpU7iIdR/E9zY3ZJew9NM8QhGoff4OsUuGLEO2Vg1kJXjgBmRlm3uCJsF5v1sd1jkcmpo45f0oWq4a7zY8VMEY4orLb0s74ppYiGtkSh7MdiDpVmJ8uteKt+gKo/0NF9muA2bSGpnckf30i52dbCtfkQYjDQXBULwNsvYLFWbKNcBDoW53u+x2/OUkfciuB4wa/2+q8MIlpEg8UHrHe0zN/eZUrp5fdltJwM7zGmBD2yLNbo/JWJxsSpwVeHqdKSXvZ3GbnDPcFe4KSUpE2Be+p4uQqHwJGufvUvS3WSWEVPifdUER4v28CMiuUJQ2A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR05MB4876.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(366004)(396003)(136003)(39860400002)(6506007)(8676002)(8936002)(26005)(52116002)(2906002)(4326008)(478600001)(66946007)(66476007)(66556008)(83380400001)(36756003)(5660300002)(2616005)(6486002)(86362001)(956004)(1076003)(6512007)(6666004)(107886003)(186003)(16526019)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 5ew/t0kN5kJWVuqTjWgfSTgkZ9VmnpCpK3iHDYIJQe8cV8KfquMXCeIl2OdTsiwXQKnrLFiyZj6jlKVywADEhL8S19XJtGdvsdiG/eyNNBk2MP7w+ui6KmsoK5Pynk5aq8sSQDRJocZ8Q+I+WdzrnwU93fG1dxpRgFShtShctGAfDOO0a3rZ7kOOZGI0eri0bPYna+LKdvaB4D3Uf1NBLOsJ8WZU8NYLzO0kBOUjEyTS7m1tzokEqII9iHtOJO8MlngzECVTuMP+/W+VyxTSJM0v7qp9R48wvoyfOKDXKeAjM87Y8k2+eGlC/I1vxsFal2nRuwAK/2lsh0wbTHKtL8BuGEwvSx5S1h71kLgEJNKmABBiR1VT2XVWoXBOHW6K9LkLemdgK1j6t+tbFb++y9NesSP8ef2ImsXxJg/DNNTThbKWNXgNQ06iCJYNwxyNkZDE7PO7VRwGJfLA/TjFl1p62KizA7ALk6g4jXm67j+d6bRXYqHzlw83PnVIgqvc X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e07fd763-1131-482a-2f15-08d82f445860 X-MS-Exchange-CrossTenant-AuthSource: DB7PR05MB4876.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2020 20:09:46.4402 (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: jDxdOMUshTYb+h5jtc6qt1CIz6U7QUZHntv0W1Ys1vjJ/N46yaF8arFY6+/BMObUvNtE+SbN74ya5P2RcWqkYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5558 Subject: [dpdk-dev] [PATCH v8 09/10] common/mlx5: register class drivers through common layer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Migrate mlx5 net, vdpa and regex PMD to start using mlx5 common class driver. Signed-off-by: Parav Pandit Acked-by: Matan Azrad --- Changelog: v7->v8: - Extended support for newly added mlx5 regex driver --- drivers/common/mlx5/mlx5_common_pci.c | 6 ++---- drivers/net/mlx5/Makefile | 1 - drivers/net/mlx5/linux/mlx5_os.c | 1 - drivers/net/mlx5/mlx5.c | 24 ++++++++++++++---------- drivers/net/mlx5/mlx5.h | 1 - drivers/regex/mlx5/meson.build | 2 +- drivers/regex/mlx5/mlx5_regex.c | 21 ++++++++++++--------- drivers/vdpa/mlx5/Makefile | 3 ++- drivers/vdpa/mlx5/meson.build | 2 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 23 +++++++++++++---------- 10 files changed, 45 insertions(+), 39 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c index b42f7469f..08c8a5538 100644 --- a/drivers/common/mlx5/mlx5_common_pci.c +++ b/drivers/common/mlx5/mlx5_common_pci.c @@ -34,10 +34,8 @@ static const unsigned int mlx5_class_combinations[] = { MLX5_CLASS_NET, MLX5_CLASS_VDPA, MLX5_CLASS_REGEX, - /* New class combination should be added here. - * For example a new multi class device combination - * can be MLX5_CLASS_FOO | MLX5_CLASS_BAR. - */ + MLX5_CLASS_NET | MLX5_CLASS_REGEX, + /* New class combination should be added here. */ }; static int diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index 253faf909..568c77241 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -55,7 +55,6 @@ LDLIBS += -lrte_common_mlx5 LDLIBS += -lm LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -LDLIBS += -lrte_bus_pci # A few warnings cannot be avoided in external headers. CFLAGS += -Wno-error=cast-qual diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index fa3b02787..97d7b0e7b 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1537,7 +1537,6 @@ mlx5_os_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, strerror(rte_errno)); return -rte_errno; } - MLX5_ASSERT(pci_drv == &mlx5_driver); errno = 0; ibv_list = mlx5_glue->get_device_list(&ret); if (!ibv_list) { diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 037703d2e..1e4c695f8 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "mlx5_defs.h" @@ -2091,16 +2092,19 @@ static const struct rte_pci_id mlx5_pci_id_map[] = { } }; -struct rte_pci_driver mlx5_driver = { - .driver = { - .name = MLX5_DRIVER_NAME +static struct mlx5_pci_driver mlx5_driver = { + .driver_class = MLX5_CLASS_NET, + .pci_driver = { + .driver = { + .name = MLX5_DRIVER_NAME, + }, + .id_table = mlx5_pci_id_map, + .probe = mlx5_os_pci_probe, + .remove = mlx5_pci_remove, + .dma_map = mlx5_dma_map, + .dma_unmap = mlx5_dma_unmap, + .drv_flags = PCI_DRV_FLAGS, }, - .id_table = mlx5_pci_id_map, - .probe = mlx5_os_pci_probe, - .remove = mlx5_pci_remove, - .dma_map = mlx5_dma_map, - .dma_unmap = mlx5_dma_unmap, - .drv_flags = PCI_DRV_FLAGS, }; /* Initialize driver log type. */ @@ -2117,7 +2121,7 @@ RTE_INIT(rte_mlx5_pmd_init) mlx5_set_cksum_table(); mlx5_set_swp_types_table(); if (mlx5_glue) - rte_pci_register(&mlx5_driver); + mlx5_pci_driver_register(&mlx5_driver); } RTE_PMD_EXPORT_NAME(net_mlx5, __COUNTER__); diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index a92194d2d..78d6eb728 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -119,7 +119,6 @@ struct mlx5_local_data { }; extern struct mlx5_shared_data *mlx5_shared_data; -extern struct rte_pci_driver mlx5_driver; /* Dev ops structs */ extern const struct eth_dev_ops mlx5_os_dev_ops; diff --git a/drivers/regex/mlx5/meson.build b/drivers/regex/mlx5/meson.build index 7f800f2e3..d7cb2c572 100644 --- a/drivers/regex/mlx5/meson.build +++ b/drivers/regex/mlx5/meson.build @@ -8,7 +8,7 @@ if not is_linux endif fmt_name = 'mlx5_regex' -deps += ['common_mlx5', 'bus_pci', 'eal', 'regexdev'] +deps += ['common_mlx5', 'eal', 'regexdev'] sources = files( 'mlx5_regex.c', 'mlx5_rxp.c', diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c index 4e0367052..ae9f00189 100644 --- a/drivers/regex/mlx5/mlx5_regex.c +++ b/drivers/regex/mlx5/mlx5_regex.c @@ -5,12 +5,12 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -246,21 +246,24 @@ static const struct rte_pci_id mlx5_regex_pci_id_map[] = { } }; -static struct rte_pci_driver mlx5_regex_driver = { - .driver = { - .name = "mlx5_regex", +static struct mlx5_pci_driver mlx5_regex_driver = { + .driver_class = MLX5_CLASS_REGEX, + .pci_driver = { + .driver = { + .name = "mlx5_regex", + }, + .id_table = mlx5_regex_pci_id_map, + .probe = mlx5_regex_pci_probe, + .remove = mlx5_regex_pci_remove, + .drv_flags = 0, }, - .id_table = mlx5_regex_pci_id_map, - .probe = mlx5_regex_pci_probe, - .remove = mlx5_regex_pci_remove, - .drv_flags = 0, }; RTE_INIT(rte_mlx5_regex_init) { mlx5_common_init(); if (mlx5_glue) - rte_pci_register(&mlx5_regex_driver); + mlx5_pci_driver_register(&mlx5_regex_driver); } RTE_LOG_REGISTER(mlx5_regex_logtype, pmd.regex.mlx5, NOTICE) diff --git a/drivers/vdpa/mlx5/Makefile b/drivers/vdpa/mlx5/Makefile index 8a1c2eab5..1cbbcecf8 100644 --- a/drivers/vdpa/mlx5/Makefile +++ b/drivers/vdpa/mlx5/Makefile @@ -24,13 +24,14 @@ CFLAGS += -I$(RTE_SDK)/drivers/common/mlx5/linux CFLAGS += -I$(RTE_SDK)/drivers/net/mlx5_vdpa CFLAGS += -I$(RTE_SDK)/lib/librte_sched CFLAGS += -I$(BUILDDIR)/drivers/common/mlx5 +CFLAGS += -I$(RTE_SDK)/drivers/bus/mlx5_pci CFLAGS += -D_BSD_SOURCE CFLAGS += -D_DEFAULT_SOURCE CFLAGS += -D_XOPEN_SOURCE=600 CFLAGS += $(WERROR_FLAGS) CFLAGS += -Wno-strict-prototypes LDLIBS += -lrte_common_mlx5 -LDLIBS += -lrte_eal -lrte_vhost -lrte_kvargs -lrte_pci -lrte_bus_pci -lrte_sched +LDLIBS += -lrte_eal -lrte_vhost -lrte_kvargs -lrte_pci -lrte_sched LDLIBS += -pthread # A few warnings cannot be avoided in external headers. diff --git a/drivers/vdpa/mlx5/meson.build b/drivers/vdpa/mlx5/meson.build index 2963aad71..254a8ec14 100644 --- a/drivers/vdpa/mlx5/meson.build +++ b/drivers/vdpa/mlx5/meson.build @@ -8,7 +8,7 @@ if not is_linux endif fmt_name = 'mlx5_vdpa' -deps += ['hash', 'common_mlx5', 'vhost', 'pci', 'bus_pci', 'eal', 'sched'] +deps += ['hash', 'common_mlx5', 'vhost', 'pci', 'eal', 'sched'] sources = files( 'mlx5_vdpa.c', 'mlx5_vdpa_mem.c', diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c index 85dbcf956..ffe2f00ac 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c @@ -11,12 +11,12 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -657,7 +657,7 @@ mlx5_vdpa_config_get(struct rte_devargs *devargs, struct mlx5_vdpa_priv *priv) } /** - * DPDK callback to register a PCI device. + * DPDK callback to register a mlx5 PCI device. * * This function spawns vdpa device out of a given PCI device. * @@ -829,14 +829,17 @@ static const struct rte_pci_id mlx5_vdpa_pci_id_map[] = { } }; -static struct rte_pci_driver mlx5_vdpa_driver = { - .driver = { - .name = "mlx5_vdpa", +static struct mlx5_pci_driver mlx5_vdpa_driver = { + .driver_class = MLX5_CLASS_VDPA, + .pci_driver = { + .driver = { + .name = "mlx5_vdpa", + }, + .id_table = mlx5_vdpa_pci_id_map, + .probe = mlx5_vdpa_pci_probe, + .remove = mlx5_vdpa_pci_remove, + .drv_flags = 0, }, - .id_table = mlx5_vdpa_pci_id_map, - .probe = mlx5_vdpa_pci_probe, - .remove = mlx5_vdpa_pci_remove, - .drv_flags = 0, }; RTE_LOG_REGISTER(mlx5_vdpa_logtype, pmd.vdpa.mlx5, NOTICE) @@ -848,7 +851,7 @@ RTE_INIT(rte_mlx5_vdpa_init) { mlx5_common_init(); if (mlx5_glue) - rte_pci_register(&mlx5_vdpa_driver); + mlx5_pci_driver_register(&mlx5_vdpa_driver); } RTE_PMD_EXPORT_NAME(net_mlx5_vdpa, __COUNTER__); From patchwork Thu Jul 23 20:09:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 74700 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7D355A0518; Thu, 23 Jul 2020 22:11:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A99E31C0D2; Thu, 23 Jul 2020 22:09:55 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80051.outbound.protection.outlook.com [40.107.8.51]) by dpdk.org (Postfix) with ESMTP id E883F1C0AE for ; Thu, 23 Jul 2020 22:09:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oGY8x7jViABvHJ4jGqGf6nAgXfrJ6xCHhEHhuV621m9u4ACA/N8GYXFCeMD6L6tVydOJ+Q8gXMZQlxiAe0bTK460flq0jxqX2l1rK4wX4CSjDgKw/q0LMni6090KjLR4fCdgjSY/KhjSbvJ/G+zIuwi85d8wB6pc5eVXB+Zs3OecPI1X35v1pBpPJthr4s/WCaQBAToR3k3Fj6JxcMGiLiOWr+KfHbMQt1gt0Taavcfn2Cn5zrVmfPSGXik1ADB7m6gTitNeOLG/qFFnQyXBopMmuwkLoUaGq4DmT7DRw3xMeTGaI0aLwFoUujIl016IIubpkZhSCLIi/FrE9aK0xw== 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=M8SXPw7eKOJbjLmDRs/d1C2C7IKFtlh10Bqvlh2eiQs=; b=DsURQQY5Wwx5JaF6FGPUYZaVoBMguut35rTRgCV7i1dOj4IlfT8Q2EkWDHqP76yv623yvF8PXFJ6iyDBMynYfw8K29zAWty6yX0Igs4RZlRth7Vx0CQAJKulyGqop3Fh86pbE/wW0nHtMRmeX6VjwSbVoYWgPta7X1BXcQLZt4TXU9AJDFi8VuPFCLSy2XrIa3JI/M5qwrrms9TfK962/Y4FGC6n67nlAYDJZfWCHEo9GmW0o/Fnf1sW+H7lzQ49hIuEdUvBTmMNNH1jwb8pmeoeqCXZg3P85dwmV7iu25rnH6mBeZDijkGKfrXlJex/HO7yf6RlQf0AomWjnqPDtw== 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=M8SXPw7eKOJbjLmDRs/d1C2C7IKFtlh10Bqvlh2eiQs=; b=Ho666SR2TD8XxH1ZgYmv/+9AO/J1ceDn0RrsvP9ktriHEGaDIQapKMhax0R0KhYv2II79McHLPZLPVCGlXt24rkFE1Bg87rc23tljq4nSex6tgCL+/lMr9DMiK333xkhStbxHGOvuOvrl9MOfTPtLCZWyQ4wEnZ5jjOF1LH6y3Q= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) by DB7PR05MB5558.eurprd05.prod.outlook.com (2603:10a6:10:5c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Thu, 23 Jul 2020 20:09:48 +0000 Received: from DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293]) by DB7PR05MB4876.eurprd05.prod.outlook.com ([fe80::8cb3:93cb:c3ef:4293%5]) with mapi id 15.20.3216.022; Thu, 23 Jul 2020 20:09:48 +0000 From: Parav Pandit To: dev@dpdk.org, grive@u256.net, ferruh.yigit@intel.com, thomas@monjalon.net Cc: rasland@mellanox.com, orika@mellanox.com, matan@mellanox.com, joyce.kong@arm.com, Parav Pandit Date: Thu, 23 Jul 2020 23:09:10 +0300 Message-Id: <20200723200910.376581-11-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200723200910.376581-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200723200910.376581-1-parav@mellanox.com> X-ClientProxiedBy: DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) To DB7PR05MB4876.eurprd05.prod.outlook.com (2603:10a6:10:1d::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw-mtx-036.mtx.labs.mlnx (208.176.44.194) by DM6PR03CA0009.namprd03.prod.outlook.com (2603:10b6:5:40::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Thu, 23 Jul 2020 20:09:46 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [208.176.44.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 041afbd6-f5fd-4d03-774d-08d82f4459a5 X-MS-TrafficTypeDiagnostic: DB7PR05MB5558: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nMHGyv84Cg/d9C92hx+bkeWFNKAy52QB0YBgDx46wAcw9dZsvcahsoCy6Ml5Hu+PT0+6Q686yYmHzw5S83a4Qetq9dwRK5dBtf3mi6N5N2fFCHLqY7iUlaE7GmKJOaj44GEwee/XO4GDAX2TO7nN9LPNha2efpxjGOq2s96za3d7vEDA5ChCgYCkbJFj6vnR6gPSoL5nTjTGzKhRl1UZhsyEdt6V/9EJTBSy0DOSQ06/l/I69AZL44A+hwZLtJYbk7NKSOddHd7qKTgAWU3TACnkISuxZN8t7ug2hzBzd+j2gh0R0wmnzEmb7goePs8m X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR05MB4876.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(346002)(366004)(396003)(136003)(39860400002)(6506007)(8676002)(8936002)(26005)(52116002)(2906002)(4326008)(478600001)(66946007)(66476007)(66556008)(83380400001)(36756003)(5660300002)(2616005)(6486002)(86362001)(956004)(1076003)(6512007)(6666004)(107886003)(186003)(16526019)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: xsWSrb1956SZnPSIBRvS3uRdEtwnjzyFNwqd7zoWMRyl2N1RXM5nqPBgqEfivUlZAQRQDp5pYZW9rdcJCWKA96j+dkM7hFWDMStl9AJ4EeWNs1uAnr773kN/U6XbxHd0motOUq+PTr68PMgSoHAnQnZSARck1fe0htphYT8N3U5f8MwugvOL/8cw3vh5OeX91XJU4B8+y23T5XOrzxXfapUm01J5tme0XcK5T8RlbD1exvP6S+UeKV2KxG/7UrfEzixK44o8beWu/iaIuI+d3geI9Gr7cp5q/356PhMsc+ZC/cptOUR1jujewP5+IHU/lp2+wB5SQ/Cg+KkgsRNtolL1jnb1EzCRwIQiCbYmajdMwSGl+tEXftubaT9/SOQs1Z0JxtOr8xBs11DBV88U8t6SE8HsGtt0amk8Bj9VCV8Abb5Gf5aJcWlhTf7b/p78BvtQIS39EXH+6SxFBthMvCd3JqnGH+07PNlqYNR0Ylg8sAQvkMQzR3DCkvDlt0Ld X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 041afbd6-f5fd-4d03-774d-08d82f4459a5 X-MS-Exchange-CrossTenant-AuthSource: DB7PR05MB4876.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2020 20:09:48.2382 (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: DkQ+6fEYEYQ0/t+IzlBKyFlM2UFarJ/4NDXfAtc3Em01rtj/DMiUgOXuv/cjpikGGvL5zGO+1bcXO3UZ6rF0kw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5558 Subject: [dpdk-dev] [PATCH v8 10/10] common/mlx5: remove class check from class drivers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Now that mlx5_pci PMD checks for enabled classes and performs probe(), remove() of associated classes, individual class driver does not need to check if other driver is enabled. Signed-off-by: Parav Pandit Acked-by: Matan Azrad --- drivers/common/mlx5/mlx5_common.c | 37 ------------------- drivers/common/mlx5/mlx5_common.h | 2 - .../common/mlx5/rte_common_mlx5_version.map | 3 +- drivers/net/mlx5/linux/mlx5_os.c | 5 --- drivers/vdpa/mlx5/mlx5_vdpa.c | 5 --- 5 files changed, 1 insertion(+), 51 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index fd818ef24..06f0a6400 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -20,43 +20,6 @@ int mlx5_common_logtype; uint8_t haswell_broadwell_cpu; -static int -mlx5_class_check_handler(__rte_unused const char *key, const char *value, - void *opaque) -{ - enum mlx5_class *ret = opaque; - - if (strcmp(value, "vdpa") == 0) { - *ret = MLX5_CLASS_VDPA; - } else if (strcmp(value, "net") == 0) { - *ret = MLX5_CLASS_NET; - } else { - DRV_LOG(ERR, "Invalid mlx5 class %s. Maybe typo in device" - " class argument setting?", value); - *ret = MLX5_CLASS_INVALID; - } - return 0; -} - -enum mlx5_class -mlx5_class_get(struct rte_devargs *devargs) -{ - struct rte_kvargs *kvlist; - const char *key = MLX5_CLASS_ARG_NAME; - enum mlx5_class ret = MLX5_CLASS_NET; - - if (devargs == NULL) - return ret; - kvlist = rte_kvargs_parse(devargs->args, NULL); - if (kvlist == NULL) - return ret; - if (rte_kvargs_count(kvlist, key)) - rte_kvargs_process(kvlist, key, mlx5_class_check_handler, &ret); - rte_kvargs_free(kvlist); - return ret; -} - - /* In case this is an x86_64 intel processor to check if * we should use relaxed ordering. */ diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index 864e82ff0..2cdb226f3 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -247,8 +247,6 @@ struct mlx5_klm { LIST_HEAD(mlx5_dbr_page_list, mlx5_devx_dbr_page); -__rte_internal -enum mlx5_class mlx5_class_get(struct rte_devargs *devargs); __rte_internal void mlx5_translate_port_name(const char *port_name_in, struct mlx5_switch_info *port_info_out); diff --git a/drivers/common/mlx5/rte_common_mlx5_version.map b/drivers/common/mlx5/rte_common_mlx5_version.map index 73cf72548..7729d0dd0 100644 --- a/drivers/common/mlx5/rte_common_mlx5_version.map +++ b/drivers/common/mlx5/rte_common_mlx5_version.map @@ -1,9 +1,8 @@ INTERNAL { global: - mlx5_class_get; - mlx5_common_init; + mlx5_common_verbs_reg_mr; mlx5_common_verbs_dereg_mr; diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 97d7b0e7b..fc339affa 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1524,11 +1524,6 @@ mlx5_os_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, unsigned int dev_config_vf; int ret; - if (mlx5_class_get(pci_dev->device.devargs) != MLX5_CLASS_NET) { - DRV_LOG(DEBUG, "Skip probing - should be probed by other mlx5" - " driver."); - return 1; - } if (rte_eal_process_type() == RTE_PROC_PRIMARY) mlx5_pmd_socket_init(); ret = mlx5_init_once(); diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c index ffe2f00ac..c0b87bcc0 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c @@ -680,11 +680,6 @@ mlx5_vdpa_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct mlx5_hca_attr attr; int ret; - if (mlx5_class_get(pci_dev->device.devargs) != MLX5_CLASS_VDPA) { - DRV_LOG(DEBUG, "Skip probing - should be probed by other mlx5" - " driver."); - return 1; - } ibv = mlx5_vdpa_get_ib_device_match(&pci_dev->addr); if (!ibv) { DRV_LOG(ERR, "No matching IB device for PCI slot "