コード例 #1
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
コード例 #2
0
 def create_qp(self):
     qia = QPInitAttr(e.IBV_QPT_RAW_PACKET,
                      rcq=self.cq,
                      scq=self.cq,
                      cap=QPCap())
     try:
         qp = QP(self.pd, qia)
     except PyverbsRDMAError as ex:
         if ex.error_code == errno.EOPNOTSUPP:
             raise unittest.SkipTest(
                 "Create Raw Packet QP is not supported")
         raise ex
     qp.to_init(QPAttr())
     return qp
コード例 #3
0
ファイル: test_qp.py プロジェクト: rixon/rdma-core
 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'
コード例 #4
0
ファイル: test_qp.py プロジェクト: shines001/rdma-core
 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'
コード例 #5
0
 def create_qp(self):
     qia = QPInitAttr(e.IBV_QPT_RAW_PACKET, rcq=self.cq, scq=self.cq,
                      cap=QPCap())
     qp = QP(self.pd, qia)
     qp.to_init(QPAttr())
     return qp