Lines Matching refs:qp
536 struct ib_qp *qp = context; in __ib_shared_qp_event_handler() local
539 spin_lock_irqsave(&qp->device->event_handler_lock, flags); in __ib_shared_qp_event_handler()
540 list_for_each_entry(event->element.qp, &qp->open_list, open_list) in __ib_shared_qp_event_handler()
541 if (event->element.qp->event_handler) in __ib_shared_qp_event_handler()
542 event->element.qp->event_handler(event, event->element.qp->qp_context); in __ib_shared_qp_event_handler()
543 spin_unlock_irqrestore(&qp->device->event_handler_lock, flags); in __ib_shared_qp_event_handler()
546 static void __ib_insert_xrcd_qp(struct ib_xrcd *xrcd, struct ib_qp *qp) in __ib_insert_xrcd_qp() argument
549 list_add(&qp->xrcd_list, &xrcd->tgt_qp_list); in __ib_insert_xrcd_qp()
557 struct ib_qp *qp; in __ib_open_qp() local
560 qp = kzalloc(sizeof *qp, GFP_KERNEL); in __ib_open_qp()
561 if (!qp) in __ib_open_qp()
564 qp->real_qp = real_qp; in __ib_open_qp()
566 qp->device = real_qp->device; in __ib_open_qp()
567 qp->event_handler = event_handler; in __ib_open_qp()
568 qp->qp_context = qp_context; in __ib_open_qp()
569 qp->qp_num = real_qp->qp_num; in __ib_open_qp()
570 qp->qp_type = real_qp->qp_type; in __ib_open_qp()
573 list_add(&qp->open_list, &real_qp->open_list); in __ib_open_qp()
576 return qp; in __ib_open_qp()
582 struct ib_qp *qp, *real_qp; in ib_open_qp() local
587 qp = ERR_PTR(-EINVAL); in ib_open_qp()
591 qp = __ib_open_qp(real_qp, qp_open_attr->event_handler, in ib_open_qp()
597 return qp; in ib_open_qp()
604 struct ib_qp *qp, *real_qp; in ib_create_qp() local
608 qp = device->create_qp(pd, qp_init_attr, NULL); in ib_create_qp()
610 if (!IS_ERR(qp)) { in ib_create_qp()
611 qp->device = device; in ib_create_qp()
612 qp->real_qp = qp; in ib_create_qp()
613 qp->uobject = NULL; in ib_create_qp()
614 qp->qp_type = qp_init_attr->qp_type; in ib_create_qp()
616 atomic_set(&qp->usecnt, 0); in ib_create_qp()
618 qp->event_handler = __ib_shared_qp_event_handler; in ib_create_qp()
619 qp->qp_context = qp; in ib_create_qp()
620 qp->pd = NULL; in ib_create_qp()
621 qp->send_cq = qp->recv_cq = NULL; in ib_create_qp()
622 qp->srq = NULL; in ib_create_qp()
623 qp->xrcd = qp_init_attr->xrcd; in ib_create_qp()
625 INIT_LIST_HEAD(&qp->open_list); in ib_create_qp()
627 real_qp = qp; in ib_create_qp()
628 qp = __ib_open_qp(real_qp, qp_init_attr->event_handler, in ib_create_qp()
630 if (!IS_ERR(qp)) in ib_create_qp()
635 qp->event_handler = qp_init_attr->event_handler; in ib_create_qp()
636 qp->qp_context = qp_init_attr->qp_context; in ib_create_qp()
638 qp->recv_cq = NULL; in ib_create_qp()
639 qp->srq = NULL; in ib_create_qp()
641 qp->recv_cq = qp_init_attr->recv_cq; in ib_create_qp()
643 qp->srq = qp_init_attr->srq; in ib_create_qp()
644 if (qp->srq) in ib_create_qp()
648 qp->pd = pd; in ib_create_qp()
649 qp->send_cq = qp_init_attr->send_cq; in ib_create_qp()
650 qp->xrcd = NULL; in ib_create_qp()
657 return qp; in ib_create_qp()
997 int ib_resolve_eth_dmac(struct ib_qp *qp, in ib_resolve_eth_dmac() argument
1003 if (qp_attr->ah_attr.port_num < rdma_start_port(qp->device) || in ib_resolve_eth_dmac()
1004 qp_attr->ah_attr.port_num > rdma_end_port(qp->device)) in ib_resolve_eth_dmac()
1007 if (!rdma_cap_eth_ah(qp->device, qp_attr->ah_attr.port_num)) in ib_resolve_eth_dmac()
1018 ret = ib_query_gid(qp->device, in ib_resolve_eth_dmac()
1045 int ib_modify_qp(struct ib_qp *qp, in ib_modify_qp() argument
1051 ret = ib_resolve_eth_dmac(qp, qp_attr, &qp_attr_mask); in ib_modify_qp()
1055 return qp->device->modify_qp(qp->real_qp, qp_attr, qp_attr_mask, NULL); in ib_modify_qp()
1059 int ib_query_qp(struct ib_qp *qp, in ib_query_qp() argument
1064 return qp->device->query_qp ? in ib_query_qp()
1065 qp->device->query_qp(qp->real_qp, qp_attr, qp_attr_mask, qp_init_attr) : in ib_query_qp()
1070 int ib_close_qp(struct ib_qp *qp) in ib_close_qp() argument
1075 real_qp = qp->real_qp; in ib_close_qp()
1076 if (real_qp == qp) in ib_close_qp()
1080 list_del(&qp->open_list); in ib_close_qp()
1084 kfree(qp); in ib_close_qp()
1090 static int __ib_destroy_shared_qp(struct ib_qp *qp) in __ib_destroy_shared_qp() argument
1096 real_qp = qp->real_qp; in __ib_destroy_shared_qp()
1100 ib_close_qp(qp); in __ib_destroy_shared_qp()
1118 int ib_destroy_qp(struct ib_qp *qp) in ib_destroy_qp() argument
1125 if (atomic_read(&qp->usecnt)) in ib_destroy_qp()
1128 if (qp->real_qp != qp) in ib_destroy_qp()
1129 return __ib_destroy_shared_qp(qp); in ib_destroy_qp()
1131 pd = qp->pd; in ib_destroy_qp()
1132 scq = qp->send_cq; in ib_destroy_qp()
1133 rcq = qp->recv_cq; in ib_destroy_qp()
1134 srq = qp->srq; in ib_destroy_qp()
1136 ret = qp->device->destroy_qp(qp); in ib_destroy_qp()
1369 int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) in ib_attach_mcast() argument
1373 if (!qp->device->attach_mcast) in ib_attach_mcast()
1375 if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD) in ib_attach_mcast()
1378 ret = qp->device->attach_mcast(qp, gid, lid); in ib_attach_mcast()
1380 atomic_inc(&qp->usecnt); in ib_attach_mcast()
1385 int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) in ib_detach_mcast() argument
1389 if (!qp->device->detach_mcast) in ib_detach_mcast()
1391 if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD) in ib_detach_mcast()
1394 ret = qp->device->detach_mcast(qp, gid, lid); in ib_detach_mcast()
1396 atomic_dec(&qp->usecnt); in ib_detach_mcast()
1423 struct ib_qp *qp; in ib_dealloc_xrcd() local
1430 qp = list_entry(xrcd->tgt_qp_list.next, struct ib_qp, xrcd_list); in ib_dealloc_xrcd()
1431 ret = ib_destroy_qp(qp); in ib_dealloc_xrcd()
1440 struct ib_flow *ib_create_flow(struct ib_qp *qp, in ib_create_flow() argument
1445 if (!qp->device->create_flow) in ib_create_flow()
1448 flow_id = qp->device->create_flow(qp, flow_attr, domain); in ib_create_flow()
1450 atomic_inc(&qp->usecnt); in ib_create_flow()
1458 struct ib_qp *qp = flow_id->qp; in ib_destroy_flow() local
1460 err = qp->device->destroy_flow(flow_id); in ib_destroy_flow()
1462 atomic_dec(&qp->usecnt); in ib_destroy_flow()