diff mbox series

[rdma-core] tests: Pass the specified gid index to u.get_global_route()

Message ID 20220901073836.1573-1-yangx.jy@fujitsu.com (mailing list archive)
State Accepted
Headers show
Series [rdma-core] tests: Pass the specified gid index to u.get_global_route() | expand

Commit Message

Xiao Yang Sept. 1, 2022, 7:38 a.m. UTC
test_create_ah() or test_destroy_ah() always triggered the following
error on SoftRoCE because the specified gid index didn't work.

$ bin/run_tests.py --dev rxe_enp0s5 --gid 1 -v tests.test_addr.AHTest.test_create_ah
test_create_ah (tests.test_addr.AHTest)
Test ibv_create_ah. ... ERROR

======================================================================
ERROR: test_create_ah (tests.test_addr.AHTest)
Test ibv_create_ah.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/rdma-core/tests/test_addr.py", line 51, in test_create_ah
    raise ex
  File "/root/rdma-core/tests/test_addr.py", line 47, in test_create_ah
    AH(pd, attr=ah_attr)
  File "addr.pyx", line 410, in pyverbs.addr.AH.__init__
pyverbs.pyverbs_error.PyverbsRDMAError: Failed to create AH. Errno: 110, Connection timed out

----------------------------------------------------------------------
Ran 1 test in 1.271s

FAILED (errors=1)

Try to fix the issue by passing the specified gid index to u.get_global_route().

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
---
 tests/base.py      | 4 ++++
 tests/test_addr.py | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Leon Romanovsky Sept. 5, 2022, 12:13 p.m. UTC | #1
On Thu, Sep 01, 2022 at 07:38:41AM +0000, yangx.jy@fujitsu.com wrote:
> test_create_ah() or test_destroy_ah() always triggered the following
> error on SoftRoCE because the specified gid index didn't work.
> 
> $ bin/run_tests.py --dev rxe_enp0s5 --gid 1 -v tests.test_addr.AHTest.test_create_ah
> test_create_ah (tests.test_addr.AHTest)
> Test ibv_create_ah. ... ERROR
> 
> ======================================================================
> ERROR: test_create_ah (tests.test_addr.AHTest)
> Test ibv_create_ah.
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/root/rdma-core/tests/test_addr.py", line 51, in test_create_ah
>     raise ex
>   File "/root/rdma-core/tests/test_addr.py", line 47, in test_create_ah
>     AH(pd, attr=ah_attr)
>   File "addr.pyx", line 410, in pyverbs.addr.AH.__init__
> pyverbs.pyverbs_error.PyverbsRDMAError: Failed to create AH. Errno: 110, Connection timed out
> 
> ----------------------------------------------------------------------
> Ran 1 test in 1.271s
> 
> FAILED (errors=1)
> 
> Try to fix the issue by passing the specified gid index to u.get_global_route().
> 
> Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
> ---
>  tests/base.py      | 4 ++++
>  tests/test_addr.py | 4 ++--
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 

Thanks, applied.
diff mbox series

Patch

diff --git a/tests/base.py b/tests/base.py
index 9229df35..2bf19ff0 100644
--- a/tests/base.py
+++ b/tests/base.py
@@ -76,6 +76,7 @@  class PyverbsAPITestCase(unittest.TestCase):
         self.ctx = None
         self.attr = None
         self.attr_ex = None
+        self.gid_index = 0
 
     def setUp(self):
         """
@@ -93,6 +94,9 @@  class PyverbsAPITestCase(unittest.TestCase):
                 raise unittest.SkipTest('No IB devices found')
             self.dev_name = dev_list[0].name.decode()
 
+        if self.config['gid']:
+            self.gid_index = self.config['gid']
+
         self.create_context()
         self.attr = self.ctx.query_device()
         self.attr_ex = self.ctx.query_device_ex()
diff --git a/tests/test_addr.py b/tests/test_addr.py
index 561812de..5b6c5efb 100644
--- a/tests/test_addr.py
+++ b/tests/test_addr.py
@@ -38,7 +38,7 @@  class AHTest(PyverbsAPITestCase):
         Test ibv_create_ah.
         """
         self.verify_state(self.ctx)
-        gr = u.get_global_route(self.ctx, port_num=self.ib_port)
+        gr = u.get_global_route(self.ctx, gid_index=self.gid_index, port_num=self.ib_port)
         port_attrs = self.ctx.query_port(self.ib_port)
         dlid = port_attrs.lid if port_attrs.link_layer == e.IBV_LINK_LAYER_INFINIBAND else 0
         ah_attr = AHAttr(dlid=dlid, gr=gr, is_global=1, port_num=self.ib_port)
@@ -72,7 +72,7 @@  class AHTest(PyverbsAPITestCase):
         Test ibv_destroy_ah.
         """
         self.verify_state(self.ctx)
-        gr = u.get_global_route(self.ctx, port_num=self.ib_port)
+        gr = u.get_global_route(self.ctx, gid_index=self.gid_index, port_num=self.ib_port)
         port_attrs = self.ctx.query_port(self.ib_port)
         dlid = port_attrs.lid if port_attrs.link_layer == e.IBV_LINK_LAYER_INFINIBAND else 0
         ah_attr = AHAttr(dlid=dlid, gr=gr, is_global=1, port_num=self.ib_port)