DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Carrillo, Erik G" <erik.g.carrillo@intel.com>
To: Jerin Jacob <jerinjacobk@gmail.com>
Cc: "jerinj@marvell.com" <jerinj@marvell.com>,
	"hofors@lysator.liu.se" <hofors@lysator.liu.se>,
	"Naga Harish K, S V" <s.v.naga.harish.k@intel.com>,
	"Jayatheerthan, Jay" <jay.jayatheerthan@intel.com>,
	"pbhagavatula@marvell.com" <pbhagavatula@marvell.com>,
	"sthotton@marvell.com" <sthotton@marvell.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [PATCH v3] eventdev/timer: add API to get remaining ticks
Date: Fri, 13 Jan 2023 16:35:31 +0000	[thread overview]
Message-ID: <IA1PR11MB6418416EC4943F439A4AD734B9C29@IA1PR11MB6418.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CALBAE1OZf2eBj_c-NajhANMgF-zvQoVTpFXkb4aKCGwKA3+_wQ@mail.gmail.com>

Hi Jerin,

Thanks for the review.  One response in-line:

<...snipped...>

> > +static int
> > +swtim_get_remaining_ticks(const struct rte_event_timer_adapter
> *adapter,
> > +                         const struct rte_event_timer *evtim,
> > +                         uint64_t *ticks_remaining) {
> > +       uint64_t nsecs_per_adapter_tick, opaque, cycles_remaining;
> > +       enum rte_event_timer_state n_state;
> > +       double nsecs_per_cycle;
> > +       struct rte_timer *tim;
> > +       uint64_t cur_cycles;
> > +
> > +       /* Check that timer is armed */
> > +       n_state = __atomic_load_n(&evtim->state, __ATOMIC_ACQUIRE);
> > +       if (n_state != RTE_EVENT_TIMER_ARMED)
> > +               return -EINVAL;
> > +
> > +       opaque = evtim->impl_opaque[0];
> > +       tim = (struct rte_timer *)(uintptr_t)opaque;
> > +
> > +       cur_cycles = rte_get_timer_cycles();
> > +       if (cur_cycles > tim->expire) {
> > +               *ticks_remaining = 0;
> > +               return 0;
> > +       }
> > +
> > +       cycles_remaining = tim->expire - cur_cycles;
> > +       nsecs_per_cycle = (double)NSECPERSEC / rte_get_timer_hz();
> > +       nsecs_per_adapter_tick = adapter->data->conf.timer_tick_ns;
> > +
> > +       *ticks_remaining = (uint64_t)ceil((cycles_remaining *
> nsecs_per_cycle) /
> > +                                         nsecs_per_adapter_tick);
> 
> Can RTE_*CEIL* in eal/include/rte_common.h" API helps here? Also, it will
> remove the need for math.h, and it will be more optimized.
>
It looks like the RTE_*CEIL* macros are related to alignment, so they don't seem to apply here.

I'll make the suggested changes for the remainder of the comments in the next version of the patch. 
 
Thanks,
Erik

<...snipped...>

  reply	other threads:[~2023-01-13 16:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-19 21:11 Erik Gabriel Carrillo
2023-01-13 14:08 ` Jerin Jacob
2023-01-13 16:35   ` Carrillo, Erik G [this message]
2023-01-13 19:50 ` [PATCH v4] " Erik Gabriel Carrillo
2023-01-16  7:45   ` Jerin Jacob

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=IA1PR11MB6418416EC4943F439A4AD734B9C29@IA1PR11MB6418.namprd11.prod.outlook.com \
    --to=erik.g.carrillo@intel.com \
    --cc=dev@dpdk.org \
    --cc=hofors@lysator.liu.se \
    --cc=jay.jayatheerthan@intel.com \
    --cc=jerinj@marvell.com \
    --cc=jerinjacobk@gmail.com \
    --cc=pbhagavatula@marvell.com \
    --cc=s.v.naga.harish.k@intel.com \
    --cc=sthotton@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).