Creates the Clock Queue for packet pacing, returns zero on success. */
| 382 | |
| 383 | /* Creates the Clock Queue for packet pacing, returns zero on success. */ |
| 384 | static int |
| 385 | mlx5_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; |
no test coverage detected