Exemple #1
0
 def to_rts(self):
     """
     Set the QP attributes' values to arbitrary values (same values used in
     ibv_rc_pingpong).
     :return: None
     """
     attr = QPAttr(port_num=self.ib_port)
     attr.dest_qp_num = self.rqpn
     attr.path_mtu = PATH_MTU
     attr.max_dest_rd_atomic = MAX_DEST_RD_ATOMIC
     attr.min_rnr_timer = MIN_RNR_TIMER
     attr.rq_psn = self.psn
     attr.sq_psn = self.rpsn
     attr.timeout = TIMEOUT
     attr.retry_cnt = RETRY_CNT
     attr.rnr_retry = RNR_RETRY
     attr.max_rd_atomic = MAX_RD_ATOMIC
     gr = GlobalRoute(dgid=self.ctx.query_gid(self.ib_port, self.gid_index),
                      sgid_index=self.gid_index)
     ah_attr = AHAttr(port_num=self.ib_port,
                      is_global=1,
                      gr=gr,
                      dlid=self.port_attr.lid)
     attr.ah_attr = ah_attr
     self.qp.to_rts(attr)
Exemple #2
0
 def test_create_ah_roce(self):
     """
     Verify that AH can't be created without GRH in RoCE
     """
     done = 0
     for ctx, attr, attr_ex in self.devices:
         pd = PD(ctx)
         for port_num in range(1, 1 + attr.phys_port_cnt):
             port_attr = ctx.query_port(port_num)
             if port_attr.state != e.IBV_PORT_ACTIVE and \
                port_attr.state != e.IBV_PORT_INIT:
                 continue
             if port_attr.link_layer != e.IBV_LINK_LAYER_ETHERNET:
                 raise unittest.SkipTest('RoCE tests are only supported on Ethernet link layer')
             ah_attr = AHAttr(is_global=0, port_num=port_num)
             try:
                 ah = AH(pd, attr=ah_attr)
             except PyverbsRDMAError as ex:
                 if ex.error_code == errno.EOPNOTSUPP:
                     raise unittest.SkipTest('Create AH is not supported')
                 assert 'Failed to create AH' in str(ex)
                 done +=1
             else:
                 raise PyverbsError('Created a non-global AH on RoCE')
     if done == 0:
         raise unittest.SkipTest('No port is up, can\'t create AH')
Exemple #3
0
 def test_create_ah_roce(self):
     """
     Verify that AH can't be created without GRH in RoCE
     """
     done = 0
     for ctx, attr, attr_ex in self.devices:
         pd = PD(ctx)
         for port_num in range(1, 1 + attr.phys_port_cnt):
             port_attr = ctx.query_port(port_num)
             if port_attr.state != e.IBV_PORT_ACTIVE and \
                port_attr.state != e.IBV_PORT_INIT:
                 continue
             if port_attr.link_layer == e.IBV_LINK_LAYER_INFINIBAND:
                 raise unittest.SkipTest(
                     'Can\'t run RoCE tests on IB link layer')
             ah_attr = AHAttr(is_global=0, port_num=port_num)
             try:
                 ah = AH(pd, attr=ah_attr)
             except PyverbsError as err:
                 assert 'Failed to create AH' in err.args[0]
                 done += 1
             else:
                 raise PyverbsError('Created a non-global AH on RoCE')
     if done == 0:
         raise unittest.SkipTest('No port is up, can\'t create AH')
Exemple #4
0
def get_global_ah(agr_obj, gid_index, port):
    gr = GlobalRoute(dgid=agr_obj.ctx.query_gid(port, gid_index),
                     sgid_index=gid_index)
    ah_attr = AHAttr(port_num=port,
                     is_global=1,
                     gr=gr,
                     dlid=agr_obj.port_attr.lid)
    return AH(agr_obj.pd, attr=ah_attr)
 def create_qp_attr(self):
     qp_attr = QPAttr(port_num=self.ib_port)
     set_rnr_attributes(qp_attr)
     qp_access = e.IBV_ACCESS_LOCAL_WRITE | e.IBV_ACCESS_REMOTE_WRITE
     qp_attr.qp_access_flags = qp_access
     gr = GlobalRoute(dgid=self.ctx.query_gid(self.ib_port, self.gid_index),
                      sgid_index=self.gid_index)
     ah_attr = AHAttr(port_num=self.ib_port, is_global=1, gr=gr,
                      dlid=self.port_attr.lid)
     qp_attr.ah_attr = ah_attr
     return qp_attr
Exemple #6
0
 def test_destroy_ah(self):
     """
     Test ibv_destroy_ah.
     """
     for ctx, attr, attr_ex in self.devices:
         pd = PD(ctx)
         for port_num in range(1, 1 + attr.phys_port_cnt):
             gr = get_global_route(ctx)
             ah_attr = AHAttr(gr=gr, is_global=1, port_num=port_num)
             with AH(pd, attr=ah_attr) as ah:
                 ah.close()
Exemple #7
0
 def test_create_ah(self):
     """
     Test ibv_create_ah.
     """
     self.verify_state(self.ctx)
     gr = u.get_global_route(self.ctx, port_num=self.ib_port)
     ah_attr = AHAttr(gr=gr, is_global=1, port_num=self.ib_port)
     pd = PD(self.ctx)
     try:
         AH(pd, attr=ah_attr)
     except PyverbsRDMAError as ex:
         if ex.error_code == errno.EOPNOTSUPP:
             raise unittest.SkipTest('Create AH is not supported')
         raise ex
Exemple #8
0
 def test_create_ah_roce(self):
     """
     Verify that AH can't be created without GRH in RoCE
     """
     self.verify_link_layer_ether(self.ctx)
     self.verify_state(self.ctx)
     pd = PD(self.ctx)
     ah_attr = AHAttr(is_global=0, port_num=self.ib_port)
     try:
         AH(pd, attr=ah_attr)
     except PyverbsRDMAError as ex:
         if ex.error_code == errno.EOPNOTSUPP:
             raise unittest.SkipTest('Create AH is not supported')
         assert 'Failed to create AH' in str(ex)
     else:
         raise PyverbsError(f'Successfully created a non-global AH on RoCE port={self.ib_port}')
Exemple #9
0
 def test_efadv_query_ah(self):
     """
     Test efadv_query_ah()
     """
     pd = PD(self.ctx)
     try:
         gr = u.get_global_route(self.ctx, port_num=self.ib_port)
         ah_attr = AHAttr(gr=gr, is_global=1, port_num=self.ib_port)
         ah = efa.EfaAH(pd, attr=ah_attr)
         query_ah_attr = ah.query_efa_ah()
         if self.config['verbosity']:
             print(f'\n{query_ah_attr}')
     except PyverbsRDMAError as ex:
         if ex.error_code == errno.EOPNOTSUPP:
             raise unittest.SkipTest('Not supported on non EFA devices')
         raise ex
Exemple #10
0
 def test_destroy_ah(self):
     """
     Test ibv_destroy_ah.
     """
     for ctx, _, _ in self.devices:
         self.verify_state(ctx)
         gr = u.get_global_route(ctx, port_num=self.ib_port)
         ah_attr = AHAttr(gr=gr, is_global=1, port_num=self.ib_port)
         pd = PD(ctx)
         try:
             with AH(pd, attr=ah_attr) as ah:
                 ah.close()
         except PyverbsRDMAError as ex:
             if ex.error_code == errno.EOPNOTSUPP:
                 raise unittest.SkipTest('Create AH is not supported')
             raise ex
Exemple #11
0
 def test_create_ah(self):
     """
     Test ibv_create_ah.
     """
     self.verify_state(self.ctx)
     gr = u.get_global_route(self.ctx, port_num=self.ib_port)
     port_attrs = self.ctx.query_port(self.ib_port)
     dlid = port_attrs.lid if port_attrs.link_layer == e.IBV_LINK_LAYER_INFINIBAND else 0
     ah_attr = AHAttr(dlid=dlid, gr=gr, is_global=1, port_num=self.ib_port)
     pd = PD(self.ctx)
     try:
         AH(pd, attr=ah_attr)
     except PyverbsRDMAError as ex:
         if ex.error_code == errno.EOPNOTSUPP:
             raise unittest.SkipTest('Create AH is not supported')
         raise ex
Exemple #12
0
 def to_rts(self):
     gid = self.ctx.query_gid(self.ib_port, self.gid_index)
     gr = GlobalRoute(dgid=gid, sgid_index=self.gid_index)
     ah_attr = AHAttr(port_num=self.ib_port, is_global=True,
                      gr=gr, dlid=self.port_attr.lid)
     qp_attr = QPAttr()
     qp_attr.path_mtu = PATH_MTU
     set_rnr_attributes(qp_attr)
     qp_attr.ah_attr = ah_attr
     for i in range(self.qp_count):
         qp_attr.dest_qp_num = self.rqps_num[i][1]
         qp_attr.rq_psn = self.psns[i]
         qp_attr.sq_psn = self.rpsns[i]
         self.rqp_lst[i].to_rts(qp_attr)
         qp_attr.dest_qp_num = self.rqps_num[i][0]
         self.sqp_lst[i].to_rts(qp_attr)
Exemple #13
0
 def test_create_ah(self):
     """
     Test ibv_create_ah.
     """
     done = 0
     for ctx, attr, attr_ex in self.devices:
         pd = PD(ctx)
         for port_num in range(1, 1 + attr.phys_port_cnt):
             state = ctx.query_port(port_num).state
             if state != e.IBV_PORT_ACTIVE and state != e.IBV_PORT_INIT:
                 continue
             gr = get_global_route(ctx, port_num=port_num)
             ah_attr = AHAttr(gr=gr, is_global=1, port_num=port_num)
             with AH(pd, attr=ah_attr):
                 done += 1
     if done == 0:
         raise unittest.SkipTest('No port is up, can\'t create AH')
Exemple #14
0
 def test_create_ah_roce(self):
     """
     Verify that AH can't be created without GRH in RoCE
     """
     for ctx, attr, attr_ex in self.devices:
         pd = PD(ctx)
         for port_num in range(1, 1 + attr.phys_port_cnt):
             port_attr = ctx.query_port(port_num)
             if port_attr.link_layer == e.IBV_LINK_LAYER_INFINIBAND:
                 return
             ah_attr = AHAttr(is_global=0, port_num=port_num)
             try:
                 ah = AH(pd, attr=ah_attr)
             except PyverbsError as err:
                 assert 'Failed to create AH' in err.args[0]
             else:
                 raise PyverbsError('Created a non-global AH on RoCE')
Exemple #15
0
 def to_rts(self):
     gid = self.ctx.query_gid(self.ib_port, self.gid_index)
     gr = GlobalRoute(dgid=gid, sgid_index=self.gid_index)
     ah_attr = AHAttr(port_num=self.ib_port, is_global=True,
                      gr=gr, dlid=self.port_attr.lid)
     qp_attr = QPAttr()
     qp_attr.path_mtu = PATH_MTU
     qp_attr.timeout = TIMEOUT
     qp_attr.retry_cnt = RETRY_CNT
     qp_attr.rnr_retry = RNR_RETRY
     qp_attr.min_rnr_timer = MIN_RNR_TIMER
     qp_attr.ah_attr = ah_attr
     for i in range(self.qp_count):
         qp_attr.dest_qp_num = self.rqps_num[i][1]
         qp_attr.rq_psn = self.psns[i]
         qp_attr.sq_psn = self.rpsns[i]
         self.rqp_lst[i].to_rts(qp_attr)
         qp_attr.dest_qp_num = self.rqps_num[i][0]
         self.sqp_lst[i].to_rts(qp_attr)
Exemple #16
0
def post_send(agr_obj, send_wr, gid_index, port):
    """
    Post a single send WR to the QP. Post_send's second parameter (send bad wr)
    is ignored for simplicity. For UD traffic an address vector is added as
    well.
    :param agr_obj: aggregation object which contains all resources necessary
    :param send_wr: Send work request to post send
    :param gid_index: Local gid index
    :param port: IB port number
    :return: None
    """
    qp_type = agr_obj.qp.qp_type
    if qp_type == e.IBV_QPT_UD:
        gr = GlobalRoute(dgid=agr_obj.ctx.query_gid(port, gid_index),
                         sgid_index=gid_index)
        ah_attr = AHAttr(port_num=port, is_global=1, gr=gr,
                         dlid=agr_obj.port_attr.lid)
        ah = AH(agr_obj.pd, attr=ah_attr)
        send_wr.set_wr_ud(ah, agr_obj.rqpn, agr_obj.UD_QKEY)
    agr_obj.qp.post_send(send_wr, None)
Exemple #17
0
 def to_rts(self):
     """
     Set the QP attributes' values to arbitrary values (same values used in
     ibv_rc_pingpong).
     :return: None
     """
     attr = self.create_qp_attr()
     attr.path_mtu = PATH_MTU
     attr.max_dest_rd_atomic = MAX_DEST_RD_ATOMIC
     set_rnr_attributes(attr)
     attr.max_rd_atomic = MAX_RD_ATOMIC
     gr = GlobalRoute(dgid=self.ctx.query_gid(self.ib_port, self.gid_index),
                      sgid_index=self.gid_index)
     ah_attr = AHAttr(port_num=self.ib_port, is_global=1, gr=gr,
                      dlid=self.port_attr.lid)
     attr.ah_attr = ah_attr
     for i in range(self.qp_count):
         attr.dest_qp_num = self.rqps_num[i]
         attr.rq_psn = self.psns[i]
         attr.sq_psn = self.rpsns[i]
         self.qps[i].to_rts(attr)
Exemple #18
0
 def test_create_ah(self):
     """
     Test ibv_create_ah.
     """
     done = 0
     for ctx, attr, attr_ex in self.devices:
         pd = PD(ctx)
         for port_num in range(1, 1 + attr.phys_port_cnt):
             state = ctx.query_port(port_num).state
             if state != e.IBV_PORT_ACTIVE and state != e.IBV_PORT_INIT:
                 continue
             gr = u.get_global_route(ctx, port_num=port_num)
             ah_attr = AHAttr(gr=gr, is_global=1, port_num=port_num)
             try:
                 with AH(pd, attr=ah_attr):
                     done += 1
             except PyverbsRDMAError as ex:
                 if ex.error_code == errno.EOPNOTSUPP:
                     raise unittest.SkipTest('Create AH is not supported')
                 raise ex
     if done == 0:
         raise unittest.SkipTest('No port is up, can\'t create AH')