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

Function mlx5_dev_hw_global_prepare

dpdk/drivers/common/mlx5/mlx5_common.c:692–726  ·  view source on GitHub ↗

* Initialize all HW global of device context. * * @param cdev * Pointer to mlx5 device structure. * @param classes * Chosen classes come from user device arguments. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */

Source from the content-addressed store, hash-verified

690 * 0 on success, a negative errno value otherwise and rte_errno is set.
691 */
692static int
693mlx5_dev_hw_global_prepare(struct mlx5_common_device *cdev, uint32_t classes)
694{
695 int ret;
696
697 /* Create context device */
698 ret = mlx5_os_open_device(cdev, classes);
699 if (ret < 0)
700 return ret;
701 /*
702 * When CTX is created by Verbs, query HCA attribute is unsupported.
703 * When CTX is imported, we cannot know if it is created by DevX or
704 * Verbs. So, we use query HCA attribute function to check it.
705 */
706 if (cdev->config.devx || cdev->config.device_fd != MLX5_ARG_UNSET) {
707 /* Query HCA attributes. */
708 ret = mlx5_devx_cmd_query_hca_attr(cdev->ctx,
709 &cdev->config.hca_attr);
710 if (ret) {
711 DRV_LOG(ERR, "Unable to read HCA caps in DevX mode.");
712 rte_errno = ENOTSUP;
713 goto error;
714 }
715 cdev->config.devx = 1;
716 }
717 DRV_LOG(DEBUG, "DevX is %ssupported.", cdev->config.devx ? "" : "NOT ");
718 /* Prepare Protection Domain object and extract its pdn. */
719 ret = mlx5_os_pd_prepare(cdev);
720 if (ret)
721 goto error;
722 return 0;
723error:
724 mlx5_dev_hw_global_release(cdev);
725 return ret;
726}
727
728static void
729mlx5_common_dev_release(struct mlx5_common_device *cdev)

Callers 1

mlx5_common_dev_createFunction · 0.85

Calls 4

mlx5_os_open_deviceFunction · 0.50
mlx5_os_pd_prepareFunction · 0.50

Tested by

no test coverage detected