DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] timer: fix reset/stop in callback for new API
@ 2019-04-26 14:41 Erik Gabriel Carrillo
  2019-04-26 14:41 ` Erik Gabriel Carrillo
  2019-05-03 21:05 ` Thomas Monjalon
  0 siblings, 2 replies; 4+ messages in thread
From: Erik Gabriel Carrillo @ 2019-04-26 14:41 UTC (permalink / raw)
  To: rsanford, thomas; +Cc: dev

The rte_timer_alt_manage function should track which is the running
timer and whether or not it was updated by a callback in the priv_timer
structure that corresponds to the running lcore, so that restarting
or stopping the timer from the callback works correctly.

Fixes: c0749f7096c7 ("timer: allow management in shared memory")

Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
---
 lib/librte_timer/rte_timer.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c
index d443b8c..9f2e921 100644
--- a/lib/librte_timer/rte_timer.c
+++ b/lib/librte_timer/rte_timer.c
@@ -830,7 +830,6 @@ rte_timer_alt_manage(uint32_t timer_data_id,
 	union rte_timer_status status;
 	struct rte_timer *tim, *next_tim, **pprev;
 	struct rte_timer *run_first_tims[RTE_MAX_LCORE];
-	unsigned int runlist_lcore_ids[RTE_MAX_LCORE];
 	unsigned int this_lcore = rte_lcore_id();
 	struct rte_timer *prev[MAX_SKIPLIST_DEPTH + 1];
 	uint64_t cur_time;
@@ -899,7 +898,6 @@ rte_timer_alt_manage(uint32_t timer_data_id,
 
 		/* transition run-list from PENDING to RUNNING */
 		run_first_tims[nb_runlists] = tim;
-		runlist_lcore_ids[nb_runlists] = poll_lcore;
 		pprev = &run_first_tims[nb_runlists];
 		nb_runlists++;
 
@@ -946,25 +944,24 @@ rte_timer_alt_manage(uint32_t timer_data_id,
 			break;
 
 		tim = run_first_tims[min_idx];
-		privp = &data->priv_timer[runlist_lcore_ids[min_idx]];
 
 		/* Move down the runlist from which we picked a timer to
 		 * execute
 		 */
 		run_first_tims[min_idx] = run_first_tims[min_idx]->sl_next[0];
 
-		privp->updated = 0;
-		privp->running_tim = tim;
+		data->priv_timer[this_lcore].updated = 0;
+		data->priv_timer[this_lcore].running_tim = tim;
 
 		/* Call the provided callback function */
 		f(tim);
 
-		__TIMER_STAT_ADD(privp, pending, -1);
+		__TIMER_STAT_ADD(data->priv_timer, pending, -1);
 
 		/* the timer was stopped or reloaded by the callback
 		 * function, we have nothing to do here
 		 */
-		if (privp->updated == 1)
+		if (data->priv_timer[this_lcore].updated == 1)
 			continue;
 
 		if (tim->period == 0) {
@@ -989,7 +986,7 @@ rte_timer_alt_manage(uint32_t timer_data_id,
 				&data->priv_timer[this_lcore].list_lock);
 		}
 
-		privp->running_tim = NULL;
+		data->priv_timer[this_lcore].running_tim = NULL;
 	}
 
 	return 0;
-- 
2.6.4

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

* [dpdk-dev] [PATCH] timer: fix reset/stop in callback for new API
  2019-04-26 14:41 [dpdk-dev] [PATCH] timer: fix reset/stop in callback for new API Erik Gabriel Carrillo
@ 2019-04-26 14:41 ` Erik Gabriel Carrillo
  2019-05-03 21:05 ` Thomas Monjalon
  1 sibling, 0 replies; 4+ messages in thread
From: Erik Gabriel Carrillo @ 2019-04-26 14:41 UTC (permalink / raw)
  To: rsanford, thomas; +Cc: dev

The rte_timer_alt_manage function should track which is the running
timer and whether or not it was updated by a callback in the priv_timer
structure that corresponds to the running lcore, so that restarting
or stopping the timer from the callback works correctly.

Fixes: c0749f7096c7 ("timer: allow management in shared memory")

Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
---
 lib/librte_timer/rte_timer.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c
index d443b8c..9f2e921 100644
--- a/lib/librte_timer/rte_timer.c
+++ b/lib/librte_timer/rte_timer.c
@@ -830,7 +830,6 @@ rte_timer_alt_manage(uint32_t timer_data_id,
 	union rte_timer_status status;
 	struct rte_timer *tim, *next_tim, **pprev;
 	struct rte_timer *run_first_tims[RTE_MAX_LCORE];
-	unsigned int runlist_lcore_ids[RTE_MAX_LCORE];
 	unsigned int this_lcore = rte_lcore_id();
 	struct rte_timer *prev[MAX_SKIPLIST_DEPTH + 1];
 	uint64_t cur_time;
@@ -899,7 +898,6 @@ rte_timer_alt_manage(uint32_t timer_data_id,
 
 		/* transition run-list from PENDING to RUNNING */
 		run_first_tims[nb_runlists] = tim;
-		runlist_lcore_ids[nb_runlists] = poll_lcore;
 		pprev = &run_first_tims[nb_runlists];
 		nb_runlists++;
 
@@ -946,25 +944,24 @@ rte_timer_alt_manage(uint32_t timer_data_id,
 			break;
 
 		tim = run_first_tims[min_idx];
-		privp = &data->priv_timer[runlist_lcore_ids[min_idx]];
 
 		/* Move down the runlist from which we picked a timer to
 		 * execute
 		 */
 		run_first_tims[min_idx] = run_first_tims[min_idx]->sl_next[0];
 
-		privp->updated = 0;
-		privp->running_tim = tim;
+		data->priv_timer[this_lcore].updated = 0;
+		data->priv_timer[this_lcore].running_tim = tim;
 
 		/* Call the provided callback function */
 		f(tim);
 
-		__TIMER_STAT_ADD(privp, pending, -1);
+		__TIMER_STAT_ADD(data->priv_timer, pending, -1);
 
 		/* the timer was stopped or reloaded by the callback
 		 * function, we have nothing to do here
 		 */
-		if (privp->updated == 1)
+		if (data->priv_timer[this_lcore].updated == 1)
 			continue;
 
 		if (tim->period == 0) {
@@ -989,7 +986,7 @@ rte_timer_alt_manage(uint32_t timer_data_id,
 				&data->priv_timer[this_lcore].list_lock);
 		}
 
-		privp->running_tim = NULL;
+		data->priv_timer[this_lcore].running_tim = NULL;
 	}
 
 	return 0;
-- 
2.6.4


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

* Re: [dpdk-dev] [PATCH] timer: fix reset/stop in callback for new API
  2019-04-26 14:41 [dpdk-dev] [PATCH] timer: fix reset/stop in callback for new API Erik Gabriel Carrillo
  2019-04-26 14:41 ` Erik Gabriel Carrillo
@ 2019-05-03 21:05 ` Thomas Monjalon
  2019-05-03 21:05   ` Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2019-05-03 21:05 UTC (permalink / raw)
  To: Erik Gabriel Carrillo; +Cc: dev, rsanford

26/04/2019 16:41, Erik Gabriel Carrillo:
> The rte_timer_alt_manage function should track which is the running
> timer and whether or not it was updated by a callback in the priv_timer
> structure that corresponds to the running lcore, so that restarting
> or stopping the timer from the callback works correctly.
> 
> Fixes: c0749f7096c7 ("timer: allow management in shared memory")
> 
> Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>

Applied, thanks

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

* Re: [dpdk-dev] [PATCH] timer: fix reset/stop in callback for new API
  2019-05-03 21:05 ` Thomas Monjalon
@ 2019-05-03 21:05   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2019-05-03 21:05 UTC (permalink / raw)
  To: Erik Gabriel Carrillo; +Cc: dev, rsanford

26/04/2019 16:41, Erik Gabriel Carrillo:
> The rte_timer_alt_manage function should track which is the running
> timer and whether or not it was updated by a callback in the priv_timer
> structure that corresponds to the running lcore, so that restarting
> or stopping the timer from the callback works correctly.
> 
> Fixes: c0749f7096c7 ("timer: allow management in shared memory")
> 
> Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>

Applied, thanks




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

end of thread, other threads:[~2019-05-03 21:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-26 14:41 [dpdk-dev] [PATCH] timer: fix reset/stop in callback for new API Erik Gabriel Carrillo
2019-04-26 14:41 ` Erik Gabriel Carrillo
2019-05-03 21:05 ` Thomas Monjalon
2019-05-03 21:05   ` Thomas Monjalon

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).