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 736BAA051E; Wed, 10 Jun 2020 19:18:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9BEAD1BFFD; Wed, 10 Jun 2020 19:18:16 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2043.outbound.protection.outlook.com [40.107.22.43]) by dpdk.org (Postfix) with ESMTP id E6B8A1BFF8 for ; Wed, 10 Jun 2020 19:18:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TdaBu1fnwAysBLy69UJTaUEwZtRVmgZ0I3kSd9VBh1cwUfksmD05G3oMLtfR1LJKIC9RHhMfFiFOEOreYEDZpYt/t4gnUOAh9kBYpiv6Pzy4Q2FVsrNTB2/2S6l1kGv98w5SnDcxhpkDgz87IXIsqnadlk4cUrNXrKLLuMxHCmTWsYIuYqtkEaoYSGWiXyiGOqQcV+hIib6ACEcJqLKuF/3j4AVHue60+zLD+K7bk6LCEcWy+A7mXxTjWk/Ii5WMQsvil0hv0KyYWreYtOvD7Hhu4pay+fszWvXLgZb18U71tY47JsT6RsL1nQrQuEZHWyP0ai65dXpGXi/+3Gw5cw== 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=faITFtC9rQsOnswzgiX7okpveEvEETFXx7fbXYOcJ+0=; b=Hw0IWz614rIdzWsFwu+qnNTHc5egsKiKX38LsDfy/4gIaiJe4iUdoAzOWPR77s4TivyJabHGvDsRb84UB4SNWXQHodSlwP2+d3k8ySE7N6Bjftc8gw8w1D8BjgVJIR4GKoGn/X02V1HxgbPr76QHO8dfkghGQezy7i1aza5s7BVi5S1Lg+zRhuY35fIH2YQsUijAT6WhSvzOZcSxj37kB94e4W6X3PW3HLzssSq7XbwSnOuQyptNkhO0A/LaOW0b27+3qJHB0edUfGuItdntoOt7wY+pGSKeSyM6K01GkJjlc9eGMF4SVPITv8fQbXF/qiSuA6ul+MzSZIfYlp2g0g== 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=faITFtC9rQsOnswzgiX7okpveEvEETFXx7fbXYOcJ+0=; b=hK7ZhU/n5i+cR+1vQMsBtmrKI0zKexUogjapcNSH1f5c659OMPWjTWulZZFVTQ4RaxuJjJkaMOHZmxyEMHc9uFaUDU8UOiaUnqkHkJKuwgCsErc+CE182IO0eiszyn4l+3++k4BZ+Nb3ocp1FXA2GwpSfoob4MmVh6Y1VljkGXI= 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 AM0PR05MB5346.eurprd05.prod.outlook.com (2603:10a6:208:f5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18; Wed, 10 Jun 2020 17:18:13 +0000 Received: from AM0PR05MB4866.eurprd05.prod.outlook.com ([fe80::d44d:a804:c730:d2b7]) by AM0PR05MB4866.eurprd05.prod.outlook.com ([fe80::d44d:a804:c730:d2b7%2]) with mapi id 15.20.3066.023; Wed, 10 Jun 2020 17:18:13 +0000 From: Parav Pandit To: dev@dpdk.org Cc: ferruh.yigit@intel.com, thomasm@mellanox.com, orika@mellanox.com, matan@mellanox.com, Parav Pandit Date: Wed, 10 Jun 2020 17:17:26 +0000 Message-Id: <20200610171728.89-5-parav@mellanox.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200610171728.89-1-parav@mellanox.com> References: <20200610171728.89-1-parav@mellanox.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SN6PR16CA0060.namprd16.prod.outlook.com (2603:10b6:805:ca::37) 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 SN6PR16CA0060.namprd16.prod.outlook.com (2603:10b6:805:ca::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.21 via Frontend Transport; Wed, 10 Jun 2020 17:18:12 +0000 X-Mailer: git-send-email 2.25.4 X-Originating-IP: [208.176.44.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6575a660-ec3d-4d3f-a15e-08d80d6241ba X-MS-TrafficTypeDiagnostic: AM0PR05MB5346: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3968; X-Forefront-PRVS: 0430FA5CB7 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UDKMqEKpAyalZbCOsq9UYs8NonBZyMH2VgyrhqMmTYQyz5Hn8kmc58AwZVImB/tywIrVBSXkGtktvUV3EJhAuIyvDoJ3641j2bTV5Bpnv2pycR2AmDVLD/Zq03MUtKZvHQ0V9hwWdV+Xxp3w2Aw3jWAZtUl3nNlEXyGMRSrs7QJggtKIlD07B8xi9Rdmx09aAPBVU2eNmkvbTh2pAEqvaKNqqBCx+fYO7SMpyFPDohQB6v/NFZwxLCy81hCVcL2JXnVqI1CKgDkxm1yQ1+mjOzCzeMcq6aYP3OznCDGkjFXMrc9gn8VNsBFsaG/I3GLz 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)(346002)(396003)(136003)(39860400002)(376002)(66476007)(6506007)(36756003)(16526019)(6486002)(6916009)(2906002)(316002)(26005)(5660300002)(186003)(66556008)(66946007)(6512007)(6666004)(8936002)(8676002)(4326008)(2616005)(83380400001)(956004)(478600001)(1076003)(86362001)(52116002)(107886003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hGKCIrDAi3Mng0bIC1qd41wp5QJ7DiZsOlzKC0vER+hdQnaeC15Q1eAkM4WrvIwzE3ChEHkLGpib3bJ6bG//0QJyPgQTHCDeCTbiC07SR/8z6z9teS7EwAAPpN6xnvVJuISPKKmSi9xz/xWjdGKBK1Lj4v1rcJViKnPE68Ag83LB4E0W3bMFgS4Oky18FpMvEgO6z6hydUFYQDFZzuKmdkwes4gC9BMrJrTPkEtRcgzFNJXS+ytccYl9TwWk6aCasJKz60z49Tgz5YYWlh45w4E5H7ez4ZNN9rr+Xko73dPdlRxzRkYpqoZx/uCeXNTqzkPIJdd1b2JSBg7W6+bN3YngKR7Y8iI0qkEsy48kPYQrjanpjagrZkCvcJ5RhXxRa7KzVREhslUgeQXz+Gty6Xhkms5zEPc2AQF/A/X00V7+WxwS9heKQfpai7q9J+D8zkuAoeZ069iKRzcQ5TmqOj8WkN/qOBrXqcuJ2X6CsvLQNet1LNSEGFQU7fJJHYmo X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6575a660-ec3d-4d3f-a15e-08d80d6241ba X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2020 17:18:13.7718 (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: JYmL43I9z97oZUBpKy6rkRBm6Dj6NG7fNYyIOo4BKRMDDGruK+13Mg+8K0xp03mlnAXwuwXqs/VHLXeDj/o98A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5346 Subject: [dpdk-dev] [RFC PATCH 4/6] bus/mlx5_pci: add mlx5 PCI bus 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" Add mlx5 PCI bus which enables multiple mlx5 drivers to bind to single pci device. Signed-off-by: Parav Pandit --- config/common_base | 6 ++ config/defconfig_arm64-bluefield-linuxapp-gcc | 6 ++ drivers/bus/meson.build | 2 +- drivers/bus/mlx5_pci/Makefile | 48 ++++++++++++++ drivers/bus/mlx5_pci/meson.build | 6 ++ drivers/bus/mlx5_pci/mlx5_pci_bus.c | 14 ++++ drivers/bus/mlx5_pci/rte_bus_mlx5_pci.h | 65 +++++++++++++++++++ .../bus/mlx5_pci/rte_bus_mlx5_pci_version.map | 5 ++ 8 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 drivers/bus/mlx5_pci/Makefile create mode 100644 drivers/bus/mlx5_pci/meson.build create mode 100644 drivers/bus/mlx5_pci/mlx5_pci_bus.c create mode 100644 drivers/bus/mlx5_pci/rte_bus_mlx5_pci.h create mode 100644 drivers/bus/mlx5_pci/rte_bus_mlx5_pci_version.map diff --git a/config/common_base b/config/common_base index c7d5c7321..f75b333f9 100644 --- a/config/common_base +++ b/config/common_base @@ -366,6 +366,12 @@ CONFIG_RTE_LIBRTE_IGC_DEBUG_TX=n CONFIG_RTE_LIBRTE_MLX4_PMD=n CONFIG_RTE_LIBRTE_MLX4_DEBUG=n +# +# Compile Mellanox PCI BUS for ConnectX-4, ConnectX-5, +# ConnectX-6 & BlueField (MLX5) PMD +# +CONFIG_RTE_LIBRTE_MLX5_PCI_BUS=n + # # Compile burst-oriented Mellanox ConnectX-4, ConnectX-5, # ConnectX-6 & BlueField (MLX5) PMD diff --git a/config/defconfig_arm64-bluefield-linuxapp-gcc b/config/defconfig_arm64-bluefield-linuxapp-gcc index b49653881..15ade7ebc 100644 --- a/config/defconfig_arm64-bluefield-linuxapp-gcc +++ b/config/defconfig_arm64-bluefield-linuxapp-gcc @@ -14,5 +14,11 @@ CONFIG_RTE_CACHE_LINE_SIZE=64 CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n CONFIG_RTE_LIBRTE_VHOST_NUMA=n +# +# Compile Mellanox PCI BUS for ConnectX-4, ConnectX-5, +# ConnectX-6 & BlueField (MLX5) PMD +# +CONFIG_RTE_LIBRTE_MLX5_PCI_BUS=n + # PMD for ConnectX-5 CONFIG_RTE_LIBRTE_MLX5_PMD=y diff --git a/drivers/bus/meson.build b/drivers/bus/meson.build index 80de2d91d..b1381838d 100644 --- a/drivers/bus/meson.build +++ b/drivers/bus/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -drivers = ['dpaa', 'fslmc', 'ifpga', 'pci', 'vdev', 'vmbus'] +drivers = ['dpaa', 'fslmc', 'ifpga', 'pci', 'mlx5_pci', 'vdev', 'vmbus'] std_deps = ['eal'] config_flag_fmt = 'RTE_LIBRTE_@0@_BUS' driver_name_fmt = 'rte_bus_@0@' diff --git a/drivers/bus/mlx5_pci/Makefile b/drivers/bus/mlx5_pci/Makefile new file mode 100644 index 000000000..b36916e52 --- /dev/null +++ b/drivers/bus/mlx5_pci/Makefile @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2020 Mellanox Technologies, Ltd + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_bus_mlx5_pci.a + +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -I$(RTE_SDK)/drivers/common/mlx5 +CFLAGS += -I$(BUILDDIR)/drivers/common/mlx5 +CFLAGS += -I$(RTE_SDK)/drivers/bus/pci +CFLAGS += -Wno-strict-prototypes +LDLIBS += -lrte_eal +LDLIBS += -lrte_common_mlx5 +LDLIBS += -lrte_pci -lrte_bus_pci + +# versioning export map +EXPORT_MAP := rte_bus_mlx5_pci_version.map + +SRCS-y += mlx5_pci_bus.c + +# DEBUG which is usually provided on the command-line may enable +# CONFIG_RTE_LIBRTE_MLX5_DEBUG. +ifeq ($(DEBUG),1) +CONFIG_RTE_LIBRTE_MLX5_DEBUG := y +endif + +# User-defined CFLAGS. +ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DEBUG),y) +CFLAGS += -pedantic +ifneq ($(CONFIG_RTE_TOOLCHAIN_ICC),y) +CFLAGS += -DPEDANTIC +endif +AUTO_CONFIG_CFLAGS += -Wno-pedantic +else +CFLAGS += -UPEDANTIC +endif + +# +# Export include files +# +SYMLINK-y-include += rte_bus_mlx5_pci.h + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/bus/mlx5_pci/meson.build b/drivers/bus/mlx5_pci/meson.build new file mode 100644 index 000000000..cc4a84e23 --- /dev/null +++ b/drivers/bus/mlx5_pci/meson.build @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Mellanox Technologies Ltd + +deps += ['pci', 'bus_pci', 'common_mlx5'] +install_headers('rte_bus_mlx5_pci.h') +sources = files('mlx5_pci_bus.c') diff --git a/drivers/bus/mlx5_pci/mlx5_pci_bus.c b/drivers/bus/mlx5_pci/mlx5_pci_bus.c new file mode 100644 index 000000000..66db3c7b0 --- /dev/null +++ b/drivers/bus/mlx5_pci/mlx5_pci_bus.c @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020 Mellanox Technologies, Ltd + */ + +#include "rte_bus_mlx5_pci.h" + +static TAILQ_HEAD(mlx5_pci_bus_drv_head, rte_mlx5_pci_driver) drv_list = + TAILQ_HEAD_INITIALIZER(drv_list); + +void +rte_mlx5_pci_driver_register(struct rte_mlx5_pci_driver *driver) +{ + TAILQ_INSERT_TAIL(&drv_list, driver, next); +} diff --git a/drivers/bus/mlx5_pci/rte_bus_mlx5_pci.h b/drivers/bus/mlx5_pci/rte_bus_mlx5_pci.h new file mode 100644 index 000000000..b0423f99e --- /dev/null +++ b/drivers/bus/mlx5_pci/rte_bus_mlx5_pci.h @@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020 Mellanox Technologies, Ltd + */ + +#ifndef _RTE_BUS_MLX5_PCI_H_ +#define _RTE_BUS_MLX5_PCI_H_ + +/** + * @file + * + * RTE Mellanox PCI Bus Interface + * Mellanox ConnectX PCI device supports multiple class (net/vdpa/regex) + * devices. This bus 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 bus driver. + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include + +#include + +/** + * A structure describing a mlx5 pci driver. + */ +struct rte_mlx5_pci_driver { + enum mlx5_class dev_class; /**< Class of this driver */ + struct rte_driver driver; /**< Inherit core driver. */ + pci_probe_t *probe; /**< Class device probe function. */ + pci_remove_t *remove; /**< Class device remove function. */ + pci_dma_map_t *dma_map; /**< Class device dma map function. */ + pci_dma_unmap_t *dma_unmap; /**< Class device dma unmap function. */ + TAILQ_ENTRY(rte_mlx5_pci_driver) next; + const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */ +}; + +/** + * Register a mlx5_pci device driver. + * + * @param driver + * A pointer to a rte_mlx5_pci_driver structure describing the driver + * to be registered. + */ +__rte_internal +void +rte_mlx5_pci_driver_register(struct rte_mlx5_pci_driver *driver); + +#define RTE_PMD_REGISTER_MLX5_PCI(nm, drv) \ +static const char *mlx5_pci_drvinit_fn_ ## nm; \ +RTE_INIT(mlx5_pci_drvinit_fn_ ##drv) \ +{ \ + (drv).driver.name = RTE_STR(nm); \ + rte_mlx5_pci_driver_register(&drv); \ +} \ +RTE_PMD_EXPORT_NAME(nm, __COUNTER__) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _RTE_BUS_MLX5_PCI_H_ */ diff --git a/drivers/bus/mlx5_pci/rte_bus_mlx5_pci_version.map b/drivers/bus/mlx5_pci/rte_bus_mlx5_pci_version.map new file mode 100644 index 000000000..4cfd3db10 --- /dev/null +++ b/drivers/bus/mlx5_pci/rte_bus_mlx5_pci_version.map @@ -0,0 +1,5 @@ +INTERNAL { + global: + + rte_mlx5_pci_driver_register; +}; -- 2.25.4