From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C515DA0548; Sat, 6 Mar 2021 17:33:34 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 61C3B22A4DA; Sat, 6 Mar 2021 17:31:18 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 17A3D22A4DA for ; Sat, 6 Mar 2021 17:31:16 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 126GQjLP009184; Sat, 6 Mar 2021 08:31:15 -0800 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=pfpt0220; bh=tGeTJT1amWOg4UmjLkXZ2Yao9g3z0gO5Nvpdi3cfsVg=; b=RweAkdmR72EYE75TiLN2+xBitNZO1Rqr/zM6P7KGmXSx67RQPMHetnyC29MwyO3+nYqE YeMIRKhrkiOyKzaC7OzPgjGSISpkkC3T20+sRC6HGWS0XzNAARnPcdMRjDeqlPXV42eT 1RkkfZ8QgjytP89tHOGzB9N0GbiZgYysaa9DCa5lvrAg5RWUlsSAtfLzJU4dSAY8nmam 9PNz4FbxCFbi9c7/tG4WUPug/Dm6YSl+vOWAVvThar0WVAOG2UOrxcyNetdejAkke2gI UrjMvv+Ki7bwkTHR86WOdrwRnKbK414oGAgKG5Hx8Ks1gX1+WdWpV9lJ1XU3UcDAJp+R Nw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 374a4w08qf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 06 Mar 2021 08:31:15 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 6 Mar 2021 08:31:13 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 6 Mar 2021 08:31:13 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 6 Mar 2021 08:31:13 -0800 Received: from BG-LT7430.marvell.com (unknown [10.193.68.121]) by maili.marvell.com (Postfix) with ESMTP id E0C643F7041; Sat, 6 Mar 2021 08:31:10 -0800 (PST) From: To: , Pavan Nikhilesh , "Shijith Thotton" , Anatoly Burakov CC: , Date: Sat, 6 Mar 2021 21:59:24 +0530 Message-ID: <20210306162942.6845-20-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210306162942.6845-1-pbhagavatula@marvell.com> References: <20210306162942.6845-1-pbhagavatula@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-06_08:2021-03-03, 2021-03-06 signatures=0 Subject: [dpdk-dev] [PATCH 19/36] event/cnxk: support event timer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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: Shijith Thotton Add event timer adapter aka TIM initialization on SSO probe. Signed-off-by: Pavan Nikhilesh Signed-off-by: Shijith Thotton --- doc/guides/eventdevs/cnxk.rst | 6 ++++ drivers/event/cnxk/cnxk_eventdev.c | 3 ++ drivers/event/cnxk/cnxk_eventdev.h | 2 ++ drivers/event/cnxk/cnxk_tim_evdev.c | 47 +++++++++++++++++++++++++++++ drivers/event/cnxk/cnxk_tim_evdev.h | 44 +++++++++++++++++++++++++++ drivers/event/cnxk/meson.build | 3 +- 6 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 drivers/event/cnxk/cnxk_tim_evdev.c create mode 100644 drivers/event/cnxk/cnxk_tim_evdev.h diff --git a/doc/guides/eventdevs/cnxk.rst b/doc/guides/eventdevs/cnxk.rst index b2684d431..662df2971 100644 --- a/doc/guides/eventdevs/cnxk.rst +++ b/doc/guides/eventdevs/cnxk.rst @@ -35,6 +35,10 @@ Features of the OCTEON CNXK SSO PMD are: - Open system with configurable amount of outstanding events limited only by DRAM - HW accelerated dequeue timeout support to enable power management +- HW managed event timers support through TIM, with high precision and + time granularity of 2.5us on CN9K and 1us on CN10K. +- Up to 256 TIM rings aka event timer adapters. +- Up to 8 rings traversed in parallel. Prerequisites and Compilation procedure --------------------------------------- @@ -101,3 +105,5 @@ Debugging Options +===+============+=======================================================+ | 1 | SSO | --log-level='pmd\.event\.cnxk,8' | +---+------------+-------------------------------------------------------+ + | 2 | TIM | --log-level='pmd\.event\.cnxk\.timer,8' | + +---+------------+-------------------------------------------------------+ diff --git a/drivers/event/cnxk/cnxk_eventdev.c b/drivers/event/cnxk/cnxk_eventdev.c index dbd35ca5d..c404bb586 100644 --- a/drivers/event/cnxk/cnxk_eventdev.c +++ b/drivers/event/cnxk/cnxk_eventdev.c @@ -582,6 +582,8 @@ cnxk_sso_init(struct rte_eventdev *event_dev) dev->nb_event_queues = 0; dev->nb_event_ports = 0; + cnxk_tim_init(&dev->sso); + return 0; error: @@ -598,6 +600,7 @@ cnxk_sso_fini(struct rte_eventdev *event_dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; + cnxk_tim_fini(); roc_sso_rsrc_fini(&dev->sso); roc_sso_dev_fini(&dev->sso); diff --git a/drivers/event/cnxk/cnxk_eventdev.h b/drivers/event/cnxk/cnxk_eventdev.h index ee7dce5f5..e4051a64b 100644 --- a/drivers/event/cnxk/cnxk_eventdev.h +++ b/drivers/event/cnxk/cnxk_eventdev.h @@ -14,6 +14,8 @@ #include "roc_api.h" +#include "cnxk_tim_evdev.h" + #define CNXK_SSO_XAE_CNT "xae_cnt" #define CNXK_SSO_GGRP_QOS "qos" #define CN9K_SSO_SINGLE_WS "single_ws" diff --git a/drivers/event/cnxk/cnxk_tim_evdev.c b/drivers/event/cnxk/cnxk_tim_evdev.c new file mode 100644 index 000000000..76b17910f --- /dev/null +++ b/drivers/event/cnxk/cnxk_tim_evdev.c @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2021 Marvell International Ltd. + */ + +#include "cnxk_eventdev.h" +#include "cnxk_tim_evdev.h" + +void +cnxk_tim_init(struct roc_sso *sso) +{ + const struct rte_memzone *mz; + struct cnxk_tim_evdev *dev; + int rc; + + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return; + + mz = rte_memzone_reserve(RTE_STR(CNXK_TIM_EVDEV_NAME), + sizeof(struct cnxk_tim_evdev), 0, 0); + if (mz == NULL) { + plt_tim_dbg("Unable to allocate memory for TIM Event device"); + return; + } + dev = mz->addr; + + dev->tim.roc_sso = sso; + rc = roc_tim_init(&dev->tim); + if (rc < 0) { + plt_err("Failed to initialize roc tim resources"); + rte_memzone_free(mz); + return; + } + dev->nb_rings = rc; + dev->chunk_sz = CNXK_TIM_RING_DEF_CHUNK_SZ; +} + +void +cnxk_tim_fini(void) +{ + struct cnxk_tim_evdev *dev = tim_priv_get(); + + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return; + + roc_tim_fini(&dev->tim); + rte_memzone_free(rte_memzone_lookup(RTE_STR(CNXK_TIM_EVDEV_NAME))); +} diff --git a/drivers/event/cnxk/cnxk_tim_evdev.h b/drivers/event/cnxk/cnxk_tim_evdev.h new file mode 100644 index 000000000..6cf0adb21 --- /dev/null +++ b/drivers/event/cnxk/cnxk_tim_evdev.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2021 Marvell International Ltd. + */ + +#ifndef __CNXK_TIM_EVDEV_H__ +#define __CNXK_TIM_EVDEV_H__ + +#include +#include +#include +#include + +#include +#include +#include + +#include "roc_api.h" + +#define CNXK_TIM_EVDEV_NAME cnxk_tim_eventdev +#define CNXK_TIM_RING_DEF_CHUNK_SZ (4096) + +struct cnxk_tim_evdev { + struct roc_tim tim; + struct rte_eventdev *event_dev; + uint16_t nb_rings; + uint32_t chunk_sz; +}; + +static inline struct cnxk_tim_evdev * +tim_priv_get(void) +{ + const struct rte_memzone *mz; + + mz = rte_memzone_lookup(RTE_STR(CNXK_TIM_EVDEV_NAME)); + if (mz == NULL) + return NULL; + + return mz->addr; +} + +void cnxk_tim_init(struct roc_sso *sso); +void cnxk_tim_fini(void); + +#endif /* __CNXK_TIM_EVDEV_H__ */ diff --git a/drivers/event/cnxk/meson.build b/drivers/event/cnxk/meson.build index 8bac4b7f3..6e9f3daab 100644 --- a/drivers/event/cnxk/meson.build +++ b/drivers/event/cnxk/meson.build @@ -13,6 +13,7 @@ sources = files('cn10k_worker.c', 'cn9k_worker.c', 'cn9k_eventdev.c', 'cnxk_eventdev.c', - 'cnxk_sso_selftest.c') + 'cnxk_sso_selftest.c', + 'cnxk_tim_evdev.c') deps += ['bus_pci', 'common_cnxk', 'net_cnxk'] -- 2.17.1