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_odp_ud_traffic(self): client, server = self.create_players(OdpUD) # Implement the traffic here because OdpUD uses two different MRs for # send and recv. ah_client = get_global_ah(client, self.gid_index, self.ib_port) recv_sge = SGE(server.recv_mr.buf, server.msg_size + GRH_SIZE, server.recv_mr.lkey) server_recv_wr = RecvWR(sg=[recv_sge], num_sge=1) send_sge = SGE(client.send_mr.buf + GRH_SIZE, client.msg_size, client.send_mr.lkey) client_send_wr = SendWR(num_sge=1, sg=[send_sge]) for i in range(self.iters): server.qp.post_recv(server_recv_wr) post_send(client, client_send_wr, ah=ah_client) poll_cq(client.cq) poll_cq(server.cq)
def full_sq_bad_flow(self): """ Check post_send while qp's sq is full. - Find qp's sq length - Fill the qp with work requests until overflow """ qp_idx = 0 send_op = e.IBV_QP_EX_WITH_SEND ah = u.get_global_ah(self.client, self.gid_index, self.ib_port) qp_attr, _ = self.client.qps[qp_idx].query(e.IBV_QP_CAP) max_send_wr = qp_attr.cap.max_send_wr with self.assertRaises(PyverbsRDMAError) as ex: for _ in range(max_send_wr + 1): _, c_sg = u.get_send_elements(self.client, False) u.send(self.client, c_sg, send_op, new_send=True, qp_idx=qp_idx, ah=ah) self.assertEqual(ex.exception.error_code, errno.ENOMEM)
def test_resize_cq(self): """ Test resize CQ, start with specific value and then increase and decrease the CQ size. The test also check bad flow of decrease the CQ size when there are more completions on it than the new value. """ self.create_players(CQUDResources, cq_depth=3) # Decrease the CQ size. new_cq_size = 1 try: self.client.cq.resize(new_cq_size) except PyverbsRDMAError as ex: if ex.error_code == errno.EOPNOTSUPP: raise unittest.SkipTest('Resize CQ is not supported') raise ex self.assertTrue( self.client.cq.cqe >= new_cq_size, f'The actual CQ size ({self.client.cq.cqe}) is less ' 'than guaranteed ({new_cq_size})') # Increase the CQ size. new_cq_size = 7 self.client.cq.resize(new_cq_size) self.assertTrue( self.client.cq.cqe >= new_cq_size, f'The actual CQ size ({self.client.cq.cqe}) is less ' 'than guaranteed ({new_cq_size})') # Fill the CQ entries except one for avoid cq_overrun warnings. send_wr, _ = u.get_send_elements(self.client, False) ah_client = u.get_global_ah(self.client, self.gid_index, self.ib_port) for i in range(self.client.cq.cqe - 1): u.send(self.client, send_wr, ah=ah_client) # Decrease the CQ size to less than the CQ unpolled entries. new_cq_size = 1 with self.assertRaises(PyverbsRDMAError) as ex: self.client.cq.resize(new_cq_size) self.assertEqual(ex.exception.error_code, errno.EINVAL)
def traffic_with_bad_flow(client, server, iters, gid_idx, port): """ Runs basic traffic with bad flow between two sides :param client: client side, clients base class is BaseTraffic :param server: server side, servers base class is BaseTraffic :param iters: number of traffic iterations :param gid_idx: local gid index :param port: IB port :return: None """ import tests.utils as u send_op = e.IBV_QP_EX_WITH_SEND ah_client = u.get_global_ah(client, gid_idx, port) s_recv_wr = u.get_recv_wr(server) c_recv_wr = u.get_recv_wr(client) for qp_idx in range(server.qp_count): # Prepare the receive queue with RecvWR u.post_recv(client, c_recv_wr, qp_idx=qp_idx) u.post_recv(server, s_recv_wr, qp_idx=qp_idx) read_offset = 0 for _ in range(iters): for qp_idx in range(server.qp_count): _, c_send_object = u.get_send_elements(client, False) u.send(client, c_send_object, send_op, True, qp_idx, ah_client, False) try: u.poll_cq(client.cq) except PyverbsError as ex: if client.bad_flow_handling(qp_idx, ex, True): continue raise ex u.poll_cq(server.cq) u.post_recv(server, s_recv_wr, qp_idx=qp_idx) msg_received = server.mr.read(server.msg_size, read_offset) u.validate(msg_received, True, server.msg_size) client.check_after_traffic()