---
name: "mlx5dv_open_device"
section: "3"
platform: "linux"
package: "rdma-core"
version: "65.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/mlx5dv_open_device"
---

# mlx5dv\_open\_device(3)

Open an RDMA device context for the mlx5 provider

## NAME

mlx5dv\_open\_device - Open an RDMA device context for the mlx5 provider

## SYNOPSIS

-

  ```
  #include <infiniband/mlx5dv.h>
  struct ibv_context *
  mlx5dv_open_device(struct ibv_device *device, struct mlx5dv_context_attr *attr);
  ```

## DESCRIPTION

Open an RDMA device context with specific mlx5 provider attributes.

## ARGUMENTS

- *device*

  RDMA device to open.

*attr*

### mlx5dv\_context\_attr

-

  ```
  struct mlx5dv_context_attr {
          uint32_t flags;
          uint64_t comp_mask;
          struct ibv_fd_arr *fds;
  };
  ```

- *flags*

  -

  ```
    A bitwise OR of the various values described below.
    *MLX5DV_CONTEXT_FLAGS_DEVX*:
    Allocate a DEVX context
  ```

- *comp\_mask*

  -

  ```
    Bitmask specifying what fields in the structure are valid
    *MLX5DV_CONTEXT_ATTR_MASK_FD_ARRAY*:
    Valid value in *fds*
  ```

- *fds*

  -

  ```
    Used to pass a file descriptor array.
  ```

### ibv\_fd\_arr

-

  ```
  struct ibv_fd_arr {
          int *arr;
          uint32_t count;
  };
  ```

- *arr*

  -

  ```
   Pointer to the file descriptor array.
  ```

- *count*

  -

  ```
   Number of elements in the array.
  ```

## RETURN VALUE

Returns a pointer to the allocated device context, or NULL if the request fails.

## SEE ALSO

*[ibv\_open\_device(3)](/ibv_open_device/3.md)*

## AUTHOR

Yishai Hadas ⟨yishaih@mellanox.com⟩\\c
