Slot indication from MAC to DU APP : LWLC fix and LC 14/3614/2
authorBalaji Shankaran <balaji.shankaran@radisys.com>
Thu, 7 May 2020 11:26:15 +0000 (16:56 +0530)
committerBalaji Shankaran <balaji.shankaran@radisys.com>
Mon, 11 May 2020 12:26:40 +0000 (17:56 +0530)
Change-Id: I5ec48c09bd20ed498afc161bb5833ba1b35cef04
Signed-off-by: Balaji Shankaran <balaji.shankaran@radisys.com>
src/5gnrmac/lwr_mac_fsm.c
src/5gnrmac/lwr_mac_fsm.h
src/5gnrmac/rg.h
src/5gnrmac/rg_lim.c
src/cm/du_app_mac_inf.c
src/du_app/du_mgr.h
src/du_app/du_msg_hdl.c

index 091b492..ba26c40 100644 (file)
@@ -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   
index 86eeb03..7c8b0d8 100644 (file)
@@ -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
index 545aaf2..2c03900 100755 (executable)
@@ -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)                                               \
index 424180b..6c7582e 100755 (executable)
@@ -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;
 }
 
 /**
index 57068bb..51c46c8 100644 (file)
@@ -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 */
index a05e7c7..d2d8c7b 100644 (file)
@@ -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
          (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
 {
index 0e61f39..a0f040e 100644 (file)
@@ -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;
 }