o-du/phy
Intel O-RAN/X-RAN Generated Doxygen Documentation
prach_performance.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_common.h"
22 #include "xran_fh_o_du.h"
23 #include "ethernet.h"
24 #include "xran_transport.h"
25 #include "xran_cp_api.h"
26 
27 #include <stdint.h>
28 
29 
30 const std::string module_name = "Prach_test";
31 
32 
33 class PrachPerf : public KernelTests
34 {
35 
36  private:
37  struct xran_section_gen_info *m_pSectResult = NULL;
38 
39  protected:
44 
46  int m_maxSections = 8; /* not used */
48 
49  struct rte_mbuf *m_pTestBuffer;
50 
54 
55  uint8_t m_dir;
56  std::string m_dirStr;
57  uint8_t m_sectionType;
58 
59  uint8_t m_ccId, m_antId;
60  uint8_t m_seqId;
62  uint8_t m_symStart, m_symNum;
63  uint16_t *m_prbStart = NULL, *m_prbNum = NULL;
64 
66  uint16_t m_beamId;
67  uint16_t m_reMask = 0xfff;
68  uint16_t m_sectionId;
69  uint8_t m_filterIndex;
70  //uint16_t m_timeOffset;
71  uint8_t m_fftSize;
72 
73  //define reference values
74  uint8_t m_startSymId;
75  uint8_t m_x;
76  uint8_t m_filterIdx;
77  uint16_t m_startPrbc;
78  uint8_t m_numPrbc;
79  uint8_t m_numSymbol;
80  uint16_t m_timeOffset;
81  int32_t m_freqOffset;
88  uint8_t m_SlotNrNum;
89 
90 
91  void SetUp() override
92  {
93  init_test("prach_performance");
94  memset(&m_xranConf, 0, sizeof(struct xran_fh_config));
95  memset(&m_xran_dev_ctx, 0, sizeof(struct xran_device_ctx));
96  m_pPRACHConfig = &m_xranConf.prach_conf;
97  m_pPrachCPConfig = &m_xran_dev_ctx.PrachCPConfig;
98 
99  //initialize input parameters
100  m_xranConf.frame_conf.nNumerology = get_input_parameter<uint8_t>("Numerology");
101  m_xranConf.frame_conf.nFrameDuplexType = get_input_parameter<uint8_t>("FrameDuplexType");
102  m_xranConf.log_level = get_input_parameter<uint32_t>("loglevel");
103 
104  m_pPRACHConfig->nPrachConfIdx = get_input_parameter<uint8_t>("PrachConfIdx");
105  m_pPRACHConfig->nPrachFreqStart = get_input_parameter<uint16_t>("PrachFreqStart");
106  m_pPRACHConfig->nPrachFreqOffset = get_input_parameter<int32_t>("PrachFreqOffset");
107  m_pPRACHConfig->nPrachSubcSpacing = get_input_parameter<uint8_t>("PrachSubcSpacing");
108 
109 
110  m_frameId = get_input_parameter<uint8_t>("frameId");
111  m_subframeId = get_input_parameter<uint8_t>("subframeId");
112  m_slotId = get_input_parameter<uint8_t>("slotId");
113  m_beamId = get_input_parameter<uint16_t>("beamId");
114  m_ccId = get_input_parameter<uint8_t>("ccId");
115  m_antId = get_input_parameter<uint8_t>("antId");
116 
117  //initialize reference output
118  m_startSymId = get_reference_parameter<uint8_t>("startSymId");
119  m_x = get_reference_parameter<uint8_t>("x_value");
120  m_filterIdx = get_reference_parameter<uint8_t>("filterIdx");
121  m_startPrbc = get_reference_parameter<uint16_t>("startPrbc");
122  m_numPrbc = get_reference_parameter<uint8_t>("numPrbc");
123  m_timeOffset = get_reference_parameter<uint16_t>("timeOffset");
124  m_freqOffset = get_reference_parameter<uint32_t>("freqOffset");
125  m_nrofPrachInSlot = get_reference_parameter<uint8_t>("nrofPrachInSlot");
126 
127  //get the values from a vector
128  std::vector<uint8_t> y_vec = get_reference_parameter<std::vector<uint8_t>>("y_value");
129  for(int i=0; i < XRAN_PRACH_CANDIDATE_Y; i++) {
130  m_y[i] = y_vec[i];
131  }
132 
133  m_numSymbol = get_reference_parameter<uint8_t>("numSymbol");
134  m_occassionsInPrachSlot = get_reference_parameter<uint8_t>("occassionsInPrachSlot");
135 
136  std::vector<uint8_t> index_vec = get_reference_parameter<std::vector<uint8_t>>("isPRACHslot");
137  m_SlotNrNum = get_reference_parameter<uint8_t>("SlotNrNum");
138  for(int i = 0; i < XRAN_PRACH_CANDIDATE_SLOT; i++){
139  m_isPRACHslot[i]=0;
140  }
141  for(int i=0; i<m_SlotNrNum;i++){
142  m_isPRACHslot[index_vec[i]]=1;
143  }
144 
145 
146  m_prach_start_symbol = get_reference_parameter<int>("prach_start_symbol");
147  m_prach_last_symbol = get_reference_parameter<int>("prach_last_symbol");
148 
149  /* allocate and prepare required data storage */
150  m_pSectGenInfo = new struct xran_section_gen_info[8];
151  ASSERT_NE(m_pSectGenInfo, nullptr);
153 
154  /* allocating an mbuf for packet generatrion */
155  m_pTestBuffer = (struct rte_mbuf*)rte_pktmbuf_alloc(_eth_mbuf_pool);
156  ASSERT_FALSE(m_pTestBuffer == NULL);
157 
158  }
159 
160  void TearDown() override
161  {
162 
163  if(m_pTestBuffer != NULL)
164  rte_pktmbuf_free(m_pTestBuffer);
165  if(m_pSectGenInfo)
166  delete[] m_pSectGenInfo;
167 
168  return;
169  }
170 };
171 
172 void performance_cp(void *pHandle,struct xran_cp_gen_params *params, struct xran_section_gen_info *sect_geninfo, struct xran_device_ctx *pxran_lib_ctx,
173  uint8_t frame_id, uint8_t subframe_id, uint8_t slot_id,
174  uint16_t beam_id, uint8_t cc_id, uint8_t prach_port_id, uint8_t seq_id)
175 {
176  struct rte_mbuf *mbuf;
177 
178  mbuf = (struct rte_mbuf*)rte_pktmbuf_alloc(_eth_mbuf_pool);
179 
180  generate_cpmsg_prach(pHandle, params, sect_geninfo, mbuf, pxran_lib_ctx,
181  frame_id, subframe_id, slot_id,
182  beam_id, cc_id, prach_port_id, seq_id);
183 
184  seq_id++;
185 
186  rte_pktmbuf_free(mbuf);
187 }
188 
189 TEST_P(PrachPerf, PacketGen)//TestCaseName TestName
190 {
191  int ret;
192  void *pHandle = NULL;
193 
194  /* Preparing input data for prach config */
196  ASSERT_TRUE(ret == XRAN_STATUS_SUCCESS);
197 
198 
201  m_beamId, m_ccId, m_antId, 0);
202  ASSERT_TRUE(ret == XRAN_STATUS_SUCCESS);
203 
204 
208  m_beamId, m_ccId, m_antId, 0);
209 }
210 
211 
213  testing::ValuesIn(get_sequence(PrachPerf::get_number_of_cases("prach_performance"))));
214 
int generate_cpmsg_prach(void *pHandle, struct xran_cp_gen_params *params, struct xran_section_gen_info *sect_geninfo, struct rte_mbuf *mbuf, struct xran_device_ctx *pxran_lib_ctx, uint8_t frame_id, uint8_t subframe_id, uint8_t slot_id, uint16_t beam_id, uint8_t cc_id, uint8_t prach_port_id, uint8_t seq_id)
Definition: xran_common.c:595
uint8_t m_iqWidth
struct xran_device_ctx m_xran_dev_ctx
#define XRAN_STATUS_SUCCESS
Definition: xran_fh_o_du.h:54
int32_t nPrachFreqOffset
Definition: xran_fh_o_du.h:442
uint8_t m_occassionsInPrachSlot
static unsigned get_number_of_cases(const std::string &type)
Definition: common.hpp:190
uint8_t m_SlotNrNum
uint8_t m_frameId
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
uint8_t m_numSymbol
void TearDown() override
uint8_t m_subframeId
uint16_t nPrachFreqStart
Definition: xran_fh_o_du.h:441
uint16_t m_beamId
uint8_t m_slotId
uint8_t m_startSymId
struct xran_fh_config m_xranConf
uint8_t nFrameDuplexType
Definition: xran_fh_o_du.h:460
struct xran_prach_cp_config * m_pPrachCPConfig
uint8_t m_numPrbc
struct xran_cp_gen_params m_result
int xran_init_prach(struct xran_fh_config *pConf, struct xran_device_ctx *p_xran_dev_ctx)
Definition: xran_main.c:308
uint8_t m_symNum
const std::string module_name
This file has all definitions for the Ethernet Data Interface Layer.
uint32_t log_level
Definition: xran_fh_o_du.h:523
#define XRAN_PRACH_CANDIDATE_SLOT
Definition: xran_common.h:80
void performance_cp(void *pHandle, struct xran_cp_gen_params *params, struct xran_section_gen_info *sect_geninfo, struct xran_device_ctx *pxran_lib_ctx, uint8_t frame_id, uint8_t subframe_id, uint8_t slot_id, uint16_t beam_id, uint8_t cc_id, uint8_t prach_port_id, uint8_t seq_id)
struct xran_cp_gen_params m_params
int m_prach_start_symbol
struct xran_frame_config frame_conf
Definition: xran_fh_o_du.h:517
uint8_t m_isPRACHslot[XRAN_PRACH_CANDIDATE_SLOT]
struct xran_section_gen_info * m_pSectGenInfo
struct rte_mbuf * m_pTestBuffer
uint8_t m_filterIdx
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 rte_mempool * _eth_mbuf_pool
Definition: ethernet.c:70
uint16_t m_sectionId
struct xran_prach_config prach_conf
Definition: xran_fh_o_du.h:515
void SetUp() override
struct xran_recv_packet_info m_pktInfo
#define XRAN_PRACH_CANDIDATE_Y
Definition: xran_common.h:79
uint8_t m_symStart
uint8_t m_y[XRAN_PRACH_CANDIDATE_Y]
uint8_t m_sectionType
XRAN layer common functionality for both lls-CU and RU as well as C-plane and U-plane.
uint8_t m_fftSize
uint16_t * m_prbNum
uint16_t m_startPrbc
std::string m_dirStr
struct xran_prach_config * m_pPRACHConfig
INSTANTIATE_TEST_CASE_P(UnitTest, PrachPerf, testing::ValuesIn(get_sequence(PrachPerf::get_number_of_cases("prach_performance"))))
This file provides public interface to xRAN Front Haul layer implementation as defined in the ORAN-WG...
uint8_t m_compMethod
struct xran_prach_cp_config PrachCPConfig
Definition: xran_common.h:210
uint8_t m_nrofPrachInSlot
struct xran_section_gen_info * sections
Definition: xran_cp_api.h:322
TEST_P(PrachPerf, PacketGen)
uint16_t m_reMask
uint16_t * m_prbStart
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
int32_t m_freqOffset
This file provides the definitions for Control Plane Messages APIs.
uint16_t m_timeOffset
uint8_t m_filterIndex
uint8_t nPrachSubcSpacing
Definition: xran_fh_o_du.h:433
This file provides the definitions for Transport layer (eCPRI) API.