* Parse user device parameters and adjust them according to device * capabilities. * * @param sh * Pointer to shared device context. * @param mkvlist * Pointer to mlx5 kvargs control, can be NULL if there is no devargs. * @param config * Pointer to shared device configuration structure. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */
| 1463 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 1464 | */ |
| 1465 | static int |
| 1466 | mlx5_shared_dev_ctx_args_config(struct mlx5_dev_ctx_shared *sh, |
| 1467 | struct mlx5_kvargs_ctrl *mkvlist, |
| 1468 | struct mlx5_sh_config *config) |
| 1469 | { |
| 1470 | const char **params = (const char *[]){ |
| 1471 | MLX5_TX_PP, |
| 1472 | MLX5_TX_SKEW, |
| 1473 | MLX5_L3_VXLAN_EN, |
| 1474 | MLX5_VF_NL_EN, |
| 1475 | MLX5_DV_ESW_EN, |
| 1476 | MLX5_DV_FLOW_EN, |
| 1477 | MLX5_DV_XMETA_EN, |
| 1478 | MLX5_LACP_BY_USER, |
| 1479 | MLX5_RECLAIM_MEM, |
| 1480 | MLX5_DECAP_EN, |
| 1481 | MLX5_ALLOW_DUPLICATE_PATTERN, |
| 1482 | MLX5_FDB_DEFAULT_RULE_EN, |
| 1483 | MLX5_HWS_CNT_SERVICE_CORE, |
| 1484 | MLX5_HWS_CNT_CYCLE_TIME, |
| 1485 | MLX5_REPR_MATCHING_EN, |
| 1486 | NULL, |
| 1487 | }; |
| 1488 | int ret = 0; |
| 1489 | |
| 1490 | /* Default configuration. */ |
| 1491 | memset(config, 0, sizeof(*config)); |
| 1492 | config->vf_nl_en = 1; |
| 1493 | config->dv_esw_en = 1; |
| 1494 | config->dv_flow_en = 1; |
| 1495 | config->decap_en = 1; |
| 1496 | config->allow_duplicate_pattern = 1; |
| 1497 | config->fdb_def_rule = 1; |
| 1498 | config->cnt_svc.cycle_time = MLX5_CNT_SVC_CYCLE_TIME_DEFAULT; |
| 1499 | config->cnt_svc.service_core = rte_get_main_lcore(); |
| 1500 | config->repr_matching = 1; |
| 1501 | if (mkvlist != NULL) { |
| 1502 | /* Process parameters. */ |
| 1503 | ret = mlx5_kvargs_process(mkvlist, params, |
| 1504 | mlx5_dev_args_check_handler, config); |
| 1505 | if (ret) { |
| 1506 | DRV_LOG(ERR, "Failed to process device arguments: %s", |
| 1507 | strerror(rte_errno)); |
| 1508 | return -rte_errno; |
| 1509 | } |
| 1510 | } |
| 1511 | /* Adjust parameters according to device capabilities. */ |
| 1512 | if (config->dv_flow_en && !sh->dev_cap.dv_flow_en) { |
| 1513 | DRV_LOG(WARNING, "DV flow is not supported."); |
| 1514 | config->dv_flow_en = 0; |
| 1515 | } |
| 1516 | if (config->dv_esw_en && !sh->dev_cap.dv_esw_en) { |
| 1517 | DRV_LOG(DEBUG, "E-Switch DV flow is not supported."); |
| 1518 | config->dv_esw_en = 0; |
| 1519 | } |
| 1520 | if (config->dv_esw_en && !config->dv_flow_en) { |
| 1521 | DRV_LOG(DEBUG, |
| 1522 | "E-Switch DV flow is supported only when DV flow is enabled."); |
no test coverage detected