* Function API to prepare IB device. * * @param cdev * Pointer to the mlx5 device. * @param classes * Chosen classes come from device arguments. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */
| 856 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 857 | */ |
| 858 | int |
| 859 | mlx5_os_open_device(struct mlx5_common_device *cdev, uint32_t classes) |
| 860 | { |
| 861 | |
| 862 | struct ibv_context *ctx = NULL; |
| 863 | |
| 864 | if (cdev->config.device_fd == MLX5_ARG_UNSET) |
| 865 | ctx = mlx5_open_device(cdev, classes); |
| 866 | else |
| 867 | ctx = mlx5_import_device(cdev); |
| 868 | if (ctx == NULL) |
| 869 | return -rte_errno; |
| 870 | /* Hint libmlx5 to use PMD allocator for data plane resources */ |
| 871 | mlx5_set_context_attr(cdev->dev, ctx); |
| 872 | cdev->ctx = ctx; |
| 873 | return 0; |
| 874 | } |
| 875 | |
| 876 | int |
| 877 | mlx5_get_device_guid(const struct rte_pci_addr *dev, uint8_t *guid, size_t len) |
no test coverage detected