示例#1
0
 def test_query_qp(self):
     """
     Queries a QP after creation. 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:
                 for i in range(1, attr.phys_port_cnt + 1):
                     qpts = get_qp_types(ctx, i)
                     for qpt in qpts:
                         # Extended QP
                         qia = get_qp_init_attr_ex(cq, pd, attr, attr_ex,
                                                   qpt)
                         caps = qia.cap  # Save them to verify values later
                         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
                         qp_attr, qp_init_attr = qp.query(e.IBV_QP_CUR_STATE |
                                                          e.IBV_QP_CAP)
                         verify_qp_attrs(caps, e.IBV_QPS_RESET, qp_init_attr,
                                         qp_attr)
                         # Legacy QP
                         qia = get_qp_init_attr(cq, attr)
                         qia.qp_type = qpt
                         caps = qia.cap  # Save them to verify values later
                         qp = QP(pd, qia)
                         qp_attr, qp_init_attr = qp.query(e.IBV_QP_CUR_STATE |
                                                          e.IBV_QP_CAP)
                         verify_qp_attrs(caps, e.IBV_QPS_RESET, qp_init_attr,
                                         qp_attr)
示例#2
0
 def test_query_qp(self):
     """
     Queries a QP after creation. 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:
                 for i in range(1, attr.phys_port_cnt + 1):
                     qpts = get_qp_types(ctx, i)
                     for qpt in qpts:
                         # Extended QP
                         qia = get_qp_init_attr_ex(cq, pd, attr, attr_ex,
                                                   qpt)
                         caps = qia.cap  # Save them to verify values later
                         qp = QP(ctx, qia)
                         qp_attr, qp_init_attr = qp.query(e.IBV_QP_CUR_STATE
                                                          | e.IBV_QP_CAP)
                         verify_qp_attrs(caps, e.IBV_QPS_RESET,
                                         qp_init_attr, qp_attr)
                         # Legacy QP
                         qia = get_qp_init_attr(cq, attr)
                         qia.qp_type = qpt
                         caps = qia.cap  # Save them to verify values later
                         qp = QP(pd, qia)
                         qp_attr, qp_init_attr = qp.query(e.IBV_QP_CUR_STATE
                                                          | e.IBV_QP_CAP)
                         verify_qp_attrs(caps, e.IBV_QPS_RESET,
                                         qp_init_attr, qp_attr)
示例#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:
                 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
示例#4
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'
示例#5
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)
                 qp = QP(ctx, 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, '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'
示例#6
0
 def test_query_qp(self):
     """
     Queries a QP after creation. 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:
                 for i in range(1, attr.phys_port_cnt + 1):
                     qpts = get_qp_types(ctx, i)
                     is_ex = random.choice([True, False])
                     if is_ex:
                         qia = get_qp_init_attr_ex(cq, pd, qpts, attr,
                                                   attr_ex)
                     else:
                         qia = get_qp_init_attr(cq, qpts, attr)
                     caps = qia.cap  # Save them to verify values later
                     qp = QP(ctx, qia) if is_ex else QP(pd, qia)
                     attr, init_attr = qp.query(e.IBV_QP_CUR_STATE
                                                | e.IBV_QP_CAP)
                     verify_qp_attrs(caps, e.IBV_QPS_RESET, init_attr, attr)