From 069ae37558afd5aee2d1072bbf5b517cf665bdd8 Mon Sep 17 00:00:00 2001 From: Balaji Shankaran Date: Thu, 7 May 2020 16:56:15 +0530 Subject: [PATCH] Slot indication from MAC to DU APP : LWLC fix and LC Change-Id: I5ec48c09bd20ed498afc161bb5833ba1b35cef04 Signed-off-by: Balaji Shankaran --- src/5gnrmac/lwr_mac_fsm.c | 12 ++++++------ src/5gnrmac/lwr_mac_fsm.h | 1 + src/5gnrmac/rg.h | 28 +++++++++++++++++++++++++- src/5gnrmac/rg_lim.c | 17 +++++++++++----- src/cm/du_app_mac_inf.c | 50 ++++++++++++++++++++++++++++++++--------------- src/du_app/du_mgr.h | 20 ++++++++++++------- src/du_app/du_msg_hdl.c | 5 ++++- 7 files changed, 97 insertions(+), 36 deletions(-) diff --git a/src/5gnrmac/lwr_mac_fsm.c b/src/5gnrmac/lwr_mac_fsm.c index 091b4928b..ba26c4027 100644 --- a/src/5gnrmac/lwr_mac_fsm.c +++ b/src/5gnrmac/lwr_mac_fsm.c @@ -2617,13 +2617,13 @@ uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg, uint32_t pduLen = 0; uint32_t *sib1TxdataValue = NULLP; - pduDesc->pduIndex = pduIndex; - pduDesc->numTlvs = 1; + pduDesc[pduIndex].pduIndex = pduIndex; + pduDesc[pduIndex].numTlvs = 1; /* fill the TLV */ /* as of now, memory is allocated from SSI, later WLS memory needs to be taken */ - pduDesc->tlvs[0].tl.tag = 1; /* pointer to be sent */ - pduDesc->tlvs[0].tl.length = macCellCfg->sib1Cfg.sib1PduLen; + pduDesc[pduIndex].tlvs[0].tl.tag = 1; /* pointer to be sent */ + pduDesc[pduIndex].tlvs[0].tl.length = macCellCfg->sib1Cfg.sib1PduLen; LWR_MAC_ALLOC(sib1TxdataValue,macCellCfg->sib1Cfg.sib1PduLen); if(sib1TxdataValue == NULLP) { @@ -2631,12 +2631,12 @@ uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc,MacCellCfg *macCellCfg, } memcpy(sib1TxdataValue,macCellCfg->sib1Cfg.sib1Pdu, macCellCfg->sib1Cfg.sib1PduLen); - pduDesc->tlvs[0].value = sib1TxdataValue; + pduDesc[pduIndex].tlvs[0].value = sib1TxdataValue; /* The total length of the PDU description and PDU data */ pduLen += 8; /* size of PDU length 2 bytes, PDU index 2 bytes, numTLV 4 bytes */ pduLen += sizeof(fapi_uint32_tlv_t); /* only 1 TLV is present */ - pduDesc->pduLength = pduLen; + pduDesc[pduIndex].pduLength = pduLen; msgLen += pduLen; #ifndef INTEL_WLS diff --git a/src/5gnrmac/lwr_mac_fsm.h b/src/5gnrmac/lwr_mac_fsm.h index 86eeb036c..7c8b0d85c 100644 --- a/src/5gnrmac/lwr_mac_fsm.h +++ b/src/5gnrmac/lwr_mac_fsm.h @@ -40,6 +40,7 @@ S16 lwr_mac_handleStopReqEvt(void *msg); void sendToLowerMac(U16, U32, void *); uint16_t handleDlTtiReq(CmLteTimingInfo *dlTtiReqtimingInfo); void handlePhyMessages(uint16_t msgType, uint32_t msgSize, void *msg); +S16 handleUlTtiReq(CmLteTimingInfo *currTimingInfo); typedef S16 (*lwrMacFsmHdlr)(void *); #endif diff --git a/src/5gnrmac/rg.h b/src/5gnrmac/rg.h index 545aaf2f3..2c0390066 100755 --- a/src/5gnrmac/rg.h +++ b/src/5gnrmac/rg.h @@ -244,7 +244,7 @@ U32 macHeader[2]; #define RG_MAX_DL_HARQ_NUM 8 #endif -#define MAC_MEM_REGION 4 +#define MAC_MEM_REGION 4 #define MAC_POOL 1 /* allocate and zero out a MAC static buffer */ #define MAC_ALLOC(_datPtr, _size) \ @@ -264,6 +264,32 @@ U32 macHeader[2]; SPutSBuf(MAC_MEM_REGION, MAC_POOL, \ (Data *)_datPtr, _size); +/* Allocate shared memory to be used for LWLC + * during inter-layer communication */ +#define MAC_ALLOC_SHRABL_BUF(_buf, _size) \ +{ \ + if(SGetStaticBuffer(MAC_MEM_REGION, MAC_POOL, \ + (Data **)&_buf, (Size) _size, 0) == ROK) \ + { \ + cmMemset((U8 *)(_buf), 0, _size); \ + } \ + else \ + { \ + (_buf) = NULLP; \ + } \ +} + +/* Free shared memory, received through LWLC */ +#define MAC_FREE_SHRABL_BUF(_region, _pool,_buf, _size) \ +{ \ + if (_buf != NULLP) \ + { \ + (Void) SPutStaticBuffer(_region, _pool, \ + (Data *) _buf, (Size) _size, 0); \ + _buf = NULLP; \ + } \ +} + /* Free shared memory, received through LWLC */ #define MAC_FREE_MEM(_region, _pool, _datPtr, _size) \ if(_datPtr) \ diff --git a/src/5gnrmac/rg_lim.c b/src/5gnrmac/rg_lim.c index 424180b41..6c7582e47 100755 --- a/src/5gnrmac/rg_lim.c +++ b/src/5gnrmac/rg_lim.c @@ -700,10 +700,11 @@ int sendSlotIndMacToSch(SlotIndInfo *slotInd) int sendSlotIndMacToDuApp(SlotIndInfo *slotInd) { Pst pst; + uint16_t ret; SlotInfo *slotInfo; - - /* Send Slot Indication to DU APP */ - MAC_ALLOC(slotInfo, sizeof(SlotInfo)); + + /* Allocate sharable memory */ + MAC_ALLOC_SHRABL_BUF(slotInfo, sizeof(SlotInfo)); if(!slotInfo) { DU_LOG("\nMAC : Slot Indication memory allocation failed"); @@ -729,8 +730,14 @@ int sendSlotIndMacToDuApp(SlotIndInfo *slotInd) pst.prior = 0; pst.intfVer = 0; - return MacDuAppSlotInd(&pst, slotInfo); - + ret = MacDuAppSlotInd(&pst, slotInfo); + 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(SlotInfo)); + } + + return ret; } /** diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index 57068bbd4..51c46c819 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -376,28 +376,34 @@ uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf) * ****************************************************************/ uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo ) { - if(pst->selector == DU_SELECTOR_LC || pst->selector == DU_SELECTOR_TC) + Buffer *mBuf = NULLP; + + if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) { - /* Loose coupling not supported */ - DU_LOG("\nDU APP : Only LWLC supported"); + DU_LOG("\nDU APP : Memory allocation failed for cell start req pack"); return RFAILED; } - else if(pst->selector == DU_SELECTOR_LWLC) + + if(pst->selector == DU_SELECTOR_LC) { - Buffer *mBuf = NULLP; + CMCHKPK(SPkU16, slotInfo->cellId, mBuf); + CMCHKPK(SPkU16, slotInfo->sfn, mBuf); + CMCHKPK(SPkU16, slotInfo->slot, mBuf); - if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) - { - DU_LOG("\nDU APP : Memory allocation failed for cell start req pack"); - return RFAILED; - } - + SPutStaticBuffer(pst->region, pst->pool, slotInfo, sizeof(SlotInfo), 0); + slotInfo = NULL; + } + else if(pst->selector == DU_SELECTOR_LWLC) + { /* pack the address of the structure */ CMCHKPK(cmPkPtr,(PTR)slotInfo, mBuf); - - return SPstTsk(pst,mBuf); } - return ROK; + else + { + SPutMsg(mBuf); + } + + return SPstTsk(pst,mBuf); } /******************************************************************* @@ -420,15 +426,27 @@ uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo ) * ****************************************************************/ uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf) { - SlotInfo *slotInfo; - if(pst->selector == DU_SELECTOR_LWLC) { + SlotInfo *slotInfo; + /* unpack the address of the structure */ CMCHKUNPK(cmUnpkPtr, (PTR *)&slotInfo, mBuf); SPutMsg(mBuf); return (*func)(pst, slotInfo); } + else if(pst->selector == DU_SELECTOR_LC) + { + SlotInfo slotInfo; + + CMCHKUNPK(SUnpkU16, &(slotInfo.slot), mBuf); + CMCHKUNPK(SUnpkU16, &(slotInfo.sfn), mBuf); + CMCHKUNPK(SUnpkU16, &(slotInfo.cellId), mBuf); + + SPutMsg(mBuf); + return (*func)(pst, &slotInfo); + + } else { /* Nothing to do for loose coupling */ diff --git a/src/du_app/du_mgr.h b/src/du_app/du_mgr.h index a05e7c778..d2d8c7bcd 100644 --- a/src/du_app/du_mgr.h +++ b/src/du_app/du_mgr.h @@ -58,9 +58,9 @@ #define DU_PROC 0 /* Memory related configs */ #define DU_APP_MEM_REGION 0 -#define RLC_UL_MEM_REGION 1 -#define RLC_DL_MEM_REGION 4 -#define MAC_MEM_REGION 4 +#define RLC_UL_MEM_REGION 1 +#define RLC_DL_MEM_REGION 4 +#define MAC_MEM_REGION 4 #define DU_POOL 1 #define RLC_POOL 1 @@ -140,10 +140,16 @@ (Data *)_datPtr, _size); /* Free shared memory, received through LWLC */ -#define DU_FREE_MEM(_region, _pool, _datPtr, _size) \ - if(_datPtr) \ - SPutSBuf(_region, _pool,(Data *)_datPtr, _size); \ - _datPtr = NULL; +#define DU_FREE_SHRABL_BUF(_region, _pool,_buf, _size) \ +{ \ + if (_buf != NULLP) \ + { \ + (Void) SPutStaticBuffer(_region, _pool, \ + (Data *) _buf, (Size) _size, 0); \ + _buf = NULLP; \ + } \ +} + typedef enum { diff --git a/src/du_app/du_msg_hdl.c b/src/du_app/du_msg_hdl.c index 0e61f39f1..a0f040e47 100644 --- a/src/du_app/du_msg_hdl.c +++ b/src/du_app/du_msg_hdl.c @@ -1666,7 +1666,10 @@ uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo) #ifdef EGTP_TEST duSendEgtpSlotInd(); #endif - DU_FREE_MEM(MAC_MEM_REGION, pst->pool, slotInfo, sizeof(SlotInfo)); + + if((pst->selector == DU_SELECTOR_LWLC) || (pst->selector == DU_SELECTOR_TC)) + DU_FREE_SHRABL_BUF(MAC_MEM_REGION, pst->pool, slotInfo, sizeof(SlotInfo)); + return ROK; } -- 2.16.6