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

Function mlx5_os_pd_prepare

dpdk/drivers/common/mlx5/linux/mlx5_common_os.c:519–556  ·  view source on GitHub ↗

* Prepare Protection Domain object and extract its pdn using DV API. * * @param[out] cdev * Pointer to the mlx5 device. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */

Source from the content-addressed store, hash-verified

517 * 0 on success, a negative errno value otherwise and rte_errno is set.
518 */
519int
520mlx5_os_pd_prepare(struct mlx5_common_device *cdev)
521{
522#ifdef HAVE_IBV_FLOW_DV_SUPPORT
523 struct mlx5dv_obj obj;
524 struct mlx5dv_pd pd_info;
525#endif
526 int ret;
527
528 if (cdev->config.pd_handle == MLX5_ARG_UNSET)
529 ret = mlx5_os_pd_create(cdev);
530 else
531 ret = mlx5_os_pd_import(cdev);
532 if (ret) {
533 rte_errno = -ret;
534 return ret;
535 }
536 if (cdev->config.devx == 0)
537 return 0;
538#ifdef HAVE_IBV_FLOW_DV_SUPPORT
539 obj.pd.in = cdev->pd;
540 obj.pd.out = &pd_info;
541 ret = mlx5_glue->dv_init_obj(&obj, MLX5DV_OBJ_PD);
542 if (ret != 0) {
543 DRV_LOG(ERR, "Fail to get PD object info.");
544 rte_errno = errno;
545 claim_zero(mlx5_os_pd_release(cdev));
546 cdev->pd = NULL;
547 return -rte_errno;
548 }
549 cdev->pdn = pd_info.pdn;
550 return 0;
551#else
552 DRV_LOG(ERR, "Cannot get pdn - no DV support.");
553 rte_errno = ENOTSUP;
554 return -rte_errno;
555#endif /* HAVE_IBV_FLOW_DV_SUPPORT */
556}
557
558static struct ibv_device *
559mlx5_os_get_ibv_device(const struct rte_pci_device *pci_dev)

Callers 1

Calls 3

mlx5_os_pd_createFunction · 0.85
mlx5_os_pd_importFunction · 0.85
mlx5_os_pd_releaseFunction · 0.70

Tested by

no test coverage detected