X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrrlc%2Frlc_portable_functions.c;fp=src%2F5gnrrlc%2Fkw_ptui.c;h=c57cb077a4e863f98baad2a15b0d96ac38f0e4c4;hb=70e1fb5996d93ef4973ffb654ee6a66228e9031c;hp=840d46028d9fa1487e2ad5ac94e52ac1fc715659;hpb=d48ca6903f310645ef58f09ad965f589660be068;p=o-du%2Fl2.git diff --git a/src/5gnrrlc/kw_ptui.c b/src/5gnrrlc/rlc_portable_functions.c old mode 100755 new mode 100644 similarity index 54% rename from src/5gnrrlc/kw_ptui.c rename to src/5gnrrlc/rlc_portable_functions.c index 840d46028..c57cb077a --- a/src/5gnrrlc/kw_ptui.c +++ b/src/5gnrrlc/rlc_portable_functions.c @@ -18,18 +18,18 @@ /********************************************************************20** - Name: NR RLC Layer - Upper Interface + Name: NR RLC Layer - Lower Interface Type: C file - Desc: C source code for the upper interface of NR RLC + Desc: C source code for the lower interface of NR RLC - File: kw_ptui.c + File: kw_ptli.c *********************************************************************21*/ -/** @file kw_ptui.c -@brief RLC Upper Interface +/** @file rlc_portable_functions.c +@brief RLC Lower Interface */ @@ -39,31 +39,214 @@ #include "ckw.h" /* CKW defines */ #include "kwu.h" /* KWU defines */ #include "rgu.h" /* RGU defines */ - -#include "kw_err.h" -#include "kw_env.h" /* RLC environment options */ -#include "kw.h" /* RLC defines */ +#ifdef KW_PDCP +#include "cpj.h" /* CPJ defines */ +#include "pju.h" /* PJU defines */ +#include "lpj.h" /* LPJ defines */ +#endif +#include "rlc_err.h" +#include "rlc_env.h" /* RLC environment options */ /* extern (.x) include files */ #include "lkw.x" /* LKW */ #include "ckw.x" /* CKW */ #include "kwu.x" /* KWU */ #include "rgu.x" /* RGU */ +#ifdef KW_PDCP +#include "cpj.x" /* CPJ defines */ +#include "pju.x" /* PJU defines */ +#include "lpj.x" /* LPJ defines */ +#endif + +#include "rlc_utils.h" /* RLC defines */ +/* #if defined(MAC_RLC_UL_RBUF) || (defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF)) || defined(SS_RBUF) #include "ss_rbuf.h" #include "ss_rbuf.x" #endif -#include "kw.x" +*/ +#include "ss_rbuf.h" +#include "ss_rbuf.x" #if defined(L2_L3_SPLIT) && defined(ICC_RECV_TSK_RBUF) #include "mt_plat_t33.h" #include "mt_plat_t33.x" #endif +#ifndef LCKWLIRGU +#define PTKWRGU +#endif + +#ifndef RG +#define PTKWRGU +#endif + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ - +/* local defines */ +#define MAXKWMI 2 /* max. layer management interfaces */ + +#ifdef RLC_MAC_DAT_REQ_RBUF +S16 rlcLiRguDatReqRbuf(Pst *Post,SpId spId,Void *datReq); +#endif + +#ifdef RLC_MAC_STA_RSP_RBUF +S16 rlcLiRguStaRspRbuf(Pst *Post,SpId spId,Void *staRsp); +#endif +#if defined(MAC_RLC_HARQ_STA_RBUF) && defined(LTE_L2_MEAS) +S16 RlcDlHarqStaBatchProc (Void); +#endif + + +/********************************************************************* + * Primitives for RGU interface + ********************************************************************/ + +/* RGU Bind Request primitive */ + +RguBndReq kwLiRguBndReqMt[] = +{ +#ifdef LCKWLIRGU + cmPkRguBndReq, /* 0 - loosely coupled */ +#endif /* LCRGUIRGU */ +#ifdef RG + RgUiRguBndReq, /* 1 - tightly coupled, MAC */ +#endif /* RG */ +#ifdef LCKWLIRGU + cmPkRguBndReq, /* 0 - loosely coupled */ +#endif /* LCRGUIRGU */ +}; + +/* RGU Unbind Request primitive */ + +RguBndReq kwLiRguUbndReqMt[] = +{ +#ifdef LCKWLIRGU + cmPkRguUbndReq, /* 0 - loosely coupled */ +#endif /* LCRGUIRGU */ +#ifdef RG + RgUiRguUbndReq, /* 1 - tightly coupled, MAC */ +#endif /* RG */ +#ifdef LCKWLIRGU + cmPkRguUbndReq, /* 0 - loosely coupled */ +#endif /* LCRGUIRGU */ +}; + +/* kw005.201 added support for L2 Measurement */ +#ifdef LTE_L2_MEAS +#ifdef LTE_RLC_R9 +/* RGU L2 Measurement Ul Ip Throughput Measurement Request primitive */ + +RguL2MUlThrpMeasReq kwLiRguL2MUlThrpMeasReqMt[] = +{ +#ifdef LCKWLIRGU + cmPkRguL2MUlThrpMeasReq, /* 0 - loosely coupled */ +#endif /* LCRGUIRGU */ +#ifdef RG + RgUiRguL2MUlThrpMeasReq, /* 1 - tightly coupled, MAC */ +#endif /* RG */ +}; +#endif /* LTE_RLC_R9 */ +#endif /* LTE_L2_MEAS */ + +/********************************************************************* + * Primitives for LKW interface + ********************************************************************/ +/* Configuration confirmation primitive */ + +static RlcConfigCfm rlcMiRlcConfigCfmMt[MAXKWMI] = +{ +#ifdef LCKWMILKW + packRlcConfigCfm, /* 0 - loosely coupled - fc */ +#endif /* LCRLMILKW */ +#ifdef SM + SmMiRlcConfigCfm, /* 1 - tightly coupled layer management*/ +#endif /* SM */ +}; + +/* control confirmation primitives */ + +static LkwCntrlCfm kwMiLkwCntrlCfmMt[MAXKWMI] = +{ +#ifdef LCKWMILKW + cmPkLkwCntrlCfm, /* 0 - loosely coupled - fc */ +#endif /* LCRLMILKW */ +#ifdef SM + SmMiLkwCntrlCfm, /* 1 - tightly coupled layer management*/ +#endif /* SM */ +}; + +/* Status Indication primitive */ + +static LkwStaInd kwMiLkwStaIndMt[MAXKWMI] = +{ +#ifdef LCKWMILKW + cmPkLkwStaInd, /* 0 - loosely coupled */ +#endif /* LCKWMILKW */ +#ifdef SM + SmMiLkwStaInd, /* 1 - tightly coupled, layer management */ +#endif /* SM */ +}; + +/* Status confirm primitive */ + +static LkwStaCfm kwMiLkwStaCfmMt[MAXKWMI] = +{ +#ifdef LCKWMILKW + cmPkLkwStaCfm, /* 0 - loosely coupled */ +#endif /* LCKWMILKW */ +#ifdef SM + SmMiLkwStaCfm, /* 1 - tightly coupled, layer management */ +#endif /* SM */ +}; + +/* Statistics confirm primitive */ + +static LkwStsCfm kwMiLkwStsCfmMt[MAXKWMI] = +{ +#ifdef LCKWMILKW + cmPkLkwStsCfm, /* 0 - loosely coupled */ +#endif /* LCRLMILKW */ +#ifdef SM + SmMiLkwStsCfm, /* 1 - tightly coupled, layer management */ +#endif /* SM */ +}; + +/* Trace indication primitive */ + +static LkwTrcInd kwMiLkwTrcIndMt[MAXKWMI] = +{ +#ifdef LCKWMILKW + cmPkLkwTrcInd, /* 0 - loosely coupled */ +#endif /* LCKWMILKW */ +#ifdef SM + SmMiLkwTrcInd, /* 1 - tightly coupled, layer management */ +#endif /* SM */ +}; + +/* kw005.201 added support for L2 Measurement */ +#ifdef LTE_L2_MEAS +static const LkwL2MeasCfm rlcMiLkwL2MeasCfmMt[] = +{ +#ifdef LCKWMILKW + cmPkLkwL2MeasCfm, +#endif +#ifdef SM + SmMiLkwL2MeasCfm, +#endif +}; +static const LkwL2MeasStopCfm RlcMiLkwL2MeasStopCfmMt[] = +{ +#ifdef LCKWMILKW + cmPkLkwL2MeasStopCfm, +#endif +#ifdef SM + SmMiLkwL2MeasStopCfm, +#endif +}; +#endif /* LTE_L2_MEAS */ + /********************************************************************* * Forward Declartion for KWU Porting Functions ********************************************************************/ @@ -225,8 +408,477 @@ KwuDatAckInd kwUiKwuDatAckIndMt[] = /* KWU AM Data confirm primitive */ #endif /* KW_PDCP */ + +/**************************************************************************** + * LKW Interface Mt functions + ***************************************************************************/ +/** + @brief + This function is called by the RlcMiRlcConfigReq function for responding + to configuration requests.The cfm field in the RlcMngmt structure contains + the response value. + + - This function calls the mapping matrix for sending the configuration + confirmation. + - The actual function called depends on the coupling at the LKW interface. + - For a loosely coupled interface, a common packing function is called. + - The packing function packs the parameter in a message buffer and posts + the message to the target task. + - For a tightly coupled interface, the actual function called depends on + the layer manager API provided. + +*/ +S16 RlcMiRlcConfigCfm +( +Pst *pst, /* post structure */ +RlcMngmt *cfm /* Layer Management structure */ +) +{ + + /* jump to specific primitive depending on configured selector */ + (*rlcMiRlcConfigCfmMt[pst->selector])(pst, cfm); + + return ROK; +} + + +/** + @brief + This function is called by the RlcMiLkwCntrlReq function to send a control confirm to the layer management module. + + - This function calls the mapping matrix for sending the control confirmation. + - Actual function called depends on the coupling of the LKW interface. + - For a loosely coupled interface, a common packing function is called. + - The packing function packs the parameter in a message buffer and posts the + message to the target task. + - For a tightly coupled interface, the actual function called depends on the + layer manager API provided. + +*/ +S16 RlcMiLkwCntrlCfm +( +Pst *pst, /* post structure */ +RlcMngmt *cfm /* configure */ +) +{ + + /* jump to specific primitive depending on configured selector */ + (*kwMiLkwCntrlCfmMt[pst->selector])(pst, cfm); + + return ROK; + +} /* end of RlcMiLkwCntrlCfm */ + +/** + @brief + Description: + - This function can be used by RLC to send unsolicited status information + to the layer manager, when the unsolicited status flag is enabled by the + layer manager through a previous control request. + + - This function calls the mapping matrix for sending the unsolicited status + indication.The actual function called depends on the coupling of the + LKW interface. + + - For a loosely coupled interface, a common packing function is called. The + packing function packs the parameter in a message buffer and posts the + message to the target task. + + - For a tightly coupled interface, the actual function called depends on + the layer manager API provided. +*/ +S16 RlcMiLkwStaInd +( +Pst *pst, /* post structure */ +RlcMngmt *usta /* unsolicited status */ +) +{ + /* jump to specific primitive depending on configured selector */ + (*kwMiLkwStaIndMt[pst->selector])(pst, usta); + + return (ROK); +} /* end of RlcMiLkwStaInd */ + + +/** + @brief + - This function is called by the RlcMiLkwStaReq function to send + the requested status information to the layer manager. + + - This function calls the mapping matrix for sending the status + confirmation. The actual function called depends on the coupling + of the LKW interface. + + - For a loosely coupled interface, a common packing function is called. + The packing function packs the parameter in a message buffer and + posts the message to the target task. + + - For a tightly coupled interface, the actual function called depends + on the layer manager API provided. + +*/ +S16 RlcMiLkwStaCfm +( +Pst *pst, /* post structure */ +RlcMngmt *cfm /* solicited status confirmation */ +) +{ + + /* jump to specific primitive depending on configured selector */ + (*kwMiLkwStaCfmMt[pst->selector])(pst, cfm); + + return ROK; + +} /* end of RlcMiLkwStaCfm */ + + +/** + @brief + - This function is called by the RlcMiLkwStsReq function for responding + to statistics requests. + + - This function calls the mapping matrix for sending the statistics + confirmation. The actual function called depends on the coupling + of the LKW interface. + + - For a loosely coupled interface, a common packing function is called. + The packing function packs the parameter in a message buffer and + posts the message to the target task. + + - For a tightly coupled interface, the actual function called depends + on the layer manager API provided. + +*/ +S16 RlcMiLkwStsCfm +( +Pst *pst, /* post structure */ +Action action, /* action */ +RlcMngmt *cfm /* statistics confirmation */ +) +{ + /* jump to specific primitive depending on configured selector */ + (*kwMiLkwStsCfmMt[pst->selector])(pst, action, cfm); + + return ROK; + +} /* end of RlcMiLkwStsCfm */ + +/** + @brief + - This function can be used by RLC module to send unsolicited trace + indications to the layer manager, when tracing is enabled by the + layer manager through a previous control request. + + - This function calls the mapping matrix for sending the trace indication. + The actual function called depends on the coupling of the LKW interface. + + - For a loosely coupled interface, a common packing function is called. + The packing function packs the parameter in a message buffer and posts + the message to the target task. + + - For a tightly coupled interface, the actual function called depends on + the layer manager API provided. + +*/ +S16 RlcMiLkwTrcInd +( +Pst *pst, /* post structure */ +RlcMngmt *trc, /* trace indication */ +Buffer *mBuf /* message buffer */ +) +{ + /* jump to specific primitive depending on configured selector */ + (*kwMiLkwTrcIndMt[pst->selector])(pst, trc, mBuf); + + return ROK; + +} /* end of RlcMiLkwTrcInd */ + +/* kw005.201 added support for L2 Measurement */ +#ifdef LTE_L2_MEAS +S16 RlcMiLkwL2MeasCfm(Pst * pst,RlcL2MeasCfmEvt *measEvt) +{ + + (*rlcMiLkwL2MeasCfmMt[pst->selector])(pst, measEvt); + + return ROK; + +} +S16 RlcMiLkwL2MeasStopCfm(Pst *pst,uint8_t measType,uint8_t status) +{ + + (*RlcMiLkwL2MeasStopCfmMt[pst->selector])(pst, measType,status); + + return ROK; + +} +#endif /* LTE_L2_MEAS */ + + +/**************************************************************************** + * RGU Interface Mt functions + ***************************************************************************/ +/** + * + * @brief + * + * Handler for RGU SAP bind Request. + * + * @b Description: + * + * This function is used by RLC to request for binding to + * MAC for accessing MAC services.This function binds MAC's + * SAP (identified by spId) with the service user's SAP + * (identified by suId). + * + * @param[in] pst Post structure + * @param[in] suId Service user SAP ID + * @param[in] spId Service provider ID + * + * @return S16 + * -# ROK + */ + +S16 RlcLiRguBndReq +( +Pst *post, /* post structure */ +SuId suId, /* Service User Id */ +SpId spId /* Service Provider Id */ +) +{ + + /* jump to specific primitive depending on configured selector */ + (*kwLiRguBndReqMt[post->selector])(post, suId, spId); + + return ROK; + +} /* end of RlcLiRguBndReq */ + + +/** + * + * @brief + * + * Handler for bind confirmation from MAC. + * + * @b Description: + * + * This function handles the bind confirmation received + * from MAC. + * + * @param[in] post - Post structure + * @param[in] suId - Service provider SAP ID + * @param[in] reason - Reason of confirmation + * + * @return S16 + * -# ROK + */ + +S16 RlcLiRguUbndReq(Pst *post,SpId spId,Reason reason) +{ + + /* jump to specific primitive depending on configured selector */ + (*kwLiRguUbndReqMt[post->selector])(post, spId, reason); + + return ROK; + +} /* end of RlcLiRguUbndReq */ + +/* kw005.201 added support for L2 Measurement */ +#ifdef LTE_L2_MEAS +#ifdef LTE_RLC_R9 +/** + * + * @brief + * + * Handler for sending ulThrpMeasReqInfo from RLC to MAC for UL ip throughput measurement. + * + * @b Description: + * + * This function sends ulThrpMeasReqInfo from RLC to MAC whenver UL ip throughput + * measurement is ON for a single or multiple qci in a UE. This is an indication for MAC + * to start the T2/T1 time stamps for the coresponding LCHs in the UE. + * + * @param[in] post Post structure + * @param[in] spId Service Provider ID + * @param[in] ulThrpMeasReqInfo Ul ip measurement request info + * + * @return S16 + * -# ROK + * -# RFAILED + * + */ +S16 RlcLiRguL2MUlThrpMeasReq(Pst *post,SpId spId,RguL2MUlThrpMeasReqInfo *l2mUlThrpMeasReq) +{ + + /* jump to specific primitive depending on configured selector */ + (*kwLiRguL2MUlThrpMeasReqMt[post->selector])(post, spId, l2mUlThrpMeasReq); + + return ROK; + +} /* end of RlcLiRguL2MUlThrpMeasReq */ + +#endif /* LTE_RLC_R9 */ +#endif /* LTE_L2_MEAS */ + + +#ifdef MAC_RLC_UL_RBUF +S16 rlcUlBatchProc ARGS ((Void)); +Void rlcUtlFreeUlRBuf ARGS((void)); + +S16 rlcUlBatchProc(Void) +{ +/* Read from Ring Buffer and process PDCP packets */ + RguDDatIndInfo *datInd; + Void *elmIndx = NULLP; + static Pst rlcUlRbfuPst={1,1,ENTRLC,0,ENTMAC,0,PRIOR0,RTESPEC,EVTRLCULDAT,0,0,0,0}; +/* Read from Ring Buffer and process PDCP packets */ + +#ifndef SS_RBUF + RguDedDatInd1 *rguDatInd = NULLP; + uint8_t rngBufDeqIndx = 0; + + elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC); + while(NULLP != elmIndx) + { + rguDatInd = (RguDedDatInd1 *)elmIndx; + datInd = (RguDDatIndInfo*) rguDatInd->msg; + SsRngInfoTbl[SS_RNG_BUF_ULMAC_TO_ULRLC].nPktProc++;//Number of pkt processed in tti + if(datInd != NULLP) + { + RlcProcDedLcUlData(&rlcUlRbfuPst, 0, datInd); + } + else + { + DU_LOG("\nERROR --> RLC UL : Received NULL buffer"); + } + rguDatInd->msg=NULLP; + SRngIncrRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC); + elmIndx = NULLP; + rguDatInd = NULLP; + + rngBufDeqIndx++; + + //if(rngBufDeqIndx >= SS_RNG_MAX_ULMAC_TO_ULRLC_DQ_CNT) + // break; + + if((elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC)) == NULLP) + break; + } +#else + elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC); + while(NULLP != elmIndx) + { + datInd = (RguDDatIndInfo *)elmIndx; + RlcProcDedLcUlData(&rlcUlRbfuPst, 0, datInd); + + elmIndx = NULLP; + datInd = NULLP; + SRngIncrRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC); + + if((elmIndx = SRngGetRIndx(SS_RNG_BUF_ULMAC_TO_ULRLC)) == NULLP) + break; + } +#endif + return ROK; + +} + +/** + * + * @brief + * Handler to clear Ring buffer from UL RLC + * + * @details + * This function clears all the ring buffer content from UL RLC + * + * @return S16 + * -# ROK + * -# RFAILED + * + */ +Void rlcUtlFreeUlRBuf(void) +{ + RguDDatIndInfo *datInd; + PTR elem; + uint8_t numLch; + uint8_t numPdu; + + /* Free SS_RNG_BUF_ULMAC_TO_ULRLC */ + while((SDeqSRngBuf (SS_RNG_BUF_ULMAC_TO_ULRLC, &elem) == ROK)) + { + datInd = (RguDDatIndInfo *)elem; + for(numLch = 0; numLch< datInd->numLch; numLch++) + { + for(numPdu = 0; numPdu < datInd->lchData[numLch].pdu.numPdu; numPdu++) + { + if(datInd->lchData[numLch].pdu.mBuf[numPdu]) + { + ODU_PUT_MSG_BUF(datInd->lchData[numLch].pdu.mBuf[numPdu]); + } + } + } + RLC_PST_FREE(0, 0, datInd, sizeof(RguDDatIndInfo)); + } +} +#endif +#ifdef RLC_MAC_STA_RSP_RBUF +S16 rlcLiRguStaRspRbuf(Pst *post,SpId spId,Void *staRsp) +{ + S16 ret1 = ROK; + + Void *elem = NULLP; + + RguDStaRspInfo *staRspInfo = NULL; + elem = SRngGetWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC); + if (NULLP != elem) + { + staRspInfo = (RguDStaRspInfo *)elem; + memcpy(staRspInfo, staRsp, sizeof(RguDStaRspInfo)); + staRspInfo->post = *post; + SRngIncrWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC); + SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC].pktRate++; + } + else + { + DU_LOG("\nERROR --> RLC_DL : RLC DL STA RSP RBUF is FULL!!! "); + SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC].pktDrop++; + ret1 = RFAILED; + } + return (ret1); +} /* cmPkRlcDatReq */ + +#endif +#ifdef RLC_MAC_DAT_REQ_RBUF +S16 rlcLiRguDatReqRbuf(Pst *post,SpId spId,Void *datReq) +{ + S16 ret1 = ROK; + + Void *elem = NULLP; + RguInfoRingElem *datReqRing=NULLP; + elem = SRngGetWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ); + if (NULLP != elem) + { + datReqRing = (RguInfoRingElem *) elem; + datReqRing->spId = spId; + datReqRing->event = post->event; + datReqRing->msg =datReq; + SRngIncrWIndx(SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ); + SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ].pktRate++; + } + else + { + DU_LOG("\nERROR --> RLC_DL : RLC DL DAT REQ RBUF is FULL!!! \n"); + SsRngInfoTbl[SS_RNG_BUF_DLRLC_TO_DLMAC_DAT_REQ].pktDrop++; + ret1 = RFAILED; + } + return (ret1); +} /* cmPkRlcDatReq */ + +#endif + /**************************************************************************** * KWU Interface Mt functions ***************************************************************************/ @@ -843,6 +1495,7 @@ S16 rlcUtlDlFreeRlcRBuf(Void) #ifdef __cplusplus } #endif /* __cplusplus */ -/********************************************************************30** + +/************************************************************************ End of file **********************************************************************/