o-du/phy
Intel O-RAN/X-RAN Generated Doxygen Documentation
chain_tests.cc
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * Copyright (c) 2019 Intel.
4 *
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
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
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.
16 *
17 *******************************************************************************/
18 
19 
20 #include "common.hpp"
21 #include "xran_lib_wrap.hpp"
22 #include "xran_common.h"
23 #include "xran_fh_o_du.h"
24 #include "ethdi.h"
25 #include "ethernet.h"
26 #include "xran_transport.h"
27 #include "xran_cp_api.h"
28 
29 #include <stdint.h>
30 
31 
32 
33 const std::string module_name = "C-Plane";
34 
35 const uint8_t m_bitmask[] = { 0x00, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
36 
37 
38 extern "C"
39 {
40 
41 /* external functions in xRAN library */
42 void tx_cp_dl_cb(struct rte_timer *tim, void *arg);
43 void tx_cp_ul_cb(struct rte_timer *tim, void *arg);
44 int xran_process_tx_sym(void *arg);
45 int process_mbuf(struct rte_mbuf *pkt);
46 
47 
48 /* wrapper functions for performace tests */
50 {
52  tx_cp_dl_cb(nullptr, xranlib->get_timer_ctx());
53 }
54 
56 {
58  tx_cp_ul_cb(nullptr, xranlib->get_timer_ctx());
59 }
60 
62 {
65 }
66 
68 {
70 
71  if(xranlib->get_symbol_index() == 3)
72  tx_cp_dl_cb(nullptr, xranlib->get_timer_ctx());
73 
75 }
76 
77 #if 0 /* TBD */
78 void xran_ut_rx_up_ul()
79 {
80  process_mbf(mbuf);
81 }
82 #endif
83 
84 
85 /* call back functions */
86 int send_mbuf_up(struct rte_mbuf *mbuf, uint16_t type)
87 {
88  rte_pktmbuf_free(mbuf);
89  return (1);
90 }
91 
92 int send_mbuf_cp_perf(struct rte_mbuf *mbuf, uint16_t type)
93 {
94  rte_pktmbuf_free(mbuf);
95  return (1);
96 }
97 
98 #if 0 /* TBD */
99 int send_mbuf_cp(struct rte_mbuf *mbuf, uint16_t type)
100 {
101 #if 0
102  xran_parse_cp_pkt(m_pTestBuffer, &m_result, &m_pktInfo);
103 
104  /* Verify the result */
105  verify_sections();
106 #else
107  printf("cp\n");
108 #endif
109  return (1);
110 }
111 #endif
112 
113 void utcp_fh_rx_callback(void *pCallbackTag, xran_status_t status)
114 {
115  return;
116 }
117 
118 void utcp_fh_rx_prach_callback(void *pCallbackTag, xran_status_t status)
119 {
120  rte_pause();
121 }
122 
123 } /* extern "C" */
124 
125 
126 class TestChain: public KernelTests
127 {
128 protected:
131 
132  bool m_bSub6;
133 
134 
135  void SetUp() override
136  {
137  int temp;
138  std::string tmpstr;
139 
140 
141  init_test("TestChain");
142 
144 
145  tmpstr = get_input_parameter<std::string>("category");
146  if(tmpstr == "A")
148  else if(tmpstr == "B")
150  else {
151  std::cout << "*** Invalid RU Category [" << tmpstr << "] !!!" << std::endl;
152  std::cout << "Set it to Category A... " << std::endl;
154  }
155 
156  m_xranConf.frame_conf.nNumerology = get_input_parameter<int>("mu");
158  std::cout << "*** Invalid Numerology [" << m_xranConf.frame_conf.nNumerology << "] !!!" << std::endl;
160  std::cout << "Set it to " << m_xranConf.frame_conf.nNumerology << "..." << std::endl;
161  }
162 
163  tmpstr = get_input_parameter<std::string>("duplex");
164  if(tmpstr == "FDD")
166  else if(tmpstr == "TDD") {
168 
169  tmpstr = get_input_parameter<std::string>("slot_config");
170  temp = xranlib->get_slot_config(tmpstr, &m_xranConf.frame_conf);
171  }
172  else {
173  std::cout << "*** Invalid Duplex type [" << tmpstr << "] !!!" << std::endl;
174  std::cout << "Set it to FDD... " << std::endl;
176  }
177 
178  m_xranConf.nCC = get_input_parameter<int>("num_cc");
180  std::cout << "*** Exceeds maximum number of carriers supported [" << m_xranConf.nCC << "] !!!" << std::endl;
182  std::cout << "Set it to " << m_xranConf.nCC << "..." << std::endl;
183  }
184  m_xranConf.neAxc = get_input_parameter<int>("num_eaxc");
186  std::cout << "*** Exceeds maximum number of antenna supported [" << m_xranConf.neAxc << "] !!!" << std::endl;
188  std::cout << "Set it to " << m_xranConf.neAxc << "..." << std::endl;
189  }
190 
191  m_bSub6 = get_input_parameter<bool>("sub6");
192  temp = get_input_parameter<int>("chbw_dl");
194  temp = get_input_parameter<int>("chbw_ul");
196 
197  m_xranConf.nAntElmTRx = get_input_parameter<int>("antelm_trx");
198  m_xranConf.nDLFftSize = get_input_parameter<int>("fftsize_dl");
199  m_xranConf.nULFftSize = get_input_parameter<int>("fftsize_ul");
200 
201 
202  m_xranConf.ru_conf.iqWidth = get_input_parameter<int>("iq_width");
203  m_xranConf.ru_conf.compMeth = get_input_parameter<int>("comp_meth");
204 
205 #if 0
206  temp = get_input_parameter<int>("fft_size");
208  while (temp >>= 1)
210 #endif
211 
212  }
213 
214  void TearDown() override
215  {
216  }
217 };
218 
219 
220 
221 
222 /***************************************************************************
223  * Performance Test cases
224  ***************************************************************************/
225 /* C-Plane DL chain (tx_cp_dl_cb) only */
226 TEST_P(TestChain, CPlaneDLPerf)
227 {
231 
233 
234  xranlib->Close();
235  xranlib->Cleanup();
236 }
237 
238 /* C-Plane UL chain (tx_cp_ul_cb) only */
239 TEST_P(TestChain, CPlaneULPerf)
240 {
244 
246 
247  xranlib->Close();
248  xranlib->Cleanup();
249 }
250 
251 /* U-Plane UL chain (process_tx_sym with disable CP) */
252 TEST_P(TestChain, UPlaneDLPerf)
253 {
254  bool flag_cpen;
255 
257 
258  /* save current CP enable flag */
259  flag_cpen = xranlib->is_cpenable()?true:false;
260 
261  /* need to disable CP to make U-Plane work without CP */
262  xranlib->apply_cpenable(false);
265 
267 
268  xranlib->Close();
269  xranlib->Cleanup();
270 
271  /* restore previous CP enable flag */
272  xranlib->apply_cpenable(flag_cpen);
273 }
274 
275 /* C-Plane and U-Plane DL chain, U-Plane will be generated by C-Plane config */
276 TEST_P(TestChain, APlaneDLPerf)
277 {
278  bool flag_cpen;
279 
281 
282  /* save current CP enable flag */
283  flag_cpen = xranlib->is_cpenable()?true:false;
284 
285  /* Enable CP by force to make UP work by CP's section information */
286  xranlib->apply_cpenable(true);
289 
291 
292  xranlib->Close();
293  xranlib->Cleanup();
294 
295  /* restore previous CP enable flag */
296  xranlib->apply_cpenable(flag_cpen);
297 }
298 
299 #if 0 /* TBD */
300 TEST_P(TestChain, UPlaneULPerf)
301 {
302 }
303 #endif
304 
305 
307  testing::ValuesIn(get_sequence(TestChain::get_number_of_cases("TestChain"))));
308 
void * get_timer_ctx()
TEST_P(TestChain, CPlaneDLPerf)
Definition: chain_tests.cc:226
uint32_t nAntElmTRx
Definition: xran_fh_o_du.h:503
int xran_process_tx_sym(void *arg)
Definition: xran_main.c:2202
uint16_t nDLRBs
Definition: xran_fh_o_du.h:506
int get_slot_config(const std::string &cfgname, struct xran_frame_config *pCfg)
static unsigned get_number_of_cases(const std::string &type)
Definition: common.hpp:190
uint16_t nULRBs
Definition: xran_fh_o_du.h:507
void update_symbol_index()
void performance(const std::string &isa, const std::string &module_name, F function, Args ... args)
Run performance test case for a given function.
Definition: common.hpp:253
#define XRAN_MAX_SECTOR_NR
Definition: xran_fh_o_du.h:110
void utcp_fh_rx_callback(void *pCallbackTag, xran_status_t status)
Definition: chain_tests.cc:113
#define XRAN_MAX_ANTENNA_NR
Definition: xran_fh_o_du.h:111
void xran_ut_tx_cp_ul()
Definition: chain_tests.cc:55
uint8_t nFrameDuplexType
Definition: xran_fh_o_du.h:460
uint16_t nDLFftSize
Definition: xran_fh_o_du.h:504
bool m_bSub6
Definition: chain_tests.cc:132
void get_cfg_fh(struct xran_fh_config *pCfg)
void xran_ut_tx_cp_dl()
Definition: chain_tests.cc:49
This file has all definitions for the Ethernet Data Interface Layer.
struct xran_fh_config m_xranConf
Definition: chain_tests.cc:129
void SetUp() override
Definition: chain_tests.cc:135
uint8_t compMeth
Definition: xran_fh_o_du.h:487
int xran_parse_cp_pkt(struct rte_mbuf *mbuf, struct xran_cp_gen_params *result, struct xran_recv_packet_info *pkt_info)
Parse a C-Plane packet (for RU emulation) Transport layer fragmentation is not supported.
Definition: xran_cp_api.c:1749
struct xran_frame_config frame_conf
Definition: xran_fh_o_du.h:517
void xran_ut_tx_cpup_dl()
Definition: chain_tests.cc:67
const std::string module_name
Definition: chain_tests.cc:33
INSTANTIATE_TEST_CASE_P(UnitTest, TestChain, testing::ValuesIn(get_sequence(TestChain::get_number_of_cases("TestChain"))))
int apply_cpenable(bool flag)
void init_test(const std::string &type)
Defines section in the conf.json that is used to load parameters from.
Definition: common.hpp:358
void utcp_fh_rx_prach_callback(void *pCallbackTag, xran_status_t status)
Definition: chain_tests.cc:118
int send_mbuf_cp_perf(struct rte_mbuf *mbuf, uint16_t type)
Definition: chain_tests.cc:92
void tx_cp_ul_cb(struct rte_timer *tim, void *arg)
Definition: xran_main.c:1045
int send_mbuf_up(struct rte_mbuf *mbuf, uint16_t type)
Definition: chain_tests.cc:86
This file has all definitions for the Ethernet Data Interface Layer.
enum xran_category xranCat
Definition: xran_fh_o_du.h:484
void xran_ut_tx_up_dl()
Definition: chain_tests.cc:61
XRAN layer common functionality for both lls-CU and RU as well as C-plane and U-plane.
struct xran_ru_config ru_conf
Definition: xran_fh_o_du.h:518
uint32_t neAxc
Definition: xran_fh_o_du.h:501
This file provides public interface to xRAN Front Haul layer implementation as defined in the ORAN-WG...
int get_num_rbs(uint32_t nNumerology, uint32_t nBandwidth, bool nSub6)
int Init(struct xran_fh_config *pCfg=nullptr)
uint16_t nULFftSize
Definition: xran_fh_o_du.h:505
int process_mbuf(struct rte_mbuf *pkt)
Definition: xran_common.c:143
void Open(xran_ethdi_mbuf_send_fn send_cp, xran_ethdi_mbuf_send_fn send_up, void *fh_rx_callback, void *fh_rx_prach_callback)
struct xran_fh_init m_xranInit
Definition: chain_tests.cc:130
const uint8_t m_bitmask[]
Definition: chain_tests.cc:35
void TearDown() override
Definition: chain_tests.cc:214
xranLibWraper * xranlib
std::vector< unsigned > get_sequence(const unsigned number)
For a given number return sequence of number from 0 to number - 1.
Definition: common.cpp:78
This file provides the definitions for Control Plane Messages APIs.
This file provides the definitions for Transport layer (eCPRI) API.
int32_t xran_status_t
Definition: xran_fh_o_du.h:236
void tx_cp_dl_cb(struct rte_timer *tim, void *arg)
Definition: xran_main.c:910