o-du/phy
Intel O-RAN/X-RAN Generated Doxygen Documentation
c_plane_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 const std::string module_name = "C-Plane";
33 
34 const uint8_t m_bitmask[] = { 0x00, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
35 
36 extern "C"
37 {
38 
39 /* wrapper function for performace tests to reset mbuf */
40 int xran_ut_prepare_cp(struct rte_mbuf *mbuf, struct xran_cp_gen_params *params,
41  uint8_t cc_id, uint8_t ant_id, uint8_t seq_id)
42 {
43  rte_pktmbuf_reset(mbuf);
44  return(xran_prepare_ctrl_pkt(mbuf, params, cc_id, ant_id, seq_id));
45 }
46 
47 
48 void cput_fh_rx_callback(void *pCallbackTag, xran_status_t status)
49 {
50  return;
51 }
52 
53 void cput_fh_rx_prach_callback(void *pCallbackTag, xran_status_t status)
54 {
55  rte_pause();
56 }
57 
58 } /* extern "C" */
59 
60 
61 
62 class C_plane: public KernelTests
63 {
64 private:
65  struct xran_section_gen_info *m_pSectGenInfo = NULL;
66  struct xran_section_gen_info *m_pSectResult = NULL;
67 
68 
69 protected:
70  int m_maxSections = 8; /* not used */
72 
73  struct rte_mbuf *m_pTestBuffer;
74 
78 
79  uint8_t m_dir;
80  std::string m_dirStr;
81  uint8_t m_sectionType;
82 
83  uint8_t m_ccId, m_antId;
84  uint8_t m_seqId;
86  uint8_t m_symStart, m_symNum;
87  uint16_t *m_prbStart = NULL, *m_prbNum = NULL;
88 
90  uint16_t m_beamId;
91  uint16_t m_reMask = 0xfff;
92  uint16_t m_sectionId;
93  uint8_t m_filterIndex;
94  uint16_t m_timeOffset;
95  uint8_t m_fftSize;
96  uint8_t m_scs;
97  uint16_t m_cpLength;
99 
100  uint16_t m_ext1_dst_len = 0;
101  int8_t *m_p_ext1_dst = NULL;
102  int16_t *m_p_bfw_iq_src = NULL;
103 
108 
110 
111 
112  void SetUp() override
113  {
114  int i, j;
115 
116  init_test("C_Plane");
117 
118  m_numSections = get_input_parameter<int>("num_sections");
119  ASSERT_FALSE(m_numSections == 0);
120 
121  m_dirStr = get_input_parameter<std::string>("direction");
122 
123  if(!m_dirStr.compare("DL")) m_dir = XRAN_DIR_DL;
124  else if(!m_dirStr.compare("UL")) m_dir = XRAN_DIR_UL;
125  else FAIL() << "Invalid direction!";
126 
127  m_sectionType = get_input_parameter<uint8_t>("section_type");
128  m_ccId = get_input_parameter<uint8_t>("cc_id");
129  m_antId = get_input_parameter<uint8_t>("ant_id");
130  m_seqId = get_input_parameter<uint16_t>("seq_id");
131 
132  m_frameId = get_input_parameter<uint8_t>("frame_id");
133  m_subframeId = get_input_parameter<uint8_t>("subframe_id");
134  m_slotId = get_input_parameter<uint8_t>("slot_id");
135  m_symStart = get_input_parameter<uint8_t>("symbol_start");
136  m_compMethod = get_input_parameter<uint8_t>("comp_method");
137  m_iqWidth = get_input_parameter<uint8_t>("iq_width");
138 
139  m_sectionId = get_input_parameter<uint8_t>("section_id");
140  m_symNum = get_input_parameter<uint8_t>("symbol_num");
141  m_beamId = get_input_parameter<uint16_t>("beam_id");
142 
143  /* reading configurations of start prb and the number of prbs */
144  std::vector<int> prbstart = get_input_parameter<std::vector<int>>("prb_start");
145  std::vector<int> prbnum = get_input_parameter<std::vector<int>>("prb_num");
146  /* number of sections and the pair of start/number of prb shall be matched */
147  ASSERT_TRUE((m_numSections == prbstart.size())
148  && (m_numSections == prbnum.size())
149  && (prbstart.size() == prbnum.size()));
150 
151  m_prbStart = new uint16_t [m_numSections];
152  m_prbNum = new uint16_t [m_numSections];
153  for(i=0; i < m_numSections; i++) {
154  m_prbStart[i] = prbstart[i];
155  m_prbNum[i] = prbnum[i];
156  }
157 
158  switch(m_sectionType) {
160  m_filterIndex = XRAN_FILTERINDEX_STANDARD;
161  break;
162 
164  m_filterIndex = get_input_parameter<uint8_t>("filter_index");
165  m_timeOffset = get_input_parameter<uint16_t>("time_offset");
166  m_fftSize = get_input_parameter<uint8_t>("fft_size");
167  m_scs = get_input_parameter<uint8_t>("scs");
168  m_cpLength = get_input_parameter<uint16_t>("cp_length");
169  m_freqOffset = get_input_parameter<int>("freq_offset");
170  break;
171 
172  default:
173  FAIL() << "Invalid Section Type - " << m_sectionType << "\n";
174  }
175 
176  /* allocate and prepare required data storage */
177  m_pSectGenInfo = new struct xran_section_gen_info [m_numSections];
178  ASSERT_NE(m_pSectGenInfo, nullptr);
179  m_params.sections = m_pSectGenInfo;
180 
181  m_pSectResult = new struct xran_section_gen_info [m_numSections];
182  ASSERT_NE(m_pSectResult, nullptr);
183  m_result.sections = m_pSectResult;
184 
185  m_ext1_dst_len = 9600;
186  m_p_ext1_dst = new int8_t [m_ext1_dst_len];
187  m_p_bfw_iq_src = new int16_t [9600/2];
188 
189  /* allocating an mbuf for packet generatrion */
190  m_pTestBuffer = xran_ethdi_mbuf_alloc();
191 
192  ASSERT_FALSE(m_pTestBuffer == NULL);
193  }
194 
195  void TearDown() override
196  {
197  int i, j;
198 
199  if(m_pTestBuffer != NULL)
200  rte_pktmbuf_free(m_pTestBuffer);
201 
202  if(m_prbStart)
203  delete[] m_prbStart;
204  if(m_prbNum)
205  delete[] m_prbNum;
206 
207  if(m_p_bfw_iq_src)
208  delete[] m_p_bfw_iq_src;
209 
210  if(m_p_ext1_dst)
211  delete[] m_p_ext1_dst;
212 
213  if(m_pSectGenInfo)
214  delete[] m_pSectGenInfo;
215 
216  if(m_pSectResult) {
217  delete[] m_pSectResult;
218  }
219 
220  }
221 
222  int prepare_sections(bool extflag);
223  int prepare_extensions(int sect_num);
224  void verify_sections(void);
225 
226 };
227 
228 
229 
231 {
232  int i, numext;
233  int N;
234 
235 
236  N = 8;
237 
238  // extension 1
239  m_ext1.bfwNumber = 4*N; // 4 ant, 8 UEs
240  m_ext1.bfwiqWidth = 16;
242  /* XRAN_BFWCOMPMETHOD_BLKFLOAT
243  * XRAN_BFWCOMPMETHOD_BLKSCALE
244  * XRAN_BFWCOMPMETHOD_ULAW
245  * XRAN_BFWCOMPMETHOD_BEAMSPACE
246  */
248 
249  switch (m_ext1.bfwCompMeth) {
252  break;
255  break;
259  for(i=0; i<N; i++)
261  break;
262  }
263 
264  for(i=0; i<N*4; i++) {
265  m_ext1.p_bfwIQ[i*2] = 0xcafe;
266  m_ext1.p_bfwIQ[i*2+1] = 0xbeef;
267  }
268 
269  // extension 2
270  m_ext2.bfAzPtWidth = 7;
272  m_ext2.bfZePtWidth = 7;
274  m_ext2.bfAz3ddWidth = 7;
276  m_ext2.bfZe3ddWidth = 7;
278  m_ext2.bfAzSI = 0x2 & m_bitmask[3];
279  m_ext2.bfZeSI = 0x5 & m_bitmask[3];
280 
281  // extension 4
282  m_ext4.csf = 1;
283  m_ext4.modCompScaler = 0x5aa5;
284 
285  // extension 5
286  m_ext5.num_sets = 2;
287  for(i=0; i<m_ext5.num_sets; i++) {
288  m_ext5.mc[i].csf = i%2;
289  m_ext5.mc[i].mcScaleReMask = 0xa5a + i;
290  m_ext5.mc[i].mcScaleOffset = 0x5a5a + i;
291  }
292 
293  numext = 0;
294 
296  m_params.sections[sect_num].exData[numext].len = sizeof(m_ext1);
297  m_params.sections[sect_num].exData[numext].data = &m_ext1;
298  numext++;
299 
301  m_params.sections[sect_num].exData[numext].len = sizeof(m_ext2);
302  m_params.sections[sect_num].exData[numext].data = &m_ext2;
303  numext++;
304 
306  m_params.sections[sect_num].exData[numext].len = sizeof(m_ext4);
307  m_params.sections[sect_num].exData[numext].data = &m_ext4;
308  numext++;
309 
311  m_params.sections[sect_num].exData[numext].len = sizeof(m_ext5);
312  m_params.sections[sect_num].exData[numext].data = &m_ext5;
313  numext++;
314 
315  m_params.sections[sect_num].exDataSize = numext;
316 
317  return (0);
318 }
319 
320 int C_plane::prepare_sections(bool extflag)
321 {
322  int numsec;
323 
324 
325  /* Preparing input data for packet generation */
326  m_params.dir = m_dir;
328 
336 
337  switch(m_sectionType) {
339  break;
340 
344  m_params.hdr.scs = m_scs;
346  break;
347 
348  default:
349  return (-1);
350  }
351 
352  for(numsec=0; numsec < m_numSections; numsec++) {
353  m_params.sections[numsec].info.type = m_params.sectionType; // for database
354  m_params.sections[numsec].info.startSymId = m_params.hdr.startSymId; // for database
355  m_params.sections[numsec].info.iqWidth = m_params.hdr.iqWidth; // for database
356  m_params.sections[numsec].info.compMeth = m_params.hdr.compMeth; // for database
357  m_params.sections[numsec].info.id = m_sectionId++;
360  m_params.sections[numsec].info.startPrbc = m_prbStart[numsec];
361  m_params.sections[numsec].info.numPrbc = m_prbNum[numsec];
365  switch(m_sectionType) {
367  break;
368 
371  break;
372 
373  default:
374  return (-1);
375  }
376 
377  /* section extension */
378  if(/*extflag == true*/0) {
379  m_params.sections[numsec].info.ef = 1;
380  prepare_extensions(numsec);
381  }
382  else {
383  m_params.sections[numsec].info.ef = 0;
384  m_params.sections[numsec].exDataSize = 0;
385  }
386  }
387 
388  m_params.numSections = numsec;
389 
390  return (0);
391 }
392 
393 
395 {
396  int i,j;
397 
398  /* Verify the result */
399  EXPECT_TRUE(m_result.dir == m_params.dir);
400  EXPECT_TRUE(m_result.sectionType == m_params.sectionType);
401 
402  EXPECT_TRUE(m_result.hdr.filterIdx == m_params.hdr.filterIdx);
403  EXPECT_TRUE(m_result.hdr.frameId == m_params.hdr.frameId);
404  EXPECT_TRUE(m_result.hdr.subframeId == m_params.hdr.subframeId);
405  EXPECT_TRUE(m_result.hdr.slotId == m_params.hdr.slotId);
406  EXPECT_TRUE(m_result.hdr.startSymId == m_params.hdr.startSymId);
407  EXPECT_TRUE(m_result.hdr.iqWidth == m_params.hdr.iqWidth);
408  EXPECT_TRUE(m_result.hdr.compMeth == m_params.hdr.compMeth);
409 
410  switch(m_sectionType) {
412  break;
413 
415  EXPECT_TRUE(m_result.hdr.fftSize == m_params.hdr.fftSize);
416  EXPECT_TRUE(m_result.hdr.scs == m_params.hdr.scs);
417  EXPECT_TRUE(m_result.hdr.cpLength == m_params.hdr.cpLength);
418  break;
419 
420  default:
421  FAIL() << "Invalid Section Type - " << m_sectionType << "\n";
422  }
423 
424  ASSERT_TRUE(m_result.numSections == m_params.numSections);
425  for(i=0; i < m_result.numSections; i++) {
426  EXPECT_TRUE(m_result.sections[i].info.id == m_params.sections[i].info.id);
427  EXPECT_TRUE(m_result.sections[i].info.rb == XRAN_RBIND_EVERY);
430  EXPECT_TRUE(m_result.sections[i].info.numPrbc == m_params.sections[i].info.numPrbc);
432  EXPECT_TRUE(m_result.sections[i].info.reMask == m_params.sections[i].info.reMask);
433  EXPECT_TRUE(m_result.sections[i].info.beamId == m_params.sections[i].info.beamId);
434  EXPECT_TRUE(m_result.sections[i].info.ef == m_params.sections[i].info.ef);
435 
436  switch(m_sectionType) {
438  break;
439 
442  break;
443 
444  default:
445  FAIL() << "Invalid Section Type - " << m_sectionType << "\n";
446  }
447 
448  if(m_params.sections[i].info.ef) {
449  // printf("[%d] %d == %d\n",i, m_result.sections[i].exDataSize, m_params.sections[i].exDataSize);
450  EXPECT_TRUE(m_result.sections[i].exDataSize == m_params.sections[i].exDataSize);
451 
452  for(j=0; j < m_params.sections[i].exDataSize; j++) {
453  EXPECT_TRUE(m_result.sections[i].exData[j].type == m_params.sections[i].exData[j].type);
454 
455  switch(m_params.sections[i].exData[j].type) {
457  {
458  struct xran_sectionext1_info *ext1_params, *ext1_result;
459  int iq_size, parm_size, N;
460 
461  ext1_params = (struct xran_sectionext1_info *)m_params.sections[i].exData[j].data;
462  ext1_result = (struct xran_sectionext1_info *)m_result.sections[i].exData[j].data;
463 
464  EXPECT_TRUE(ext1_result->bfwiqWidth == ext1_params->bfwiqWidth);
465  EXPECT_TRUE(ext1_result->bfwCompMeth == ext1_params->bfwCompMeth);
466 
467  N = ext1_params->bfwNumber;
468  switch(ext1_params->bfwCompMeth) {
470  EXPECT_TRUE(ext1_result->bfwCompParam.exponent == ext1_params->bfwCompParam.exponent);
471  break;
472 
474  EXPECT_TRUE(ext1_result->bfwCompParam.blockScaler == ext1_params->bfwCompParam.blockScaler);
475  break;
476 
478  EXPECT_TRUE(ext1_result->bfwCompParam.compBitWidthShift == ext1_params->bfwCompParam.compBitWidthShift);
479  break;
480 
482  parm_size = N>>3; if(N%8) parm_size++; parm_size *= 8;
483  EXPECT_TRUE(std::memcmp(ext1_result->bfwCompParam.activeBeamspaceCoeffMask, ext1_params->bfwCompParam.activeBeamspaceCoeffMask, parm_size));
484  break;
485  }
486 
487  /* Get the number of BF weights */
488  iq_size = N*ext1_params->bfwiqWidth*2; // total in bits
489  parm_size = iq_size>>3; // total in bytes (/8)
490  if(iq_size%8) parm_size++; // round up
491  EXPECT_TRUE(std::memcmp(ext1_result->p_bfwIQ, ext1_params->p_bfwIQ, parm_size));
492 
493  }
494  break;
495 
497  {
498  struct xran_sectionext2_info *ext2_params, *ext2_result;
499 
500  ext2_params = (struct xran_sectionext2_info *)m_params.sections[i].exData[j].data;
501  ext2_result = (struct xran_sectionext2_info *)m_result.sections[i].exData[j].data;
502 
503  if(ext2_params->bfAzPtWidth) {
504  EXPECT_TRUE(ext2_result->bfAzPtWidth == ext2_params->bfAzPtWidth);
505  EXPECT_TRUE(ext2_result->bfAzPt == ext2_params->bfAzPt);
506  }
507 
508  if(ext2_params->bfZePtWidth) {
509  EXPECT_TRUE(ext2_result->bfZePtWidth == ext2_params->bfZePtWidth);
510  EXPECT_TRUE(ext2_result->bfZePt == ext2_params->bfZePt);
511  }
512  if(ext2_params->bfAz3ddWidth) {
513  EXPECT_TRUE(ext2_result->bfAz3ddWidth == ext2_params->bfAz3ddWidth);
514  EXPECT_TRUE(ext2_result->bfAz3dd == ext2_params->bfAz3dd);
515  }
516  if(ext2_params->bfZe3ddWidth) {
517  EXPECT_TRUE(ext2_result->bfZe3ddWidth == ext2_params->bfZe3ddWidth);
518  EXPECT_TRUE(ext2_result->bfZe3dd == ext2_params->bfZe3dd);
519  }
520 
521  EXPECT_TRUE(ext2_result->bfAzSI == ext2_params->bfAzSI);
522  EXPECT_TRUE(ext2_result->bfZeSI == ext2_params->bfZeSI);
523  }
524  break;
525 
527  {
528  struct xran_sectionext4_info *ext4_params, *ext4_result;
529 
530  ext4_params = (struct xran_sectionext4_info *)m_params.sections[i].exData[j].data;
531  ext4_result = (struct xran_sectionext4_info *)m_result.sections[i].exData[j].data;
532 
533  EXPECT_TRUE(ext4_result->csf == ext4_params->csf);
534  EXPECT_TRUE(ext4_result->modCompScaler == ext4_params->modCompScaler);
535  }
536  break;
538  {
539  struct xran_sectionext5_info *ext5_params, *ext5_result;
540  int idx;
541 
542  ext5_params = (struct xran_sectionext5_info *)m_params.sections[i].exData[j].data;
543  ext5_result = (struct xran_sectionext5_info *)m_result.sections[i].exData[j].data;
544 
545  EXPECT_TRUE(ext5_result->num_sets == ext5_params->num_sets);
546  for(idx=0; idx < ext5_params->num_sets; idx++) {
547  EXPECT_TRUE(ext5_result->mc[idx].csf == ext5_params->mc[idx].csf);
548  EXPECT_TRUE(ext5_result->mc[idx].mcScaleReMask == ext5_params->mc[idx].mcScaleReMask);
549  EXPECT_TRUE(ext5_result->mc[idx].mcScaleOffset == ext5_params->mc[idx].mcScaleOffset);
550  }
551  }
552  break;
553  }
554  }
555  }
556  }
557 
558  return;
559 }
560 
561 
562 /***************************************************************************
563  * Functional Test cases
564  ***************************************************************************/
565 
566 TEST_P(C_plane, Section_Ext1)
567 {
568  int i = 0, idRb;
569  int32_t len = 0;
570  int16_t *ptr = NULL;
571  int32_t nRbs = 36;
572  int32_t nAntElm = 32;
573  int8_t iqWidth = 16;
574  int8_t compMethod = XRAN_COMPMETHOD_NONE;
575  int8_t *p_ext1_dst = NULL;
576  int16_t *bfw_payload = NULL;
577  int32_t expected_len = (3+1)*nRbs + nAntElm*nRbs*4;
578 
579  struct xran_section_gen_info* loc_pSectGenInfo = m_params.sections;
580  struct xran_sectionext1_info m_ext1;
581  struct xran_cp_radioapp_section_ext1 *p_ext1;
582 
583  /* Configure section information */
584  if(prepare_sections(false) < 0) {
585  FAIL() << "Invalid Section configuration\n";
586  }
587  ptr = m_p_bfw_iq_src;
588 
589  for (idRb =0; idRb < nRbs*nAntElm*2; idRb++){
590  ptr[idRb] = i;
591  i++;
592  }
593 
597  nRbs,
598  nAntElm,
599  iqWidth,
600  compMethod);
601 
602  ASSERT_TRUE(len == expected_len);
603 
604  p_ext1_dst = m_p_ext1_dst;
605  idRb = 0;
606  do {
607  p_ext1 = (struct xran_cp_radioapp_section_ext1 *)p_ext1_dst;
608  bfw_payload = (int16_t*)(p_ext1+1);
609  p_ext1_dst += p_ext1->extLen*XRAN_SECTIONEXT_ALIGN;
610  idRb++;
611  }while(p_ext1->ef != XRAN_EF_F_LAST);
612 
613  ASSERT_TRUE(idRb == nRbs);
614 
615  /* Update section information */
616  memset(&m_ext1, 0, sizeof (struct xran_sectionext1_info));
617  m_ext1.bfwNumber = nAntElm;
618  m_ext1.bfwiqWidth = iqWidth;
619  m_ext1.bfwCompMeth = compMethod;
620  m_ext1.p_bfwIQ = (int16_t*)m_p_ext1_dst;
621  m_ext1.bfwIQ_sz = len;
622 
623  loc_pSectGenInfo->exData[0].type = XRAN_CP_SECTIONEXTCMD_1;
624  loc_pSectGenInfo->exData[0].len = sizeof(m_ext1);
625  loc_pSectGenInfo->exData[0].data = &m_ext1;
626 
627  loc_pSectGenInfo->info.ef = 1;
628  loc_pSectGenInfo->exDataSize = 1;
629 
630  m_params.numSections = 1;
631 
632  /* Generating C-Plane packet */
634 
635  /* Parsing generated packet */
637 
638  /* Verify the result */
639  //verify_sections();
640 }
641 
642 TEST_P(C_plane, Section_Ext1_9bit)
643 {
644  int i = 0, idRb;
645  int32_t len = 0;
646  int16_t *ptr = NULL;
647  int32_t nRbs = 36;
648  int32_t nAntElm = 32;
649  int8_t iqWidth = 9;
650  int8_t compMethod = XRAN_COMPMETHOD_BLKFLOAT;
651  int8_t *p_ext1_dst = NULL;
652  int16_t *bfw_payload = NULL;
653  int32_t expected_len = ((nAntElm/16*4*iqWidth)+1)*nRbs + /* bfwCompParam + IQ = */
654  sizeof(struct xran_cp_radioapp_section_ext1)*nRbs; /* ext1 Headers */
655 
656  struct xran_section_gen_info* loc_pSectGenInfo = m_params.sections;
657  struct xran_sectionext1_info m_ext1;
658  struct xran_cp_radioapp_section_ext1 *p_ext1;
659 
660  /* Configure section information */
661  if(prepare_sections(false) < 0) {
662  FAIL() << "Invalid Section configuration\n";
663  }
664  ptr = m_p_bfw_iq_src;
665 
666  for (idRb =0; idRb < nRbs*nAntElm*2; idRb++){
667  ptr[idRb] = i;
668  i++;
669  }
670 
674  nRbs,
675  nAntElm,
676  iqWidth,
677  compMethod);
678 
679  ASSERT_TRUE(len == expected_len);
680 
681  p_ext1_dst = m_p_ext1_dst;
682  idRb = 0;
683  do {
684  p_ext1 = (struct xran_cp_radioapp_section_ext1 *)p_ext1_dst;
685  bfw_payload = (int16_t*)(p_ext1+1);
686  p_ext1_dst += p_ext1->extLen*XRAN_SECTIONEXT_ALIGN;
687  idRb++;
688  }while(p_ext1->ef != XRAN_EF_F_LAST);
689 
690  ASSERT_TRUE(idRb == nRbs);
691 
692  /* Update section information */
693  memset(&m_ext1, 0, sizeof (struct xran_sectionext1_info));
694  m_ext1.bfwNumber = nAntElm;
695  m_ext1.bfwiqWidth = iqWidth;
696  m_ext1.bfwCompMeth = compMethod;
697  m_ext1.p_bfwIQ = (int16_t*)m_p_ext1_dst;
698  m_ext1.bfwIQ_sz = len;
699 
700  loc_pSectGenInfo->exData[0].type = XRAN_CP_SECTIONEXTCMD_1;
701  loc_pSectGenInfo->exData[0].len = sizeof(m_ext1);
702  loc_pSectGenInfo->exData[0].data = &m_ext1;
703 
704  loc_pSectGenInfo->info.ef = 1;
705  loc_pSectGenInfo->exDataSize = 1;
706 
707  m_params.numSections = 1;
708 
709  /* Generating C-Plane packet */
711 
712  /* Parsing generated packet */
714 
715  /* Verify the result */
716  //verify_sections();
717 }
718 
719 
720 
721 TEST_P(C_plane, PacketGen)
722 {
723  int i;
724 
725 
726  /* Configure section information */
727  if(prepare_sections(false) < 0) {
728  FAIL() << "Invalid Section configuration\n";
729  }
730 
731  /* Generating C-Plane packet */
733 
734  /* Parsing generated packet */
736 
737  /* Verify the result */
738  verify_sections();
739 }
740 
741 
742 TEST_P(C_plane, PacketGen_Ext)
743 {
744  int i;
745 
746 
747  /* Configure section information */
748  if(prepare_sections(true) < 0) {
749  FAIL() << "Invalid Section configuration\n";
750  }
751 
752  /* Generating C-Plane packet */
754 
755  /* Parsing generated packet */
757 
758  /* Verify the result */
759  verify_sections();
760 }
761 
762 
763 /***************************************************************************
764  * Performance Test cases
765  ***************************************************************************/
767 {
768  /* Configure section information */
769  if(prepare_sections(false) < 0) {
770  FAIL() << "Invalid Section configuration\n";
771  }
772 
773  /* using wrapper function to reset mbuf */
776 }
777 
778 TEST_P(C_plane, Perf_Ext)
779 {
780  /* Configure section information */
781  if(prepare_sections(true) < 0) {
782  FAIL() << "Invalid Section configuration\n";
783  }
784 
785  /* using wrapper function to reset mbuf */
788 }
789 
790 
792  testing::ValuesIn(get_sequence(C_plane::get_number_of_cases("C_Plane"))));
793 
uint16_t * m_prbStart
uint8_t m_sectionType
struct rte_mbuf * xran_ethdi_mbuf_alloc(void)
Definition: ethdi.c:77
struct xran_recv_packet_info m_pktInfo
#define XRAN_STATUS_SUCCESS
Definition: xran_fh_o_du.h:54
const uint8_t m_bitmask[]
std::string m_dirStr
int m_freqOffset
int m_maxSections
uint8_t activeBeamspaceCoeffMask[XRAN_MAX_BFW_N]
Definition: xran_cp_api.h:220
static unsigned get_number_of_cases(const std::string &type)
Definition: common.hpp:190
int m_numSections
void cput_fh_rx_prach_callback(void *pCallbackTag, xran_status_t status)
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
struct xran_sectionext5_info::@1 mc[XRAN_MAX_MODCOMP_ADDPARMS]
uint16_t m_cpLength
uint16_t m_timeOffset
uint8_t m_slotId
void cput_fh_rx_callback(void *pCallbackTag, xran_status_t status)
uint8_t m_symStart
struct xran_section_info info
Definition: xran_cp_api.h:296
void verify_sections(void)
uint8_t m_fftSize
int16_t m_bfwIQ[XRAN_MAX_BFW_N *2]
#define XRAN_EF_F_LAST
Definition: xran_cp_api.h:141
This file has all definitions for the Ethernet Data Interface Layer.
uint16_t * m_prbNum
uint16_t startPrbc
Definition: xran_cp_api.h:193
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
#define XRAN_SECTIONEXT_ALIGN
Definition: xran_cp_api.h:50
uint8_t m_iqWidth
struct xran_sectionext1_info m_ext1
struct xran_sectionext4_info m_ext4
INSTANTIATE_TEST_CASE_P(UnitTest, C_plane, testing::ValuesIn(get_sequence(C_plane::get_number_of_cases("C_Plane"))))
TEST_P(C_plane, Section_Ext1)
uint8_t m_filterIndex
uint16_t m_reMask
void init_test(const std::string &type)
Defines section in the conf.json that is used to load parameters from.
Definition: common.hpp:358
struct xran_cp_header_params hdr
Definition: xran_cp_api.h:320
#define XRAN_MAX_BFW_N
Definition: xran_cp_api.h:47
uint8_t m_antId
struct rte_mbuf * m_pTestBuffer
uint8_t m_symNum
This file has all definitions for the Ethernet Data Interface Layer.
struct xran_cp_gen_params m_params
uint8_t m_compMethod
XRAN layer common functionality for both lls-CU and RU as well as C-plane and U-plane.
int prepare_extensions(int sect_num)
union xran_sectionext1_info::@0 bfwCompParam
int8_t * m_p_ext1_dst
const std::string module_name
int32_t xran_cp_populate_section_ext_1(int8_t *p_ext1_dst, uint16_t ext1_dst_len, int16_t *p_bfw_iq_src, uint16_t rbNumber, uint16_t bfwNumber, uint8_t bfwiqWidth, uint8_t bfwCompMeth)
Definition: xran_cp_api.c:387
void TearDown() override
uint8_t m_dir
int prepare_sections(bool extflag)
int xran_prepare_ctrl_pkt(struct rte_mbuf *mbuf, struct xran_cp_gen_params *params, uint8_t CC_ID, uint8_t Ant_ID, uint8_t seq_id)
Create a C-Plane packet Transport layer fragmentation is not supported.
Definition: xran_cp_api.c:1381
#define XRAN_CONVERT_IQWIDTH(x)
Definition: xran_cp_api.h:120
This file provides public interface to xRAN Front Haul layer implementation as defined in the ORAN-WG...
struct xran_sectionext5_info m_ext5
struct xran_cp_gen_params m_result
uint16_t m_sectionId
int16_t * m_p_bfw_iq_src
uint16_t m_ext1_dst_len
uint8_t m_scs
void SetUp() override
struct xran_section_gen_info * sections
Definition: xran_cp_api.h:322
uint16_t numSections
Definition: xran_cp_api.h:318
struct xran_section_gen_info::@2 exData[XRAN_MAX_NUM_EXTENSIONS]
uint16_t m_beamId
uint8_t m_ccId
int xran_ut_prepare_cp(struct rte_mbuf *mbuf, struct xran_cp_gen_params *params, uint8_t cc_id, uint8_t ant_id, uint8_t seq_id)
uint8_t m_seqId
uint8_t m_frameId
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
uint8_t m_subframeId
This file provides the definitions for Control Plane Messages APIs.
struct xran_sectionext2_info m_ext2
This file provides the definitions for Transport layer (eCPRI) API.
int32_t xran_status_t
Definition: xran_fh_o_du.h:236