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

Function mlx5_txpp_create_clock_queue

dpdk/drivers/net/mlx5/mlx5_txpp.c:384–471  ·  view source on GitHub ↗

Creates the Clock Queue for packet pacing, returns zero on success. */

Source from the content-addressed store, hash-verified

382
383/* Creates the Clock Queue for packet pacing, returns zero on success. */
384static int
385mlx5_txpp_create_clock_queue(struct mlx5_dev_ctx_shared *sh)
386{
387 struct mlx5_devx_create_sq_attr sq_attr = { 0 };
388 struct mlx5_devx_modify_sq_attr msq_attr = { 0 };
389 struct mlx5_devx_cq_attr cq_attr = {
390 .use_first_only = 1,
391 .overrun_ignore = 1,
392 .uar_page_id = mlx5_os_get_devx_uar_page_id(sh->tx_uar.obj),
393 };
394 struct mlx5_txpp_wq *wq = &sh->txpp.clock_queue;
395 int ret;
396
397 sh->txpp.tsa = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO,
398 MLX5_TXPP_REARM_SQ_SIZE *
399 sizeof(struct mlx5_txpp_ts),
400 0, sh->numa_node);
401 if (!sh->txpp.tsa) {
402 DRV_LOG(ERR, "Failed to allocate memory for CQ stats.");
403 return -ENOMEM;
404 }
405 sh->txpp.ts_p = 0;
406 sh->txpp.ts_n = 0;
407 /* Create completion queue object for Clock Queue. */
408 ret = mlx5_devx_cq_create(sh->cdev->ctx, &wq->cq_obj,
409 log2above(MLX5_TXPP_CLKQ_SIZE), &cq_attr,
410 sh->numa_node);
411 if (ret) {
412 DRV_LOG(ERR, "Failed to create CQ for Clock Queue.");
413 goto error;
414 }
415 wq->cq_ci = 0;
416 /* Allocate memory buffer for Send Queue WQEs. */
417 if (sh->txpp.test) {
418 wq->sq_size = RTE_ALIGN(MLX5_TXPP_TEST_PKT_SIZE +
419 MLX5_WQE_CSEG_SIZE +
420 2 * MLX5_WQE_ESEG_SIZE -
421 MLX5_ESEG_MIN_INLINE_SIZE,
422 MLX5_WQE_SIZE) / MLX5_WQE_SIZE;
423 wq->sq_size *= MLX5_TXPP_CLKQ_SIZE;
424 } else {
425 wq->sq_size = MLX5_TXPP_CLKQ_SIZE;
426 }
427 /* There should not be WQE leftovers in the cyclic queue. */
428 MLX5_ASSERT(wq->sq_size == (1 << log2above(wq->sq_size)));
429 /* Create send queue object for Clock Queue. */
430 if (sh->txpp.test) {
431 sq_attr.tis_lst_sz = 1;
432 sq_attr.tis_num = sh->tis[0]->id;
433 sq_attr.non_wire = 0;
434 sq_attr.static_sq_wq = 1;
435 } else {
436 sq_attr.non_wire = 1;
437 sq_attr.static_sq_wq = 1;
438 }
439 sq_attr.cqn = wq->cq_obj.cq->id;
440 sq_attr.packet_pacing_rate_limit_index = sh->txpp.pp_id;
441 sq_attr.wq_attr.cd_slave = 1;

Callers 1

mlx5_txpp_createFunction · 0.85

Calls 9

mlx5_mallocFunction · 0.85
mlx5_devx_cq_createFunction · 0.85
log2aboveFunction · 0.85
mlx5_ts_format_convFunction · 0.85
mlx5_devx_sq_createFunction · 0.85
mlx5_devx_cmd_modify_sqFunction · 0.85

Tested by

no test coverage detected