Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Enumerations | Functions
rdma_cm.h File Reference
#include <linux/socket.h>
#include <linux/in6.h>
#include <rdma/ib_addr.h>
#include <rdma/ib_sa.h>

Go to the source code of this file.

Data Structures

struct  rdma_addr
struct  rdma_route
struct  rdma_conn_param
struct  rdma_ud_param
struct  rdma_cm_event
struct  rdma_cm_id


typedef int(* rdma_cm_event_handler )(struct rdma_cm_id *id, struct rdma_cm_event *event)


enum  rdma_cm_event_type {
enum  rdma_port_space {
  RDMA_PS_SDP = 0x0001, RDMA_PS_IPOIB = 0x0002, RDMA_PS_IB = 0x013F, RDMA_PS_TCP = 0x0106,
  RDMA_PS_UDP = 0x0111
enum  rdma_cm_state {


struct rdma_cm_idrdma_create_id (rdma_cm_event_handler event_handler, void *context, enum rdma_port_space ps, enum ib_qp_type qp_type)
void rdma_destroy_id (struct rdma_cm_id *id)
int rdma_bind_addr (struct rdma_cm_id *id, struct sockaddr *addr)
int rdma_resolve_addr (struct rdma_cm_id *id, struct sockaddr *src_addr, struct sockaddr *dst_addr, int timeout_ms)
int rdma_resolve_route (struct rdma_cm_id *id, int timeout_ms)
int rdma_create_qp (struct rdma_cm_id *id, struct ib_pd *pd, struct ib_qp_init_attr *qp_init_attr)
void rdma_destroy_qp (struct rdma_cm_id *id)
int rdma_init_qp_attr (struct rdma_cm_id *id, struct ib_qp_attr *qp_attr, int *qp_attr_mask)
int rdma_connect (struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
int rdma_listen (struct rdma_cm_id *id, int backlog)
int rdma_accept (struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
int rdma_notify (struct rdma_cm_id *id, enum ib_event_type event)
int rdma_reject (struct rdma_cm_id *id, const void *private_data, u8 private_data_len)
int rdma_disconnect (struct rdma_cm_id *id)
int rdma_join_multicast (struct rdma_cm_id *id, struct sockaddr *addr, void *context)
void rdma_leave_multicast (struct rdma_cm_id *id, struct sockaddr *addr)
void rdma_set_service_type (struct rdma_cm_id *id, int tos)
int rdma_set_reuseaddr (struct rdma_cm_id *id, int reuse)
int rdma_set_afonly (struct rdma_cm_id *id, int afonly)

Typedef Documentation

typedef int(* rdma_cm_event_handler)(struct rdma_cm_id *id, struct rdma_cm_event *event)

rdma_cm_event_handler - Callback used to report user events.

Notes: Users may not call rdma_destroy_id from this callback to destroy the passed in id, or a corresponding listen id. Returning a non-zero value from the callback will destroy the passed in id.

Definition at line 138 of file rdma_cm.h.

Enumeration Type Documentation


Definition at line 46 of file rdma_cm.h.


Definition at line 115 of file rdma_cm.h.


Definition at line 65 of file rdma_cm.h.

Function Documentation

int rdma_accept ( struct rdma_cm_id id,
struct rdma_conn_param conn_param 

rdma_accept - Called to accept a connection request or response. : Connection identifier associated with the request. : Information needed to establish the connection. This must be provided if accepting a connection request. If accepting a connection response, this parameter must be NULL.

Typically, this routine is only called by the listener to accept a connection request. It must also be called on the active side of a connection if the user is performing their own QP transitions.

In the case of error, a reject message is sent to the remote side and the state of the qp associated with the id is modified to error, such that any previously posted receive buffers would be flushed.

Definition at line 2825 of file cma.c.

int rdma_bind_addr ( struct rdma_cm_id id,
struct sockaddr addr 

rdma_bind_addr - Bind an RDMA identifier to a source address and associated RDMA device, if needed.

: RDMA identifier. : Local address information. Wildcard values are permitted.

This associates a source address with the RDMA identifier before calling rdma_listen. If a specific local address is given, the RDMA identifier will be bound to a local RDMA device.

Definition at line 2380 of file cma.c.

int rdma_connect ( struct rdma_cm_id id,
struct rdma_conn_param conn_param 

rdma_connect - Initiate an active connection request. : Connection identifier to connect. : Connection information used for connected QPs.

Users must have resolved a route for the rdma_cm_id to connect with by having called rdma_resolve_route before calling this routine.

This call will either connect to a remote QP or obtain remote QP information for unconnected rdma_cm_id's. The actual operation is based on the rdma_cm_id's port space.

Definition at line 2712 of file cma.c.

struct rdma_cm_id* rdma_create_id ( rdma_cm_event_handler  event_handler,
void context,
enum rdma_port_space  ps,
enum ib_qp_type  qp_type 

rdma_create_id - Create an RDMA identifier.

: User callback invoked to report events associated with the returned rdma_id. : User specified context associated with the id. : RDMA port space. : type of queue pair associated with the id.

Definition at line 422 of file cma.c.

int rdma_create_qp ( struct rdma_cm_id id,
struct ib_pd pd,
struct ib_qp_init_attr qp_init_attr 

rdma_create_qp - Allocate a QP and associate it with the specified RDMA identifier.

QPs allocated to an rdma_cm_id will automatically be transitioned by the CMA through their states.

Definition at line 490 of file cma.c.

void rdma_destroy_id ( struct rdma_cm_id id)

rdma_destroy_id - Destroys an RDMA identifier.

: RDMA identifier.

Note: calling this function has the effect of canceling in-flight asynchronous operations associated with the id.

Definition at line 912 of file cma.c.

void rdma_destroy_qp ( struct rdma_cm_id id)

rdma_destroy_qp - Deallocate the QP associated with the specified RDMA identifier.

Users must destroy any QP associated with an RDMA identifier before destroying the RDMA ID.

Definition at line 522 of file cma.c.

int rdma_disconnect ( struct rdma_cm_id id)

rdma_disconnect - This function disconnects the associated QP and transitions it into the error state.

Definition at line 2931 of file cma.c.

int rdma_init_qp_attr ( struct rdma_cm_id id,
struct ib_qp_attr qp_attr,
int qp_attr_mask 

rdma_init_qp_attr - Initializes the QP attributes for use in transitioning to a specified QP state. : Communication identifier associated with the QP attributes to initialize. : On input, specifies the desired QP state. On output, the mandatory and desired optional attributes will be set in order to modify the QP to the specified state. : The QP attribute mask that may be used to transition the QP to the specified state.

Users must set the ->qp_state to the desired QP state. This call will set all required attributes for the given transition, along with known optional attributes. Users may override the attributes returned from this call before calling ib_modify_qp.

Users that wish to have their QP automatically transitioned through its states can associate a QP with the rdma_cm_id by calling rdma_create_qp().

Definition at line 647 of file cma.c.

int rdma_join_multicast ( struct rdma_cm_id id,
struct sockaddr addr,
void context 

rdma_join_multicast - Join the multicast group specified by the given address. : Communication identifier associated with the request. : Multicast address identifying the group to join. : User-defined context associated with the join request, returned to the user through the private_data pointer in multicast events.

Definition at line 3169 of file cma.c.

void rdma_leave_multicast ( struct rdma_cm_id id,
struct sockaddr addr 

rdma_leave_multicast - Leave the multicast group specified by the given address.

Definition at line 3222 of file cma.c.

int rdma_listen ( struct rdma_cm_id id,
int  backlog 

rdma_listen - This function is called by the passive side to listen for incoming connection requests.

Users must have bound the rdma_cm_id to a local address by calling rdma_bind_addr before calling this routine.

Definition at line 2330 of file cma.c.

int rdma_notify ( struct rdma_cm_id id,
enum ib_event_type  event 

rdma_notify - Notifies the RDMA CM of an asynchronous event that has occurred on the connection. : Connection identifier to transition to established. : Asynchronous event.

This routine should be invoked by users to notify the CM of relevant communication events. Events that should be reported to the CM and when to report them are:

IB_EVENT_COMM_EST - Used when a message is received on a connected QP before an RTU has been received.

Definition at line 2878 of file cma.c.

int rdma_reject ( struct rdma_cm_id id,
const void private_data,
u8  private_data_len 

rdma_reject - Called to reject a connection request or response.

Definition at line 2899 of file cma.c.

int rdma_resolve_addr ( struct rdma_cm_id id,
struct sockaddr src_addr,
struct sockaddr dst_addr,
int  timeout_ms 

rdma_resolve_addr - Resolve destination and optional source addresses from IP addresses to an RDMA address. If successful, the specified rdma_cm_id will be bound to a local device.

: RDMA identifier. : Source address information. This parameter may be NULL. : Destination address information. : Time to wait for resolution to complete.

Definition at line 2058 of file cma.c.

int rdma_resolve_route ( struct rdma_cm_id id,
int  timeout_ms 

rdma_resolve_route - Resolve the RDMA address bound to the RDMA identifier into route information needed to establish a connection.

This is called on the client side of a connection. Users must have first called rdma_resolve_addr to resolve a dst_addr into an RDMA address before calling this routine.

Definition at line 1876 of file cma.c.

int rdma_set_afonly ( struct rdma_cm_id id,
int  afonly 

rdma_set_afonly - Specify that listens are restricted to the bound address family only. : Communication identifer to configure. : Value indicating if listens are restricted.

Must be set before identifier is in the listening state.

Definition at line 2112 of file cma.c.

int rdma_set_reuseaddr ( struct rdma_cm_id id,
int  reuse 

rdma_set_reuseaddr - Allow the reuse of local addresses when binding the rdma_cm_id. : Communication identifier to configure. : Value indicating if the bound address is reusable.

Reuse must be set before an address is bound to the id.

Definition at line 2093 of file cma.c.

void rdma_set_service_type ( struct rdma_cm_id id,
int  tos 

rdma_set_service_type - Set the type of service associated with a connection identifier. : Communication identifier to associated with service type. : Type of service.

The type of service is interpretted as a differentiated service field (RFC 2474). The service type should be specified before performing route resolution, as existing communication on the connection identifier may be unaffected. The type of service requested may not be supported by the network to all destinations.

Definition at line 1605 of file cma.c.