Skip to content

Commit

Permalink
tests: Add EFA direct verbs query MR test
Browse files Browse the repository at this point in the history
Add basic coverage for EFA direct verbs query MR function.

Signed-off-by: Michael Margolin <[email protected]>
  • Loading branch information
mrgolin committed Dec 5, 2023
1 parent 93f8a1e commit 084312a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_efadv.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from pyverbs.cq import CQ
import pyverbs.enums as e
from pyverbs.pd import PD
from pyverbs.mr import MR

from tests.efa_base import EfaAPITestCase, EfaRDMATestCase, EfaCQRes
import tests.utils as u
Expand Down Expand Up @@ -152,3 +153,24 @@ def test_dv_cq_ex_with_sgid(self):
u.send(self.client, sg, e.IBV_WR_SEND, new_send=True, qp_idx=0, ah=ah_client)
u.poll_cq_ex(self.client.cq)
u.poll_cq_ex(self.server.cq, sgid=self.server.remote_gid)


class EfaMRTest(EfaAPITestCase):
"""
Test various EFA-specific functionalities of the MR class.
"""
def test_efadv_query_mr(self):
with efa.EfaContext(name=self.ctx.name) as efa_ctx, PD(self.ctx) as pd:
try:
mr = MR(pd, 16, e.IBV_ACCESS_LOCAL_WRITE)
mr_attrs = efa_ctx.query_efa_mr(mr)
if self.config['verbosity']:
print(f'\n{mr_attrs}')

assert(mr_attrs.pci_bus_id_validity & ~(efa_e.EFADV_MR_ATTR_VALIDITY_RECV_PCI_BUS_ID |
efa_e.EFADV_MR_ATTR_VALIDITY_RDMA_READ_PCI_BUS_ID |
efa_e.EFADV_MR_ATTR_VALIDITY_RDMA_RECV_PCI_BUS_ID) == 0)
except PyverbsRDMAError as ex:
if ex.error_code in [errno.EOPNOTSUPP, errno.ENOTTY, errno.EPROTONOSUPPORT]:
raise unittest.SkipTest(f'Query MR not supported, errno={ex.error_code}')
raise ex

0 comments on commit 084312a

Please sign in to comment.