From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AAB60A0524; Sun, 26 Jul 2020 16:57:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AE3201C127; Sun, 26 Jul 2020 16:56:10 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2055.outbound.protection.outlook.com [40.107.21.55]) by dpdk.org (Postfix) with ESMTP id 6BD5B1C0D6 for ; Sun, 26 Jul 2020 16:56:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EAZF0sohimPQRpG8wIsBBWWN37HkPAZkwPRPLxW8ER8UM8hIPBQl8Ex1hE0F4NZVMk1BUax5WpoQw8qzVzlaCYLgRaCbofVQ4vM9mjEK1v8ocgObYNWI02Tn+J4wTaTDlzEkpPEh/VE1dZAcZ5guYQIQX9xBNfAFOyLyyeUHRUVkWBGZXTu0Hjnim8uBRbmx81IEMz5XuQy6r4ajDDhDPaRn6bTaeH3gEIfTR92tLCztrgBrZYspTnq7ym/+cMRFnJ67RSYtdWGEPLs19nhbwQ9QAUAuZPN9WUZRQlIdC4jsnhm4paQHrZfxcuiptZX79HrCC2jISCtLrmy3bPtvHA== 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=TMyZRp1nmmyEt30SV7SsT+gh+60Uq31nB+G8SVLvEMc=; b=CE3Ie7wnuj3Kfk17+bxoyrV48k9mestX9hOk1td2db+CcGSe9DSjA2bZqSL+4Pj4WXxjVqbZ5gLcuS9jUSq856brt0/6wc+AVkq/FIvhVKgDcmP7yiQOKssHO3mu3QEB5/QeIrGasoqSZr8p+NMgQxTXSYYd9Dooj7OjBMV38nBMkVWUe/862Xs6DihySxLJ8F8wHNab7QpzWob+X1KukZetMGgMzz84I4N7qI2mlsUn5bNZVuMb7sOGqnJhXxsmsnQYbxzoNlhzO45Yt/A/zWpYtz7oNGgoLyLxkIhVkRtnyM7C+lROVowlBq84fxGkp2ul7LqoeAsmFWo7OpH6nA== 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=TMyZRp1nmmyEt30SV7SsT+gh+60Uq31nB+G8SVLvEMc=; b=jFnC38xaaJvhk4cYrcTQ6Svqlgm5agad06TPkSyW/uvnPMLZGsddAnLKKKGLcuM0LQRUKKh8wiHfFPRnCanM5VeuOjCcQNDVURRaNy5kwPldZ8y2Xpkc5hECqUcHjrLmQmz+skacm1QZG/rkX6oOJYt+jFkCq0Lvw4Y7wIR/HqI= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB4866.eurprd05.prod.outlook.com (2603:10a6:208:c0::32) by AM0PR05MB6225.eurprd05.prod.outlook.com (2603:10a6:208:117::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.27; Sun, 26 Jul 2020 14:56:02 +0000 Received: from AM0PR05MB4866.eurprd05.prod.outlook.com ([fe80::eccf:72b3:bacb:f09d]) by AM0PR05MB4866.eurprd05.prod.outlook.com ([fe80::eccf:72b3:bacb:f09d%5]) with mapi id 15.20.3216.031; Sun, 26 Jul 2020 14:56:02 +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: Sun, 26 Jul 2020 17:55:23 +0300 Message-Id: <20200726145524.149355-10-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200726145524.149355-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200726145524.149355-1-parav@mellanox.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: DM5PR04CA0045.namprd04.prod.outlook.com (2603:10b6:3:12b::31) To AM0PR05MB4866.eurprd05.prod.outlook.com (2603:10a6:208:c0::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw-mtx-036.mtx.labs.mlnx (208.176.44.194) by DM5PR04CA0045.namprd04.prod.outlook.com (2603:10b6:3:12b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Sun, 26 Jul 2020 14:56:00 +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: d299ed6d-220e-4ee9-0aa7-08d8317403bb X-MS-TrafficTypeDiagnostic: AM0PR05MB6225: 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:240; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IfHWFhGE4+UOmy7ozszYPCOI3Lc2w/FLoX0P/CJ0CsFZov9iPMv67kr1CL43ZxaQxMRISKgPY+Dn5ZBV/nUsGfNM6+aRwHwidRfz+08Yr//DiOBweQJw4soKg4lWwSQCbBks09QRZJEsJOP7CMIS0l7HMNBtAl+PvJZ3gJ3/Ol9cK83o2FUCkcA30Y0lEltkbSBV5XkEQRFFYEPcbwF5oNDx7XncGeZRb4S3xB3Bk0bsYGgOpew7BPO7X1T9FpiFsz1Yd3E/pJbUWVx4nafCFqEHA/lzvxDQgMW4/7bRvaEgALk74HCM/pddZew0jVsN X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB4866.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(396003)(346002)(39860400002)(136003)(376002)(6486002)(66476007)(8936002)(66556008)(6512007)(2616005)(956004)(186003)(66946007)(26005)(16526019)(8676002)(1076003)(6666004)(316002)(83380400001)(6506007)(107886003)(4326008)(36756003)(478600001)(2906002)(86362001)(52116002)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: A7S8jDy5iQwfsCS7todC3ZMghmfvMiQS+jihXooS9XrKHErZFpWJAbXbUq+OBMKJ9djBlPBwWh+wUOSwvQhSbqA7JAecREiNNGWK2z/fm+OVN/qk99pbmUxDsmPTA+knPS/PMPlDDsK8yaU3gnbjgkGWOI/A8Ou3vLLNfLSxlW6nBbx9gl5bBBUu08nsrauZF8qZrwBU7y1rG73K3MurCWD48b/Nep/YjdYyexTw5YEoJNNtIh8hO7g1RzurdXtOSPj+zWT0+bSllTnwzS+DzWGRt/jn7V51veo8ds8hEjmSyjk1zAvD6aoslvwRViFz5BdXJE+J4uoyz5cmXKtCN435JSb2Wr5QkKtuPKWSdnzkWLdY2IEjsSvGO3HIj4yt5HurLqPzdz49JrcYBR4XTy0KZrRlPMFuar682IA9ZSBkP2cWhwZCF/Uoo4fN2S4ztwpRAwMitDRiYWrycGLu2a6etw1pcpf06xtlxeydptqqMi6gC9tCbqhOWqkKx8NC X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d299ed6d-220e-4ee9-0aa7-08d8317403bb X-MS-Exchange-CrossTenant-AuthSource: AM0PR05MB4866.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2020 14:56:02.2951 (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: t9PGRtyqUmNoQV3+A+E7pM2nOMgVjiRd3R8d1gunudMEOugJyXTkvtxeJ8APWH4jFZbiK1sBlg8dApzWBCpfsA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6225 Subject: [dpdk-dev] [PATCH v11 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: v10->v11: - Moved new class combinations to previous patch v8->v9: - Removed leftover inclusion of mlx5_pci bus include directory --- 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 | 2 +- drivers/vdpa/mlx5/meson.build | 2 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 23 +++++++++++++---------- 9 files changed, 42 insertions(+), 35 deletions(-) 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..d46699fbc 100644 --- a/drivers/vdpa/mlx5/Makefile +++ b/drivers/vdpa/mlx5/Makefile @@ -30,7 +30,7 @@ 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__); -- 2.26.2