Lines Matching refs:ibqp
194 struct ib_device *ibdev = &(to_hr_dev(qp->ibqp.device))->ib_dev; in fill_ext_sge_inl_data()
270 struct hns_roce_dev *hr_dev = to_hr_dev(qp->ibqp.device); in check_inl_data_len()
287 struct hns_roce_dev *hr_dev = to_hr_dev(qp->ibqp.device); in set_rc_inl()
328 static int set_rwqe_data_seg(struct ib_qp *ibqp, const struct ib_send_wr *wr, in set_rwqe_data_seg() argument
335 struct hns_roce_qp *qp = to_hr_qp(ibqp); in set_rwqe_data_seg()
376 struct ib_qp *ibqp = &hr_qp->ibqp; in check_send_valid() local
378 if (unlikely(ibqp->qp_type != IB_QPT_RC && in check_send_valid()
379 ibqp->qp_type != IB_QPT_GSI && in check_send_valid()
380 ibqp->qp_type != IB_QPT_UD)) { in check_send_valid()
382 ibqp->qp_type); in check_send_valid()
498 hr_reg_write(ud_sq_wqe, UD_SEND_WQE_PD, to_hr_pd(qp->ibqp.pd)->pdn); in set_ud_wqe()
580 struct hns_roce_dev *hr_dev = to_hr_dev(qp->ibqp.device); in set_rc_wqe()
608 ret = set_rwqe_data_seg(&qp->ibqp, wr, rc_sq_wqe, in set_rc_wqe()
695 static int hns_roce_v2_post_send(struct ib_qp *ibqp, in hns_roce_v2_post_send() argument
699 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in hns_roce_v2_post_send()
701 struct hns_roce_qp *qp = to_hr_qp(ibqp); in hns_roce_v2_post_send()
722 if (hns_roce_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq)) { in hns_roce_v2_post_send()
744 if (ibqp->qp_type == IB_QPT_RC) in hns_roce_v2_post_send()
775 struct ib_qp *ibqp = &hr_qp->ibqp; in check_recv_valid() local
777 if (unlikely(ibqp->qp_type != IB_QPT_RC && in check_recv_valid()
778 ibqp->qp_type != IB_QPT_GSI && in check_recv_valid()
779 ibqp->qp_type != IB_QPT_UD)) { in check_recv_valid()
781 ibqp->qp_type); in check_recv_valid()
842 static int hns_roce_v2_post_recv(struct ib_qp *ibqp, in hns_roce_v2_post_recv() argument
846 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in hns_roce_v2_post_recv()
847 struct hns_roce_qp *hr_qp = to_hr_qp(ibqp); in hns_roce_v2_post_recv()
865 hr_qp->ibqp.recv_cq))) { in hns_roce_v2_post_recv()
2737 qp = &hr_qp->ibqp; in free_mr_init_qp()
2748 free_mr->rsv_qp[i]->ibqp.recv_cq = cq; in free_mr_init_qp()
2749 free_mr->rsv_qp[i]->ibqp.send_cq = cq; in free_mr_init_qp()
2763 qp = &free_mr->rsv_qp[i]->ibqp; in free_mr_exit()
2842 hr_qp = to_hr_qp(&free_mr->rsv_qp[sl_num]->ibqp); in free_mr_modify_rsv_qp()
2844 hr_qp->ibqp.device = ibdev; in free_mr_modify_rsv_qp()
2845 hr_qp->ibqp.qp_type = IB_QPT_RC; in free_mr_modify_rsv_qp()
2851 ret = hr_dev->hw->modify_qp(&hr_qp->ibqp, attr, mask, IB_QPS_INIT, in free_mr_modify_rsv_qp()
2873 ret = hr_dev->hw->modify_qp(&hr_qp->ibqp, attr, mask, IB_QPS_INIT, in free_mr_modify_rsv_qp()
2888 ret = hr_dev->hw->modify_qp(&hr_qp->ibqp, attr, mask, IB_QPS_RTR, in free_mr_modify_rsv_qp()
3486 struct hns_roce_dev *hr_dev = to_hr_dev(hr_qp->ibqp.device); in free_mr_post_send_lp_wqe()
3496 ret = hns_roce_v2_post_send(&hr_qp->ibqp, send_wr, &bad_wr); in free_mr_post_send_lp_wqe()
3781 wc->qp = &hr_qp->ibqp; in sw_comp()
4066 wc->qp = &qp->ibqp; in hns_roce_v2_poll_one()
4087 if (qp->ibqp.srq) { in hns_roce_v2_poll_one()
4088 srq = to_hr_srq(qp->ibqp.srq); in hns_roce_v2_poll_one()
4406 static void modify_qp_reset_to_init(struct ib_qp *ibqp, in modify_qp_reset_to_init() argument
4411 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in modify_qp_reset_to_init()
4412 struct hns_roce_qp *hr_qp = to_hr_qp(ibqp); in modify_qp_reset_to_init()
4420 hr_reg_write(context, QPC_TST, to_hr_qp_type(ibqp->qp_type)); in modify_qp_reset_to_init()
4422 hr_reg_write(context, QPC_PD, get_pdn(ibqp->pd)); in modify_qp_reset_to_init()
4431 if (ibqp->qp_type == IB_QPT_XRC_TGT) { in modify_qp_reset_to_init()
4448 if (ibqp->qp_type != IB_QPT_UD && ibqp->qp_type != IB_QPT_GSI) in modify_qp_reset_to_init()
4452 hr_reg_write(context, QPC_RX_CQN, get_cqn(ibqp->recv_cq)); in modify_qp_reset_to_init()
4454 if (ibqp->srq) { in modify_qp_reset_to_init()
4456 hr_reg_write(context, QPC_SRQN, to_hr_srq(ibqp->srq)->srqn); in modify_qp_reset_to_init()
4461 hr_reg_write(context, QPC_TX_CQN, get_cqn(ibqp->send_cq)); in modify_qp_reset_to_init()
4470 static void modify_qp_init_to_init(struct ib_qp *ibqp, in modify_qp_init_to_init() argument
4481 hr_reg_write(context, QPC_TST, to_hr_qp_type(ibqp->qp_type)); in modify_qp_init_to_init()
4484 hr_reg_write(context, QPC_PD, get_pdn(ibqp->pd)); in modify_qp_init_to_init()
4487 hr_reg_write(context, QPC_RX_CQN, get_cqn(ibqp->recv_cq)); in modify_qp_init_to_init()
4490 hr_reg_write(context, QPC_TX_CQN, get_cqn(ibqp->send_cq)); in modify_qp_init_to_init()
4493 if (ibqp->srq) { in modify_qp_init_to_init()
4496 hr_reg_write(context, QPC_SRQN, to_hr_srq(ibqp->srq)->srqn); in modify_qp_init_to_init()
4630 static inline enum ib_mtu get_mtu(struct ib_qp *ibqp, in get_mtu() argument
4633 if (ibqp->qp_type == IB_QPT_GSI || ibqp->qp_type == IB_QPT_UD) in get_mtu()
4639 static int modify_qp_init_to_rtr(struct ib_qp *ibqp, in modify_qp_init_to_rtr() argument
4644 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in modify_qp_init_to_rtr()
4645 struct hns_roce_qp *hr_qp = to_hr_qp(ibqp); in modify_qp_init_to_rtr()
4725 ib_mtu = get_mtu(ibqp, attr); in modify_qp_init_to_rtr()
4766 static int modify_qp_rtr_to_rts(struct ib_qp *ibqp, in modify_qp_rtr_to_rts() argument
4771 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in modify_qp_rtr_to_rts()
4772 struct hns_roce_qp *hr_qp = to_hr_qp(ibqp); in modify_qp_rtr_to_rts()
4814 static int get_dip_ctx_idx(struct ib_qp *ibqp, const struct ib_qp_attr *attr, in get_dip_ctx_idx() argument
4818 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in get_dip_ctx_idx()
4828 spare_idx[*tail] = ibqp->qp_num; in get_dip_ctx_idx()
4882 static int check_cong_type(struct ib_qp *ibqp, in check_cong_type() argument
4885 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in check_cong_type()
4923 static int fill_cong_field(struct ib_qp *ibqp, const struct ib_qp_attr *attr, in fill_cong_field() argument
4929 struct ib_device *ibdev = ibqp->device; in fill_cong_field()
4938 ret = check_cong_type(ibqp, &cong_field); in fill_cong_field()
4960 ret = get_dip_ctx_idx(ibqp, attr, &dip_idx); in fill_cong_field()
4972 static int hns_roce_v2_set_path(struct ib_qp *ibqp, in hns_roce_v2_set_path() argument
4979 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in hns_roce_v2_set_path()
4980 struct hns_roce_qp *hr_qp = to_hr_qp(ibqp); in hns_roce_v2_set_path()
5040 is_udp ? rdma_get_udp_sport(grh->flow_label, ibqp->qp_num, in hns_roce_v2_set_path()
5053 ret = fill_cong_field(ibqp, attr, context, qpc_mask); in hns_roce_v2_set_path()
5104 static int hns_roce_v2_set_abs_fields(struct ib_qp *ibqp, in hns_roce_v2_set_abs_fields() argument
5112 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in hns_roce_v2_set_abs_fields()
5122 modify_qp_reset_to_init(ibqp, attr, context, qpc_mask); in hns_roce_v2_set_abs_fields()
5124 modify_qp_init_to_init(ibqp, attr, context, qpc_mask); in hns_roce_v2_set_abs_fields()
5126 ret = modify_qp_init_to_rtr(ibqp, attr, attr_mask, context, in hns_roce_v2_set_abs_fields()
5129 ret = modify_qp_rtr_to_rts(ibqp, attr, attr_mask, context, in hns_roce_v2_set_abs_fields()
5160 static int hns_roce_v2_set_opt_fields(struct ib_qp *ibqp, in hns_roce_v2_set_opt_fields() argument
5166 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in hns_roce_v2_set_opt_fields()
5167 struct hns_roce_qp *hr_qp = to_hr_qp(ibqp); in hns_roce_v2_set_opt_fields()
5172 ret = hns_roce_v2_set_path(ibqp, attr, attr_mask, context, in hns_roce_v2_set_opt_fields()
5262 static void hns_roce_v2_record_opt_fields(struct ib_qp *ibqp, in hns_roce_v2_record_opt_fields() argument
5266 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in hns_roce_v2_record_opt_fields()
5267 struct hns_roce_qp *hr_qp = to_hr_qp(ibqp); in hns_roce_v2_record_opt_fields()
5282 struct ib_qp *ibqp = &hr_qp->ibqp; in clear_qp() local
5284 if (ibqp->send_cq) in clear_qp()
5285 hns_roce_v2_cq_clean(to_hr_cq(ibqp->send_cq), in clear_qp()
5288 if (ibqp->recv_cq && ibqp->recv_cq != ibqp->send_cq) in clear_qp()
5289 hns_roce_v2_cq_clean(to_hr_cq(ibqp->recv_cq), in clear_qp()
5290 hr_qp->qpn, ibqp->srq ? in clear_qp()
5291 to_hr_srq(ibqp->srq) : NULL); in clear_qp()
5303 static void v2_set_flushed_fields(struct ib_qp *ibqp, in v2_set_flushed_fields() argument
5307 struct hns_roce_qp *hr_qp = to_hr_qp(ibqp); in v2_set_flushed_fields()
5311 if (ibqp->qp_type == IB_QPT_XRC_TGT) in v2_set_flushed_fields()
5320 if (ibqp->srq || ibqp->qp_type == IB_QPT_XRC_INI) /* no RQ */ in v2_set_flushed_fields()
5329 static int hns_roce_v2_modify_qp(struct ib_qp *ibqp, in hns_roce_v2_modify_qp() argument
5334 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in hns_roce_v2_modify_qp()
5335 struct hns_roce_qp *hr_qp = to_hr_qp(ibqp); in hns_roce_v2_modify_qp()
5354 ret = hns_roce_v2_set_abs_fields(ibqp, attr, attr_mask, cur_state, in hns_roce_v2_modify_qp()
5361 v2_set_flushed_fields(ibqp, context, qpc_mask); in hns_roce_v2_modify_qp()
5364 ret = hns_roce_v2_set_opt_fields(ibqp, attr, attr_mask, context, in hns_roce_v2_modify_qp()
5370 to_hr_qp_type(hr_qp->ibqp.qp_type) == SERV_TYPE_XRC || in hns_roce_v2_modify_qp()
5371 ibqp->srq); in hns_roce_v2_modify_qp()
5387 hns_roce_v2_record_opt_fields(ibqp, attr, attr_mask); in hns_roce_v2_modify_qp()
5389 if (new_state == IB_QPS_RESET && !ibqp->uobject) in hns_roce_v2_modify_qp()
5434 static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, in hns_roce_v2_query_qp() argument
5438 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in hns_roce_v2_query_qp()
5439 struct hns_roce_qp *hr_qp = to_hr_qp(ibqp); in hns_roce_v2_query_qp()
5476 if (hr_qp->ibqp.qp_type == IB_QPT_UD) in hns_roce_v2_query_qp()
5487 if (hr_qp->ibqp.qp_type == IB_QPT_RC || in hns_roce_v2_query_qp()
5488 hr_qp->ibqp.qp_type == IB_QPT_XRC_INI || in hns_roce_v2_query_qp()
5489 hr_qp->ibqp.qp_type == IB_QPT_XRC_TGT) { in hns_roce_v2_query_qp()
5524 qp_init_attr->qp_context = ibqp->qp_context; in hns_roce_v2_query_qp()
5525 qp_init_attr->qp_type = ibqp->qp_type; in hns_roce_v2_query_qp()
5526 qp_init_attr->recv_cq = ibqp->recv_cq; in hns_roce_v2_query_qp()
5527 qp_init_attr->send_cq = ibqp->send_cq; in hns_roce_v2_query_qp()
5528 qp_init_attr->srq = ibqp->srq; in hns_roce_v2_query_qp()
5539 return ((hr_qp->ibqp.qp_type == IB_QPT_RC || in modify_qp_is_ok()
5540 hr_qp->ibqp.qp_type == IB_QPT_UD || in modify_qp_is_ok()
5541 hr_qp->ibqp.qp_type == IB_QPT_XRC_INI || in modify_qp_is_ok()
5542 hr_qp->ibqp.qp_type == IB_QPT_XRC_TGT) && in modify_qp_is_ok()
5557 ret = hns_roce_v2_modify_qp(&hr_qp->ibqp, NULL, 0, in hns_roce_v2_destroy_qp_common()
5565 send_cq = hr_qp->ibqp.send_cq ? to_hr_cq(hr_qp->ibqp.send_cq) : NULL; in hns_roce_v2_destroy_qp_common()
5566 recv_cq = hr_qp->ibqp.recv_cq ? to_hr_cq(hr_qp->ibqp.recv_cq) : NULL; in hns_roce_v2_destroy_qp_common()
5574 (hr_qp->ibqp.srq ? in hns_roce_v2_destroy_qp_common()
5575 to_hr_srq(hr_qp->ibqp.srq) : in hns_roce_v2_destroy_qp_common()
5590 int hns_roce_v2_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata) in hns_roce_v2_destroy_qp() argument
5592 struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); in hns_roce_v2_destroy_qp()
5593 struct hns_roce_qp *hr_qp = to_hr_qp(ibqp); in hns_roce_v2_destroy_qp()