DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shijith Thotton <sthotton@marvell.com>
To: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Cc: Shijith Thotton <sthotton@marvell.com>,
	Pavan Nikhilesh <pbhagavatula@marvell.com>,
	Jerin Jacob <jerinj@marvell.com>, <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 3/3] event/octeontx2: add timer periodic mode support
Date: Tue, 9 Mar 2021 02:15:43 +0530	[thread overview]
Message-ID: <20210308204543.2903723-4-sthotton@marvell.com> (raw)
In-Reply-To: <20210308204543.2903723-1-sthotton@marvell.com>

Add support for periodic mode in event timer adapter.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 drivers/event/octeontx2/otx2_tim_evdev.c | 29 ++++++++++++++++++++----
 drivers/event/octeontx2/otx2_tim_evdev.h |  1 +
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/drivers/event/octeontx2/otx2_tim_evdev.c b/drivers/event/octeontx2/otx2_tim_evdev.c
index 4c24cc8a6..39a29f17f 100644
--- a/drivers/event/octeontx2/otx2_tim_evdev.c
+++ b/drivers/event/octeontx2/otx2_tim_evdev.c
@@ -65,7 +65,8 @@ otx2_tim_ring_info_get(const struct rte_event_timer_adapter *adptr,
 	struct otx2_tim_ring *tim_ring = adptr->data->adapter_priv;
 
 	adptr_info->max_tmo_ns = tim_ring->max_tout;
-	adptr_info->min_resolution_ns = tim_ring->tck_nsec;
+	adptr_info->min_resolution_ns = tim_ring->ena_periodic ?
+		tim_ring->max_tout : tim_ring->tck_nsec;
 	rte_memcpy(&adptr_info->conf, &adptr->data->conf,
 		   sizeof(struct rte_event_timer_adapter_conf));
 }
@@ -163,7 +164,7 @@ tim_chnk_pool_create(struct otx2_tim_ring *tim_ring,
 		}
 		tim_ring->aura = npa_lf_aura_handle_to_aura(
 				tim_ring->chunk_pool->pool_id);
-		tim_ring->ena_dfb = 0;
+		tim_ring->ena_dfb = tim_ring->ena_periodic ? 1 : 0;
 	} else {
 		tim_ring->chunk_pool = rte_mempool_create(pool_name,
 				tim_ring->nb_chunks, tim_ring->chunk_sz,
@@ -254,6 +255,7 @@ otx2_tim_ring_create(struct rte_event_timer_adapter *adptr)
 	struct tim_ring_req *free_req;
 	struct tim_lf_alloc_req *req;
 	struct tim_lf_alloc_rsp *rsp;
+	uint8_t is_periodic;
 	int i, rc;
 
 	if (dev == NULL)
@@ -284,6 +286,20 @@ otx2_tim_ring_create(struct rte_event_timer_adapter *adptr)
 		}
 	}
 
+	is_periodic = 0;
+	if (rcfg->flags & RTE_EVENT_TIMER_ADAPTER_F_PERIODIC) {
+		if (rcfg->max_tmo_ns &&
+		    rcfg->max_tmo_ns != rcfg->timer_tick_ns) {
+			rc = -ERANGE;
+			goto rng_mem_err;
+		}
+
+		/* Use 2 buckets to avoid contention */
+		rcfg->max_tmo_ns = rcfg->timer_tick_ns;
+		rcfg->timer_tick_ns /= 2;
+		is_periodic = 1;
+	}
+
 	tim_ring = rte_zmalloc("otx2_tim_prv", sizeof(struct otx2_tim_ring), 0);
 	if (tim_ring == NULL) {
 		rc =  -ENOMEM;
@@ -296,11 +312,13 @@ otx2_tim_ring_create(struct rte_event_timer_adapter *adptr)
 	tim_ring->clk_src = (int)rcfg->clk_src;
 	tim_ring->ring_id = adptr->data->id;
 	tim_ring->tck_nsec = RTE_ALIGN_MUL_CEIL(rcfg->timer_tick_ns, 10);
-	tim_ring->max_tout = rcfg->max_tmo_ns;
+	tim_ring->max_tout = is_periodic ?
+		rcfg->timer_tick_ns * 2 : rcfg->max_tmo_ns;
 	tim_ring->nb_bkts = (tim_ring->max_tout / tim_ring->tck_nsec);
 	tim_ring->chunk_sz = dev->chunk_sz;
 	tim_ring->nb_timers = rcfg->nb_timers;
 	tim_ring->disable_npa = dev->disable_npa;
+	tim_ring->ena_periodic = is_periodic;
 	tim_ring->enable_stats = dev->enable_stats;
 
 	for (i = 0; i < dev->ring_ctl_cnt ; i++) {
@@ -348,7 +366,7 @@ otx2_tim_ring_create(struct rte_event_timer_adapter *adptr)
 	cfg_req->ring = tim_ring->ring_id;
 	cfg_req->bigendian = false;
 	cfg_req->clocksource = tim_ring->clk_src;
-	cfg_req->enableperiodic = false;
+	cfg_req->enableperiodic = tim_ring->ena_periodic;
 	cfg_req->enabledontfreebuffer = tim_ring->ena_dfb;
 	cfg_req->bucketsize = tim_ring->nb_bkts;
 	cfg_req->chunksize = tim_ring->chunk_sz;
@@ -568,7 +586,8 @@ otx2_tim_caps_get(const struct rte_eventdev *evdev, uint64_t flags,
 
 	/* Store evdev pointer for later use. */
 	dev->event_dev = (struct rte_eventdev *)(uintptr_t)evdev;
-	*caps = RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT;
+	*caps = RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT |
+		RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC;
 	*ops = &otx2_tim_ops;
 
 	return 0;
diff --git a/drivers/event/octeontx2/otx2_tim_evdev.h b/drivers/event/octeontx2/otx2_tim_evdev.h
index 44e3c7b51..82d116c09 100644
--- a/drivers/event/octeontx2/otx2_tim_evdev.h
+++ b/drivers/event/octeontx2/otx2_tim_evdev.h
@@ -155,6 +155,7 @@ struct otx2_tim_ring {
 	uint8_t disable_npa;
 	uint8_t optimized;
 	uint8_t ena_dfb;
+	uint8_t ena_periodic;
 	uint16_t ring_id;
 	uint32_t aura;
 	uint64_t nb_timers;
-- 
2.25.1


  parent reply	other threads:[~2021-03-08 20:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 20:45 [dpdk-dev] [PATCH 0/3] periodic mode for event timer adapter Shijith Thotton
2021-03-08 20:45 ` [dpdk-dev] [PATCH 1/3] eventdev: introduce adapter flags for periodic mode Shijith Thotton
2021-03-09 20:04   ` Carrillo, Erik G
2021-03-10  9:14     ` Shijith Thotton
2021-03-11 20:47       ` Carrillo, Erik G
2021-03-12 15:30   ` Carrillo, Erik G
2021-03-14 16:49     ` Shijith Thotton
2021-03-08 20:45 ` [dpdk-dev] [PATCH 2/3] test/event: add unit tests for periodic timer Shijith Thotton
2021-03-08 20:45 ` Shijith Thotton [this message]
2021-03-14 16:45 ` [dpdk-dev] [PATCH v2 0/3] periodic mode for event timer adapter Shijith Thotton
2021-03-14 16:45   ` [dpdk-dev] [PATCH v2 1/3] eventdev: introduce adapter flags for periodic mode Shijith Thotton
2021-03-16 19:04     ` Carrillo, Erik G
2021-03-17  6:10       ` Shijith Thotton
2021-03-14 16:45   ` [dpdk-dev] [PATCH v2 2/3] test/event: add unit tests for periodic timer Shijith Thotton
2021-03-14 16:45   ` [dpdk-dev] [PATCH v2 3/3] event/octeontx2: add timer periodic mode support Shijith Thotton
2021-03-17  8:04   ` [dpdk-dev] [PATCH v3 0/3] periodic mode for event timer adapter Shijith Thotton
2021-03-17  8:04     ` [dpdk-dev] [PATCH v3 1/3] eventdev: introduce adapter flags for periodic mode Shijith Thotton
2021-03-17 18:07       ` Carrillo, Erik G
2021-03-22  9:50         ` Jerin Jacob
2021-03-17  8:04     ` [dpdk-dev] [PATCH v3 2/3] test/event: add unit tests for periodic timer Shijith Thotton
2021-03-17 18:11       ` Carrillo, Erik G
2021-03-17  8:04     ` [dpdk-dev] [PATCH v3 3/3] event/octeontx2: add timer periodic mode support Shijith Thotton
2021-03-21 14:43       ` Pavan Nikhilesh Bhagavatula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210308204543.2903723-4-sthotton@marvell.com \
    --to=sthotton@marvell.com \
    --cc=dev@dpdk.org \
    --cc=erik.g.carrillo@intel.com \
    --cc=jerinj@marvell.com \
    --cc=pbhagavatula@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).