Skip to content

Conversation

shefty
Copy link
Contributor

@shefty shefty commented Jul 30, 2025

The following series adds support for using SA ServiceRecords to resolve a service name to a usable IB address. This is in addition to the current approach which uses DNS. To add this support, a couple enhancements are added to the librdmacm.

  • Address resolution can now be done asynchronously. A new function, rdma_resolve_addrinfo(), is added to the API. The behavior is similar to rdma_getaddrinfo(), only the operation is asynchronous. Once the resolution completes, an event is written to the event channel. An rdma_cm_id is used to track the operation while it is outstanding. The new call supports both SA name resolution and DNS. In the case of DNS support, asynchronous behavior is emulated.
  • The application can use flags passed into rdma_resolve_addrinfo() to control whether DNS or SA or both are used for resolution.
  • Once asynchronous resolution completes, a new rdma_query_addrinfo() call allows the application to retrieve the results. The flow of calling rdma_resolve_addrinfo() + reading the event + rdma_query_addrinfo() provides similar behavior as calling rdma_getaddrinfo().
  • In order to convert synchronous DNS resolution into an asynchronous operation, a third API call is added, rdma_write_cm_event(). This call allows user space to inject an event into the event channel queue. This allows rdma_resolve_addrinfo() to provide consistent application behavior, independent of how resolution is implemented under the API. Because such an API may be useful for applications, it is exposed for direct use.

I'm submitting this PR on behalf of Mark Zhang, who is the author.

@shefty shefty force-pushed the svcrec branch 4 times, most recently from 62b4f12 to de12787 Compare August 12, 2025 22:40
To commit: 810f874eda8e ("RDMA/ucma: Support query resolved service
records").

Signed-off-by: Sean Hefty <[email protected]>
Add the following APIs to resolve IB services and report addrinfo
structures:
  * rdma_resolve_addrinfo() - To resolve an IB service;
  * rdma_query_addrinfo() -  To get the resolved information.

A new flag "RAI_SA" is added, which can be used as a hint to indicate
resolve SA, as this API is going to support DNS also.

Two new CM events are added:
  * RDMA_CM_EVENT_ADDRINFO_RESOLVED: resolution completed successfully.
  * RDMA_CM_EVENT_ADDRINFO_ERROR: resolution failed.

On a successful resolve, one or more addrinfo is returned and saved
internally, the first one will be used by default.

Signed-off-by: Mark Zhang <[email protected]>
Signed-off-by: Sean Hefty <[email protected]>
@shefty shefty force-pushed the svcrec branch 2 times, most recently from 18afbec to b683f94 Compare August 25, 2025 16:29
Support writing an event to a CM channel and add a new user API
"rdma_write_cm_event()". Two new events are added and supported to be
written:
- RDMA_CM_EVENT_USER: User-defined, event details are specified by the
  user and not interpreted by the librdmacm.  This event is useful for
  a multi-threaded application to signal a thread which may be waiting
  on the RDMA CM event channel. This is the only event that users can
  write;
- RDMA_CM_EVENT_INTERNAL: Used and consumed internally by the
  librdmacm. Users should not write this event.

A new event parameter "arg" is supported, which will be passed from
sender to receiver along with the event.

Signed-off-by: Mark Zhang <[email protected]>
Allow rdma_resolve_addrinfo() and rdma_query_addrinfo() to support DNS
resolve and query, respectively.

A new flags "RAI_DNS" is supported to indicate this is a DNS resolve
request. This flag is mutual exclusive with RAI_SA. If both are not set
then DNS resolve is performed by default.

With this patch a user may resolve both DNS and SA, and it's possible
that one thread is querying the resolved addrinfo while another thread
is resolving. So protect the route.resolved_ai with id_priv->mut lock.

Signed-off-by: Mark Zhang <[email protected]>
Allow rdma_getaddrinfo() to support IB SA resolve when RAI_SA flag is
set in the hints. It resolves the requested IB service on all IB ports
one by one, and returns on the first successful resolve.

Signed-off-by: Mark Zhang <[email protected]>
Add manual pages for new APIs rdma_resolve_addrinfo(),
rdma_query_addrinfo(), rdma_write_cm_event(), and RAI_DNS, RAI_SA flags.

Signed-off-by: Mark Zhang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants