* Check sibling device configurations when probing again. * * Sibling devices sharing infiniband device context should have compatible * configurations. This regards representors and bonding device. * * @param cdev * Pointer to mlx5 device structure. * @param mkvlist * Pointer to mlx5 kvargs control, can be NULL if there is no devargs. * * @return * 0 on success, a negative errno
| 2927 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 2928 | */ |
| 2929 | int |
| 2930 | mlx5_probe_again_args_validate(struct mlx5_common_device *cdev, |
| 2931 | struct mlx5_kvargs_ctrl *mkvlist) |
| 2932 | { |
| 2933 | struct mlx5_dev_ctx_shared *sh = NULL; |
| 2934 | struct mlx5_sh_config *config; |
| 2935 | int ret; |
| 2936 | |
| 2937 | /* Secondary process should not handle devargs. */ |
| 2938 | if (rte_eal_process_type() != RTE_PROC_PRIMARY) |
| 2939 | return 0; |
| 2940 | pthread_mutex_lock(&mlx5_dev_ctx_list_mutex); |
| 2941 | /* Search for IB context by common device pointer. */ |
| 2942 | LIST_FOREACH(sh, &mlx5_dev_ctx_list, next) |
| 2943 | if (sh->cdev == cdev) |
| 2944 | break; |
| 2945 | pthread_mutex_unlock(&mlx5_dev_ctx_list_mutex); |
| 2946 | /* There is sh for this device -> it isn't probe again. */ |
| 2947 | if (sh == NULL) |
| 2948 | return 0; |
| 2949 | config = mlx5_malloc(MLX5_MEM_ZERO | MLX5_MEM_RTE, |
| 2950 | sizeof(struct mlx5_sh_config), |
| 2951 | RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY); |
| 2952 | if (config == NULL) { |
| 2953 | rte_errno = -ENOMEM; |
| 2954 | return -rte_errno; |
| 2955 | } |
| 2956 | /* |
| 2957 | * Creates a temporary IB context configure structure according to new |
| 2958 | * devargs attached in probing again. |
| 2959 | */ |
| 2960 | ret = mlx5_shared_dev_ctx_args_config(sh, mkvlist, config); |
| 2961 | if (ret) { |
| 2962 | DRV_LOG(ERR, "Failed to process device configure: %s", |
| 2963 | strerror(rte_errno)); |
| 2964 | mlx5_free(config); |
| 2965 | return ret; |
| 2966 | } |
| 2967 | /* |
| 2968 | * Checks the match between the temporary structure and the existing |
| 2969 | * IB context structure. |
| 2970 | */ |
| 2971 | if (sh->config.dv_flow_en ^ config->dv_flow_en) { |
| 2972 | DRV_LOG(ERR, "\"dv_flow_en\" " |
| 2973 | "configuration mismatch for shared %s context.", |
| 2974 | sh->ibdev_name); |
| 2975 | goto error; |
| 2976 | } |
| 2977 | if ((sh->config.dv_xmeta_en ^ config->dv_xmeta_en) || |
| 2978 | (sh->config.dv_miss_info ^ config->dv_miss_info)) { |
| 2979 | DRV_LOG(ERR, "\"dv_xmeta_en\" " |
| 2980 | "configuration mismatch for shared %s context.", |
| 2981 | sh->ibdev_name); |
| 2982 | goto error; |
| 2983 | } |
| 2984 | if (sh->config.dv_esw_en ^ config->dv_esw_en) { |
| 2985 | DRV_LOG(ERR, "\"dv_esw_en\" " |
| 2986 | "configuration mismatch for shared %s context.", |
no test coverage detected