From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id D1433A045E for ; Sat, 1 Jun 2019 03:52:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C08321B9C8; Sat, 1 Jun 2019 03:50:08 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 310361B952 for ; Sat, 1 Jun 2019 03:50:05 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x511mruc004005; Fri, 31 May 2019 18:50:03 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=qFYPCBNF7U5Ce3RpjeTUSndUyDYblhUEUYt1DvAA6LI=; b=J5Y3X3uCPwwFjAPawt85loOHeEZNdso9amAUbX7IeTU0yISYKhtG6Y3YKEaVmQrYtvCK m2Es1HleJypc2wqc/zCJIcEhOdJW+Pd/mfcEJuvk2H15HbfgSSUBZtBRSu04QN6Dqp8U ZBp7F7Lyd2VGI1cLyXIyHLFjxCGBWeNrLnygVkOYhzTjammSeDeb8bCOIQRzbi6hMtvU I0BJ3zpp5Zd5GD6s3zked0r4gFR37DxkypPuxzZS3wIxEnIt+AIAy1/lvkWkqTX0nx24 YAhy0NP3mZUo3IrESDkPei3y8Bj8gBaFQ8mb1ykdvIElhLeZn85AqhANXCCWPm4w9ZCj Bg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2su5xh2bv0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 31 May 2019 18:50:02 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 31 May 2019 18:50:01 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Fri, 31 May 2019 18:50:01 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 3F7173F703F; Fri, 31 May 2019 18:49:59 -0700 (PDT) From: To: , Thomas Monjalon , Olivier Matz , Andrew Rybchenko , "Jerin Jacob" , Nithin Dabilpuram , Vamsi Attunuru , Anatoly Burakov CC: Pavan Nikhilesh Date: Sat, 1 Jun 2019 07:18:54 +0530 Message-ID: <20190601014905.45531-17-jerinj@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190601014905.45531-1-jerinj@marvell.com> References: <20190523081339.56348-1-jerinj@marvell.com> <20190601014905.45531-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-01_02:, , signatures=0 Subject: [dpdk-dev] [PATCH v2 16/27] mempool/octeontx2: add build infra and device probe 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: Jerin Jacob Add the make and meson based build infrastructure along with the mempool(NPA) device probe. Signed-off-by: Jerin Jacob Signed-off-by: Pavan Nikhilesh --- config/common_base | 5 ++ drivers/common/Makefile | 3 + drivers/mempool/Makefile | 1 + drivers/mempool/meson.build | 2 +- drivers/mempool/octeontx2/Makefile | 36 ++++++++++++ drivers/mempool/octeontx2/meson.build | 20 +++++++ drivers/mempool/octeontx2/otx2_mempool.c | 57 +++++++++++++++++++ .../rte_mempool_octeontx2_version.map | 4 ++ mk/rte.app.mk | 4 ++ 9 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 drivers/mempool/octeontx2/Makefile create mode 100644 drivers/mempool/octeontx2/meson.build create mode 100644 drivers/mempool/octeontx2/otx2_mempool.c create mode 100644 drivers/mempool/octeontx2/rte_mempool_octeontx2_version.map diff --git a/config/common_base b/config/common_base index 6f19ad5d2..4a3de0360 100644 --- a/config/common_base +++ b/config/common_base @@ -771,6 +771,11 @@ CONFIG_RTE_DRIVER_MEMPOOL_STACK=y # CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL=y +# +# Compile PMD for octeontx2 npa mempool device +# +CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL=y + # # Compile librte_mbuf # diff --git a/drivers/common/Makefile b/drivers/common/Makefile index e7abe210e..05d75568f 100644 --- a/drivers/common/Makefile +++ b/drivers/common/Makefile @@ -23,6 +23,9 @@ ifeq ($(CONFIG_RTE_LIBRTE_COMMON_DPAAX),y) DIRS-y += dpaax endif +OCTEONTX2-y := $(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL) +ifeq ($(findstring y,$(OCTEONTX2-y)),y) DIRS-y += octeontx2 +endif include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/mempool/Makefile b/drivers/mempool/Makefile index 28c2e8360..29ef73bf4 100644 --- a/drivers/mempool/Makefile +++ b/drivers/mempool/Makefile @@ -13,5 +13,6 @@ endif DIRS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING) += ring DIRS-$(CONFIG_RTE_DRIVER_MEMPOOL_STACK) += stack DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL) += octeontx +DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL) += octeontx2 include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/mempool/meson.build b/drivers/mempool/meson.build index 4527d9806..7520e489f 100644 --- a/drivers/mempool/meson.build +++ b/drivers/mempool/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -drivers = ['bucket', 'dpaa', 'dpaa2', 'octeontx', 'ring', 'stack'] +drivers = ['bucket', 'dpaa', 'dpaa2', 'octeontx', 'octeontx2', 'ring', 'stack'] std_deps = ['mempool'] config_flag_fmt = 'RTE_LIBRTE_@0@_MEMPOOL' driver_name_fmt = 'rte_mempool_@0@' diff --git a/drivers/mempool/octeontx2/Makefile b/drivers/mempool/octeontx2/Makefile new file mode 100644 index 000000000..6fbb6e291 --- /dev/null +++ b/drivers/mempool/octeontx2/Makefile @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2019 Marvell International Ltd. +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_mempool_octeontx2.a + +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx2 +CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx2 +CFLAGS += -I$(RTE_SDK)/drivers/bus/pci +CFLAGS += -O3 + +ifneq ($(CONFIG_RTE_ARCH_64),y) +CFLAGS += -Wno-int-to-pointer-cast +CFLAGS += -Wno-pointer-to-int-cast +endif + +EXPORT_MAP := rte_mempool_octeontx2_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL) += \ + otx2_mempool.c + +LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf +LDLIBS += -lrte_common_octeontx2 -lrte_kvargs -lrte_bus_pci + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/mempool/octeontx2/meson.build b/drivers/mempool/octeontx2/meson.build new file mode 100644 index 000000000..ec3c59eef --- /dev/null +++ b/drivers/mempool/octeontx2/meson.build @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2019 Marvell International Ltd. +# + +sources = files('otx2_mempool.c', + ) + +extra_flags = [] +# This integrated controller runs only on a arm64 machine, remove 32bit warnings +if not dpdk_conf.get('RTE_ARCH_64') + extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast'] +endif + +foreach flag: extra_flags + if cc.has_argument(flag) + cflags += flag + endif +endforeach + +deps += ['eal', 'mbuf', 'kvargs', 'bus_pci', 'common_octeontx2', 'mempool'] diff --git a/drivers/mempool/octeontx2/otx2_mempool.c b/drivers/mempool/octeontx2/otx2_mempool.c new file mode 100644 index 000000000..fd8e147f5 --- /dev/null +++ b/drivers/mempool/octeontx2/otx2_mempool.c @@ -0,0 +1,57 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include +#include +#include +#include + +#include "otx2_common.h" + +static int +npa_remove(struct rte_pci_device *pci_dev) +{ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + RTE_SET_USED(pci_dev); + return 0; +} + +static int +npa_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) +{ + RTE_SET_USED(pci_drv); + + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + RTE_SET_USED(pci_dev); + return 0; +} + +static const struct rte_pci_id pci_npa_map[] = { + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, + PCI_DEVID_OCTEONTX2_RVU_NPA_PF) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, + PCI_DEVID_OCTEONTX2_RVU_NPA_VF) + }, + { + .vendor_id = 0, + }, +}; + +static struct rte_pci_driver pci_npa = { + .id_table = pci_npa_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_IOVA_AS_VA, + .probe = npa_probe, + .remove = npa_remove, +}; + +RTE_PMD_REGISTER_PCI(mempool_octeontx2, pci_npa); +RTE_PMD_REGISTER_PCI_TABLE(mempool_octeontx2, pci_npa_map); +RTE_PMD_REGISTER_KMOD_DEP(mempool_octeontx2, "vfio-pci"); diff --git a/drivers/mempool/octeontx2/rte_mempool_octeontx2_version.map b/drivers/mempool/octeontx2/rte_mempool_octeontx2_version.map new file mode 100644 index 000000000..fc8c95e91 --- /dev/null +++ b/drivers/mempool/octeontx2/rte_mempool_octeontx2_version.map @@ -0,0 +1,4 @@ +DPDK_19.05 { + + local: *; +}; diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 1e9dcd5a1..cd89ccfd5 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -91,6 +91,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER) += -lrte_timer _LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += -lrte_mempool _LDLIBS-$(CONFIG_RTE_LIBRTE_STACK) += -lrte_stack _LDLIBS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING) += -lrte_mempool_ring +_LDLIBS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL) += -lrte_mempool_octeontx2 _LDLIBS-$(CONFIG_RTE_LIBRTE_RING) += -lrte_ring _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI) += -lrte_pci _LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal @@ -125,7 +126,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_FSLMC_BUS),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_COMMON_DPAAX) += -lrte_common_dpaax endif +OCTEONTX2-y := $(CONFIG_RTE_LIBRTE_OCTEONTX2_MEMPOOL) +ifeq ($(findstring y,$(OCTEONTX2-y)),y) _LDLIBS-y += -lrte_common_octeontx2 +endif _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += -lrte_bus_pci _LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += -lrte_bus_vdev -- 2.21.0