0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #ifndef _CMA_PRIV_H
0037 #define _CMA_PRIV_H
0038
0039 enum rdma_cm_state {
0040 RDMA_CM_IDLE,
0041 RDMA_CM_ADDR_QUERY,
0042 RDMA_CM_ADDR_RESOLVED,
0043 RDMA_CM_ROUTE_QUERY,
0044 RDMA_CM_ROUTE_RESOLVED,
0045 RDMA_CM_CONNECT,
0046 RDMA_CM_DISCONNECT,
0047 RDMA_CM_ADDR_BOUND,
0048 RDMA_CM_LISTEN,
0049 RDMA_CM_DEVICE_REMOVAL,
0050 RDMA_CM_DESTROYING
0051 };
0052
0053 struct rdma_id_private {
0054 struct rdma_cm_id id;
0055
0056 struct rdma_bind_list *bind_list;
0057 struct hlist_node node;
0058 union {
0059 struct list_head device_item;
0060 struct list_head listen_any_item;
0061 };
0062 union {
0063
0064 struct list_head listen_item;
0065 struct list_head listen_list;
0066 };
0067 struct list_head id_list_entry;
0068 struct cma_device *cma_dev;
0069 struct list_head mc_list;
0070
0071 int internal_id;
0072 enum rdma_cm_state state;
0073 spinlock_t lock;
0074 struct mutex qp_mutex;
0075
0076 struct completion comp;
0077 refcount_t refcount;
0078 struct mutex handler_mutex;
0079
0080 int backlog;
0081 int timeout_ms;
0082 struct ib_sa_query *query;
0083 int query_id;
0084 union {
0085 struct ib_cm_id *ib;
0086 struct iw_cm_id *iw;
0087 } cm_id;
0088
0089 u32 seq_num;
0090 u32 qkey;
0091 u32 qp_num;
0092 u32 options;
0093 u8 srq;
0094 u8 tos;
0095 u8 tos_set:1;
0096 u8 timeout_set:1;
0097 u8 min_rnr_timer_set:1;
0098 u8 reuseaddr;
0099 u8 afonly;
0100 u8 timeout;
0101 u8 min_rnr_timer;
0102 u8 used_resolve_ip;
0103 enum ib_gid_type gid_type;
0104
0105
0106
0107
0108 struct rdma_restrack_entry res;
0109 struct rdma_ucm_ece ece;
0110 };
0111
0112 #if IS_ENABLED(CONFIG_INFINIBAND_ADDR_TRANS_CONFIGFS)
0113 int cma_configfs_init(void);
0114 void cma_configfs_exit(void);
0115 #else
0116 static inline int cma_configfs_init(void)
0117 {
0118 return 0;
0119 }
0120
0121 static inline void cma_configfs_exit(void)
0122 {
0123 }
0124 #endif
0125
0126 void cma_dev_get(struct cma_device *dev);
0127 void cma_dev_put(struct cma_device *dev);
0128 typedef bool (*cma_device_filter)(struct ib_device *, void *);
0129 struct cma_device *cma_enum_devices_by_ibdev(cma_device_filter filter,
0130 void *cookie);
0131 int cma_get_default_gid_type(struct cma_device *dev, u32 port);
0132 int cma_set_default_gid_type(struct cma_device *dev, u32 port,
0133 enum ib_gid_type default_gid_type);
0134 int cma_get_default_roce_tos(struct cma_device *dev, u32 port);
0135 int cma_set_default_roce_tos(struct cma_device *dev, u32 port,
0136 u8 default_roce_tos);
0137 struct ib_device *cma_get_ib_dev(struct cma_device *dev);
0138
0139 #endif