| 282 | } |
| 283 | |
| 284 | static int |
| 285 | mlx5_crypto_parse_devargs(struct mlx5_kvargs_ctrl *mkvlist, |
| 286 | struct mlx5_crypto_devarg_params *devarg_prms, |
| 287 | bool wrapped_mode) |
| 288 | { |
| 289 | struct mlx5_devx_crypto_login_attr *attr = &devarg_prms->login_attr; |
| 290 | const char **params = (const char *[]){ |
| 291 | "credential_id", |
| 292 | "import_kek_id", |
| 293 | "keytag", |
| 294 | "max_segs_num", |
| 295 | "wcs_file", |
| 296 | "algo", |
| 297 | NULL, |
| 298 | }; |
| 299 | |
| 300 | /* Default values. */ |
| 301 | attr->credential_pointer = 0; |
| 302 | attr->session_import_kek_ptr = 0; |
| 303 | devarg_prms->keytag = 0; |
| 304 | devarg_prms->max_segs_num = 8; |
| 305 | if (mkvlist == NULL) { |
| 306 | if (!wrapped_mode) |
| 307 | return 0; |
| 308 | DRV_LOG(ERR, |
| 309 | "No login devargs in order to enable crypto operations in the device."); |
| 310 | rte_errno = EINVAL; |
| 311 | return -1; |
| 312 | } |
| 313 | if (mlx5_kvargs_process(mkvlist, params, mlx5_crypto_args_check_handler, |
| 314 | devarg_prms) != 0) { |
| 315 | DRV_LOG(ERR, "Devargs handler function Failed."); |
| 316 | rte_errno = EINVAL; |
| 317 | return -1; |
| 318 | } |
| 319 | if (devarg_prms->login_devarg == false && wrapped_mode) { |
| 320 | DRV_LOG(ERR, |
| 321 | "No login credential devarg in order to enable crypto operations in the device while in wrapped import method."); |
| 322 | rte_errno = EINVAL; |
| 323 | return -1; |
| 324 | } |
| 325 | return 0; |
| 326 | } |
| 327 | |
| 328 | static int |
| 329 | mlx5_crypto_dev_probe(struct mlx5_common_device *cdev, |
no test coverage detected