Exemple #1
0
 def test_destroy_comp_channel(self):
     """
     Test ibv_destroy_comp_channel()
     """
     for ctx, attr, attr_ex in self.devices:
         cc = CompChannel(ctx)
         cc.close()
Exemple #2
0
 def test_destroy_comp_channel():
     """
     Test ibv_destroy_comp_channel()
     """
     lst = d.get_device_list()
     for dev in lst:
         with d.Context(name=dev.name.decode()) as ctx:
             cc = CompChannel(ctx)
             cc.close()
Exemple #3
0
 def test_create_cq_with_comp_channel(self):
     for cq_size in [1, self.attr.max_cqe / 2, self.attr.max_cqe]:
         try:
             cc = CompChannel(self.ctx)
             CQ(self.ctx, cq_size, None, cc, 0)
             cc.close()
         except PyverbsRDMAError as ex:
             if ex.error_code == errno.EOPNOTSUPP:
                 raise unittest.SkipTest(
                     f'CQ with completion channel is not supported')
Exemple #4
0
 def test_create_comp_channel(self):
     """
     Test ibv_create_comp_channel()
     """
     for ctx, attr, attr_ex in self.devices:
         with CompChannel(ctx):
             pass
Exemple #5
0
 def test_create_cq_bad_flow(self):
     """
     Test ibv_create_cq() with a wrong comp_vector / cqe number
     """
     for ctx, attr, attr_ex in self.devices:
         for i in range(10):
             cc = CompChannel(ctx)
             cqes = 100
             comp_vector = ctx.num_comp_vectors + int(100 * random.random())
             has_cc = random.choice([True, False])
             if not has_cc:
                 cc = None
             try:
                 with CQ(ctx, cqes, None, cc, comp_vector):
                     pass
             except PyverbsError as e:
                 assert 'Failed to create a CQ' in e.args[0]
                 assert 'Invalid argument' in e.args[0]
             else:
                 raise PyverbsError(
                     'Created a CQ with comp_vector={n} while device\'s num_comp_vectors={nc}'
                     .format(n=comp_vector, nc=ctx.num_comp_vectors))
             max_cqe = ctx.query_device().max_cqe
             cqes = random.randint(max_cqe + 1, max_cqe + 100)
             try:
                 with CQ(ctx, cqes, None, cc, 0):
                     pass
             except PyverbsError as err:
                 assert 'Failed to create a CQ' in err.args[0]
                 assert 'Invalid argument' in err.args[0]
             else:
                 raise PyverbsError(
                     'Created a CQ with cqe={n} while device\'s max_cqe={nc}'
                     .format(n=cqes, nc=max_cqe))
Exemple #6
0
 def test_create_comp_channel():
     """
     Test ibv_create_comp_channel()
     """
     lst = d.get_device_list()
     for dev in lst:
         with d.Context(name=dev.name.decode()) as ctx:
             with CompChannel(ctx):
                 pass
Exemple #7
0
 def test_create_cq_bad_flow():
     """
     Test ibv_create_cq() with a wrong comp_vector / cqe number
     """
     lst = d.get_device_list()
     for dev in lst:
         with d.Context(name=dev.name.decode()) as ctx:
             cqes = get_num_cqes(ctx)
             comp_vector = random.randint(ctx.num_comp_vectors, 100)
             try:
                 if random.choice([True, False]):
                     with CompChannel(ctx) as cc:
                         with CQ(ctx, cqes, None, cc, comp_vector):
                             pass
                 else:
                     with CQ(ctx, cqes, None, None, comp_vector):
                         pass
             except PyverbsError as e:
                 assert 'Failed to create a CQ' in e.args[0]
                 assert 'Invalid argument' in e.args[0]
             else:
                 raise PyverbsError(
                     'Created a CQ with comp_vector={n} while device\'s num_comp_vectors={nc}'
                     .format(n=comp_vector, nc=ctx.num_comp_vectors))
             max_cqe = ctx.query_device().max_cqe
             cqes = random.randint(max_cqe + 1, max_cqe + 100)
             try:
                 if random.choice([True, False]):
                     with CompChannel(ctx) as cc:
                         with CQ(ctx, cqes, None, cc, 0):
                             pass
                 else:
                     with CQ(ctx, cqes, None, None, 0):
                         pass
             except PyverbsError as err:
                 assert 'Failed to create a CQ' in err.args[0]
                 assert 'Invalid argument' in err.args[0]
             else:
                 raise PyverbsError(
                     'Created a CQ with cqe={n} while device\'s max_cqe={nc}'
                     .format(n=cqes, nc=max_cqe))
Exemple #8
0
 def test_destroy_cq(self):
     """
     Test ibv_destroy_cq()
     """
     for ctx, attr, attr_ex in self.devices:
         for i in range(10):
             cqes = get_num_cqes(attr)
             comp_vector = int(ctx.num_comp_vectors * random.random())
             if random.choice([True, False]):
                 with CompChannel(ctx) as cc:
                     cq = CQ(ctx, cqes, None, cc, comp_vector)
             else:
                 cq = CQ(ctx, cqes, None, None, comp_vector)
             cq.close()
Exemple #9
0
 def test_destroy_cq():
     """
     Test ibv_destroy_cq()
     """
     lst = d.get_device_list()
     for dev in lst:
         with d.Context(name=dev.name.decode()) as ctx:
             cqes = get_num_cqes(ctx)
             comp_vector = random.randint(0, ctx.num_comp_vectors - 1)
             if random.choice([True, False]):
                 with CompChannel(ctx) as cc:
                     cq = CQ(ctx, cqes, None, cc, comp_vector)
             else:
                 cq = CQ(ctx, cqes, None, None, comp_vector)
             cq.close()
def create_cq_with_comp_channel(agr_obj):
    agr_obj.comp_channel = CompChannel(agr_obj.ctx)
    agr_obj.cq = CQ(agr_obj.ctx, agr_obj.num_msgs, None, agr_obj.comp_channel)
    agr_obj.cq.req_notify()
Exemple #11
0
 def test_create_cq_with_comp_channel(self):
     for cq_size in [1, self.max_cqe / 2, self.max_cqe]:
         cc = CompChannel(self.ctx)
         CQ(self.ctx, cq_size, None, cc, 0)
         cc.close()