X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Fmac_cfg_hdl.c;h=5c0e85e666124833d40e04d0fad3d387310989d6;hb=836efc088282ad7c9dadcdae0bccfdf0774652ab;hp=b6f0fcab660b429ca941593039c316efdbea8567;hpb=91badb497240f15ed4de91a1eaae71534c044571;p=o-du%2Fl2.git diff --git a/src/5gnrmac/mac_cfg_hdl.c b/src/5gnrmac/mac_cfg_hdl.c index b6f0fcab6..5c0e85e66 100644 --- a/src/5gnrmac/mac_cfg_hdl.c +++ b/src/5gnrmac/mac_cfg_hdl.c @@ -70,11 +70,18 @@ MacDuSliceCfgRspFunc macDuSliceCfgRspOpts[] = packDuMacSliceCfgRsp /* packing for light weight loosly coupled */ }; -MacDuSliceReCfgRspFunc macDuSliceReCfgRspOpts[] = +MacDuSliceRecfgRspFunc macDuSliceRecfgRspOpts[] = { - packDuMacSliceReCfgRsp, /* packing for loosely coupled */ - DuProcMacSliceReCfgRsp, /* packing for tightly coupled */ - packDuMacSliceReCfgRsp /* packing for light weight loosly coupled */ + packDuMacSliceRecfgRsp, /* packing for loosely coupled */ + DuProcMacSliceRecfgRsp, /* packing for tightly coupled */ + packDuMacSliceRecfgRsp /* packing for light weight loosly coupled */ +}; + +MacSchPagingIndFunc macSchPagingIndOpts[] = +{ + packMacSchPagingInd, /* packing for loosely coupled */ + MacSchPagingInd, /* packing for tightly coupled */ + packMacSchPagingInd /* packing for light weight loosely coupled */ }; /** @@ -167,6 +174,7 @@ uint8_t MacProcCellCfgReq(Pst *pst, MacCellCfg *macCellCfg) GET_CELL_IDX(macCellCfg->cellId, cellIdx); macCb.macCell[cellIdx] = macCellCb; macCb.macCell[cellIdx]->cellId = macCellCfg->cellId; + macCb.macCell[cellIdx]->numOfSlots = 10 * (1 << macCellCfg->numerology); memcpy(&macCb.macCell[cellIdx]->macCellCfg, macCellCfg, sizeof(MacCellCfg)); MAC_ALLOC(macCb.macCell[cellIdx]->macCellCfg.sib1Cfg.sib1Pdu, \ @@ -632,11 +640,11 @@ uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDelRsp) * * ****************************************************************/ -uint8_t sendCellDelReqToSch(SchCellDelete *schCellDel) +uint8_t sendCellDelReqToSch(SchCellDeleteReq *schCellDelReq) { Pst schPst; FILL_PST_MAC_TO_SCH(schPst, EVENT_CELL_DELETE_REQ_TO_SCH); - return(*macSchCellDeleteReqOpts[schPst.selector])(&schPst, schCellDel); + return(*macSchCellDeleteReqOpts[schPst.selector])(&schPst, schCellDelReq); } /******************************************************************* @@ -655,10 +663,10 @@ uint8_t sendCellDelReqToSch(SchCellDelete *schCellDel) * * * ****************************************************************/ -uint8_t MacProcCellDeleteReq(Pst *pst, MacCellDelete *cellDelete) +uint8_t MacProcCellDeleteReq(Pst *pst, MacCellDeleteReq *cellDelete) { uint8_t ret = ROK, cellIdx=0; - SchCellDelete schCellDelete; + SchCellDeleteReq schCellDelete; DU_LOG("\nINFO --> MAC : Cell Delete Request received for cellId[%d]", cellDelete->cellId); @@ -669,7 +677,7 @@ uint8_t MacProcCellDeleteReq(Pst *pst, MacCellDelete *cellDelete) { if(macCb.macCell[cellIdx]->cellId == cellDelete->cellId) { - memset(&schCellDelete, 0, sizeof(SchCellDelete)); + memset(&schCellDelete, 0, sizeof(SchCellDeleteReq )); schCellDelete.cellId = cellDelete->cellId; ret = sendCellDelReqToSch(&schCellDelete); if(ret != ROK) @@ -702,7 +710,7 @@ uint8_t MacProcCellDeleteReq(Pst *pst, MacCellDelete *cellDelete) } } - MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellDelete, sizeof(MacCellDelete)); + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellDelete, sizeof(MacCellDeleteReq)); } else { @@ -902,17 +910,17 @@ uint8_t MacProcSchSliceCfgRsp(Pst *pst, SchSliceCfgRsp *schSliceCfgRsp) * * sends slice cfg response to duapp * -* @param[in] MacSliceCfgRsp macSliceRecfgRsp +* @param[in] MacSliceRecfgRsp macSliceRecfgRsp * @return int * -# ROK **/ -uint8_t MacSendSliceReconfigRsp(MacSliceCfgRsp *macSliceRecfgRsp) +uint8_t MacSendSliceReconfigRsp(MacSliceRecfgRsp *macSliceRecfgRsp) { Pst rspPst; memset(&rspPst, 0, sizeof(Pst)); FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_SLICE_RECFG_RSP); - return (*macDuSliceReCfgRspOpts[rspPst.selector])(&rspPst, macSliceRecfgRsp); + return (*macDuSliceRecfgRspOpts[rspPst.selector])(&rspPst, macSliceRecfgRsp); } @@ -921,7 +929,7 @@ uint8_t MacSendSliceReconfigRsp(MacSliceCfgRsp *macSliceRecfgRsp) * * @details * - * Function : MacProcSchSliceReCfgRsp + * Function : MacProcSchSliceRecfgRsp * * This function process the slice cfg rsp received from sch * @@ -930,32 +938,112 @@ uint8_t MacSendSliceReconfigRsp(MacSliceCfgRsp *macSliceRecfgRsp) * @return int * -# ROK **/ -uint8_t MacProcSchSliceReCfgRsp(Pst *pst, SchSliceCfgRsp *schSliceRecfgRsp) +uint8_t MacProcSchSliceRecfgRsp(Pst *pst, SchSliceRecfgRsp *schSliceRecfgRsp) { - MacSliceCfgRsp *macSliceReCfgRsp = NULLP; + MacSliceRecfgRsp *macSliceRecfgRsp = NULLP; if(schSliceRecfgRsp) { - MAC_ALLOC_SHRABL_BUF(macSliceReCfgRsp, sizeof(MacSliceCfgRsp)); - if(macSliceReCfgRsp == NULLP) + MAC_ALLOC_SHRABL_BUF(macSliceRecfgRsp, sizeof(MacSliceRecfgRsp)); + if(macSliceRecfgRsp == NULLP) { - DU_LOG("\nERROR --> MAC : Failed to allocate memory in MacProcSchSliceReCfgRsp"); + DU_LOG("\nERROR --> MAC : Failed to allocate memory in MacProcSchSliceRecfgRsp"); return RFAILED; } if(schSliceRecfgRsp->listOfSliceCfgRsp) { - if(fillMacSliceCfgRsp(schSliceRecfgRsp, macSliceReCfgRsp) != ROK) + if(fillMacSliceCfgRsp(schSliceRecfgRsp, macSliceRecfgRsp) != ROK) { DU_LOG("\nERROR --> MAC : Failed to fill the slice Recfg response"); return RFAILED; } - MacSendSliceReconfigRsp(macSliceReCfgRsp); + MacSendSliceReconfigRsp(macSliceRecfgRsp); } freeSchSliceCfgRsp(schSliceRecfgRsp); } return ROK; } + +/** + * @brief Mac process the downlink pcch indication received from DUAPP + * + * @details + * + * Function : MacProcDlPcchInd + * + * This function process the downlink pcch indication received from DUAPP + * + * @param[in] Pst *pst + * @param[in] DlPcchInd *pcchInd + * @return int + * -# ROK + **/ +uint8_t MacProcDlPcchInd(Pst *pst, DlPcchInd *pcchInd) +{ + uint8_t ret = RFAILED; + uint16_t cellIdx = 0; + Pst schPst; + SchPageInd *schPageInd = NULLP; + + if(pcchInd) + { + DU_LOG("\nINFO --> MAC : Received DL PCCH IND from DU_APP for cellId[%d]", pcchInd->cellId); + + GET_CELL_IDX(pcchInd->cellId, cellIdx); + + if(macCb.macCell[cellIdx] == NULLP || macCb.macCell[cellIdx]->cellId != pcchInd->cellId) + { + DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): CellId[%d] does not exist", pcchInd->cellId); + } + else + { + if((pcchInd->pcchPdu == NULLP) || (pcchInd->pduLen <= 0)) + { + DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): Received Pcch pdu is null"); + } + else + { + MAC_ALLOC(schPageInd, sizeof(SchPageInd)); + if(schPageInd == NULLP) + { + DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): Failed to allocate memory"); + } + else + { + schPageInd->cellId = pcchInd->cellId; + schPageInd->pf = pcchInd->pf; + schPageInd->i_s = pcchInd->i_s; + schPageInd->pduLen = pcchInd->pduLen; + + MAC_ALLOC(schPageInd->pagePdu, pcchInd->pduLen); + if(schPageInd->pagePdu == NULLP) + { + DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): Failed to allocate memory"); + MAC_FREE(schPageInd, sizeof(SchPageInd)); + } + else + { + memcpy(schPageInd->pagePdu, pcchInd->pcchPdu, pcchInd->pduLen); + + FILL_PST_MAC_TO_SCH(schPst, EVENT_PAGING_IND_TO_SCH); + ret = (*macSchPagingIndOpts[schPst.selector])(&schPst, schPageInd); + } + } + } + } + if((pcchInd->pcchPdu) && (pcchInd->pduLen > 0)) + { + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, pcchInd->pcchPdu, pcchInd->pduLen); + } + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, pcchInd, sizeof(DlPcchInd)); + } + else + { + DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): Received Null pointer"); + } + return ret; +} /********************************************************************** End of file **********************************************************************/