From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01hn0243.outbound.protection.outlook.com [104.47.34.243]) by dpdk.org (Postfix) with ESMTP id 5B17D4CBD for ; Tue, 20 Mar 2018 15:41:33 +0100 (CET) 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=4BlXM2yjj4YlBKmqCUgZVJ87l7Hp0AdCzLP28OtZc24=; b=VkC0Qvfn1sIroQawmWQm9YvVkUg18s+BPMJsp7/ktUVy6v6B6HS7ZwgXQ+oseDcUCDiURv4umSI/B9TJEQ9e7Vt1ZQX53O992WScyjKy9TQ8tnquLcjjXiPmn2sDFJ8/RUAOdMT9jOM+eMq6176mPsK7NJ/hTTfrj4Np52yQZoM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from ltp-pvn.caveonetworks.com (111.93.218.67) by MWHPR07MB3472.namprd07.prod.outlook.com (2603:10b6:301:63::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Tue, 20 Mar 2018 14:41:26 +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: Tue, 20 Mar 2018 20:10:46 +0530 Message-Id: <20180320144046.15382-2-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180320144046.15382-1-pbhagavatula@caviumnetworks.com> References: <20180319092726.10153-1-pbhagavatula@caviumnetworks.com> <20180320144046.15382-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BN6PR1301CA0022.namprd13.prod.outlook.com (2603:10b6:405:29::35) To MWHPR07MB3472.namprd07.prod.outlook.com (2603:10b6:301:63::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c2384a70-c58c-43be-9808-08d58e70aba8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603328)(7153060)(7193020); SRVR:MWHPR07MB3472; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3472; 3:SIljK/OE6N3syF9UzWsFIExW26lim2K9eOrQBq5FPfNDJ+ENPjgR/bG+9P8fY2Q43ju1oy+mfEr37oz4XE5UCBQM6yO89433+bFsN5+CRLVB67IQx8MiC4rt0NrXviIl/U2yu+oMuGcZTGlYhbe2I0Zu2ejdiIEctUuf+GBOKSdsiajXD52J6qeYZnsMYm7Ou/jlzq+GpUyqrUw4mYQ9HZMsg/UafImYoeNDMZvrDssaUes9jdDxGAgwewhwWnc5; 25:GyAh9yFIjCJoioAbnA9QvKlwKlq32EOAi3Bkty8AdliJx/ypSaQEQol8BHE8gw5mFxBW2ze3yW5WaZGrfSDVQCsAHYGLhagrPIZm0z5nY7WJdwIdUhzZYqtcVLLcpfkUpzItGH6Hr87pm/jaFZDAzks3VdaXDTeMZWODws2wvddpeRZbuDQgXCUCsr7tmYtJ2qmFRdZIezKcI3DkeStpAUxCdgDJFxRDWqDpaz2ru2ZmebJuGJxV5gpsJ6nUkBSkl1tfTvkUERCx8qo+IOmdB63vH9uOTYJ6NGuHk0TQBscNUGWK2ugseaUt8V31L1m/K/rdgvRgQMvM0zNUhCyb8Q==; 31:1rZJFZbHTuN0Ke4vb1ZSYd+ZucpCPUk3xJUgYuBYPpqHpJiHCqqc0xXOji77idFLvAcscglxjY/oudKNt5Z+3qAEoZgKN1AimoyVEP2YMsucVijMvlKtRPtXLki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jwrr4cYqhSQ5aHsa+pMtoVi5Ffv+BtBRXOqtbpufFq9tt/cYj+qw 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)(944501244)(52105095)(93006095)(10201501046)(3002001)(6041310)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:MWHPR07MB3472; BCL:0; PCL:0; RULEID:; SRVR:MWHPR07MB3472; X-Forefront-PRVS: 061725F016 X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(39860400002)(366004)(376002)(396003)(346002)(39380400002)(189003)(199004)(72206003)(8656006)(478600001)(6506007)(59450400001)(386003)(50466002)(26005)(48376002)(6116002)(6512007)(1076002)(69596002)(3846002)(36756003)(76176011)(42882007)(4326008)(305945005)(7736002)(52116002)(51416003)(25786009)(8936002)(81166006)(50226002)(8676002)(81156014)(2906002)(6486002)(316002)(107886003)(47776003)(66066001)(53936002)(1857600001)(5660300001)(2950100002)(6666003)(105586002)(5009440100003)(97736004)(16586007)(53416004)(106356001)(68736007)(16526019)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:MWHPR07MB3472; H:ltp-pvn.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR07MB3472; 23:yLbSlFl+qtwN5RJmd6haLtalInMurqHxeCOhzq8zC?= =?us-ascii?Q?bBNc5r7a60F+3DmInZ28GYB5YfOCBhY3es8KAnVS2em5rGK3FtncDBFazE3D?= =?us-ascii?Q?d9hNtHdjMte0DCkGf9dmshkYlF6j/J2QZ58Qlplj1oiBj9+uJsd+XJlP/ajV?= =?us-asc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GB5HLEaMQzYEvF4JOI037w6riyx6poLx5/M58Pg0RkFcs++sQpQvtaqbaeFQAAVneKAloQyUFuEmd+k3OHzRLe8ZdHf2J2GKK9Us0lKcPxEVE0mXSWHWuiAYhnnh+k3wwn1Sv50wuea70QukZDiaz/KbA0d69xRrucVIKVN+Pg+bPvLbjYHnQyNnS/4WRfrmQb5MYAPeH2nZH4nB1/lbpJuk6lAK491QDoDpuc7iJi4It39o2oNaoOLMU5TVpVJiQE5pNeGl+mBBA==; 5:F4qQNXLN6Mzj/XakpJmRE1KiFDZ6r6d8ekNGyAm/BCpgyGTrVNBzCmdmZnZ8Oze8vROdZ4yAmmLQF9GEPUcUsQH8pIgOectjpcvwsmCuULmsIKtG4cg5dXeR62edQK5N+1sNdikndrtxLAQkSpN4a8jPgLSoFlDNMa7fAF5Kc58=; 24:r3AdwxS+u/0lgMDiXJdoLiRtYXIuUYpI/NfuFiDqd2SgRGDKsyVYiBv8Hg7yU3dZ5tgYnVn7Cvc79bm01esW8Q==; 7:oCTGZvbzByklLtAy/hvonrz4pL4oXC5JGbnqhp4EO+EAeKR6zI8nlmsX4SlRPLir6lu8bIvJF48ZdNT6qlj+MOrF9VDioBDiq5tDb2hDRnCm7TGKqtIehrI9h2SMhm0UpTClUDhIJQGpTI+IwEK2fGw0wxw75tZeGW9lghEkI/IU80n+auqDajTxKmAdjQn13NJ0fiJvQSR9ia2E+9W4V5fCobQX/8oyyJJ2qWXB5OBc+cAXkJimR12tGPz4bnFm SpamDiagnosticOutput: 1:22 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2018 14:41:26.8665 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2384a70-c58c-43be-9808-08d58e70aba8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3472 Subject: [dpdk-dev] [PATCH v2 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: Tue, 20 Mar 2018 14:41:34 -0000 Move commonly used functions across mempool, event and net devices to a common folder in drivers. Signed-off-by: Pavan Nikhilesh --- 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_octeontx_common_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 ++ 17 files changed, 144 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_octeontx_common_version.map rename drivers/{mempool => event}/octeontx/octeontx_ssovf.c (92%) 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 9c2565f00..fcb3617d0 100644 --- a/drivers/common/meson.build +++ b/drivers/common/meson.build @@ -1,5 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Cavium, Inc +drivers = ['octeontx'] config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' driver_name_fmt = 'rte_@0@_common' diff --git a/drivers/common/octeontx/Makefile b/drivers/common/octeontx/Makefile new file mode 100644 index 000000000..62b021f4a --- /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_octeontx_common.a + +CFLAGS += $(WERROR_FLAGS) +EXPORT_MAP := rte_octeontx_common_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_octeontx_common_version.map b/drivers/common/octeontx/rte_octeontx_common_version.map new file mode 100644 index 000000000..ca3a815a7 --- /dev/null +++ b/drivers/common/octeontx/rte_octeontx_common_version.map @@ -0,0 +1,9 @@ +DPDK_18.02 { + 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..097608061 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_octeontx_common -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..c5e88dfd8 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 += ['octeontx_common', '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..7d12094bb 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_octeontx_common include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/mempool/octeontx/meson.build b/drivers/mempool/octeontx/meson.build index 1e894a56b..86c2ba104 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', 'octeontx_common'] 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..efe38c4ac 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_octeontx_common LDLIBS += -lrte_mempool_octeontx LDLIBS += -lrte_eventdev LDLIBS += -lrte_bus_pci diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 94525dc80..4bcc4bbf0 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -223,6 +223,10 @@ endif # CONFIG_RTE_LIBRTE_DPAA_BUS endif # CONFIG_RTE_LIBRTE_CRYPTODEV +ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL),yy) +_LDLIBS-y += -lrte_octeontx_common +endif + ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += -lrte_pmd_skeleton_event _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += -lrte_pmd_sw_event -- 2.16.2