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

# rdma\_set\_option(3)

Set communication options for an rdma\_cm\_id.

## NAME

rdma\_set\_option - Set communication options for an rdma\_cm\_id.

## SYNOPSIS

**#include \<rdma/rdma\_cma.h\>**

**int rdma\_set\_option** **(struct rdma\_cm\_id \****id***,** **int** *level***,** **int** *optname***,** **void \****optval***,** **size\_t** *optlen***);**

## ARGUMENTS

- id

  RDMA identifier.

- level

  Protocol level of the option to set.

- optname

  Name of the option, relative to the level, to set.

- optval

  Reference to the option data.  The data is dependent on the level and optname.

- optlen

  The size of the %optval buffer.

## DESCRIPTION

Sets communication options for an rdma\_cm\_id.  This call is used to override the default system settings.

- optname can be one of

  - RDMA\_OPTION\_ID\_TOS

  Specify the quality of service provided by a connection. The expected optlen is size of uint8\_t.

- RDMA\_OPTION\_ID\_REUSEADDR

  Bound the rdma\_cm\_id to a reuseable address. This will allow other users to bind to that same address. The expected optlen is size of int.

- RDMA\_OPTION\_ID\_AFONLY

  Set IPV6\_V6ONLY socket. The expected optlen is size of int.

- RDMA\_OPTION\_IB\_PATH

  Set IB path record data. The expected optlen is size of struct ibv\_path\_data\[\].

- RDMA\_OPTION\_ID\_ACK\_TIMEOUT

  Set QP ACK timeout. The value calculated according to the formula 4.096 \* 2^(ack\_timeout) usec.

## RETURN VALUE

Returns 0 on success, or -1 on error.  If an error occurs, errno will be set to indicate the failure reason.

## NOTES

Option details may be found in the relevant header files.

## SEE ALSO

[rdma\_create\_id(3)](/rdma_create_id/3.md)
