1 /******************************************************************************
3 * Copyright (c) 2020 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_up_api.h"
24 #include "xran_fh_o_du.h"
29 const std::string module_name = "U-Plane";
33 struct xran_cp_radioapp_common_header cmnhdr;
34 struct xran_radioapp_udComp_header udComp;
42 void fucntional_dl(struct rte_mbuf *test_buffer, char * iq_offset)
44 enum xran_pkt_dir direction = XRAN_DIR_DL;
45 uint16_t section_id = 7;
46 uint16_t num_sections = 1;
47 enum xran_input_byte_order iq_buf_byte_order = XRAN_CPU_LE_BYTE_ORDER;
48 uint8_t frame_id = 99;
49 uint8_t subframe_id = 9;
51 uint8_t symbol_no = 7;
55 uint8_t RU_Port_ID = 0;
59 enum xran_comp_hdr_type staticEn = XRAN_COMP_HDR_TYPE_DYNAMIC;
63 prepare_symbol_ex(direction,
84 /*union xran_cp_radioapp_section_ext11 *ext11 = NULL;
85 struct xran_sectionext11_info *params = NULL;
87 ext11 = (union xran_cp_radioapp_section_ext11 *)(iq_offset);
88 params = (struct xran_sectionext11_info *)(iq_offset+100);
91 params->disableBFWs = 1;
92 params->numBundPrb = 1;
93 params->bfwCompMeth = 2;
95 for(i = 0; i< 10000; i++)
97 ext11->data_field.data_field1 = (XRAN_CP_SECTIONEXTCMD_11 << 24) | (params->RAD << 7) | (params->disableBFWs << 8);
98 //ext11->data_field.data_field1 = (XRAN_CP_SECTIONEXTCMD_11 << 24)'
99 //ext11->all_bits.RAD = params->RAD;
100 //ext11->all_bits.disableBFWs = params->disableBFWs;
101 ext11->data_field.data_field2 = (params->bfwCompMeth << 4) | params->numBundPrb;
102 //ext11->all_bits.numBundPrb = params->numBundPrb;
103 //ext11->all_bits.bfwCompMeth = params->bfwCompMeth;
106 //printf("ext11->data_field.data_field1 is %d\n", ext11->data_field.data_field1);
107 //ASSERT_EQ(prep_bytes, 3168);
109 class U_planePerf : public KernelTests
116 struct rte_mbuf *test_buffer;
119 void SetUp() override
121 /* Parameters stored in the functional section will be used. GTest will call
122 TEST_P (including SetUp and TearDown) for each case in the section. */
123 init_test("u_plane_performace");
124 test_buffer = (struct rte_mbuf*)rte_pktmbuf_alloc(_eth_mbuf_pool);
126 /* buffer size defined as the maximum size of all inputs/outputs in BYTE */
127 if(test_buffer == NULL) {
128 std::cout << __func__ << ":" << __LINE__ << " Failed to allocatte a packet buffer!" << std::endl;
131 iq_offset = rte_pktmbuf_mtod(test_buffer, char * );
132 iq_offset = iq_offset + sizeof(struct rte_ether_hdr) +
133 sizeof (struct xran_ecpri_hdr) +
134 sizeof (struct radio_app_common_hdr) +
135 sizeof(struct data_section_hdr);
138 /* It's called after an execution of the each test case.*/
139 void TearDown() override
141 rte_pktmbuf_free(test_buffer);
147 TEST_P(U_planePerf, Perf)
149 performance("C", module_name, &fucntional_dl, test_buffer, iq_offset);
152 INSTANTIATE_TEST_CASE_P(UnitTest, U_planePerf,
153 testing::ValuesIn(get_sequence(U_planePerf::get_number_of_cases("u_plane_performance"))));