From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01hn0210.outbound.protection.outlook.com [104.47.34.210]) by dpdk.org (Postfix) with ESMTP id 3A343AAA7 for ; Mon, 26 Mar 2018 09:54:26 +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=/fsJSZTbvmQf23Q94d0QrPU2U8gpgECy0EaeUa4EmMQ=; b=m4TXljVXbA6h9d5pziK+MCGBIrR58/6ZT58sWDuwxB6yZi9rvwZMoDRwDkiIJbTHXYfUlw3t28yG6roxYUKe6b0mtqXg8tVKDteaGYObbd9EvDpAJVBh0N8oDGiq80uDuDn59N9TZV/6ZTabTecf0XYMXlHp2H5eWw+ig/NIKdE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (111.93.218.67) by BN6PR07MB3457.namprd07.prod.outlook.com (2603:10b6:405:64::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.10; Mon, 26 Mar 2018 07:54:18 +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, 26 Mar 2018 13:23:44 +0530 Message-Id: <20180326075344.2209-2-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180326075344.2209-1-pbhagavatula@caviumnetworks.com> References: <20180319092726.10153-1-pbhagavatula@caviumnetworks.com> <20180326075344.2209-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: SG2PR06CA0164.apcprd06.prod.outlook.com (2603:1096:1:1e::18) To BN6PR07MB3457.namprd07.prod.outlook.com (2603:10b6:405:64::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2deed01e-6e0d-43c7-ca28-08d592eec987 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603328)(7153060)(7193020); SRVR:BN6PR07MB3457; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3457; 3:5DvC3CGLEdPB2M8gEnnENcERNsq+XayIOj0TGImyCJPx4HRAqrMUe+OuKkAyfEJv44e0oPksfui4+TKZm0ePwtkXd6ySrWvBKANtt0JSWefixEs7kZnjsAd/lTsu/2LoZDVOItN7ZA9B7wGYLPwCYCZu6DCxkbK04RoQoauYYnev0hiZcSMzs3UIw450m2SHzNwWT23Zy95QIOhv86b8ggNKHI19bNnRxRb13kFXS2mpaRn70OOw5T+K1sSmBKmG; 25:z7AVPE/dY2tNLsPU5zjhAjPbGtVivelNjD2W4DMzryu/1IQn1jRZDefGw8rg2iSul6QmpjOH1ZXukTm5odk/AVztb440G9OSEb1tHyxDjQkEZN/0T5cyqO6JVGexU6bPsQsv8Wd88aAZUnFuqHmsnFuRq1GqbURNwyO/0GcW1jxeNrQ/3U9R4ArIGAjB4UghzuPag8z/Jy+z+x2mTdZ2NLDxmTpJh6gNzwz13/+CyaOsftLF5Z2ULdIRCoihwPtaqnc6OByvDv9HAdbJwWF3nBzoT+hnD5+9Q0pK4Tg11ZQM3fIAmffdPMUYYJe4qUFxi0VP0NQD4jHIcv2gP65jCg==; 31:vO7+KclLKLZomT9FUMU+R9u6XhbolqsTO58RMWLehol6UDvCYnA2rAZvRB03ncnccgmVoCkCnnoObDwIMeb1fbyI/1geYafBKZDzPww3R+IdreuphFJtxDSf2YJ4nxDV0WSNuEIyD1tkYwt8nQ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w74TnuULiE8p00zvyZo52C 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)(8121501046)(5005006)(3002001)(10201501046)(3231221)(2232076)(944501327)(52105095)(93006095)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:BN6PR07MB3457; BCL:0; PCL:0; RULEID:; SRVR:BN6PR07MB3457; X-Forefront-PRVS: 06237E4555 X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(6069001)(346002)(39850400004)(376002)(39380400002)(396003)(366004)(189003)(199004)(2906002)(42882007)(1857600001)(5660300001)(11346002)(25786009)(446003)(72206003)(106356001)(4326008)(48376002)(478600001)(16526019)(1076002)(26005)(50466002)(2616005)(5009440100003)(956004)(8656006)(105586002)(97736004)(305945005)(52116002)(6486002)(47776003)(51416003)(66066001)(6666003)(76176011)(50226002)(7736002)(68736007)(53936002)(6512007)(59450400001)(6506007)(8676002)(107886003)(8936002)(16586007)(36756003)(386003)(81166006)(81156014)(316002)(3846002)(6116002)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:BN6PR07MB3457; H:localhost.localdomain; 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; BN6PR07MB3457; 23:GrmheY9vNfCRHLOUjox9P/54TPuAnDFh3ByRkABcO?= =?us-ascii?Q?yI8nk3RJFQxxpqcgWVtp9kHcHRGt/MnqKActuUaBIjFpguLaT28e1KlUxxt6?= =?us-ascii?Q?8vx78HcRJg1s+Z1M6n4Rf2+HjsEPmyMPogoD1uexlYEQ3XC71/n5izarmFJd?= =?us-ascii?Q?dR7MscpslITSANBDijKGdx24sD8UEFu7fpD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zvJw3f8+hD/uqo/VGianWc80exAAFCY1iD0rWUBm7kLz85BsuifIRj?= =?us-ascii?Q?w1Q7+VPFyVxmjSErX0kYSRsr+48bnkpQ4RbnWbyRL+S44nFzbvi1RbnBfzns?= =?us-ascii?Q?um3dMPsAZ2L2ZS7kvz6Dsr0Lg+EkiGrAY9+G4BezeWtx2En8n6vcj0hHjATL?= =?us-ascii?Q?5KSAeWY2/oDG/XKGpKLIX29k701l2BqKQcAGlZMHIFDEQtCqplM553IV8ORM?= =?us-ascii?Q?mJ6kaBYnfVmFsrRWetZNkaOs1do5TJuKc/rhqBR7oG4rdU+prLFlNRxZNkcl?= =?us-ascii?Q?81/7A=3D=3D?= X-Microsoft-Antispam-Message-Info: PgMaX/J+pPRrxInGAoEz7rNDwYixGTqV1QnPZtAt4iOxMEOuQHiaO/JGCrZtLlhpoQ8rXBT4MeKJ628hzAbKsMYgAtcFMIZ1tIGzkZVCShFIWTRDM5tqD3d9L86UHjbmIyU21k1sLVrY1WPtEt2IokErwvRvhAA9PcFZckxXCW+Ux4+WCzfP6RSdy5HeQTLoppelM7zS8PH5cWqRcu5m9elUCJZFc6C58PoIlVblIAh/6bURn6PJQTdZmfiTw7QrRH4CwvAd8tWXsYNfxwapPx8DpkFCK5q0COtcnsGKYos56KHHhxBDo90C0C5sx77HAUDDvWJQX8A8gZS7015MbHikwiUqpc4mhPv2l5vDRcJggJOeGfW3IcFqTgID1kbTNwKvTre78aZQFZ5O5OOmx86AAU1D5p01YBCvG1moCp5dnJH9HUoeA3V6HwPEJASk6vCJ+2DVsrQrY1A3X3teJMK9wJGqGNJ2/HwG+qbKY1udpmtrudNo1nSAa4taD7Bb X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3457; 6:CgbCvTi6NzESHgwZcwYMBMSZB2hOJyO/c20cSelmp3qBx9e+1Etvwfau3mYiFEP0S3b8Wofe2dUFx1uEix+ZNzHvioq+pnjUGSHJsYNe9fUqwknYJR5bcShGU70pUCqKa/gchT8/kCYnegRsi0Wk4sn5V+IWrL6iO+uzAuwcEHgvCMSvkgrwNl1FSoUbq/8iBNYlS4JF6a4tIn4YtdZPiLKy1LlRErm2PJhMoOevnKNqXP29LaTDQb49CpoEJXUMlVMGJJr6fa987I8NzRXJ46N9e5ZDABZUqV6u4I+fjCT12N+hedbXWtxAYIW0tvOoCGsKvTDvyZuXzBAwpn0VbFNPFlXYVbPnWg7XjolqVnngH0XMROXfhW0KGfO0MgPRrzdiKGLb3kSoqsWM3Wx+JlRYUldXXn+VCWytJo6UJBfIN1xWvvAHmwpgqCkglMofesRG94Y0xieI6J5RvUcgdVIUAExTUTCG7VjAJfE6x9B8gkFxC88PC8lqhSHZxNQN; 5:AUySU7xUc3W5THfOxsSiqMSluLq0rYX1tGUx226LlxRtNSOUDH49MUCem+zF9OVWE9T18fUUAJrHYg7DZQdYGqpNGSf5pGDuN8YoX+E/fWX/Ct0OInfaBvp9H0vgujmFwJaq+AFVGSrkOiES0u44C0sqch44NM5vbmazKNTcMEc=; 24:Ng8qgDAHeMprttbLUrDro7bLuEbgRJjZtdGKFAm7MIQ5EswG/zUOogUJsf5PG/NLh7keNnPh8ToNJZYW9nIyuA== SpamDiagnosticOutput: 1:22 X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3457; 7:ON+4BPs2Z3okftIHS/aXP3GQB39fMmSBLW96Nin8Kt6q1PeHBzeXyd/VORniVlakVTcqbbKmINoEbBIDplGsJDoE2oFF5ZSVLU3BQEV4jtixkQ7TcJBEKc0MiM7bN0cOosEgZseI7okiLXjHNPbidzEqK/c6c6zqieNxb/owt9iZhDKGe7hseWhv0NANSZWQUks8IEBwKDrQxIgINnBIWe0fAjcMTrb38fvvb9Z9+mPzsABdSu0lpiwk28zaROHI X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2018 07:54:18.5077 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2deed01e-6e0d-43c7-ca28-08d592eec987 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3457 Subject: [dpdk-dev] [PATCH v3 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, 26 Mar 2018 07:54:27 -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_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 ++ 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_common_octeontx_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 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 3eb41d176..c18f6a6a2 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -217,6 +217,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_common_octeontx +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