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 enum xran_input_byte_order iq_buf_byte_order = XRAN_CPU_LE_BYTE_ORDER;
47 uint8_t frame_id = 99;
48 uint8_t subframe_id = 9;
50 uint8_t symbol_no = 7;
54 uint8_t RU_Port_ID = 0;
58 enum xran_comp_hdr_type staticEn = XRAN_COMP_HDR_TYPE_DYNAMIC;
63 prep_bytes = prepare_symbol_ex(direction,
82 /*union xran_cp_radioapp_section_ext11 *ext11 = NULL;
83 struct xran_sectionext11_info *params = NULL;
85 ext11 = (union xran_cp_radioapp_section_ext11 *)(iq_offset);
86 params = (struct xran_sectionext11_info *)(iq_offset+100);
89 params->disableBFWs = 1;
90 params->numBundPrb = 1;
91 params->bfwCompMeth = 2;
93 for(i = 0; i< 10000; i++)
95 ext11->data_field.data_field1 = (XRAN_CP_SECTIONEXTCMD_11 << 24) | (params->RAD << 7) | (params->disableBFWs << 8);
96 //ext11->data_field.data_field1 = (XRAN_CP_SECTIONEXTCMD_11 << 24)'
97 //ext11->all_bits.RAD = params->RAD;
98 //ext11->all_bits.disableBFWs = params->disableBFWs;
99 ext11->data_field.data_field2 = (params->bfwCompMeth << 4) | params->numBundPrb;
100 //ext11->all_bits.numBundPrb = params->numBundPrb;
101 //ext11->all_bits.bfwCompMeth = params->bfwCompMeth;
104 //printf("ext11->data_field.data_field1 is %d\n", ext11->data_field.data_field1);
105 //ASSERT_EQ(prep_bytes, 3168);
107 class U_planePerf : public KernelTests
114 struct rte_mbuf *test_buffer;
117 void SetUp() override
119 /* Parameters stored in the functional section will be used. GTest will call
120 TEST_P (including SetUp and TearDown) for each case in the section. */
121 init_test("u_plane_performace");
122 test_buffer = (struct rte_mbuf*)rte_pktmbuf_alloc(_eth_mbuf_pool);
124 /* buffer size defined as the maximum size of all inputs/outputs in BYTE */
125 if(test_buffer == NULL) {
126 std::cout << __func__ << ":" << __LINE__ << " Failed to allocatte a packet buffer!" << std::endl;
129 iq_offset = rte_pktmbuf_mtod(test_buffer, char * );
130 iq_offset = iq_offset + sizeof(struct rte_ether_hdr) +
131 sizeof (struct xran_ecpri_hdr) +
132 sizeof (struct radio_app_common_hdr) +
133 sizeof(struct data_section_hdr);
136 /* It's called after an execution of the each test case.*/
137 void TearDown() override
139 rte_pktmbuf_free(test_buffer);
145 TEST_P(U_planePerf, Perf)
147 performance("C", module_name, &fucntional_dl, test_buffer, iq_offset);
150 INSTANTIATE_TEST_CASE_P(UnitTest, U_planePerf,
151 testing::ValuesIn(get_sequence(U_planePerf::get_number_of_cases("u_plane_performance"))));