Skip to content

Commit

Permalink
pyverbs: Expose some C objects
Browse files Browse the repository at this point in the history
Expose the underlying C object of Context and Mlx5DevxObj objects by
adding an appropriate property to their classes.

Signed-off-by: Daria Velikovsky <daria@nvidia.com>
Signed-off-by: Edward Srouji <edwards@nvidia.com>
  • Loading branch information
dariavel authored and EdwardSro committed Feb 23, 2022
1 parent 21134ab commit 8c0caf1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pyverbs/device.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ cdef class Context(PyverbsCM):
raise PyverbsRDMAErrno(f'Failed to close device {self.name}')
self.context = NULL

@property
def context(self):
return <object>self.context

@property
def num_comp_vectors(self):
return self.context.num_comp_vectors
Expand Down
4 changes: 4 additions & 0 deletions pyverbs/providers/mlx5/mlx5dv.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ cdef class Mlx5DevxObj(PyverbsCM):
def out_view(self):
return self.out_view

@property
def obj(self):
return <object>self.obj

def __dealloc__(self):
self.close()

Expand Down

0 comments on commit 8c0caf1

Please sign in to comment.