33 #include <linux/kernel.h>
35 #include <linux/slab.h>
78 dp =
event->param.conn.private_data;
80 rds_iw_set_protocol(conn,
107 static void rds_iw_cm_fill_conn_param(
struct rds_connection *conn,
120 memset(dp, 0,
sizeof(*dp));
130 unsigned int credits;
144 rdsdebug(
"event %u data %p\n", event->
event, data);
152 rdsdebug(
"conn %p ic %p event %u\n", conn, ic, event->
event);
154 switch (event->
event) {
161 rdsdebug(
"Fatal QP Event %u "
162 "- connection %pI4->%pI4, reconnecting\n",
176 void (*send_cq_handler)(
struct ib_cq *,
void *),
178 void (*recv_cq_handler)(
struct ib_cq *,
void *),
182 unsigned int send_size, recv_size;
191 memset(attr, 0,
sizeof(*attr));
194 attr->
cap.max_send_wr = send_size;
195 attr->
cap.max_recv_wr = recv_size;
202 rds_iw_cq_event_handler,
203 context, send_size, 0);
207 rdsdebug(
"ib_create_cq send failed: %d\n", ret);
212 rds_iw_cq_event_handler,
213 context, recv_size, 0);
217 rdsdebug(
"ib_create_cq send failed: %d\n", ret);
223 rdsdebug(
"ib_req_notify_cq send failed: %d\n", ret);
229 rdsdebug(
"ib_req_notify_cq recv failed: %d\n", ret);
271 ret = rds_iw_init_qp_attrs(&attr, rds_iwdev,
287 rdsdebug(
"rdma_create_qp failed: %d\n", ret);
297 rdsdebug(
"ib_dma_alloc_coherent send failed\n");
307 rdsdebug(
"ib_dma_alloc_coherent recv failed\n");
315 rdsdebug(
"ib_dma_alloc_coherent ack failed\n");
322 rdsdebug(
"send allocation failed\n");
330 rdsdebug(
"recv allocation failed\n");
341 rdsdebug(
"conn %p pd %p mr %p cq %p %p\n", conn, ic->
i_pd, ic->
i_mr,
366 while ((common >>= 1) != 0)
370 "incompatible protocol version %u.%u\n",
390 version = rds_iw_protocol_compatible(dp);
394 rdsdebug(
"saddr %pI4 daddr %pI4 RDSv%u.%u\n",
401 rdsdebug(
"rds_conn_create failed (%ld)\n", PTR_ERR(conn));
416 rdsdebug(
"incoming connect while connecting\n");
430 rds_iw_set_protocol(conn, version);
451 err = rds_iw_setup_qp(conn);
458 rds_iw_cm_fill_conn_param(conn, &conn_param, &dp_rep, version);
489 ret = rds_iw_setup_qp(conn);
528 rdsdebug(
"rdma_create_id() failed: %d\n", ret);
532 rdsdebug(
"created cm id %p for conn %p\n", ic->
i_cm_id, conn);
541 rdsdebug(
"rdma_bind_addr(%pI4) failed: %d\n",
559 rdsdebug(
"addr resolve failed for cm id %p: %d\n", ic->
i_cm_id,
580 rdsdebug(
"cm %p pd %p cq %p %p qp %p\n", ic->
i_cm_id,
587 rdsdebug(
"disconnecting cm %p\n", ic->
i_cm_id);
593 rdsdebug(
"rds_iw_conn_shutdown: failed to disconnect,"
594 " cm: %p err %d\n", ic->
i_cm_id, err);
607 ib_dma_free_coherent(dev,
614 ib_dma_free_coherent(dev,
621 ib_dma_free_coherent(dev,
sizeof(
struct rds_header),
665 #ifdef KERNEL_HAS_ATOMIC64
688 rdsdebug(
"shutdown complete\n");
705 #ifndef KERNEL_HAS_ATOMIC64
736 rdsdebug(
"ic %p\n", ic);
745 spin_lock_irq(lock_ptr);
747 spin_unlock_irq(lock_ptr);