• Home
  • Raw
  • Download

Lines Matching refs:qp

48 int qib_make_uc_req(struct rvt_qp *qp, unsigned long *flags)  in qib_make_uc_req()  argument
50 struct qib_qp_priv *priv = qp->priv; in qib_make_uc_req()
56 u32 pmtu = qp->pmtu; in qib_make_uc_req()
59 if (!(ib_rvt_state_ops[qp->state] & RVT_PROCESS_SEND_OK)) { in qib_make_uc_req()
60 if (!(ib_rvt_state_ops[qp->state] & RVT_FLUSH_SEND)) in qib_make_uc_req()
63 if (qp->s_last == READ_ONCE(qp->s_head)) in qib_make_uc_req()
67 qp->s_flags |= RVT_S_WAIT_DMA; in qib_make_uc_req()
70 wqe = rvt_get_swqe_ptr(qp, qp->s_last); in qib_make_uc_req()
71 rvt_send_complete(qp, wqe, IB_WC_WR_FLUSH_ERR); in qib_make_uc_req()
76 if (rdma_ah_get_ah_flags(&qp->remote_ah_attr) & IB_AH_GRH) in qib_make_uc_req()
84 wqe = rvt_get_swqe_ptr(qp, qp->s_cur); in qib_make_uc_req()
85 qp->s_wqe = NULL; in qib_make_uc_req()
86 switch (qp->s_state) { in qib_make_uc_req()
88 if (!(ib_rvt_state_ops[qp->state] & in qib_make_uc_req()
92 if (qp->s_cur == READ_ONCE(qp->s_head)) in qib_make_uc_req()
97 qp->s_psn = wqe->psn; in qib_make_uc_req()
98 qp->s_sge.sge = wqe->sg_list[0]; in qib_make_uc_req()
99 qp->s_sge.sg_list = wqe->sg_list + 1; in qib_make_uc_req()
100 qp->s_sge.num_sge = wqe->wr.num_sge; in qib_make_uc_req()
101 qp->s_sge.total_len = wqe->length; in qib_make_uc_req()
103 qp->s_len = len; in qib_make_uc_req()
108 qp->s_state = OP(SEND_FIRST); in qib_make_uc_req()
113 qp->s_state = OP(SEND_ONLY); in qib_make_uc_req()
115 qp->s_state = in qib_make_uc_req()
123 qp->s_wqe = wqe; in qib_make_uc_req()
124 if (++qp->s_cur >= qp->s_size) in qib_make_uc_req()
125 qp->s_cur = 0; in qib_make_uc_req()
137 qp->s_state = OP(RDMA_WRITE_FIRST); in qib_make_uc_req()
142 qp->s_state = OP(RDMA_WRITE_ONLY); in qib_make_uc_req()
144 qp->s_state = in qib_make_uc_req()
152 qp->s_wqe = wqe; in qib_make_uc_req()
153 if (++qp->s_cur >= qp->s_size) in qib_make_uc_req()
154 qp->s_cur = 0; in qib_make_uc_req()
163 qp->s_state = OP(SEND_MIDDLE); in qib_make_uc_req()
166 len = qp->s_len; in qib_make_uc_req()
172 qp->s_state = OP(SEND_LAST); in qib_make_uc_req()
174 qp->s_state = OP(SEND_LAST_WITH_IMMEDIATE); in qib_make_uc_req()
181 qp->s_wqe = wqe; in qib_make_uc_req()
182 if (++qp->s_cur >= qp->s_size) in qib_make_uc_req()
183 qp->s_cur = 0; in qib_make_uc_req()
187 qp->s_state = OP(RDMA_WRITE_MIDDLE); in qib_make_uc_req()
190 len = qp->s_len; in qib_make_uc_req()
196 qp->s_state = OP(RDMA_WRITE_LAST); in qib_make_uc_req()
198 qp->s_state = in qib_make_uc_req()
206 qp->s_wqe = wqe; in qib_make_uc_req()
207 if (++qp->s_cur >= qp->s_size) in qib_make_uc_req()
208 qp->s_cur = 0; in qib_make_uc_req()
211 qp->s_len -= len; in qib_make_uc_req()
212 qp->s_hdrwords = hwords; in qib_make_uc_req()
213 qp->s_cur_sge = &qp->s_sge; in qib_make_uc_req()
214 qp->s_cur_size = len; in qib_make_uc_req()
215 qib_make_ruc_header(qp, ohdr, bth0 | (qp->s_state << 24), in qib_make_uc_req()
216 qp->s_psn++ & QIB_PSN_MASK); in qib_make_uc_req()
220 qp->s_flags &= ~RVT_S_BUSY; in qib_make_uc_req()
238 int has_grh, void *data, u32 tlen, struct rvt_qp *qp) in qib_uc_rcv() argument
246 u32 pmtu = qp->pmtu; in qib_uc_rcv()
260 if (qib_ruc_check_hdr(ibp, hdr, has_grh, qp, opcode)) in qib_uc_rcv()
267 if (unlikely(qib_cmp24(psn, qp->r_psn) != 0)) { in qib_uc_rcv()
272 qp->r_psn = psn; in qib_uc_rcv()
274 if (qp->r_state == OP(SEND_FIRST) || in qib_uc_rcv()
275 qp->r_state == OP(SEND_MIDDLE)) { in qib_uc_rcv()
276 set_bit(RVT_R_REWIND_SGE, &qp->r_aflags); in qib_uc_rcv()
277 qp->r_sge.num_sge = 0; in qib_uc_rcv()
279 rvt_put_ss(&qp->r_sge); in qib_uc_rcv()
280 qp->r_state = OP(SEND_LAST); in qib_uc_rcv()
298 switch (qp->r_state) { in qib_uc_rcv()
326 if (qp->state == IB_QPS_RTR && !(qp->r_flags & RVT_R_COMM_EST)) in qib_uc_rcv()
327 rvt_comm_est(qp); in qib_uc_rcv()
335 if (test_and_clear_bit(RVT_R_REWIND_SGE, &qp->r_aflags)) in qib_uc_rcv()
336 qp->r_sge = qp->s_rdma_read_sge; in qib_uc_rcv()
338 ret = rvt_get_rwqe(qp, false); in qib_uc_rcv()
347 qp->s_rdma_read_sge = qp->r_sge; in qib_uc_rcv()
349 qp->r_rcv_len = 0; in qib_uc_rcv()
359 qp->r_rcv_len += pmtu; in qib_uc_rcv()
360 if (unlikely(qp->r_rcv_len > qp->r_len)) in qib_uc_rcv()
362 rvt_copy_sge(qp, &qp->r_sge, data, pmtu, false, false); in qib_uc_rcv()
384 wc.byte_len = tlen + qp->r_rcv_len; in qib_uc_rcv()
385 if (unlikely(wc.byte_len > qp->r_len)) in qib_uc_rcv()
388 rvt_copy_sge(qp, &qp->r_sge, data, tlen, false, false); in qib_uc_rcv()
389 rvt_put_ss(&qp->s_rdma_read_sge); in qib_uc_rcv()
391 wc.wr_id = qp->r_wr_id; in qib_uc_rcv()
393 wc.qp = &qp->ibqp; in qib_uc_rcv()
394 wc.src_qp = qp->remote_qpn; in qib_uc_rcv()
395 wc.slid = rdma_ah_get_dlid(&qp->remote_ah_attr); in qib_uc_rcv()
396 wc.sl = rdma_ah_get_sl(&qp->remote_ah_attr); in qib_uc_rcv()
403 rvt_recv_cq(qp, &wc, ib_bth_is_solicited(ohdr)); in qib_uc_rcv()
410 if (unlikely(!(qp->qp_access_flags & in qib_uc_rcv()
416 qp->r_len = be32_to_cpu(reth->length); in qib_uc_rcv()
417 qp->r_rcv_len = 0; in qib_uc_rcv()
418 qp->r_sge.sg_list = NULL; in qib_uc_rcv()
419 if (qp->r_len != 0) { in qib_uc_rcv()
425 ok = rvt_rkey_ok(qp, &qp->r_sge.sge, qp->r_len, in qib_uc_rcv()
429 qp->r_sge.num_sge = 1; in qib_uc_rcv()
431 qp->r_sge.num_sge = 0; in qib_uc_rcv()
432 qp->r_sge.sge.mr = NULL; in qib_uc_rcv()
433 qp->r_sge.sge.vaddr = NULL; in qib_uc_rcv()
434 qp->r_sge.sge.length = 0; in qib_uc_rcv()
435 qp->r_sge.sge.sge_length = 0; in qib_uc_rcv()
448 qp->r_rcv_len += pmtu; in qib_uc_rcv()
449 if (unlikely(qp->r_rcv_len > qp->r_len)) in qib_uc_rcv()
451 rvt_copy_sge(qp, &qp->r_sge, data, pmtu, true, false); in qib_uc_rcv()
468 if (unlikely(tlen + qp->r_rcv_len != qp->r_len)) in qib_uc_rcv()
470 if (test_and_clear_bit(RVT_R_REWIND_SGE, &qp->r_aflags)) in qib_uc_rcv()
471 rvt_put_ss(&qp->s_rdma_read_sge); in qib_uc_rcv()
473 ret = rvt_get_rwqe(qp, true); in qib_uc_rcv()
479 wc.byte_len = qp->r_len; in qib_uc_rcv()
481 rvt_copy_sge(qp, &qp->r_sge, data, tlen, true, false); in qib_uc_rcv()
482 rvt_put_ss(&qp->r_sge); in qib_uc_rcv()
495 if (unlikely(tlen + qp->r_rcv_len != qp->r_len)) in qib_uc_rcv()
497 rvt_copy_sge(qp, &qp->r_sge, data, tlen, true, false); in qib_uc_rcv()
498 rvt_put_ss(&qp->r_sge); in qib_uc_rcv()
505 qp->r_psn++; in qib_uc_rcv()
506 qp->r_state = opcode; in qib_uc_rcv()
510 set_bit(RVT_R_REWIND_SGE, &qp->r_aflags); in qib_uc_rcv()
511 qp->r_sge.num_sge = 0; in qib_uc_rcv()
517 rvt_rc_error(qp, IB_WC_LOC_QP_OP_ERR); in qib_uc_rcv()