Lines Matching refs:conn

74 static void rds_ib_set_protocol(struct rds_connection *conn, unsigned int version)  in rds_ib_set_protocol()  argument
76 conn->c_version = version; in rds_ib_set_protocol()
82 static void rds_ib_set_flow_control(struct rds_connection *conn, u32 credits) in rds_ib_set_flow_control() argument
84 struct rds_ib_connection *ic = conn->c_transport_data; in rds_ib_set_flow_control()
89 rds_ib_send_add_credits(conn, credits); in rds_ib_set_flow_control()
124 void rds_ib_cm_connect_complete(struct rds_connection *conn, struct rdma_cm_event *event) in rds_ib_cm_connect_complete() argument
127 struct rds_ib_connection *ic = conn->c_transport_data; in rds_ib_cm_connect_complete()
131 if (event->param.conn.private_data_len >= sizeof(*dp)) { in rds_ib_cm_connect_complete()
132 dp = event->param.conn.private_data; in rds_ib_cm_connect_complete()
136 rds_ib_set_protocol(conn, in rds_ib_cm_connect_complete()
139 rds_ib_set_flow_control(conn, be32_to_cpu(dp->dp_credit)); in rds_ib_cm_connect_complete()
143 if (conn->c_version < RDS_PROTOCOL(3,1)) { in rds_ib_cm_connect_complete()
146 &conn->c_faddr, in rds_ib_cm_connect_complete()
147 RDS_PROTOCOL_MAJOR(conn->c_version), in rds_ib_cm_connect_complete()
148 RDS_PROTOCOL_MINOR(conn->c_version)); in rds_ib_cm_connect_complete()
149 rds_conn_destroy(conn); in rds_ib_cm_connect_complete()
153 &conn->c_faddr, in rds_ib_cm_connect_complete()
154 RDS_PROTOCOL_MAJOR(conn->c_version), in rds_ib_cm_connect_complete()
155 RDS_PROTOCOL_MINOR(conn->c_version), in rds_ib_cm_connect_complete()
167 rds_ib_recv_refill(conn, 1); in rds_ib_cm_connect_complete()
178 err = rds_ib_update_ipaddr(ic->rds_ibdev, conn->c_laddr); in rds_ib_cm_connect_complete()
186 rds_send_drop_acked(conn, be64_to_cpu(dp->dp_ack_seq), NULL); in rds_ib_cm_connect_complete()
188 rds_connect_complete(conn); in rds_ib_cm_connect_complete()
191 static void rds_ib_cm_fill_conn_param(struct rds_connection *conn, in rds_ib_cm_fill_conn_param() argument
198 struct rds_ib_connection *ic = conn->c_transport_data; in rds_ib_cm_fill_conn_param()
212 dp->dp_saddr = conn->c_laddr; in rds_ib_cm_fill_conn_param()
213 dp->dp_daddr = conn->c_faddr; in rds_ib_cm_fill_conn_param()
241 struct rds_connection *conn = data; in rds_ib_qp_event_handler() local
242 struct rds_ib_connection *ic = conn->c_transport_data; in rds_ib_qp_event_handler()
244 rdsdebug("conn %p ic %p event %u (%s)\n", conn, ic, event->event, in rds_ib_qp_event_handler()
255 &conn->c_laddr, &conn->c_faddr); in rds_ib_qp_event_handler()
256 rds_conn_drop(conn); in rds_ib_qp_event_handler()
265 static int rds_ib_setup_qp(struct rds_connection *conn) in rds_ib_setup_qp() argument
267 struct rds_ib_connection *ic = conn->c_transport_data; in rds_ib_setup_qp()
282 rds_ib_add_conn(rds_ibdev, conn); in rds_ib_setup_qp()
294 rds_ib_cq_event_handler, conn, in rds_ib_setup_qp()
304 rds_ib_cq_event_handler, conn, in rds_ib_setup_qp()
328 attr.qp_context = conn; in rds_ib_setup_qp()
397 rdsdebug("conn %p pd %p mr %p cq %p %p\n", conn, ic->i_pd, ic->i_mr, in rds_ib_setup_qp()
407 const struct rds_ib_connect_private *dp = event->param.conn.private_data; in rds_ib_protocol_compatible()
422 if (!event->param.conn.private_data_len) { in rds_ib_protocol_compatible()
429 if (event->param.conn.private_data_len < sizeof (*dp) || in rds_ib_protocol_compatible()
453 const struct rds_ib_connect_private *dp = event->param.conn.private_data; in rds_ib_cm_handle_connect()
455 struct rds_connection *conn = NULL; in rds_ib_cm_handle_connect() local
472 conn = rds_conn_create(dp->dp_daddr, dp->dp_saddr, &rds_ib_transport, in rds_ib_cm_handle_connect()
474 if (IS_ERR(conn)) { in rds_ib_cm_handle_connect()
475 rdsdebug("rds_conn_create failed (%ld)\n", PTR_ERR(conn)); in rds_ib_cm_handle_connect()
476 conn = NULL; in rds_ib_cm_handle_connect()
487 mutex_lock(&conn->c_cm_lock); in rds_ib_cm_handle_connect()
488 if (!rds_conn_transition(conn, RDS_CONN_DOWN, RDS_CONN_CONNECTING)) { in rds_ib_cm_handle_connect()
489 if (rds_conn_state(conn) == RDS_CONN_UP) { in rds_ib_cm_handle_connect()
491 rds_conn_drop(conn); in rds_ib_cm_handle_connect()
494 if (rds_conn_state(conn) == RDS_CONN_CONNECTING) { in rds_ib_cm_handle_connect()
501 ic = conn->c_transport_data; in rds_ib_cm_handle_connect()
503 rds_ib_set_protocol(conn, version); in rds_ib_cm_handle_connect()
504 rds_ib_set_flow_control(conn, be32_to_cpu(dp->dp_credit)); in rds_ib_cm_handle_connect()
509 rds_send_drop_acked(conn, be64_to_cpu(dp->dp_ack_seq), NULL); in rds_ib_cm_handle_connect()
515 cm_id->context = conn; in rds_ib_cm_handle_connect()
521 err = rds_ib_setup_qp(conn); in rds_ib_cm_handle_connect()
523 rds_ib_conn_error(conn, "rds_ib_setup_qp failed (%d)\n", err); in rds_ib_cm_handle_connect()
527 rds_ib_cm_fill_conn_param(conn, &conn_param, &dp_rep, version, in rds_ib_cm_handle_connect()
528 event->param.conn.responder_resources, in rds_ib_cm_handle_connect()
529 event->param.conn.initiator_depth); in rds_ib_cm_handle_connect()
534 rds_ib_conn_error(conn, "rdma_accept failed (%d)\n", err); in rds_ib_cm_handle_connect()
537 if (conn) in rds_ib_cm_handle_connect()
538 mutex_unlock(&conn->c_cm_lock); in rds_ib_cm_handle_connect()
547 struct rds_connection *conn = cm_id->context; in rds_ib_cm_initiate_connect() local
548 struct rds_ib_connection *ic = conn->c_transport_data; in rds_ib_cm_initiate_connect()
555 rds_ib_set_protocol(conn, RDS_PROTOCOL_3_0); in rds_ib_cm_initiate_connect()
558 ret = rds_ib_setup_qp(conn); in rds_ib_cm_initiate_connect()
560 rds_ib_conn_error(conn, "rds_ib_setup_qp failed (%d)\n", ret); in rds_ib_cm_initiate_connect()
564 rds_ib_cm_fill_conn_param(conn, &conn_param, &dp, RDS_PROTOCOL_VERSION, in rds_ib_cm_initiate_connect()
568 rds_ib_conn_error(conn, "rdma_connect failed (%d)\n", ret); in rds_ib_cm_initiate_connect()
581 int rds_ib_conn_connect(struct rds_connection *conn) in rds_ib_conn_connect() argument
583 struct rds_ib_connection *ic = conn->c_transport_data; in rds_ib_conn_connect()
589 ic->i_cm_id = rdma_create_id(rds_rdma_cm_event_handler, conn, in rds_ib_conn_connect()
598 rdsdebug("created cm id %p for conn %p\n", ic->i_cm_id, conn); in rds_ib_conn_connect()
601 src.sin_addr.s_addr = (__force u32)conn->c_laddr; in rds_ib_conn_connect()
605 dest.sin_addr.s_addr = (__force u32)conn->c_faddr; in rds_ib_conn_connect()
627 void rds_ib_conn_shutdown(struct rds_connection *conn) in rds_ib_conn_shutdown() argument
629 struct rds_ib_connection *ic = conn->c_transport_data; in rds_ib_conn_shutdown()
698 rds_ib_remove_conn(ic->rds_ibdev, conn); in rds_ib_conn_shutdown()
747 int rds_ib_conn_alloc(struct rds_connection *conn, gfp_t gfp) in rds_ib_conn_alloc() argument
780 ic->conn = conn; in rds_ib_conn_alloc()
781 conn->c_transport_data = ic; in rds_ib_conn_alloc()
788 rdsdebug("conn %p conn ic %p\n", conn, conn->c_transport_data); in rds_ib_conn_alloc()
823 __rds_ib_conn_error(struct rds_connection *conn, const char *fmt, ...) in __rds_ib_conn_error() argument
827 rds_conn_drop(conn); in __rds_ib_conn_error()