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