Lines Matching refs:ic

54 	struct rds_iw_connection *ic = conn->c_transport_data;
58 ic->i_flowctl = 1;
61 ic->i_flowctl = 0;
72 struct rds_iw_connection *ic = conn->c_transport_data;
86 rds_iwdev = ib_get_client_data(ic->i_cm_id->device, &rds_iw_client);
87 err = rds_iw_update_cm_id(rds_iwdev, ic->i_cm_id);
101 ic->i_flowctl ? ", flow control" : "");
111 struct rds_iw_connection *ic = conn->c_transport_data;
124 dp->dp_ack_seq = rds_iw_piggyb_ack(ic);
127 if (ic->i_flowctl) {
130 credits = IB_GET_POST_CREDITS(atomic_read(&ic->i_credits));
132 atomic_sub(IB_SET_POST_CREDITS(credits), &ic->i_credits);
148 struct rds_iw_connection *ic = conn->c_transport_data;
150 rdsdebug("conn %p ic %p event %u\n", conn, ic, event->event);
154 rdma_notify(ic->i_cm_id, IB_EVENT_COMM_EST);
247 struct rds_iw_connection *ic = conn->c_transport_data;
248 struct ib_device *dev = ic->i_cm_id->device;
267 ic->i_pd = rds_iwdev->pd;
268 ic->i_mr = rds_iwdev->mr;
271 &ic->i_send_ring, rds_iw_send_cq_comp_handler,
272 &ic->i_recv_ring, rds_iw_recv_cq_comp_handler,
277 ic->i_send_cq = attr.send_cq;
278 ic->i_recv_cq = attr.recv_cq;
280 ret = rdma_create_qp(ic->i_cm_id, ic->i_pd, &attr);
286 ic->i_send_hdrs = ib_dma_alloc_coherent(dev,
287 ic->i_send_ring.w_nr *
289 &ic->i_send_hdrs_dma, GFP_KERNEL);
290 if (ic->i_send_hdrs == NULL) {
296 ic->i_recv_hdrs = ib_dma_alloc_coherent(dev,
297 ic->i_recv_ring.w_nr *
299 &ic->i_recv_hdrs_dma, GFP_KERNEL);
300 if (ic->i_recv_hdrs == NULL) {
306 ic->i_ack = ib_dma_alloc_coherent(dev, sizeof(struct rds_header),
307 &ic->i_ack_dma, GFP_KERNEL);
308 if (ic->i_ack == NULL) {
314 ic->i_sends = vmalloc(ic->i_send_ring.w_nr * sizeof(struct rds_iw_send_work));
315 if (ic->i_sends == NULL) {
320 rds_iw_send_init_ring(ic);
322 ic->i_recvs = vmalloc(ic->i_recv_ring.w_nr * sizeof(struct rds_iw_recv_work));
323 if (ic->i_recvs == NULL) {
329 rds_iw_recv_init_ring(ic);
330 rds_iw_recv_init_ack(ic);
336 rdsdebug("conn %p pd %p mr %p cq %p %p\n", conn, ic->i_pd, ic->i_mr,
337 ic->i_send_cq, ic->i_recv_cq);
379 struct rds_iw_connection *ic = NULL;
424 ic = conn->c_transport_data;
435 BUG_ON(ic->i_cm_id);
437 ic->i_cm_id = cm_id;
441 ic->i_dma_local_lkey = rds_iwdev->dma_local_lkey;
475 struct rds_iw_connection *ic = conn->c_transport_data;
483 ic->i_flowctl = rds_iw_sysctl_flow_control; /* advertise flow control */
502 struct rds_iw_connection *ic = conn->c_transport_data;
504 if (ic->i_cm_id == cm_id)
512 struct rds_iw_connection *ic = conn->c_transport_data;
518 ic->i_cm_id = rdma_create_id(rds_rdma_cm_event_handler, conn,
520 if (IS_ERR(ic->i_cm_id)) {
521 ret = PTR_ERR(ic->i_cm_id);
522 ic->i_cm_id = NULL;
527 rdsdebug("created cm id %p for conn %p\n", ic->i_cm_id, conn);
534 ret = rdma_bind_addr(ic->i_cm_id, (struct sockaddr *) &src);
538 rdma_destroy_id(ic->i_cm_id);
539 ic->i_cm_id = NULL;
543 rds_iwdev = ib_get_client_data(ic->i_cm_id->device, &rds_iw_client);
544 ic->i_dma_local_lkey = rds_iwdev->dma_local_lkey;
550 ret = rdma_resolve_addr(ic->i_cm_id, (struct sockaddr *)&src,
554 rdsdebug("addr resolve failed for cm id %p: %d\n", ic->i_cm_id,
556 rdma_destroy_id(ic->i_cm_id);
557 ic->i_cm_id = NULL;
571 struct rds_iw_connection *ic = conn->c_transport_data;
575 rdsdebug("cm %p pd %p cq %p %p qp %p\n", ic->i_cm_id,
576 ic->i_pd, ic->i_send_cq, ic->i_recv_cq,
577 ic->i_cm_id ? ic->i_cm_id->qp : NULL);
579 if (ic->i_cm_id) {
580 struct ib_device *dev = ic->i_cm_id->device;
582 rdsdebug("disconnecting cm %p\n", ic->i_cm_id);
583 err = rdma_disconnect(ic->i_cm_id);
589 " cm: %p err %d\n", ic->i_cm_id, err);
592 if (ic->i_cm_id->qp) {
594 ib_modify_qp(ic->i_cm_id->qp, &qp_attr, IB_QP_STATE);
598 rds_iw_ring_empty(&ic->i_send_ring) &&
599 rds_iw_ring_empty(&ic->i_recv_ring));
601 if (ic->i_send_hdrs)
603 ic->i_send_ring.w_nr *
605 ic->i_send_hdrs,
606 ic->i_send_hdrs_dma);
608 if (ic->i_recv_hdrs)
610 ic->i_recv_ring.w_nr *
612 ic->i_recv_hdrs,
613 ic->i_recv_hdrs_dma);
615 if (ic->i_ack)
617 ic->i_ack, ic->i_ack_dma);
619 if (ic->i_sends)
620 rds_iw_send_clear_ring(ic);
621 if (ic->i_recvs)
622 rds_iw_recv_clear_ring(ic);
624 if (ic->i_cm_id->qp)
625 rdma_destroy_qp(ic->i_cm_id);
626 if (ic->i_send_cq)
627 ib_destroy_cq(ic->i_send_cq);
628 if (ic->i_recv_cq)
629 ib_destroy_cq(ic->i_recv_cq);
636 if (ic->rds_iwdev)
637 rds_iw_remove_conn(ic->rds_iwdev, conn);
639 rdma_destroy_id(ic->i_cm_id);
641 ic->i_cm_id = NULL;
642 ic->i_pd = NULL;
643 ic->i_mr = NULL;
644 ic->i_send_cq = NULL;
645 ic->i_recv_cq = NULL;
646 ic->i_send_hdrs = NULL;
647 ic->i_recv_hdrs = NULL;
648 ic->i_ack = NULL;
650 BUG_ON(ic->rds_iwdev);
653 if (ic->i_rm) {
654 rds_message_put(ic->i_rm);
655 ic->i_rm = NULL;
659 clear_bit(IB_ACK_IN_FLIGHT, &ic->i_ack_flags);
661 atomic64_set(&ic->i_ack_next, 0);
663 ic->i_ack_next = 0;
665 ic->i_ack_recv = 0;
668 ic->i_flowctl = 0;
669 atomic_set(&ic->i_credits, 0);
671 rds_iw_ring_init(&ic->i_send_ring, rds_iw_sysctl_max_send_wr);
672 rds_iw_ring_init(&ic->i_recv_ring, rds_iw_sysctl_max_recv_wr);
674 if (ic->i_iwinc) {
675 rds_inc_put(&ic->i_iwinc->ii_inc);
676 ic->i_iwinc = NULL;
679 vfree(ic->i_sends);
680 ic->i_sends = NULL;
681 vfree(ic->i_recvs);
682 ic->i_recvs = NULL;
688 struct rds_iw_connection *ic;
691 ic = kzalloc(sizeof(struct rds_iw_connection), GFP_KERNEL);
692 if (ic == NULL)
695 INIT_LIST_HEAD(&ic->iw_node);
696 tasklet_init(&ic->i_recv_tasklet, rds_iw_recv_tasklet_fn,
697 (unsigned long) ic);
698 mutex_init(&ic->i_recv_mutex);
700 spin_lock_init(&ic->i_ack_lock);
707 rds_iw_ring_init(&ic->i_send_ring, rds_iw_sysctl_max_send_wr);
708 rds_iw_ring_init(&ic->i_recv_ring, rds_iw_sysctl_max_recv_wr);
710 ic->conn = conn;
711 conn->c_transport_data = ic;
714 list_add_tail(&ic->iw_node, &iw_nodev_conns);
718 rdsdebug("conn %p conn ic %p\n", conn, conn->c_transport_data);
727 struct rds_iw_connection *ic = arg;
730 rdsdebug("ic %p\n", ic);
737 lock_ptr = ic->rds_iwdev ? &ic->rds_iwdev->spinlock : &iw_nodev_conns_lock;
740 list_del(&ic->iw_node);
743 kfree(ic);