X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fevent%2Focteontx%2Ftimvf_evdev.c;h=caa129087e59b0e5f923d7c514f31c5da353ed45;hb=8459f5ab32211fb10bbfe388fa0e017475d8507c;hp=b20a2f1f5a1925c913b8199826d6b5a3f2c3ca63;hpb=3e249bc559145eea290d407261a3d814b5906aed;p=dpdk.git diff --git a/drivers/event/octeontx/timvf_evdev.c b/drivers/event/octeontx/timvf_evdev.c index b20a2f1f5a..caa129087e 100644 --- a/drivers/event/octeontx/timvf_evdev.c +++ b/drivers/event/octeontx/timvf_evdev.c @@ -1,5 +1,4 @@ -/* - * SPDX-License-Identifier: BSD-3-Clause +/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2017 Cavium, Inc */ @@ -7,9 +6,7 @@ int otx_logtype_timvf; -RTE_INIT(otx_timvf_init_log); -static void -otx_timvf_init_log(void) +RTE_INIT(otx_timvf_init_log) { otx_logtype_timvf = rte_log_register("pmd.event.octeontx.timer"); if (otx_logtype_timvf >= 0) @@ -175,7 +172,7 @@ timvf_ring_start(const struct rte_event_timer_adapter *adptr) if (use_fpa) { pool = (uintptr_t)((struct rte_mempool *) timr->chunk_pool)->pool_id; - ret = octeontx_fpa_bufpool_gpool(pool); + ret = octeontx_fpa_bufpool_gaura(pool); if (ret < 0) { timvf_log_dbg("Unable to get gaura id"); ret = -ENOMEM; @@ -234,17 +231,15 @@ timvf_ring_create(struct rte_event_timer_adapter *adptr) { char pool_name[25]; int ret; + uint8_t tim_ring_id; uint64_t nb_timers; struct rte_event_timer_adapter_conf *rcfg = &adptr->data->conf; struct timvf_ring *timr; - struct timvf_info tinfo; const char *mempool_ops; unsigned int mp_flags = 0; - if (timvf_info(&tinfo) < 0) - return -ENODEV; - - if (adptr->data->id >= tinfo.total_timvfs) + tim_ring_id = timvf_get_ring(); + if (tim_ring_id == UINT8_MAX) return -ENODEV; timr = rte_zmalloc("octeontx_timvf_priv", @@ -262,7 +257,7 @@ timvf_ring_create(struct rte_event_timer_adapter *adptr) } timr->clk_src = (int) rcfg->clk_src; - timr->tim_ring_id = adptr->data->id; + timr->tim_ring_id = tim_ring_id; timr->tck_nsec = RTE_ALIGN_MUL_CEIL(rcfg->timer_tick_ns, 10); timr->max_tout = rcfg->max_tmo_ns; timr->nb_bkts = (timr->max_tout / timr->tck_nsec); @@ -295,7 +290,8 @@ timvf_ring_create(struct rte_event_timer_adapter *adptr) if (timr->bkt == NULL) goto mem_err; - snprintf(pool_name, 30, "timvf_chunk_pool%d", timr->tim_ring_id); + snprintf(pool_name, sizeof(pool_name), "timvf_chunk_pool%d", + timr->tim_ring_id); timr->chunk_pool = (void *)rte_mempool_create_empty(pool_name, timr->nb_chunks, TIM_CHUNK_SIZE, 0, 0, rte_socket_id(), mp_flags); @@ -339,8 +335,10 @@ static int timvf_ring_free(struct rte_event_timer_adapter *adptr) { struct timvf_ring *timr = adptr->data->adapter_priv; + rte_mempool_free(timr->chunk_pool); rte_free(timr->bkt); + timvf_release_ring(timr->tim_ring_id); rte_free(adptr->data->adapter_priv); return 0; }