1 /******************************************************************************
\r
3 * Copyright (c) 2019 Intel.
\r
5 * Licensed under the Apache License, Version 2.0 (the "License");
\r
6 * you may not use this file except in compliance with the License.
\r
7 * You may obtain a copy of the License at
\r
9 * http://www.apache.org/licenses/LICENSE-2.0
\r
11 * Unless required by applicable law or agreed to in writing, software
\r
12 * distributed under the License is distributed on an "AS IS" BASIS,
\r
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 * See the License for the specific language governing permissions and
\r
15 * limitations under the License.
\r
17 *******************************************************************************/
\r
20 #include "common.hpp"
\r
22 #include "xran_common.h"
\r
23 #include "xran_fh_o_du.h"
\r
24 #include "ethernet.h"
\r
28 const std::string module_name = "u-plane";
\r
30 class U_planePerf : public KernelTests
\r
37 struct rte_mbuf *test_buffer;
\r
39 struct rte_mempool *test_eth_mbuf_pool;
\r
41 void SetUp() override
\r
43 /* Parameters stored in the functional section will be used. GTest will call
\r
44 TEST_P (including SetUp and TearDown) for each case in the section. */
\r
45 init_test("u_plane_performace");
\r
46 test_eth_mbuf_pool = rte_pktmbuf_pool_create("mempool", NUM_MBUFS,
\r
47 MBUF_CACHE, 0, MBUF_POOL_ELEMENT, rte_socket_id());
\r
49 /* buffer size defined as the maximum size of all inputs/outputs in BYTE */
\r
50 const int buffer_size = 9600;
\r
51 test_buffer = (struct rte_mbuf*)rte_pktmbuf_alloc(test_eth_mbuf_pool);
\r
53 iq_offset = rte_pktmbuf_mtod(test_buffer, char * );
\r
54 iq_offset = iq_offset + sizeof(struct ether_hdr) +
\r
55 sizeof (struct xran_ecpri_hdr) +
\r
56 sizeof (struct radio_app_common_hdr) +
\r
57 sizeof(struct data_section_hdr);
\r
60 /* It's called after an execution of the each test case.*/
\r
61 void TearDown() override
\r
63 rte_pktmbuf_free(test_buffer);
\r
66 void fucntional_dl(F function, int32_t* request, int32_t* response)
\r
68 enum xran_pkt_dir direction = XRAN_DIR_DL;
\r
69 uint16_t section_id = 0;
\r
70 enum xran_input_byte_order iq_buf_byte_order = XRAN_CPU_LE_BYTE_ORDER;
\r
71 uint8_t frame_id = 0;
\r
72 uint8_t subframe_id = 0;
\r
73 uint8_t slot_id = 0;
\r
74 uint8_t symbol_no = 0;
\r
78 uint8_t RU_Port_ID = 0;
\r
80 uint32_t do_copy = 0;
\r
84 prep_bytes = prepare_symbol_ex(direction,
\r
87 (struct rb_map *)iq_offset,
\r
100 //ASSERT_EQ(prep_bytes, 3168);
\r
104 TEST_P(U_planePerf, Test_DL)
\r
106 performance("C", module_name, fucntional_dl, &request, &response);
\r
109 INSTANTIATE_TEST_CASE_P(UnitTest, U_planePerf,
\r
110 testing::ValuesIn(get_sequence(U_planePerf::get_number_of_cases("u_plane_performance"))));
\r