Lines Matching refs:qp

117 	struct rxe_qp *qp = from_timer(qp, t, retrans_timer);  in retransmit_timer()  local
119 rxe_dbg_qp(qp, "retransmit timer fired\n"); in retransmit_timer()
121 if (qp->valid) { in retransmit_timer()
122 qp->comp.timeout = 1; in retransmit_timer()
123 rxe_sched_task(&qp->comp.task); in retransmit_timer()
127 void rxe_comp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb) in rxe_comp_queue_pkt() argument
131 skb_queue_tail(&qp->resp_pkts, skb); in rxe_comp_queue_pkt()
133 must_sched = skb_queue_len(&qp->resp_pkts) > 1; in rxe_comp_queue_pkt()
138 rxe_sched_task(&qp->comp.task); in rxe_comp_queue_pkt()
140 rxe_run_task(&qp->comp.task); in rxe_comp_queue_pkt()
143 static inline enum comp_state get_wqe(struct rxe_qp *qp, in get_wqe() argument
152 wqe = queue_head(qp->sq.queue, QUEUE_TYPE_FROM_CLIENT); in get_wqe()
171 static inline void reset_retry_counters(struct rxe_qp *qp) in reset_retry_counters() argument
173 qp->comp.retry_cnt = qp->attr.retry_cnt; in reset_retry_counters()
174 qp->comp.rnr_retry = qp->attr.rnr_retry; in reset_retry_counters()
175 qp->comp.started_retry = 0; in reset_retry_counters()
178 static inline enum comp_state check_psn(struct rxe_qp *qp, in check_psn() argument
193 reset_retry_counters(qp); in check_psn()
201 diff = psn_compare(pkt->psn, qp->comp.psn); in check_psn()
209 (qp->comp.opcode == IB_OPCODE_RC_RDMA_READ_RESPONSE_FIRST || in check_psn()
210 qp->comp.opcode == IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE)) in check_psn()
221 static inline enum comp_state check_ack(struct rxe_qp *qp, in check_ack() argument
227 struct rxe_dev *rxe = to_rdev(qp->ibqp.device); in check_ack()
230 switch (qp->comp.opcode) { in check_ack()
287 reset_retry_counters(qp); in check_ack()
299 reset_retry_counters(qp); in check_ack()
306 reset_retry_counters(qp); in check_ack()
319 if (psn_compare(pkt->psn, qp->comp.psn) > 0) { in check_ack()
322 qp->comp.psn = pkt->psn; in check_ack()
323 if (qp->req.wait_psn) { in check_ack()
324 qp->req.wait_psn = 0; in check_ack()
325 rxe_run_task(&qp->req.task); in check_ack()
343 rxe_dbg_qp(qp, "unexpected nak %x\n", syn); in check_ack()
354 rxe_dbg_qp(qp, "unexpected opcode\n"); in check_ack()
360 static inline enum comp_state do_read(struct rxe_qp *qp, in do_read() argument
366 ret = copy_data(qp->pd, IB_ACCESS_LOCAL_WRITE, in do_read()
380 static inline enum comp_state do_atomic(struct rxe_qp *qp, in do_atomic() argument
388 ret = copy_data(qp->pd, IB_ACCESS_LOCAL_WRITE, in do_atomic()
399 static void make_send_cqe(struct rxe_qp *qp, struct rxe_send_wqe *wqe, in make_send_cqe() argument
407 if (!qp->is_user) { in make_send_cqe()
410 wc->qp = &qp->ibqp; in make_send_cqe()
414 uwc->qp_num = qp->ibqp.qp_num; in make_send_cqe()
418 if (!qp->is_user) { in make_send_cqe()
442 static void do_complete(struct rxe_qp *qp, struct rxe_send_wqe *wqe) in do_complete() argument
444 struct rxe_dev *rxe = to_rdev(qp->ibqp.device); in do_complete()
449 post = ((qp->sq_sig_type == IB_SIGNAL_ALL_WR) || in do_complete()
454 make_send_cqe(qp, wqe, &cqe); in do_complete()
456 queue_advance_consumer(qp->sq.queue, QUEUE_TYPE_FROM_CLIENT); in do_complete()
459 rxe_cq_post(qp->scq, &cqe, 0); in do_complete()
470 if (qp->req.wait_fence) { in do_complete()
471 qp->req.wait_fence = 0; in do_complete()
472 rxe_run_task(&qp->req.task); in do_complete()
476 static inline enum comp_state complete_ack(struct rxe_qp *qp, in complete_ack() argument
482 atomic_inc(&qp->req.rd_atomic); in complete_ack()
483 if (qp->req.need_rd_atomic) { in complete_ack()
484 qp->comp.timeout_retry = 0; in complete_ack()
485 qp->req.need_rd_atomic = 0; in complete_ack()
486 rxe_run_task(&qp->req.task); in complete_ack()
490 if (unlikely(qp->req.state == QP_STATE_DRAIN)) { in complete_ack()
492 spin_lock_bh(&qp->state_lock); in complete_ack()
493 if ((qp->req.state == QP_STATE_DRAIN) && in complete_ack()
494 (qp->comp.psn == qp->req.psn)) { in complete_ack()
495 qp->req.state = QP_STATE_DRAINED; in complete_ack()
496 spin_unlock_bh(&qp->state_lock); in complete_ack()
498 if (qp->ibqp.event_handler) { in complete_ack()
501 ev.device = qp->ibqp.device; in complete_ack()
502 ev.element.qp = &qp->ibqp; in complete_ack()
504 qp->ibqp.event_handler(&ev, in complete_ack()
505 qp->ibqp.qp_context); in complete_ack()
508 spin_unlock_bh(&qp->state_lock); in complete_ack()
512 do_complete(qp, wqe); in complete_ack()
514 if (psn_compare(pkt->psn, qp->comp.psn) >= 0) in complete_ack()
520 static inline enum comp_state complete_wqe(struct rxe_qp *qp, in complete_wqe() argument
525 if (psn_compare(wqe->last_psn, qp->comp.psn) >= 0) { in complete_wqe()
526 qp->comp.psn = (wqe->last_psn + 1) & BTH_PSN_MASK; in complete_wqe()
527 qp->comp.opcode = -1; in complete_wqe()
530 if (qp->req.wait_psn) { in complete_wqe()
531 qp->req.wait_psn = 0; in complete_wqe()
532 rxe_sched_task(&qp->req.task); in complete_wqe()
536 do_complete(qp, wqe); in complete_wqe()
541 static void rxe_drain_resp_pkts(struct rxe_qp *qp, bool notify) in rxe_drain_resp_pkts() argument
545 struct rxe_queue *q = qp->sq.queue; in rxe_drain_resp_pkts()
547 while ((skb = skb_dequeue(&qp->resp_pkts))) { in rxe_drain_resp_pkts()
548 rxe_put(qp); in rxe_drain_resp_pkts()
550 ib_device_put(qp->ibqp.device); in rxe_drain_resp_pkts()
556 do_complete(qp, wqe); in rxe_drain_resp_pkts()
566 struct rxe_qp *qp = pkt->qp; in free_pkt() local
567 struct ib_device *dev = qp->ibqp.device; in free_pkt()
570 rxe_put(qp); in free_pkt()
576 struct rxe_qp *qp = (struct rxe_qp *)arg; in rxe_completer() local
577 struct rxe_dev *rxe = to_rdev(qp->ibqp.device); in rxe_completer()
584 if (!rxe_get(qp)) in rxe_completer()
587 if (!qp->valid || qp->comp.state == QP_STATE_ERROR || in rxe_completer()
588 qp->comp.state == QP_STATE_RESET) { in rxe_completer()
589 rxe_drain_resp_pkts(qp, qp->valid && in rxe_completer()
590 qp->comp.state == QP_STATE_ERROR); in rxe_completer()
594 if (qp->comp.timeout) { in rxe_completer()
595 qp->comp.timeout_retry = 1; in rxe_completer()
596 qp->comp.timeout = 0; in rxe_completer()
598 qp->comp.timeout_retry = 0; in rxe_completer()
601 if (qp->req.need_retry) in rxe_completer()
607 rxe_dbg_qp(qp, "state = %s\n", comp_state_name[state]); in rxe_completer()
610 skb = skb_dequeue(&qp->resp_pkts); in rxe_completer()
613 qp->comp.timeout_retry = 0; in rxe_completer()
619 state = get_wqe(qp, pkt, &wqe); in rxe_completer()
623 state = check_psn(qp, pkt, wqe); in rxe_completer()
627 state = check_ack(qp, pkt, wqe); in rxe_completer()
631 state = do_read(qp, pkt, wqe); in rxe_completer()
635 state = do_atomic(qp, pkt, wqe); in rxe_completer()
647 state = complete_ack(qp, pkt, wqe); in rxe_completer()
651 state = complete_wqe(qp, pkt, wqe); in rxe_completer()
656 qp->comp.opcode = -1; in rxe_completer()
658 qp->comp.opcode = pkt->opcode; in rxe_completer()
660 if (psn_compare(pkt->psn, qp->comp.psn) >= 0) in rxe_completer()
661 qp->comp.psn = (pkt->psn + 1) & BTH_PSN_MASK; in rxe_completer()
663 if (qp->req.wait_psn) { in rxe_completer()
664 qp->req.wait_psn = 0; in rxe_completer()
665 rxe_sched_task(&qp->req.task); in rxe_completer()
675 if (qp->comp.timeout_retry && wqe) { in rxe_completer()
688 if ((qp_type(qp) == IB_QPT_RC) && in rxe_completer()
689 (qp->req.state == QP_STATE_READY) && in rxe_completer()
690 (psn_compare(qp->req.psn, qp->comp.psn) > 0) && in rxe_completer()
691 qp->qp_timeout_jiffies) in rxe_completer()
692 mod_timer(&qp->retrans_timer, in rxe_completer()
693 jiffies + qp->qp_timeout_jiffies); in rxe_completer()
712 if (qp->comp.started_retry && in rxe_completer()
713 !qp->comp.timeout_retry) in rxe_completer()
716 if (qp->comp.retry_cnt > 0) { in rxe_completer()
717 if (qp->comp.retry_cnt != 7) in rxe_completer()
718 qp->comp.retry_cnt--; in rxe_completer()
724 if (psn_compare(qp->req.psn, in rxe_completer()
725 qp->comp.psn) > 0) { in rxe_completer()
731 qp->req.need_retry = 1; in rxe_completer()
732 qp->comp.started_retry = 1; in rxe_completer()
733 rxe_run_task(&qp->req.task); in rxe_completer()
746 if (qp->comp.rnr_retry > 0) { in rxe_completer()
747 if (qp->comp.rnr_retry != 7) in rxe_completer()
748 qp->comp.rnr_retry--; in rxe_completer()
753 qp->req.wait_for_rnr_timer = 1; in rxe_completer()
754 rxe_dbg_qp(qp, "set rnr nak timer\n"); in rxe_completer()
755 mod_timer(&qp->rnr_nak_timer, in rxe_completer()
769 do_complete(qp, wqe); in rxe_completer()
770 rxe_qp_error(qp); in rxe_completer()
787 rxe_put(qp); in rxe_completer()