Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (c) 2005 Voltaire Inc.  All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (c) 2005 Intel Corporation.  All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #ifndef RDMA_CM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #define RDMA_CM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/socket.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/in6.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <rdma/ib_addr.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <rdma/ib_sa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <uapi/rdma/rdma_user_cm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * Upon receiving a device removal event, users must destroy the associated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * RDMA identifier and release all resources allocated with the device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) enum rdma_cm_event_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	RDMA_CM_EVENT_ADDR_RESOLVED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	RDMA_CM_EVENT_ADDR_ERROR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	RDMA_CM_EVENT_ROUTE_RESOLVED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	RDMA_CM_EVENT_ROUTE_ERROR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	RDMA_CM_EVENT_CONNECT_REQUEST,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	RDMA_CM_EVENT_CONNECT_RESPONSE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	RDMA_CM_EVENT_CONNECT_ERROR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	RDMA_CM_EVENT_UNREACHABLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	RDMA_CM_EVENT_REJECTED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	RDMA_CM_EVENT_ESTABLISHED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	RDMA_CM_EVENT_DISCONNECTED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	RDMA_CM_EVENT_DEVICE_REMOVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	RDMA_CM_EVENT_MULTICAST_JOIN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	RDMA_CM_EVENT_MULTICAST_ERROR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	RDMA_CM_EVENT_ADDR_CHANGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	RDMA_CM_EVENT_TIMEWAIT_EXIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) const char *__attribute_const__ rdma_event_msg(enum rdma_cm_event_type event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define RDMA_IB_IP_PS_MASK   0xFFFFFFFFFFFF0000ULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define RDMA_IB_IP_PS_TCP    0x0000000001060000ULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #define RDMA_IB_IP_PS_UDP    0x0000000001110000ULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #define RDMA_IB_IP_PS_IB     0x00000000013F0000ULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) struct rdma_addr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	struct sockaddr_storage src_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	struct sockaddr_storage dst_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	struct rdma_dev_addr dev_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) struct rdma_route {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	struct rdma_addr addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	struct sa_path_rec *path_rec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	int num_paths;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) struct rdma_conn_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	const void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	u8 private_data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	u8 responder_resources;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	u8 initiator_depth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	u8 flow_control;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	u8 retry_count;		/* ignored when accepting */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	u8 rnr_retry_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	/* Fields below ignored if a QP is created on the rdma_cm_id. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	u8 srq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	u32 qp_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	u32 qkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) struct rdma_ud_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	const void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	u8 private_data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	struct rdma_ah_attr ah_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	u32 qp_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	u32 qkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) struct rdma_cm_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	enum rdma_cm_event_type	 event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	int			 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		struct rdma_conn_param	conn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		struct rdma_ud_param	ud;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	} param;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	struct rdma_ucm_ece ece;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) struct rdma_cm_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  * rdma_cm_event_handler - Callback used to report user events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)  * Notes: Users may not call rdma_destroy_id from this callback to destroy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)  *   the passed in id, or a corresponding listen id.  Returning a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)  *   non-zero value from the callback will destroy the passed in id.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) typedef int (*rdma_cm_event_handler)(struct rdma_cm_id *id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 				     struct rdma_cm_event *event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) struct rdma_cm_id {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	struct ib_device	*device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	void			*context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	struct ib_qp		*qp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	rdma_cm_event_handler	 event_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	struct rdma_route	 route;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	enum rdma_ucm_port_space ps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	enum ib_qp_type		 qp_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	u8			 port_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) struct rdma_cm_id *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) __rdma_create_kernel_id(struct net *net, rdma_cm_event_handler event_handler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 			void *context, enum rdma_ucm_port_space ps,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 			enum ib_qp_type qp_type, const char *caller);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) struct rdma_cm_id *rdma_create_user_id(rdma_cm_event_handler event_handler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 				       void *context,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 				       enum rdma_ucm_port_space ps,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 				       enum ib_qp_type qp_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  * rdma_create_id - Create an RDMA identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  * @net: The network namespace in which to create the new id.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)  * @event_handler: User callback invoked to report events associated with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)  *   returned rdma_id.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)  * @context: User specified context associated with the id.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)  * @ps: RDMA port space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)  * @qp_type: type of queue pair associated with the id.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)  * Returns a new rdma_cm_id. The id holds a reference on the network
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  * namespace until it is destroyed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  * The event handler callback serializes on the id's mutex and is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  * allowed to sleep.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) #define rdma_create_id(net, event_handler, context, ps, qp_type)               \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	__rdma_create_kernel_id(net, event_handler, context, ps, qp_type,      \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 				KBUILD_MODNAME)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)   * rdma_destroy_id - Destroys an RDMA identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)   *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)   * @id: RDMA identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)   *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)   * Note: calling this function has the effect of canceling in-flight
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)   * asynchronous operations associated with the id.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) void rdma_destroy_id(struct rdma_cm_id *id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)  * rdma_bind_addr - Bind an RDMA identifier to a source address and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)  *   associated RDMA device, if needed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)  * @id: RDMA identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)  * @addr: Local address information.  Wildcard values are permitted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  * This associates a source address with the RDMA identifier before calling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  * rdma_listen.  If a specific local address is given, the RDMA identifier will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  * be bound to a local RDMA device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)  * rdma_resolve_addr - Resolve destination and optional source addresses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)  *   from IP addresses to an RDMA address.  If successful, the specified
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  *   rdma_cm_id will be bound to a local device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  * @id: RDMA identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)  * @src_addr: Source address information.  This parameter may be NULL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)  * @dst_addr: Destination address information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)  * @timeout_ms: Time to wait for resolution to complete.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		      const struct sockaddr *dst_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		      unsigned long timeout_ms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)  * rdma_resolve_route - Resolve the RDMA address bound to the RDMA identifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)  *   into route information needed to establish a connection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)  * This is called on the client side of a connection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)  * Users must have first called rdma_resolve_addr to resolve a dst_addr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)  * into an RDMA address before calling this routine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) int rdma_resolve_route(struct rdma_cm_id *id, unsigned long timeout_ms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)  * rdma_create_qp - Allocate a QP and associate it with the specified RDMA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)  * identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)  * QPs allocated to an rdma_cm_id will automatically be transitioned by the CMA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)  * through their states.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) int rdma_create_qp(struct rdma_cm_id *id, struct ib_pd *pd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 		   struct ib_qp_init_attr *qp_init_attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)  * rdma_destroy_qp - Deallocate the QP associated with the specified RDMA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)  * identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)  * Users must destroy any QP associated with an RDMA identifier before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)  * destroying the RDMA ID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) void rdma_destroy_qp(struct rdma_cm_id *id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  * rdma_init_qp_attr - Initializes the QP attributes for use in transitioning
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  *   to a specified QP state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  * @id: Communication identifier associated with the QP attributes to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  *   initialize.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)  * @qp_attr: On input, specifies the desired QP state.  On output, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)  *   mandatory and desired optional attributes will be set in order to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)  *   modify the QP to the specified state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)  * @qp_attr_mask: The QP attribute mask that may be used to transition the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)  *   QP to the specified state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)  * Users must set the @qp_attr->qp_state to the desired QP state.  This call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)  * will set all required attributes for the given transition, along with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)  * known optional attributes.  Users may override the attributes returned from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)  * this call before calling ib_modify_qp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)  * Users that wish to have their QP automatically transitioned through its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)  * states can associate a QP with the rdma_cm_id by calling rdma_create_qp().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 		       int *qp_attr_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) int rdma_connect_locked(struct rdma_cm_id *id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 			struct rdma_conn_param *conn_param);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) int rdma_connect_ece(struct rdma_cm_id *id, struct rdma_conn_param *conn_param,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 		     struct rdma_ucm_ece *ece);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)  * rdma_listen - This function is called by the passive side to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)  *   listen for incoming connection requests.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)  * Users must have bound the rdma_cm_id to a local address by calling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)  * rdma_bind_addr before calling this routine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) int rdma_listen(struct rdma_cm_id *id, int backlog);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) void rdma_lock_handler(struct rdma_cm_id *id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) void rdma_unlock_handler(struct rdma_cm_id *id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) int rdma_accept_ece(struct rdma_cm_id *id, struct rdma_conn_param *conn_param,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 		    struct rdma_ucm_ece *ece);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)  * rdma_notify - Notifies the RDMA CM of an asynchronous event that has
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)  * occurred on the connection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)  * @id: Connection identifier to transition to established.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)  * @event: Asynchronous event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)  * This routine should be invoked by users to notify the CM of relevant
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)  * communication events.  Events that should be reported to the CM and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)  * when to report them are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)  * IB_EVENT_COMM_EST - Used when a message is received on a connected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)  *    QP before an RTU has been received.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) int rdma_notify(struct rdma_cm_id *id, enum ib_event_type event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)  * rdma_reject - Called to reject a connection request or response.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) int rdma_reject(struct rdma_cm_id *id, const void *private_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 		u8 private_data_len, u8 reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)  * rdma_disconnect - This function disconnects the associated QP and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)  *   transitions it into the error state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) int rdma_disconnect(struct rdma_cm_id *id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)  * rdma_join_multicast - Join the multicast group specified by the given
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)  *   address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)  * @id: Communication identifier associated with the request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)  * @addr: Multicast address identifying the group to join.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)  * @join_state: Multicast JoinState bitmap requested by port.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)  *		Bitmap is based on IB_SA_MCMEMBER_REC_JOIN_STATE bits.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)  * @context: User-defined context associated with the join request, returned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)  * to the user through the private_data pointer in multicast events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) int rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 			u8 join_state, void *context);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)  * rdma_leave_multicast - Leave the multicast group specified by the given
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)  *   address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)  * rdma_set_service_type - Set the type of service associated with a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)  *   connection identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)  * @id: Communication identifier to associated with service type.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)  * @tos: Type of service.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)  * The type of service is interpretted as a differentiated service
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)  * field (RFC 2474).  The service type should be specified before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)  * performing route resolution, as existing communication on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)  * connection identifier may be unaffected.  The type of service
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)  * requested may not be supported by the network to all destinations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) void rdma_set_service_type(struct rdma_cm_id *id, int tos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)  * rdma_set_reuseaddr - Allow the reuse of local addresses when binding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315)  *    the rdma_cm_id.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)  * @id: Communication identifier to configure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)  * @reuse: Value indicating if the bound address is reusable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)  * Reuse must be set before an address is bound to the id.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) int rdma_set_reuseaddr(struct rdma_cm_id *id, int reuse);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)  * rdma_set_afonly - Specify that listens are restricted to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)  *    bound address family only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)  * @id: Communication identifer to configure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)  * @afonly: Value indicating if listens are restricted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)  * Must be set before identifier is in the listening state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) int rdma_set_afonly(struct rdma_cm_id *id, int afonly);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)  /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)  * rdma_get_service_id - Return the IB service ID for a specified address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)  * @id: Communication identifier associated with the address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)  * @addr: Address for the service ID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) __be64 rdma_get_service_id(struct rdma_cm_id *id, struct sockaddr *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)  * rdma_reject_msg - return a pointer to a reject message string.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)  * @id: Communication identifier that received the REJECT event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)  * @reason: Value returned in the REJECT event status field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 						int reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)  * rdma_consumer_reject_data - return the consumer reject private data and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)  *			       length, if any.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)  * @id: Communication identifier that received the REJECT event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)  * @ev: RDMA CM reject event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)  * @data_len: Pointer to the resulting length of the consumer data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) const void *rdma_consumer_reject_data(struct rdma_cm_id *id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 				      struct rdma_cm_event *ev, u8 *data_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)  * rdma_read_gids - Return the SGID and DGID used for establishing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)  *                  connection. This can be used after rdma_resolve_addr()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)  *                  on client side. This can be use on new connection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)  *                  on server side. This is applicable to IB, RoCE, iWarp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)  *                  If cm_id is not bound yet to the RDMA device, it doesn't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)  *                  copy and SGID or DGID to the given pointers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)  * @id: Communication identifier whose GIDs are queried.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)  * @sgid: Pointer to SGID where SGID will be returned. It is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)  * @dgid: Pointer to DGID where DGID will be returned. It is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)  * Note: This API should not be used by any new ULPs or new code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)  * Instead, users interested in querying GIDs should refer to path record
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)  * of the rdma_cm_id to query the GIDs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)  * This API is provided for compatibility for existing users.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) void rdma_read_gids(struct rdma_cm_id *cm_id, union ib_gid *sgid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 		    union ib_gid *dgid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) struct iw_cm_id *rdma_iw_cm_id(struct rdma_cm_id *cm_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) struct rdma_cm_id *rdma_res_to_id(struct rdma_restrack_entry *res);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) #endif /* RDMA_CM_H */