X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Frg_dux.c;h=55d7080c6b2f52e15972159d3e708f5ab36cf305;hb=3330932565e15a749fd5dd5039cdea2862ca51cc;hp=4b38e8264ea1fbf10e8942feb0f53575e3082ac2;hpb=18fbca81feebe0cf45f205c1c580c574741292b0;p=o-du%2Fl2.git diff --git a/src/5gnrmac/rg_dux.c b/src/5gnrmac/rg_dux.c index 4b38e8264..55d7080c6 100755 --- a/src/5gnrmac/rg_dux.c +++ b/src/5gnrmac/rg_dux.c @@ -32,23 +32,9 @@ @brief This module handles de-multiplexing of the data recieved at MAC. */ -static const char* RLOG_MODULE_NAME="MAC"; -static int RLOG_FILE_ID=176; -static int RLOG_MODULE_ID=4096; /* header include files -- defines (.h) */ -#include "envopt.h" /* environment options */ -#include "envdep.h" /* environment dependent */ -#include "envind.h" /* environment independent */ +#include "common_def.h" -#include "gen.h" /* general */ -#include "ssi.h" /* system services */ - -#include "cm_lte.h" /* Common LTE */ -#include "cm_tkns.h" /* Common Token Defines */ -#include "cm_llist.h" /* Common Link List Defines */ -#include "cm_hash.h" /* Common Hash List Defines */ -#include "cm_mblk.h" /* common memory link list library */ - #include "rg_env.h" /* MAC Environment Defines */ #include "tfu.h" /* CRG Interface defines */ #include "crg.h" /* CRG Interface defines */ @@ -60,16 +46,6 @@ static int RLOG_MODULE_ID=4096; #include "rg_err.h" /* MAC error defines */ /* header/extern include files (.x) */ -#include "gen.x" /* general */ -#include "ssi.x" /* system services */ -#include "cm5.x" /* common timers */ -#include "cm_lib.x" /* common library */ -#include "cm_lte.x" /* Common LTE */ -#include "cm_tkns.x" /* Common Token Definitions */ -#include "cm_llist.x" /* Common Link List Definitions */ -#include "cm_lib.x" /* Common Library Definitions */ -#include "cm_hash.x" /* Common Hash List Definitions */ -#include "cm_mblk.x" /* common memory link list library */ #include "rgu.x" /* RGU types */ #include "tfu.x" /* CRG Interface includes */ @@ -79,7 +55,7 @@ static int RLOG_MODULE_ID=4096; #include "rgu.x" /* RGU Interface includes */ #include "lrg.x" /* LRG Interface includes */ -#include "du_mgr_mac_inf.h" +#include "du_app_mac_inf.h" #include "rg.x" /* MAC includes */ /* local defines */ @@ -115,15 +91,15 @@ static int RLOG_MODULE_ID=4096; } #define RG_UNPACK_SHORT_BSR(_bsr, _mBuf, _ret) {\ - _ret = SUnpkU8((_bsr), (_mBuf)); \ + _ret = oduPackUInt8((_bsr), (_mBuf)); \ } #define RG_UNPACK_TRUNC_BSR(_bsr, _mBuf, _ret) {\ - _ret = SUnpkU8((_bsr), (_mBuf)); \ + _ret = oduPackUInt8((_bsr), (_mBuf)); \ } #define RG_UNPACK_PHR(_phr, _mBuf, _ret) {\ - _ret = SUnpkU8((_phr), (_mBuf)); \ + _ret = oduPackUInt8((_phr), (_mBuf)); \ } #define RG_UNPACK_CRNTI(_rnti, _mBuf, _ret) {\ @@ -132,18 +108,18 @@ static int RLOG_MODULE_ID=4096; _ret = SRemPreMsgMult(_unpkArray, (MsgLen) 2, _mBuf);\ if (_ret == ROK)\ {\ - *_rnti = (U16) PutHiByte(*_rnti, (U8) _unpkArray[0]);\ - *_rnti = (U16) PutLoByte(*_rnti, (U8) _unpkArray[1]);\ + *_rnti = (uint16_t) PutHiByte(*_rnti, (uint8_t) _unpkArray[0]);\ + *_rnti = (uint16_t) PutLoByte(*_rnti, (uint8_t) _unpkArray[1]);\ }\ } /* For EXT PHR DEMUX */ #define RG_UNPACK_EXT_PHR_CI(_ci, _mBuf, _ret) {\ - _ret = SUnpkU8((_ci), (_mBuf)); \ + _ret = oduPackUInt8((_ci), (_mBuf)); \ } #define RG_UNPACK_EXT_PHR(_extPhr, _mBuf, _ret) {\ - _ret = SUnpkU8((_extPhr), (_mBuf)); \ + _ret = oduPackUInt8((_extPhr), (_mBuf)); \ } @@ -169,42 +145,23 @@ static int RLOG_MODULE_ID=4096; * -# ROK * -# RFAILED **/ -#ifdef ANSI -PRIVATE S16 rgDUXInsSdu -( -Inst inst, -RgMacPdu *pdu, -RgMacSdu **sdu, -U8 lcId, -U16 sduLen, -RgErrInfo *err -) -#else -PRIVATE S16 rgDUXInsSdu(inst,pdu, sdu, lcId, sduLen, err) -Inst inst; -RgMacPdu *pdu; -RgMacSdu **sdu, -U8 lcId; -U16 sduLen; -RgErrInfo *err; -#endif +static S16 rgDUXInsSdu(Inst inst, RgMacPdu *pdu, RgMacSdu **sdu, uint8_t lcId, uint16_t sduLen, RgErrInfo *err) { S16 ret; RgMacSdu *sduAloc = NULLP; - TRC2(rgDUXInsSdu) RG_DUX_ALLOC(pdu, sizeof(RgMacSdu), sduAloc, ret); if(ret != ROK) { - RLOG1(L_ERROR, "Allocation of RgSubHdr failed for LCID:%d",lcId); + DU_LOG("\nERROR --> MAC : Allocation of RgSubHdr failed for LCID:%d",lcId); err->errCause = RGERR_DUX_MEM_EXHAUST; - RETVALUE(RFAILED); + return RFAILED; } *sdu = sduAloc; RG_INIT_SDU(sduAloc, lcId, sduLen); cmLListAdd2Tail(&pdu->sduLst, &sduAloc->sduLstEnt); - RETVALUE(ROK); + return ROK; } /** @@ -229,38 +186,18 @@ RgErrInfo *err; * -# ROK * -# RFAILED **/ -#ifdef ANSI -PRIVATE S16 rgDUXExtSubHdr -( -Inst inst, -RgMacPdu *pdu, -Buffer *mBuf, -U8 *lcId, -U16 *len, -RgErrInfo *err -) -#else -PRIVATE S16 rgDUXExtSubHdr(inst,pdu, mBuf, lcId, -len, err) -Inst inst; -RgMacPdu *pdu; -Buffer *mBuf; -U8 *lcId; -U16 *len; -RgErrInfo *err; -#endif +static S16 rgDUXExtSubHdr(Inst inst, RgMacPdu *pdu, Buffer *mBuf, uint8_t *lcId, uint16_t *len, RgErrInfo *err) { - U8 byte; - U8 fmt=0; + uint8_t byte; + uint8_t fmt=0; - TRC2(rgDUXExtSubHdr) *len = 0; - if(SUnpkU8(&byte,mBuf) != ROK) + if(oduPackUInt8(&byte,mBuf) != ROK) { - RLOG0(L_ERROR, "SUnpkU8 failed"); + DU_LOG("\nERROR --> MAC : oduPackUInt8 failed"); err->errCause = RGERR_DUX_UNPACK_FAILURE; - RETVALUE(RFAILED); + return RFAILED; } /* Extract the lcid */ RG_EXT_LCID(*lcId, byte); @@ -269,25 +206,25 @@ RgErrInfo *err; if(*lcId <= RG_DEDLC_MAX_LCID) { /* variable size MAC Sub PDU */ RG_EXT_FORMT_BIT(fmt,byte); - if(SUnpkU8(&byte, mBuf) != ROK) + if(oduPackUInt8(&byte, mBuf) != ROK) { - RLOG0(L_ERROR, "SUnpkU8 failed"); + DU_LOG("\nERROR --> MAC : oduPackUInt8 failed"); err->errCause = RGERR_DUX_UNPACK_FAILURE; - RETVALUE(RFAILED); + return RFAILED; } *len = byte; if(fmt) { - if(SUnpkU8(&byte,mBuf) != ROK) + if(oduPackUInt8(&byte,mBuf) != ROK) { - RLOG0(L_ERROR, "SUnpkU8 failed"); + DU_LOG("\nERROR --> MAC : oduPackUInt8 failed"); err->errCause = RGERR_DUX_UNPACK_FAILURE; - RETVALUE(RFAILED); + return RFAILED; } *len = (*len << 8) | byte; } } - RETVALUE(ROK); + return ROK; } /* rgDUXExtSubHdr */ /** @@ -313,48 +250,28 @@ RgErrInfo *err; * -# ROK * -# RFAILED **/ -#ifdef ANSI -PRIVATE S16 rgDUXExtCe -( -Inst inst, -RgMacPdu *pdu, -RgInfCeInfo *ceInfo, -Buffer *mBuf, -U8 lcId, -U16 subPduLen, -RgErrInfo *err -) -#else -PRIVATE S16 rgDUXExtCe(inst,pdu, ceInfo, mBuf,lcId,subPduLen, err) -Inst inst; -RgMacPdu *pdu; -RgInfCeInfo *ceInfo; -Buffer *mBuf; -U8 lcId; -U16 subPduLen; -RgErrInfo *err; -#endif +static S16 rgDUXExtCe(Inst inst, RgMacPdu *pdu, RgInfCeInfo *ceInfo, Buffer *mBuf, uint8_t lcId, uint16_t subPduLen,\ +RgErrInfo *err) { S16 ret; - TRC2(rgDUXExtCe); switch(lcId) { case RG_EXT_PHR_LCID: { - U8 Ci; - U8 sCellIdx; - U8 extPhrOctet; - U8 extPhrPCmax; + uint8_t Ci; + uint8_t sCellIdx; + uint8_t extPhrOctet; + uint8_t extPhrPCmax; RgInfExtPhrCEInfo *extPhr; RG_UNPACK_EXT_PHR_CI(&Ci,mBuf,ret); if(ret != ROK) { - RLOG1(L_ERROR,"Unpacking of EXT PHR failed LCID:%d",lcId); + DU_LOG("\nERROR --> MAC : Unpacking of EXT PHR failed LCID:%d",lcId); err->errCause = RGERR_DUX_UNPACK_FAILURE; - RETVALUE(RFAILED); + return RFAILED; } /* Not handling Type 2 PHR report as simultaneous PUSCH/PUCCH @@ -373,9 +290,9 @@ RgErrInfo *err; RG_UNPACK_EXT_PHR(&extPhrOctet,mBuf,ret); if(ret != ROK) { - RLOG1(L_ERROR,"Unpacking of EXT PHR failed LCID:%d",lcId); + DU_LOG("\nERROR --> MAC : Unpacking of EXT PHR failed LCID:%d",lcId); err->errCause = RGERR_DUX_UNPACK_FAILURE; - RETVALUE(RFAILED); + return RFAILED; } /* extPhrOctet: Bits : 7 6 5 4 3 2 1 0 @@ -397,9 +314,9 @@ RgErrInfo *err; RG_UNPACK_EXT_PHR(&extPhrPCmax,mBuf,ret); if(ret != ROK) { - RLOG1(L_ERROR,"Unpacking of EXT PHR failed LCID:%d",lcId); + DU_LOG("\nERROR --> MAC : Unpacking of EXT PHR failed LCID:%d",lcId); err->errCause = RGERR_DUX_UNPACK_FAILURE; - RETVALUE(RFAILED); + return RFAILED; } extPhr->servCellPhr[extPhr->numServCells].pCmax = (extPhrPCmax & 0x3F); } @@ -417,9 +334,9 @@ RgErrInfo *err; RG_UNPACK_PHR(&ceInfo->ces.phr,mBuf,ret); if(ret != ROK) { - RLOG1(L_ERROR,"Unpacking of PHR failed LCID:%d",lcId); + DU_LOG("\nERROR --> MAC : Unpacking of PHR failed LCID:%d",lcId); err->errCause = RGERR_DUX_UNPACK_FAILURE; - RETVALUE(RFAILED); + return RFAILED; } ceInfo->bitMask |= RG_PHR_CE_PRSNT; } @@ -429,9 +346,9 @@ RgErrInfo *err; RG_UNPACK_TRUNC_BSR(&ceInfo->ces.bsr.truncBsr,mBuf,ret); if(ret != ROK) { - RLOG1(L_ERROR,"Unpacking of Trunc BSR failed LCID:%d",lcId); + DU_LOG("\nERROR --> MAC : Unpacking of Trunc BSR failed LCID:%d",lcId); err->errCause = RGERR_DUX_UNPACK_FAILURE; - RETVALUE(RFAILED); + return RFAILED; } ceInfo->bitMask |= RG_TRUNC_BSR_CE_PRSNT; } @@ -441,22 +358,22 @@ RgErrInfo *err; RG_UNPACK_SHORT_BSR(&ceInfo->ces.bsr.shortBsr,mBuf,ret); if(ret != ROK) { - RLOG1(L_ERROR,"Unpacking of Short BSR failed LCID:%d",lcId); + DU_LOG("\nERROR --> MAC : Unpacking of Short BSR failed LCID:%d",lcId); err->errCause = RGERR_DUX_UNPACK_FAILURE; - RETVALUE(RFAILED); + return RFAILED; } ceInfo->bitMask |= RG_SHORT_BSR_CE_PRSNT; } break; case RG_LONG_BSR_LCID: { - U8 longBsr[3] = {0}; /* KW_FIXX */ + uint8_t longBsr[3] = {0}; /* KW_FIXX */ RG_UNPACK_LONG_BSR(longBsr,mBuf,ret); if(ret != ROK) { - RLOG1(L_ERROR,"Unpacking of Long BSR failed LCID:%d",lcId); + DU_LOG("\nERROR --> MAC : Unpacking of Long BSR failed LCID:%d",lcId); err->errCause = RGERR_DUX_UNPACK_FAILURE; - RETVALUE(RFAILED); + return RFAILED; } RG_EXT_BS(longBsr, ceInfo->ces.bsr.longBsr.bs1, @@ -471,19 +388,19 @@ RgErrInfo *err; RG_UNPACK_CRNTI(&ceInfo->ces.cRnti,mBuf,ret); if(ret != ROK) { - RLOG1(L_ERROR,"Unpacking of C-RNTI failed LCID:%d",lcId); + DU_LOG("\nERROR --> MAC : Unpacking of C-RNTI failed LCID:%d",lcId); err->errCause = RGERR_DUX_UNPACK_FAILURE; - RETVALUE(RFAILED); + return RFAILED; } ceInfo->bitMask |= RG_CRNTI_CE_PRSNT; } break; default: - RLOG1(L_ERROR, "Invalid LCID:%u received",lcId); + DU_LOG("\nERROR --> MAC : Invalid LCID:%u received",lcId); err->errCause = RGERR_DUX_INV_LCID_RX; - RETVALUE(RFAILED); + return RFAILED; } - RETVALUE(ROK); + return ROK; } /* rgDUXExtCe */ @@ -510,34 +427,14 @@ RgErrInfo *err; * -# ROK * -# RFAILED **/ -#ifdef ANSI -PRIVATE S16 rgDUXExtSdu -( -Inst inst, -RgMacPdu *pdu, -RgInfCeInfo *ceInfo, -Buffer **mBuf, -U8 lcId, -U16 subPduLen, -RgErrInfo *err -) -#else -PRIVATE S16 rgDUXExtSdu(inst,pdu, ceInfo,mBuf,lcId,subPduLen,err) -Inst inst; -RgMacPdu *pdu; -RgInfCeInfo *ceInfo; -Buffer **mBuf; -U8 lcId; -U16 subPduLen; -RgErrInfo *err; -#endif +static S16 rgDUXExtSdu(Inst inst, RgMacPdu *pdu, RgInfCeInfo *ceInfo, Buffer **mBuf, uint8_t lcId, uint16_t subPduLen,\ +RgErrInfo *err) { S16 ret; Buffer *tmpBuf1; Buffer *tmpBuf2 = NULLP; RgMacSdu *sdu; - TRC2(rgDUXExtSdu) if(lcId == RG_CCCH_LCID) { @@ -547,7 +444,7 @@ RgErrInfo *err; if(rgDUXInsSdu(inst,pdu, &sdu,lcId, subPduLen, err) != ROK) { RG_FREE_MSG(*mBuf); - RETVALUE(RFAILED); + return RFAILED; } tmpBuf1 = *mBuf; @@ -556,14 +453,14 @@ RgErrInfo *err; if((ret != ROK) && (!((ret == ROKDNA) ))) { RG_FREE_MSG(tmpBuf1); - RLOG0(L_ERROR,"SSegMsg failed"); + DU_LOG("\nERROR --> MAC : SSegMsg failed"); err->errCause = RGERR_DUX_RLC_PDU_CREAT_FAIL; - RETVALUE(RFAILED); + return RFAILED; } sdu->mBuf = tmpBuf1; *mBuf = tmpBuf2; } - RETVALUE(ROK); + return ROK; } /* rgDUXExtSdu */ /** @@ -588,28 +485,11 @@ RgErrInfo *err; * -# ROK * -# RFAILED **/ -#ifdef ANSI -PUBLIC S16 rgDUXDemuxData -( -Inst inst, -RgMacPdu *pdu, -RgInfCeInfo *ceInfo, -Buffer **mBuf, -RgErrInfo *err -) -#else -PUBLIC S16 rgDUXDemuxData(inst,pdu, ceInfo, mBuf, err) -Inst inst; -RgMacPdu *pdu; -RgInfCeInfo *ceInfo; -Buffer **mBuf; -RgErrInfo *err; -#endif +S16 rgDUXDemuxData(Inst inst, RgMacPdu *pdu, RgInfCeInfo *ceInfo, Buffer **mBuf, RgErrInfo *err) { - U8 lcId; - U16 subPduLen; + uint8_t lcId; + uint16_t subPduLen; MsgLen len; - TRC2(rgDUXDemuxData) ceInfo->bitMask = 0x0000; @@ -618,8 +498,8 @@ RgErrInfo *err; if(*mBuf == NULLP) { - RLOG0(L_ERROR, "Null Buffer Recevived"); - RETVALUE(RFAILED); + DU_LOG("\nERROR --> MAC : Null Buffer Recevived"); + return RFAILED; } do { @@ -630,13 +510,13 @@ RgErrInfo *err; &subPduLen, err) != ROK) { RG_FREE_MSG(*mBuf); - RLOG0(L_ERROR, "Failed to extract pad sub headers"); - RETVALUE(RFAILED); + DU_LOG("\nERROR --> MAC : Failed to extract pad sub headers"); + return RFAILED; } if(lcId == RG_PAD_LCID) { /*at end of MAC PDU, Padding started */ RG_FREE_MSG(*mBuf); - RETVALUE(ROK); + return ROK; } if(lcId <= RG_DEDLC_MAX_LCID) { @@ -646,12 +526,12 @@ RgErrInfo *err; /* Fix : syed rgDUXExtSdu would have segmented mBuf and hence * will be responsible for freeing mBuf */ *mBuf = NULLP; - RLOG0(L_ERROR, "failed to Extract the sdus"); - RETVALUE(RFAILED); + DU_LOG("\nERROR --> MAC : failed to Extract the sdus"); + return RFAILED; } if(*mBuf == NULLP) /* if message read completes then return */ { - RETVALUE(ROK); + return ROK; } } else @@ -660,21 +540,21 @@ RgErrInfo *err; if(rgDUXExtCe(inst,pdu,ceInfo,*mBuf, lcId,subPduLen, err) != ROK) { RG_FREE_MSG(*mBuf); - RLOG0(L_ERROR, " failed to Extract the ces"); - RETVALUE(RFAILED); + DU_LOG("\nERROR --> MAC : failed to Extract the ces"); + return RFAILED; } } if(SFndLenMsg(*mBuf,&len) != ROK) { RG_FREE_MSG(*mBuf); - RLOG0(L_ERROR,"mBuf length check failed"); + DU_LOG("\nERROR --> MAC : mBuf length check failed"); err->errCause = RGERR_DUX_UNPACK_FAILURE; - RETVALUE(RFAILED); + return RFAILED; } }while(len); RG_FREE_MSG(*mBuf); - RETVALUE(ROK); + return ROK; } /* rgDUXDemuxData */ /**********************************************************************