Exemplo n.º 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)
Exemplo n.º 2
0
 def test_modify_qp(self):
     """
     Queries a QP after calling modify(). Verifies that its properties are
     as expected.
     """
     for ctx, attr, attr_ex in self.devices:
         with PD(ctx) as pd:
             with CQ(ctx, 100, None, None, 0) as cq:
                 is_ex = random.choice([True, False])
                 if is_ex:
                     qia = get_qp_init_attr_ex(cq, pd, [e.IBV_QPT_UD], attr,
                                               attr_ex)
                 else:
                     qia = get_qp_init_attr(cq, [e.IBV_QPT_UD], attr)
                 qp = QP(ctx, qia) if is_ex \
                     else QP(pd, qia)
                 qa = QPAttr()
                 qa.qkey = 0x123
                 qp.to_init(qa)
                 attr, iattr = qp.query(e.IBV_QP_QKEY)
                 assert attr.qkey == qa.qkey
                 qp.to_rtr(qa)
                 qa.sq_psn = 0x45
                 qp.to_rts(qa)
                 attr, iattr = qp.query(e.IBV_QP_SQ_PSN)
                 assert attr.sq_psn == qa.sq_psn
                 qa.qp_state = e.IBV_QPS_RESET
                 qp.modify(qa, e.IBV_QP_STATE)
                 assert qp.qp_state == e.IBV_QPS_RESET
Exemplo n.º 3
0
 def test_modify_qp(self):
     """
     Queries a QP after calling modify(). Verifies that its properties are
     as expected.
     """
     for ctx, attr, attr_ex in self.devices:
         with PD(ctx) as pd:
             with CQ(ctx, 100, None, None, 0) as cq:
                 # Extended QP
                 qia = get_qp_init_attr_ex(cq, pd, attr, attr_ex, e.IBV_QPT_UD)
                 try:
                     qp = QP(ctx, qia)
                 except PyverbsRDMAError as ex:
                     if ex.error_code == errno.EOPNOTSUPP:
                         raise unittest.SkipTest('Create QP with extended attrs is not supported')
                     raise ex
                 qa = QPAttr()
                 qa.qkey = 0x123
                 qp.to_init(qa)
                 qp_attr, qp_iattr = qp.query(e.IBV_QP_QKEY)
                 assert qp_attr.qkey == qa.qkey, 'Extended QP, QKey is not as expected'
                 qp.to_rtr(qa)
                 qa.sq_psn = 0x45
                 qp.to_rts(qa)
                 qp_attr, qp_iattr = qp.query(e.IBV_QP_SQ_PSN)
                 assert qp_attr.sq_psn == qa.sq_psn, 'Extended QP, SQ PSN is not as expected'
                 qa.qp_state = e.IBV_QPS_RESET
                 qp.modify(qa, e.IBV_QP_STATE)
                 assert qp.qp_state == e.IBV_QPS_RESET, 'Extended QP, QP state is not as expected'
                 # Legacy QP
                 qia = get_qp_init_attr(cq, attr)
                 qp = QP(pd, qia)
                 qa = QPAttr()
                 qa.qkey = 0x123
                 qp.to_init(qa)
                 qp_attr, qp_iattr = qp.query(e.IBV_QP_QKEY)
                 assert qp_attr.qkey == qa.qkey, 'Legacy QP, QKey is not as expected'
                 qp.to_rtr(qa)
                 qa.sq_psn = 0x45
                 qp.to_rts(qa)
                 qp_attr, qp_iattr = qp.query(e.IBV_QP_SQ_PSN)
                 assert qp_attr.sq_psn == qa.sq_psn, 'Legacy QP, SQ PSN is not as expected'
                 qa.qp_state = e.IBV_QPS_RESET
                 qp.modify(qa, e.IBV_QP_STATE)
                 assert qp.qp_state == e.IBV_QPS_RESET, 'Legacy QP, QP state is not as expected'
Exemplo n.º 4
0
 def test_modify_ud_qp(self):
     """
     Queries a UD QP after calling modify(). Verifies that its properties are
     as expected.
     """
     for ctx, attr, attr_ex in self.devices:
         with PD(ctx) as pd:
             with CQ(ctx, 100, None, None, 0) as cq:
                 # Legacy QP
                 qia = u.get_qp_init_attr(cq, attr)
                 qia.qp_type = e.IBV_QPT_UD
                 qp = self.create_qp(pd, qia, False, False, self.ib_port)
                 qa = QPAttr()
                 qa.qkey = 0x123
                 qp.to_init(qa)
                 qp_attr, _ = qp.query(e.IBV_QP_QKEY)
                 assert qp_attr.qkey == qa.qkey, 'Legacy QP, QKey is not as expected'
                 qp.to_rtr(qa)
                 qa.sq_psn = 0x45
                 qp.to_rts(qa)
                 qp_attr, _ = qp.query(e.IBV_QP_SQ_PSN)
                 assert qp_attr.sq_psn == qa.sq_psn, 'Legacy QP, SQ PSN is not as expected'
                 qa.qp_state = e.IBV_QPS_RESET
                 qp.modify(qa, e.IBV_QP_STATE)
                 assert qp.qp_state == e.IBV_QPS_RESET, 'Legacy QP, QP state is not as expected'
                 # Extended QP
                 qia = get_qp_init_attr_ex(cq, pd, attr, attr_ex,
                                           e.IBV_QPT_UD)
                 qp = self.create_qp(ctx, qia, True, False, self.ib_port)
                 qa = QPAttr()
                 qa.qkey = 0x123
                 qp.to_init(qa)
                 qp_attr, _ = qp.query(e.IBV_QP_QKEY)
                 assert qp_attr.qkey == qa.qkey, 'Extended QP, QKey is not as expected'
                 qp.to_rtr(qa)
                 qa.sq_psn = 0x45
                 qp.to_rts(qa)
                 qp_attr, _ = qp.query(e.IBV_QP_SQ_PSN)
                 assert qp_attr.sq_psn == qa.sq_psn, 'Extended QP, SQ PSN is not as expected'
                 qa.qp_state = e.IBV_QPS_RESET
                 qp.modify(qa, e.IBV_QP_STATE)
                 assert qp.qp_state == e.IBV_QPS_RESET, 'Extended QP, QP state is not as expected'
Exemplo n.º 5
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)
Exemplo n.º 6
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)