![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 0002 /* 0003 * Copyright (c) 2005 Network Appliance, Inc. All rights reserved. 0004 * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. 0005 */ 0006 0007 #ifndef IW_CM_H 0008 #define IW_CM_H 0009 0010 #include <linux/in.h> 0011 #include <rdma/ib_cm.h> 0012 0013 struct iw_cm_id; 0014 0015 enum iw_cm_event_type { 0016 IW_CM_EVENT_CONNECT_REQUEST = 1, /* connect request received */ 0017 IW_CM_EVENT_CONNECT_REPLY, /* reply from active connect request */ 0018 IW_CM_EVENT_ESTABLISHED, /* passive side accept successful */ 0019 IW_CM_EVENT_DISCONNECT, /* orderly shutdown */ 0020 IW_CM_EVENT_CLOSE /* close complete */ 0021 }; 0022 0023 struct iw_cm_event { 0024 enum iw_cm_event_type event; 0025 int status; 0026 struct sockaddr_storage local_addr; 0027 struct sockaddr_storage remote_addr; 0028 void *private_data; 0029 void *provider_data; 0030 u8 private_data_len; 0031 u8 ord; 0032 u8 ird; 0033 }; 0034 0035 /** 0036 * iw_cm_handler - Function to be called by the IW CM when delivering events 0037 * to the client. 0038 * 0039 * @cm_id: The IW CM identifier associated with the event. 0040 * @event: Pointer to the event structure. 0041 */ 0042 typedef int (*iw_cm_handler)(struct iw_cm_id *cm_id, 0043 struct iw_cm_event *event); 0044 0045 /** 0046 * iw_event_handler - Function called by the provider when delivering provider 0047 * events to the IW CM. Returns either 0 indicating the event was processed 0048 * or -errno if the event could not be processed. 0049 * 0050 * @cm_id: The IW CM identifier associated with the event. 0051 * @event: Pointer to the event structure. 0052 */ 0053 typedef int (*iw_event_handler)(struct iw_cm_id *cm_id, 0054 struct iw_cm_event *event); 0055 0056 struct iw_cm_id { 0057 iw_cm_handler cm_handler; /* client callback function */ 0058 void *context; /* client cb context */ 0059 struct ib_device *device; 0060 struct sockaddr_storage local_addr; /* local addr */ 0061 struct sockaddr_storage remote_addr; 0062 struct sockaddr_storage m_local_addr; /* nmapped local addr */ 0063 struct sockaddr_storage m_remote_addr; /* nmapped rem addr */ 0064 void *provider_data; /* provider private data */ 0065 iw_event_handler event_handler; /* cb for provider 0066 events */ 0067 /* Used by provider to add and remove refs on IW cm_id */ 0068 void (*add_ref)(struct iw_cm_id *); 0069 void (*rem_ref)(struct iw_cm_id *); 0070 u8 tos; 0071 bool tos_set:1; 0072 bool mapped:1; 0073 bool afonly:1; 0074 }; 0075 0076 struct iw_cm_conn_param { 0077 const void *private_data; 0078 u16 private_data_len; 0079 u32 ord; 0080 u32 ird; 0081 u32 qpn; 0082 }; 0083 0084 enum iw_flags { 0085 0086 /* 0087 * This flag allows the iwcm and iwpmd to still advertise 0088 * mappings but the real and mapped port numbers are the 0089 * same. Further, iwpmd will not bind any user socket to 0090 * reserve the port. This is required for soft iwarp 0091 * to play in the port mapped iwarp space. 0092 */ 0093 IW_F_NO_PORT_MAP = (1 << 0), 0094 }; 0095 0096 /** 0097 * iw_create_cm_id - Create an IW CM identifier. 0098 * 0099 * @device: The IB device on which to create the IW CM identier. 0100 * @event_handler: User callback invoked to report events associated with the 0101 * returned IW CM identifier. 0102 * @context: User specified context associated with the id. 0103 */ 0104 struct iw_cm_id *iw_create_cm_id(struct ib_device *device, 0105 iw_cm_handler cm_handler, void *context); 0106 0107 /** 0108 * iw_destroy_cm_id - Destroy an IW CM identifier. 0109 * 0110 * @cm_id: The previously created IW CM identifier to destroy. 0111 * 0112 * The client can assume that no events will be delivered for the CM ID after 0113 * this function returns. 0114 */ 0115 void iw_destroy_cm_id(struct iw_cm_id *cm_id); 0116 0117 /** 0118 * iw_cm_bind_qp - Unbind the specified IW CM identifier and QP 0119 * 0120 * @cm_id: The IW CM idenfier to unbind from the QP. 0121 * @qp: The QP 0122 * 0123 * This is called by the provider when destroying the QP to ensure 0124 * that any references held by the IWCM are released. It may also 0125 * be called by the IWCM when destroying a CM_ID to that any 0126 * references held by the provider are released. 0127 */ 0128 void iw_cm_unbind_qp(struct iw_cm_id *cm_id, struct ib_qp *qp); 0129 0130 /** 0131 * iw_cm_get_qp - Return the ib_qp associated with a QPN 0132 * 0133 * @ib_device: The IB device 0134 * @qpn: The queue pair number 0135 */ 0136 struct ib_qp *iw_cm_get_qp(struct ib_device *device, int qpn); 0137 0138 /** 0139 * iw_cm_listen - Listen for incoming connection requests on the 0140 * specified IW CM id. 0141 * 0142 * @cm_id: The IW CM identifier. 0143 * @backlog: The maximum number of outstanding un-accepted inbound listen 0144 * requests to queue. 0145 * 0146 * The source address and port number are specified in the IW CM identifier 0147 * structure. 0148 */ 0149 int iw_cm_listen(struct iw_cm_id *cm_id, int backlog); 0150 0151 /** 0152 * iw_cm_accept - Called to accept an incoming connect request. 0153 * 0154 * @cm_id: The IW CM identifier associated with the connection request. 0155 * @iw_param: Pointer to a structure containing connection establishment 0156 * parameters. 0157 * 0158 * The specified cm_id will have been provided in the event data for a 0159 * CONNECT_REQUEST event. Subsequent events related to this connection will be 0160 * delivered to the specified IW CM identifier prior and may occur prior to 0161 * the return of this function. If this function returns a non-zero value, the 0162 * client can assume that no events will be delivered to the specified IW CM 0163 * identifier. 0164 */ 0165 int iw_cm_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param); 0166 0167 /** 0168 * iw_cm_reject - Reject an incoming connection request. 0169 * 0170 * @cm_id: Connection identifier associated with the request. 0171 * @private_daa: Pointer to data to deliver to the remote peer as part of the 0172 * reject message. 0173 * @private_data_len: The number of bytes in the private_data parameter. 0174 * 0175 * The client can assume that no events will be delivered to the specified IW 0176 * CM identifier following the return of this function. The private_data 0177 * buffer is available for reuse when this function returns. 0178 */ 0179 int iw_cm_reject(struct iw_cm_id *cm_id, const void *private_data, 0180 u8 private_data_len); 0181 0182 /** 0183 * iw_cm_connect - Called to request a connection to a remote peer. 0184 * 0185 * @cm_id: The IW CM identifier for the connection. 0186 * @iw_param: Pointer to a structure containing connection establishment 0187 * parameters. 0188 * 0189 * Events may be delivered to the specified IW CM identifier prior to the 0190 * return of this function. If this function returns a non-zero value, the 0191 * client can assume that no events will be delivered to the specified IW CM 0192 * identifier. 0193 */ 0194 int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param); 0195 0196 /** 0197 * iw_cm_disconnect - Close the specified connection. 0198 * 0199 * @cm_id: The IW CM identifier to close. 0200 * @abrupt: If 0, the connection will be closed gracefully, otherwise, the 0201 * connection will be reset. 0202 * 0203 * The IW CM identifier is still active until the IW_CM_EVENT_CLOSE event is 0204 * delivered. 0205 */ 0206 int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrupt); 0207 0208 /** 0209 * iw_cm_init_qp_attr - Called to initialize the attributes of the QP 0210 * associated with a IW CM identifier. 0211 * 0212 * @cm_id: The IW CM identifier associated with the QP 0213 * @qp_attr: Pointer to the QP attributes structure. 0214 * @qp_attr_mask: Pointer to a bit vector specifying which QP attributes are 0215 * valid. 0216 */ 0217 int iw_cm_init_qp_attr(struct iw_cm_id *cm_id, struct ib_qp_attr *qp_attr, 0218 int *qp_attr_mask); 0219 0220 /** 0221 * iwcm_reject_msg - return a pointer to a reject message string. 0222 * @reason: Value returned in the REJECT event status field. 0223 */ 0224 const char *__attribute_const__ iwcm_reject_msg(int reason); 0225 0226 #endif /* IW_CM_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |