[PATCH rdma-core 1/7] pyverbs: Allow QP creation by provider

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A QP can be created using either the generic interface or a provider
specific interface.
Provider QPs extend the legacy QP, which in Cython means that the
legacy QP's __cinit__ will be called automatically. To avoid QP being
initialized via legacy interface, add **kwargs to QP's __cinit__(). If
kwargs is not empty, the QP's __cinit__ will return without creating
the QP, leaving the initialization to the provider.

Signed-off-by: Noa Osherovich <noaos@xxxxxxxxxxxx>
---
 pyverbs/qp.pyx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/pyverbs/qp.pyx b/pyverbs/qp.pyx
index c526f0ad1bb6..74e2ce76665e 100755
--- a/pyverbs/qp.pyx
+++ b/pyverbs/qp.pyx
@@ -783,7 +783,7 @@ cdef class QPAttr(PyverbsObject):
 
 cdef class QP(PyverbsCM):
     def __cinit__(self, object creator not None, object init_attr not None,
-                  QPAttr qp_attr=None):
+                  QPAttr qp_attr=None, **kwargs):
         """
         Initializes a QP object and performs state transitions according to
         user request.
@@ -803,11 +803,16 @@ cdef class QP(PyverbsCM):
                           using Context).
         :param qp_attr: Optional QPAttr object. Will be used for QP state
                         transitions after creation.
+        :param kwargs: Provider-specific QP creation attributes, meaning that
+                       the QP will be created by the provider.
         :return: An initialized QP object
         """
         cdef PD pd
         cdef Context ctx
         self.update_cqs(init_attr)
+        if len(kwargs) > 0:
+            # Leave QP initialization to the provider
+            return
         # In order to use cdef'd methods, a proper casting must be done, let's
         # infer the type.
         if issubclass(type(creator), Context):
-- 
2.21.0





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux