c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * This file contains definitions used in OFED defined user/kernel
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * interfaces. These are imported from the OFED header rdma_cm.h. Oracle
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * elects to have and use the contents of rdma_cm.h under and governed
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * by the OpenIB.org BSD license (see below for details). However,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * the following notice accompanied the original version of this file:
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Copyright (c) 2005 Voltaire Inc. All rights reserved.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Copyright (c) 2005 Intel Corporation. All rights reserved.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * This Software is licensed under one of the following licenses:
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * 1) under the terms of the "Common Public License 1.0" a copy of which is
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * available from the Open Source Initiative, see
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * http://www.opensource.org/licenses/cpl.php.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * 2) under the terms of the "The BSD License" a copy of which is
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * available from the Open Source Initiative, see
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * http://www.opensource.org/licenses/bsd-license.php.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * copy of which is available from the Open Source Initiative, see
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * http://www.opensource.org/licenses/gpl-license.php.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Licensee has the right to choose one of the above licenses.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Redistributions of source code must retain the above copyright
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * notice and one of the license notices.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Redistributions in binary form must reproduce both the above copyright
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * notice, one of the license notices in the documentation
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * and/or other materials provided with the distribution.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Upon receiving a device removal event, users must destroy the associated
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * RDMA identifier and release all resources allocated with the device.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t src_pad[sizeof (struct sockaddr_in6) -
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sizeof (struct sockaddr)];
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t dst_pad[sizeof (struct sockaddr_in6) -
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sizeof (struct sockaddr)];
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t retry_count; /* ignored when accepting */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar /* Fields below ignored if a QP is created on the rdma_cm_id. */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_cm_event_handler - Callback used to report user events.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Notes: Users may not call rdma_destroy_id from this callback to destroy
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * the passed in id, or a corresponding listen id. Returning a
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * non-zero value from the callback will destroy the passed in id.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikartypedef int (*rdma_cm_event_handler)(struct rdma_cm_id *id,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_create_id - Create an RDMA identifier.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @event_handler: User callback invoked to report events associated with the
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * returned rdma_id.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @context: User specified context associated with the id.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @ps: RDMA port space.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarstruct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_map_id2clnthdl -
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Maps RDMA identifier with IBTF and / or ROF client handles. Either
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * of the handles can be NULL, but both should not be NULL. This API
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * is called just after calling rdma_create_id() on the passive side.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_map_id2qphdl -
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * This is used to map RDMA-CM ID to IBTF or ROF client handle and
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * the QP handle. This is called by the passive side just after
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_create_id() and on the active side just before rdma_accept()
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * in the CONNECTION_REQUEST event handler.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarvoid rdma_map_id2clnthdl(struct rdma_cm_id *id, void *ib_client_hdl,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarvoid rdma_map_id2qphdl(struct rdma_cm_id *id, void *qp_hdl);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_destroy_id - Destroys an RDMA identifier.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @id: RDMA identifier.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Note: calling this function has the effect of canceling in-flight
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * asynchronous operations associated with the id.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_bind_addr - Bind an RDMA identifier to a source address and
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * associated RDMA device, if needed.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @id: RDMA identifier.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @addr: Local address information. Wildcard values are permitted.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * This associates a source address with the RDMA identifier before calling
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_listen. If a specific local address is given, the RDMA identifier will
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * be bound to a local RDMA device.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_resolve_addr - Resolve destination and optional source addresses
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * from IP addresses to an RDMA address. If successful, the specified
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_cm_id will be bound to a local device.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @id: RDMA identifier.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @src_addr: Source address information. This parameter may be NULL.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @dst_addr: Destination address information.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @timeout_ms: Time to wait for resolution to complete.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_resolve_route - Resolve the RDMA address bound to the RDMA identifier
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * into route information needed to establish a connection.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * This is called on the client side of a connection.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Users must have first called rdma_resolve_addr to resolve a dst_addr
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * into an RDMA address before calling this routine.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_init_qp_attr - Initializes the QP attributes for use in transitioning
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * to a specified QP state.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @id: Communication identifier associated with the QP attributes to
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * initialize.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @qp_attr: On input, specifies the desired QP state. On output, the
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * mandatory and desired optional attributes will be set in order to
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * modify the QP to the specified state.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @qp_attr_mask: The QP attribute mask that may be used to transition the
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * QP to the specified state.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Users must set the @qp_attr->qp_state to the desired QP state. This call
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * will set all required attributes for the given transition, along with
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * known optional attributes. Users may override the attributes returned from
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * this call before calling ib_modify_qp.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Users that wish to have their QP automatically transitioned through its
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * states can associate a QP with the rdma_cm_id by calling rdma_create_qp().
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_connect - Initiate an active connection request.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @id: Connection identifier to connect.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @conn_param: Connection information used for connected QPs.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Users must have resolved a route for the rdma_cm_id to connect with
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * by having called rdma_resolve_route before calling this routine.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * This call will either connect to a remote QP or obtain remote QP
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * information for unconnected rdma_cm_id's. The actual operation is
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * based on the rdma_cm_id's port space.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_listen - This function is called by the passive side to
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * listen for incoming connection requests.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Users must have bound the rdma_cm_id to a local address by calling
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_bind_addr before calling this routine.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint rdma_listen(struct rdma_cm_id *id, int backlog);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_accept - Called to accept a connection request or response.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @id: Connection identifier associated with the request.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @conn_param: Information needed to establish the connection. This must be
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * provided if accepting a connection request. If accepting a connection
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * response, this parameter must be NULL.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Typically, this routine is only called by the listener to accept a connection
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * request. It must also be called on the active side of a connection if the
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * user is performing their own QP transitions.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * In the case of error, a reject message is sent to the remote side and the
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * state of the qp associated with the id is modified to error, such that any
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * previously posted receive buffers would be flushed.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_notify - Notifies the RDMA CM of an asynchronous event that has
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * occurred on the connection.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @id: Connection identifier to transition to established.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @event: Asynchronous event.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * This routine should be invoked by users to notify the CM of relevant
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * communication events. Events that should be reported to the CM and
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * when to report them are:
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * IB_EVENT_COMM_EST - Used when a message is received on a connected
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * QP before an RTU has been received.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint rdma_notify(struct rdma_cm_id *id, enum ib_event_type event);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_reject - Called to reject a connection request or response.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint rdma_reject(struct rdma_cm_id *id, const void *private_data,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_disconnect - This function disconnects the associated QP and
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * transitions it into the error state.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_join_multicast - Join the multicast group specified by the given
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @id: Communication identifier associated with the request.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @addr: Multicast address identifying the group to join.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @context: User-defined context associated with the join request, returned
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * to the user through the private_data pointer in multicast events.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_leave_multicast - Leave the multicast group specified by the given
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarvoid rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_set_service_type - Set the type of service associated with a
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * connection identifier.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @id: Communication identifier to associated with service type.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * @tos: Type of service.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * The type of service is interpretted as a differentiated service
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * field (RFC 2474). The service type should be specified before
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * performing route resolution, as existing communication on the
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * connection identifier may be unaffected. The type of service
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * requested may not be supported by the network to all destinations.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarvoid rdma_set_service_type(struct rdma_cm_id *id, int tos);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_create_qp - Allocate a QP and associate it with the specified RDMA
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * identifier.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * QPs allocated to an rdma_cm_id will automatically be transitioned by the CMA
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * through their states.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint rdma_create_qp(struct rdma_cm_id *id, struct ib_pd *pd,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * rdma_destroy_qp - Deallocate the QP associated with the specified RDMA
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * identifier.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Users must destroy any QP associated with an RDMA identifier before
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * destroying the RDMA ID.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif /* _SYS_IB_CLIENTS_OF_RDMA_RDMA_CM_H */