1 /******************************************************************************
3 * Copyright (c) 2019 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 *******************************************************************************/
21 #include "xran_lib_wrap.hpp"
22 #include "xran_common.h"
23 #include "xran_fh_o_du.h"
26 #include "xran_transport.h"
27 #include "xran_cp_api.h"
32 const std::string module_name = "C-Plane";
34 const uint8_t m_bitmask[] = { 0x00, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
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)
43 rte_pktmbuf_reset(mbuf);
44 return(xran_prepare_ctrl_pkt(mbuf, params, cc_id, ant_id, seq_id));
48 void cput_fh_rx_callback(void *pCallbackTag, xran_status_t status)
53 void cput_fh_rx_prach_callback(void *pCallbackTag, xran_status_t status)
62 class C_plane: public KernelTests
65 struct xran_section_gen_info *m_pSectGenInfo = NULL;
66 struct xran_section_gen_info *m_pSectResult = NULL;
70 int m_maxSections = 8; /* not used */
73 struct rte_mbuf *m_pTestBuffer;
75 struct xran_cp_gen_params m_params;
76 struct xran_recv_packet_info m_pktInfo;
77 struct xran_cp_gen_params m_result;
81 uint8_t m_sectionType;
83 uint8_t m_ccId, m_antId;
85 uint8_t m_frameId, m_subframeId, m_slotId;
86 uint8_t m_symStart, m_symNum;
87 uint16_t *m_prbStart = NULL, *m_prbNum = NULL;
89 uint8_t m_iqWidth, m_compMethod;
91 uint16_t m_reMask = 0xfff;
93 uint8_t m_filterIndex;
94 uint16_t m_timeOffset;
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;
104 struct xran_sectionext1_info m_ext1;
105 struct xran_sectionext2_info m_ext2;
106 struct xran_sectionext4_info m_ext4;
107 struct xran_sectionext5_info m_ext5;
109 int16_t m_bfwIQ[XRAN_MAX_BFW_N*2];
112 void SetUp() override
116 init_test("C_Plane");
118 m_numSections = get_input_parameter<int>("num_sections");
119 ASSERT_FALSE(m_numSections == 0);
121 m_dirStr = get_input_parameter<std::string>("direction");
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!";
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");
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");
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");
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()));
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];
158 switch(m_sectionType) {
159 case XRAN_CP_SECTIONTYPE_1:
160 m_filterIndex = XRAN_FILTERINDEX_STANDARD;
163 case XRAN_CP_SECTIONTYPE_3:
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");
173 FAIL() << "Invalid Section Type - " << m_sectionType << "\n";
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;
181 m_pSectResult = new struct xran_section_gen_info [m_numSections];
182 ASSERT_NE(m_pSectResult, nullptr);
183 m_result.sections = m_pSectResult;
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];
189 /* allocating an mbuf for packet generatrion */
190 m_pTestBuffer = xran_ethdi_mbuf_alloc();
192 ASSERT_FALSE(m_pTestBuffer == NULL);
195 void TearDown() override
199 if(m_pTestBuffer != NULL)
200 rte_pktmbuf_free(m_pTestBuffer);
208 delete[] m_p_bfw_iq_src;
211 delete[] m_p_ext1_dst;
214 delete[] m_pSectGenInfo;
217 delete[] m_pSectResult;
222 int prepare_sections(bool extflag);
223 int prepare_extensions(int sect_num);
224 void verify_sections(void);
230 int C_plane::prepare_extensions(int sect_num)
239 m_ext1.bfwNumber = 4*N; // 4 ant, 8 UEs
240 m_ext1.bfwiqWidth = 16;
241 m_ext1.bfwCompMeth = XRAN_BFWCOMPMETHOD_NONE;
242 /* XRAN_BFWCOMPMETHOD_BLKFLOAT
243 * XRAN_BFWCOMPMETHOD_BLKSCALE
244 * XRAN_BFWCOMPMETHOD_ULAW
245 * XRAN_BFWCOMPMETHOD_BEAMSPACE
247 m_ext1.p_bfwIQ = m_bfwIQ;
249 switch (m_ext1.bfwCompMeth) {
250 case XRAN_BFWCOMPMETHOD_BLKFLOAT:
251 m_ext1.bfwCompParam.exponent = 0xa;
253 case XRAN_BFWCOMPMETHOD_BLKSCALE:
254 m_ext1.bfwCompParam.blockScaler = 0xa5;
256 case XRAN_BFWCOMPMETHOD_ULAW:
257 m_ext1.bfwCompParam.compBitWidthShift = 0x55;
258 case XRAN_BFWCOMPMETHOD_BEAMSPACE:
260 m_ext1.bfwCompParam.activeBeamspaceCoeffMask[i] = 0xa0 + i;
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;
270 m_ext2.bfAzPtWidth = 7;
271 m_ext2.bfAzPt = 0x55 & m_bitmask[m_ext2.bfAzPtWidth];
272 m_ext2.bfZePtWidth = 7;
273 m_ext2.bfZePt = 0xaa & m_bitmask[m_ext2.bfAzPtWidth];
274 m_ext2.bfAz3ddWidth = 7;
275 m_ext2.bfAz3dd = 0x5a & m_bitmask[m_ext2.bfAzPtWidth];
276 m_ext2.bfZe3ddWidth = 7;
277 m_ext2.bfZe3dd = 0xa5 & m_bitmask[m_ext2.bfAzPtWidth];
278 m_ext2.bfAzSI = 0x2 & m_bitmask[3];
279 m_ext2.bfZeSI = 0x5 & m_bitmask[3];
283 m_ext4.modCompScaler = 0x5aa5;
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;
295 m_params.sections[sect_num].exData[numext].type = XRAN_CP_SECTIONEXTCMD_1;
296 m_params.sections[sect_num].exData[numext].len = sizeof(m_ext1);
297 m_params.sections[sect_num].exData[numext].data = &m_ext1;
300 m_params.sections[sect_num].exData[numext].type = XRAN_CP_SECTIONEXTCMD_2;
301 m_params.sections[sect_num].exData[numext].len = sizeof(m_ext2);
302 m_params.sections[sect_num].exData[numext].data = &m_ext2;
305 m_params.sections[sect_num].exData[numext].type = XRAN_CP_SECTIONEXTCMD_4;
306 m_params.sections[sect_num].exData[numext].len = sizeof(m_ext4);
307 m_params.sections[sect_num].exData[numext].data = &m_ext4;
310 m_params.sections[sect_num].exData[numext].type = XRAN_CP_SECTIONEXTCMD_5;
311 m_params.sections[sect_num].exData[numext].len = sizeof(m_ext5);
312 m_params.sections[sect_num].exData[numext].data = &m_ext5;
315 m_params.sections[sect_num].exDataSize = numext;
320 int C_plane::prepare_sections(bool extflag)
325 /* Preparing input data for packet generation */
326 m_params.dir = m_dir;
327 m_params.sectionType = m_sectionType;
329 m_params.hdr.filterIdx = m_filterIndex;
330 m_params.hdr.frameId = m_frameId;
331 m_params.hdr.subframeId = m_subframeId;
332 m_params.hdr.slotId = m_slotId;
333 m_params.hdr.startSymId = m_symStart;
334 m_params.hdr.iqWidth = XRAN_CONVERT_IQWIDTH(m_iqWidth);
335 m_params.hdr.compMeth = m_compMethod;
337 switch(m_sectionType) {
338 case XRAN_CP_SECTIONTYPE_1:
341 case XRAN_CP_SECTIONTYPE_3:
342 m_params.hdr.timeOffset = m_timeOffset;
343 m_params.hdr.fftSize = m_fftSize;
344 m_params.hdr.scs = m_scs;
345 m_params.hdr.cpLength = m_cpLength;
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++;
358 m_params.sections[numsec].info.rb = XRAN_RBIND_EVERY;
359 m_params.sections[numsec].info.symInc = XRAN_SYMBOLNUMBER_NOTINC;
360 m_params.sections[numsec].info.startPrbc = m_prbStart[numsec];
361 m_params.sections[numsec].info.numPrbc = m_prbNum[numsec];
362 m_params.sections[numsec].info.numSymbol = m_symNum;
363 m_params.sections[numsec].info.reMask = m_reMask;
364 m_params.sections[numsec].info.beamId = m_beamId;
365 switch(m_sectionType) {
366 case XRAN_CP_SECTIONTYPE_1:
369 case XRAN_CP_SECTIONTYPE_3:
370 m_params.sections[numsec].info.freqOffset = m_freqOffset;
377 /* section extension */
378 if(/*extflag == true*/0) {
379 m_params.sections[numsec].info.ef = 1;
380 prepare_extensions(numsec);
383 m_params.sections[numsec].info.ef = 0;
384 m_params.sections[numsec].exDataSize = 0;
388 m_params.numSections = numsec;
394 void C_plane::verify_sections(void)
398 /* Verify the result */
399 EXPECT_TRUE(m_result.dir == m_params.dir);
400 EXPECT_TRUE(m_result.sectionType == m_params.sectionType);
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);
410 switch(m_sectionType) {
411 case XRAN_CP_SECTIONTYPE_1:
414 case XRAN_CP_SECTIONTYPE_3:
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);
421 FAIL() << "Invalid Section Type - " << m_sectionType << "\n";
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);
428 EXPECT_TRUE(m_result.sections[i].info.symInc == XRAN_SYMBOLNUMBER_NOTINC);
429 EXPECT_TRUE(m_result.sections[i].info.startPrbc == m_params.sections[i].info.startPrbc);
430 EXPECT_TRUE(m_result.sections[i].info.numPrbc == m_params.sections[i].info.numPrbc);
431 EXPECT_TRUE(m_result.sections[i].info.numSymbol == m_params.sections[i].info.numSymbol);
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);
436 switch(m_sectionType) {
437 case XRAN_CP_SECTIONTYPE_1:
440 case XRAN_CP_SECTIONTYPE_3:
441 EXPECT_TRUE(m_result.sections[i].info.freqOffset == m_params.sections[i].info.freqOffset);
445 FAIL() << "Invalid Section Type - " << m_sectionType << "\n";
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);
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);
455 switch(m_params.sections[i].exData[j].type) {
456 case XRAN_CP_SECTIONEXTCMD_1:
458 struct xran_sectionext1_info *ext1_params, *ext1_result;
459 int iq_size, parm_size, N;
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;
464 EXPECT_TRUE(ext1_result->bfwiqWidth == ext1_params->bfwiqWidth);
465 EXPECT_TRUE(ext1_result->bfwCompMeth == ext1_params->bfwCompMeth);
467 N = ext1_params->bfwNumber;
468 switch(ext1_params->bfwCompMeth) {
469 case XRAN_BFWCOMPMETHOD_BLKFLOAT:
470 EXPECT_TRUE(ext1_result->bfwCompParam.exponent == ext1_params->bfwCompParam.exponent);
473 case XRAN_BFWCOMPMETHOD_BLKSCALE:
474 EXPECT_TRUE(ext1_result->bfwCompParam.blockScaler == ext1_params->bfwCompParam.blockScaler);
477 case XRAN_BFWCOMPMETHOD_ULAW:
478 EXPECT_TRUE(ext1_result->bfwCompParam.compBitWidthShift == ext1_params->bfwCompParam.compBitWidthShift);
481 case XRAN_BFWCOMPMETHOD_BEAMSPACE:
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));
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));
496 case XRAN_CP_SECTIONEXTCMD_2:
498 struct xran_sectionext2_info *ext2_params, *ext2_result;
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;
503 if(ext2_params->bfAzPtWidth) {
504 EXPECT_TRUE(ext2_result->bfAzPtWidth == ext2_params->bfAzPtWidth);
505 EXPECT_TRUE(ext2_result->bfAzPt == ext2_params->bfAzPt);
508 if(ext2_params->bfZePtWidth) {
509 EXPECT_TRUE(ext2_result->bfZePtWidth == ext2_params->bfZePtWidth);
510 EXPECT_TRUE(ext2_result->bfZePt == ext2_params->bfZePt);
512 if(ext2_params->bfAz3ddWidth) {
513 EXPECT_TRUE(ext2_result->bfAz3ddWidth == ext2_params->bfAz3ddWidth);
514 EXPECT_TRUE(ext2_result->bfAz3dd == ext2_params->bfAz3dd);
516 if(ext2_params->bfZe3ddWidth) {
517 EXPECT_TRUE(ext2_result->bfZe3ddWidth == ext2_params->bfZe3ddWidth);
518 EXPECT_TRUE(ext2_result->bfZe3dd == ext2_params->bfZe3dd);
521 EXPECT_TRUE(ext2_result->bfAzSI == ext2_params->bfAzSI);
522 EXPECT_TRUE(ext2_result->bfZeSI == ext2_params->bfZeSI);
526 case XRAN_CP_SECTIONEXTCMD_4:
528 struct xran_sectionext4_info *ext4_params, *ext4_result;
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;
533 EXPECT_TRUE(ext4_result->csf == ext4_params->csf);
534 EXPECT_TRUE(ext4_result->modCompScaler == ext4_params->modCompScaler);
537 case XRAN_CP_SECTIONEXTCMD_5:
539 struct xran_sectionext5_info *ext5_params, *ext5_result;
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;
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);
562 /***************************************************************************
563 * Functional Test cases
564 ***************************************************************************/
566 TEST_P(C_plane, Section_Ext1)
572 int32_t nAntElm = 32;
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;
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;
583 /* Configure section information */
584 if(prepare_sections(false) < 0) {
585 FAIL() << "Invalid Section configuration\n";
587 ptr = m_p_bfw_iq_src;
589 for (idRb =0; idRb < nRbs*nAntElm*2; idRb++){
594 len = xran_cp_populate_section_ext_1(m_p_ext1_dst,
602 ASSERT_TRUE(len == expected_len);
604 p_ext1_dst = m_p_ext1_dst;
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;
611 }while(p_ext1->ef != XRAN_EF_F_LAST);
613 ASSERT_TRUE(idRb == nRbs);
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;
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;
627 loc_pSectGenInfo->info.ef = 1;
628 loc_pSectGenInfo->exDataSize = 1;
630 m_params.numSections = 1;
632 /* Generating C-Plane packet */
633 ASSERT_TRUE(xran_prepare_ctrl_pkt(m_pTestBuffer, &m_params, m_ccId, m_antId, m_seqId) == XRAN_STATUS_SUCCESS);
635 /* Parsing generated packet */
636 EXPECT_TRUE(xran_parse_cp_pkt(m_pTestBuffer, &m_result, &m_pktInfo) == XRAN_STATUS_SUCCESS);
638 /* Verify the result */
642 TEST_P(C_plane, Section_Ext1_9bit)
648 int32_t nAntElm = 32;
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 */
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;
660 /* Configure section information */
661 if(prepare_sections(false) < 0) {
662 FAIL() << "Invalid Section configuration\n";
664 ptr = m_p_bfw_iq_src;
666 for (idRb =0; idRb < nRbs*nAntElm*2; idRb++){
671 len = xran_cp_populate_section_ext_1(m_p_ext1_dst,
679 ASSERT_TRUE(len == expected_len);
681 p_ext1_dst = m_p_ext1_dst;
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;
688 }while(p_ext1->ef != XRAN_EF_F_LAST);
690 ASSERT_TRUE(idRb == nRbs);
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;
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;
704 loc_pSectGenInfo->info.ef = 1;
705 loc_pSectGenInfo->exDataSize = 1;
707 m_params.numSections = 1;
709 /* Generating C-Plane packet */
710 ASSERT_TRUE(xran_prepare_ctrl_pkt(m_pTestBuffer, &m_params, m_ccId, m_antId, m_seqId) == XRAN_STATUS_SUCCESS);
712 /* Parsing generated packet */
713 EXPECT_TRUE(xran_parse_cp_pkt(m_pTestBuffer, &m_result, &m_pktInfo) == XRAN_STATUS_SUCCESS);
715 /* Verify the result */
721 TEST_P(C_plane, PacketGen)
726 /* Configure section information */
727 if(prepare_sections(false) < 0) {
728 FAIL() << "Invalid Section configuration\n";
731 /* Generating C-Plane packet */
732 ASSERT_TRUE(xran_prepare_ctrl_pkt(m_pTestBuffer, &m_params, m_ccId, m_antId, m_seqId) == XRAN_STATUS_SUCCESS);
734 /* Parsing generated packet */
735 EXPECT_TRUE(xran_parse_cp_pkt(m_pTestBuffer, &m_result, &m_pktInfo) == XRAN_STATUS_SUCCESS);
737 /* Verify the result */
742 TEST_P(C_plane, PacketGen_Ext)
747 /* Configure section information */
748 if(prepare_sections(true) < 0) {
749 FAIL() << "Invalid Section configuration\n";
752 /* Generating C-Plane packet */
753 ASSERT_TRUE(xran_prepare_ctrl_pkt(m_pTestBuffer, &m_params, m_ccId, m_antId, m_seqId) == XRAN_STATUS_SUCCESS);
755 /* Parsing generated packet */
756 EXPECT_TRUE(xran_parse_cp_pkt(m_pTestBuffer, &m_result, &m_pktInfo) == XRAN_STATUS_SUCCESS);
758 /* Verify the result */
763 /***************************************************************************
764 * Performance Test cases
765 ***************************************************************************/
766 TEST_P(C_plane, Perf)
768 /* Configure section information */
769 if(prepare_sections(false) < 0) {
770 FAIL() << "Invalid Section configuration\n";
773 /* using wrapper function to reset mbuf */
774 performance("C", module_name,
775 &xran_ut_prepare_cp, m_pTestBuffer, &m_params, m_ccId, m_antId, m_seqId);
778 TEST_P(C_plane, Perf_Ext)
780 /* Configure section information */
781 if(prepare_sections(true) < 0) {
782 FAIL() << "Invalid Section configuration\n";
785 /* using wrapper function to reset mbuf */
786 performance("C", module_name,
787 &xran_ut_prepare_cp, m_pTestBuffer, &m_params, m_ccId, m_antId, m_seqId);
791 INSTANTIATE_TEST_CASE_P(UnitTest, C_plane,
792 testing::ValuesIn(get_sequence(C_plane::get_number_of_cases("C_Plane"))));