Lines Matching full:qp

13 #include "qp.h"
23 * @sqp: the sending QP
36 struct rvt_qp *qp; in ud_loopback() local
47 qp = rvt_lookup_qpn(ib_to_rvt(sqp->ibqp.device), &ibp->rvp, in ud_loopback()
49 if (!qp) { in ud_loopback()
57 dqptype = qp->ibqp.qp_type == IB_QPT_GSI ? in ud_loopback()
58 IB_QPT_UD : qp->ibqp.qp_type; in ud_loopback()
61 !(ib_rvt_state_ops[qp->state] & RVT_PROCESS_RECV_OK)) { in ud_loopback()
69 if (qp->ibqp.qp_num > 1) { in ud_loopback()
78 qp->s_pkey_index, in ud_loopback()
82 sqp->ibqp.qp_num, qp->ibqp.qp_num, in ud_loopback()
91 * qkey from the QP context instead of the WR (see 10.2.5). in ud_loopback()
93 if (qp->ibqp.qp_num) { in ud_loopback()
98 if (unlikely(qkey != qp->qkey)) in ud_loopback()
115 spin_lock_irqsave(&qp->r_lock, flags); in ud_loopback()
120 if (qp->r_flags & RVT_R_REUSE_SGE) { in ud_loopback()
121 qp->r_flags &= ~RVT_R_REUSE_SGE; in ud_loopback()
125 ret = rvt_get_rwqe(qp, false); in ud_loopback()
127 rvt_rc_error(qp, IB_WC_LOC_QP_OP_ERR); in ud_loopback()
131 if (qp->ibqp.qp_num == 0) in ud_loopback()
137 if (unlikely(wc.byte_len > qp->r_len)) { in ud_loopback()
138 qp->r_flags |= RVT_R_REUSE_SGE; in ud_loopback()
172 rvt_copy_sge(qp, &qp->r_sge, &grh, in ud_loopback()
176 rvt_skip_sge(&qp->r_sge, sizeof(struct ib_grh), true); in ud_loopback()
186 rvt_copy_sge(qp, &qp->r_sge, sge->vaddr, len, true, false); in ud_loopback()
190 rvt_put_ss(&qp->r_sge); in ud_loopback()
191 if (!test_and_clear_bit(RVT_R_WRID_VALID, &qp->r_aflags)) in ud_loopback()
193 wc.wr_id = qp->r_wr_id; in ud_loopback()
196 wc.qp = &qp->ibqp; in ud_loopback()
198 if (qp->ibqp.qp_type == IB_QPT_GSI || qp->ibqp.qp_type == IB_QPT_SMI) { in ud_loopback()
214 wc.port_num = qp->port_num; in ud_loopback()
216 rvt_recv_cq(qp, &wc, swqe->wr.send_flags & IB_SEND_SOLICITED); in ud_loopback()
219 spin_unlock_irqrestore(&qp->r_lock, flags); in ud_loopback()
224 static void hfi1_make_bth_deth(struct rvt_qp *qp, struct rvt_swqe *wqe, in hfi1_make_bth_deth() argument
231 ibp = to_iport(qp->ibqp.device, qp->port_num); in hfi1_make_bth_deth()
242 if (qp->ibqp.qp_type == IB_QPT_GSI || qp->ibqp.qp_type == IB_QPT_SMI) in hfi1_make_bth_deth()
245 *pkey = hfi1_get_pkey(ibp, qp->s_pkey_index); in hfi1_make_bth_deth()
253 * qkey from the QP context instead of the WR (see 10.2.5). in hfi1_make_bth_deth()
256 cpu_to_be32((int)rvt_get_swqe_remote_qkey(wqe) < 0 ? qp->qkey : in hfi1_make_bth_deth()
258 ohdr->u.ud.deth[1] = cpu_to_be32(qp->ibqp.qp_num); in hfi1_make_bth_deth()
261 void hfi1_make_ud_req_9B(struct rvt_qp *qp, struct hfi1_pkt_state *ps, in hfi1_make_ud_req_9B() argument
268 struct hfi1_qp_priv *priv = qp->priv; in hfi1_make_ud_req_9B()
275 ibp = to_iport(qp->ibqp.device, qp->port_num); in hfi1_make_ud_req_9B()
301 if (qp->ibqp.qp_type == IB_QPT_SMI) { in hfi1_make_ud_req_9B()
323 hfi1_make_bth_deth(qp, wqe, ohdr, &pkey, extra_bytes, false); in hfi1_make_ud_req_9B()
332 void hfi1_make_ud_req_16B(struct rvt_qp *qp, struct hfi1_pkt_state *ps, in hfi1_make_ud_req_16B() argument
335 struct hfi1_qp_priv *priv = qp->priv; in hfi1_make_ud_req_16B()
342 u32 src_qp = qp->ibqp.qp_num; in hfi1_make_ud_req_16B()
347 ibp = to_iport(qp->ibqp.device, qp->port_num); in hfi1_make_ud_req_16B()
397 if (qp->ibqp.qp_type == IB_QPT_SMI) in hfi1_make_ud_req_16B()
415 hfi1_make_bth_deth(qp, wqe, ohdr, &pkey, extra_bytes, true); in hfi1_make_ud_req_16B()
428 * @qp: the QP
435 int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) in hfi1_make_ud_req() argument
437 struct hfi1_qp_priv *priv = qp->priv; in hfi1_make_ud_req()
445 ps->s_txreq = get_txreq(ps->dev, qp); in hfi1_make_ud_req()
449 if (!(ib_rvt_state_ops[qp->state] & RVT_PROCESS_NEXT_SEND_OK)) { in hfi1_make_ud_req()
450 if (!(ib_rvt_state_ops[qp->state] & RVT_FLUSH_SEND)) in hfi1_make_ud_req()
453 if (qp->s_last == READ_ONCE(qp->s_head)) in hfi1_make_ud_req()
457 qp->s_flags |= RVT_S_WAIT_DMA; in hfi1_make_ud_req()
460 wqe = rvt_get_swqe_ptr(qp, qp->s_last); in hfi1_make_ud_req()
461 rvt_send_complete(qp, wqe, IB_WC_WR_FLUSH_ERR); in hfi1_make_ud_req()
466 if (qp->s_cur == READ_ONCE(qp->s_head)) in hfi1_make_ud_req()
469 wqe = rvt_get_swqe_ptr(qp, qp->s_cur); in hfi1_make_ud_req()
470 next_cur = qp->s_cur + 1; in hfi1_make_ud_req()
471 if (next_cur >= qp->s_size) in hfi1_make_ud_req()
475 ibp = to_iport(qp->ibqp.device, qp->port_num); in hfi1_make_ud_req()
485 (qp->ibqp.qp_type == IB_QPT_GSI))))) { in hfi1_make_ud_req()
495 qp->s_flags |= RVT_S_WAIT_DMA; in hfi1_make_ud_req()
498 qp->s_cur = next_cur; in hfi1_make_ud_req()
499 spin_unlock_irqrestore(&qp->s_lock, tflags); in hfi1_make_ud_req()
500 ud_loopback(qp, wqe); in hfi1_make_ud_req()
501 spin_lock_irqsave(&qp->s_lock, tflags); in hfi1_make_ud_req()
503 rvt_send_complete(qp, wqe, IB_WC_SUCCESS); in hfi1_make_ud_req()
508 qp->s_cur = next_cur; in hfi1_make_ud_req()
510 ps->s_txreq->ss = &qp->s_sge; in hfi1_make_ud_req()
511 qp->s_srate = rdma_ah_get_static_rate(ah_attr); in hfi1_make_ud_req()
512 qp->srate_mbps = ib_rate_to_mbps(qp->s_srate); in hfi1_make_ud_req()
513 qp->s_wqe = wqe; in hfi1_make_ud_req()
514 qp->s_sge.sge = wqe->sg_list[0]; in hfi1_make_ud_req()
515 qp->s_sge.sg_list = wqe->sg_list + 1; in hfi1_make_ud_req()
516 qp->s_sge.num_sge = wqe->wr.num_sge; in hfi1_make_ud_req()
517 qp->s_sge.total_len = wqe->length; in hfi1_make_ud_req()
520 hfi1_make_ud_req_tbl[priv->hdr_type](qp, ps, qp->s_wqe); in hfi1_make_ud_req()
521 priv->s_sde = qp_to_sdma_engine(qp, priv->s_sc); in hfi1_make_ud_req()
523 priv->s_sendcontext = qp_to_send_context(qp, priv->s_sc); in hfi1_make_ud_req()
542 qp->s_flags &= ~RVT_S_BUSY; in hfi1_make_ud_req()
591 void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp, in return_cnp_16B() argument
602 struct send_context *ctxt = qp_to_send_context(qp, sc5); in return_cnp_16B()
642 pbc = create_pbc(ppd, pbc_flags, qp->srate_mbps, vl, plen); in return_cnp_16B()
653 void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn, in return_cnp() argument
664 struct send_context *ctxt = qp_to_send_context(qp, sc5); in return_cnp()
697 pbc = create_pbc(ppd, pbc_flags, qp->srate_mbps, vl, plen); in return_cnp()
722 * - destination QP is QP0
727 struct rvt_qp *qp, u16 slid, struct opa_smp *smp) in opa_smp_check() argument
805 * for the given QP.
819 struct rvt_qp *qp = packet->qp; in hfi1_ud_rcv() local
856 process_ecn(qp, packet); in hfi1_ud_rcv()
870 if (qp->ibqp.qp_num) { in hfi1_ud_rcv()
873 if (qp->ibqp.qp_num > 1) { in hfi1_ud_rcv()
883 src_qp, qp->ibqp.qp_num, in hfi1_ud_rcv()
894 ib_get_qkey(packet->ohdr) != qp->qkey)) in hfi1_ud_rcv()
898 if (unlikely(qp->ibqp.qp_num == 1 && in hfi1_ud_rcv()
905 if (opa_smp_check(ibp, pkey, sc5, qp, slid, smp)) in hfi1_ud_rcv()
920 if (qp->ibqp.qp_num > 1 && in hfi1_ud_rcv()
940 if (qp->r_flags & RVT_R_REUSE_SGE) { in hfi1_ud_rcv()
941 qp->r_flags &= ~RVT_R_REUSE_SGE; in hfi1_ud_rcv()
945 ret = rvt_get_rwqe(qp, false); in hfi1_ud_rcv()
947 rvt_rc_error(qp, IB_WC_LOC_QP_OP_ERR); in hfi1_ud_rcv()
951 if (qp->ibqp.qp_num == 0) in hfi1_ud_rcv()
957 if (unlikely(wc.byte_len > qp->r_len)) { in hfi1_ud_rcv()
958 qp->r_flags |= RVT_R_REUSE_SGE; in hfi1_ud_rcv()
962 rvt_copy_sge(qp, &qp->r_sge, packet->grh, in hfi1_ud_rcv()
973 rvt_copy_sge(qp, &qp->r_sge, &grh, in hfi1_ud_rcv()
977 rvt_skip_sge(&qp->r_sge, sizeof(struct ib_grh), true); in hfi1_ud_rcv()
979 rvt_copy_sge(qp, &qp->r_sge, data, wc.byte_len - sizeof(struct ib_grh), in hfi1_ud_rcv()
981 rvt_put_ss(&qp->r_sge); in hfi1_ud_rcv()
982 if (!test_and_clear_bit(RVT_R_WRID_VALID, &qp->r_aflags)) in hfi1_ud_rcv()
984 wc.wr_id = qp->r_wr_id; in hfi1_ud_rcv()
988 wc.qp = &qp->ibqp; in hfi1_ud_rcv()
991 if (qp->ibqp.qp_type == IB_QPT_GSI || in hfi1_ud_rcv()
992 qp->ibqp.qp_type == IB_QPT_SMI) { in hfi1_ud_rcv()
997 dd_dev_err(dd, "QP type %d mgmt_pkey_idx < 0 and packet not dropped???\n", in hfi1_ud_rcv()
998 qp->ibqp.qp_type); in hfi1_ud_rcv()
1016 wc.port_num = qp->port_num; in hfi1_ud_rcv()
1018 rvt_recv_cq(qp, &wc, solicited); in hfi1_ud_rcv()