Lines Matching refs:qp

46 int ipath_make_uc_req(struct ipath_qp *qp)  in ipath_make_uc_req()  argument
54 u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); in ipath_make_uc_req()
57 spin_lock_irqsave(&qp->s_lock, flags); in ipath_make_uc_req()
59 if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK)) { in ipath_make_uc_req()
60 if (!(ib_ipath_state_ops[qp->state] & IPATH_FLUSH_SEND)) in ipath_make_uc_req()
63 if (qp->s_last == qp->s_head) in ipath_make_uc_req()
66 if (atomic_read(&qp->s_dma_busy)) { in ipath_make_uc_req()
67 qp->s_flags |= IPATH_S_WAIT_DMA; in ipath_make_uc_req()
70 wqe = get_swqe_ptr(qp, qp->s_last); in ipath_make_uc_req()
71 ipath_send_complete(qp, wqe, IB_WC_WR_FLUSH_ERR); in ipath_make_uc_req()
75 ohdr = &qp->s_hdr.u.oth; in ipath_make_uc_req()
76 if (qp->remote_ah_attr.ah_flags & IB_AH_GRH) in ipath_make_uc_req()
77 ohdr = &qp->s_hdr.u.l.oth; in ipath_make_uc_req()
84 wqe = get_swqe_ptr(qp, qp->s_cur); in ipath_make_uc_req()
85 qp->s_wqe = NULL; in ipath_make_uc_req()
86 switch (qp->s_state) { in ipath_make_uc_req()
88 if (!(ib_ipath_state_ops[qp->state] & in ipath_make_uc_req()
92 if (qp->s_cur == qp->s_head) in ipath_make_uc_req()
97 qp->s_psn = wqe->psn = qp->s_next_psn; in ipath_make_uc_req()
98 qp->s_sge.sge = wqe->sg_list[0]; in ipath_make_uc_req()
99 qp->s_sge.sg_list = wqe->sg_list + 1; in ipath_make_uc_req()
100 qp->s_sge.num_sge = wqe->wr.num_sge; in ipath_make_uc_req()
101 qp->s_len = len = wqe->length; in ipath_make_uc_req()
106 qp->s_state = OP(SEND_FIRST); in ipath_make_uc_req()
111 qp->s_state = OP(SEND_ONLY); in ipath_make_uc_req()
113 qp->s_state = in ipath_make_uc_req()
121 qp->s_wqe = wqe; in ipath_make_uc_req()
122 if (++qp->s_cur >= qp->s_size) in ipath_make_uc_req()
123 qp->s_cur = 0; in ipath_make_uc_req()
135 qp->s_state = OP(RDMA_WRITE_FIRST); in ipath_make_uc_req()
140 qp->s_state = OP(RDMA_WRITE_ONLY); in ipath_make_uc_req()
142 qp->s_state = in ipath_make_uc_req()
150 qp->s_wqe = wqe; in ipath_make_uc_req()
151 if (++qp->s_cur >= qp->s_size) in ipath_make_uc_req()
152 qp->s_cur = 0; in ipath_make_uc_req()
161 qp->s_state = OP(SEND_MIDDLE); in ipath_make_uc_req()
164 len = qp->s_len; in ipath_make_uc_req()
170 qp->s_state = OP(SEND_LAST); in ipath_make_uc_req()
172 qp->s_state = OP(SEND_LAST_WITH_IMMEDIATE); in ipath_make_uc_req()
179 qp->s_wqe = wqe; in ipath_make_uc_req()
180 if (++qp->s_cur >= qp->s_size) in ipath_make_uc_req()
181 qp->s_cur = 0; in ipath_make_uc_req()
185 qp->s_state = OP(RDMA_WRITE_MIDDLE); in ipath_make_uc_req()
188 len = qp->s_len; in ipath_make_uc_req()
194 qp->s_state = OP(RDMA_WRITE_LAST); in ipath_make_uc_req()
196 qp->s_state = in ipath_make_uc_req()
204 qp->s_wqe = wqe; in ipath_make_uc_req()
205 if (++qp->s_cur >= qp->s_size) in ipath_make_uc_req()
206 qp->s_cur = 0; in ipath_make_uc_req()
209 qp->s_len -= len; in ipath_make_uc_req()
210 qp->s_hdrwords = hwords; in ipath_make_uc_req()
211 qp->s_cur_sge = &qp->s_sge; in ipath_make_uc_req()
212 qp->s_cur_size = len; in ipath_make_uc_req()
213 ipath_make_ruc_header(to_idev(qp->ibqp.device), in ipath_make_uc_req()
214 qp, ohdr, bth0 | (qp->s_state << 24), in ipath_make_uc_req()
215 qp->s_next_psn++ & IPATH_PSN_MASK); in ipath_make_uc_req()
221 qp->s_flags &= ~IPATH_S_BUSY; in ipath_make_uc_req()
223 spin_unlock_irqrestore(&qp->s_lock, flags); in ipath_make_uc_req()
241 int has_grh, void *data, u32 tlen, struct ipath_qp *qp) in ipath_uc_rcv() argument
249 u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); in ipath_uc_rcv()
254 if (unlikely(be16_to_cpu(hdr->lrh[3]) != qp->remote_ah_attr.dlid)) in ipath_uc_rcv()
288 if (unlikely(ipath_cmp24(psn, qp->r_psn) != 0)) { in ipath_uc_rcv()
293 qp->r_psn = psn; in ipath_uc_rcv()
295 qp->r_state = OP(SEND_LAST); in ipath_uc_rcv()
314 switch (qp->r_state) { in ipath_uc_rcv()
348 if (qp->r_flags & IPATH_R_REUSE_SGE) { in ipath_uc_rcv()
349 qp->r_flags &= ~IPATH_R_REUSE_SGE; in ipath_uc_rcv()
350 qp->r_sge = qp->s_rdma_read_sge; in ipath_uc_rcv()
351 } else if (!ipath_get_rwqe(qp, 0)) { in ipath_uc_rcv()
356 qp->s_rdma_read_sge = qp->r_sge; in ipath_uc_rcv()
357 qp->r_rcv_len = 0; in ipath_uc_rcv()
366 qp->r_flags |= IPATH_R_REUSE_SGE; in ipath_uc_rcv()
370 qp->r_rcv_len += pmtu; in ipath_uc_rcv()
371 if (unlikely(qp->r_rcv_len > qp->r_len)) { in ipath_uc_rcv()
372 qp->r_flags |= IPATH_R_REUSE_SGE; in ipath_uc_rcv()
376 ipath_copy_sge(&qp->r_sge, data, pmtu); in ipath_uc_rcv()
398 qp->r_flags |= IPATH_R_REUSE_SGE; in ipath_uc_rcv()
404 wc.byte_len = tlen + qp->r_rcv_len; in ipath_uc_rcv()
405 if (unlikely(wc.byte_len > qp->r_len)) { in ipath_uc_rcv()
406 qp->r_flags |= IPATH_R_REUSE_SGE; in ipath_uc_rcv()
412 ipath_copy_sge(&qp->r_sge, data, tlen); in ipath_uc_rcv()
413 wc.wr_id = qp->r_wr_id; in ipath_uc_rcv()
415 wc.qp = &qp->ibqp; in ipath_uc_rcv()
416 wc.src_qp = qp->remote_qpn; in ipath_uc_rcv()
417 wc.slid = qp->remote_ah_attr.dlid; in ipath_uc_rcv()
418 wc.sl = qp->remote_ah_attr.sl; in ipath_uc_rcv()
420 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, in ipath_uc_rcv()
437 qp->r_len = be32_to_cpu(reth->length); in ipath_uc_rcv()
438 qp->r_rcv_len = 0; in ipath_uc_rcv()
439 if (qp->r_len != 0) { in ipath_uc_rcv()
445 ok = ipath_rkey_ok(qp, &qp->r_sge, qp->r_len, in ipath_uc_rcv()
453 qp->r_sge.sg_list = NULL; in ipath_uc_rcv()
454 qp->r_sge.sge.mr = NULL; in ipath_uc_rcv()
455 qp->r_sge.sge.vaddr = NULL; in ipath_uc_rcv()
456 qp->r_sge.sge.length = 0; in ipath_uc_rcv()
457 qp->r_sge.sge.sge_length = 0; in ipath_uc_rcv()
459 if (unlikely(!(qp->qp_access_flags & in ipath_uc_rcv()
475 qp->r_rcv_len += pmtu; in ipath_uc_rcv()
476 if (unlikely(qp->r_rcv_len > qp->r_len)) { in ipath_uc_rcv()
480 ipath_copy_sge(&qp->r_sge, data, pmtu); in ipath_uc_rcv()
505 if (unlikely(tlen + qp->r_rcv_len != qp->r_len)) { in ipath_uc_rcv()
509 if (qp->r_flags & IPATH_R_REUSE_SGE) in ipath_uc_rcv()
510 qp->r_flags &= ~IPATH_R_REUSE_SGE; in ipath_uc_rcv()
511 else if (!ipath_get_rwqe(qp, 1)) { in ipath_uc_rcv()
515 wc.byte_len = qp->r_len; in ipath_uc_rcv()
531 if (unlikely(tlen + qp->r_rcv_len != qp->r_len)) { in ipath_uc_rcv()
535 ipath_copy_sge(&qp->r_sge, data, tlen); in ipath_uc_rcv()
543 qp->r_psn++; in ipath_uc_rcv()
544 qp->r_state = opcode; in ipath_uc_rcv()