MCPcopy Create free account
hub / github.com/F-Stack/f-stack / timvf_ring_create

Function timvf_ring_create

dpdk/drivers/event/octeontx/timvf_evdev.c:225–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225static int
226timvf_ring_create(struct rte_event_timer_adapter *adptr)
227{
228 struct rte_event_timer_adapter_conf *rcfg = &adptr->data->conf;
229 uint16_t free_idx = UINT16_MAX;
230 unsigned int mp_flags = 0;
231 struct ssovf_evdev *edev;
232 struct timvf_ring *timr;
233 const char *mempool_ops;
234 uint8_t tim_ring_id;
235 char pool_name[25];
236 int i, ret;
237
238 tim_ring_id = timvf_get_ring();
239 if (tim_ring_id == UINT8_MAX)
240 return -ENODEV;
241
242 edev = ssovf_pmd_priv(event_dev);
243 timr = rte_zmalloc("octeontx_timvf_priv",
244 sizeof(struct timvf_ring), 0);
245 if (timr == NULL)
246 return -ENOMEM;
247
248 adptr->data->adapter_priv = timr;
249 /* Check config parameters. */
250 if ((rcfg->clk_src != RTE_EVENT_TIMER_ADAPTER_CPU_CLK) &&
251 (!rcfg->timer_tick_ns ||
252 rcfg->timer_tick_ns < TIM_MIN_INTERVAL)) {
253 timvf_log_err("Too low timer ticks");
254 goto cfg_err;
255 }
256
257 timr->clk_src = (int) rcfg->clk_src;
258 timr->tim_ring_id = tim_ring_id;
259 timr->tck_nsec = RTE_ALIGN_MUL_CEIL(rcfg->timer_tick_ns, 10);
260 timr->max_tout = rcfg->max_tmo_ns;
261 timr->nb_bkts = (timr->max_tout / timr->tck_nsec);
262 timr->vbar0 = timvf_bar(timr->tim_ring_id, 0);
263 timr->bkt_pos = (uint8_t *)timr->vbar0 + TIM_VRING_REL;
264 timr->nb_timers = rcfg->nb_timers;
265 timr->get_target_bkt = bkt_mod;
266
267 if (edev->available_events < timr->nb_timers) {
268 timvf_log_err(
269 "Max available events %"PRIu32" requested timer events %"PRIu64"",
270 edev->available_events, timr->nb_timers);
271 return -ENOMEM;
272 }
273
274 for (i = 0; i < edev->tim_ring_cnt; i++) {
275 if (edev->tim_ring_ids[i] == UINT16_MAX)
276 free_idx = i;
277 }
278
279 if (free_idx == UINT16_MAX) {
280 void *old_ptr;
281
282 edev->tim_ring_cnt++;

Callers

nothing calls this directly

Calls 14

timvf_get_ringFunction · 0.85
ssovf_pmd_privFunction · 0.85
rte_zmallocFunction · 0.85
timvf_barFunction · 0.85
rte_reallocFunction · 0.85
snprintfFunction · 0.85
rte_mempool_create_emptyFunction · 0.85
rte_socket_idFunction · 0.85
rte_freeFunction · 0.85

Tested by

no test coverage detected