From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02hn0223.outbound.protection.outlook.com [104.47.38.223]) by dpdk.org (Postfix) with ESMTP id 71E48AAD1 for ; Mon, 2 Apr 2018 11:10:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=coImbuiO2S7eeZH6XB1gtoomKuXBM0D505DXnu+iAmI=; b=Xf9nVewA8GAfWziWOCB3Iw4TJAEW+QVoRAP2Fk1p1MMe2Ij3htqwqW8akfQBhf01W/pyXd+AoVb80UR3ysRLUAQOTnc/c5PAcGLimOlXapLQbUFqGU7SrWTn67/Ra8PJhZl5MDulwOeufyOY6JFn1ihTuUuhzX8TdCYJLbmKZD8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from ltp-pvn.caveonetworks.com (111.93.218.67) by CY4PR07MB3464.namprd07.prod.outlook.com (2603:10b6:910:75::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.631.10; Mon, 2 Apr 2018 09:10:32 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com, thomas@monjalon.net, anatoly.burakov@intel.com, lironh@marvell.com, bruce.richardson@intel.com, fiona.trahe@intel.com, shreyansh.jain@nxp.com, hemant.agrawal@nxp.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Mon, 2 Apr 2018 14:40:00 +0530 Message-Id: <20180402091000.9208-2-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180402091000.9208-1-pbhagavatula@caviumnetworks.com> References: <20180319092726.10153-1-pbhagavatula@caviumnetworks.com> <20180402091000.9208-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR0101CA0018.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:18::28) To CY4PR07MB3464.namprd07.prod.outlook.com (2603:10b6:910:75::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 60bce6d6-4d39-41c3-1a70-08d5987998b2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603328)(7153060)(7193020); SRVR:CY4PR07MB3464; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3464; 3:rjsG4ztbBlC8znl4sHHC7NC+ZX0kCsH0mdqFljexZ4CbsXYkg8qa5aSeub1DufhivS3vFvJFU1depCNIgnAyvOSl+OMT7vQDLzoavX1syrdMatKGI98aR4Xr75de25pOkaOD3x5vFa4tM9RlIWLc81xdISaWKUSfnsNRc4Dchb2FEAZh3u6rSdSWlyYyim2guFevkIY0FLw/jnPhNhV4j8rX+K3nPjqd/EhHYTuWlvWBYmRk0v0aIZyJDpI94Bl4; 25:Zcxnzx4uZqAoLOuAZitrtFd1cXc+TxOFraNdFI5TJd3evTfHog2FRSP4+3wswr+FPNuraeWAV4z4rs1kJnxjK73aU3QnXCwKha/HxKOC4qByadxFtzh4zGedrdr/OXZUK2Hq1QWClR+VmTncZBDiOT2IsSp1KqlwgHFogB8rvlQn4gGHb8kB3qWr0cgXOWzoQvSHC1L6WJp7nUOnIj3sJ9BFHe/7FLYmhw8zIu3fBTQ6zUNNMbxS+f5Ex6ExI26Z+3hMrgI2VgwQDKHzYAfRF2OtwIORI5DujU+qdclBApqhICtI63XnYbvGEY3YFUHMVOKzvKgmzQqZEGU+c41aww==; 31:0aixhq8YzKsLmUmGv/EsN0Dy6LpNYWE7BaA8UJmPQHdTYU58H37H8uGjXP0pOELQfIM0ZI1aiRVp4UXpKlv52ealEvmtWp3+tHy4ljMl8nQFp6mJ+NTT74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ytgpGuGfQcoJFJhq/3wBQXoN2MQLuZpl3D4Wn6MeOT1bg2i4LsGSvJZ568f9DbsP2YI X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(66839620246622); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231221)(2232076)(944501327)(52105095)(10201501046)(3002001)(93006095)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:CY4PR07MB3464; BCL:0; PCL:0; RULEID:; SRVR:CY4PR07MB3464; X-Forefront-PRVS: 0630013541 X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(346002)(396003)(376002)(39850400004)(366004)(39380400002)(199004)(189003)(8936002)(59450400001)(107886003)(105586002)(6506007)(7736002)(3846002)(2616005)(53416004)(956004)(81166006)(305945005)(16586007)(6116002)(6666003)(26005)(2906002)(1076002)(1857600001)(4326008)(47776003)(81156014)(478600001)(48376002)(16526019)(5660300001)(69596002)(8676002)(68736007)(386003)(5009440100003)(52116002)(42882007)(50226002)(446003)(53936002)(8656006)(97736004)(51416003)(50466002)(575784001)(6486002)(316002)(11346002)(76176011)(36756003)(66066001)(106356001)(25786009)(72206003)(476003)(486005)(6512007)(486005)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:CY4PR07MB3464; H:ltp-pvn.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR07MB3464; 23:PPTNJ1ru4sMqB/o8NdluJE4SbNAojf6QejknkNzto?= =?us-ascii?Q?8x78UtYqgtjSg+KluWeuzFWbiHVIwYlMXnu6JTG7NKJUP8YwqC/swoOf/1rD?= =?us-ascii?Q?JtTz5X4vVxZOsxyMBSTebP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uj2zVPI7MGenrb9Dldd1bcP8fHvTPt1i+4s+zN8j4bDTZdppKVKgxnBmhjgyDcf5m6FLhB8ILQQK3Q8nx22wNB X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Apr 2018 09:10:32.8067 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 60bce6d6-4d39-41c3-1a70-08d5987998b2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3464 Subject: [dpdk-dev] [PATCH v4 2/2] octeontx: move mbox to common folder 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: , X-List-Received-Date: Mon, 02 Apr 2018 09:10:38 -0000 Move commonly used functions across mempool, event and net devices to a common folder in drivers. Signed-off-by: Pavan Nikhilesh --- MAINTAINERS | 1 + drivers/common/Makefile | 4 ++ drivers/common/meson.build | 1 + drivers/common/octeontx/Makefile | 24 ++++++++ drivers/common/octeontx/meson.build | 6 ++ .../{mempool => common}/octeontx/octeontx_mbox.c | 65 +++++++++++++++++----- .../{mempool => common}/octeontx/octeontx_mbox.h | 14 +++++ .../octeontx/rte_common_octeontx_version.map | 9 +++ drivers/event/octeontx/Makefile | 4 +- drivers/event/octeontx/meson.build | 5 +- .../{mempool => event}/octeontx/octeontx_ssovf.c | 20 ++++++- drivers/mempool/octeontx/Makefile | 5 +- drivers/mempool/octeontx/meson.build | 6 +- drivers/mempool/octeontx/octeontx_fpavf.c | 4 -- drivers/mempool/octeontx/octeontx_pool_logs.h | 9 --- .../octeontx/rte_mempool_octeontx_version.map | 6 -- drivers/net/octeontx/Makefile | 3 +- mk/rte.app.mk | 4 ++ 18 files changed, 145 insertions(+), 45 deletions(-) create mode 100644 drivers/common/octeontx/Makefile create mode 100644 drivers/common/octeontx/meson.build rename drivers/{mempool => common}/octeontx/octeontx_mbox.c (83%) rename drivers/{mempool => common}/octeontx/octeontx_mbox.h (66%) create mode 100644 drivers/common/octeontx/rte_common_octeontx_version.map rename drivers/{mempool => event}/octeontx/octeontx_ssovf.c (92%) diff --git a/MAINTAINERS b/MAINTAINERS index d4c0cc1bc..ed3251da7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -412,6 +412,7 @@ F: doc/guides/nics/features/liquidio.ini Cavium OcteonTX M: Santosh Shukla M: Jerin Jacob +F: drivers/common/octeontx/ F: drivers/mempool/octeontx/ F: drivers/net/octeontx/ F: doc/guides/nics/octeontx.rst diff --git a/drivers/common/Makefile b/drivers/common/Makefile index 192066307..0fd223761 100644 --- a/drivers/common/Makefile +++ b/drivers/common/Makefile @@ -4,4 +4,8 @@ include $(RTE_SDK)/mk/rte.vars.mk +ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL),yy) +DIRS-y += octeontx +endif + include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/meson.build b/drivers/common/meson.build index ab774b8ef..5f6341b8f 100644 --- a/drivers/common/meson.build +++ b/drivers/common/meson.build @@ -2,5 +2,6 @@ # Copyright(c) 2018 Cavium, Inc std_deps = ['eal'] +drivers = ['octeontx'] config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' driver_name_fmt = 'rte_common_@0@' diff --git a/drivers/common/octeontx/Makefile b/drivers/common/octeontx/Makefile new file mode 100644 index 000000000..dfdb9f196 --- /dev/null +++ b/drivers/common/octeontx/Makefile @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_common_octeontx.a + +CFLAGS += $(WERROR_FLAGS) +EXPORT_MAP := rte_common_octeontx_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-y += octeontx_mbox.c + +LDLIBS += -lrte_eal + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/common/octeontx/meson.build b/drivers/common/octeontx/meson.build new file mode 100644 index 000000000..8a28ce800 --- /dev/null +++ b/drivers/common/octeontx/meson.build @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium, Inc +# + +sources = files('octeontx_mbox.c' +) diff --git a/drivers/mempool/octeontx/octeontx_mbox.c b/drivers/common/octeontx/octeontx_mbox.c similarity index 83% rename from drivers/mempool/octeontx/octeontx_mbox.c rename to drivers/common/octeontx/octeontx_mbox.c index f8cb6a453..c98e110f3 100644 --- a/drivers/mempool/octeontx/octeontx_mbox.c +++ b/drivers/common/octeontx/octeontx_mbox.c @@ -11,7 +11,6 @@ #include #include "octeontx_mbox.h" -#include "octeontx_pool_logs.h" /* Mbox operation timeout in seconds */ #define MBOX_WAIT_TIME_SEC 3 @@ -60,6 +59,17 @@ struct mbox_ram_hdr { }; }; +int octeontx_logtype_mbox; + +RTE_INIT(otx_init_log); +static void +otx_init_log(void) +{ + octeontx_logtype_mbox = rte_log_register("pmd.octeontx.mbox"); + if (octeontx_logtype_mbox >= 0) + rte_log_set_level(octeontx_logtype_mbox, RTE_LOG_NOTICE); +} + static inline void mbox_msgcpy(volatile uint8_t *d, volatile const uint8_t *s, uint16_t size) { @@ -181,22 +191,49 @@ mbox_send(struct mbox *m, struct octeontx_mbox_hdr *hdr, const void *txmsg, return res; } -static inline int -mbox_setup(struct mbox *m) +int +octeontx_mbox_set_ram_mbox_base(uint8_t *ram_mbox_base) +{ + struct mbox *m = &octeontx_mbox; + + if (m->init_once) + return -EALREADY; + + if (ram_mbox_base == NULL) { + mbox_log_err("Invalid ram_mbox_base=%p", ram_mbox_base); + return -EINVAL; + } + + m->ram_mbox_base = ram_mbox_base; + + if (m->reg != NULL) { + rte_spinlock_init(&m->lock); + m->init_once = 1; + } + + return 0; +} + +int +octeontx_mbox_set_reg(uint8_t *reg) { - if (unlikely(m->init_once == 0)) { + struct mbox *m = &octeontx_mbox; + + if (m->init_once) + return -EALREADY; + + if (reg == NULL) { + mbox_log_err("Invalid reg=%p", reg); + return -EINVAL; + } + + m->reg = reg; + + if (m->ram_mbox_base != NULL) { rte_spinlock_init(&m->lock); - m->ram_mbox_base = octeontx_ssovf_bar(OCTEONTX_SSO_HWS, 0, 4); - m->reg = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, 0, 0); - m->reg += SSO_VHGRP_PF_MBOX(1); - - if (m->ram_mbox_base == NULL || m->reg == NULL) { - mbox_log_err("Invalid ram_mbox_base=%p or reg=%p", - m->ram_mbox_base, m->reg); - return -EINVAL; - } m->init_once = 1; } + return 0; } @@ -207,7 +244,7 @@ octeontx_ssovf_mbox_send(struct octeontx_mbox_hdr *hdr, void *txdata, struct mbox *m = &octeontx_mbox; RTE_BUILD_BUG_ON(sizeof(struct mbox_ram_hdr) != 8); - if (rte_eal_process_type() != RTE_PROC_PRIMARY || mbox_setup(m)) + if (rte_eal_process_type() != RTE_PROC_PRIMARY) return -EINVAL; return mbox_send(m, hdr, txdata, txlen, rxdata, rxlen); diff --git a/drivers/mempool/octeontx/octeontx_mbox.h b/drivers/common/octeontx/octeontx_mbox.h similarity index 66% rename from drivers/mempool/octeontx/octeontx_mbox.h rename to drivers/common/octeontx/octeontx_mbox.h index 1b056071a..52fae4ef9 100644 --- a/drivers/mempool/octeontx/octeontx_mbox.h +++ b/drivers/common/octeontx/octeontx_mbox.h @@ -6,10 +6,22 @@ #define __OCTEONTX_MBOX_H__ #include +#include #define SSOW_BAR4_LEN (64 * 1024) #define SSO_VHGRP_PF_MBOX(x) (0x200ULL | ((x) << 3)) +#define MBOX_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, octeontx_logtype_mbox,\ + "%s() line %u: " fmt "\n", __func__, __LINE__, ## args) + +#define mbox_log_info(fmt, ...) MBOX_LOG(INFO, fmt, ##__VA_ARGS__) +#define mbox_log_dbg(fmt, ...) MBOX_LOG(DEBUG, fmt, ##__VA_ARGS__) +#define mbox_log_err(fmt, ...) MBOX_LOG(ERR, fmt, ##__VA_ARGS__) +#define mbox_func_trace mbox_log_dbg + +extern int octeontx_logtype_mbox; + struct octeontx_ssovf_info { uint16_t domain; /* Domain id */ uint8_t total_ssovfs; /* Total sso groups available in domain */ @@ -30,6 +42,8 @@ struct octeontx_mbox_hdr { int octeontx_ssovf_info(struct octeontx_ssovf_info *info); void *octeontx_ssovf_bar(enum octeontx_ssovf_type, uint8_t id, uint8_t bar); +int octeontx_mbox_set_ram_mbox_base(uint8_t *ram_mbox_base); +int octeontx_mbox_set_reg(uint8_t *reg); int octeontx_ssovf_mbox_send(struct octeontx_mbox_hdr *hdr, void *txdata, uint16_t txlen, void *rxdata, uint16_t rxlen); diff --git a/drivers/common/octeontx/rte_common_octeontx_version.map b/drivers/common/octeontx/rte_common_octeontx_version.map new file mode 100644 index 000000000..59dbed5b2 --- /dev/null +++ b/drivers/common/octeontx/rte_common_octeontx_version.map @@ -0,0 +1,9 @@ +DPDK_18.05 { + global: + + octeontx_ssovf_info; + octeontx_ssovf_bar; + octeontx_mbox_set_ram_mbox_base; + octeontx_mbox_set_reg; + octeontx_ssovf_mbox_send; +}; diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index 0e49efd84..34dcb844c 100644 --- a/drivers/event/octeontx/Makefile +++ b/drivers/event/octeontx/Makefile @@ -10,10 +10,11 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_pmd_octeontx_ssovf.a CFLAGS += $(WERROR_FLAGS) +CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/ -LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx -lrte_pmd_octeontx +LDLIBS += -lrte_eal -lrte_eventdev -lrte_common_octeontx -lrte_pmd_octeontx LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_mbuf -lrte_kvargs LDLIBS += -lrte_bus_vdev @@ -27,6 +28,7 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_worker.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev_selftest.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx_ssovf.c ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_ssovf_worker.o += -fno-prefetch-loop-arrays diff --git a/drivers/event/octeontx/meson.build b/drivers/event/octeontx/meson.build index 358fc9fc9..1181f337b 100644 --- a/drivers/event/octeontx/meson.build +++ b/drivers/event/octeontx/meson.build @@ -3,7 +3,8 @@ sources = files('ssovf_worker.c', 'ssovf_evdev.c', - 'ssovf_evdev_selftest.c' + 'ssovf_evdev_selftest.c', + 'octeontx_ssovf.c' ) -deps += ['mempool_octeontx', 'bus_vdev', 'pmd_octeontx'] +deps += ['common_octeontx', 'mempool_octeontx', 'bus_vdev', 'pmd_octeontx'] diff --git a/drivers/mempool/octeontx/octeontx_ssovf.c b/drivers/event/octeontx/octeontx_ssovf.c similarity index 92% rename from drivers/mempool/octeontx/octeontx_ssovf.c rename to drivers/event/octeontx/octeontx_ssovf.c index 97b240665..c32b49a01 100644 --- a/drivers/mempool/octeontx/octeontx_ssovf.c +++ b/drivers/event/octeontx/octeontx_ssovf.c @@ -10,7 +10,6 @@ #include #include "octeontx_mbox.h" -#include "octeontx_pool_logs.h" #define PCI_VENDOR_ID_CAVIUM 0x177D #define PCI_DEVICE_ID_OCTEONTX_SSOGRP_VF 0xA04B @@ -142,6 +141,7 @@ ssowvf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) uint16_t vfid; struct ssowvf_res *res; struct ssowvf_identify *id; + uint8_t *ram_mbox_base; RTE_SET_USED(pci_drv); @@ -180,6 +180,14 @@ ssowvf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) res->domain = id->domain; sdev.total_ssowvfs++; + if (!vfid) { + ram_mbox_base = octeontx_ssovf_bar(OCTEONTX_SSO_HWS, 0, 4); + if (octeontx_mbox_set_ram_mbox_base(ram_mbox_base)) { + mbox_log_err("Invalid Failed to set ram mbox base"); + return -EINVAL; + } + } + rte_wmb(); mbox_log_dbg("Domain=%d hws=%d total_ssowvfs=%d", res->domain, res->vfid, sdev.total_ssowvfs); @@ -213,6 +221,7 @@ ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) uint16_t vfid; uint8_t *idreg; struct ssovf_res *res; + uint8_t *reg; RTE_SET_USED(pci_drv); @@ -246,6 +255,15 @@ ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) res->domain = val & 0xffff; sdev.total_ssovfs++; + if (!vfid) { + reg = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, 0, 0); + reg += SSO_VHGRP_PF_MBOX(1); + if (octeontx_mbox_set_reg(reg)) { + mbox_log_err("Invalid Failed to set mbox_reg"); + return -EINVAL; + } + } + rte_wmb(); mbox_log_dbg("Domain=%d group=%d total_ssovfs=%d", res->domain, res->vfid, sdev.total_ssovfs); diff --git a/drivers/mempool/octeontx/Makefile b/drivers/mempool/octeontx/Makefile index dfc373e62..a3e1dce88 100644 --- a/drivers/mempool/octeontx/Makefile +++ b/drivers/mempool/octeontx/Makefile @@ -10,6 +10,7 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_mempool_octeontx.a CFLAGS += $(WERROR_FLAGS) +CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx/ EXPORT_MAP := rte_mempool_octeontx_version.map LIBABIVER := 1 @@ -17,8 +18,6 @@ LIBABIVER := 1 # # all source are stored in SRCS-y # -SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL) += octeontx_ssovf.c -SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL) += octeontx_mbox.c SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL) += octeontx_fpavf.c SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL) += rte_mempool_octeontx.c @@ -36,6 +35,6 @@ CFLAGS_rte_mempool_octeontx.o += -Ofast endif LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf -LDLIBS += -lrte_bus_pci +LDLIBS += -lrte_bus_pci -lrte_common_octeontx include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/mempool/octeontx/meson.build b/drivers/mempool/octeontx/meson.build index 1e894a56b..3baaf7db2 100644 --- a/drivers/mempool/octeontx/meson.build +++ b/drivers/mempool/octeontx/meson.build @@ -1,10 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Cavium, Inc -sources = files('octeontx_ssovf.c', - 'octeontx_mbox.c', - 'octeontx_fpavf.c', +sources = files('octeontx_fpavf.c', 'rte_mempool_octeontx.c' ) -deps += ['mbuf', 'bus_pci'] +deps += ['mbuf', 'bus_pci', 'common_octeontx'] diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c index 61c72c7c8..85c361d20 100644 --- a/drivers/mempool/octeontx/octeontx_fpavf.c +++ b/drivers/mempool/octeontx/octeontx_fpavf.c @@ -115,10 +115,6 @@ otx_pool_init_log(void) octeontx_logtype_fpavf = rte_log_register("pmd.mempool.octeontx"); if (octeontx_logtype_fpavf >= 0) rte_log_set_level(octeontx_logtype_fpavf, RTE_LOG_NOTICE); - - octeontx_logtype_fpavf_mbox = rte_log_register("pmd.mempool.octeontx.mbox"); - if (octeontx_logtype_fpavf_mbox >= 0) - rte_log_set_level(octeontx_logtype_fpavf_mbox, RTE_LOG_NOTICE); } /* lock is taken by caller */ diff --git a/drivers/mempool/octeontx/octeontx_pool_logs.h b/drivers/mempool/octeontx/octeontx_pool_logs.h index 958651924..7b4e1b387 100644 --- a/drivers/mempool/octeontx/octeontx_pool_logs.h +++ b/drivers/mempool/octeontx/octeontx_pool_logs.h @@ -11,21 +11,12 @@ rte_log(RTE_LOG_ ## level, octeontx_logtype_fpavf,\ "%s() line %u: " fmt "\n", __func__, __LINE__, ## args) -#define MBOX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, octeontx_logtype_fpavf_mbox,\ - "%s() line %u: " fmt "\n", __func__, __LINE__, ## args) - #define fpavf_log_info(fmt, ...) FPAVF_LOG(INFO, fmt, ##__VA_ARGS__) #define fpavf_log_dbg(fmt, ...) FPAVF_LOG(DEBUG, fmt, ##__VA_ARGS__) #define fpavf_log_err(fmt, ...) FPAVF_LOG(ERR, fmt, ##__VA_ARGS__) #define fpavf_func_trace fpavf_log_dbg -#define mbox_log_info(fmt, ...) MBOX_LOG(INFO, fmt, ##__VA_ARGS__) -#define mbox_log_dbg(fmt, ...) MBOX_LOG(DEBUG, fmt, ##__VA_ARGS__) -#define mbox_log_err(fmt, ...) MBOX_LOG(ERR, fmt, ##__VA_ARGS__) -#define mbox_func_trace mbox_log_dbg extern int octeontx_logtype_fpavf; -extern int octeontx_logtype_fpavf_mbox; #endif /* __OCTEONTX_POOL_LOGS_H__*/ diff --git a/drivers/mempool/octeontx/rte_mempool_octeontx_version.map b/drivers/mempool/octeontx/rte_mempool_octeontx_version.map index fe8cdeca0..a75303172 100644 --- a/drivers/mempool/octeontx/rte_mempool_octeontx_version.map +++ b/drivers/mempool/octeontx/rte_mempool_octeontx_version.map @@ -1,9 +1,3 @@ DPDK_17.11 { - global: - - octeontx_ssovf_info; - octeontx_ssovf_bar; - octeontx_ssovf_mbox_send; - local: *; }; diff --git a/drivers/net/octeontx/Makefile b/drivers/net/octeontx/Makefile index 3e4a10662..885f17684 100644 --- a/drivers/net/octeontx/Makefile +++ b/drivers/net/octeontx/Makefile @@ -10,6 +10,7 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_pmd_octeontx.a CFLAGS += $(WERROR_FLAGS) +CFLAGS += -I$(RTE_SDK)/drivers/common/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/ EXPORT_MAP := rte_pmd_octeontx_version.map @@ -46,7 +47,7 @@ endif CFLAGS_octeontx_ethdev.o += -DALLOW_EXPERIMENTAL_API LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring -LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs +LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_common_octeontx LDLIBS += -lrte_mempool_octeontx LDLIBS += -lrte_eventdev LDLIBS += -lrte_bus_pci diff --git a/mk/rte.app.mk b/mk/rte.app.mk index a9b4b0502..bf39c4ab0 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -111,6 +111,10 @@ ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni endif +ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL),yy) +_LDLIBS-y += -lrte_common_octeontx +endif + _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += -lrte_bus_pci _LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += -lrte_bus_vdev _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += -lrte_bus_dpaa -- 2.16.2