DPDK usage discussions
 help / color / Atom feed
* [dpdk-users] Stopping DPDK Timer [dpdk-dev] [RTE-Timers]
@ 2019-09-02  5:32 Suraj R Gupta
  2019-09-02 11:22 ` [dpdk-users] [dpdk-dev] Stopping DPDK Timer [RTE-Timers] Bruce Richardson
  0 siblings, 1 reply; 6+ messages in thread
From: Suraj R Gupta @ 2019-09-02  5:32 UTC (permalink / raw)
  To: users, dev

Hi all,
I am working with DPDK timers.
In the documentation of timers, it has been said that dpdk based rte-timers
cannot stopped while running. I would like to know if there is any way to
stop it in middle or any workaround is possible.

For e.g.: If I have timer started for 500 ms and  i want to stop it in 100
ms due to an event/interrupt.

Note:I am not talking of stopping timer after callback execution, before
timer expiry in middle
Thanks in advance.

-- 
Thanks and Regards
Suraj R Gupta

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-users] [dpdk-dev] Stopping DPDK Timer  [RTE-Timers]
  2019-09-02  5:32 [dpdk-users] Stopping DPDK Timer [dpdk-dev] [RTE-Timers] Suraj R Gupta
@ 2019-09-02 11:22 ` Bruce Richardson
  2019-09-02 11:42   ` Suraj R Gupta
  0 siblings, 1 reply; 6+ messages in thread
From: Bruce Richardson @ 2019-09-02 11:22 UTC (permalink / raw)
  To: Suraj R Gupta; +Cc: users, dev

On Mon, Sep 02, 2019 at 11:02:16AM +0530, Suraj R Gupta wrote:
> Hi all,
> I am working with DPDK timers.
> In the documentation of timers, it has been said that dpdk based rte-timers
> cannot stopped while running. I would like to know if there is any way to
> stop it in middle or any workaround is possible.
> 
> For e.g.: If I have timer started for 500 ms and  i want to stop it in 100
> ms due to an event/interrupt.
> 
> Note:I am not talking of stopping timer after callback execution, before
> timer expiry in middle
> Thanks in advance.
>
I think rte_timer_stop() is what you are looking for.

/Bruce 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-users] [dpdk-dev] Stopping DPDK Timer [RTE-Timers]
  2019-09-02 11:22 ` [dpdk-users] [dpdk-dev] Stopping DPDK Timer [RTE-Timers] Bruce Richardson
@ 2019-09-02 11:42   ` Suraj R Gupta
  2019-09-02 15:14     ` Bruce Richardson
  0 siblings, 1 reply; 6+ messages in thread
From: Suraj R Gupta @ 2019-09-02 11:42 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: users, dev

Hi,
If I am right, rte_timer_stop() stops the timer after the call back
execution.
It is said that if rte_timer_stop() is called during timer running,
function will fail.

I want to know if timer can be stopped in middle abruptly? i.e  If I have
timer started for 500 ms and  i want to stop it in 100ms

Thanks

On Mon, Sep 2, 2019 at 4:52 PM Bruce Richardson <bruce.richardson@intel.com>
wrote:

> On Mon, Sep 02, 2019 at 11:02:16AM +0530, Suraj R Gupta wrote:
> > Hi all,
> > I am working with DPDK timers.
> > In the documentation of timers, it has been said that dpdk based
> rte-timers
> > cannot stopped while running. I would like to know if there is any way to
> > stop it in middle or any workaround is possible.
> >
> > For e.g.: If I have timer started for 500 ms and  i want to stop it in
> 100
> > ms due to an event/interrupt.
> >
> > Note:I am not talking of stopping timer after callback execution, before
> > timer expiry in middle
> > Thanks in advance.
> >
> I think rte_timer_stop() is what you are looking for.
>
> /Bruce
>


-- 
Thanks and Regards
Suraj R Gupta

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-users] [dpdk-dev] Stopping DPDK Timer [RTE-Timers]
  2019-09-02 11:42   ` Suraj R Gupta
@ 2019-09-02 15:14     ` Bruce Richardson
  2019-09-03  4:51       ` Suraj R Gupta
  0 siblings, 1 reply; 6+ messages in thread
From: Bruce Richardson @ 2019-09-02 15:14 UTC (permalink / raw)
  To: Suraj R Gupta; +Cc: users, dev

On Mon, Sep 02, 2019 at 05:12:36PM +0530, Suraj R Gupta wrote:
>    Hi,
>    If I am right, rte_timer_stop() stops the timer after the call back
>    execution.
>    It is said that if rte_timer_stop() is called during timer running,
>    function will fail.
>    I want to know if timer can be stopped in middle abruptly? i.e  If I
>    have timer started for 500 ms and  i want to stop it in 100ms
>    Thanks
> 

IIRC when a timer has been configured but the time has not yet expired
it is in the PENDING state, where is can be safely stopped. I believe the
running state is for timers which have expired and are about to have their
callbacks processed, or are currently having their callbacks processed on
another core. Therefore, in the normal case, using stop will do what
you want. If this is not the case, it seems like something we should fix.

Regards,
/Bruce

>    On Mon, Sep 2, 2019 at 4:52 PM Bruce Richardson
>    <[1]bruce.richardson@intel.com> wrote:
> 
>      On Mon, Sep 02, 2019 at 11:02:16AM +0530, Suraj R Gupta wrote:
>      > Hi all,
>      > I am working with DPDK timers.
>      > In the documentation of timers, it has been said that dpdk based
>      rte-timers
>      > cannot stopped while running. I would like to know if there is any
>      way to
>      > stop it in middle or any workaround is possible.
>      >
>      > For e.g.: If I have timer started for 500 ms and  i want to stop
>      it in 100
>      > ms due to an event/interrupt.
>      >
>      > Note:I am not talking of stopping timer after callback execution,
>      before
>      > timer expiry in middle
>      > Thanks in advance.
>      >
>      I think rte_timer_stop() is what you are looking for.
>      /Bruce
> 
>    --
> 
>    Thanks and Regards
>    Suraj R Gupta
> 
> References
> 
>    1. mailto:bruce.richardson@intel.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-users] [dpdk-dev] Stopping DPDK Timer [RTE-Timers]
  2019-09-02 15:14     ` Bruce Richardson
@ 2019-09-03  4:51       ` Suraj R Gupta
  2019-09-03  6:04         ` Stephen Hemminger
  0 siblings, 1 reply; 6+ messages in thread
From: Suraj R Gupta @ 2019-09-03  4:51 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: users, dev

These are the links to Timers documentation.
https://doc.dpdk.org/api/rte__timer_8h.html
https://doc.dpdk.org/guides/prog_guide/timer_lib.html

 As per my understanding of the documentation,
PENDING means timer is scheduled to run but not started.(in a list)
RUNNING means timer is presently running.
STOPPED means timer has stopped and callback processed.

rte_timer_stop() can be used from callbacks for stopping the timer even in
case of periodical(multishot timers)
my use case is for a single shot , where i have to stop the timer in middle.


On Mon, Sep 2, 2019 at 8:44 PM Bruce Richardson <bruce.richardson@intel.com>
wrote:

> On Mon, Sep 02, 2019 at 05:12:36PM +0530, Suraj R Gupta wrote:
> >    Hi,
> >    If I am right, rte_timer_stop() stops the timer after the call back
> >    execution.
> >    It is said that if rte_timer_stop() is called during timer running,
> >    function will fail.
> >    I want to know if timer can be stopped in middle abruptly? i.e  If I
> >    have timer started for 500 ms and  i want to stop it in 100ms
> >    Thanks
> >
>
> IIRC when a timer has been configured but the time has not yet expired
> it is in the PENDING state, where is can be safely stopped. I believe the
> running state is for timers which have expired and are about to have their
> callbacks processed, or are currently having their callbacks processed on
> another core. Therefore, in the normal case, using stop will do what
> you want. If this is not the case, it seems like something we should fix.
>
> Regards,
> /Bruce
>
> >    On Mon, Sep 2, 2019 at 4:52 PM Bruce Richardson
> >    <[1]bruce.richardson@intel.com> wrote:
> >
> >      On Mon, Sep 02, 2019 at 11:02:16AM +0530, Suraj R Gupta wrote:
> >      > Hi all,
> >      > I am working with DPDK timers.
> >      > In the documentation of timers, it has been said that dpdk based
> >      rte-timers
> >      > cannot stopped while running. I would like to know if there is any
> >      way to
> >      > stop it in middle or any workaround is possible.
> >      >
> >      > For e.g.: If I have timer started for 500 ms and  i want to stop
> >      it in 100
> >      > ms due to an event/interrupt.
> >      >
> >      > Note:I am not talking of stopping timer after callback execution,
> >      before
> >      > timer expiry in middle
> >      > Thanks in advance.
> >      >
> >      I think rte_timer_stop() is what you are looking for.
> >      /Bruce
> >
> >    --
> >
> >    Thanks and Regards
> >    Suraj R Gupta
> >
> > References
> >
> >    1. mailto:bruce.richardson@intel.com
>


-- 
Thanks and Regards
Suraj R Gupta

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-users] [dpdk-dev] Stopping DPDK Timer [RTE-Timers]
  2019-09-03  4:51       ` Suraj R Gupta
@ 2019-09-03  6:04         ` Stephen Hemminger
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2019-09-03  6:04 UTC (permalink / raw)
  To: Suraj R Gupta; +Cc: Bruce Richardson, users, dev

On Tue, 3 Sep 2019 10:21:17 +0530
Suraj R Gupta <surajrgupta@iith.ac.in> wrote:

> These are the links to Timers documentation.
> https://doc.dpdk.org/api/rte__timer_8h.html
> https://doc.dpdk.org/guides/prog_guide/timer_lib.html
> 
>  As per my understanding of the documentation,
> PENDING means timer is scheduled to run but not started.(in a list)
> RUNNING means timer is presently running.
> STOPPED means timer has stopped and callback processed.
> 
> rte_timer_stop() can be used from callbacks for stopping the timer even in
> case of periodical(multishot timers)
> my use case is for a single shot , where i have to stop the timer in middle.
> 

rte_timer_manage is what that drives running timers.
You can't stop a timer in the middle through DPDK.
But you could set a flag on one cpu and test that in what ever long
running loop you have in a the timer.

Having a long running loop, kind of defeats the purpose of rte_timers
which are meant for short running callbacks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-02  5:32 [dpdk-users] Stopping DPDK Timer [dpdk-dev] [RTE-Timers] Suraj R Gupta
2019-09-02 11:22 ` [dpdk-users] [dpdk-dev] Stopping DPDK Timer [RTE-Timers] Bruce Richardson
2019-09-02 11:42   ` Suraj R Gupta
2019-09-02 15:14     ` Bruce Richardson
2019-09-03  4:51       ` Suraj R Gupta
2019-09-03  6:04         ` Stephen Hemminger

DPDK usage discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/users/0 users/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 users users/ http://inbox.dpdk.org/users \
		users@dpdk.org
	public-inbox-index users


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.users


AGPL code for this site: git clone https://public-inbox.org/ public-inbox