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

Function mlx5_shared_dev_ctx_args_config

dpdk/drivers/net/mlx5/mlx5.c:1465–1585  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

1463 * 0 on success, a negative errno value otherwise and rte_errno is set.
1464 */
1465static int
1466mlx5_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.");

Callers 2

Calls 4

memsetFunction · 0.85
rte_get_main_lcoreFunction · 0.85
mlx5_kvargs_processFunction · 0.85
mlx5_devx_obj_ops_enFunction · 0.85

Tested by

no test coverage detected