* Parse common device parameters. * * @param devargs * Device arguments structure. * @param config * Pointer to device configuration structure. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */
| 311 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 312 | */ |
| 313 | static int |
| 314 | mlx5_common_config_get(struct mlx5_kvargs_ctrl *mkvlist, |
| 315 | struct mlx5_common_dev_config *config) |
| 316 | { |
| 317 | const char **params = (const char *[]){ |
| 318 | RTE_DEVARGS_KEY_CLASS, |
| 319 | MLX5_DRIVER_KEY, |
| 320 | MLX5_TX_DB_NC, |
| 321 | MLX5_SQ_DB_NC, |
| 322 | MLX5_MR_EXT_MEMSEG_EN, |
| 323 | MLX5_SYS_MEM_EN, |
| 324 | MLX5_MR_MEMPOOL_REG_EN, |
| 325 | MLX5_DEVICE_FD, |
| 326 | MLX5_PD_HANDLE, |
| 327 | NULL, |
| 328 | }; |
| 329 | int ret = 0; |
| 330 | |
| 331 | /* Set defaults. */ |
| 332 | config->mr_ext_memseg_en = 1; |
| 333 | config->mr_mempool_reg_en = 1; |
| 334 | config->sys_mem_en = 0; |
| 335 | config->dbnc = MLX5_ARG_UNSET; |
| 336 | config->device_fd = MLX5_ARG_UNSET; |
| 337 | config->pd_handle = MLX5_ARG_UNSET; |
| 338 | if (mkvlist == NULL) |
| 339 | return 0; |
| 340 | /* Process common parameters. */ |
| 341 | ret = mlx5_kvargs_process(mkvlist, params, |
| 342 | mlx5_common_args_check_handler, config); |
| 343 | if (ret) { |
| 344 | rte_errno = EINVAL; |
| 345 | return -rte_errno; |
| 346 | } |
| 347 | /* Validate user arguments for remote PD and CTX if it is given. */ |
| 348 | ret = mlx5_os_remote_pd_and_ctx_validate(config); |
| 349 | if (ret) |
| 350 | return ret; |
| 351 | DRV_LOG(DEBUG, "mr_ext_memseg_en is %u.", config->mr_ext_memseg_en); |
| 352 | DRV_LOG(DEBUG, "mr_mempool_reg_en is %u.", config->mr_mempool_reg_en); |
| 353 | DRV_LOG(DEBUG, "sys_mem_en is %u.", config->sys_mem_en); |
| 354 | DRV_LOG(DEBUG, "Send Queue doorbell mapping parameter is %d.", |
| 355 | config->dbnc); |
| 356 | return ret; |
| 357 | } |
| 358 | |
| 359 | static int |
| 360 | devargs_class_handler(__rte_unused const char *key, |
no test coverage detected