|
|
fa196d |
From 7be6d311d4bbdb93d06abfc9888e9f805d2d6fdb Mon Sep 17 00:00:00 2001
|
|
|
fa196d |
From: Edward Srouji <edwards@nvidia.com>
|
|
|
fa196d |
Date: Wed, 30 Dec 2020 17:03:34 +0200
|
|
|
fa196d |
Subject: [PATCH] tests: Check CQE compression cap before using it
|
|
|
fa196d |
|
|
|
fa196d |
Add a CQE compression capability check in mlx5 CQ tests before creating
|
|
|
fa196d |
a CQ. If the device does not support the requested CQE compression type,
|
|
|
fa196d |
the test will be skipped.
|
|
|
fa196d |
|
|
|
fa196d |
Fixes: 8aae7abe241c ("tests: Add mlx5 CQ tests")
|
|
|
fa196d |
Signed-off-by: Edward Srouji <edwards@nvidia.com>
|
|
|
fa196d |
Reviewed-by: Ido Kalir <idok@nvidia.com>
|
|
|
fa196d |
---
|
|
|
fa196d |
tests/test_mlx5_cq.py | 8 +++++++-
|
|
|
fa196d |
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
fa196d |
|
|
|
fa196d |
diff --git a/tests/test_mlx5_cq.py b/tests/test_mlx5_cq.py
|
|
|
fa196d |
index 1f757c27345e..8be568c54262 100644
|
|
|
fa196d |
--- a/tests/test_mlx5_cq.py
|
|
|
fa196d |
+++ b/tests/test_mlx5_cq.py
|
|
|
fa196d |
@@ -2,7 +2,7 @@ import unittest
|
|
|
fa196d |
import errno
|
|
|
fa196d |
|
|
|
fa196d |
from pyverbs.providers.mlx5.mlx5dv import Mlx5Context, Mlx5DVContextAttr, \
|
|
|
fa196d |
- Mlx5DVCQInitAttr, Mlx5CQ, context_flags_to_str
|
|
|
fa196d |
+ Mlx5DVCQInitAttr, Mlx5CQ, context_flags_to_str, cqe_comp_to_str
|
|
|
fa196d |
from pyverbs.pyverbs_error import PyverbsRDMAError, PyverbsUserError
|
|
|
fa196d |
from tests.base import RDMATestCase, RCResources
|
|
|
fa196d |
import pyverbs.providers.mlx5.mlx5_enums as dve
|
|
|
fa196d |
@@ -22,6 +22,12 @@ def create_dv_cq(res):
|
|
|
fa196d |
if res.cqe_comp_res_format:
|
|
|
fa196d |
dvcq_init_attr.cqe_comp_res_format = res.cqe_comp_res_format
|
|
|
fa196d |
dvcq_init_attr.comp_mask |= dve.MLX5DV_CQ_INIT_ATTR_MASK_COMPRESSED_CQE
|
|
|
fa196d |
+ # Check CQE compression capability
|
|
|
fa196d |
+ cqe_comp_caps = res.ctx.query_mlx5_device().cqe_comp_caps
|
|
|
fa196d |
+ if not (cqe_comp_caps['supported_format'] & res.cqe_comp_res_format) or \
|
|
|
fa196d |
+ not cqe_comp_caps['max_num']:
|
|
|
fa196d |
+ cqe_comp_str = cqe_comp_to_str(res.cqe_comp_res_format)
|
|
|
fa196d |
+ raise unittest.SkipTest(f'CQE compression {cqe_comp_str} is not supported')
|
|
|
fa196d |
if res.flags:
|
|
|
fa196d |
dvcq_init_attr.flags = res.flags
|
|
|
fa196d |
dvcq_init_attr.comp_mask |= dve.MLX5DV_CQ_INIT_ATTR_MASK_FLAGS
|
|
|
fa196d |
--
|
|
|
fa196d |
2.25.4
|
|
|
fa196d |
|