Lines Matching refs:qp
377 struct ib_qp *qp = context; in __ib_shared_qp_event_handler() local
380 spin_lock_irqsave(&qp->device->event_handler_lock, flags); in __ib_shared_qp_event_handler()
381 list_for_each_entry(event->element.qp, &qp->open_list, open_list) in __ib_shared_qp_event_handler()
382 if (event->element.qp->event_handler) in __ib_shared_qp_event_handler()
383 event->element.qp->event_handler(event, event->element.qp->qp_context); in __ib_shared_qp_event_handler()
384 spin_unlock_irqrestore(&qp->device->event_handler_lock, flags); in __ib_shared_qp_event_handler()
387 static void __ib_insert_xrcd_qp(struct ib_xrcd *xrcd, struct ib_qp *qp) in __ib_insert_xrcd_qp() argument
390 list_add(&qp->xrcd_list, &xrcd->tgt_qp_list); in __ib_insert_xrcd_qp()
398 struct ib_qp *qp; in __ib_open_qp() local
401 qp = kzalloc(sizeof *qp, GFP_KERNEL); in __ib_open_qp()
402 if (!qp) in __ib_open_qp()
405 qp->real_qp = real_qp; in __ib_open_qp()
407 qp->device = real_qp->device; in __ib_open_qp()
408 qp->event_handler = event_handler; in __ib_open_qp()
409 qp->qp_context = qp_context; in __ib_open_qp()
410 qp->qp_num = real_qp->qp_num; in __ib_open_qp()
411 qp->qp_type = real_qp->qp_type; in __ib_open_qp()
414 list_add(&qp->open_list, &real_qp->open_list); in __ib_open_qp()
417 return qp; in __ib_open_qp()
423 struct ib_qp *qp, *real_qp; in ib_open_qp() local
428 qp = ERR_PTR(-EINVAL); in ib_open_qp()
432 qp = __ib_open_qp(real_qp, qp_open_attr->event_handler, in ib_open_qp()
438 return qp; in ib_open_qp()
445 struct ib_qp *qp, *real_qp; in ib_create_qp() local
449 qp = device->create_qp(pd, qp_init_attr, NULL); in ib_create_qp()
451 if (!IS_ERR(qp)) { in ib_create_qp()
452 qp->device = device; in ib_create_qp()
453 qp->real_qp = qp; in ib_create_qp()
454 qp->uobject = NULL; in ib_create_qp()
455 qp->qp_type = qp_init_attr->qp_type; in ib_create_qp()
457 atomic_set(&qp->usecnt, 0); in ib_create_qp()
459 qp->event_handler = __ib_shared_qp_event_handler; in ib_create_qp()
460 qp->qp_context = qp; in ib_create_qp()
461 qp->pd = NULL; in ib_create_qp()
462 qp->send_cq = qp->recv_cq = NULL; in ib_create_qp()
463 qp->srq = NULL; in ib_create_qp()
464 qp->xrcd = qp_init_attr->xrcd; in ib_create_qp()
466 INIT_LIST_HEAD(&qp->open_list); in ib_create_qp()
468 real_qp = qp; in ib_create_qp()
469 qp = __ib_open_qp(real_qp, qp_init_attr->event_handler, in ib_create_qp()
471 if (!IS_ERR(qp)) in ib_create_qp()
476 qp->event_handler = qp_init_attr->event_handler; in ib_create_qp()
477 qp->qp_context = qp_init_attr->qp_context; in ib_create_qp()
479 qp->recv_cq = NULL; in ib_create_qp()
480 qp->srq = NULL; in ib_create_qp()
482 qp->recv_cq = qp_init_attr->recv_cq; in ib_create_qp()
484 qp->srq = qp_init_attr->srq; in ib_create_qp()
485 if (qp->srq) in ib_create_qp()
489 qp->pd = pd; in ib_create_qp()
490 qp->send_cq = qp_init_attr->send_cq; in ib_create_qp()
491 qp->xrcd = NULL; in ib_create_qp()
498 return qp; in ib_create_qp()
867 int ib_resolve_eth_l2_attrs(struct ib_qp *qp, in ib_resolve_eth_l2_attrs() argument
874 (rdma_port_get_link_layer(qp->device, qp_attr->ah_attr.port_num) == IB_LINK_LAYER_ETHERNET)) { in ib_resolve_eth_l2_attrs()
875 ret = ib_query_gid(qp->device, qp_attr->ah_attr.port_num, in ib_resolve_eth_l2_attrs()
903 int ib_modify_qp(struct ib_qp *qp, in ib_modify_qp() argument
909 ret = ib_resolve_eth_l2_attrs(qp, qp_attr, &qp_attr_mask); in ib_modify_qp()
913 return qp->device->modify_qp(qp->real_qp, qp_attr, qp_attr_mask, NULL); in ib_modify_qp()
917 int ib_query_qp(struct ib_qp *qp, in ib_query_qp() argument
922 return qp->device->query_qp ? in ib_query_qp()
923 qp->device->query_qp(qp->real_qp, qp_attr, qp_attr_mask, qp_init_attr) : in ib_query_qp()
928 int ib_close_qp(struct ib_qp *qp) in ib_close_qp() argument
933 real_qp = qp->real_qp; in ib_close_qp()
934 if (real_qp == qp) in ib_close_qp()
938 list_del(&qp->open_list); in ib_close_qp()
942 kfree(qp); in ib_close_qp()
948 static int __ib_destroy_shared_qp(struct ib_qp *qp) in __ib_destroy_shared_qp() argument
954 real_qp = qp->real_qp; in __ib_destroy_shared_qp()
958 ib_close_qp(qp); in __ib_destroy_shared_qp()
976 int ib_destroy_qp(struct ib_qp *qp) in ib_destroy_qp() argument
983 if (atomic_read(&qp->usecnt)) in ib_destroy_qp()
986 if (qp->real_qp != qp) in ib_destroy_qp()
987 return __ib_destroy_shared_qp(qp); in ib_destroy_qp()
989 pd = qp->pd; in ib_destroy_qp()
990 scq = qp->send_cq; in ib_destroy_qp()
991 rcq = qp->recv_cq; in ib_destroy_qp()
992 srq = qp->srq; in ib_destroy_qp()
994 ret = qp->device->destroy_qp(qp); in ib_destroy_qp()
1344 int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) in ib_attach_mcast() argument
1348 if (!qp->device->attach_mcast) in ib_attach_mcast()
1350 if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD) in ib_attach_mcast()
1353 ret = qp->device->attach_mcast(qp, gid, lid); in ib_attach_mcast()
1355 atomic_inc(&qp->usecnt); in ib_attach_mcast()
1360 int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) in ib_detach_mcast() argument
1364 if (!qp->device->detach_mcast) in ib_detach_mcast()
1366 if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD) in ib_detach_mcast()
1369 ret = qp->device->detach_mcast(qp, gid, lid); in ib_detach_mcast()
1371 atomic_dec(&qp->usecnt); in ib_detach_mcast()
1398 struct ib_qp *qp; in ib_dealloc_xrcd() local
1405 qp = list_entry(xrcd->tgt_qp_list.next, struct ib_qp, xrcd_list); in ib_dealloc_xrcd()
1406 ret = ib_destroy_qp(qp); in ib_dealloc_xrcd()
1415 struct ib_flow *ib_create_flow(struct ib_qp *qp, in ib_create_flow() argument
1420 if (!qp->device->create_flow) in ib_create_flow()
1423 flow_id = qp->device->create_flow(qp, flow_attr, domain); in ib_create_flow()
1425 atomic_inc(&qp->usecnt); in ib_create_flow()
1433 struct ib_qp *qp = flow_id->qp; in ib_destroy_flow() local
1435 err = qp->device->destroy_flow(flow_id); in ib_destroy_flow()
1437 atomic_dec(&qp->usecnt); in ib_destroy_flow()