* Parse user port parameters and adjust them according to device capabilities. * * @param priv * Pointer to shared device context. * @param mkvlist * Pointer to mlx5 kvargs control, can be NULL if there is no devargs. * @param config * Pointer to port configuration structure. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */
| 2673 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 2674 | */ |
| 2675 | int |
| 2676 | mlx5_port_args_config(struct mlx5_priv *priv, struct mlx5_kvargs_ctrl *mkvlist, |
| 2677 | struct mlx5_port_config *config) |
| 2678 | { |
| 2679 | struct mlx5_hca_attr *hca_attr = &priv->sh->cdev->config.hca_attr; |
| 2680 | struct mlx5_dev_cap *dev_cap = &priv->sh->dev_cap; |
| 2681 | bool devx = priv->sh->cdev->config.devx; |
| 2682 | const char **params = (const char *[]){ |
| 2683 | MLX5_RXQ_CQE_COMP_EN, |
| 2684 | MLX5_RXQ_PKT_PAD_EN, |
| 2685 | MLX5_RX_MPRQ_EN, |
| 2686 | MLX5_RX_MPRQ_LOG_STRIDE_NUM, |
| 2687 | MLX5_RX_MPRQ_LOG_STRIDE_SIZE, |
| 2688 | MLX5_RX_MPRQ_MAX_MEMCPY_LEN, |
| 2689 | MLX5_RXQS_MIN_MPRQ, |
| 2690 | MLX5_TXQ_INLINE, |
| 2691 | MLX5_TXQ_INLINE_MIN, |
| 2692 | MLX5_TXQ_INLINE_MAX, |
| 2693 | MLX5_TXQ_INLINE_MPW, |
| 2694 | MLX5_TXQS_MIN_INLINE, |
| 2695 | MLX5_TXQS_MAX_VEC, |
| 2696 | MLX5_TXQ_MPW_EN, |
| 2697 | MLX5_TXQ_MPW_HDR_DSEG_EN, |
| 2698 | MLX5_TXQ_MAX_INLINE_LEN, |
| 2699 | MLX5_TX_VEC_EN, |
| 2700 | MLX5_RX_VEC_EN, |
| 2701 | MLX5_REPRESENTOR, |
| 2702 | MLX5_MAX_DUMP_FILES_NUM, |
| 2703 | MLX5_LRO_TIMEOUT_USEC, |
| 2704 | MLX5_HP_BUF_SIZE, |
| 2705 | MLX5_DELAY_DROP, |
| 2706 | NULL, |
| 2707 | }; |
| 2708 | int ret = 0; |
| 2709 | |
| 2710 | /* Default configuration. */ |
| 2711 | memset(config, 0, sizeof(*config)); |
| 2712 | config->mps = MLX5_ARG_UNSET; |
| 2713 | config->cqe_comp = 1; |
| 2714 | config->rx_vec_en = 1; |
| 2715 | config->txq_inline_max = MLX5_ARG_UNSET; |
| 2716 | config->txq_inline_min = MLX5_ARG_UNSET; |
| 2717 | config->txq_inline_mpw = MLX5_ARG_UNSET; |
| 2718 | config->txqs_inline = MLX5_ARG_UNSET; |
| 2719 | config->mprq.max_memcpy_len = MLX5_MPRQ_MEMCPY_DEFAULT_LEN; |
| 2720 | config->mprq.min_rxqs_num = MLX5_MPRQ_MIN_RXQS; |
| 2721 | config->mprq.log_stride_num = MLX5_MPRQ_DEFAULT_LOG_STRIDE_NUM; |
| 2722 | config->mprq.log_stride_size = MLX5_ARG_UNSET; |
| 2723 | config->log_hp_size = MLX5_ARG_UNSET; |
| 2724 | config->std_delay_drop = 0; |
| 2725 | config->hp_delay_drop = 0; |
| 2726 | if (mkvlist != NULL) { |
| 2727 | /* Process parameters. */ |
| 2728 | ret = mlx5_kvargs_process(mkvlist, params, |
| 2729 | mlx5_port_args_check_handler, config); |
| 2730 | if (ret) { |
| 2731 | DRV_LOG(ERR, "Failed to process port arguments: %s", |
| 2732 | strerror(rte_errno)); |
no test coverage detected