@@ -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):
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@mellanox.com> --- pyverbs/qp.pyx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)