def test_odp_dc_traffic(self): send_ops_flag = e.IBV_QP_EX_WITH_SEND self.create_players(OdpDc, qp_count=2, send_ops_flags=send_ops_flag) self.check_odp_dc_support() u.traffic(**self.traffic_args, new_send=True, send_op=e.IBV_QP_EX_WITH_SEND)
def test_dmabuf_rc_traffic(self): """ Test send/recv using dma-buf MR over RC """ client, server = self.create_players(DmaBufRC, gpu=self.gpu, gtt=self.gtt) u.traffic(client, server, self.iters, self.gid_index, self.ib_port)
def test_sched_per_qp_traffic(self): """ Tests attaching a QP to a sched leaf. The test creates a sched tree consisting of a root node and a leaf with max BW and share BW, modifies two RC QPs to be attached to the sched leaf and then run traffic using those QPs. """ self.create_players(RCResources) try: root_node = Mlx5dvSchedNode(self.server.ctx, Mlx5dvSchedAttr()) mixed_flags = dve.MLX5DV_SCHED_ELEM_ATTR_FLAGS_MAX_AVG_BW | \ dve.MLX5DV_SCHED_ELEM_ATTR_FLAGS_BW_SHARE mixed_sched_attr = Mlx5dvSchedAttr(root_node, max_avg_bw=10, bw_share=2, flags=mixed_flags) leaf = Mlx5dvSchedLeaf(self.server.ctx, mixed_sched_attr) Mlx5QP.modify_qp_sched_elem(self.server.qp, req_sched_leaf=leaf, resp_sched_leaf=leaf) except PyverbsRDMAError as ex: if ex.error_code == errno.EOPNOTSUPP: raise unittest.SkipTest( 'Creation or usage of schedule elements is not supported') raise ex u.traffic(**self.traffic_args)
def test_dc_send(self): self.create_players(Mlx5DcResources, qp_count=2, send_ops_flags=e.IBV_QP_EX_WITH_SEND) u.traffic(**self.traffic_args, new_send=True, send_op=e.IBV_QP_EX_WITH_SEND)
def test_qp_ex_rc_rdma_write_imm(self): client, server = self.create_players('rc_write_imm') client.rkey = server.mr.rkey server.rkey = client.mr.rkey client.raddr = server.mr.buf server.raddr = client.mr.buf u.traffic(client, server, self.iters, self.gid_index, self.ib_port, is_cq_ex=False, send_op=e.IBV_QP_EX_WITH_RDMA_WRITE_WITH_IMM)
def test_rc_traffic_cq_ex(self): client, server = self.create_players('rc') u.traffic(client, server, self.iters, self.gid_index, self.ib_port, is_cq_ex=True)
def test_dv_cq_padding(self): """ Create DV CQ with padding flag. """ self.create_players(Mlx5CQRes, cqe_size=128, flags=dve.MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD, requested_dev_cap=dve.MLX5DV_CONTEXT_FLAGS_CQE_128B_PAD) u.traffic(**self.traffic_args, is_cq_ex=True)
def test_qp_ex_srd_old_send(self): self.create_players() u.traffic(self.client, self.server, self.iters, self.gid_index, self.ib_port, new_send=False)
def test_odp_rc_huge_user_addr_traffic(self): self.user_addr = mmap(length=HUGE_PAGE_SIZE, flags=MAP_ANONYMOUS_ | MAP_PRIVATE_ | MAP_HUGETLB_) client, server = self.create_players(OdpRC, is_huge=True, user_addr=self.user_addr) traffic(client, server, self.iters, self.gid_index, self.ib_port)
def test_qp_ex_rc_send_imm(self): client, server = self.create_players('rc_send_imm') u.traffic(client, server, self.iters, self.gid_index, self.ib_port, new_send=True, send_op=e.IBV_QP_EX_WITH_SEND_WITH_IMM)
def test_odp_async_prefetch_rc_traffic(self): for advice in [ e._IBV_ADVISE_MR_ADVICE_PREFETCH, e._IBV_ADVISE_MR_ADVICE_PREFETCH_WRITE ]: client, server = self.create_players(OdpRC, use_mr_prefetch='async', prefetch_advice=advice) traffic(client, server, self.iters, self.gid_index, self.ib_port)
def test_dv_cq_cqe_size_64(self): """ Test multiple sizes of msg using CQE size of 64KB. """ msg_sizes = [1024, # Lower than 32KB 60000, # In range of 32KB - 64KB 70000] # Bigger than 64KB for size in msg_sizes: self.create_players(Mlx5CQRes, cqe_size=64, msg_size=size) u.traffic(**self.traffic_args, is_cq_ex=True)
def test_dv_cq_cqe_size_128(self): """ Test multiple sizes of msg using CQE size of 128KB. """ msg_sizes = [60000, # Lower than 64KB 70000, # In range of 64KB - 128KB 140000] # Bigger than 128KB for size in msg_sizes: self.create_players(Mlx5CQRes, cqe_size=128, msg_size=size) u.traffic(**self.traffic_args, is_cq_ex=True)
def test_qp_ex_srd_send_imm(self): send_op = e.IBV_QP_EX_WITH_SEND_WITH_IMM self.create_players(send_op) u.traffic(self.client, self.server, self.iters, self.gid_index, self.ib_port, new_send=True, send_op=send_op)
def test_qp_ex_ud_zero_size(self): client, server = self.create_players('ud_send') client.msg_size = 0 server.msg_size = 0 u.traffic(client, server, self.iters, self.gid_index, self.ib_port, new_send=True, send_op=e.IBV_QP_EX_WITH_SEND)
def test_scatter_to_cqe_control_by_qp(self): """ Create QP with specific SCATTER_TO_CQE flags. The test set different values in the scatter2cqe environment variable and create the QP with enable/disable flags. The QP should ignore the environment variable value and behave according to the specific creation flag. """ for s2c_env_val in ['0', '1']: for qp_s2c_value in [dve.MLX5DV_QP_CREATE_DISABLE_SCATTER_TO_CQE, dve.MLX5DV_QP_CREATE_ALLOW_SCATTER_TO_CQE]: self.set_env_variable('MLX5_SCATTER_TO_CQE', s2c_env_val) self.create_players(Mlx5DvCqDcRes, create_flags=qp_s2c_value) u.traffic(**self.traffic_args, new_send=True, send_op=e.IBV_QP_EX_WITH_SEND, is_cq_ex=True)
def test_dc_ah_to_qp_mapping(self): self.create_players(Mlx5DcResources, qp_count=2, send_ops_flags=e.IBV_QP_EX_WITH_SEND) client_ah = u.get_global_ah(self.client, self.gid_index, self.ib_port) try: Mlx5QP.map_ah_to_qp(client_ah, self.server.qps[0].qp_num) except PyverbsRDMAError as ex: if ex.error_code == errno.EOPNOTSUPP: raise unittest.SkipTest('Mapping AH to QP is not supported') raise ex u.traffic(**self.traffic_args, new_send=True, send_op=e.IBV_QP_EX_WITH_SEND)
def test_mr_rereg_addr(self): self.create_players(MRRes) s_recv_wr = u.get_recv_wr(self.server) self.server.qp.post_recv(s_recv_wr) server_addr = posix_memalign(self.server.msg_size) self.server.rereg_mr(flags=e.IBV_REREG_MR_CHANGE_TRANSLATION, addr=server_addr, length=self.server.msg_size) with self.assertRaisesRegex(PyverbsRDMAError, 'Remote operation error'): # The server QP receive queue has WR with the old MR address, # therefore traffic should fail. u.traffic(**self.traffic_args) self.restate_qps() u.traffic(**self.traffic_args) free(server_addr)
def test_rc_modify_udp_sport(self): """ Create RC resources and change the server QP's UDP source port to an arbitrary legal value (55555). Then run SEND traffic. :return: None """ self.create_players(RCResources) try: Mlx5QP.modify_udp_sport(self.server.qp, udp_sport=55555) except PyverbsRDMAError as ex: if ex.error_code == errno.EOPNOTSUPP: raise unittest.SkipTest( 'Modifying a QP UDP sport is not supported') raise ex u.traffic(self.client, self.server, self.iters, self.gid_index, self.ib_port)
def test_dv_cq_compression_flags(self): """ Create DV CQ with different types of CQE compression formats. The test also does bad flow and try to use more than one compression formats. """ # Create DV CQ with all legal compression flags. for comp_type in [dve.MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX, dve.MLX5DV_CQE_RES_FORMAT_CSUM, dve.MLX5DV_CQE_RES_FORMAT_HASH]: self.create_players(Mlx5CQRes, cqe_comp_res_format=comp_type, requested_dev_cap=dve.MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP) u.traffic(**self.traffic_args, is_cq_ex=True) # Try to create DV CQ with more than one compression flags. cqe_multi_format = dve.MLX5DV_CQE_RES_FORMAT_HASH | \ dve.MLX5DV_CQE_RES_FORMAT_CSUM with self.assertRaises(PyverbsRDMAError) as ex: self.create_players(Mlx5CQRes, cqe_comp_res_format=cqe_multi_format) self.assertEqual(ex.exception.error_code, errno.EINVAL)
def test_mr_rereg_pd(self): """ Test that cover rereg MR's PD with this flow: Use MR with QP that was created with the same PD. Then rereg the MR's PD and use the MR with the same QP, expect the traffic to fail with "remote operation error". Restate the QP from ERR state, rereg the MR back to its previous PD and use it again with the QP, verify that it now succeeds. """ self.create_players(MRRes) u.traffic(**self.traffic_args) server_new_pd = PD(self.server.ctx) self.server.rereg_mr(flags=e.IBV_REREG_MR_CHANGE_PD, pd=server_new_pd) with self.assertRaisesRegex(PyverbsRDMAError, 'Remote operation error'): u.traffic(**self.traffic_args) self.restate_qps() self.server.rereg_mr(flags=e.IBV_REREG_MR_CHANGE_PD, pd=self.server.pd) u.traffic(**self.traffic_args) # Rereg the MR again with the new PD to cover # destroying a PD with a re-registered MR. self.server.rereg_mr(flags=e.IBV_REREG_MR_CHANGE_PD, pd=server_new_pd)
def test_odp_ud_traffic(self): client, server = self.create_players('ud') traffic(client, server, self.iters, self.gid_index, self.ib_port)
def test_odp_prefetch_rc_traffic(self): client, server = self.create_players('rc', use_mr_prefetch=True) traffic(client, server, self.iters, self.gid_index, self.ib_port)
def test_odp_rc_huge_traffic(self): client, server = self.create_players('rc', is_huge=True) traffic(client, server, self.iters, self.gid_index, self.ib_port)
def test_huge_page_traffic(self): self.create_players(ParentDomainHugePageRcRes, alloc_func=huge_page_alloc, free_func=huge_page_free) u.traffic(**self.traffic_args)
def test_mem_align_srq_excq_rc_traffic(self): self.create_players(ParentDomainCqExSrqRes, alloc_func=mem_align_allocator, free_func=free_func) u.traffic(**self.traffic_args, is_cq_ex=True)
def test_mem_align_ud_traffic(self): parent_domain_ud_res = parent_domain_res_cls(UDResources) self.create_players(parent_domain_ud_res, alloc_func=mem_align_allocator, free_func=free_func) u.traffic(**self.traffic_args)
def test_default_allocators_rc_traffic(self): parent_domain_rc_res = parent_domain_res_cls(RCResources) self.create_players(parent_domain_rc_res, alloc_func=default_allocator, free_func=default_free) u.traffic(**self.traffic_args)
def test_without_allocators_rc_traffic(self): parent_domain_rc_res = parent_domain_res_cls(RCResources) self.create_players(parent_domain_rc_res) u.traffic(**self.traffic_args)
def test_ud_modify_lag_port(self): self.create_players(UDResources) u.traffic(self.client, self.server, self.iters, self.gid_index, self.ib_port)