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
def create_qps(self): """ Initializes self.qps with RSS QPs. :return: None """ qp_init_attr = self.create_qp_init_attr() for _ in range(self.qp_count): try: qp = QPEx(self.ctx, qp_init_attr) self.qps.append(qp) self.qps_num.append(qp.qp_num) self.psns.append(random.getrandbits(24)) except PyverbsRDMAError as ex: if ex.error_code == errno.EOPNOTSUPP: raise unittest.SkipTest(f'Create QPEx type {qp_init_attr.qp_type} is not ' 'supported') raise ex