Lines Matching full:qp
74 /* when destroying a_RoCE QP the control is returned to the user after in qed_roce_stop()
76 * We delay for a short while if an async destroy QP is still expected. in qed_roce_stop()
96 static void qed_rdma_copy_gids(struct qed_rdma_qp *qp, __le32 *src_gid, in qed_rdma_copy_gids() argument
101 if (qp->roce_mode == ROCE_V2_IPV4) { in qed_rdma_copy_gids()
107 src_gid[3] = cpu_to_le32(qp->sgid.ipv4_addr); in qed_rdma_copy_gids()
108 dst_gid[3] = cpu_to_le32(qp->dgid.ipv4_addr); in qed_rdma_copy_gids()
111 for (i = 0; i < ARRAY_SIZE(qp->sgid.dwords); i++) { in qed_rdma_copy_gids()
112 src_gid[i] = cpu_to_le32(qp->sgid.dwords[i]); in qed_rdma_copy_gids()
113 dst_gid[i] = cpu_to_le32(qp->dgid.dwords[i]); in qed_rdma_copy_gids()
164 DP_NOTICE(p_hwfn, "Failed to allocate two adjacent qp's'\n"); in qed_roce_alloc_cid()
206 static u8 qed_roce_get_qp_tc(struct qed_hwfn *p_hwfn, struct qed_rdma_qp *qp) in qed_roce_get_qp_tc() argument
210 if (qp->vlan_id) { in qed_roce_get_qp_tc()
211 pri = (qp->vlan_id & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; in qed_roce_get_qp_tc()
216 "qp icid %u tc: %u (vlan priority %s)\n", in qed_roce_get_qp_tc()
217 qp->icid, tc, qp->vlan_id ? "enabled" : "disabled"); in qed_roce_get_qp_tc()
223 struct qed_rdma_qp *qp) in qed_roce_sp_create_responder() argument
234 if (!qp->has_resp) in qed_roce_sp_create_responder()
237 DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "icid = %08x\n", qp->icid); in qed_roce_sp_create_responder()
240 qp->irq_num_pages = 1; in qed_roce_sp_create_responder()
241 qp->irq = dma_alloc_coherent(&p_hwfn->cdev->pdev->dev, in qed_roce_sp_create_responder()
243 &qp->irq_phys_addr, GFP_KERNEL); in qed_roce_sp_create_responder()
244 if (!qp->irq) { in qed_roce_sp_create_responder()
254 init_data.cid = qp->icid; in qed_roce_sp_create_responder()
264 qed_roce_mode_to_flavor(qp->roce_mode)); in qed_roce_sp_create_responder()
267 qp->incoming_rdma_read_en); in qed_roce_sp_create_responder()
270 qp->incoming_rdma_write_en); in qed_roce_sp_create_responder()
273 qp->incoming_atomic_en); in qed_roce_sp_create_responder()
276 qp->e2e_flow_control_en); in qed_roce_sp_create_responder()
278 SET_FIELD(flags, ROCE_CREATE_QP_RESP_RAMROD_DATA_SRQ_FLG, qp->use_srq); in qed_roce_sp_create_responder()
281 qp->fmr_and_reserved_lkey); in qed_roce_sp_create_responder()
284 qp->min_rnr_nak_timer); in qed_roce_sp_create_responder()
287 qed_rdma_is_xrc_qp(qp)); in qed_roce_sp_create_responder()
291 p_ramrod->max_ird = qp->max_rd_atomic_resp; in qed_roce_sp_create_responder()
292 p_ramrod->traffic_class = qp->traffic_class_tos; in qed_roce_sp_create_responder()
293 p_ramrod->hop_limit = qp->hop_limit_ttl; in qed_roce_sp_create_responder()
294 p_ramrod->irq_num_pages = qp->irq_num_pages; in qed_roce_sp_create_responder()
295 p_ramrod->p_key = cpu_to_le16(qp->pkey); in qed_roce_sp_create_responder()
296 p_ramrod->flow_label = cpu_to_le32(qp->flow_label); in qed_roce_sp_create_responder()
297 p_ramrod->dst_qp_id = cpu_to_le32(qp->dest_qp); in qed_roce_sp_create_responder()
298 p_ramrod->mtu = cpu_to_le16(qp->mtu); in qed_roce_sp_create_responder()
299 p_ramrod->initial_psn = cpu_to_le32(qp->rq_psn); in qed_roce_sp_create_responder()
300 p_ramrod->pd = cpu_to_le16(qp->pd); in qed_roce_sp_create_responder()
301 p_ramrod->rq_num_pages = cpu_to_le16(qp->rq_num_pages); in qed_roce_sp_create_responder()
302 DMA_REGPAIR_LE(p_ramrod->rq_pbl_addr, qp->rq_pbl_ptr); in qed_roce_sp_create_responder()
303 DMA_REGPAIR_LE(p_ramrod->irq_pbl_addr, qp->irq_phys_addr); in qed_roce_sp_create_responder()
304 qed_rdma_copy_gids(qp, p_ramrod->src_gid, p_ramrod->dst_gid); in qed_roce_sp_create_responder()
305 p_ramrod->qp_handle_for_async.hi = qp->qp_handle_async.hi; in qed_roce_sp_create_responder()
306 p_ramrod->qp_handle_for_async.lo = qp->qp_handle_async.lo; in qed_roce_sp_create_responder()
307 p_ramrod->qp_handle_for_cqe.hi = qp->qp_handle.hi; in qed_roce_sp_create_responder()
308 p_ramrod->qp_handle_for_cqe.lo = qp->qp_handle.lo; in qed_roce_sp_create_responder()
310 qp->rq_cq_id); in qed_roce_sp_create_responder()
311 p_ramrod->xrc_domain = cpu_to_le16(qp->xrcd_id); in qed_roce_sp_create_responder()
313 tc = qed_roce_get_qp_tc(p_hwfn, qp); in qed_roce_sp_create_responder()
317 "qp icid %u pqs: regular_latency %u low_latency %u\n", in qed_roce_sp_create_responder()
318 qp->icid, regular_latency_queue - CM_TX_PQ_BASE, in qed_roce_sp_create_responder()
325 p_ramrod->dpi = cpu_to_le16(qp->dpi); in qed_roce_sp_create_responder()
327 qed_rdma_set_fw_mac(p_ramrod->remote_mac_addr, qp->remote_mac_addr); in qed_roce_sp_create_responder()
328 qed_rdma_set_fw_mac(p_ramrod->local_mac_addr, qp->local_mac_addr); in qed_roce_sp_create_responder()
330 p_ramrod->udp_src_port = cpu_to_le16(qp->udp_src_port); in qed_roce_sp_create_responder()
331 p_ramrod->vlan_id = cpu_to_le16(qp->vlan_id); in qed_roce_sp_create_responder()
332 p_ramrod->srq_id.srq_idx = cpu_to_le16(qp->srq_id); in qed_roce_sp_create_responder()
336 qp->stats_queue; in qed_roce_sp_create_responder()
342 qp->resp_offloaded = true; in qed_roce_sp_create_responder()
343 qp->cq_prod = 0; in qed_roce_sp_create_responder()
346 qed_roce_set_real_cid(p_hwfn, qp->icid - in qed_roce_sp_create_responder()
354 qp->irq_num_pages * RDMA_RING_PAGE_SIZE, in qed_roce_sp_create_responder()
355 qp->irq, qp->irq_phys_addr); in qed_roce_sp_create_responder()
361 struct qed_rdma_qp *qp) in qed_roce_sp_create_requester() argument
372 if (!qp->has_req) in qed_roce_sp_create_requester()
375 DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "icid = %08x\n", qp->icid); in qed_roce_sp_create_requester()
378 qp->orq_num_pages = 1; in qed_roce_sp_create_requester()
379 qp->orq = dma_alloc_coherent(&p_hwfn->cdev->pdev->dev, in qed_roce_sp_create_requester()
381 &qp->orq_phys_addr, GFP_KERNEL); in qed_roce_sp_create_requester()
382 if (!qp->orq) { in qed_roce_sp_create_requester()
392 init_data.cid = qp->icid + 1; in qed_roce_sp_create_requester()
403 qed_roce_mode_to_flavor(qp->roce_mode)); in qed_roce_sp_create_requester()
406 qp->fmr_and_reserved_lkey); in qed_roce_sp_create_requester()
409 qp->signal_all); in qed_roce_sp_create_requester()
412 qp->retry_cnt); in qed_roce_sp_create_requester()
415 qp->rnr_retry_cnt); in qed_roce_sp_create_requester()
418 qed_rdma_is_xrc_qp(qp)); in qed_roce_sp_create_requester()
424 qp->edpm_mode); in qed_roce_sp_create_requester()
426 p_ramrod->max_ord = qp->max_rd_atomic_req; in qed_roce_sp_create_requester()
427 p_ramrod->traffic_class = qp->traffic_class_tos; in qed_roce_sp_create_requester()
428 p_ramrod->hop_limit = qp->hop_limit_ttl; in qed_roce_sp_create_requester()
429 p_ramrod->orq_num_pages = qp->orq_num_pages; in qed_roce_sp_create_requester()
430 p_ramrod->p_key = cpu_to_le16(qp->pkey); in qed_roce_sp_create_requester()
431 p_ramrod->flow_label = cpu_to_le32(qp->flow_label); in qed_roce_sp_create_requester()
432 p_ramrod->dst_qp_id = cpu_to_le32(qp->dest_qp); in qed_roce_sp_create_requester()
433 p_ramrod->ack_timeout_val = cpu_to_le32(qp->ack_timeout); in qed_roce_sp_create_requester()
434 p_ramrod->mtu = cpu_to_le16(qp->mtu); in qed_roce_sp_create_requester()
435 p_ramrod->initial_psn = cpu_to_le32(qp->sq_psn); in qed_roce_sp_create_requester()
436 p_ramrod->pd = cpu_to_le16(qp->pd); in qed_roce_sp_create_requester()
437 p_ramrod->sq_num_pages = cpu_to_le16(qp->sq_num_pages); in qed_roce_sp_create_requester()
438 DMA_REGPAIR_LE(p_ramrod->sq_pbl_addr, qp->sq_pbl_ptr); in qed_roce_sp_create_requester()
439 DMA_REGPAIR_LE(p_ramrod->orq_pbl_addr, qp->orq_phys_addr); in qed_roce_sp_create_requester()
440 qed_rdma_copy_gids(qp, p_ramrod->src_gid, p_ramrod->dst_gid); in qed_roce_sp_create_requester()
441 p_ramrod->qp_handle_for_async.hi = qp->qp_handle_async.hi; in qed_roce_sp_create_requester()
442 p_ramrod->qp_handle_for_async.lo = qp->qp_handle_async.lo; in qed_roce_sp_create_requester()
443 p_ramrod->qp_handle_for_cqe.hi = qp->qp_handle.hi; in qed_roce_sp_create_requester()
444 p_ramrod->qp_handle_for_cqe.lo = qp->qp_handle.lo; in qed_roce_sp_create_requester()
446 cpu_to_le32((p_hwfn->hw_info.opaque_fid << 16) | qp->sq_cq_id); in qed_roce_sp_create_requester()
448 tc = qed_roce_get_qp_tc(p_hwfn, qp); in qed_roce_sp_create_requester()
452 "qp icid %u pqs: regular_latency %u low_latency %u\n", in qed_roce_sp_create_requester()
453 qp->icid, regular_latency_queue - CM_TX_PQ_BASE, in qed_roce_sp_create_requester()
460 p_ramrod->dpi = cpu_to_le16(qp->dpi); in qed_roce_sp_create_requester()
462 qed_rdma_set_fw_mac(p_ramrod->remote_mac_addr, qp->remote_mac_addr); in qed_roce_sp_create_requester()
463 qed_rdma_set_fw_mac(p_ramrod->local_mac_addr, qp->local_mac_addr); in qed_roce_sp_create_requester()
465 p_ramrod->udp_src_port = cpu_to_le16(qp->udp_src_port); in qed_roce_sp_create_requester()
466 p_ramrod->vlan_id = cpu_to_le16(qp->vlan_id); in qed_roce_sp_create_requester()
468 qp->stats_queue; in qed_roce_sp_create_requester()
474 qp->req_offloaded = true; in qed_roce_sp_create_requester()
477 qp->icid + 1 - in qed_roce_sp_create_requester()
485 qp->orq_num_pages * RDMA_RING_PAGE_SIZE, in qed_roce_sp_create_requester()
486 qp->orq, qp->orq_phys_addr); in qed_roce_sp_create_requester()
491 struct qed_rdma_qp *qp, in qed_roce_sp_modify_responder() argument
500 if (!qp->has_resp) in qed_roce_sp_modify_responder()
503 DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "icid = %08x\n", qp->icid); in qed_roce_sp_modify_responder()
505 if (move_to_err && !qp->resp_offloaded) in qed_roce_sp_modify_responder()
510 init_data.cid = qp->icid; in qed_roce_sp_modify_responder()
526 qp->incoming_rdma_read_en); in qed_roce_sp_modify_responder()
529 qp->incoming_rdma_write_en); in qed_roce_sp_modify_responder()
532 qp->incoming_atomic_en); in qed_roce_sp_modify_responder()
535 qp->e2e_flow_control_en); in qed_roce_sp_modify_responder()
562 qp->min_rnr_nak_timer); in qed_roce_sp_modify_responder()
564 p_ramrod->max_ird = qp->max_rd_atomic_resp; in qed_roce_sp_modify_responder()
565 p_ramrod->traffic_class = qp->traffic_class_tos; in qed_roce_sp_modify_responder()
566 p_ramrod->hop_limit = qp->hop_limit_ttl; in qed_roce_sp_modify_responder()
567 p_ramrod->p_key = cpu_to_le16(qp->pkey); in qed_roce_sp_modify_responder()
568 p_ramrod->flow_label = cpu_to_le32(qp->flow_label); in qed_roce_sp_modify_responder()
569 p_ramrod->mtu = cpu_to_le16(qp->mtu); in qed_roce_sp_modify_responder()
570 qed_rdma_copy_gids(qp, p_ramrod->src_gid, p_ramrod->dst_gid); in qed_roce_sp_modify_responder()
578 struct qed_rdma_qp *qp, in qed_roce_sp_modify_requester() argument
588 if (!qp->has_req) in qed_roce_sp_modify_requester()
591 DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "icid = %08x\n", qp->icid); in qed_roce_sp_modify_requester()
593 if (move_to_err && !(qp->req_offloaded)) in qed_roce_sp_modify_requester()
598 init_data.cid = qp->icid + 1; in qed_roce_sp_modify_requester()
617 qp->sqd_async); in qed_roce_sp_modify_requester()
646 ROCE_MODIFY_QP_REQ_RAMROD_DATA_ERR_RETRY_CNT, qp->retry_cnt); in qed_roce_sp_modify_requester()
648 qp->rnr_retry_cnt); in qed_roce_sp_modify_requester()
650 p_ramrod->max_ord = qp->max_rd_atomic_req; in qed_roce_sp_modify_requester()
651 p_ramrod->traffic_class = qp->traffic_class_tos; in qed_roce_sp_modify_requester()
652 p_ramrod->hop_limit = qp->hop_limit_ttl; in qed_roce_sp_modify_requester()
653 p_ramrod->p_key = cpu_to_le16(qp->pkey); in qed_roce_sp_modify_requester()
654 p_ramrod->flow_label = cpu_to_le32(qp->flow_label); in qed_roce_sp_modify_requester()
655 p_ramrod->ack_timeout_val = cpu_to_le32(qp->ack_timeout); in qed_roce_sp_modify_requester()
656 p_ramrod->mtu = cpu_to_le16(qp->mtu); in qed_roce_sp_modify_requester()
657 qed_rdma_copy_gids(qp, p_ramrod->src_gid, p_ramrod->dst_gid); in qed_roce_sp_modify_requester()
665 struct qed_rdma_qp *qp, in qed_roce_sp_destroy_qp_responder() argument
675 if (!qp->has_resp) { in qed_roce_sp_destroy_qp_responder()
680 DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "icid = %08x\n", qp->icid); in qed_roce_sp_destroy_qp_responder()
681 *cq_prod = qp->cq_prod; in qed_roce_sp_destroy_qp_responder()
683 if (!qp->resp_offloaded) { in qed_roce_sp_destroy_qp_responder()
689 cid = qp->icid - in qed_roce_sp_destroy_qp_responder()
699 init_data.cid = qp->icid; in qed_roce_sp_destroy_qp_responder()
731 qp->cq_prod = *cq_prod; in qed_roce_sp_destroy_qp_responder()
735 qp->irq_num_pages * RDMA_RING_PAGE_SIZE, in qed_roce_sp_destroy_qp_responder()
736 qp->irq, qp->irq_phys_addr); in qed_roce_sp_destroy_qp_responder()
738 qp->resp_offloaded = false; in qed_roce_sp_destroy_qp_responder()
751 struct qed_rdma_qp *qp) in qed_roce_sp_destroy_qp_requester() argument
760 if (!qp->has_req) in qed_roce_sp_destroy_qp_requester()
763 DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "icid = %08x\n", qp->icid); in qed_roce_sp_destroy_qp_requester()
765 if (!qp->req_offloaded) in qed_roce_sp_destroy_qp_requester()
779 init_data.cid = qp->icid + 1; in qed_roce_sp_destroy_qp_requester()
797 qp->orq_num_pages * RDMA_RING_PAGE_SIZE, in qed_roce_sp_destroy_qp_requester()
798 qp->orq, qp->orq_phys_addr); in qed_roce_sp_destroy_qp_requester()
800 qp->req_offloaded = false; in qed_roce_sp_destroy_qp_requester()
812 struct qed_rdma_qp *qp, in qed_roce_query_qp() argument
828 if ((!(qp->resp_offloaded)) && (!(qp->req_offloaded))) { in qed_roce_query_qp()
829 /* We can't send ramrod to the fw since this qp wasn't offloaded in qed_roce_query_qp()
833 out_params->rq_psn = qp->rq_psn; in qed_roce_query_qp()
834 out_params->sq_psn = qp->sq_psn; in qed_roce_query_qp()
835 out_params->state = qp->cur_state; in qed_roce_query_qp()
841 if (!(qp->resp_offloaded)) { in qed_roce_query_qp()
843 "The responder's qp should be offloaded before requester's\n"); in qed_roce_query_qp()
854 "qed query qp failed: cannot allocate memory (ramrod)\n"); in qed_roce_query_qp()
860 init_data.cid = qp->icid; in qed_roce_query_qp()
882 if (!(qp->req_offloaded)) { in qed_roce_query_qp()
883 /* Don't send query qp for the requester */ in qed_roce_query_qp()
884 out_params->sq_psn = qp->sq_psn; in qed_roce_query_qp()
888 qp->cur_state = QED_ROCE_QP_STATE_ERR; in qed_roce_query_qp()
890 out_params->state = qp->cur_state; in qed_roce_query_qp()
903 "qed query qp failed: cannot allocate memory (ramrod)\n"); in qed_roce_query_qp()
908 init_data.cid = qp->icid + 1; in qed_roce_query_qp()
934 qp->cur_state = QED_ROCE_QP_STATE_ERR; in qed_roce_query_qp()
937 out_params->state = qp->cur_state; in qed_roce_query_qp()
951 int qed_roce_destroy_qp(struct qed_hwfn *p_hwfn, struct qed_rdma_qp *qp) in qed_roce_destroy_qp() argument
956 /* Destroys the specified QP */ in qed_roce_destroy_qp()
957 if ((qp->cur_state != QED_ROCE_QP_STATE_RESET) && in qed_roce_destroy_qp()
958 (qp->cur_state != QED_ROCE_QP_STATE_ERR) && in qed_roce_destroy_qp()
959 (qp->cur_state != QED_ROCE_QP_STATE_INIT)) { in qed_roce_destroy_qp()
961 "QP must be in error, reset or init state before destroying it\n"); in qed_roce_destroy_qp()
965 if (qp->cur_state != QED_ROCE_QP_STATE_RESET) { in qed_roce_destroy_qp()
966 rc = qed_roce_sp_destroy_qp_responder(p_hwfn, qp, in qed_roce_destroy_qp()
972 rc = qed_roce_sp_destroy_qp_requester(p_hwfn, qp); in qed_roce_destroy_qp()
981 struct qed_rdma_qp *qp, in qed_roce_modify_qp() argument
992 (qp->cur_state == QED_ROCE_QP_STATE_RTR)) { in qed_roce_modify_qp()
994 rc = qed_roce_sp_create_responder(p_hwfn, qp); in qed_roce_modify_qp()
997 (qp->cur_state == QED_ROCE_QP_STATE_RTS)) { in qed_roce_modify_qp()
999 rc = qed_roce_sp_create_requester(p_hwfn, qp); in qed_roce_modify_qp()
1004 rc = qed_roce_sp_modify_responder(p_hwfn, qp, false, in qed_roce_modify_qp()
1008 (qp->cur_state == QED_ROCE_QP_STATE_RTS)) { in qed_roce_modify_qp()
1010 rc = qed_roce_sp_modify_responder(p_hwfn, qp, false, in qed_roce_modify_qp()
1015 rc = qed_roce_sp_modify_requester(p_hwfn, qp, false, false, in qed_roce_modify_qp()
1019 (qp->cur_state == QED_ROCE_QP_STATE_SQD)) { in qed_roce_modify_qp()
1021 rc = qed_roce_sp_modify_requester(p_hwfn, qp, true, false, in qed_roce_modify_qp()
1025 (qp->cur_state == QED_ROCE_QP_STATE_SQD)) { in qed_roce_modify_qp()
1027 rc = qed_roce_sp_modify_responder(p_hwfn, qp, false, in qed_roce_modify_qp()
1032 rc = qed_roce_sp_modify_requester(p_hwfn, qp, false, false, in qed_roce_modify_qp()
1036 (qp->cur_state == QED_ROCE_QP_STATE_RTS)) { in qed_roce_modify_qp()
1038 rc = qed_roce_sp_modify_responder(p_hwfn, qp, false, in qed_roce_modify_qp()
1043 rc = qed_roce_sp_modify_requester(p_hwfn, qp, false, false, in qed_roce_modify_qp()
1047 } else if (qp->cur_state == QED_ROCE_QP_STATE_ERR) { in qed_roce_modify_qp()
1049 rc = qed_roce_sp_modify_responder(p_hwfn, qp, true, in qed_roce_modify_qp()
1054 rc = qed_roce_sp_modify_requester(p_hwfn, qp, false, true, in qed_roce_modify_qp()
1057 } else if (qp->cur_state == QED_ROCE_QP_STATE_RESET) { in qed_roce_modify_qp()
1063 qp, in qed_roce_modify_qp()
1069 qp->cq_prod = cq_prod; in qed_roce_modify_qp()
1071 rc = qed_roce_sp_destroy_qp_requester(p_hwfn, qp); in qed_roce_modify_qp()