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
21 #include "xran_lib_wrap.hpp"
\r
22 #include "xran_common.h"
\r
23 #include "xran_fh_o_du.h"
\r
25 #include "ethernet.h"
\r
26 #include "xran_transport.h"
\r
27 #include "xran_cp_api.h"
\r
33 const std::string module_name = "C-Plane";
\r
35 const uint8_t m_bitmask[] = { 0x00, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
\r
41 /* external functions in xRAN library */
\r
42 void tx_cp_dl_cb(struct rte_timer *tim, void *arg);
\r
43 void tx_cp_ul_cb(struct rte_timer *tim, void *arg);
\r
44 int xran_process_tx_sym(void *arg);
\r
45 int process_mbuf(struct rte_mbuf *pkt);
\r
48 /* wrapper functions for performace tests */
\r
49 void xran_ut_tx_cp_dl()
\r
51 xranlib->update_tti();
\r
52 tx_cp_dl_cb(nullptr, xranlib->get_timer_ctx());
\r
55 void xran_ut_tx_cp_ul()
\r
57 xranlib->update_tti();
\r
58 tx_cp_ul_cb(nullptr, xranlib->get_timer_ctx());
\r
61 void xran_ut_tx_up_dl()
\r
63 xranlib->update_symbol_index();
\r
64 xran_process_tx_sym(xranlib->get_timer_ctx());
\r
67 void xran_ut_tx_cpup_dl()
\r
69 xranlib->update_symbol_index();
\r
71 if(xranlib->get_symbol_index() == 3)
\r
72 tx_cp_dl_cb(nullptr, xranlib->get_timer_ctx());
\r
74 xran_process_tx_sym(xranlib->get_timer_ctx());
\r
78 void xran_ut_rx_up_ul()
\r
85 /* call back functions */
\r
86 int send_mbuf_up(struct rte_mbuf *mbuf, uint16_t type)
\r
88 rte_pktmbuf_free(mbuf);
\r
92 int send_mbuf_cp_perf(struct rte_mbuf *mbuf, uint16_t type)
\r
94 rte_pktmbuf_free(mbuf);
\r
99 int send_mbuf_cp(struct rte_mbuf *mbuf, uint16_t type)
\r
102 xran_parse_cp_pkt(m_pTestBuffer, &m_result, &m_pktInfo);
\r
104 /* Verify the result */
\r
113 void utcp_fh_rx_callback(void *pCallbackTag, xran_status_t status)
\r
118 void utcp_fh_rx_prach_callback(void *pCallbackTag, xran_status_t status)
\r
126 class TestChain: public KernelTests
\r
129 struct xran_fh_config m_xranConf;
\r
130 struct xran_fh_init m_xranInit;
\r
135 void SetUp() override
\r
138 std::string tmpstr;
\r
141 init_test("TestChain");
\r
143 xranlib->get_cfg_fh(&m_xranConf);
\r
145 tmpstr = get_input_parameter<std::string>("category");
\r
147 m_xranConf.ru_conf.xranCat = XRAN_CATEGORY_A;
\r
148 else if(tmpstr == "B")
\r
149 m_xranConf.ru_conf.xranCat = XRAN_CATEGORY_B;
\r
151 std::cout << "*** Invalid RU Category [" << tmpstr << "] !!!" << std::endl;
\r
152 std::cout << "Set it to Category A... " << std::endl;
\r
153 m_xranConf.ru_conf.xranCat = XRAN_CATEGORY_A;
\r
156 m_xranConf.frame_conf.nNumerology = get_input_parameter<int>("mu");
\r
157 if(m_xranConf.frame_conf.nNumerology > 3) {
\r
158 std::cout << "*** Invalid Numerology [" << m_xranConf.frame_conf.nNumerology << "] !!!" << std::endl;
\r
159 m_xranConf.frame_conf.nNumerology = 0;
\r
160 std::cout << "Set it to " << m_xranConf.frame_conf.nNumerology << "..." << std::endl;
\r
163 tmpstr = get_input_parameter<std::string>("duplex");
\r
164 if(tmpstr == "FDD")
\r
165 m_xranConf.frame_conf.nFrameDuplexType = 0;
\r
166 else if(tmpstr == "TDD") {
\r
167 m_xranConf.frame_conf.nFrameDuplexType = 1;
\r
169 tmpstr = get_input_parameter<std::string>("slot_config");
\r
170 temp = xranlib->get_slot_config(tmpstr, &m_xranConf.frame_conf);
\r
173 std::cout << "*** Invalid Duplex type [" << tmpstr << "] !!!" << std::endl;
\r
174 std::cout << "Set it to FDD... " << std::endl;
\r
175 m_xranConf.frame_conf.nFrameDuplexType = 0;
\r
178 m_xranConf.nCC = get_input_parameter<int>("num_cc");
\r
179 if(m_xranConf.nCC > XRAN_MAX_SECTOR_NR) {
\r
180 std::cout << "*** Exceeds maximum number of carriers supported [" << m_xranConf.nCC << "] !!!" << std::endl;
\r
181 m_xranConf.nCC = XRAN_MAX_SECTOR_NR;
\r
182 std::cout << "Set it to " << m_xranConf.nCC << "..." << std::endl;
\r
184 m_xranConf.neAxc = get_input_parameter<int>("num_eaxc");
\r
185 if(m_xranConf.neAxc > XRAN_MAX_ANTENNA_NR) {
\r
186 std::cout << "*** Exceeds maximum number of antenna supported [" << m_xranConf.neAxc << "] !!!" << std::endl;
\r
187 m_xranConf.neAxc = XRAN_MAX_ANTENNA_NR;
\r
188 std::cout << "Set it to " << m_xranConf.neAxc << "..." << std::endl;
\r
191 m_bSub6 = get_input_parameter<bool>("sub6");
\r
192 temp = get_input_parameter<int>("chbw_dl");
\r
193 m_xranConf.nDLRBs = xranlib->get_num_rbs(m_xranConf.frame_conf.nNumerology, temp, m_bSub6);
\r
194 temp = get_input_parameter<int>("chbw_ul");
\r
195 m_xranConf.nULRBs = xranlib->get_num_rbs(m_xranConf.frame_conf.nNumerology, temp, m_bSub6);
\r
197 m_xranConf.nAntElmTRx = get_input_parameter<int>("antelm_trx");
\r
198 m_xranConf.nDLFftSize = get_input_parameter<int>("fftsize_dl");
\r
199 m_xranConf.nULFftSize = get_input_parameter<int>("fftsize_ul");
\r
202 m_xranConf.ru_conf.iqWidth = get_input_parameter<int>("iq_width");
\r
203 m_xranConf.ru_conf.compMeth = get_input_parameter<int>("comp_meth");
\r
206 temp = get_input_parameter<int>("fft_size");
\r
207 m_xranConf.ru_conf.fftSize = 0;
\r
209 ++m_xranConf.ru_conf.fftSize;
\r
214 void TearDown() override
\r
222 /***************************************************************************
\r
223 * Performance Test cases
\r
224 ***************************************************************************/
\r
225 /* C-Plane DL chain (tx_cp_dl_cb) only */
\r
226 TEST_P(TestChain, CPlaneDLPerf)
\r
228 xranlib->Init(&m_xranConf);
\r
229 xranlib->Open(send_mbuf_cp_perf, send_mbuf_up,
\r
230 (void *)utcp_fh_rx_callback, (void *)utcp_fh_rx_prach_callback);
\r
232 performance("C", module_name, xran_ut_tx_cp_dl);
\r
235 xranlib->Cleanup();
\r
238 /* C-Plane UL chain (tx_cp_ul_cb) only */
\r
239 TEST_P(TestChain, CPlaneULPerf)
\r
241 xranlib->Init(&m_xranConf);
\r
242 xranlib->Open(send_mbuf_cp_perf, send_mbuf_up,
\r
243 (void *)utcp_fh_rx_callback, (void *)utcp_fh_rx_prach_callback);
\r
245 performance("C", module_name, xran_ut_tx_cp_ul);
\r
248 xranlib->Cleanup();
\r
251 /* U-Plane UL chain (process_tx_sym with disable CP) */
\r
252 TEST_P(TestChain, UPlaneDLPerf)
\r
256 xranlib->Init(&m_xranConf);
\r
258 /* save current CP enable flag */
\r
259 flag_cpen = xranlib->is_cpenable()?true:false;
\r
261 /* need to disable CP to make U-Plane work without CP */
\r
262 xranlib->apply_cpenable(false);
\r
263 xranlib->Open(send_mbuf_cp_perf, send_mbuf_up,
\r
264 (void *)utcp_fh_rx_callback, (void *)utcp_fh_rx_prach_callback);
\r
266 performance("C", module_name, xran_ut_tx_up_dl);
\r
269 xranlib->Cleanup();
\r
271 /* restore previous CP enable flag */
\r
272 xranlib->apply_cpenable(flag_cpen);
\r
275 /* C-Plane and U-Plane DL chain, U-Plane will be generated by C-Plane config */
\r
276 TEST_P(TestChain, APlaneDLPerf)
\r
280 xranlib->Init(&m_xranConf);
\r
282 /* save current CP enable flag */
\r
283 flag_cpen = xranlib->is_cpenable()?true:false;
\r
285 /* Enable CP by force to make UP work by CP's section information */
\r
286 xranlib->apply_cpenable(true);
\r
287 xranlib->Open(send_mbuf_cp_perf, send_mbuf_up,
\r
288 (void *)utcp_fh_rx_callback, (void *)utcp_fh_rx_prach_callback);
\r
290 performance("C", module_name, xran_ut_tx_cpup_dl);
\r
293 xranlib->Cleanup();
\r
295 /* restore previous CP enable flag */
\r
296 xranlib->apply_cpenable(flag_cpen);
\r
300 TEST_P(TestChain, UPlaneULPerf)
\r
306 INSTANTIATE_TEST_CASE_P(UnitTest, TestChain,
\r
307 testing::ValuesIn(get_sequence(TestChain::get_number_of_cases("TestChain"))));
\r