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