struct siw_qp *siw_qp_id2obj(struct siw_dev *sdev, int id) { struct siw_objhdr *obj = siw_get_obj(&sdev->qp_idr, id); if (obj) return container_of(obj, struct siw_qp, hdr); return NULL; }
struct siw_qp *siw_qp_id2obj(struct siw_dev *sdev, int id) { struct siw_objhdr *obj = siw_get_obj(&sdev->qp_idr, id); if (obj) { pr_debug(DBG_OBJ "(QP%d): New refcount: %d\n", obj->id, kref_read(&obj->ref)); return container_of(obj, struct siw_qp, hdr); } return NULL; }
/* * siw_mem_id2obj() * * resolves memory from stag given by id. might be called from: * o process context before sending out of sgl * o or in softirq when resolving target memory */ struct siw_mem *siw_mem_id2obj(struct siw_dev *sdev, int id) { struct siw_objhdr *obj; unsigned long flags; spin_lock_irqsave(&sdev->idr_lock, flags); obj = siw_get_obj(&sdev->mem_idr, id); spin_unlock_irqrestore(&sdev->idr_lock, flags); if (obj) { dprint(DBG_MM|DBG_OBJ, "(MEM%d): New refcount: %d\n", obj->id, obj->ref.refcount.counter); return container_of(obj, struct siw_mem, hdr); } dprint(DBG_MM|DBG_OBJ|DBG_ON, "(MEM%d): not found!\n", id); return NULL; }