Here's a modified version of the header. Notable changes are: * Functions have been renamed from ib_blah to rdma_blah. * Creation and destruction of the cma_id are explicit. * A single event handler is defined. * Routing information is retrieved via a separate call. * Listeners must now specify a backlog. * The get device routine has been removed. * Get source IP is no longer needed and has been removed.
Functionality that could be added could include changing the route associated with a cma_id and retrieving all IP addresses for a device/port. - Sean /* * Copyright (c) 2005 Voltaire Inc. All rights reserved. * Copyright (c) 2005 Intel Corporation. All rights reserved. * * This Software is licensed under one of the following licenses: * * 1) under the terms of the "Common Public License 1.0" a copy of which is * available from the Open Source Initiative, see * http://www.opensource.org/licenses/cpl.php. * * 2) under the terms of the "The BSD License" a copy of which is * available from the Open Source Initiative, see * http://www.opensource.org/licenses/bsd-license.php. * * 3) under the terms of the "GNU General Public License (GPL) Version 2" a * copy of which is available from the Open Source Initiative, see * http://www.opensource.org/licenses/gpl-license.php. * * Licensee has the right to choose one of the above licenses. * * Redistributions of source code must retain the above copyright * notice and one of the license notices. * * Redistributions in binary form must reproduce both the above copyright * notice, one of the license notices in the documentation * and/or other materials provided with the distribution. * */ #if !defined(RDMA_CMA_H) #define RDMA_CMA_H #include <linux/socket.h> #include <linux/in.h> #include <rdma/ib_verbs.h> enum rdma_cma_event_type { RDMA_CMA_EVENT_ROUTE_FOUND, RDMA_CMA_EVENT_ESTABLISHED, RDMA_CMA_EVENT_REJECTED, RDMA_CMA_EVENT_DISCONNECTED, RDMA_CMA_EVENT_UNREACHABLE }; /* How to use? */ enum rdma_qos { RDMA_QOS_BEST_EFFORT = 0, RDMA_QOS_HIGH_THROUGHPUT = (1 << 0), RDMA_QOS_LOW_LATENCY = (1 << 1), RDMA_QOS_ECONOMY = (1 << 2), RDMA_QOS_PREMIUM = (1 << 3) }; /* How to use? */ enum rdma_connect_flags { RDMA_CONNECT_DEFAULT_FLAG = 0x00, RDMA_CONNECT_MULTIPATH_FLAG = 0x01 }; struct rdma_route { struct sockaddr src_ip; struct sockaddr dest_ip; }; struct rdma_cma_event { enum rdma_cma_event_type event; void *private_data; }; struct rdma_cma_id; typedef void (*rdma_cma_event_handler)(struct rdma_cma_id *cma_id, struct rdma_cma_event event); struct rdma_cma_id { struct ib_device *device; void *context; struct ib_qp *qp; rdma_cma_event_handler event_handler; struct rdma_route *route; }; struct rdma_cma_id* rdma_cma_create_id(struct ib_device *device, void *context, rdma_cma_event_handler event_handler); void rdma_cma_destroy_id(struct rdma_cma_id *cma_id); /** * rdma_cma_listen - this function is called by the passive side. It is * listening on a the specified port for incomming connection requests. */ int rdma_cma_listen(struct rdma_cma_id *cma_id, struct sockaddr *address, int backlog); int rdma_cma_get_route(struct rdma_cma_id *cma_id, struct sockaddr *src_ip, struct sockaddr *dest_ip); struct rdma_cma_conn_param { struct ib_qp *qp; struct ib_qp_attr *qp_attr; /* Need to clarify what's needed */ const void *private_data; u8 private_data_len; enum rdma_qos qos; /* ? */ enum rdma_connect_flags connect_flags; /* ? */ }; /** * rdma_cma_connect - this is the connect request function, called by * the active side. The consumer registers an upcall that will be * initiated by the cma with an appropriate connection event * notification (established/rejected/disconnected etc) * @conn_param: This structure contains the following connection parameters: * @qp: qp for establishing the connection * @qp_attr: only relevant attributes are used * @private_data: private data to be received at the listener upcall * @private_data_len: private data length * @qos: Quality of service for the rc * @connect_flags: default or multipath connection */ int rdma_cma_connect(struct rdma_cma_id *cma_id, struct rdma_cma_conn_param *conn_param); /** * rdma_cma_accept - call on the passive side to accept a connection request * note that if the function returned with error - a reject message was * sent to the remote side and the cma_id was destroyed * @cma_id: pass the handle that was returned in cma_listen callback for * this connection * @qp: the connection's qp * @private_data: private data to send back to the initiator * @private_data_len: private data length */ int rdma_cma_accept(struct rdma_cma_id *cma_id, struct ib_qp *qp, const void *private_data, u8 private_data_len); /** * rdma_cma_reject - call on the passive side to reject a connection request. * This call destroys the cma_id, hence when the active side accepts * the reject the cma_id is already destroyed. * @cma_id: this handle was accepted in cma_listen callback * @private_data: private data to send back to the initiator * @private_data_len: private data length */ int rdma_cma_reject(struct rdma_cma_id *cma_id, const void *private_data, u8 private_data_len); /** * rdma_cma_disconnect - this function disconnects the associated QP. */ int rdma_cma_disconnect(struct rdma_cma_id *cma_id); #endif /* RDMA_CMA_H */ _______________________________________________ openib-general mailing list [email protected] http://openib.org/mailman/listinfo/openib-general To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
