Skip to content

Commit

Permalink
Merge pull request #1509 from mohammadheib/bnxt_skip_cq_resize
Browse files Browse the repository at this point in the history
tests: Skip CQ shrinking for bnxt_re devices.
  • Loading branch information
rleon authored Nov 12, 2024
2 parents 69ac14f + 906b210 commit e8b1192
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion providers/bnxt_re/verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,10 @@ struct ibv_cq *bnxt_re_create_cq(struct ibv_context *ibvctx, int ncqe,
struct bnxt_re_context *cntx = to_bnxt_re_context(ibvctx);
struct bnxt_re_dev *dev = to_bnxt_re_dev(ibvctx->device);

if (ncqe > dev->max_cq_depth)
if (ncqe > dev->max_cq_depth) {
errno = EINVAL;
return NULL;
}

cq = calloc(1, (sizeof(*cq) + sizeof(struct bnxt_re_queue)));
if (!cq)
Expand Down
12 changes: 8 additions & 4 deletions tests/test_cq.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,24 @@ def test_resize_cq(self):

# Increase the CQ size.
new_cq_size = 7
post_send_num = new_cq_size - 1
self.client.cq.resize(new_cq_size)
self.assertTrue(self.client.cq.cqe >= new_cq_size,
f'The actual CQ size ({self.client.cq.cqe}) is less '
'than guaranteed ({new_cq_size})')

irdma.skip_if_irdma_dev(d.Context(name=self.dev_name))
# Fill the CQ entries except one for avoid cq_overrun warnings.
send_wr, _ = u.get_send_elements(self.client, False)
ah_client = u.get_global_ah(self.client, self.gid_index, self.ib_port)
for i in range(self.client.cq.cqe - 1):
for i in range(post_send_num):
u.send(self.client, send_wr, ah=ah_client)

# Decrease the CQ size to less than the CQ unpolled entries.
new_cq_size = 1
with self.assertRaises(PyverbsRDMAError) as ex:
try:
self.client.cq.resize(new_cq_size)
self.assertEqual(ex.exception.error_code, errno.EINVAL)
except PyverbsRDMAError as ex:
self.assertEqual(ex.error_code, errno.EINVAL)
finally:
for i in range(post_send_num):
u.poll_cq(self.client.cq)

0 comments on commit e8b1192

Please sign in to comment.