X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=fhi_lib%2Ftest%2Fcommon%2Fxran_lib_wrap.hpp;h=a323f7f5589583201f764452751a0527d42a5503;hb=892daba4c616407f16506415d5a69549519ef11d;hp=c92abc74a0a8d00f82484357fcb10a937afa3b3e;hpb=70d9d920dd4e575f085f1f1a9050fefd1c10e127;p=o-du%2Fphy.git diff --git a/fhi_lib/test/common/xran_lib_wrap.hpp b/fhi_lib/test/common/xran_lib_wrap.hpp index c92abc7..a323f7f 100644 --- a/fhi_lib/test/common/xran_lib_wrap.hpp +++ b/fhi_lib/test/common/xran_lib_wrap.hpp @@ -18,6 +18,7 @@ #include "common.hpp" #include "xran_fh_o_du.h" +#include "xran_fh_o_ru.h" #include "xran_common.h" #include "xran_frame_struct.h" @@ -42,14 +43,15 @@ extern "C" { -extern uint32_t xran_lib_ota_tti; -extern uint32_t xran_lib_ota_sym; -extern uint32_t xran_lib_ota_sym_idx; +extern uint32_t xran_lib_ota_tti[]; +extern uint32_t xran_lib_ota_sym[]; +extern uint32_t xran_lib_ota_sym_idx[]; void sym_ota_cb(struct rte_timer *tim, void *arg); void tti_ota_cb(struct rte_timer *tim, void *arg); } + class xranLibWraper { public: @@ -60,11 +62,68 @@ public: XRANFTHTX_SEC_DESC_OUT, XRANFTHRX_IN, XRANFTHRX_PRB_MAP_IN, + XRANCP_PRB_MAP_IN_RX, + XRANCP_PRB_MAP_IN_TX, XRANFTHTX_SEC_DESC_IN, XRANFTHRACH_IN, MAX_SW_XRAN_INTERFACE_NUM } SWXRANInterfaceTypeEnum; +struct xran_io_buf_ctrl { + /* -1-this subframe is not used in current frame format + 0-this subframe can be transmitted, i.e., data is ready + 1-this subframe is waiting transmission, i.e., data is not ready + 10 - DL transmission missing deadline. When FE needs this subframe data but bValid is still 1, + set bValid to 10. + */ + int32_t bValid ; // when UL rx, it is subframe index. + int32_t nSegToBeGen; + int32_t nSegGenerated; // how many date segment are generated by DL LTE processing or received from FE + // -1 means that DL packet to be transmitted is not ready in BS + int32_t nSegTransferred; // number of data segments has been transmitted or received + //struct rte_mbuf *pData[N_MAX_BUFFER_SEGMENT]; // point to DPDK allocated memory pool + struct xran_buffer_list sBufferList; +}; + +struct xran_io_shared_ctrl { + /* io struct */ + struct xran_io_buf_ctrl sFrontHaulTxBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; + struct xran_io_buf_ctrl sFrontHaulTxPrbMapBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; + struct xran_io_buf_ctrl sFrontHaulRxBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; + struct xran_io_buf_ctrl sFrontHaulRxPrbMapBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; + struct xran_io_buf_ctrl sFHPrachRxBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; + struct xran_io_buf_ctrl sFHPrachRxBbuIoBufCtrlDecomp[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; + + /* Cat B */ + struct xran_io_buf_ctrl sFHSrsRxBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANT_ARRAY_ELM_NR]; + struct xran_io_buf_ctrl sFHSrsRxPrbMapBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANT_ARRAY_ELM_NR]; + + struct xran_io_buf_ctrl sFHCpRxPrbMapBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; + struct xran_io_buf_ctrl sFHCpTxPrbMapBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; + + /* buffers lists */ + struct xran_flat_buffer sFrontHaulTxBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_NUM_OF_SYMBOL_PER_SLOT]; + struct xran_flat_buffer sFrontHaulTxPrbMapBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; + struct xran_flat_buffer sFrontHaulRxBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_NUM_OF_SYMBOL_PER_SLOT]; + struct xran_flat_buffer sFrontHaulRxPrbMapBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; + struct xran_flat_buffer sFHPrachRxBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_NUM_OF_SYMBOL_PER_SLOT]; + struct xran_flat_buffer sFHPrachRxBuffersDecomp[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_NUM_OF_SYMBOL_PER_SLOT]; + + struct xran_flat_buffer sFrontHaulCpRxPrbMapBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; + struct xran_flat_buffer sFrontHaulCpTxPrbMapBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; + + /* Cat B SRS buffers */ + struct xran_flat_buffer sFHSrsRxBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANT_ARRAY_ELM_NR][XRAN_MAX_NUM_OF_SRS_SYMBOL_PER_SLOT]; + struct xran_flat_buffer sFHSrsRxPrbMapBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANT_ARRAY_ELM_NR]; +}; + +struct bbu_xran_io_if { + void* nInstanceHandle[XRAN_PORTS_NUM][XRAN_MAX_SECTOR_NR]; /* instance per ORAN port */ + uint32_t nBufPoolIndex[XRAN_PORTS_NUM][XRAN_MAX_SECTOR_NR][MAX_SW_XRAN_INTERFACE_NUM]; /* every api owns unique buffer pool */ + uint16_t nInstanceNum[XRAN_PORTS_NUM]; + struct xran_io_shared_ctrl ioCtrl[XRAN_PORTS_NUM]; /**< for each O-RU port */ +}; + enum nChBw { PHY_BW_5MHZ = 5, PHY_BW_10MHZ = 10, PHY_BW_15MHZ = 15, @@ -91,7 +150,6 @@ public: { 32, 66, 132, 264 } // Numerology 3 (120KHz) }; - protected: char argv[25] = "unittest"; @@ -111,28 +169,7 @@ protected: uint32_t tti_to_process; } m_timer_ctx[MAX_NUM_OF_XRAN_CTX]; - /* io struct */ - BbuIoBufCtrlStruct m_sFrontHaulTxBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; - BbuIoBufCtrlStruct m_sFrontHaulTxPrbMapBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; - BbuIoBufCtrlStruct m_sFrontHaulRxBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; - BbuIoBufCtrlStruct m_sFrontHaulRxPrbMapBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; - BbuIoBufCtrlStruct m_sFHPrachRxBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; - - /* Cat B */ - BbuIoBufCtrlStruct m_sFHSrsRxBbuIoBufCtrl[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANT_ARRAY_ELM_NR]; - - /* buffers lists */ - struct xran_flat_buffer m_sFrontHaulTxBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_NUM_OF_SYMBOL_PER_SLOT]; - struct xran_flat_buffer m_sFrontHaulTxPrbMapBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; - struct xran_flat_buffer m_sFrontHaulRxBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_NUM_OF_SYMBOL_PER_SLOT]; - struct xran_flat_buffer m_sFrontHaulRxPrbMapBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR]; - struct xran_flat_buffer m_sFHPrachRxBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_NUM_OF_SYMBOL_PER_SLOT]; - - /* Cat B SRS buffers */ - struct xran_flat_buffer m_sFHSrsRxBuffers[XRAN_N_FE_BUF_LEN][XRAN_MAX_SECTOR_NR][XRAN_MAX_ANT_ARRAY_ELM_NR][XRAN_MAX_NUM_OF_SRS_SYMBOL_PER_SLOT]; - - void *m_nInstanceHandle[XRAN_PORTS_NUM][XRAN_MAX_SECTOR_NR]; // instance per sector - uint32_t m_nBufPoolIndex[XRAN_MAX_SECTOR_NR][MAX_SW_XRAN_INTERFACE_NUM]; // every api owns unique buffer pool + struct bbu_xran_io_if m_gsXranIoIf; uint32_t m_nSW_ToFpga_FTH_TxBufferLen; uint32_t m_nFpgaToSW_FTH_RxBufferLen; @@ -152,7 +189,6 @@ protected: int32_t tx_ul_bfw_buffer_size[MAX_ANT_CARRIER_SUPPORTED]; int32_t tx_ul_bfw_buffer_position[MAX_ANT_CARRIER_SUPPORTED]; - private: json m_global_cfg; @@ -185,10 +221,10 @@ private: return (result << shift); } - int init_memory() + int init_memory(uint32_t o_xu_id) { xran_status_t status; - int32_t i, j, k, z; + uint32_t i, j, k, z, m; SWXRANInterfaceTypeEnum eInterfaceType; void *ptr; void *mb; @@ -196,8 +232,11 @@ private: uint16_t *u16dptr; uint8_t *u8dptr; - uint32_t xran_max_antenna_nr = RTE_MAX(get_num_eaxc(), get_num_eaxc_ul()); - uint32_t xran_max_ant_array_elm_nr = RTE_MAX(get_num_antelmtrx(), xran_max_antenna_nr); + struct bbu_xran_io_if *psBbuIo = (struct bbu_xran_io_if*)&m_gsXranIoIf; + struct xran_io_shared_ctrl *psIoCtrl = (struct xran_io_shared_ctrl *)&psBbuIo->ioCtrl[o_xu_id]; + + uint32_t xran_max_antenna_nr = (uint32_t)RTE_MAX((uint32_t)get_num_eaxc(), (uint32_t)get_num_eaxc_ul()); + uint32_t xran_max_ant_array_elm_nr = (uint32_t)RTE_MAX((uint32_t)get_num_antelmtrx(), (uint32_t)xran_max_antenna_nr); std::cout << "XRAN front haul xran_mm_init" << std::endl; @@ -208,26 +247,27 @@ private: } /* initialize maximum instances to have flexibility for the tests */ - int nInstanceNum = XRAN_MAX_SECTOR_NR; + /* initialize maximum supported CC to have flexibility on the test */ - int32_t nSectorNum = 6;//XRAN_MAX_SECTOR_NR; + uint32_t nSectorNum = 6;//XRAN_MAX_SECTOR_NR; - for(k = 0; k < XRAN_PORTS_NUM; k++) { - status = xran_sector_get_instances(m_xranhandle, nInstanceNum, &m_nInstanceHandle[k][0]); + k = o_xu_id; + psBbuIo->nInstanceNum[k] = nSectorNum; + status = xran_sector_get_instances(k, m_xranhandle, psBbuIo->nInstanceNum[k], &psBbuIo->nInstanceHandle[k][0]); if(status != XRAN_STATUS_SUCCESS) { - std::cout << "get sector instance failed " << k << " for XRAN nInstanceNum " << nInstanceNum << std::endl; + std::cout << "get sector instance failed " << k << " for XRAN nInstanceNum " << psBbuIo->nInstanceNum[k] << std::endl; return (-1); } - for (i = 0; i < nInstanceNum; i++) - std::cout << __func__ << " [" << k << "]: CC " << i << " handle " << m_nInstanceHandle[0][i] << std::endl; - } + for (i = 0; i < psBbuIo->nInstanceNum[k]; i++) + std::cout << __func__ << " [" << k << "]: CC " << i << " handle " << psBbuIo->nInstanceHandle[k][i] << std::endl; + std::cout << "Sucess xran_mm_init" << std::endl; /* Init Memory */ for(i = 0; inInstanceHandle[o_xu_id][i], + &psBbuIo->nBufPoolIndex[o_xu_id][m_nSectorIndex[i]][eInterfaceType], XRAN_N_FE_BUF_LEN * xran_max_antenna_nr * XRAN_NUM_OF_SYMBOL_PER_SLOT, m_nSW_ToFpga_FTH_TxBufferLen); if(status != XRAN_STATUS_SUCCESS) { @@ -236,24 +276,24 @@ private: } for(j = 0; j < XRAN_N_FE_BUF_LEN; j++) { for(z = 0; z < xran_max_antenna_nr; z++){ - m_sFrontHaulTxBbuIoBufCtrl[j][i][z].bValid = 0; - m_sFrontHaulTxBbuIoBufCtrl[j][i][z].nSegGenerated = -1; - m_sFrontHaulTxBbuIoBufCtrl[j][i][z].nSegToBeGen = -1; - m_sFrontHaulTxBbuIoBufCtrl[j][i][z].nSegTransferred = 0; - m_sFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList.nNumBuffers = XRAN_NUM_OF_SYMBOL_PER_SLOT; - m_sFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers = &m_sFrontHaulTxBuffers[j][i][z][0]; + psIoCtrl->sFrontHaulTxBbuIoBufCtrl[j][i][z].bValid = 0; + psIoCtrl->sFrontHaulTxBbuIoBufCtrl[j][i][z].nSegGenerated = -1; + psIoCtrl->sFrontHaulTxBbuIoBufCtrl[j][i][z].nSegToBeGen = -1; + psIoCtrl->sFrontHaulTxBbuIoBufCtrl[j][i][z].nSegTransferred = 0; + psIoCtrl->sFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList.nNumBuffers = XRAN_NUM_OF_SYMBOL_PER_SLOT; + psIoCtrl->sFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers = &psIoCtrl->sFrontHaulTxBuffers[j][i][z][0]; for(k = 0; k < XRAN_NUM_OF_SYMBOL_PER_SLOT; k++) { - m_sFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nElementLenInBytes = m_nSW_ToFpga_FTH_TxBufferLen; // 14 symbols 3200bytes/symbol - m_sFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nNumberOfElements = 1; - m_sFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nOffsetInBytes = 0; - status = xran_bm_allocate_buffer(m_nInstanceHandle[0][i], m_nBufPoolIndex[m_nSectorIndex[i]][eInterfaceType], &ptr, &mb); + psIoCtrl->sFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nElementLenInBytes = m_nSW_ToFpga_FTH_TxBufferLen; // 14 symbols 3200bytes/symbol + psIoCtrl->sFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nNumberOfElements = 1; + psIoCtrl->sFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nOffsetInBytes = 0; + status = xran_bm_allocate_buffer(psBbuIo->nInstanceHandle[o_xu_id][i], psBbuIo->nBufPoolIndex[o_xu_id][m_nSectorIndex[i]][eInterfaceType], &ptr, &mb); if(status != XRAN_STATUS_SUCCESS) { std::cout << __LINE__ << " Failed at xran_bm_allocate_buffer, status " << status << std::endl; return (-1); } - m_sFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].pData = (uint8_t *)ptr; - m_sFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].pCtrl = (void *)mb; + psIoCtrl->sFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].pData = (uint8_t *)ptr; + psIoCtrl->sFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].pCtrl = (void *)mb; if(ptr) { u32dptr = (uint32_t*)(ptr); @@ -265,17 +305,9 @@ private: } /* C-plane DL */ - eInterfaceType = XRANFTHTX_SEC_DESC_OUT; - status = xran_bm_init(m_nInstanceHandle[0][i], - &m_nBufPoolIndex[m_nSectorIndex[i]][eInterfaceType], - XRAN_N_FE_BUF_LEN * xran_max_antenna_nr * XRAN_NUM_OF_SYMBOL_PER_SLOT*XRAN_MAX_SECTIONS_PER_SYM, sizeof(struct xran_section_desc)); - if(XRAN_STATUS_SUCCESS != status) { - std::cout << __LINE__ << " Failed at xran_bm_init, status " << status << std::endl; - return (-1); - } eInterfaceType = XRANFTHTX_PRB_MAP_OUT; - status = xran_bm_init(m_nInstanceHandle[0][i], - &m_nBufPoolIndex[m_nSectorIndex[i]][eInterfaceType], + status = xran_bm_init(psBbuIo->nInstanceHandle[o_xu_id][i], + &psBbuIo->nBufPoolIndex[o_xu_id][m_nSectorIndex[i]][eInterfaceType], XRAN_N_FE_BUF_LEN * xran_max_antenna_nr * XRAN_NUM_OF_SYMBOL_PER_SLOT, sizeof(struct xran_prb_map)); if(status != XRAN_STATUS_SUCCESS) { @@ -284,47 +316,99 @@ private: } for(j = 0; j < XRAN_N_FE_BUF_LEN; j++) { for(z = 0; z < xran_max_antenna_nr; z++) { - m_sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].bValid = 0; - m_sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].nSegGenerated = -1; - m_sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].nSegToBeGen = -1; - m_sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].nSegTransferred = 0; - m_sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.nNumBuffers = XRAN_NUM_OF_SYMBOL_PER_SLOT; - m_sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers = &m_sFrontHaulTxPrbMapBuffers[j][i][z]; - - m_sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nElementLenInBytes = sizeof(struct xran_prb_map); - m_sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nNumberOfElements = 1; - m_sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nOffsetInBytes = 0; - status = xran_bm_allocate_buffer(m_nInstanceHandle[0][i], m_nBufPoolIndex[m_nSectorIndex[i]][eInterfaceType], &ptr, &mb); + psIoCtrl->sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].bValid = 0; + psIoCtrl->sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].nSegGenerated = -1; + psIoCtrl->sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].nSegToBeGen = -1; + psIoCtrl->sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].nSegTransferred = 0; + psIoCtrl->sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.nNumBuffers = XRAN_NUM_OF_SYMBOL_PER_SLOT; + psIoCtrl->sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers = &psIoCtrl->sFrontHaulTxPrbMapBuffers[j][i][z]; + + psIoCtrl->sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nElementLenInBytes = sizeof(struct xran_prb_map); + psIoCtrl->sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nNumberOfElements = 1; + psIoCtrl->sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nOffsetInBytes = 0; + + status = xran_bm_allocate_buffer(psBbuIo->nInstanceHandle[o_xu_id][i], psBbuIo->nBufPoolIndex[o_xu_id][m_nSectorIndex[i]][eInterfaceType], &ptr, &mb); if(status != XRAN_STATUS_SUCCESS) { std::cout << __LINE__ << " Failed at xran_bm_allocate_buffer, status " << status << std::endl; return (-1); } - m_sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->pData = (uint8_t *)ptr; - m_sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->pCtrl = (void *)mb; - void *sd_ptr; - void *sd_mb; - int elm_id; + psIoCtrl->sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->pData = (uint8_t *)ptr; + psIoCtrl->sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->pCtrl = (void *)mb; + struct xran_prb_map * p_rb_map = (struct xran_prb_map *)ptr; //memcpy(ptr, &startupConfiguration.PrbMap, sizeof(struct xran_prb_map)); - for (elm_id = 0; elm_id < XRAN_MAX_SECTIONS_PER_SYM; elm_id++){ - struct xran_prb_elm *pPrbElem = &p_rb_map->prbMap[elm_id]; - for(k = 0; k < XRAN_NUM_OF_SYMBOL_PER_SLOT; k++){ - status = xran_bm_allocate_buffer(m_nInstanceHandle[0][i], m_nBufPoolIndex[m_nSectorIndex[i]][XRANFTHTX_SEC_DESC_OUT], &sd_ptr, &sd_mb); + } + } + /* C-plane */ + eInterfaceType = XRANCP_PRB_MAP_IN_RX; + status = xran_bm_init(psBbuIo->nInstanceHandle[o_xu_id][i], + &psBbuIo->nBufPoolIndex[o_xu_id][m_nSectorIndex[i]][eInterfaceType], + XRAN_N_FE_BUF_LEN * xran_max_antenna_nr * XRAN_NUM_OF_SYMBOL_PER_SLOT, + sizeof(struct xran_prb_map)); if(XRAN_STATUS_SUCCESS != status){ - std::cout << __LINE__ << "SD Failed at xran_bm_allocate_buffer , status %d\n" << status << std::endl; - return (-1); + rte_panic("Failed at xran_bm_init, status %d\n", status); + } + + for(j = 0;j < XRAN_N_FE_BUF_LEN; j++) { + for(z = 0; z < xran_max_antenna_nr; z++){ + psIoCtrl->sFHCpRxPrbMapBbuIoBufCtrl[j][i][z].bValid = 0; + psIoCtrl->sFHCpRxPrbMapBbuIoBufCtrl[j][i][z].nSegGenerated = -1; + psIoCtrl->sFHCpRxPrbMapBbuIoBufCtrl[j][i][z].nSegToBeGen = -1; + psIoCtrl->sFHCpRxPrbMapBbuIoBufCtrl[j][i][z].nSegTransferred = 0; + psIoCtrl->sFHCpRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.nNumBuffers = XRAN_NUM_OF_SYMBOL_PER_SLOT; + psIoCtrl->sFHCpRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers = &psIoCtrl->sFrontHaulCpRxPrbMapBbuIoBufCtrl[j][i][z]; + + psIoCtrl->sFHCpRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nElementLenInBytes = sizeof(struct xran_prb_map); + psIoCtrl->sFHCpRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nNumberOfElements = 1; + psIoCtrl->sFHCpRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nOffsetInBytes = 0; + status = xran_bm_allocate_buffer(psBbuIo->nInstanceHandle[o_xu_id][i], psBbuIo->nBufPoolIndex[o_xu_id][m_nSectorIndex[i]][eInterfaceType], &ptr, &mb); + if(XRAN_STATUS_SUCCESS != status) { + rte_panic("Failed at xran_bm_allocate_buffer , status %d\n",status); } - pPrbElem->p_sec_desc[k] = (struct xran_section_desc *)sd_ptr; + psIoCtrl->sFHCpRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->pData = (uint8_t *)ptr; + psIoCtrl->sFHCpRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->pCtrl = (void *)mb; + struct xran_prb_map * p_rb_map = (struct xran_prb_map *)ptr; } } + + + /* C-plane Tx */ + eInterfaceType = XRANCP_PRB_MAP_IN_TX; + status = xran_bm_init(psBbuIo->nInstanceHandle[o_xu_id][i], + &psBbuIo->nBufPoolIndex[o_xu_id][m_nSectorIndex[i]][eInterfaceType], + XRAN_N_FE_BUF_LEN * xran_max_antenna_nr * XRAN_NUM_OF_SYMBOL_PER_SLOT, + sizeof(struct xran_prb_map)); + if(XRAN_STATUS_SUCCESS != status) { + rte_panic("Failed at xran_bm_init, status %d\n", status); + } + + for(j = 0;j < XRAN_N_FE_BUF_LEN; j++) { + for(z = 0; z < xran_max_antenna_nr; z++){ + psIoCtrl->sFHCpTxPrbMapBbuIoBufCtrl[j][i][z].bValid = 0; + psIoCtrl->sFHCpTxPrbMapBbuIoBufCtrl[j][i][z].nSegGenerated = -1; + psIoCtrl->sFHCpTxPrbMapBbuIoBufCtrl[j][i][z].nSegToBeGen = -1; + psIoCtrl->sFHCpTxPrbMapBbuIoBufCtrl[j][i][z].nSegTransferred = 0; + psIoCtrl->sFHCpTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.nNumBuffers = XRAN_NUM_OF_SYMBOL_PER_SLOT; + psIoCtrl->sFHCpTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers = &psIoCtrl->sFrontHaulCpTxPrbMapBbuIoBufCtrl[j][i][z]; + + psIoCtrl->sFHCpTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nElementLenInBytes = sizeof(struct xran_prb_map); + psIoCtrl->sFHCpTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nNumberOfElements = 1; + psIoCtrl->sFHCpTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nOffsetInBytes = 0; + status = xran_bm_allocate_buffer(psBbuIo->nInstanceHandle[o_xu_id][i],psBbuIo->nBufPoolIndex[o_xu_id][m_nSectorIndex[i]][eInterfaceType],&ptr, &mb); + if(XRAN_STATUS_SUCCESS != status) { + rte_panic("Failed at xran_bm_allocate_buffer , status %d\n",status); + } + psIoCtrl->sFHCpTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->pData = (uint8_t *)ptr; + psIoCtrl->sFHCpTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->pCtrl = (void *)mb; + struct xran_prb_map * p_rb_map = (struct xran_prb_map *)ptr; } } } for(i = 0; inInstanceHandle[o_xu_id][i], + &psBbuIo->nBufPoolIndex[o_xu_id][m_nSectorIndex[i]][eInterfaceType], XRAN_N_FE_BUF_LEN * xran_max_antenna_nr * XRAN_NUM_OF_SYMBOL_PER_SLOT, m_nSW_ToFpga_FTH_TxBufferLen); /* ????, actual alloc size is m_nFpgaToSW_FTH_RxBUfferLen */ if(status != XRAN_STATUS_SUCCESS) { @@ -334,23 +418,23 @@ private: for(j = 0;j < XRAN_N_FE_BUF_LEN; j++) { for(z = 0; z < xran_max_antenna_nr; z++) { - m_sFrontHaulRxBbuIoBufCtrl[j][i][z].bValid = 0; - m_sFrontHaulRxBbuIoBufCtrl[j][i][z].nSegGenerated = -1; - m_sFrontHaulRxBbuIoBufCtrl[j][i][z].nSegToBeGen = -1; - m_sFrontHaulRxBbuIoBufCtrl[j][i][z].nSegTransferred = 0; - m_sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList.nNumBuffers = XRAN_NUM_OF_SYMBOL_PER_SLOT; - m_sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers = &m_sFrontHaulRxBuffers[j][i][z][0]; + psIoCtrl->sFrontHaulRxBbuIoBufCtrl[j][i][z].bValid = 0; + psIoCtrl->sFrontHaulRxBbuIoBufCtrl[j][i][z].nSegGenerated = -1; + psIoCtrl->sFrontHaulRxBbuIoBufCtrl[j][i][z].nSegToBeGen = -1; + psIoCtrl->sFrontHaulRxBbuIoBufCtrl[j][i][z].nSegTransferred = 0; + psIoCtrl->sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList.nNumBuffers = XRAN_NUM_OF_SYMBOL_PER_SLOT; + psIoCtrl->sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers = &psIoCtrl->sFrontHaulRxBuffers[j][i][z][0]; for(k = 0; k< XRAN_NUM_OF_SYMBOL_PER_SLOT; k++) { - m_sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nElementLenInBytes = m_nFpgaToSW_FTH_RxBufferLen; - m_sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nNumberOfElements = 1; - m_sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nOffsetInBytes = 0; - status = xran_bm_allocate_buffer(m_nInstanceHandle[0][i], m_nBufPoolIndex[m_nSectorIndex[i]][eInterfaceType],&ptr, &mb); + psIoCtrl->sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nElementLenInBytes = m_nFpgaToSW_FTH_RxBufferLen; + psIoCtrl->sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nNumberOfElements = 1; + psIoCtrl->sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nOffsetInBytes = 0; + status = xran_bm_allocate_buffer(psBbuIo->nInstanceHandle[o_xu_id][i], psBbuIo->nBufPoolIndex[o_xu_id][m_nSectorIndex[i]][eInterfaceType],&ptr, &mb); if(status != XRAN_STATUS_SUCCESS) { std::cout << __LINE__ << " Failed at xran_bm_allocate_buffer, status " << status << std::endl; return (-1); } - m_sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].pData = (uint8_t *)ptr; - m_sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].pCtrl = (void *) mb; + psIoCtrl->sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].pData = (uint8_t *)ptr; + psIoCtrl->sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].pCtrl = (void *) mb; if(ptr) { u32dptr = (uint32_t*)(ptr); uint8_t *ptr_temp = (uint8_t *)ptr; @@ -360,17 +444,9 @@ private: } } - eInterfaceType = XRANFTHTX_SEC_DESC_IN; - status = xran_bm_init(m_nInstanceHandle[0][i], - &m_nBufPoolIndex[m_nSectorIndex[i]][eInterfaceType], - XRAN_N_FE_BUF_LEN * xran_max_antenna_nr * XRAN_NUM_OF_SYMBOL_PER_SLOT*XRAN_MAX_SECTIONS_PER_SYM, sizeof(struct xran_section_desc)); - if(XRAN_STATUS_SUCCESS != status) { - std::cout << __LINE__ << " Failed at xran_bm_init, status " << status << std::endl; - return (-1); - } eInterfaceType = XRANFTHRX_PRB_MAP_IN; - status = xran_bm_init(m_nInstanceHandle[0][i], - &m_nBufPoolIndex[m_nSectorIndex[i]][eInterfaceType], + status = xran_bm_init(psBbuIo->nInstanceHandle[o_xu_id][i], + &psBbuIo->nBufPoolIndex[o_xu_id][m_nSectorIndex[i]][eInterfaceType], XRAN_N_FE_BUF_LEN * xran_max_antenna_nr * XRAN_NUM_OF_SYMBOL_PER_SLOT, sizeof(struct xran_prb_map)); if(status != XRAN_STATUS_SUCCESS) { @@ -380,75 +456,62 @@ private: for(j = 0;j < XRAN_N_FE_BUF_LEN; j++) { for(z = 0; z < xran_max_antenna_nr; z++) { - m_sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].bValid = 0; - m_sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].nSegGenerated = -1; - m_sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].nSegToBeGen = -1; - m_sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].nSegTransferred = 0; - m_sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.nNumBuffers = XRAN_NUM_OF_SYMBOL_PER_SLOT; - m_sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers = &m_sFrontHaulRxPrbMapBuffers[j][i][z]; - - m_sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nElementLenInBytes = sizeof(struct xran_prb_map); - m_sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nNumberOfElements = 1; - m_sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nOffsetInBytes = 0; - status = xran_bm_allocate_buffer(m_nInstanceHandle[0][i],m_nBufPoolIndex[m_nSectorIndex[i]][eInterfaceType], &ptr, &mb); + psIoCtrl->sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].bValid = 0; + psIoCtrl->sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].nSegGenerated = -1; + psIoCtrl->sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].nSegToBeGen = -1; + psIoCtrl->sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].nSegTransferred = 0; + psIoCtrl->sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.nNumBuffers = XRAN_NUM_OF_SYMBOL_PER_SLOT; + psIoCtrl->sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers = &psIoCtrl->sFrontHaulRxPrbMapBuffers[j][i][z]; + + psIoCtrl->sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nElementLenInBytes = sizeof(struct xran_prb_map); + psIoCtrl->sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nNumberOfElements = 1; + psIoCtrl->sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->nOffsetInBytes = 0; + status = xran_bm_allocate_buffer(psBbuIo->nInstanceHandle[o_xu_id][i],psBbuIo->nBufPoolIndex[o_xu_id][m_nSectorIndex[i]][eInterfaceType], &ptr, &mb); if(status != XRAN_STATUS_SUCCESS) { std::cout << __LINE__ << " Failed at xran_bm_allocate_buffer , status " << status << std::endl; return (-1); } - m_sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->pData = (uint8_t *)ptr; - m_sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->pCtrl = (void *)mb; - void *sd_ptr; - void *sd_mb; - int elm_id; + psIoCtrl->sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->pData = (uint8_t *)ptr; + psIoCtrl->sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList.pBuffers->pCtrl = (void *)mb; struct xran_prb_map * p_rb_map = (struct xran_prb_map *)ptr; //memcpy(ptr, &startupConfiguration.PrbMap, sizeof(struct xran_prb_map)); - for (elm_id = 0; elm_id < XRAN_MAX_SECTIONS_PER_SYM; elm_id++){ - struct xran_prb_elm *pPrbElem = &p_rb_map->prbMap[elm_id]; - for(k = 0; k < XRAN_NUM_OF_SYMBOL_PER_SLOT; k++){ - status = xran_bm_allocate_buffer(m_nInstanceHandle[0][i], m_nBufPoolIndex[m_nSectorIndex[i]][XRANFTHTX_SEC_DESC_IN], &sd_ptr, &sd_mb); - if(XRAN_STATUS_SUCCESS != status){ - std::cout << __LINE__ << "SD Failed at xran_bm_allocate_buffer , status %d\n" << status << std::endl; - return (-1); - } - pPrbElem->p_sec_desc[k] = (struct xran_section_desc *)sd_ptr; - } - } } } } for(i = 0; inInstanceHandle[o_xu_id][i], + &psBbuIo->nBufPoolIndex[o_xu_id][m_nSectorIndex[i]][eInterfaceType], XRAN_N_FE_BUF_LEN * xran_max_antenna_nr * XRAN_NUM_OF_SYMBOL_PER_SLOT, - FPGA_TO_SW_PRACH_RX_BUFFER_LEN); + PRACH_PLAYBACK_BUFFER_BYTES); if(status != XRAN_STATUS_SUCCESS) { std::cout << __LINE__ << " Failed at xran_bm_init, status " << status << std::endl; return (-1); } for(j = 0; j < XRAN_N_FE_BUF_LEN; j++) { for(z = 0; z < xran_max_antenna_nr; z++) { - m_sFHPrachRxBbuIoBufCtrl[j][i][z].bValid = 0; - m_sFHPrachRxBbuIoBufCtrl[j][i][z].nSegGenerated = -1; - m_sFHPrachRxBbuIoBufCtrl[j][i][z].nSegToBeGen = -1; - m_sFHPrachRxBbuIoBufCtrl[j][i][z].nSegTransferred = 0; - m_sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList.nNumBuffers = xran_max_antenna_nr; - m_sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers = &m_sFHPrachRxBuffers[j][i][z][0]; + psIoCtrl->sFHPrachRxBbuIoBufCtrl[j][i][z].bValid = 0; + psIoCtrl->sFHPrachRxBbuIoBufCtrl[j][i][z].nSegGenerated = -1; + psIoCtrl->sFHPrachRxBbuIoBufCtrl[j][i][z].nSegToBeGen = -1; + psIoCtrl->sFHPrachRxBbuIoBufCtrl[j][i][z].nSegTransferred = 0; + psIoCtrl->sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList.nNumBuffers = xran_max_antenna_nr; + psIoCtrl->sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers = &psIoCtrl->sFHPrachRxBuffers[j][i][z][0]; for(k = 0; k< XRAN_NUM_OF_SYMBOL_PER_SLOT; k++) { - m_sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nElementLenInBytes = FPGA_TO_SW_PRACH_RX_BUFFER_LEN; - m_sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nNumberOfElements = 1; - m_sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nOffsetInBytes = 0; - status = xran_bm_allocate_buffer(m_nInstanceHandle[0][i], m_nBufPoolIndex[m_nSectorIndex[i]][eInterfaceType], &ptr, &mb); + psIoCtrl->sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nElementLenInBytes = PRACH_PLAYBACK_BUFFER_BYTES; + psIoCtrl->sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nNumberOfElements = 1; + psIoCtrl->sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].nOffsetInBytes = 0; + status = xran_bm_allocate_buffer(psBbuIo->nInstanceHandle[o_xu_id][i], psBbuIo->nBufPoolIndex[o_xu_id][m_nSectorIndex[i]][eInterfaceType], &ptr, &mb); if(status != XRAN_STATUS_SUCCESS) { std::cout << __LINE__ << " Failed at xran_bm_allocate_buffer, status " << status << std::endl; return (-1); } - m_sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].pData = (uint8_t *)ptr; - m_sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].pCtrl = (void *)mb; + psIoCtrl->sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].pData = (uint8_t *)ptr; + psIoCtrl->sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList.pBuffers[k].pCtrl = (void *)mb; if(ptr) { u32dptr = (uint32_t*)(ptr); - memset(u32dptr, 0x0, FPGA_TO_SW_PRACH_RX_BUFFER_LEN); + memset(u32dptr, 0x0, PRACH_PLAYBACK_BUFFER_BYTES); } } } @@ -484,6 +547,9 @@ public: m_xranInit.io_cfg.pkt_proc_core = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_IO, "pkt_proc_core"); m_xranInit.io_cfg.pkt_aux_core = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_IO, "pkt_aux_core"); m_xranInit.io_cfg.timing_core = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_IO, "timing_core"); + m_xranInit.io_cfg.dpdkMemorySize = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_IO, "dpdkMemorySize"); + + m_xranInit.xran_ports = 1; std::string bbdev_mode = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_IO, "bbdev_mode"); if(bbdev_mode == "sw") @@ -499,6 +565,7 @@ public: m_xranInit.dpdkBasebandFecMode = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_IO, "dpdkBasebandFecMode"); + m_dpdk_bbdev = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_IO, "dpdkBasebandDevice"); m_xranInit.dpdkBasebandDevice = (m_dpdk_bbdev == "") ? NULL : (char *)&m_dpdk_bbdev; @@ -520,8 +587,8 @@ public: m_ru_mac[i] = (uint8_t)tmp_mac[i]; m_xranInit.p_o_du_addr = (int8_t *)m_du_mac; m_xranInit.p_o_ru_addr = (int8_t *)m_ru_mac; - m_xranInit.cp_vlan_tag = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_IO, "cp_vlan_tag"); - m_xranInit.up_vlan_tag = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_IO, "up_vlan_tag"); + m_xranConf.cp_vlan_tag = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_IO, "cp_vlan_tag"); + m_xranConf.up_vlan_tag = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_IO, "up_vlan_tag"); /* eAxCID configurations */ int bitnum_cuport = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_EAXCID, "bit_cuPortId"); @@ -539,36 +606,36 @@ public: m_xranInit.eAxCId_conf.mask_ruPortId = get_eaxcid_mask(bitnum_ruport, m_xranInit.eAxCId_conf.bit_ruPortId); m_xranInit.totalBfWeights = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "totalBfWeights"); - - m_xranInit.Tadv_cp_dl = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "Tadv_cp_dl"); - m_xranInit.T2a_min_cp_dl = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T2a_min_cp_dl"); - m_xranInit.T2a_max_cp_dl = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T2a_max_cp_dl"); - m_xranInit.T2a_min_cp_ul = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T2a_min_cp_ul"); - m_xranInit.T2a_max_cp_ul = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T2a_max_cp_ul"); - m_xranInit.T2a_min_up = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T2a_min_up"); - m_xranInit.T2a_max_up = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T2a_max_up"); - m_xranInit.Ta3_min = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "Ta3_min"); - m_xranInit.Ta3_max = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "Ta3_max"); - m_xranInit.T1a_min_cp_dl = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T1a_min_cp_dl"); - m_xranInit.T1a_max_cp_dl = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T1a_max_cp_dl"); - m_xranInit.T1a_min_cp_ul = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T1a_min_cp_ul"); - m_xranInit.T1a_max_cp_ul = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T1a_max_cp_ul"); - m_xranInit.T1a_min_up = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T1a_min_up"); - m_xranInit.T1a_max_up = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T1a_max_up"); - m_xranInit.Ta4_min = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "Ta4_min"); - m_xranInit.Ta4_max = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "Ta4_max"); - - m_xranInit.enableCP = 1; - m_xranInit.prachEnable = 1; - m_xranInit.debugStop = 0; - m_xranInit.debugStopCount = 0; - m_xranInit.DynamicSectionEna= 0; - - m_xranInit.filePrefix = "wls"; + m_xranInit.filePrefix = (char *)"wls"; m_bSub6 = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "sub6"); memset(&m_xranConf, 0, sizeof(struct xran_fh_config)); + + m_xranConf.Tadv_cp_dl = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "Tadv_cp_dl"); + m_xranConf.T2a_min_cp_dl = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T2a_min_cp_dl"); + m_xranConf.T2a_max_cp_dl = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T2a_max_cp_dl"); + m_xranConf.T2a_min_cp_ul = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T2a_min_cp_ul"); + m_xranConf.T2a_max_cp_ul = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T2a_max_cp_ul"); + m_xranConf.T2a_min_up = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T2a_min_up"); + m_xranConf.T2a_max_up = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T2a_max_up"); + m_xranConf.Ta3_min = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "Ta3_min"); + m_xranConf.Ta3_max = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "Ta3_max"); + m_xranConf.T1a_min_cp_dl = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T1a_min_cp_dl"); + m_xranConf.T1a_max_cp_dl = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T1a_max_cp_dl"); + m_xranConf.T1a_min_cp_ul = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T1a_min_cp_ul"); + m_xranConf.T1a_max_cp_ul = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T1a_max_cp_ul"); + m_xranConf.T1a_min_up = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T1a_min_up"); + m_xranConf.T1a_max_up = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "T1a_max_up"); + m_xranConf.Ta4_min = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "Ta4_min"); + m_xranConf.Ta4_max = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "Ta4_max"); + + m_xranConf.enableCP = 1; + m_xranConf.prachEnable = 1; + m_xranConf.debugStop = 0; + m_xranConf.debugStopCount = 0; + m_xranConf.DynamicSectionEna= 0; + tmpstr = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "duplex"); if(tmpstr == "FDD") { m_xranConf.frame_conf.nFrameDuplexType = 0; @@ -585,7 +652,7 @@ public: std::stringstream slotcfgname; slotcfgname << "slot" << i; std::vector slotcfg = get_globalcfg_array(slotcfg_key, slotcfgname.str()); - for(int j=0; j < slotcfg.size(); j++) { + for(int j=0; j < (int)slotcfg.size(); j++) { m_xranConf.frame_conf.sSlotConfig[i].nSymbolType[j] = slotcfg[j]; } m_xranConf.frame_conf.sSlotConfig[i].reserved[0] = 0; @@ -623,6 +690,7 @@ public: m_xranConf.nDLRBs = get_num_rbs(get_numerology(), temp, m_bSub6); temp = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "chbw_ul"); m_xranConf.nULRBs = get_num_rbs(get_numerology(), temp, m_bSub6); + m_xranConf.dpdk_port = 0; m_xranConf.nAntElmTRx = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "ant_elm_trx"); m_xranConf.nDLFftSize = get_globalcfg(XRAN_UT_KEY_GLOBALCFG_RU, "fft_size"); @@ -706,6 +774,8 @@ public: xran_init(0, NULL, &m_xranInit, &argv[0], &m_xranhandle); + + for(i = 0; i < XRAN_MAX_SECTOR_NR; i++) m_nSectorIndex[i] = i; @@ -713,7 +783,7 @@ public: m_nFpgaToSW_FTH_RxBufferLen = 13168; /* 273*12*4 + 64*/ m_nSW_ToFpga_FTH_TxBufferLen = 13168; /* 273*12*4 + 64*/ - if(init_memory() < 0) { + if(init_memory(0) < 0) { std::cout << "Fatal Error on Initialization !!!" << std::endl; std::cout << "INIT FAILED" << std::endl; return (-1); @@ -734,10 +804,10 @@ public: std::cout << "ALREADY CLOSED" << std::endl; } - int Init(struct xran_fh_config *pCfg = nullptr) + int Init(uint32_t o_xu_id, struct xran_fh_config *pCfg = nullptr) { xran_status_t status; - int32_t nSectorNum; + uint32_t nSectorNum; int32_t i, j, k, z; void *ptr; void *mb; @@ -745,11 +815,14 @@ public: uint16_t *u16dptr; uint8_t *u8dptr; SWXRANInterfaceTypeEnum eInterfaceType; - int32_t cc_id, ant_id, sym_id, tti; + uint32_t cc_id, ant_id, sym_id, tti; int32_t flowId; char *pos = NULL; struct xran_prb_map *pRbMap = NULL; + struct xran_prb_map tmppRbMap; + struct bbu_xran_io_if *psBbuIo = (struct bbu_xran_io_if*)&m_gsXranIoIf; + struct xran_io_shared_ctrl *psIoCtrl = (struct xran_io_shared_ctrl *)&psBbuIo->ioCtrl[o_xu_id]; uint32_t xran_max_antenna_nr = RTE_MAX(get_num_eaxc(), get_num_eaxc_ul()); uint32_t xran_max_ant_array_elm_nr = RTE_MAX(get_num_antelmtrx(), xran_max_antenna_nr); @@ -760,9 +833,12 @@ public: memcpy(&m_xranConf, pCfg, sizeof(struct xran_fh_config)); /* Init timer context */ - xran_lib_ota_tti = 0; - xran_lib_ota_sym = 0; - xran_lib_ota_sym_idx = 0; + for (i=0; ipData; + pRbMap = (struct xran_prb_map *)psIoCtrl->sFrontHaulTxPrbMapBbuIoBufCtrl[tti][cc_id][ant_id].sBufferList.pBuffers->pData; if(pRbMap) { pRbMap->dir = XRAN_DIR_DL; pRbMap->xran_port = 0; @@ -829,12 +905,12 @@ public: int iPrb; char *dl_bfw_pos = ((char*)p_tx_dl_bfw_buffer[flowId]) + tx_dl_bfw_buffer_position[flowId]; struct xran_prb_elm* p_prbMap = NULL; - int num_antelm; + // int num_antelm; pRbMap->prbMap[0].BeamFormingType = XRAN_BEAM_WEIGHT; pRbMap->prbMap[0].bf_weight_update = 1; - num_antelm = get_num_antelmtrx(); + // num_antelm = get_num_antelmtrx(); #if 0 /* populate beam weights to C-plane for each elm */ pRbMap->bf_weight.nAntElmTRx = num_antelm; @@ -842,18 +918,110 @@ public: p_prbMap = &pRbMap->prbMap[idxElm]; for (iPrb = p_prbMap->nRBStart; iPrb < (p_prbMap->nRBStart + p_prbMap->nRBSize); iPrb++) { /* copy BF W IQs for 1 PRB of */ - rte_memcpy(&pRbMap->bf_weight.weight[iPrb][0], (dl_bfw_pos + (iPrb * num_antelm)*4), num_antelm*4); + memcpy(&pRbMap->bf_weight.weight[iPrb][0], (dl_bfw_pos + (iPrb * num_antelm)*4), num_antelm*4); } } #endif } /* else if(get_rucategory() == XRAN_CATEGORY_B) */ + memcpy(&tmppRbMap, pRbMap, sizeof(struct xran_prb_map)); + xran_init_PrbMap_from_cfg(&tmppRbMap, pRbMap, m_xranInit.mtu); } /* if(pRbMap) */ else { std::cout << "DL pRbMap ==NULL" << std::endl; } + if(get_rucategory() == XRAN_CATEGORY_B){ + pRbMap = (struct xran_prb_map *)psIoCtrl->sFHCpRxPrbMapBbuIoBufCtrl[tti][cc_id][ant_id].sBufferList.pBuffers->pData; + if(pRbMap) { + pRbMap->dir = XRAN_DIR_DL; + pRbMap->xran_port = 0; + pRbMap->band_id = 0; + pRbMap->cc_id = cc_id; + pRbMap->ru_port_id = ant_id; + pRbMap->tti_id = tti; + pRbMap->start_sym_id = 0; + + pRbMap->nPrbElm = 1; + pRbMap->prbMap[0].nRBStart = 0; + pRbMap->prbMap[0].nRBSize = get_num_dlrbs(); + pRbMap->prbMap[0].nStartSymb = 0; + pRbMap->prbMap[0].numSymb = 14; + pRbMap->prbMap[0].nBeamIndex = 0; + pRbMap->prbMap[0].compMethod = XRAN_COMPMETHOD_NONE; + uint32_t idxElm; + int iPrb; + char *dl_bfw_pos = ((char*)p_tx_dl_bfw_buffer[flowId]) + tx_dl_bfw_buffer_position[flowId]; + struct xran_prb_elm* p_prbMap = NULL; + int num_antelm; + + pRbMap->prbMap[0].BeamFormingType = XRAN_BEAM_WEIGHT; + pRbMap->prbMap[0].bf_weight_update = 1; + + num_antelm = get_num_antelmtrx(); +#if 1 + /* populate beam weights to C-plane for each elm */ + // pRbMap->bf_weight.nAntElmTRx = num_antelm; + for(idxElm = 0; idxElm < pRbMap->nPrbElm; idxElm++){ + p_prbMap = &pRbMap->prbMap[idxElm]; + for (iPrb = p_prbMap->nRBStart; iPrb < (p_prbMap->nRBStart + p_prbMap->nRBSize); iPrb++) { + /* copy BF W IQs for 1 PRB of */ + p_prbMap->bf_weight.nAntElmTRx = num_antelm; + // memcpy(&p_prbMap->bf_weight.p_ext_section[iPrb][0], (dl_bfw_pos + (iPrb * num_antelm)*4), num_antelm*4); + } + } +#endif + } /* if(pRbMap) */ + else { + std::cout << "Cp DL pRbMap ==NULL" << std::endl; + } + + pRbMap = (struct xran_prb_map *)psIoCtrl->sFHCpTxPrbMapBbuIoBufCtrl[tti][cc_id][ant_id].sBufferList.pBuffers->pData; + if(pRbMap) { + pRbMap->dir = XRAN_DIR_DL; + pRbMap->xran_port = 0; + pRbMap->band_id = 0; + pRbMap->cc_id = cc_id; + pRbMap->ru_port_id = ant_id; + pRbMap->tti_id = tti; + pRbMap->start_sym_id = 0; + + pRbMap->nPrbElm = 1; + pRbMap->prbMap[0].nRBStart = 0; + pRbMap->prbMap[0].nRBSize = get_num_dlrbs(); + pRbMap->prbMap[0].nStartSymb = 0; + pRbMap->prbMap[0].numSymb = 14; + pRbMap->prbMap[0].nBeamIndex = 0; + pRbMap->prbMap[0].compMethod = XRAN_COMPMETHOD_NONE; + int idxElm; + int iPrb; + char *dl_bfw_pos = ((char*)p_tx_dl_bfw_buffer[flowId]) + tx_dl_bfw_buffer_position[flowId]; + struct xran_prb_elm* p_prbMap = NULL; + // int num_antelm; + + pRbMap->prbMap[0].BeamFormingType = XRAN_BEAM_WEIGHT; + pRbMap->prbMap[0].bf_weight_update = 1; + + // num_antelm = get_num_antelmtrx(); +#if 0 + /* populate beam weights to C-plane for each elm */ + pRbMap->bf_weight.nAntElmTRx = num_antelm; + for(idxElm = 0; idxElm < pRbMap->nPrbElm; idxElm++){ + p_prbMap = &pRbMap->prbMap[idxElm]; + for (iPrb = p_prbMap->nRBStart; iPrb < (p_prbMap->nRBStart + p_prbMap->nRBSize); iPrb++) { + /* copy BF W IQs for 1 PRB of */ + memcpy(&pRbMap->bf_weight.weight[iPrb][0], (dl_bfw_pos + (iPrb * num_antelm)*4), num_antelm*4); + } + } +#endif + } /* if(pRbMap) */ + else { + std::cout << "Cp UL pRbMap ==NULL" << std::endl; + } + } + + /* C-plane UL */ - pRbMap = (struct xran_prb_map *)m_sFrontHaulRxPrbMapBbuIoBufCtrl[tti][cc_id][ant_id].sBufferList.pBuffers->pData; + pRbMap = (struct xran_prb_map *)psIoCtrl->sFrontHaulRxPrbMapBbuIoBufCtrl[tti][cc_id][ant_id].sBufferList.pBuffers->pData; if(pRbMap) { pRbMap->dir = XRAN_DIR_UL; pRbMap->xran_port = 0; @@ -882,12 +1050,12 @@ public: int iPrb; char *ul_bfw_pos = ((char*)p_tx_ul_bfw_buffer[flowId]) + tx_ul_bfw_buffer_position[flowId]; struct xran_prb_elm* p_prbMap = NULL; - int num_antelm; + // int num_antelm; pRbMap->prbMap[0].BeamFormingType = XRAN_BEAM_WEIGHT; pRbMap->prbMap[0].bf_weight_update = 1; - num_antelm = get_num_antelmtrx(); + // num_antelm = get_num_antelmtrx(); #if 0 /* populate beam weights to C-plane for each elm */ pRbMap->bf_weight.nAntElmTRx = num_antelm; @@ -895,12 +1063,13 @@ public: p_prbMap = &pRbMap->prbMap[idxElm]; for (iPrb = p_prbMap->nRBStart; iPrb < (p_prbMap->nRBStart + p_prbMap->nRBSize); iPrb++){ /* copy BF W IQs for 1 PRB of */ - rte_memcpy(&pRbMap->bf_weight.weight[iPrb][0], (ul_bfw_pos + (iPrb*num_antelm)*4), num_antelm*4); + memcpy(&pRbMap->bf_weight.weight[iPrb][0], (ul_bfw_pos + (iPrb*num_antelm)*4), num_antelm*4); } } #endif } /* else if(get_rucategory() == XRAN_CATEGORY_B) */ - + memcpy(&tmppRbMap, pRbMap, sizeof(struct xran_prb_map)); + xran_init_PrbMap_from_cfg(&tmppRbMap, pRbMap, m_xranInit.mtu); } /* if(pRbMap) */ else { std::cout << "UL: pRbMap ==NULL" << std::endl; @@ -917,15 +1086,15 @@ public: int i; if(get_rucategory() == XRAN_CATEGORY_B) { - for(i = 0; i < MAX_ANT_CARRIER_SUPPORTED && i < (uint32_t)(get_num_cc() * get_num_eaxc()); i++) { + for(i = 0; i < MAX_ANT_CARRIER_SUPPORTED && i < (get_num_cc() * get_num_eaxc()); i++) { if(p_tx_dl_bfw_buffer[i]) { free(p_tx_dl_bfw_buffer[i]); - p_tx_dl_bfw_buffer[i] == NULL; + p_tx_dl_bfw_buffer[i] = NULL; } if(p_tx_ul_bfw_buffer[i]) { free(p_tx_ul_bfw_buffer[i]); - p_tx_ul_bfw_buffer[i] == NULL; + p_tx_ul_bfw_buffer[i] = NULL; } } } @@ -934,13 +1103,16 @@ public: } - 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, void *fh_srs_callback) + void Open(uint32_t o_xu_id, xran_ethdi_mbuf_send_fn send_cp, xran_ethdi_mbuf_send_fn send_up, + void *fh_rx_callback, void *fh_bfw_callback, void *fh_rx_prach_callback, void *fh_srs_callback) { struct xran_fh_config *pXranConf; int32_t nSectorNum; int i, j, k, z; + struct bbu_xran_io_if *psBbuIo = (struct bbu_xran_io_if*)&m_gsXranIoIf; + struct xran_io_shared_ctrl *psIoCtrl = (struct xran_io_shared_ctrl *)&psBbuIo->ioCtrl[o_xu_id]; + uint32_t xran_max_antenna_nr = RTE_MAX(get_num_eaxc(), get_num_eaxc_ul()); uint32_t xran_max_ant_array_elm_nr = RTE_MAX(get_num_antelmtrx(), xran_max_antenna_nr); @@ -949,7 +1121,12 @@ public: struct xran_buffer_list *pFthRxBuffer[XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_N_FE_BUF_LEN]; struct xran_buffer_list *pFthRxPrbMapBuffer[XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_N_FE_BUF_LEN]; struct xran_buffer_list *pFthRxRachBuffer[XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_N_FE_BUF_LEN]; + struct xran_buffer_list *pFthRxRachBufferDecomp[XRAN_MAX_SECTOR_NR][XRAN_MAX_ANTENNA_NR][XRAN_N_FE_BUF_LEN]; struct xran_buffer_list *pFthRxSrsBuffer[XRAN_MAX_SECTOR_NR][XRAN_MAX_ANT_ARRAY_ELM_NR][XRAN_N_FE_BUF_LEN]; + struct xran_buffer_list *pFthRxSrsPrbMapBuffer[XRAN_MAX_SECTOR_NR][XRAN_MAX_ANT_ARRAY_ELM_NR][XRAN_N_FE_BUF_LEN]; + + struct xran_buffer_list *pFthRxCpPrbMapBuffer[XRAN_MAX_SECTOR_NR][XRAN_MAX_ANT_ARRAY_ELM_NR][XRAN_N_FE_BUF_LEN]; + struct xran_buffer_list *pFthTxCpPrbMapBuffer[XRAN_MAX_SECTOR_NR][XRAN_MAX_ANT_ARRAY_ELM_NR][XRAN_N_FE_BUF_LEN]; #if 0 xran_reg_physide_cb(xranHandle, physide_dl_tti_call_back, NULL, 10, XRAN_CB_TTI); @@ -958,61 +1135,69 @@ public: #endif nSectorNum = get_num_cc(); - for(i=0; isFrontHaulTxBbuIoBufCtrl[j][i][z].sBufferList); + pFthTxPrbMapBuffer[i][z][j] = &(psIoCtrl->sFrontHaulTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList); + pFthRxBuffer[i][z][j] = &(psIoCtrl->sFrontHaulRxBbuIoBufCtrl[j][i][z].sBufferList); + pFthRxPrbMapBuffer[i][z][j] = &(psIoCtrl->sFrontHaulRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList); + pFthRxRachBuffer[i][z][j] = &(psIoCtrl->sFHPrachRxBbuIoBufCtrl[j][i][z].sBufferList); + pFthRxRachBufferDecomp[i][z][j] = &(psIoCtrl->sFHPrachRxBbuIoBufCtrlDecomp[j][i][z].sBufferList); + pFthRxCpPrbMapBuffer[i][z][j] = &(psIoCtrl->sFHCpRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList); + pFthTxCpPrbMapBuffer[i][z][j] = &(psIoCtrl->sFHCpTxPrbMapBbuIoBufCtrl[j][i][z].sBufferList); } - for(z = 0; z < xran_max_ant_array_elm_nr && xran_max_ant_array_elm_nr; z++){ - pFthRxSrsBuffer[i][z][j] = &(m_sFHSrsRxBbuIoBufCtrl[j][i][z].sBufferList); + for(z = 0; z < XRAN_MAX_ANT_ARRAY_ELM_NR /*xran_max_ant_array_elm_nr && xran_max_ant_array_elm_nr*/; z++) { + pFthRxSrsBuffer[i][z][j] = &(psIoCtrl->sFHSrsRxBbuIoBufCtrl[j][i][z].sBufferList); + pFthRxSrsPrbMapBuffer[i][z][j] = &(psIoCtrl->sFHSrsRxPrbMapBbuIoBufCtrl[j][i][z].sBufferList); } } } - if(m_nInstanceHandle[0] != NULL) { + if(psBbuIo->nInstanceHandle[o_xu_id] != NULL) { for(i = 0; inInstanceHandle[o_xu_id][i], pFthTxBuffer[i], pFthTxPrbMapBuffer[i], pFthRxBuffer[i], pFthRxPrbMapBuffer[i], (void (*)(void *, xran_status_t))fh_rx_callback, &pFthRxBuffer[i][0]); - xran_5g_prach_req(m_nInstanceHandle[0][i], pFthRxRachBuffer[i], - (void (*)(void *, xran_status_t))fh_rx_prach_callback, &pFthRxRachBuffer[i][0]); + xran_5g_bfw_config(psBbuIo->nInstanceHandle[o_xu_id][i], + pFthRxCpPrbMapBuffer[i], + pFthTxCpPrbMapBuffer[i], + (void (*)(void *, xran_status_t))fh_bfw_callback, &pFthRxCpPrbMapBuffer[i][0]); + + xran_5g_prach_req(psBbuIo->nInstanceHandle[o_xu_id][i], pFthRxRachBuffer[i],pFthRxRachBufferDecomp[i], + (void (*)(void *, xran_status_t))fh_rx_prach_callback, &pFthRxRachBuffer[i]); } /* add SRS callback here */ for (i = 0; inInstanceHandle[o_xu_id][i], pFthRxSrsBuffer[i], pFthRxSrsPrbMapBuffer[i], + (void (*)(void *, xran_status_t))fh_srs_callback, pFthRxSrsBuffer[i]); } } - - xran_register_cb_mbuf2ring(send_cp, send_up); - xran_open(m_xranhandle, &m_xranConf); } @@ -1046,14 +1231,19 @@ public: void update_symbol_index() { - xran_lib_ota_sym_idx++; - if((xran_lib_ota_sym_idx % N_SYM_PER_SLOT) == 0) { + int i; + for (i=0; i= N_SYM_PER_SLOT) + xran_lib_ota_sym[i] = 0; + } - xran_lib_ota_sym++; - if(xran_lib_ota_sym >= N_SYM_PER_SLOT) - xran_lib_ota_sym = 0; } int apply_cpenable(bool flag) @@ -1067,11 +1257,11 @@ public: return (-1); if(flag == true) { - m_xranInit.enableCP = 1; + m_xranConf.enableCP = 1; pCtx->enableCP = 1; } else { - m_xranInit.enableCP = 0; + m_xranConf.enableCP = 0; pCtx->enableCP = 0; } @@ -1092,7 +1282,7 @@ public: slotcfgname << "slot" << i; std::vector slotcfg = get_globalcfg_array(cfgname, slotcfgname.str()); - for(j=0; j < slotcfg.size(); j++) + for(j=0; j < (int)slotcfg.size(); j++) pCfg->sSlotConfig[i].nSymbolType[j] = slotcfg[j]; pCfg->sSlotConfig[i].reserved[0] = 0; pCfg->sSlotConfig[i].reserved[1] = 0; } @@ -1142,9 +1332,9 @@ public: } void *get_xranhandle() { return(m_xranhandle); } - void *get_timer_ctx() { return((void *)&m_timer_ctx[0]); } + void *get_timer_ctx() { return((void *)xran_dev_get_ctx()); } - int get_symbol_index() { return (xran_lib_ota_sym); } + int get_symbol_index() { return (xran_lib_ota_sym[0]); } bool is_running() { return((xran_get_if_state() == XRAN_RUNNING)?true:false); } @@ -1157,11 +1347,11 @@ public: int get_num_eaxc_ul() { return(m_xranConf.neAxcUl); } int get_num_dlrbs() { return(m_xranConf.nDLRBs); } int get_num_ulrbs() { return(m_xranConf.nULRBs); } - int get_num_antelmtrx() { return(m_xranConf.nAntElmTRx); } + uint32_t get_num_antelmtrx() { return(m_xranConf.nAntElmTRx); } - bool is_cpenable() { return(m_xranInit.enableCP); }; - bool is_prachenable() { return(m_xranInit.prachEnable); }; - bool is_dynamicsection() { return(m_xranInit.DynamicSectionEna?true:false); } + bool is_cpenable() { return(m_xranConf.enableCP); }; + bool is_prachenable() { return(m_xranConf.prachEnable); }; + bool is_dynamicsection() { return(m_xranConf.DynamicSectionEna?true:false); } void get_cfg_prach(struct xran_prach_config *pCfg) {