63 "%s - Unable to convert CM status: %d\n",
69 static const char* to_event_str(
int event)
71 static const char* event_str[] = {
72 "CCAE_REMOTE_SHUTDOWN",
73 "CCAE_ACTIVE_CONNECT_RESULTS",
74 "CCAE_CONNECTION_REQUEST",
75 "CCAE_LLP_CLOSE_COMPLETE",
76 "CCAE_TERMINATE_MESSAGE_RECEIVED",
77 "CCAE_LLP_CONNECTION_RESET",
78 "CCAE_LLP_CONNECTION_LOST",
79 "CCAE_LLP_SEGMENT_SIZE_INVALID",
80 "CCAE_LLP_INVALID_CRC",
82 "CCAE_INVALID_DDP_VERSION",
83 "CCAE_INVALID_RDMA_VERSION",
84 "CCAE_UNEXPECTED_OPCODE",
85 "CCAE_INVALID_DDP_QUEUE_NUMBER",
86 "CCAE_RDMA_READ_NOT_ENABLED",
87 "CCAE_RDMA_WRITE_NOT_ENABLED",
88 "CCAE_RDMA_READ_TOO_SMALL",
90 "CCAE_TAGGED_INVALID_STAG",
91 "CCAE_TAGGED_BASE_BOUNDS_VIOLATION",
92 "CCAE_TAGGED_ACCESS_RIGHTS_VIOLATION",
93 "CCAE_TAGGED_INVALID_PD",
97 "CCAE_INVALID_MSN_RANGE",
98 "CCAE_INVALID_MSN_GAP",
101 "CCAE_IRRQ_MSN_RANGE",
102 "CCAE_IRRQ_INVALID_STAG",
103 "CCAE_IRRQ_BASE_BOUNDS_VIOLATION",
104 "CCAE_IRRQ_ACCESS_RIGHTS_VIOLATION",
105 "CCAE_IRRQ_INVALID_PD",
106 "CCAE_IRRQ_WRAP_ERROR",
107 "CCAE_CQ_SQ_COMPLETION_OVERFLOW",
108 "CCAE_CQ_RQ_COMPLETION_ERROR",
109 "CCAE_QP_SRQ_WQE_ERROR",
110 "CCAE_QP_LOCAL_CATASTROPHIC_ERROR",
112 "CCAE_CQ_OPERATION_ERROR",
113 "CCAE_SRQ_LIMIT_REACHED",
114 "CCAE_QP_RQ_LIMIT_REACHED",
115 "CCAE_SRQ_CATASTROPHIC_ERROR",
116 "CCAE_RNIC_CATASTROPHIC_ERROR"
121 return "<invalid event>";
124 return event_str[
event];
127 static const char *to_qp_state_str(
int state)
131 return "C2_QP_STATE_IDLE";
133 return "C2_QP_STATE_CONNECTING";
135 return "C2_QP_STATE_RTS";
137 return "C2_QP_STATE_CLOSING";
139 return "C2_QP_STATE_TERMINATE";
141 return "C2_QP_STATE_ERROR";
143 return "<invalid QP state>";
151 void *resource_user_context;
166 memset(&ib_event, 0,
sizeof(ib_event));
167 memset(&cm_event, 0,
sizeof(cm_event));
169 event_id = c2_wr_get_id(wr);
171 resource_user_context =
172 (
void *) (
unsigned long) wr->
ae.
ae_generic.user_context;
174 status = cm_event.
status = c2_convert_cm_status(c2_wr_get_result(wr));
176 pr_debug(
"event received c2_dev=%p, event_id=%d, "
177 "resource_indicator=%d, user_context=%p, status = %d\n",
178 c2dev, event_id, resource_indicator, resource_user_context,
181 switch (resource_indicator) {
184 struct c2_qp *qp = (
struct c2_qp *)resource_user_context;
189 pr_debug(
"event received, but cm_id is <nul>, qp=%p!\n",
193 pr_debug(
"%s: event = %s, user_context=%llx, "
195 "resource=%x, qp_state=%s\n",
197 to_event_str(event_id),
223 spin_unlock_irqrestore(&qp->
lock, flags);
236 if (qp->
ibqp.event_handler)
237 qp->
ibqp.event_handler(&ib_event,
252 spin_unlock_irqrestore(&qp->
lock, flags);
260 pr_debug(
"%s:%d Unexpected event_id=%d on QP=%p, "
263 event_id, qp, cm_id);
274 (
struct iw_cm_id *)resource_user_context;
276 pr_debug(
"C2_RES_IND_EP event_id=%d\n", event_id);
278 pr_debug(
"%s: Invalid event_id: %d\n",
295 cm_event.
ird = cm_event.
ord = 128;
304 (
struct c2_cq *) resource_user_context;
311 if (cq->
ibcq.event_handler)
312 cq->
ibcq.event_handler(&ib_event,
313 cq->
ibcq.cq_context);
317 printk(
"Bad resource indicator = %d\n",