def test_create_cq_ex(self): """ Test ibv_create_cq_ex() """ cq_init_attrs_ex = CqInitAttrEx(cqe=10, wc_flags=0, comp_mask=0, flags=0) if self.attr_ex.raw_packet_caps & e.IBV_RAW_PACKET_CAP_CVLAN_STRIPPING: cq_init_attrs_ex.wc_flags = e.IBV_WC_EX_WITH_CVLAN CQEX(self.ctx, cq_init_attrs_ex) for flag in list(e.ibv_create_cq_wc_flags): cq_init_attrs_ex.wc_flags = flag try: cq_ex = CQEX(self.ctx, cq_init_attrs_ex) cq_ex.close() except PyverbsRDMAError as ex: if ex.error_code != errno.EOPNOTSUPP: raise ex cq_init_attrs_ex.wc_flags = 0 cq_init_attrs_ex.comp_mask = e.IBV_CQ_INIT_ATTR_MASK_FLAGS attr_flags = list(e.ibv_create_cq_attr_flags) for flag in attr_flags: cq_init_attrs_ex.flags = flag try: cq_ex = CQEX(self.ctx, cq_init_attrs_ex) cq_ex.close() except PyverbsRDMAError as ex: if ex.error_code != errno.EOPNOTSUPP: raise ex
def test_destroy_cq_ex(self): """ Test ibv_destroy_cq() for extended CQs """ for ctx, attr, attr_ex in self.devices: cqe = get_num_cqes(attr) cq_init_attrs_ex = CqInitAttrEx(cqe=cqe, wc_flags=0, comp_mask=0, flags=0) wc_flags = get_cq_flags_with_caps() if attr_ex.raw_packet_caps & e.IBV_RAW_PACKET_CAP_CVLAN_STRIPPING == 0: wc_flags.remove(e.IBV_WC_EX_WITH_CVLAN) for f in wc_flags: cq_init_attrs_ex.wc_flags = f with CQEX(ctx, cq_init_attrs_ex) as cq: cq.close() # For the wc_flags that have no capability bit, we're not raising # an exception for EOPNOTSUPPORT wc_flags = get_cq_flags_with_no_caps() for f in wc_flags: cq_init_attrs_ex.wc_flags = f try: with CQEX(ctx, cq_init_attrs_ex) as cq: cq.close() except PyverbsError as ex: assert 'Failed to create extended CQ' in ex.args[0] assert ' Errno: 95' in ex.args[0] cq_init_attrs_ex.wc_flags = 0 cq_init_attrs_ex.comp_mask = e.IBV_CQ_INIT_ATTR_MASK_FLAGS attr_flags = list(e.ibv_create_cq_attr_flags) for f in attr_flags: cq_init_attrs_ex.flags = f try: with CQEX(ctx, cq_init_attrs_ex) as cq: cq.close() except PyverbsError as ex: assert 'Failed to create extended CQ' in ex.args[0] assert ' Errno: 95' in ex.args[0]