From 698f2ae804767635342694d31d9590fe6ad2217e Mon Sep 17 00:00:00 2001
From: Kamal Heib <kamalheib1@gmail.com>
Date: Wed, 8 Dec 2021 16:12:11 +0200
Subject: [PATCH] tests: Fix comparing qp_state for iWARP providers.
The initial QP state for iWARP providers is IBV_QPS_INIT (not
IBV_QPS_RESET), Change the test to handle this case.
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
tests/test_qp.py | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/tests/test_qp.py b/tests/test_qp.py
index b952c95e..a66f724f 100644
--- a/tests/test_qp.py
+++ b/tests/test_qp.py
@@ -14,6 +14,7 @@ from pyverbs.pyverbs_error import PyverbsRDMAError
from pyverbs.qp import QPInitAttr, QPAttr, QP
from tests.base import PyverbsAPITestCase
import pyverbs.utils as pu
+import pyverbs.device as d
import pyverbs.enums as e
from pyverbs.pd import PD
from pyverbs.cq import CQ
@@ -177,6 +178,11 @@ class QPTest(PyverbsAPITestCase):
self.assertLessEqual(orig_cap.max_recv_sge, init_attr.cap.max_recv_sge)
self.assertLessEqual(orig_cap.max_inline_data, init_attr.cap.max_inline_data)
+ def get_node_type(self):
+ for dev in d.get_device_list():
+ if dev.name.decode() == self.ctx.name:
+ return dev.node_type
+
def query_qp_common_test(self, qp_type):
with PD(self.ctx) as pd:
with CQ(self.ctx, 100, None, None, 0) as cq:
@@ -190,14 +196,20 @@ class QPTest(PyverbsAPITestCase):
caps = qia.cap
qp = self.create_qp(pd, qia, False, False, self.ib_port)
qp_attr, qp_init_attr = qp.query(e.IBV_QP_STATE | e.IBV_QP_CAP)
- self.verify_qp_attrs(caps, e.IBV_QPS_RESET, qp_init_attr, qp_attr)
+ if self.get_node_type() == e.IBV_NODE_RNIC:
+ self.verify_qp_attrs(caps, e.IBV_QPS_INIT, qp_init_attr, qp_attr)
+ else:
+ self.verify_qp_attrs(caps, e.IBV_QPS_RESET, qp_init_attr, qp_attr)
# Extended QP
qia = get_qp_init_attr_ex(cq, pd, self.attr, self.attr_ex, qp_type)
caps = qia.cap # Save them to verify values later
qp = self.create_qp(self.ctx, qia, True, False, self.ib_port)
qp_attr, qp_init_attr = qp.query(e.IBV_QP_STATE | e.IBV_QP_CAP)
- self.verify_qp_attrs(caps, e.IBV_QPS_RESET, qp_init_attr, qp_attr)
+ if self.get_node_type() == e.IBV_NODE_RNIC:
+ self.verify_qp_attrs(caps, e.IBV_QPS_INIT, qp_init_attr, qp_attr)
+ else:
+ self.verify_qp_attrs(caps, e.IBV_QPS_RESET, qp_init_attr, qp_attr)
def test_query_rc_qp(self):
"""
--
2.31.1