-/******************************************************************************\r
-*\r
-* Copyright (c) 2019 Intel.\r
-*\r
-* Licensed under the Apache License, Version 2.0 (the "License");\r
-* you may not use this file except in compliance with the License.\r
-* You may obtain a copy of the License at\r
-*\r
-* http://www.apache.org/licenses/LICENSE-2.0\r
-*\r
-* Unless required by applicable law or agreed to in writing, software\r
-* distributed under the License is distributed on an "AS IS" BASIS,\r
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-* See the License for the specific language governing permissions and\r
-* limitations under the License.\r
-*\r
-*******************************************************************************/\r
-\r
-\r
-#include "common.hpp"\r
-#include "xran_common.h"\r
-#include "xran_fh_o_du.h"\r
-#include "ethernet.h"\r
-#include "xran_transport.h"\r
-#include "xran_cp_api.h"\r
-\r
-#include <stdint.h>\r
-\r
-\r
-const std::string module_name = "Prach_test";\r
-\r
-\r
-class PrachPerf : public KernelTests\r
-{\r
-\r
- private:\r
- struct xran_section_gen_info *m_pSectResult = NULL;\r
-\r
- protected:\r
- struct xran_fh_config m_xranConf;\r
- struct xran_device_ctx m_xran_dev_ctx;\r
- struct xran_prach_config *m_pPRACHConfig;\r
- struct xran_prach_cp_config *m_pPrachCPConfig;\r
-\r
- struct xran_section_gen_info *m_pSectGenInfo = NULL;\r
- int m_maxSections = 8; /* not used */\r
- int lastsymbol;\r
-\r
- struct rte_mbuf *m_pTestBuffer;\r
-\r
- struct xran_cp_gen_params m_params;\r
- struct xran_recv_packet_info m_pktInfo;\r
- struct xran_cp_gen_params m_result;\r
-\r
- uint8_t m_dir;\r
- std::string m_dirStr;\r
- uint8_t m_sectionType;\r
-\r
- uint8_t m_ccId, m_antId;\r
- uint8_t m_seqId;\r
- uint8_t m_frameId, m_subframeId, m_slotId;\r
- uint8_t m_symStart, m_symNum;\r
- uint16_t *m_prbStart = NULL, *m_prbNum = NULL;\r
-\r
- uint8_t m_iqWidth, m_compMethod;\r
- uint16_t m_beamId;\r
- uint16_t m_reMask = 0xfff;\r
- uint16_t m_sectionId;\r
- uint8_t m_filterIndex;\r
- //uint16_t m_timeOffset;\r
- uint8_t m_fftSize;\r
-\r
- //define reference values\r
- uint8_t m_startSymId;\r
- uint8_t m_x;\r
- uint8_t m_filterIdx;\r
- uint16_t m_startPrbc;\r
- uint8_t m_numPrbc;\r
- uint8_t m_numSymbol;\r
- uint16_t m_timeOffset;\r
- int32_t m_freqOffset;\r
- uint8_t m_nrofPrachInSlot;\r
- uint8_t m_occassionsInPrachSlot;\r
- uint8_t m_y[XRAN_PRACH_CANDIDATE_Y];\r
- uint8_t m_isPRACHslot[XRAN_PRACH_CANDIDATE_SLOT];\r
- int m_prach_start_symbol;\r
- int m_prach_last_symbol;\r
- uint8_t m_SlotNrNum;\r
-\r
-\r
- void SetUp() override\r
- {\r
- init_test("prach_performance");\r
- memset(&m_xranConf, 0, sizeof(struct xran_fh_config));\r
- memset(&m_xran_dev_ctx, 0, sizeof(struct xran_device_ctx));\r
- m_pPRACHConfig = &m_xranConf.prach_conf;\r
- m_pPrachCPConfig = &m_xran_dev_ctx.PrachCPConfig;\r
-\r
- //initialize input parameters\r
- m_xranConf.frame_conf.nNumerology = get_input_parameter<uint8_t>("Numerology");\r
- m_xranConf.frame_conf.nFrameDuplexType = get_input_parameter<uint8_t>("FrameDuplexType");\r
- m_xranConf.log_level = get_input_parameter<uint32_t>("loglevel");\r
-\r
- m_pPRACHConfig->nPrachConfIdx = get_input_parameter<uint8_t>("PrachConfIdx");\r
- m_pPRACHConfig->nPrachFreqStart = get_input_parameter<uint16_t>("PrachFreqStart");\r
- m_pPRACHConfig->nPrachFreqOffset = get_input_parameter<int32_t>("PrachFreqOffset");\r
- m_pPRACHConfig->nPrachSubcSpacing = get_input_parameter<uint8_t>("PrachSubcSpacing");\r
-\r
-\r
- m_frameId = get_input_parameter<uint8_t>("frameId");\r
- m_subframeId = get_input_parameter<uint8_t>("subframeId");\r
- m_slotId = get_input_parameter<uint8_t>("slotId");\r
- m_beamId = get_input_parameter<uint16_t>("beamId");\r
- m_ccId = get_input_parameter<uint8_t>("ccId");\r
- m_antId = get_input_parameter<uint8_t>("antId");\r
-\r
- //initialize reference output\r
- m_startSymId = get_reference_parameter<uint8_t>("startSymId");\r
- m_x = get_reference_parameter<uint8_t>("x_value");\r
- m_filterIdx = get_reference_parameter<uint8_t>("filterIdx");\r
- m_startPrbc = get_reference_parameter<uint16_t>("startPrbc");\r
- m_numPrbc = get_reference_parameter<uint8_t>("numPrbc");\r
- m_timeOffset = get_reference_parameter<uint16_t>("timeOffset");\r
- m_freqOffset = get_reference_parameter<uint32_t>("freqOffset");\r
- m_nrofPrachInSlot = get_reference_parameter<uint8_t>("nrofPrachInSlot");\r
-\r
- //get the values from a vector\r
- std::vector<uint8_t> y_vec = get_reference_parameter<std::vector<uint8_t>>("y_value");\r
- for(int i=0; i < XRAN_PRACH_CANDIDATE_Y; i++) {\r
- m_y[i] = y_vec[i];\r
- }\r
-\r
- m_numSymbol = get_reference_parameter<uint8_t>("numSymbol");\r
- m_occassionsInPrachSlot = get_reference_parameter<uint8_t>("occassionsInPrachSlot");\r
-\r
- std::vector<uint8_t> index_vec = get_reference_parameter<std::vector<uint8_t>>("isPRACHslot");\r
- m_SlotNrNum = get_reference_parameter<uint8_t>("SlotNrNum");\r
- for(int i = 0; i < XRAN_PRACH_CANDIDATE_SLOT; i++){\r
- m_isPRACHslot[i]=0;\r
- }\r
- for(int i=0; i<m_SlotNrNum;i++){\r
- m_isPRACHslot[index_vec[i]]=1;\r
- }\r
-\r
-\r
- m_prach_start_symbol = get_reference_parameter<int>("prach_start_symbol");\r
- m_prach_last_symbol = get_reference_parameter<int>("prach_last_symbol");\r
-\r
- /* allocate and prepare required data storage */\r
- m_pSectGenInfo = new struct xran_section_gen_info[8];\r
- ASSERT_NE(m_pSectGenInfo, nullptr);\r
- m_params.sections = m_pSectGenInfo;\r
-\r
- /* allocating an mbuf for packet generatrion */\r
- m_pTestBuffer = (struct rte_mbuf*)rte_pktmbuf_alloc(_eth_mbuf_pool);\r
- ASSERT_FALSE(m_pTestBuffer == NULL);\r
-\r
- }\r
-\r
- void TearDown() override\r
- {\r
-\r
- if(m_pTestBuffer != NULL)\r
- rte_pktmbuf_free(m_pTestBuffer);\r
- if(m_pSectGenInfo)\r
- delete[] m_pSectGenInfo;\r
-\r
- return;\r
- }\r
-};\r
-\r
-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,\r
- uint8_t frame_id, uint8_t subframe_id, uint8_t slot_id,\r
- uint16_t beam_id, uint8_t cc_id, uint8_t prach_port_id, uint8_t seq_id)\r
-{\r
- struct rte_mbuf *mbuf;\r
-\r
- mbuf = (struct rte_mbuf*)rte_pktmbuf_alloc(_eth_mbuf_pool);\r
-\r
- generate_cpmsg_prach(pHandle, params, sect_geninfo, mbuf, pxran_lib_ctx,\r
- frame_id, subframe_id, slot_id,\r
- beam_id, cc_id, prach_port_id, seq_id);\r
-\r
- seq_id++;\r
-\r
- rte_pktmbuf_free(mbuf);\r
-}\r
-\r
-TEST_P(PrachPerf, PacketGen)//TestCaseName TestName\r
-{\r
- int ret;\r
- void *pHandle = NULL;\r
-\r
- /* Preparing input data for prach config */\r
- ret = xran_init_prach(&m_xranConf, &m_xran_dev_ctx);\r
- ASSERT_TRUE(ret == XRAN_STATUS_SUCCESS);\r
-\r
-\r
- ret = generate_cpmsg_prach(pHandle, &m_params, m_pSectGenInfo, m_pTestBuffer, &m_xran_dev_ctx,\r
- m_frameId, m_subframeId, m_slotId,\r
- m_beamId, m_ccId, m_antId, 0);\r
- ASSERT_TRUE(ret == XRAN_STATUS_SUCCESS);\r
-\r
-\r
- performance("C", module_name,\r
- &performance_cp, pHandle, &m_params, m_pSectGenInfo, &m_xran_dev_ctx,\r
- m_frameId, m_subframeId, m_slotId,\r
- m_beamId, m_ccId, m_antId, 0);\r
-}\r
-\r
-\r
-INSTANTIATE_TEST_CASE_P(UnitTest, PrachPerf,\r
- testing::ValuesIn(get_sequence(PrachPerf::get_number_of_cases("prach_performance"))));\r
-\r
+/******************************************************************************
+*
+* Copyright (c) 2019 Intel.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*******************************************************************************/
+
+
+#include "common.hpp"
+#include "xran_common.h"
+#include "xran_fh_o_du.h"
+#include "ethernet.h"
+#include "xran_transport.h"
+#include "xran_cp_api.h"
+
+#include <stdint.h>
+
+
+const std::string module_name = "Prach_test";
+
+
+class PrachPerf : public KernelTests
+{
+
+ private:
+ struct xran_section_gen_info *m_pSectResult = NULL;
+
+ protected:
+ struct xran_fh_config m_xranConf;
+ struct xran_device_ctx m_xran_dev_ctx;
+ struct xran_prach_config *m_pPRACHConfig;
+ struct xran_prach_cp_config *m_pPrachCPConfig;
+
+ struct xran_section_gen_info *m_pSectGenInfo = NULL;
+ int m_maxSections = 8; /* not used */
+ int lastsymbol;
+
+ struct rte_mbuf *m_pTestBuffer;
+
+ struct xran_cp_gen_params m_params;
+ struct xran_recv_packet_info m_pktInfo;
+ struct xran_cp_gen_params m_result;
+
+ uint8_t m_dir;
+ std::string m_dirStr;
+ uint8_t m_sectionType;
+
+ uint8_t m_ccId, m_antId;
+ uint8_t m_seqId;
+ uint8_t m_frameId, m_subframeId, m_slotId;
+ uint8_t m_symStart, m_symNum;
+ uint16_t *m_prbStart = NULL, *m_prbNum = NULL;
+
+ uint8_t m_iqWidth, m_compMethod;
+ uint16_t m_beamId;
+ uint16_t m_reMask = 0xfff;
+ uint16_t m_sectionId;
+ uint8_t m_filterIndex;
+ //uint16_t m_timeOffset;
+ uint8_t m_fftSize;
+
+ //define reference values
+ uint8_t m_startSymId;
+ uint8_t m_x;
+ uint8_t m_filterIdx;
+ uint16_t m_startPrbc;
+ uint8_t m_numPrbc;
+ uint8_t m_numSymbol;
+ uint16_t m_timeOffset;
+ int32_t m_freqOffset;
+ uint8_t m_nrofPrachInSlot;
+ uint8_t m_occassionsInPrachSlot;
+ uint8_t m_y[XRAN_PRACH_CANDIDATE_Y];
+ uint8_t m_isPRACHslot[XRAN_PRACH_CANDIDATE_SLOT];
+ int m_prach_start_symbol;
+ int m_prach_last_symbol;
+ uint8_t m_SlotNrNum;
+
+
+ void SetUp() override
+ {
+ init_test("prach_performance");
+ memset(&m_xranConf, 0, sizeof(struct xran_fh_config));
+ memset(&m_xran_dev_ctx, 0, sizeof(struct xran_device_ctx));
+ m_pPRACHConfig = &m_xranConf.prach_conf;
+ m_pPrachCPConfig = &m_xran_dev_ctx.PrachCPConfig;
+
+ //initialize input parameters
+ m_xranConf.frame_conf.nNumerology = get_input_parameter<uint8_t>("Numerology");
+ m_xranConf.frame_conf.nFrameDuplexType = get_input_parameter<uint8_t>("FrameDuplexType");
+ m_xranConf.log_level = get_input_parameter<uint32_t>("loglevel");
+
+ m_pPRACHConfig->nPrachConfIdx = get_input_parameter<uint8_t>("PrachConfIdx");
+ m_pPRACHConfig->nPrachFreqStart = get_input_parameter<uint16_t>("PrachFreqStart");
+ m_pPRACHConfig->nPrachFreqOffset = get_input_parameter<int32_t>("PrachFreqOffset");
+ m_pPRACHConfig->nPrachSubcSpacing = get_input_parameter<uint8_t>("PrachSubcSpacing");
+
+
+ m_frameId = get_input_parameter<uint8_t>("frameId");
+ m_subframeId = get_input_parameter<uint8_t>("subframeId");
+ m_slotId = get_input_parameter<uint8_t>("slotId");
+ m_beamId = get_input_parameter<uint16_t>("beamId");
+ m_ccId = get_input_parameter<uint8_t>("ccId");
+ m_antId = get_input_parameter<uint8_t>("antId");
+
+ //initialize reference output
+ m_startSymId = get_reference_parameter<uint8_t>("startSymId");
+ m_x = get_reference_parameter<uint8_t>("x_value");
+ m_filterIdx = get_reference_parameter<uint8_t>("filterIdx");
+ m_startPrbc = get_reference_parameter<uint16_t>("startPrbc");
+ m_numPrbc = get_reference_parameter<uint8_t>("numPrbc");
+ m_timeOffset = get_reference_parameter<uint16_t>("timeOffset");
+ m_freqOffset = get_reference_parameter<uint32_t>("freqOffset");
+ m_nrofPrachInSlot = get_reference_parameter<uint8_t>("nrofPrachInSlot");
+
+ //get the values from a vector
+ std::vector<uint8_t> y_vec = get_reference_parameter<std::vector<uint8_t>>("y_value");
+ for(int i=0; i < XRAN_PRACH_CANDIDATE_Y; i++) {
+ m_y[i] = y_vec[i];
+ }
+
+ m_numSymbol = get_reference_parameter<uint8_t>("numSymbol");
+ m_occassionsInPrachSlot = get_reference_parameter<uint8_t>("occassionsInPrachSlot");
+
+ std::vector<uint8_t> index_vec = get_reference_parameter<std::vector<uint8_t>>("isPRACHslot");
+ m_SlotNrNum = get_reference_parameter<uint8_t>("SlotNrNum");
+ for(int i = 0; i < XRAN_PRACH_CANDIDATE_SLOT; i++){
+ m_isPRACHslot[i]=0;
+ }
+ for(int i=0; i<m_SlotNrNum;i++){
+ m_isPRACHslot[index_vec[i]]=1;
+ }
+
+
+ m_prach_start_symbol = get_reference_parameter<int>("prach_start_symbol");
+ m_prach_last_symbol = get_reference_parameter<int>("prach_last_symbol");
+
+ /* allocate and prepare required data storage */
+ m_pSectGenInfo = new struct xran_section_gen_info[8];
+ ASSERT_NE(m_pSectGenInfo, nullptr);
+ m_params.sections = m_pSectGenInfo;
+
+ /* allocating an mbuf for packet generatrion */
+ m_pTestBuffer = (struct rte_mbuf*)rte_pktmbuf_alloc(_eth_mbuf_pool);
+ ASSERT_FALSE(m_pTestBuffer == NULL);
+
+ }
+
+ void TearDown() override
+ {
+
+ if(m_pTestBuffer != NULL)
+ rte_pktmbuf_free(m_pTestBuffer);
+ if(m_pSectGenInfo)
+ delete[] m_pSectGenInfo;
+
+ return;
+ }
+};
+
+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 rte_mbuf *mbuf;
+
+ mbuf = (struct rte_mbuf*)rte_pktmbuf_alloc(_eth_mbuf_pool);
+
+ generate_cpmsg_prach(pHandle, params, sect_geninfo, mbuf, pxran_lib_ctx,
+ frame_id, subframe_id, slot_id,
+ beam_id, cc_id, prach_port_id, seq_id);
+
+ seq_id++;
+
+ rte_pktmbuf_free(mbuf);
+}
+
+TEST_P(PrachPerf, PacketGen)//TestCaseName TestName
+{
+ int ret;
+ void *pHandle = NULL;
+
+ /* Preparing input data for prach config */
+ ret = xran_init_prach(&m_xranConf, &m_xran_dev_ctx);
+ ASSERT_TRUE(ret == XRAN_STATUS_SUCCESS);
+
+
+ ret = generate_cpmsg_prach(pHandle, &m_params, m_pSectGenInfo, m_pTestBuffer, &m_xran_dev_ctx,
+ m_frameId, m_subframeId, m_slotId,
+ m_beamId, m_ccId, m_antId, 0);
+ ASSERT_TRUE(ret == XRAN_STATUS_SUCCESS);
+
+
+ performance("C", module_name,
+ &performance_cp, pHandle, &m_params, m_pSectGenInfo, &m_xran_dev_ctx,
+ m_frameId, m_subframeId, m_slotId,
+ m_beamId, m_ccId, m_antId, 0);
+}
+
+
+INSTANTIATE_TEST_CASE_P(UnitTest, PrachPerf,
+ testing::ValuesIn(get_sequence(PrachPerf::get_number_of_cases("prach_performance"))));
+