-----Original Message----- From: Daniel Vetter daniel@ffwll.ch Sent: Monday, November 30, 2020 6:58 AM To: Xiong, Jianxin jianxin.xiong@intel.com Cc: linux-rdma@vger.kernel.org; dri-devel@lists.freedesktop.org; Leon Romanovsky leon@kernel.org; Jason Gunthorpe jgg@ziepe.ca; Doug Ledford dledford@redhat.com; Vetter, Daniel daniel.vetter@intel.com; Christian Koenig christian.koenig@amd.com Subject: Re: [PATCH rdma-core v3 4/6] pyverbs: Add dma-buf based MR support
+cdef class DmaBuf:
- def __init__(self, size, unit=0):
"""
Allocate DmaBuf object from a GPU device. This is done through the
DRI device interface. Usually this requires the effective user id
being a member of the 'render' group.
:param size: The size (in number of bytes) of the buffer.
:param unit: The unit number of the GPU to allocate the buffer from.
:return: The newly created DmaBuf object on success.
"""
self.dmabuf_mrs = weakref.WeakSet()
self.dmabuf = dmabuf_alloc(size, unit)
if self.dmabuf == NULL:
raise PyverbsRDMAErrno(f'Failed to allocate dmabuf of size {size} on unit {unit}')
self.dri_fd = dmabuf_get_dri_fd(<dmabuf *>self.dmabuf)
dri_fd seems unused by the tests
It's used by the read/write methods of the DmaBufMR class for performing mmap.