bnxt_entry = container_of(rdma_entry, struct bnxt_re_user_mmap_entry,
rdma_entry);
+ if (bnxt_entry->dpi_valid)
+ bnxt_qplib_free_uc_dpi(&bnxt_entry->uctx->rdev->qplib_res,
+ &bnxt_entry->dpi);
+
kfree(bnxt_entry);
}
goto free_dpi;
}
+ /* Save DPI info to the mmap entry so that bnxt_re_mmap_free()
+ * can free the DPI slot only after the last reference to the
+ * mmap entry is released.
+ */
+ obj->entry->dpi = *dpi;
+ obj->entry->dpi_valid = true;
+
obj->rdev = rdev;
kref_init(&obj->usecnt);
uobj->object = obj;
{
struct bnxt_re_dbr_obj *obj =
container_of(ref, struct bnxt_re_dbr_obj, usecnt);
- struct bnxt_re_dev *rdev = obj->rdev;
+ /* Drop the driver's reference to the mmap entry (_remove()).
+ * The DPI slot gets freed from bnxt_re_mmap_free() only
+ * when there's no VMA mapping reference to it.
+ */
rdma_user_mmap_entry_remove(&obj->entry->rdma_entry);
- bnxt_qplib_free_uc_dpi(&rdev->qplib_res, &obj->dpi);
kfree(obj);
}