def create_qps(self): # Create the DCI QPs. qp_init_attr = self.create_qp_init_attr(self.send_ops_flags) try: for _ in range(self.qp_count): comp_mask = dve.MLX5DV_QP_INIT_ATTR_MASK_DC if self.create_flags: comp_mask |= dve.MLX5DV_QP_INIT_ATTR_MASK_QP_CREATE_FLAGS attr = Mlx5DVQPInitAttr(comp_mask=comp_mask, create_flags=self.create_flags, dc_init_attr=Mlx5DVDCInitAttr()) qp = Mlx5QP(self.ctx, qp_init_attr, attr) self.qps.append(qp) self.qps_num.append(qp.qp_num) self.psns.append(random.getrandbits(24)) # Create the DCT QP. qp_init_attr = self.create_qp_init_attr() dc_attr = Mlx5DVDCInitAttr(dc_type=dve.MLX5DV_DCTYPE_DCT, dct_access_key=DCT_KEY) attr = Mlx5DVQPInitAttr(comp_mask=dve.MLX5DV_QP_INIT_ATTR_MASK_DC, dc_init_attr=dc_attr) self.dct_qp = Mlx5QP(self.ctx, qp_init_attr, attr) except PyverbsRDMAError as ex: if ex.error_code == errno.EOPNOTSUPP: raise unittest.SkipTest(f'Create DC QP is not supported') raise ex
def create_qp(self, conn_idx=0): """ Create an RDMACM QP. If self.with_ext_qp is set, then an external CQ and DC QP will be created. In case that CQ is already created, it is used for the newly created QP. """ try: if not self.passive: # Create the DCI QPs. cmid = self.cmids[conn_idx] self.create_cq(cmid) qp_init_attr = self.create_qp_init_attr( cmid, e.IBV_QP_EX_WITH_SEND) attr = Mlx5DVQPInitAttr( comp_mask=dve.MLX5DV_QP_INIT_ATTR_MASK_DC, dc_init_attr=Mlx5DVDCInitAttr()) self.qps[conn_idx] = Mlx5QP(cmid.context, qp_init_attr, attr) if self.passive and conn_idx == 0: # Create the DCT QP only for the first connection. cmid = self.child_id self.create_cq(cmid) self.create_srq(cmid) qp_init_attr = self.create_qp_init_attr(cmid) dc_attr = Mlx5DVDCInitAttr(dc_type=dve.MLX5DV_DCTYPE_DCT, dct_access_key=DCT_KEY) attr = Mlx5DVQPInitAttr( comp_mask=dve.MLX5DV_QP_INIT_ATTR_MASK_DC, dc_init_attr=dc_attr) self.qps[conn_idx] = Mlx5QP(cmid.context, qp_init_attr, attr) except PyverbsRDMAError as ex: if ex.error_code == errno.EOPNOTSUPP: raise unittest.SkipTest('Create DC QP is not supported') raise ex
def create_qps(self): # Create the DCI QPs. qp_init_attr = self.create_qp_init_attr(self.send_ops_flags) self.dcis = {} # This array contains current stream id self.current_qp_stream_id = {} # This array counts different errors in bad_flow self.qp_stream_errors = [] comp_mask = dve.MLX5DV_QP_INIT_ATTR_MASK_DC | \ dve.MLX5DV_QP_INIT_ATTR_MASK_DCI_STREAMS try: for qpn in range(self.qp_count): if self.create_flags: comp_mask |= dve.MLX5DV_QP_INIT_ATTR_MASK_QP_CREATE_FLAGS self.generate_dci_attr(qpn) stream_ctx = Mlx5DCIStreamInitAttr(self.log_dci_streams, self.log_dci_errored) self.dcis[qpn] = { 'stream': 1 << self.log_dci_streams, 'errored': 1 << self.log_dci_errored } attr = Mlx5DVQPInitAttr( comp_mask=comp_mask, create_flags=self.create_flags, dc_init_attr=Mlx5DVDCInitAttr(dci_streams=stream_ctx)) qp = Mlx5QP(self.ctx, qp_init_attr, attr) self.qps.append(qp) # Different values for start point of stream id per qp self.current_qp_stream_id[qpn] = qpn # Array of errors for bad_flow # For DCI_TEST_BAD_FLOW_WITH_RESET # First element - number of injected bad flows # Second element - number of exceptions from bad flows # For DCI_TEST_BAD_FLOW_WITHOUT_RESET # First element - bitmap of bad flow streams # Second element - number of exceptions from bad flows # Third element - flag if reset of qp been executed self.qp_stream_errors.append([0, 0, False]) self.qps_num.append(qp.qp_num) self.psns.append(random.getrandbits(24)) # Create the DCT QP. qp_init_attr = self.create_qp_init_attr() dc_attr = Mlx5DVDCInitAttr(dc_type=dve.MLX5DV_DCTYPE_DCT, dct_access_key=DCT_KEY) attr = Mlx5DVQPInitAttr(comp_mask=dve.MLX5DV_QP_INIT_ATTR_MASK_DC, dc_init_attr=dc_attr) self.dct_qp = Mlx5QP(self.ctx, qp_init_attr, attr) except PyverbsRDMAError as ex: if ex.error_code in [errno.EOPNOTSUPP, errno.EPROTONOSUPPORT]: raise unittest.SkipTest('Create DC QP is not supported') raise ex
def create_qps(self): try: qp_init_attr = self.create_qp_init_attr() comp_mask = dve.MLX5DV_QP_INIT_ATTR_MASK_SEND_OPS_FLAGS attr = Mlx5DVQPInitAttr(comp_mask=comp_mask, send_ops_flags=self.dv_send_ops_flags) qp = Mlx5QP(self.ctx, qp_init_attr, attr) self.qps.append(qp) self.qps_num.append(qp.qp_num) self.psns.append(0) except PyverbsRDMAError as ex: if ex.error_code == errno.EOPNOTSUPP: raise unittest.SkipTest('Create Mlx5DV QP is not supported') raise ex