Add support for the RTE_EVENT_TIMER_ADAPTER_F_SP_PUT flag, which indicates
that the API should be used in single-producer put mode.

Signed-off-by: Erik Gabriel Carrillo <erik.g.carri...@intel.com>
---
 lib/librte_eventdev/rte_event_timer_adapter.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eventdev/rte_event_timer_adapter.c 
b/lib/librte_eventdev/rte_event_timer_adapter.c
index ebc6124..0af68b2 100644
--- a/lib/librte_eventdev/rte_event_timer_adapter.c
+++ b/lib/librte_eventdev/rte_event_timer_adapter.c
@@ -798,6 +798,7 @@ sw_event_timer_adapter_init(struct rte_event_timer_adapter 
*adapter)
        int ret;
        struct rte_event_timer_adapter_sw_data *sw_data;
        uint64_t nb_timers;
+       unsigned int flags;
        struct rte_service_spec service;
        static bool timer_subsystem_inited; // static initialized to false
 
@@ -823,8 +824,11 @@ sw_event_timer_adapter_init(struct rte_event_timer_adapter 
*adapter)
        char msg_ring_name[RTE_RING_NAMESIZE];
        snprintf(msg_ring_name, RTE_RING_NAMESIZE,
                 "sw_evtim_adap_msg_ring_%"PRIu8, adapter->data->id);
+       flags = adapter->data->conf.flags & RTE_EVENT_TIMER_ADAPTER_F_SP_PUT ?
+               RING_F_SP_ENQ | RING_F_SC_DEQ :
+               RING_F_SC_DEQ;
        sw_data->msg_ring = rte_ring_create(msg_ring_name, nb_timers,
-                                           adapter->data->socket_id, 0);
+                                           adapter->data->socket_id, flags);
        if (sw_data->msg_ring == NULL) {
                rte_errno = ENOMEM;
                return -1;
@@ -833,10 +837,13 @@ sw_event_timer_adapter_init(struct 
rte_event_timer_adapter *adapter)
        char pool_name[RTE_RING_NAMESIZE];
        snprintf(pool_name, RTE_RING_NAMESIZE, "sw_evtim_adap_msg_pool_%"PRIu8,
                 adapter->data->id);
+       flags = (adapter->data->conf.flags & RTE_EVENT_TIMER_ADAPTER_F_SP_PUT) ?
+                MEMPOOL_F_SP_PUT | MEMPOOL_F_SC_GET :
+                MEMPOOL_F_SC_GET;
        sw_data->msg_pool = rte_mempool_create(pool_name, nb_timers,
                                               sizeof(struct msg), 32, 0, NULL,
                                               NULL, NULL, NULL,
-                                              adapter->data->socket_id, 0);
+                                              adapter->data->socket_id, flags);
        if (sw_data->msg_pool == NULL) {
                rte_errno = ENOMEM;
                return -1;
@@ -847,7 +854,7 @@ sw_event_timer_adapter_init(struct rte_event_timer_adapter 
*adapter)
        sw_data->tim_pool = rte_mempool_create(pool_name, nb_timers,
                                               sizeof(struct rte_timer), 32, 0,
                                               NULL, NULL, NULL, NULL,
-                                              adapter->data->socket_id, 0);
+                                              adapter->data->socket_id, flags);
        if (sw_data->tim_pool == NULL) {
                printf("Could not allocate tim mempool\n");
                return -1;
-- 
2.6.4

Reply via email to