From: lal.harshita Date: Fri, 18 Dec 2020 12:35:33 +0000 (+0530) Subject: EGTP receiver thread creation X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=79b8d410dc34e5624583b9ad935e65350dd3f62a;p=o-du%2Fl2.git EGTP receiver thread creation Change-Id: If106ebff4389e3c8ea87712319ede27eef2c6900 Signed-off-by: lal.harshita --- diff --git a/src/5gnrmac/mac_msg_hdl.c b/src/5gnrmac/mac_msg_hdl.c index 9ff644bb1..aef583be6 100644 --- a/src/5gnrmac/mac_msg_hdl.c +++ b/src/5gnrmac/mac_msg_hdl.c @@ -415,61 +415,62 @@ uint8_t sendSchedRptToRlc(DlSchedInfo dlInfo, SlotIndInfo slotInfo) * * @details * - * Function : MacProcCellStartReq + * Function : MacProcCellStart * * Functionality: * Handles cell start reuqest from DU APP * * @params[in] Post structure pointer - * Cell Start Request info pointer + * Cell Id * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t MacProcCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) +uint8_t MacProcCellStart(Pst *pst, OduCellId *cellId) { DU_LOG("\nMAC : Handling cell start request"); - sendToLowerMac(START_REQUEST, 0, cellStartInfo); + gSlotCount = 0; + sendToLowerMac(START_REQUEST, 0, cellId); - MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellStartInfo, \ - sizeof(MacCellStartInfo)); + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, \ + sizeof(OduCellId)); return ROK; } /******************************************************************* * - * @brief Handles cell stop request from DU APP + * @brief Handles cell stop from DU APP * * @details * - * Function : MacProcCellStartReq + * Function : MacProcCellStop * * Functionality: - * Handles cell stop request from DU APP + * Handles cell stop from DU APP * * @params[in] Post structure pointer - * Mac Cell stop information + * Cell Id * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t MacProcCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo) +uint8_t MacProcCellStop(Pst *pst, OduCellId *cellId) { #ifdef INTEL_FAPI uint16_t cellIdx; SlotIndInfo slotInfo; DU_LOG("\nMAC : Sending cell stop request to Lower Mac"); - GET_CELL_IDX(cellStopInfo->cellId, cellIdx); - slotInfo.cellId = cellStopInfo->cellId; + GET_CELL_IDX(cellId->cellId, cellIdx); + slotInfo.cellId = cellId->cellId; slotInfo.sfn = macCb.macCell[cellIdx]->currTime.sfn; slotInfo.slot = macCb.macCell[cellIdx]->currTime.slot; sendToLowerMac(FAPI_STOP_REQUEST, 0, &slotInfo); #endif - MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellStopInfo, \ - sizeof(MacCellStopInfo)); + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, \ + sizeof(OduCellId)); return ROK; } diff --git a/src/5gnrmac/mac_slot_ind.c b/src/5gnrmac/mac_slot_ind.c index 19f8f0e20..6bc961b89 100644 --- a/src/5gnrmac/mac_slot_ind.c +++ b/src/5gnrmac/mac_slot_ind.c @@ -240,50 +240,47 @@ int sendSlotIndMacToSch(SlotIndInfo *slotInd) /******************************************************************* * - * @brief Send slot indication to DU APP + * @brief Send cell up indication to DU APP * * @details * - * Function : sendSlotIndMacToDuApp + * Function : sendCellUpIndMacToDuApp * * Functionality: - * Send slot indication to DU APP + * Send cell up indication to DU APP * - * @params[in] Slot indication info + * @params[in] Cell Up indication info * @return ROK - success * RFAILED - failure * * ****************************************************************/ -int sendSlotIndMacToDuApp(SlotIndInfo *slotInd) +int sendCellUpIndMacToDuApp(uint16_t cellId) { Pst pst; uint16_t ret; - SlotIndInfo *slotInfo; + OduCellId *oduCellId; /* Allocate sharable memory */ - MAC_ALLOC_SHRABL_BUF(slotInfo, sizeof(SlotIndInfo)); - if(!slotInfo) + MAC_ALLOC_SHRABL_BUF(oduCellId, sizeof(OduCellId)); + if(!oduCellId) { - DU_LOG("\nMAC : Slot Indication memory allocation failed"); + DU_LOG("\nMAC : Memory allocation failed for cell up indication"); return RFAILED; } - - slotInfo->cellId = slotInd->cellId; - slotInfo->sfn = slotInd->sfn; - slotInfo->slot = slotInd->slot; + oduCellId->cellId = cellId; /* Fill Pst */ - FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_SLOT_IND); + FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_CELL_UP_IND); - ret = MacDuAppSlotInd(&pst, slotInfo); + ret = MacDuAppCellUpInd(&pst, oduCellId); if(ret != ROK) { - DU_LOG("\nMAC: Failed to send slot indication to DU APP"); - MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, slotInfo, sizeof(SlotIndInfo)); + DU_LOG("\nMAC: Failed to send cell up indication to DU APP"); + MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, oduCellId, sizeof(OduCellId)); } return ret; -} /* sendSlotIndMacToDuApp */ +} /* sendCellUpIndMacToDuApp */ /******************************************************************* * @@ -352,6 +349,7 @@ uint8_t fapiMacSlotInd(Pst *pst, SlotIndInfo *slotInd) #endif /*starting Task*/ ODU_START_TASK(&startTime, PID_MAC_TTI_IND); + gSlotCount++; /* When testing L2 with Intel-L1, any changes specific to * timer mode testing must be guarded under INTEL_TIMER_MODE*/ @@ -375,12 +373,15 @@ uint8_t fapiMacSlotInd(Pst *pst, SlotIndInfo *slotInd) #endif /* send slot indication to du app */ - ret = sendSlotIndMacToDuApp(slotInd); - if(ret != ROK) + if(gSlotCount == 1) { - DU_LOG("\nMAC :Sending of slot ind msg from MAC to DU APP failed"); - MAC_FREE_SHRABL_BUF(pst->region, pst->pool, slotInd, sizeof(SlotIndInfo)); - return ret; + ret = sendCellUpIndMacToDuApp(slotInd->cellId); + if(ret != ROK) + { + DU_LOG("\nMAC :Sending of slot ind msg from MAC to DU APP failed"); + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, slotInd, sizeof(SlotIndInfo)); + return ret; + } } /*stoping Task*/ diff --git a/src/5gnrmac/mac_stop_ind.c b/src/5gnrmac/mac_stop_ind.c index a37bb9c16..c1adb7d8f 100644 --- a/src/5gnrmac/mac_stop_ind.c +++ b/src/5gnrmac/mac_stop_ind.c @@ -47,25 +47,25 @@ uint8_t sendStopIndToDuApp(uint16_t cellId) { Pst pst; uint8_t ret = ROK; - MacCellStopInfo *cellStopInd; + OduCellId *oduCellId; /* Allocate sharable memory */ - MAC_ALLOC_SHRABL_BUF(cellStopInd, sizeof(MacCellStopInfo)); - if(!cellStopInd) + MAC_ALLOC_SHRABL_BUF(oduCellId, sizeof(OduCellId)); + if(!oduCellId) { DU_LOG("\nMAC : Stop Indication memory allocation failed"); return RFAILED; } - cellStopInd->cellId = cellId; + oduCellId->cellId = cellId; /* Fill Pst */ FILL_PST_MAC_TO_DUAPP(pst, EVENT_MAC_STOP_IND); - ret = MacDuAppStopInd(&pst, cellStopInd); + ret = MacDuAppStopInd(&pst, oduCellId); if(ret != ROK) { DU_LOG("\nMAC: Failed to send stop indication to DU APP"); - MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, cellStopInd, sizeof(MacCellStopInfo)); + MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, oduCellId, sizeof(OduCellId)); } return ROK; } diff --git a/src/5gnrmac/mac_upr_inf_api.c b/src/5gnrmac/mac_upr_inf_api.c index 6992add6c..6e6b962af 100644 --- a/src/5gnrmac/mac_upr_inf_api.c +++ b/src/5gnrmac/mac_upr_inf_api.c @@ -23,12 +23,12 @@ #include "rlc_mac_inf.h" #include "mac_upr_inf_api.h" -/* Funtion pointer options for slot indication */ -DuMacSlotInd packMacSlotIndOpts[] = +/* Funtion pointer options for cell up indication */ +DuMacCellUpInd packMacCellUpIndOpts[] = { - packMacSlotInd, - duHandleSlotInd, - packMacSlotInd + packMacCellUpInd, + duHandleCellUpInd, + packMacCellUpInd }; /* Funtion pointer options for stop indication */ DuMacStopInd packMacStopIndOpts[] = @@ -65,25 +65,25 @@ RlcMacSchedResultRptFunc rlcMacSchedResultRptOpts[] = /******************************************************************* * - * @brief Send slot indication to MAC + * @brief Send cell up indication to DU APP * * @details * - * Function : MacDuAppSlotInd + * Function : MacDuAppCellUpInd * * Functionality: * Select appropriate function using selector value and - * send to MAC + * send cell up indication to DU APP * * @params[in] Post structure pointer - * Slot info pointer + * Cell UP info * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t MacDuAppSlotInd(Pst *pst, SlotIndInfo *slotInfo) +uint8_t MacDuAppCellUpInd(Pst *pst, OduCellId *cellId) { - return (*packMacSlotIndOpts[pst->selector])(pst, slotInfo); + return (*packMacCellUpIndOpts[pst->selector])(pst, cellId); } /******************************************************************* @@ -102,9 +102,9 @@ uint8_t MacDuAppSlotInd(Pst *pst, SlotIndInfo *slotInfo) * RFAILED - failure * * ****************************************************************/ -uint8_t MacDuAppStopInd(Pst *pst, MacCellStopInfo *cellStopId) +uint8_t MacDuAppStopInd(Pst *pst, OduCellId *cellId) { - return (*packMacStopIndOpts[pst->selector])(pst, cellStopId); + return (*packMacStopIndOpts[pst->selector])(pst, cellId); } /******************************************************************* diff --git a/src/5gnrmac/mac_upr_inf_api.h b/src/5gnrmac/mac_upr_inf_api.h index bc7216c2f..1bcd9b920 100644 --- a/src/5gnrmac/mac_upr_inf_api.h +++ b/src/5gnrmac/mac_upr_inf_api.h @@ -19,8 +19,8 @@ /* This file contains the definitions for Upper Interface APIs that are * invoked from MAC */ -uint8_t MacDuAppSlotInd(Pst *pst, SlotIndInfo *slotInfo); -uint8_t MacDuAppStopInd(Pst *pst, MacCellStopInfo *cellStopId); +uint8_t MacDuAppCellUpInd(Pst *pst, OduCellId *cellId); +uint8_t MacDuAppStopInd(Pst *pst, OduCellId *cellId); uint8_t MacDuAppUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo); uint8_t MacSendUlDataToRlc(Pst *pst, RlcData *ulData); uint8_t MacSendSchedResultRptToRlc(Pst *pst, RlcSchedResultRpt *schedRpt); diff --git a/src/5gnrmac/rg_ex_ms.c b/src/5gnrmac/rg_ex_ms.c index a4c422c98..ec2c85bee 100755 --- a/src/5gnrmac/rg_ex_ms.c +++ b/src/5gnrmac/rg_ex_ms.c @@ -107,13 +107,13 @@ Buffer *mBuf /* message buffer */ /* Process MAC cell config */ unpackDuMacCellCfg(MacProcCellCfgReq, pst, mBuf); break; - case EVENT_MAC_CELL_START_REQ: + case EVENT_MAC_CELL_START: /* Process MAC cell start request */ - unpackMacCellStartReq(MacProcCellStartReq, pst, mBuf); + unpackMacCellStart(MacProcCellStart, pst, mBuf); break; - case EVENT_MAC_CELL_STOP_REQ: + case EVENT_MAC_CELL_STOP: /* Process MAC cell stop request */ - unpackMacCellStopReq(MacProcCellStopReq, pst, mBuf); + unpackMacCellStop(MacProcCellStop, pst, mBuf); break; case EVENT_MAC_DL_CCCH_IND: /* Process DL CCCH Ind */ diff --git a/src/cm/common_def.h b/src/cm/common_def.h index 0bd7491ab..5f18a9725 100644 --- a/src/cm/common_def.h +++ b/src/cm/common_def.h @@ -159,6 +159,21 @@ _bitPos = __builtin_ctz(_in); \ } +typedef enum +{ + UE_CFG_INACTIVE, + UE_CREATE_COMPLETE, + UE_RECFG_COMPLETE +}UeCfgState; + +typedef enum +{ + CONFIG_UNKNOWN, + CONFIG_ADD, + CONFIG_MOD, + CONFIG_DEL +}ConfigType; + typedef struct slotIndInfo { uint16_t cellId; @@ -172,20 +187,12 @@ typedef struct PlmnIdentity uint8_t mnc[3]; }Plmn; -typedef enum +typedef struct oduCellId { - UE_CFG_INACTIVE, - UE_CREATE_COMPLETE, - UE_RECFG_COMPLETE -}UeCfgState; + uint16_t cellId; +}OduCellId; -typedef enum -{ - CONFIG_UNKNOWN, - CONFIG_ADD, - CONFIG_MOD, - CONFIG_DEL -}ConfigType; +uint64_t gSlotCount; void freqDomRscAllocType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain); void oduCpyFixBufToMsg(uint8_t *fixBuf, Buffer *mBuf, uint16_t len); diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index 41f725cdb..e1ef58f52 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -181,18 +181,18 @@ uint8_t unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf) * * @details * - * Function : packMacCellStartReq + * Function : packMacCellStart * * Functionality: * Packs and Sends Cell Start Request to MAC * * @params[in] Post structure pointer - * MacCellStartInfo pointer + * Cell Id * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) +uint8_t packMacCellStart(Pst *pst, OduCellId *cellId) { Buffer *mBuf = NULLP; @@ -211,7 +211,7 @@ uint8_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) } /* pack the address of the structure */ - CMCHKPK(oduPackPointer,(PTR)cellStartInfo, mBuf); + CMCHKPK(oduPackPointer,(PTR)cellId, mBuf); } return ODU_POST_TASK(pst,mBuf); @@ -223,28 +223,28 @@ uint8_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo) * * @details * - * Function : unpackMaCellStartReq + * Function : unpackMaCellStart * * Functionality: * Unpacks MAC Cell Start Request from DU APP * * @params[in] Function pointer of cell start request handler * Post structure pointer - * Cell Start Request Info Pointer + * Message Buffer * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf) +uint8_t unpackMacCellStart(DuMacCellStart func, Pst *pst, Buffer *mBuf) { - MacCellStartInfo *cellStartInfo; + OduCellId *cellId; if(pst->selector == ODU_SELECTOR_LWLC) { /* unpack the address of the structure */ - CMCHKUNPK(oduUnpackPointer, (PTR *)&cellStartInfo, mBuf); + CMCHKUNPK(oduUnpackPointer, (PTR *)&cellId, mBuf); ODU_PUT_MSG_BUF(mBuf); - return (*func)(pst, cellStartInfo); + return (*func)(pst, cellId); } else { @@ -260,18 +260,18 @@ uint8_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf) * * @details * - * Function : packMacCellStopReq + * Function : packMacCellStop * * Functionality: * Packs and Send cell stop request to MAC * * @params[in] Post structure pointer - * Cell stop info structure + * Cell Id * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo) +uint8_t packMacCellStop(Pst *pst, OduCellId *cellId) { if(pst->selector == ODU_SELECTOR_LC) { @@ -289,7 +289,7 @@ uint8_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo) } /* pack the address of the structure */ - CMCHKPK(oduPackPointer,(PTR)cellStopInfo, mBuf); + CMCHKPK(oduPackPointer,(PTR)cellId, mBuf); return ODU_POST_TASK(pst,mBuf); } @@ -302,7 +302,7 @@ uint8_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo) * * @details * - * Function : unpackMaCellStopReq + * Function : unpackMaCellStop * * Functionality: * Unpacks cell stop request from DU APP @@ -314,16 +314,16 @@ uint8_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo) * RFAILED - failure * * ****************************************************************/ -uint8_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf) +uint8_t unpackMacCellStop(DuMacCellStop func, Pst *pst, Buffer *mBuf) { - MacCellStopInfo *cellStopInfo; - + OduCellId *cellId; + if(pst->selector == ODU_SELECTOR_LWLC) { /* unpack the address of the structure */ - CMCHKUNPK(oduUnpackPointer, (PTR *)&cellStopInfo, mBuf); + CMCHKUNPK(oduUnpackPointer, (PTR *)&cellId, mBuf); ODU_PUT_MSG_BUF(mBuf); - return (*func)(pst, cellStopInfo); + return (*func)(pst, cellId); } else { @@ -335,63 +335,60 @@ uint8_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf) /******************************************************************* * - * @brief Packs and Sends slot ind from MAC to DUAPP + * @brief Packs and Sends cell up ind from MAC to DUAPP * * @details * - * Function : packMacSlotInd + * Function : packMacCellUpInd * * Functionality: - * Packs and Sends slot ind from MAC to DUAPP + * Packs and Sends cell up ind from MAC to DUAPP * * @params[in] Post structure pointer - * Slot Info pointer + * Cell Id * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t packMacSlotInd(Pst *pst, SlotIndInfo *slotInfo ) +uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId) { Buffer *mBuf = NULLP; if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { - DU_LOG("\nDU APP : Memory allocation failed for packMacSlotInd"); + DU_LOG("\nDU APP : Memory allocation failed for packMacCellUpInd"); return RFAILED; } if(pst->selector == ODU_SELECTOR_LC) { - CMCHKPK(oduUnpackUInt16, slotInfo->cellId, mBuf); - CMCHKPK(oduUnpackUInt16, slotInfo->sfn, mBuf); - CMCHKPK(oduUnpackUInt16, slotInfo->slot, mBuf); - - CM_FREE_SHRABL_BUF(pst->region, pst->pool, slotInfo, sizeof(SlotIndInfo)); - slotInfo = NULL; + CMCHKPK(oduUnpackUInt16, cellId->cellId, mBuf); + CM_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, sizeof(OduCellId)); + cellId = NULL; } else if(pst->selector == ODU_SELECTOR_LWLC) { /* pack the address of the structure */ - CMCHKPK(oduPackPointer,(PTR)slotInfo, mBuf); + CMCHKPK(oduPackPointer,(PTR)cellId, mBuf); } else { ODU_PUT_MSG_BUF(mBuf); } - return ODU_POST_TASK(pst,mBuf); + return ODU_POST_TASK(pst, mBuf); } /******************************************************************* * - * @brief Unpacks slot indication from MAC + * @brief Unpacks cell up indication from MAC * * @details * - * Function : unpackMacSlotInd + * Function : unpackMacCellUpInd * * Functionality: - * Unpacks slot indication from MAC + * Unpacks cell up indication from MAC * * @params[in] Pointer to Handler * Post structure pointer @@ -400,28 +397,23 @@ uint8_t packMacSlotInd(Pst *pst, SlotIndInfo *slotInfo ) * RFAILED - failure * * ****************************************************************/ -uint8_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf) +uint8_t unpackMacCellUpInd(DuMacCellUpInd func, Pst *pst, Buffer *mBuf) { if(pst->selector == ODU_SELECTOR_LWLC) { - SlotIndInfo *slotInfo; + OduCellId *cellId; /* unpack the address of the structure */ - CMCHKUNPK(oduUnpackPointer, (PTR *)&slotInfo, mBuf); + CMCHKUNPK(oduUnpackPointer, (PTR *)&cellId, mBuf); ODU_PUT_MSG_BUF(mBuf); - return (*func)(pst, slotInfo); + return (*func)(pst, cellId); } else if(pst->selector == ODU_SELECTOR_LC) { - SlotIndInfo slotInfo; - - CMCHKUNPK(oduPackUInt16, &(slotInfo.slot), mBuf); - CMCHKUNPK(oduPackUInt16, &(slotInfo.sfn), mBuf); - CMCHKUNPK(oduPackUInt16, &(slotInfo.cellId), mBuf); - + OduCellId cellId; + CMCHKUNPK(oduPackUInt16, &cellId.cellId, mBuf); ODU_PUT_MSG_BUF(mBuf); - return (*func)(pst, &slotInfo); - + return (*func)(pst, &cellId); } else { @@ -448,7 +440,7 @@ uint8_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf) * RFAILED - failure * * ****************************************************************/ -uint8_t packMacStopInd(Pst *pst, MacCellStopInfo *cellStopId) +uint8_t packMacStopInd(Pst *pst, OduCellId *cellId) { Buffer *mBuf = NULLP; @@ -462,14 +454,14 @@ uint8_t packMacStopInd(Pst *pst, MacCellStopInfo *cellStopId) { /*pack the payload here*/ DU_LOG("\nDU APP : Packed CellId"); - CMCHKPK(oduUnpackUInt16, cellStopId->cellId, mBuf); - CM_FREE_SHRABL_BUF(pst->region, pst->pool, cellStopId, sizeof(MacCellStopInfo)); - cellStopId = NULL; + CMCHKPK(oduUnpackUInt16, cellId->cellId, mBuf); + CM_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, sizeof(OduCellId)); + cellId = NULL; } else if(pst->selector == ODU_SELECTOR_LWLC) { /* pack the address of the structure */ - CMCHKPK(oduPackPointer,(PTR)cellStopId, mBuf); + CMCHKPK(oduPackPointer,(PTR)cellId, mBuf); } else { @@ -501,19 +493,19 @@ uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf) { if(pst->selector == ODU_SELECTOR_LWLC) { - MacCellStopInfo *cellStopId; + OduCellId *cellId; /* unpack the address of the structure */ - CMCHKUNPK(oduUnpackPointer, (PTR *)&cellStopId, mBuf); + CMCHKUNPK(oduUnpackPointer, (PTR *)&cellId, mBuf); ODU_PUT_MSG_BUF(mBuf); - return (*func)(pst, cellStopId); + return (*func)(pst, cellId); } else if(pst->selector == ODU_SELECTOR_LC) { - MacCellStopInfo cellStopId; - CMCHKUNPK(oduPackUInt16, &(cellStopId.cellId), mBuf); + OduCellId cellId; + CMCHKUNPK(oduPackUInt16, &(cellId.cellId), mBuf); ODU_PUT_MSG_BUF(mBuf); - return (*func)(pst, &cellStopId); + return (*func)(pst, &cellId); } else diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index acc2f6496..beb026a24 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -60,9 +60,9 @@ /* Event IDs */ #define EVENT_MAC_CELL_CONFIG_REQ 200 #define EVENT_MAC_CELL_CONFIG_CFM 201 -#define EVENT_MAC_CELL_START_REQ 202 -#define EVENT_MAC_CELL_STOP_REQ 203 -#define EVENT_MAC_SLOT_IND 204 +#define EVENT_MAC_CELL_START 202 +#define EVENT_MAC_CELL_STOP 203 +#define EVENT_MAC_CELL_UP_IND 204 #define EVENT_MAC_STOP_IND 205 #define EVENT_MAC_UL_CCCH_IND 206 #define EVENT_MAC_DL_CCCH_IND 207 @@ -666,20 +666,10 @@ typedef struct macCellCfg typedef struct macCellCfgCfm { - uint16_t cellId; + uint16_t cellId; uint8_t rsp; }MacCellCfgCfm; -typedef struct macCellStartInfo -{ - uint16_t cellId; -}MacCellStartInfo; - -typedef struct macCellStopInfo -{ - uint16_t cellId; -}MacCellStopInfo; - typedef struct ulCcchInd { uint16_t cellId; @@ -1100,24 +1090,24 @@ typedef struct ueCfgRsp }MacUeCfgRsp; /* Functions for slot Ind from MAC to DU APP*/ -typedef uint8_t (*DuMacSlotInd) ARGS(( +typedef uint8_t (*DuMacCellUpInd) ARGS(( Pst *pst, - SlotIndInfo *slotInfo )); + OduCellId *cellId )); /* Functions for stop Ind from MAC to DU APP*/ typedef uint8_t (*DuMacStopInd) ARGS(( - Pst *pst, - MacCellStopInfo *cellId )); + Pst *pst, + OduCellId *cellId )); /* Functions for mac cell start req */ -typedef uint8_t (*DuMacCellStartReq) ARGS(( - Pst *pst, - MacCellStartInfo *cellStartInfo )); +typedef uint8_t (*DuMacCellStart) ARGS(( + Pst *pst, + OduCellId *cellId)); /* Functions for mac cell stop request */ -typedef uint8_t (*DuMacCellStopReq) ARGS(( - Pst *pst, - MacCellStopInfo *cellStopInfo )); +typedef uint8_t (*DuMacCellStop) ARGS(( + Pst *pst, + OduCellId *cellId )); /* Function pointers for packing macCellCfg Request and Confirm */ typedef uint8_t (*packMacCellCfgReq) ARGS(( @@ -1161,24 +1151,24 @@ typedef uint8_t (*DuMacUeReconfigReq) ARGS(( Pst *pst, MacUeCfg *ueCfg )); -uint8_t packMacSlotInd(Pst *pst, SlotIndInfo *slotInfo ); -uint8_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf); -uint8_t duHandleSlotInd(Pst *pst, SlotIndInfo *slotInfo); -uint8_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo); -uint8_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf); -uint8_t MacProcCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo); -uint8_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo); -uint8_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf); -uint8_t MacProcCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo); +uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId); +uint8_t unpackMacCellUpInd(DuMacCellUpInd func, Pst *pst, Buffer *mBuf); +uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId); +uint8_t packMacCellStart(Pst *pst, OduCellId *cellId); +uint8_t unpackMacCellStart(DuMacCellStart func, Pst *pst, Buffer *mBuf); +uint8_t MacProcCellStart(Pst *pst, OduCellId *cellId); +uint8_t packMacCellStop(Pst *pst, OduCellId *cellId); +uint8_t unpackMacCellStop(DuMacCellStop func, Pst *pst, Buffer *mBuf); +uint8_t MacProcCellStop(Pst *pst, OduCellId *cellId); uint8_t packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg); uint8_t unpackDuMacCellCfg(DuMacCellCfgReq func, Pst *pst, Buffer *mBuf); uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg); uint8_t packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm); uint8_t unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf); uint8_t duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm); -uint8_t packMacStopInd(Pst *pst, MacCellStopInfo *cellId); +uint8_t packMacStopInd(Pst *pst, OduCellId *cellId); uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf); -uint8_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellId); +uint8_t duHandleStopInd(Pst *pst, OduCellId *cellId); uint8_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo); uint8_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf); uint8_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo); diff --git a/src/cm/legtp.c b/src/cm/legtp.c index 5eb17e6b8..d4acd4a44 100644 --- a/src/cm/legtp.c +++ b/src/cm/legtp.c @@ -484,21 +484,21 @@ uint8_t unpackEgtpTnlMgmtCfm(EgtpTnlMgmtCfm func, Buffer *mBuf) /******************************************************************* * - * @brief Packs Slot indication and sends to EGTP + * @brief Packs Polling requesting and sends to EGTP * * @details * - * Function : packEgtpSlotInd + * Function : packEgtpStartPollingReq * * Functionality: - * Packs slot indication and sends tp EGTP + * Packs polling request and sends to EGTP * * @params[in] Post structure * @return ROK - success * RFAILED - failure * *******************************************************************/ -uint8_t packEgtpSlotInd(Pst *pst) +uint8_t packEgtpStartPollingReq(Pst *pst) { Buffer *mBuf; @@ -510,26 +510,8 @@ uint8_t packEgtpSlotInd(Pst *pst) ODU_POST_TASK(pst, mBuf); return ROK; - } -/******************************************************************* - * - * @brief Unpacks slot indication - * - * @details - * - * Function : unpackEgtpSlotInd - * - * Functionality: - * Unpacks slot indication - * - * @params[in] - * @return ROK - success - * RFAILED - failure - * -******************************************************************/ -uint8_t unpackEgtpSlotInd(EgtpSlotInd func, Pst *pst, Buffer *mBuf) -{ - return ((*func)()); -} +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/cm/legtp.h b/src/cm/legtp.h index 65516e4c3..844587ed0 100644 --- a/src/cm/legtp.h +++ b/src/cm/legtp.h @@ -106,9 +106,9 @@ uint8_t packEgtpSrvOpenCfm(Pst *pst, CmStatus cfm); uint8_t unpackEgtpSrvOpenCfm(EgtpSrvOpenCfm func, Buffer *mBuf); uint8_t packEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt); uint8_t unpackEgtpTnlMgmtReq(EgtpTnlMgmtReq func, Pst *pst, Buffer *mBuf); +uint8_t egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt); uint8_t packEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt); +uint8_t duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm); uint8_t unpackEgtpTnlMgmtCfm(EgtpTnlMgmtCfm func, Buffer *mBuf); -uint8_t packEgtpSlotInd(Pst *pst); -uint8_t unpackEgtpSlotInd(EgtpSlotInd func, Pst *pst, Buffer *mBuf); - +uint8_t packEgtpStartPollingReq(Pst *pst); #endif diff --git a/src/cu_stub/cu_f1ap_msg_hdl.h b/src/cu_stub/cu_f1ap_msg_hdl.h index 0e0e13a38..e97c88df3 100644 --- a/src/cu_stub/cu_f1ap_msg_hdl.h +++ b/src/cu_stub/cu_f1ap_msg_hdl.h @@ -63,6 +63,7 @@ #define UE_CONTEXT_SETUP_RSP 4 #define SECURITY_MODE_COMPLETE 5 #define RRC_RECONFIG 6 + typedef struct f1apDb { uint8_t dlRrcMsgCount; diff --git a/src/cu_stub/cu_stub.c b/src/cu_stub/cu_stub.c index a3a494dc7..f3ca64a1f 100644 --- a/src/cu_stub/cu_stub.c +++ b/src/cu_stub/cu_stub.c @@ -87,8 +87,25 @@ void init_log() uint8_t tst() { + int retVal=0; + pthread_t conThrdId; + pthread_attr_t attr; + init_log(); - DU_LOG("\nStarting CU_STUB"); + DU_LOG("\nStarting CU_STUB\n"); + + /* Start thread to receive console input */ + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, (size_t)NULLD); + pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + retVal = pthread_create(&conThrdId, &attr, cuConsoleHandler, NULLP); + if(retVal != 0) + { + DU_LOG("\nCU_STUB: Thread creation failed. Cause %d", retVal); + } + pthread_attr_destroy(&attr); + /* Read CU configurations */ readCuCfg(); @@ -169,6 +186,36 @@ void readCuCfg() cuCfgParams.egtpParams.maxTunnelId = 10; } /* End of readCuCfg */ + +/******************************************************************* + * + * @brief Handles Console input + * + * @details + * + * Function : cuConsoleHandler + * + * Functionality: Handles Console input + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +void *cuConsoleHandler(void *args) +{ + char ch; + while(true) + { + /* Send DL user data to CU when user enters 'd' on console */ + if((ch = getchar()) == 'd') + { + /* Start Pumping data from CU to DU */ + DU_LOG("\nEGTP: Sending DL User Data"); + cuEgtpDatReq(); + } + } +} /********************************************************************** End of file **********************************************************************/ diff --git a/src/cu_stub/cu_stub.h b/src/cu_stub/cu_stub.h index cfc1de047..342a68040 100644 --- a/src/cu_stub/cu_stub.h +++ b/src/cu_stub/cu_stub.h @@ -93,6 +93,7 @@ void readCuCfg(); void cuAppInmsgHdlr(Buffer *mBuf); void sctpNtfyInd(CmInetSctpNotification *ntfy); uint8_t egtpInitReq(); +void *cuConsoleHandler(void *); #endif diff --git a/src/cu_stub/cu_stub_egtp.c b/src/cu_stub/cu_stub_egtp.c index 3729e45fc..47276dd9c 100644 --- a/src/cu_stub/cu_stub_egtp.c +++ b/src/cu_stub/cu_stub_egtp.c @@ -505,7 +505,7 @@ S16 cuEgtpHdlRecvMsg(Buffer *mBuf) cuEgtpDecodeHdr(mBuf); /* Start Pumping data from CU to DU */ - return (cuEgtpDatReq()); + //return (cuEgtpDatReq()); } @@ -636,7 +636,7 @@ S16 cuEgtpDatReq() BuildEgtpMsg(&egtpMsg); /* Send Message to peer */ - while(cnt < 1) + while(cnt < 200) { DU_LOG("\nEGTP : Sending message[%d]", cnt+1); cuEgtpSendMsg(egtpMsg.msg); diff --git a/src/du_app/du_cell_mgr.c b/src/du_app/du_cell_mgr.c index e66352581..fc0695bce 100644 --- a/src/du_app/du_cell_mgr.c +++ b/src/du_app/du_cell_mgr.c @@ -28,6 +28,7 @@ #include "du_app_rlc_inf.h" #include "du_cfg.h" #include "du_mgr.h" +#include "du_utils.h" #include "du_cell_mgr.h" /******************************************************************* @@ -158,6 +159,52 @@ uint8_t duGetCellCb(uint16_t cellId, DuCellCb **cellCb) return ROK; } +/******************************************************************* + * + * @brief Handles cell up indication from MAC + * + * @details + * + * Function : duHandleCellUpInd + * + * Functionality: + * Handles cell up indication from MAC + * + * @params[in] Post structure pointer + * cell Up info + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId) +{ + DuCellCb *cellCb = NULLP; + + if(cellId->cellId <=0 || cellId->cellId > MAX_NUM_CELL) + { + DU_LOG("\nDU APP : Invalid Cell Id %d in duHandleCellUpInd()", cellId->cellId); + return RFAILED; + } + + if(duGetCellCb(cellId->cellId, &cellCb) != ROK) + return RFAILED; + + if((cellCb != NULL) && (cellCb->cellStatus == ACTIVATION_IN_PROGRESS)) + { + DU_LOG("\nDU APP : 5G-NR Cell %d is UP", cellId->cellId); + cellCb->cellStatus = ACTIVATED; + +#ifdef O1_ENABLE + DU_LOG("\nDU APP : Raise cell UP alarm for cell id=%d", cellId->cellId); + raiseCellAlrm(CELL_UP_ALARM_ID, cellId->cellId); +#endif + } + + if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC)) + DU_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, sizeof(OduCellId)); + return ROK; +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_egtp.c b/src/du_app/du_egtp.c index a6ba63665..830b2df4f 100644 --- a/src/du_app/du_egtp.c +++ b/src/du_app/du_egtp.c @@ -107,9 +107,23 @@ uint8_t egtpActvTsk(Pst *pst, Buffer *mBuf) ret = unpackEgtpTnlMgmtReq(egtpTnlMgmtReq, pst, mBuf); break; } - case EVTSLOTIND: + default: { - ret = unpackEgtpSlotInd(egtpSlotInd, pst, mBuf); + DU_LOG("\nEGTP : Invalid event %d", pst->event); + ODU_PUT_MSG_BUF(mBuf); + ret = RFAILED; + } + } + break; + } + case ENTEGTP: + { + switch(pst->event) + { + case EVTSTARTPOLL: + { + DU_LOG("\nEGTP : Starting Socket Polling"); + egtpRecvMsg(); ODU_PUT_MSG_BUF(mBuf); break; } @@ -119,8 +133,8 @@ uint8_t egtpActvTsk(Pst *pst, Buffer *mBuf) ODU_PUT_MSG_BUF(mBuf); ret = RFAILED; } - } - break; + } + break; } case ENTRLC: { @@ -255,10 +269,11 @@ uint8_t egtpFillRspPst(Pst *pst, Pst *rspPst) uint8_t egtpSrvOpenReq(Pst *pst) { - uint8_t ret; /* Return value */ - Pst rspPst; /* Response Pst structure */ - CmStatus cfm; /* Confirmation status */ - uint8_t sockType; /* Socket type */ + uint8_t ret; /* Return value */ + Pst rspPst; /* Response Pst structure */ + Pst egtpPst; /* Self post */ + CmStatus cfm; /* Confirmation status */ + uint8_t sockType; /* Socket type */ DU_LOG("\nEGTP : Received EGTP open server request"); @@ -280,7 +295,20 @@ uint8_t egtpSrvOpenReq(Pst *pst) DU_LOG("\nEGTP : Receiver socket[%d] and Sender socket[%d] open", egtpCb.recvTptSrvr.sockFd.fd, egtpCb.dstCb.sendTptSrvr.sockFd.fd); - /* Filling and seing response */ + /* Start Socket polling */ + memset(&egtpPst, 0, sizeof(egtpPst)); + egtpPst.srcEnt = (Ent)ENTEGTP; + egtpPst.srcInst = (Inst)EGTP_INST; + egtpPst.srcProcId = DU_PROC; + egtpPst.dstEnt = (Ent)ENTEGTP; + egtpPst.dstInst = (Inst)EGTP_INST; + egtpPst.dstProcId = DU_PROC; + egtpPst.event = EVTSTARTPOLL; + egtpPst.selector = ODU_SELECTOR_LC; + egtpPst.pool= DU_POOL; + packEgtpStartPollingReq(&egtpPst); + + /* Filling and sending response */ cfm.status = LCM_PRIM_OK; cfm.reason = LCM_REASON_NOT_APPL; @@ -337,8 +365,7 @@ uint8_t egtpSrvOpenPrc(uint8_t sockType, EgtpTptSrvr *server) * Functionality: * This function handles EGTP tunnel managament request * - * @param[in] Pst *pst, post structure - * Tunnel Eveny structure + * @param[in] Tunnel Eveny structure * @return ROK - success * RFAILED - failure * @@ -347,7 +374,6 @@ uint8_t egtpSrvOpenPrc(uint8_t sockType, EgtpTptSrvr *server) uint8_t egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) { S8 ret; - Pst rspPst; DU_LOG("\nEGTP : Received tunnel management request"); switch(tnlEvt.action) @@ -386,9 +412,7 @@ uint8_t egtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) } DU_LOG("\nEGTP : Sending Tunnel management confirmation"); - egtpFillRspPst(pst, &rspPst); - rspPst.event = EVTTNLMGMTCFM; - packEgtpTnlMgmtCfm(&rspPst, tnlEvt); + duHdlEgtpTnlMgmtCfm(tnlEvt); return ROK; } @@ -765,28 +789,6 @@ uint8_t egtpSendMsg(Buffer *mBuf) return ROK; } -/******************************************************************* - * - * @brief Handles Slot Indication from PHY - * - * @details - * - * Function : egtpSlotInd - * - * Functionality: - * Handles TTI Indication from PHY - * - * @params[in] - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -uint8_t egtpSlotInd() -{ - egtpRecvMsg(); - return ROK; -} - /******************************************************************* * * @brief Receives EGTP message from UDP socket @@ -813,9 +815,6 @@ uint8_t egtpRecvMsg() CmInetAddr fromAddr; /* Egtp data sender address */ CmInetMemInfo memInfo; /* Buffer allocation info */ - - DU_LOG("\nEGTP : Received Slot Indication"); - nMsg = 0; memInfo.region = DU_APP_MEM_REGION; memInfo.pool = DU_POOL; @@ -823,7 +822,7 @@ uint8_t egtpRecvMsg() fromAddr.port = egtpCb.dstCb.dstPort; fromAddr.address = egtpCb.dstCb.dstIp; - while(nMsg < EGTP_MAX_MSG_RECV) + while(true) { bufLen = -1; ret = cmInetRecvMsg(&(egtpCb.recvTptSrvr.sockFd), &fromAddr, &memInfo, \ @@ -840,6 +839,21 @@ uint8_t egtpRecvMsg() return ROK; } +/******************************************************************* + * + * @brief Handles DL User data received from CU + * + * @details + * + * Function : egtpHdlRecvData + * + * Functionality: Handles DL User data received from CU + * + * @params[in] DL Usre data buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ uint8_t egtpHdlRecvData(Buffer *mBuf) { EgtpMsg egtpMsg; @@ -853,6 +867,21 @@ uint8_t egtpHdlRecvData(Buffer *mBuf) return ROK; } +/******************************************************************* + * + * @brief Decodes EGTP header from DL User data + * + * @details + * + * Function : egtpDecodeHdr + * + * Functionality: Decodes EGTP header from DL User data + * + * @params[in] + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ uint8_t egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) { uint8_t tmpByte[5]; /* Holds 5 byte of data after Decoding */ @@ -1016,3 +1045,6 @@ uint8_t egtpDecodeHdr(Buffer *mBuf, EgtpMsg *egtpMsg) return ROK; } +/********************************************************************** + End of file +**********************************************************************/ diff --git a/src/du_app/du_f1ap_msg_hdl.c b/src/du_app/du_f1ap_msg_hdl.c index 95862d1d7..de5b43a19 100644 --- a/src/du_app/du_f1ap_msg_hdl.c +++ b/src/du_app/du_f1ap_msg_hdl.c @@ -7459,7 +7459,7 @@ UE_NR_Capability_t *extractUeCapability(UE_CapabilityRAT_ContainerList_t *ueCapa if(!ueCapRatContList) { DU_LOG("\nF1AP : Memory allocation failed in extractUeCapability"); - return RFAILED; + return NULLP; } memset(ueCapRatContList, 0, sizeof(UE_CapabilityRAT_ContainerListRRC_t)); memset(&rval, 0, sizeof(asn_dec_rval_t)); @@ -7486,7 +7486,7 @@ UE_NR_Capability_t *extractUeCapability(UE_CapabilityRAT_ContainerList_t *ueCapa { DU_LOG("\nF1AP : Memory allocation failed in extractUeCapability"); DU_FREE(ueCapRatContList, sizeof(UE_CapabilityRAT_ContainerListRRC_t)); - return RFAILED; + return NULLP; } memset(ueNrCap, 0, sizeof(UE_NR_Capability_t)); memset(&rval, 0, sizeof(asn_dec_rval_t)); diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index ee9dbbf50..923444641 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -143,7 +143,6 @@ typedef struct duCellCb CellCfgParams cellInfo; /* Cell info */ /* pointer to store the address of macCellCfg params used to send du-app to MAC */ MacCellCfg *duMacCellCfg; - bool firstSlotIndRcvd; CellStatus cellStatus; /* Cell status */ uint32_t numActvUes; /* Total Active UEs */ DuUeCb ueCb[MAX_NUM_UE]; /* UE CONTEXT */ @@ -236,12 +235,11 @@ uint8_t duHdlEgtpCfgComplete(CmStatus cfm); uint8_t duSendEgtpSrvOpenReq(); uint8_t duHdlEgtpSrvOpenComplete(CmStatus cfm); uint8_t duSendEgtpTnlMgmtReq(uint8_t action, uint32_t lclTeid, uint32_t remTeid); -uint8_t duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm); uint8_t duSendEgtpTestData(); uint8_t duSendEgtpDatInd(Buffer *mBuf); uint8_t duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm); -uint8_t duBuildAndSendMacCellStartReq(); -uint8_t duBuildAndSendMacCellStopReq(); +uint8_t duBuildAndSendMacCellStart(); +uint8_t duBuildAndSendMacCellStop(); #endif /********************************************************************** diff --git a/src/du_app/du_mgr_ex_ms.c b/src/du_app/du_mgr_ex_ms.c index 402812255..5e26c0605 100644 --- a/src/du_app/du_mgr_ex_ms.c +++ b/src/du_app/du_mgr_ex_ms.c @@ -232,9 +232,9 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf) ret = unpackMacCellCfgCfm(duHandleMacCellCfgCfm, pst, mBuf); break; } - case EVENT_MAC_SLOT_IND: + case EVENT_MAC_CELL_UP_IND: { - ret = unpackMacSlotInd(duHandleSlotInd, pst, mBuf); + ret = unpackMacCellUpInd(duHandleCellUpInd, pst, mBuf); break; } case EVENT_MAC_STOP_IND: diff --git a/src/du_app/du_mgr_main.c b/src/du_app/du_mgr_main.c index 7f112cb1f..4feb2c661 100644 --- a/src/du_app/du_mgr_main.c +++ b/src/du_app/du_mgr_main.c @@ -61,9 +61,9 @@ DuCfgParams duCfgParam; * ****************************************************************/ uint8_t duAppInit(SSTskId sysTskId) { - /* Register DU APP TAPA Task for DU */ - if(ODU_REG_TTSK((Ent)ENTDUAPP, (Inst)DU_INST, (Ttype)TTNORM, (Prior)PRIOR0, - duActvInit, (ActvTsk)duActvTsk) != ROK) + /* Register DU APP TAPA Task for DU */ + if(ODU_REG_TTSK((Ent)ENTDUAPP, (Inst)DU_INST, (Ttype)TTNORM, (Prior)PRIOR0, + duActvInit, (ActvTsk)duActvTsk) != ROK) { return RFAILED; } @@ -284,7 +284,7 @@ uint8_t lwrMacInit(SSTskId sysTskId) uint8_t commonInit() { /* Declare system task Ids */ - SSTskId du_app_stsk, sctp_stsk, rlc_ul_stsk, rlc_mac_cl_stsk, lwr_mac_stsk; + SSTskId du_app_stsk, egtp_stsk, sctp_stsk, rlc_ul_stsk, rlc_mac_cl_stsk, lwr_mac_stsk; pthread_attr_t attr; @@ -298,6 +298,14 @@ uint8_t commonInit() } ODU_SET_THREAD_AFFINITY(&du_app_stsk, SS_AFFINITY_MODE_EXCL, 15, 0); + /* system task for EGTP */ + if(ODU_CREATE_TASK(PRIOR0, &egtp_stsk) != ROK) + { + DU_LOG("\nDU_APP : System Task creation for EGTP failed"); + return RFAILED; + } + ODU_SET_THREAD_AFFINITY(&egtp_stsk, SS_AFFINITY_MODE_EXCL, 16, 0); + /* system task for RLC_DL and MAC */ if(ODU_CREATE_TASK(PRIOR0, &rlc_mac_cl_stsk) != ROK) { @@ -306,7 +314,7 @@ uint8_t commonInit() } pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 16, 0); + ODU_SET_THREAD_AFFINITY(&rlc_mac_cl_stsk, SS_AFFINITY_MODE_EXCL, 17, 0); /* system task for RLC UL */ if(ODU_CREATE_TASK(PRIOR1, &rlc_ul_stsk) != ROK) @@ -314,7 +322,7 @@ uint8_t commonInit() DU_LOG("\nDU_APP : System Task creation for RLC UL failed"); return RFAILED; } - ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 17, 0); + ODU_SET_THREAD_AFFINITY(&rlc_ul_stsk, SS_AFFINITY_MODE_EXCL, 18, 0); /* system task for SCTP receiver thread */ if(ODU_CREATE_TASK(PRIOR0, &sctp_stsk) != ROK) @@ -322,7 +330,7 @@ uint8_t commonInit() DU_LOG("\nDU_APP : System Task creation for SCTP failed"); return RFAILED; } - ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 18, 0); + ODU_SET_THREAD_AFFINITY(&sctp_stsk, SS_AFFINITY_MODE_EXCL, 19, 0); /* system task for lower-mac receiver thread */ if(ODU_CREATE_TASK(PRIOR0, &lwr_mac_stsk) != ROK) @@ -330,7 +338,7 @@ uint8_t commonInit() DU_LOG("\nDU_APP : System Task creation for Lower MAC failed"); return RFAILED; } - ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 19, 0); + ODU_SET_THREAD_AFFINITY(&lwr_mac_stsk, SS_AFFINITY_MODE_EXCL, 20, 0); /* Create TAPA tasks */ if(duAppInit(du_app_stsk) != ROK) @@ -339,7 +347,7 @@ uint8_t commonInit() return RFAILED; } - if(egtpInit(du_app_stsk) != ROK) + if(egtpInit(egtp_stsk) != ROK) { DU_LOG("\nDU_APP : EGTP TAPA Task initialization failed"); return RFAILED; @@ -396,7 +404,6 @@ uint8_t duInit() { ret = RFAILED; } - return ret; } @@ -404,6 +411,7 @@ void init_log() { openlog("ODU",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); } + /******************************************************************* * * @brief Entry point for the DU APP @@ -423,15 +431,14 @@ void init_log() * ****************************************************************/ uint8_t tst(void) { - init_log(); + init_log(); - //Initialize TAPA layers - if(duInit() != ROK) - { + //Initialize TAPA layers + if(duInit() != ROK) + { return RFAILED; } - //Read all the configs from du_utils.c into duCfgParams duReadCfg(); diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index 6fb4026d4..b2321bca0 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -71,18 +71,18 @@ packMacCellCfgReq packMacCellCfgOpts[] = packMacCellCfg, /* packing for light weight loosly coupled */ }; -DuMacCellStartReq packMacCellStartReqOpts[] = +DuMacCellStart packMacCellStartOpts[] = { - packMacCellStartReq, /* Loose coupling */ - MacProcCellStartReq, /* TIght coupling */ - packMacCellStartReq /* Light weight-loose coupling */ + packMacCellStart, /* Loose coupling */ + MacProcCellStart, /* TIght coupling */ + packMacCellStart /* Light weight-loose coupling */ }; -DuMacCellStopReq packMacCellStopReqOpts[] = +DuMacCellStop packMacCellStopOpts[] = { - packMacCellStopReq, /* Loose coupling */ - MacProcCellStopReq, /* TIght coupling */ - packMacCellStopReq /* Light weight-loose coupling */ + packMacCellStop, /* Loose coupling */ + MacProcCellStop, /* TIght coupling */ + packMacCellStop /* Light weight-loose coupling */ }; /************************************************************************** @@ -1178,10 +1178,8 @@ uint8_t duSendEgtpTnlMgmtReq(uint8_t action, uint32_t lclTeid, uint32_t remTeid) tnlEvt.remTeid = remTeid; DU_LOG("\nDU_APP : Sending EGTP tunnel management request"); - duFillEgtpPst(&pst, EVTTNLMGMTREQ); - packEgtpTnlMgmtReq(&pst, tnlEvt); - + egtpTnlMgmtReq(&pst, tnlEvt); return ROK; } @@ -1208,6 +1206,9 @@ uint8_t duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm) if(tnlEvtCfm.cfmStatus.status == LCM_PRIM_OK) { DU_LOG("\nDU_APP : Tunnel management confirm OK"); +#ifdef EGTP_TEST + duSendEgtpTestData(); +#endif } else { @@ -1218,6 +1219,21 @@ uint8_t duHdlEgtpTnlMgmtCfm(EgtpTnlEvt tnlEvtCfm) return (ret); } +/******************************************************************* + * + * @brief Sends UL user data over to EGTP + * + * @details + * + * Function : duSendEgtpDatInd + * + * Functionality: Sends UL user data over to EGTP + * + * @params[in] UL data buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ uint8_t duSendEgtpDatInd(Buffer *mBuf) { EgtpMsg egtpMsg; @@ -1508,33 +1524,6 @@ uint8_t duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm) return ROK; } -/******************************************************************* - * - * @brief Sends Slot indication to EGTP - * - * @details - * - * Function : duSendEgtpSlotInd - * - * Functionality: - * Sends Slot indication to EGTP - * - * @params[in] - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -uint8_t duSendEgtpSlotInd() -{ - Pst pst; - - duFillEgtpPst(&pst, EVTSLOTIND); - packEgtpSlotInd(&pst); - - return ROK; - -} - /************************************************************************** * @brief Function to fill and send MacCellconfig * @@ -1607,7 +1596,7 @@ uint8_t duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) ret = BuildAndSendDUConfigUpdate(); /* Build and Send Cell Start Req to MAC */ - ret = duBuildAndSendMacCellStartReq(); + ret = duBuildAndSendMacCellStart(); } else { @@ -1620,70 +1609,13 @@ uint8_t duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm) return ret; } -/******************************************************************* - * - * @brief Handles slot indication from MAC - * - * @details - * - * Function : duHandleSlotInd - * - * Functionality: - * Handles slot indication from MAC - * - * @params[in] Post structure pointer - * Slot Info pointer - * @return ROK - success - * RFAILED - failure - * - * ****************************************************************/ -uint8_t duHandleSlotInd(Pst *pst, SlotIndInfo *slotInfo) -{ - DuCellCb *cellCb = NULLP; - - if(slotInfo->cellId <=0 || slotInfo->cellId > MAX_NUM_CELL) - { - DU_LOG("\nDU APP : Invalid Cell Id %d in duHandleSlotInd()", slotInfo->cellId); - return RFAILED; - } - - if(duGetCellCb(slotInfo->cellId, &cellCb) != ROK) - return RFAILED; - - if(!cellCb->firstSlotIndRcvd) - { - DU_LOG("\nDU APP : Slot Indication received"); - cellCb->firstSlotIndRcvd = true; - if((cellCb != NULL) && (cellCb->cellStatus == ACTIVATION_IN_PROGRESS)) - { - DU_LOG("\nDU APP : 5G-NR Cell %d is UP", slotInfo->cellId); - cellCb->cellStatus = ACTIVATED; - -#ifdef O1_ENABLE - DU_LOG("\nDU APP : Raise cell UP alarm for cell id=%d", slotInfo->cellId); - raiseCellAlrm(CELL_UP_ALARM_ID, slotInfo->cellId); -#endif - } - } - - /* TODO : Slot Indication to be moved out of EGTP_TEST when - * data path is established */ -#ifdef EGTP_TEST - duSendEgtpSlotInd(); -#endif - - if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC)) - DU_FREE_SHRABL_BUF(pst->region, pst->pool, slotInfo, sizeof(SlotIndInfo)); - return ROK; -} - /******************************************************************* * * @brief Builds and sends cell start request to MAC * * @details * - * Function : duBuildAndSendMacCellStartReq + * Function : duBuildAndSendMacCellStart * * Functionality: * Builds and sends cell start request to MAC @@ -1693,16 +1625,16 @@ uint8_t duHandleSlotInd(Pst *pst, SlotIndInfo *slotInfo) * RFAILED - failure * * ****************************************************************/ -uint8_t duBuildAndSendMacCellStartReq() +uint8_t duBuildAndSendMacCellStart() { Pst pst; - MacCellStartInfo *cellStartInfo = NULL; + OduCellId *cellId = NULL; DU_LOG("\nDU APP : Building and Sending cell start request to MAC"); /* Send Cell Start Request to MAC */ - DU_ALLOC_SHRABL_BUF(cellStartInfo, sizeof(MacCellStartInfo)); - if(!cellStartInfo) + DU_ALLOC_SHRABL_BUF(cellId, sizeof(OduCellId)); + if(!cellId) { DU_LOG("\nDU APP : Memory alloc failed while building cell start request"); return RFAILED; @@ -1712,13 +1644,12 @@ uint8_t duBuildAndSendMacCellStartReq() { if(duCb.actvCellLst[id]) { - duCb.actvCellLst[id]->firstSlotIndRcvd = FALSE; - cellStartInfo->cellId = duCb.actvCellLst[id]->cellId; + cellId->cellId = duCb.actvCellLst[id]->cellId; /* Fill Pst */ - FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_START_REQ); + FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_START); - return (*packMacCellStartReqOpts[pst.selector])(&pst, cellStartInfo); + return (*packMacCellStartOpts[pst.selector])(&pst, cellId); } } return ROK; @@ -1730,7 +1661,7 @@ uint8_t duBuildAndSendMacCellStartReq() * * @details * - * Function : duBuildAndSendMacCellStopReq + * Function : duBuildAndSendMacCellStop * * Functionality: * Builds and sends cell stop request to MAC @@ -1740,26 +1671,26 @@ uint8_t duBuildAndSendMacCellStartReq() * RFAILED - failure * * ****************************************************************/ -uint8_t duBuildAndSendMacCellStopReq() +uint8_t duBuildAndSendMacCellStop() { Pst pst; - MacCellStopInfo *cellStopInfo = NULL; + OduCellId *cellId = NULL; DU_LOG("\nDU APP : Building and Sending cell stop request to MAC"); /* Send Cell Stop Request to MAC */ - DU_ALLOC_SHRABL_BUF(cellStopInfo, sizeof(MacCellStopInfo)); - if(!cellStopInfo) + DU_ALLOC_SHRABL_BUF(cellId, sizeof(OduCellId)); + if(!cellId) { DU_LOG("\nDU APP : Memory alloc failed while building cell stop request"); return RFAILED; } - cellStopInfo->cellId = duCb.actvCellLst[0]->cellId; + cellId->cellId = duCb.actvCellLst[0]->cellId; /* Fill Pst */ - FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_STOP_REQ); + FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_STOP); - return (*packMacCellStopReqOpts[pst.selector])(&pst, cellStopInfo); + return (*packMacCellStopOpts[pst.selector])(&pst, cellId); } /******************************************************************* @@ -1778,39 +1709,35 @@ uint8_t duBuildAndSendMacCellStopReq() * RFAILED - failure * * ****************************************************************/ -uint8_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellStopId) +uint8_t duHandleStopInd(Pst *pst, OduCellId *cellId) { DuCellCb *cellCb = NULLP; - - if(cellStopId->cellId <=0 || cellStopId->cellId > MAX_NUM_CELL) + + if(cellId->cellId <=0 || cellId->cellId > MAX_NUM_CELL) { - DU_LOG("\nDU APP : Invalid Cell Id %d in duHandleStopInd()", cellStopId->cellId); + DU_LOG("\nDU APP : Invalid Cell Id %d in duHandleStopInd()", cellId->cellId); } - if(duGetCellCb(cellStopId->cellId, &cellCb) != ROK) + if(duGetCellCb(cellId->cellId, &cellCb) != ROK) return RFAILED; - if(cellCb->firstSlotIndRcvd) + if((cellCb->cellStatus == ACTIVATED)) { - cellCb->firstSlotIndRcvd = false; - if((cellCb->cellStatus == ACTIVATED)) - { - DU_LOG("\nDU APP : 5G-NR Cell %d is DOWN", cellStopId->cellId); - cellCb->cellStatus = DELETION_IN_PROGRESS; + DU_LOG("\nDU APP : 5G-NR Cell %d is DOWN", cellId->cellId); + cellCb->cellStatus = DELETION_IN_PROGRESS; #ifdef O1_ENABLE - DU_LOG("\nDU APP : Raise cell down alarm for cell id=%d", cellStopId->cellId); - raiseCellAlrm(CELL_DOWN_ALARM_ID, cellStopId->cellId); + DU_LOG("\nDU APP : Raise cell down alarm for cell id=%d", cellId->cellId); + raiseCellAlrm(CELL_DOWN_ALARM_ID, cellId->cellId); #endif - } } + if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC)) - DU_FREE_SHRABL_BUF(MAC_MEM_REGION, pst->pool, cellStopId, sizeof(MacCellStopInfo)); + DU_FREE_SHRABL_BUF(MAC_MEM_REGION, pst->pool, cellId, sizeof(OduCellId)); cellCb->cellStatus = CELL_OUT_OF_SERVICE; //TODO: cell status must be set to OOS after all UE and cell cleanup which is not //supported now - return ROK; } diff --git a/src/du_app/du_ue_mgr.c b/src/du_app/du_ue_mgr.c index a651fd7ee..c9d7941b2 100644 --- a/src/du_app/du_ue_mgr.c +++ b/src/du_app/du_ue_mgr.c @@ -123,7 +123,7 @@ uint8_t duHdlEgtpDlData(EgtpMsg *egtpMsg) pst.srcProcId = DU_PROC; pst.region = duCb.init.region; - cmPkKwuDatReq(&pst, &datReqInfo, egtpMsg->msg); + //cmPkKwuDatReq(&pst, &datReqInfo, egtpMsg->msg); #else //duBuildAndSendDlRrcMsgToRlc(); #endif diff --git a/src/mt/mt_ss.c b/src/mt/mt_ss.c index 877dd56a1..1001da39b 100644 --- a/src/mt/mt_ss.c +++ b/src/mt/mt_ss.c @@ -503,7 +503,19 @@ SsRegCfg cfgRegInfo[SS_MAX_REGS] = { SS_POOL_DYNAMIC, MT_POOL_4_DSIZE }, { SS_POOL_STATIC, 0 } } + }, + { + SS_DFLT_REGION + 6, SS_MAX_POOLS_PER_REG - 1, + { + { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_4_DSIZE }, + { SS_POOL_STATIC, 0 } + } } + #endif /* SS_LOCKLESS_MEMORY */ }; /* mt003.301 Modifications - File Based task registration made @@ -586,11 +598,23 @@ MtDynMemCfg mtDynMemoCfg = {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} } + }, + { + SS_DFLT_REGION + 6, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + { + /* block size, no. of blocks, Upper threshold, lower threshold */ + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} + } } #if ((defined (SPLIT_RLC_DL_TASK)) && (!defined (L2_L3_SPLIT))) , { - SS_DFLT_REGION + 4, /* region id */ + SS_DFLT_REGION + 7, /* region id */ MT_MAX_BKTS, /* number of buckets */ { /* block size, no. of blocks, Upper threshold, lower threshold */ @@ -729,6 +753,18 @@ MtMemCfg mtMemoCfg = {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} /* block size, no. of blocks */ } }, + { + SS_DFLT_REGION + 5, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + MT_HEAP_SIZE, /* heap size */ + { + {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} /* block size, no. of blocks */ + } + }, { SS_DFLT_REGION + 5, /* region id */ MT_MAX_BKTS, /* number of buckets */ diff --git a/src/mt/mt_ss.h b/src/mt/mt_ss.h index 154566c13..2dc42fa86 100755 --- a/src/mt/mt_ss.h +++ b/src/mt/mt_ss.h @@ -53,7 +53,7 @@ #define SS_MAX_TTSKS 100 #ifndef SS_MULTICORE_SUPPORT -#define SS_MAX_STSKS 6 +#define SS_MAX_STSKS 7 #else /* mt001.301 : Additions */ #ifdef SPLIT_RLC_DL_TASK @@ -63,13 +63,13 @@ #define SS_MAX_STSKS 5 #endif #else -#define SS_MAX_STSKS 6 +#define SS_MAX_STSKS 7 #endif #endif /* SS_MULTICORE_SUPPORT */ #else /* SS_MULTIPLE_PROCS */ #define SS_MAX_TTSKS 1000 -#define SS_MAX_STSKS 6 +#define SS_MAX_STSKS 7 #endif /* SS_MULTIPLE_PROCS */ #ifdef SS_DRVR_SUPPORT @@ -90,7 +90,7 @@ #ifdef SS_MULTICORE_SUPPORT #define SS_MAX_REGS SS_MAX_STSKS #else -#define SS_MAX_REGS 6 +#define SS_MAX_REGS 7 #endif #ifdef CMM_MAX_BKT_ENT