-----Original Message----- > Date: Tue, 3 Apr 2018 20:35:11 +0530 > From: Pavan Nikhilesh <pbhagavat...@caviumnetworks.com> > To: jerin.ja...@caviumnetworks.com, santosh.shu...@caviumnetworks.com, > erik.g.carri...@intel.com > Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavat...@caviumnetworks.com> > Subject: [dpdk-dev] [PATCH v3 09/12] event/octeontx: optimize timer adapter > resolution parameters > X-Mailer: git-send-email 2.16.3 > > When application sets `RTE_EVENT_TIMER_ADAPTER_F_ADJUST_RES` flag > while creating adapter underlying driver is free to optimize the > resolution for best possible configuration. > > Signed-off-by: Pavan Nikhilesh <pbhagavat...@caviumnetworks.com> > --- > static int > timvf_ring_start(const struct rte_event_timer_adapter *adptr) > { > @@ -217,7 +256,7 @@ timvf_ring_create(struct rte_event_timer_adapter *adptr) > } > > timr->tim_ring_id = adptr->data->id; > - timr->tck_nsec = rcfg->timer_tick_ns; > + timr->tck_nsec = RTE_ALIGN_MUL_CEIL(rcfg->timer_tick_ns, 10); > timr->max_tout = rcfg->max_tmo_ns; > timr->meta.nb_bkts = (timr->max_tout / timr->tck_nsec) + 1; > timr->vbar0 = octeontx_timvf_bar(timr->tim_ring_id, 0); > @@ -227,6 +266,13 @@ timvf_ring_create(struct rte_event_timer_adapter *adptr) > > timr->nb_chunks = nb_timers / nb_chunk_slots; > > + /* Try to optimize the bucket parameters. */ > + if ((rcfg->flags & RTE_EVENT_TIMER_ADAPTER_F_ADJUST_RES) > + && !rte_is_power_of_2(timr->meta.nb_bkts)) { > + optimize_bucket_parameters(timr); > + timvf_log_info("Optimizing configured values");
You could print the adjusted values here. > + } > + > if (rcfg->flags & RTE_EVENT_TIMER_ADAPTER_F_SP_PUT) { > mp_flags = MEMPOOL_F_SP_PUT | MEMPOOL_F_SC_GET; > timvf_log_info("Using single producer mode"); > diff --git a/drivers/event/octeontx/timvf_evdev.h > b/drivers/event/octeontx/timvf_evdev.h > index d8a6d111f..22c8c2266 100644 > --- a/drivers/event/octeontx/timvf_evdev.h > +++ b/drivers/event/octeontx/timvf_evdev.h > @@ -192,6 +192,12 @@ bkt_mod(const uint32_t rel_bkt, const uint32_t nb_bkts) > return rel_bkt % nb_bkts; > } > > +static __rte_always_inline uint32_t __hot __hot may not be required here as it in as inline function. > +bkt_and(uint32_t rel_bkt, uint32_t nb_bkts) > +{ > + return rel_bkt & (nb_bkts - 1); > +} > + > int timvf_timer_adapter_caps_get(const struct rte_eventdev *dev, uint64_t > flags, > uint32_t *caps, const struct rte_event_timer_adapter_ops **ops); > uint16_t timvf_timer_unreg_burst(const struct rte_event_timer_adapter *adptr, With above change: Acked-by: Jerin Jacob <jerin.ja...@caviumnetworks.com>