Exemple #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:
                 # 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'
Exemple #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
Exemple #3
0
def create_qp_ex(agr_obj, qp_type, send_flags):
    if qp_type == e.IBV_QPT_XRC_SEND:
        cap = QPCap(max_send_wr=agr_obj.num_msgs, max_recv_wr=0, max_recv_sge=0,
                    max_send_sge=1)
    else:
        cap = QPCap(max_send_wr=agr_obj.num_msgs, max_recv_wr=agr_obj.num_msgs,
                    max_recv_sge=1, max_send_sge=1)
    qia = QPInitAttrEx(cap=cap, qp_type=qp_type, scq=agr_obj.cq,
                       rcq=agr_obj.cq, pd=agr_obj.pd, send_ops_flags=send_flags,
                       comp_mask=e.IBV_QP_INIT_ATTR_PD |
                                 e.IBV_QP_INIT_ATTR_SEND_OPS_FLAGS)
    qp_attr = QPAttr(port_num=agr_obj.ib_port)
    if qp_type == e.IBV_QPT_UD:
        qp_attr.qkey = agr_obj.UD_QKEY
        qp_attr.pkey_index = agr_obj.UD_PKEY_INDEX
    if qp_type == e.IBV_QPT_RC:
        qp_attr.qp_access_flags = e.IBV_ACCESS_REMOTE_WRITE | \
                                  e.IBV_ACCESS_REMOTE_READ | \
                                  e.IBV_ACCESS_REMOTE_ATOMIC
    try:
        # We don't have capability bits for this
        qp = QPEx(agr_obj.ctx, qia, qp_attr)
    except PyverbsRDMAError as ex:
        if ex.error_code == errno.EOPNOTSUPP:
            raise unittest.SkipTest('Extended QP is not supported on this device')
        raise ex
    return qp
Exemple #4
0
 def create_qp(self):
     qp_caps = QPCap(max_recv_wr=self.num_msgs)
     qp_init_attr = QPInitAttr(qp_type=e.IBV_QPT_UD, cap=qp_caps,
                               scq=self.cq, rcq=self.cq)
     qp_attr = QPAttr(port_num=self.ib_port)
     qp_attr.qkey = self.UD_QKEY
     qp_attr.pkey_index = self.UD_PKEY_INDEX
     self.qp = QP(self.pd, qp_init_attr, qp_attr)
Exemple #5
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'
Exemple #6
0
 def create_qp_attr(self):
     attr = QPAttr(port_num=self.ib_port)
     attr.qkey = self.SRD_QKEY
     attr.pkey_index = self.SRD_PKEY_INDEX
     return attr