RLC DL UMD PDU changes [Issue-ID: ODUHIGH-271] 01/5401/11
authorlal.harshita <harshita.lal@radisys.com>
Mon, 11 Jan 2021 15:29:01 +0000 (20:59 +0530)
committerlal.harshita <harshita.lal@radisys.com>
Wed, 17 Feb 2021 08:53:27 +0000 (14:23 +0530)
Change-Id: I5cc024031863298b0f28710a0a39d63e34d94cf8
Signed-off-by: lal.harshita <harshita.lal@radisys.com>
15 files changed:
src/5gnrmac/lwr_mac_fsm.c
src/5gnrmac/mac.h
src/5gnrmac/mac_msg_hdl.c
src/5gnrmac/mac_mux.c
src/5gnrrlc/kw.h
src/5gnrrlc/kw.x
src/5gnrrlc/kw_dl.x
src/5gnrrlc/kw_uim.c
src/5gnrrlc/kw_umm_dl.c
src/5gnrrlc/kw_utl_dl.c
src/cm/du_app_rlc_inf.h
src/cm/rlc_mac_inf.h
src/cu_stub/cu_stub_egtp.c
src/du_app/du_egtp.c
src/du_app/du_ue_mgr.c

index 4ae21cc..cbf14be 100644 (file)
@@ -3328,7 +3328,6 @@ uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo)
       macCellCfg = macCb.macCell[cellIdx]->macCellCfg;
 
       currDlSlot = &macCb.macCell[cellIdx]->dlSlot[dlTtiReqTimingInfo.slot]; 
-      nPdu = calcDlTtiReqPduCount(&currDlSlot->dlInfo);
 
       LWR_MAC_ALLOC(dlTtiElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_dl_tti_req_t)));
       if(dlTtiElem)
@@ -3360,7 +3359,6 @@ uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo)
         dlTtiReq->nPdus = calcDlTtiReqPduCount(&currDlSlot->dlInfo);  /* get total Pdus */
         nPdu = dlTtiReq->nPdus;
         dlTtiReq->nGroup = 0;
-
         if(dlTtiReq->nPdus > 0)
         {
            if(currDlSlot->dlInfo.isBroadcastPres)
index 54a5438..6c27527 100644 (file)
@@ -21,7 +21,7 @@
 /* MAX values */
 #define MAX_MAC_CE 6
 #define MAX_CRI_SIZE 6
-#define MAX_MAC_DL_PDU 10
+#define MAX_MAC_DL_PDU 16
 #define MAX_NUM_HARQ_PROC  16
 #define MAX_SLOT_SUPPORTED    10 /* numerology 0 15Khz */
 #define MAX_ZERO_CORR_CFG_IDX 16 /* max zero correlation config index */
index f18c9d4..7966445 100644 (file)
@@ -210,15 +210,17 @@ uint8_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd)
  * ****************************************************************/
 uint8_t MacProcRlcDlData(Pst* pstInfo, RlcData *dlData)
 {
-   uint8_t   pduIdx =0;
-   uint8_t   *txPdu =NULLP;
-   uint16_t  tbSize =0;
-   MacDlData macDlData;
-   MacDlSlot *currDlSlot = NULLP;
+   uint8_t    pduIdx =0;
+   uint8_t    lcIdx = 0;
+   uint8_t    *txPdu =NULLP;
+   uint16_t   tbSize =0;
+   MacDlData  macDlData;
+   MacDlSlot  *currDlSlot = NULLP;
+   DlRlcBoInfo  dlBoInfo;
   
    memset(&macDlData , 0, sizeof(MacDlData));
-   DU_LOG("\nDEBUG  -->  MAC: Received DL data for sfn=%d slot=%d", \
-      dlData->slotInfo.sfn, dlData->slotInfo.slot);
+   DU_LOG("\nDEBUG  -->  MAC: Received DL data for sfn=%d slot=%d numPdu= %d", \
+      dlData->slotInfo.sfn, dlData->slotInfo.slot, dlData->numPdu);
    /* Copy the pdus to be muxed into mac Dl data */
    macDlData.numPdu = dlData->numPdu;
    for(pduIdx = 0;  pduIdx < dlData->numPdu; pduIdx++)
@@ -248,6 +250,19 @@ uint8_t MacProcRlcDlData(Pst* pstInfo, RlcData *dlData)
       }
    }
 
+   for(lcIdx = 0; lcIdx < dlData->numLc; lcIdx++)
+   {
+      if(dlData->boStatus[lcIdx].bo)
+      {
+         memset(&dlBoInfo, 0, sizeof(DlRlcBoInfo));
+         dlBoInfo.cellId = dlData->boStatus[lcIdx].cellId;
+         GET_CRNTI(dlBoInfo.crnti, dlData->boStatus[lcIdx].ueIdx);
+         dlBoInfo.lcId = dlData->boStatus[lcIdx].lcId;
+         dlBoInfo.dataVolume = dlData->boStatus[lcIdx].bo;
+         sendDlRlcBoInfoToSch(&dlBoInfo);
+      }
+   }
+
    /* Free memory */
    for(pduIdx = 0; pduIdx < dlData->numPdu; pduIdx++)
    {
index 153db75..18167d7 100644 (file)
@@ -42,7 +42,7 @@
  * @return void
  *
  * ****************************************************************/
-void packBytes(uint8_t *buf, uint8_t *bytePos, uint8_t *bitPos, uint32_t val, uint8_t valSize)
+void packBytes(uint8_t *buf, uint16_t *bytePos, uint8_t *bitPos, uint32_t val, uint8_t valSize)
 {
    uint32_t  temp;
    uint8_t   bytePart1;
@@ -99,7 +99,7 @@ void fillRarPdu(RarInfo *rarInfo)
    uint8_t   *rarPdu = rarInfo->rarPdu;
    uint16_t  totalBits = 0;
    uint8_t   numBytes = 0;
-   uint8_t   bytePos= 0;
+   uint16_t  bytePos= 0;
    uint8_t   bitPos = 0;
 
    /* RAR subheader fields */
@@ -278,7 +278,7 @@ void fillMacCe(MacCeInfo *macCeInfo, uint8_t *msg3Pdu)
 
 void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *txPdu, uint16_t tbSize)
 {
-   uint8_t bytePos = 0;
+   uint16_t bytePos = 0;
    uint8_t bitPos = 7;
    uint8_t idx = 0;
    uint8_t macPdu[tbSize];
@@ -356,7 +356,6 @@ void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *txPdu, uint16_t
            DU_LOG("\nERROR  -->  MAC: Invalid LCID %d in mac pdu",lcid);
            break;
       }
-
    }
    if(bytePos < tbSize && (tbSize-bytePos >= 1))
    {
index d57dd95..ac1e620 100755 (executable)
 
 /* Each LI(Length Indicator) holds approx 1+1/2 byte and some other fields thus keeping Header Size equal to twice of MAX LI */
 /* 5GNR_RLC: Need to change value of HDRSZ as per number of PDUs going in one datReq */
+#define RLC_MIN_HDRSZ                         1
 #define RLC_MAX_HDRSZ                         5 
 #define RLC_AM_PDU_FIXED_HDRSZ                2
 #define RLC_AM_PDU_12BIT_SN_HDRSZ             2
index fb098d7..95b2ecf 100755 (executable)
@@ -96,7 +96,6 @@ typedef struct rlcSduSnMap RlcSduSnMap;
 typedef RguLchMapInfo KwLchMapInfo;
 #endif /*  LTE_L2_MEAS */
 
-
 /** @defgroup ummode UM Module Info 
 */
 /** 
@@ -114,7 +113,6 @@ typedef struct rlcUmHdr
    uint16_t    so;              /*!< Segmentation offset */
 }RlcUmHdr;
 
-
 /** 
  * @brief  Structure to hold an Acknowledged Mode header
  *
index 6636644..2d9f806 100755 (executable)
@@ -151,9 +151,9 @@ typedef struct rlcTm
 */
 typedef struct rlcBoRep
 {
-   S32      bo;            /*!< Buffer occupancy */
+   int32_t  bo;            /*!< Buffer occupancy */
    uint16_t estHdrSz;      /*!< Estimated header size for the bo */
-   Bool     staPduPrsnt;   /*!< Indicate control bo present or not */
+   bool     staPduPrsnt;   /*!< Indicate control bo present or not */
    uint32_t staPduBo;     /*!< Indicate bo for control PDU */
    uint32_t oldestSduArrTime;
 } RlcBoRep;
@@ -192,25 +192,18 @@ typedef struct rlcDatReq
  *                    as 1 for 5 bit sequence numbers and 
  *                    2 for 10 bit sequence numbers
  *    - bo          : Current buffer occupancy for this RB
- *    - estHdrSz    : Estimated size of headers required to send 
- *                    all the SDUs in the queue
- *    - vtUs        : VT(US)
+ *    - TX_Next     : SN to be allocated to next SDU
  *    - modBitMask  : Bitmask used to do modulus operations to wrap around 
- *                    state variables, value is 0x1f or 
- *                    0x3ff for 5-bit and 10-bit sequence numbers respectively
- *    - numLi       : Number of length indicators to be sent in the next pdu
- *    - li          : Values of the lenght indicators
+ *                    state variables, value is 0x3f or 
+ *                    0xfff for 6-bit and 12-bit sequence numbers respectively
 */
 typedef struct rlcUmDl
 {
    CmLListCp   sduQ;            /*!< SDU queue for UM */
    uint8_t     snLen;           /*!< Sequence number length */
    S32         bo;              /*!< Buffer occupancy */
-   S32         estHdrSz;        /*!< Estimated header size for BO */
-   RlcSn       vtUs;            /*!< VT(US) */
+   RlcSn       txNext;          /*!< TX_Next */
    uint16_t    modBitMask;      /*!< Bitmask for modulus to wrap around vars*/   
-   uint16_t    numLi;           /*!< Number of LIs */
-   uint16_t    li[RLC_MAX_LI];   /*!< Length Indicator array */
 }RlcUmDl;
 
 /** 
@@ -725,7 +718,7 @@ Void rlcUtlRemovTxBuf ARGS ((CmLListCp      *txBufLst,
 uint8_t rlcUtlSendDedLcBoStatus ARGS ((RlcCb *gCb,
                                   RlcDlRbCb *rbCb,
                                   int32_t bo,
-                                  int32_t estHdrSz,
+                                 int32_t estHdrSz,
                                   bool staPduPrsnt,
                                   uint32_t staPduBo));
 
@@ -735,11 +728,6 @@ Void rlcUtlEmptySduQ ARGS ((RlcCb *gCb, RlcDlRbCb *rbCb, CmLListCp *sduQ));
 Void rlcUtlEmptySduQ ARGS ((RlcCb *gCb,CmLListCp *sduQ));
 #endif /* LTE_L2_MEAS */
 
-Void rlcUtlCalcLiForSdu ARGS ((RlcCb *gCb,
-                                     uint16_t numLi, 
-                                     MsgLen msgLen,
-                                     S16 *pduSz));
-
 uint8_t rlcUtlSendToMac ARGS ((RlcCb *gCb, SuId suId, KwDStaIndInfo *staIndInfo));
 
 Void rlcUtlIncrementKwuStsSduTx ARGS((RlcKwuSapCb *rlckwuSap));
index 9fab144..c9e9e82 100755 (executable)
@@ -760,7 +760,6 @@ uint8_t rlcProcDlData(Pst *pst, KwuDatReqInfo *datReq, Buffer *mBuf)
       case RLC_MODE_UM:
       {
          rlcUmmQSdu(tRlcCb,rbCb, datReq, mBuf);
-
          break;
       }
       case RLC_MODE_AM:
index 8c35e73..dad725d 100755 (executable)
@@ -75,12 +75,10 @@ uint32_t buffer_occ;
 uint32_t dlrate_kwu;
 #endif
 
-static void rlcUmmEstHdrSz ARGS ((RlcUmDl *umUl));
-
 static Void rlcUmmCreatePdu ARGS ((RlcCb *gCb,
                                   RlcDlRbCb *rbCb, 
                                   Buffer *pdu,
-                                  uint8_t fi,
+                                  RlcUmHdr *umHdr,
                                   KwPduInfo *datReqPduInfo));
 
 /** @addtogroup ummode */
@@ -142,15 +140,13 @@ void rlcUmmQSdu(RlcCb *gCb, RlcDlRbCb *rbCb, KwuDatReqInfo *datReq, Buffer *mBuf
 #endif
 #endif
    rbCb->m.umDl.bo += len;
-   
+   rbCb->m.umDl.bo += RLC_MAX_HDRSZ;
    cmLListAdd2Tail(&(rbCb->m.umDl.sduQ), &sdu->lstEnt);
    sdu->lstEnt.node = (PTR)sdu;
-   
-   rlcUmmEstHdrSz(&rbCb->m.umDl);
 
    if(!rlcDlUtlIsReestInProgress(rbCb))
    {
-      rlcUtlSendDedLcBoStatus(gCb,rbCb,rbCb->m.umDl.bo,rbCb->m.umDl.estHdrSz,FALSE,0);
+      rlcUtlSendDedLcBoStatus(gCb, rbCb, rbCb->m.umDl.bo, 0, FALSE,0);
    }
    
    /* kw005.201 added support for L2 Measurement */
@@ -188,10 +184,14 @@ void rlcUmmQSdu(RlcCb *gCb, RlcDlRbCb *rbCb, KwuDatReqInfo *datReq, Buffer *mBuf
 void rlcUmmProcessSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *datReq)
 {
    CmLList     *firstNode;   /* First Node in SDU queue */
-   uint8_t      fi=0;           /* Framing Info */
    Buffer      *pdu;         /* Buffer for holding the formed PDU */
    KwPduInfo   *pduInfo;     /* PDU Info pointer */
    int16_t     pduSz;        /* PDU Size to be constructed */
+   RlcUmHdr    umHdr;        /* Header */
+   uint32_t    rlcHdrSz;
+   uint32_t    rlcSduSz;
+   uint32_t    rlcPduSz;
+   uint32_t    macHdrSz;
    
    /* kw005.201 added support for L2 Measurement */
 #ifdef LTE_L2_MEAS
@@ -210,7 +210,6 @@ void rlcUmmProcessSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *datReq)
    RlcSdu                *sdu;
 
    pdu = NULLP;
-
    pduInfo = &(datReq->pduInfo);
    pduSz = datReq->pduSz;
    
@@ -226,8 +225,7 @@ void rlcUmmProcessSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *datReq)
    rlcUtlGetCurrTime(&curTime);
 
    /* ccpu00143043 */
-   while ((pduSz > 0) && (rbCb->m.umDl.sduQ.count > 0) &&
-           (rbCb->m.umDl.numLi < RLC_MAX_DL_LI) && (pduInfo->numPdu < RLC_MAX_PDU))
+   while ((pduSz > 0) && (rbCb->m.umDl.sduQ.count > 0) && (pduInfo->numPdu < RLC_MAX_PDU))
    {
       CM_LLIST_FIRST_NODE(&rbCb->m.umDl.sduQ,firstNode);
       sdu = (RlcSdu *)(firstNode->node);
@@ -247,63 +245,74 @@ void rlcUmmProcessSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *datReq)
             continue;
          }
       }
-      /* When forming a new PDU, pdu == NULLP
-           -# Eliminate MAC header size for each pdu 
-           -# Initialize the li array to 0 
-           -# Substract the fixed header length based on SN length
-      */
 #ifdef LTE_L2_MEAS
       newIdx = FALSE;
 #endif
-      if (!pdu)
+      /* When forming a new PDU, pdu == NULLP
+           -# Eliminate MAC header size for each pdu
+           -# Substract the fixed header length based on SN length
+      */
+      /* account for the RLC header size
+         minimum header size will be 1 , if Sdu is not segmented */
+      rlcHdrSz = RLC_MIN_HDRSZ;
+      if(sdu->mode.um.isSegmented)
       {
-         RLC_RMV_MAC_HDR_SZ(pduSz);
+         /* value of rbCb->m.umDl.snLen will be 1 for 6 bit SN and 2 for 12 bit SN and 2 bytes of SO */
+         rlcHdrSz = (rbCb->m.umDl.snLen + 2);
+      }
+      macHdrSz = RLC_MAC_HDR_SZ2; /*Minimum MacHdr size */
+      rlcSduSz = sdu->sduSz;
+      rlcPduSz = ((rlcSduSz + rlcHdrSz) < (pduSz - macHdrSz))? (rlcSduSz + rlcHdrSz) : (pduSz - macHdrSz);
+      rlcSduSz = rlcPduSz - rlcHdrSz;
 
-         /* account for the RLC header size */
-         pduSz -= rbCb->m.umDl.snLen;
+      /*Estimate MAC Hdr based on calculated rlcPduSz */
+      macHdrSz = (rlcPduSz > 255 ) ? RLC_MAC_HDR_SZ3 : RLC_MAC_HDR_SZ2;
 
-         /* kw005.201 fixing pduSz <= 0 problem, ccpu00119417 */
-         if(pduSz <= 0)
-         {
-            break;
-         }         
-         
-         rbCb->m.umDl.numLi = 0;
-         if (sdu->mode.um.isSegmented == TRUE)
-         {
-            fi = 2;
-         }
-         else
-         {
-            fi = 0;
-         }
+      if(macHdrSz != RLC_MAC_HDR_SZ2)
+      {
+          rlcSduSz = sdu->sduSz;
+          rlcPduSz = ((rlcSduSz + rlcHdrSz) < (pduSz - macHdrSz))? (rlcSduSz + rlcHdrSz) : (pduSz - macHdrSz);
+          rlcSduSz = rlcPduSz - rlcHdrSz;
+          macHdrSz = (rlcPduSz > 255 ) ? RLC_MAC_HDR_SZ3 : RLC_MAC_HDR_SZ2;
+      }
+
+      if(sdu->mode.um.isSegmented == FALSE)
+      {
+          /* RLC SDU is estimated to be segmented first time */
+          if(rlcSduSz < sdu->sduSz)
+          {
+              rlcHdrSz = rbCb->m.umDl.snLen;
+              rlcSduSz = sdu->sduSz;
+              rlcPduSz = ((rlcSduSz + rlcHdrSz) < (pduSz - macHdrSz))? (rlcSduSz + rlcHdrSz) : (pduSz - macHdrSz);
+              rlcSduSz = rlcPduSz - rlcHdrSz;
+              /*Estimate MAC Hdr based on calculated rlcPduSz */
+              macHdrSz = (rlcPduSz > 255 ) ? RLC_MAC_HDR_SZ3 : RLC_MAC_HDR_SZ2;
+          }
       }
 
-      rlcUtlCalcLiForSdu(gCb,rbCb->m.umDl.numLi,sdu->sduSz,&pduSz);
+      pduSz -= (rlcHdrSz + macHdrSz);
+
+      if(pduSz <= 0)
+      {
+          break;
+      }
      
-      /* Exact fit scenario :
-         If the SDU size matches with the PDU size
-           -# Allocate memory equal to PDU size;
-           -# update BO
-           -# Remove SDu from queue
-           -# Append to already existing PDU portion if present .
-           -# Add Header and create complete PDU and place it in
-              pduInfo and return
-      */ 
-      if (sdu->sduSz == pduSz)
+      /* No Segmentation scenario :
+         If SDU size is less than or equal to the requested PDU size
+         -# Allocate memory and copy SDU into it.
+         -# Update BO
+         -# Remove SDU from the Queue.
+      */
+      if (sdu->sduSz <= pduSz)
       {
          if (!pdu)
          {
             pdu = sdu->mBuf;
             sdu->mBuf = NULLP;
          }
-         else
-         {
-            SCatMsg(pdu, sdu->mBuf, M1M2);    
-         }
-         
-         rbCb->m.umDl.bo -= pduSz;
-         pduSz = 0;
+         rbCb->m.umDl.bo -= sdu->sduSz;
+        rbCb->m.umDl.bo -= RLC_MAX_HDRSZ;
+         pduSz -= sdu->sduSz;
 
 #ifdef LTE_L2_MEAS
         if(RLC_MEAS_IS_DL_ANY_MEAS_ON_FOR_RB(gCb,rbCb))
@@ -343,97 +352,29 @@ void rlcUmmProcessSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *datReq)
              }
           }
 #endif /*  LTE_L2_MEAS */
-         RLC_RMV_SDU(gCb,&(rbCb->m.umDl.sduQ),sdu); /* kw003.201 */
-         rlcUtlIncrementKwuStsSduTx(gCb->u.dlCb->rlcKwuDlSap + rbCb->k1wuSapId);
 
-         rlcUmmCreatePdu(gCb,rbCb,pdu,fi,pduInfo);
-         pdu = NULLP;
-         
-      }
-      /* Concatenation scenario :
-         If SDU size is less than the requested PDU size
-           -# Allocate memory and copy SDU into it.
-           -# Update BO
-           -# Remove SDU from the Queue.
-           -# Append to already existing PDU portion if present .
-           -# If the SDU size is greater than 2047 or the number of i
-                 LIs reaches max, place it as a separate PDU in pduInfo and 
-                 set pdu to NULL
-              else 
-                 place the msglen in li array and continue with the next SDU.
-           -# If the number of PDUs is more than RLC_MAX_PDU, return from 
-              the function even if pduSize > 0.
-      */
-      else if (sdu->sduSz < pduSz)
-      {
-         if (!pdu)
+         if(sdu->mode.um.isSegmented)
          {
-            pdu = sdu->mBuf;
-            sdu->mBuf = NULLP;
+             umHdr.si = RLC_SI_LAST_SEG;
+             umHdr.so = sdu->actSz - sdu->sduSz;
+             sdu->mode.um.isSegmented = FALSE;
          }
          else
          {
-            ODU_CAT_MSG(pdu, sdu->mBuf ,M1M2);
-         }
-         rbCb->m.umDl.bo -= sdu->sduSz;
-
-         pduSz -= sdu->sduSz;
-/* kw005.201 added support for L2 Measurement */
-#ifdef LTE_L2_MEAS_RLC
-          rlcUtlUpdSduSnMap(rbCb, sdu, datReq, TRUE);
-#endif /*  LTE_L2_MEAS */
-         if (sdu->sduSz < 2048 && rbCb->m.umDl.numLi < RLC_MAX_DL_LI)
-         {
-            rbCb->m.umDl.li[(rbCb->m.umDl.numLi)++] = sdu->sduSz;
-         }
-         else 
-         {
-            rlcUmmCreatePdu(gCb, rbCb, pdu, fi, pduInfo);
-            pdu = NULLP;
-
-            if ( pduInfo->numPdu == RLC_MAX_PDU)
-            {
-                /* Could not transmit what MAC asked for because the number 
-                 * of PDUs to be transmitted has reached maximum. */
-               DU_LOG("\nERROR  -->  RLC DL: rlcUmmProcessSdus: Maximum Pdu limit has been reached\
-                 UEID:%d CELLID:%d", rbCb->rlcId.ueId, rbCb->rlcId.cellId);
-               break;
-            }
+              umHdr.si = 0;
+              umHdr.so = 0;
          }
-#ifdef LTE_L2_MEAS
-        if(RLC_MEAS_IS_DL_ANY_MEAS_ON_FOR_RB(gCb,rbCb) )
-        {
-           if(sdu->mode.um.isSegmented)
-           {
-              *sduIdx    = dlIpThPut->lastSduIdx;
-           }
-           else
-           {
-              RLC_GETSDUIDX(*sduIdx);
-              newIdx = TRUE;
-           }
-           rlcUtlUpdateContainedSduLst(*sduIdx, &contSduLst);
-           rlcUtlUpdateOutStandingSduLst(dlIpThPut, *sduIdx, sdu->actSz, 
-                 sdu->mode.um.sduId, newIdx);
-           /* ccpu00143043 */
-           if ( lchInfo.numSdus < RLC_L2MEAS_SDUIDX)
-           {
-              lchInfo.sduInfo[lchInfo.numSdus].arvlTime = sdu->arrTime; 
-              lchInfo.sduInfo[lchInfo.numSdus].isRetxPdu = FALSE;
-              lchInfo.numSdus++;
-           }
-        }
-#endif
-         RLC_RMV_SDU(gCb,&(rbCb->m.umDl.sduQ),sdu);
-         /* kw005.201 ccpu00117318, updating the statistics */
-         rlcUtlIncrementKwuStsSduTx(gCb->u.dlCb->rlcKwuDlSap + rbCb->k1wuSapId);         
+         rlcUmmCreatePdu(gCb, rbCb, pdu, &umHdr, pduInfo);
+         RLC_RMV_SDU(gCb,&(rbCb->m.umDl.sduQ),sdu); /* kw003.201 */
+         rlcUtlIncrementKwuStsSduTx(gCb->u.dlCb->rlcKwuDlSap + rbCb->k1wuSapId);
+         pdu = NULLP;
       }
       /* Segmentation scenario :
          If size of SDU is greater than PDU size 
            -# Allocate memory and Segment the Sdu.
            -# Update BO
-           -# Append to already existing PDU if any.
-           -# Set the second bit of the framing info.
+           -# Add segment to the PDU
+           -# Set the second bit of the segmentation info.
            -# Create the complete PDU and place in pduInfo.
       */ 
       else 
@@ -466,29 +407,29 @@ void rlcUmmProcessSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *datReq)
            }
         }
 #endif
-         if (!pdu)
+         if(sdu->mode.um.isSegmented)
          {
-            pdu = sdu->mBuf;
+            umHdr.si = RLC_SI_MID_SEG;
+            umHdr.so = sdu->actSz - sdu->sduSz;
          }
-         else 
+         else
          {
-            ODU_CAT_MSG(pdu, sdu->mBuf, M1M2);
-            ODU_PUT_MSG_BUF(sdu->mBuf);
+            umHdr.si = RLC_SI_FIRST_SEG;
+            umHdr.so = 0;
+            sdu->mode.um.isSegmented = TRUE;
          }
+        pdu = sdu->mBuf;
+        sdu->sduSz -= pduSz;
+        rbCb->m.umDl.bo -= pduSz;
+        sdu->mBuf = remSdu;
+        pduSz = 0;
 
-         sdu->sduSz -= pduSz;
-         rbCb->m.umDl.bo -= pduSz;
-         sdu->mode.um.isSegmented = TRUE;
-         sdu->mBuf = remSdu;
-         pduSz = 0;
-         
-         fi |= 1;
 /* kw005.201 added support for L2 Measurement */
 #ifdef LTE_L2_MEAS_RLC
          rlcUtlUpdSduSnMap(rbCb, sdu, datReq, FALSE);
 #endif /*  LTE_L2_MEAS */
 
-         rlcUmmCreatePdu(gCb,rbCb,pdu,fi,pduInfo);
+         rlcUmmCreatePdu(gCb, rbCb, pdu, &umHdr, pduInfo);
          pdu = NULLP;
       }
 /* kw005.201 added support for L2 Measurement */
@@ -523,27 +464,8 @@ void rlcUmmProcessSdus(RlcCb *gCb, RlcDlRbCb *rbCb, RlcDatReq *datReq)
    *totMacGrant -= (oldBo - rbCb->m.umDl.bo);
 #endif 
 
-   /* If we have a situation wherein the size requested is greater than the total size of SDUs
-      and a pdu buffer which is not null, this if loop helps to send 
-      a non null PDU to the lower layer. 
-   */
-   if (pduSz > 0 && pdu)
-   {
-      if (pduInfo->numPdu != RLC_MAX_PDU)
-      {
-         rbCb->m.umDl.numLi--;         
-         rlcUmmCreatePdu(gCb,rbCb,pdu,fi,pduInfo);   
-         pdu = NULLP;
-      }
-      else
-      {
-         ODU_PUT_MSG_BUF(pdu);
-      }
-   }
-   
-   rlcUmmEstHdrSz(&rbCb->m.umDl);
    datReq->boRep.bo = rbCb->m.umDl.bo;
-   datReq->boRep.estHdrSz = rbCb->m.umDl.estHdrSz;
+   datReq->boRep.estHdrSz = 0;
    datReq->boRep.staPduPrsnt = FALSE;
    if (rbCb->m.umDl.sduQ.count > 0)
    {
@@ -577,7 +499,7 @@ Void rlcDlUmmReEstablish(RlcCb *gCb,CmLteRlcId rlcId,Bool sendReEst,RlcDlRbCb *r
 
    rlcUmmFreeDlRbCb(gCb, rbCb);
 
-   rbCb->m.umDl.vtUs = 0;
+   rbCb->m.umDl.txNext = 0;
 
    /* this would have been set when re-establishment was triggered
       for SRB 1 */
@@ -597,107 +519,51 @@ Void rlcDlUmmReEstablish(RlcCb *gCb,CmLteRlcId rlcId,Bool sendReEst,RlcDlRbCb *r
  * @param[in]     gCb            RLC instance control block
  * @param[in,out] rbCb           RB control block 
  * @param[in]     pdu            PDU  
- * @param[in]     fi             Framing Info field
+ * @param[in]     umHdr          UM mode header
  * @param[out]    datReqPduInfo  Holder in which to copy the created PDU pointer
  *
  * @return  Void
 */ 
-static void rlcUmmCreatePdu(RlcCb *gCb, RlcDlRbCb *rbCb, Buffer *pdu, uint8_t fi, KwPduInfo *datReqPduInfo)
+static void rlcUmmCreatePdu(RlcCb *gCb, RlcDlRbCb *rbCb, Buffer *pdu, RlcUmHdr *umHdr, KwPduInfo *datReqPduInfo)
 {
-   RlcSn     sn;        /*  Sequence Number */
-   uint32_t  liCount;   /*  LI count */
-   uint8_t   e = 0;     /* Extension Bit */
-   uint32_t  count;     /* Loop Counter */
-   uint32_t  hdrSz;
-
-   /* create a big array to store the header, assuming 3 bytes per 2 L1s 
-    * (2 bytes if only a single LI) and 2 bytes for the 
-    *  FI and SN
-    * size of header = ( NumLi /2 ) * 3 + (NumLi % 2) * 2 + 2;
-    * where NumLi = Number of Length Indicators to be sent
-   */
-   uint8_t hdr[((RLC_MAX_DL_LI >> 1) * 3) + ((RLC_MAX_DL_LI & 0x01) << 1) + 2];
-   uint32_t idx = 0; /* To index to the hdr array */
+   RlcSn     sn;                   /*  Sequence Number */
+   uint8_t   hdr[RLC_MAX_HDRSZ];   /* Stores header */
+   uint32_t  idx = 0;              /* To index to the hdr array */
    
-   /* Note: idx is not checked against crossing the hdr array bound as 
-    * liCount will be < RLC_MAX_DL_LI and as per the size calculated above; 
-    * idx cannot cross the array
-    */
-
    /* stats updated before for bytes sent before adding RLC headers */
    rlcUtlIncrementGenStsBytesAndPdusSent(&gCb->genSts, pdu);
          
-   sn = rbCb->m.umDl.vtUs;
-   liCount = rbCb->m.umDl.numLi;
-   
-   if(liCount > RLC_MAX_DL_LI)
-      liCount = RLC_MAX_DL_LI;
-
-   /* if there are any LI's then set the first E bit */
-   if(liCount)
-   {
-      e = 1;
-   }
-   
-   if (rbCb->m.umDl.snLen == 1) 
-   {
-      hdr[idx++] = (fi << 6) | (e << 5) | sn;
-   }
-   else /* SN length is 2 */
+   /* If SI = 0, 1 byte header conatining SI/R */
+   if(umHdr->si == 0)
    {
-      /* SN length is 10 bits */
-      hdr[idx] = (fi << 3) | (e << 2) | (sn >> 8);
-      hdr[++idx] = sn & 0xff;
-      ++idx;
+      hdr[idx++] = 0;
    }
-
-   hdrSz = sizeof(hdr); 
-   for (count = 0;count < liCount;count++)
+   else
    {
-      /* In each iteration we try and encode 2 LIs */
-      /* if this is the last LI then e should be 0 */
-      if(count == liCount - 1)
+      /* Add SN based on SN length */
+      sn = rbCb->m.umDl.txNext;
+      if (rbCb->m.umDl.snLen == RLC_UM_CFG_6BIT_SN_LEN) 
       {
-         e = 0;
+         hdr[idx++] = (umHdr->si << 6) | sn;
       }
-      
-      /* ccpu00135170  Fixing KLOCK warning */  
-      if((idx + 1)>= hdrSz)
-      {
-             break;
-      }
-      /* odd LI, 1st , 3rd etc */
-      hdr[idx] = (e << 7) | (rbCb->m.umDl.li[count] >> 4);
-      hdr[++idx] = (rbCb->m.umDl.li[count] & 0xf) << 4;
-      
-      count++;
-      if(count == liCount - 1)
-      {
-         e = 0;
-      }
-      else if(count >= liCount)
+      else
       {
-         break;
+         hdr[idx++] = (umHdr->si << 6) | (sn >> 8);
+        hdr[idx++] = sn & 0xff ;
       }
-      /* ccpu00135170  Fixing KLOCK warning */  
-      if((idx + 1)>= hdrSz)
+
+      /* Add SO for middle and last segments*/
+      if((umHdr->si == RLC_SI_MID_SEG) | (umHdr->si == RLC_SI_LAST_SEG))
       {
-             break;
+         hdr[idx++] = (umHdr->so >> 8);
+        hdr[idx++] = umHdr->so & 0xff;
       }
-      /* even one, 2nd , 4th etc LI's, count starts at 0 */
-      hdr[idx] |= ((e << 3) | (rbCb->m.umDl.li[count] >> 8));
-      hdr[++idx] = rbCb->m.umDl.li[count] & 0xff;
-      ++idx;
-   }
 
-   /* if odd number of L1s increment idx */
-   if(liCount & 0x1)
-   {
-      ++idx;
-   }
+      /* Increment TX_Next if this is last segment of current SDU */
+      if(umHdr->si == RLC_SI_LAST_SEG)
+         rbCb->m.umDl.txNext = (rbCb->m.umDl.txNext + 1) & rbCb->m.umDl.modBitMask;
 
-   /* increment VT(US) */
-   rbCb->m.umDl.vtUs = (rbCb->m.umDl.vtUs + 1) & rbCb->m.umDl.modBitMask;
+   }
 
    /* add the header to the beginning of the pdu */
    ODU_ADD_PRE_MSG_MULT_IN_ORDER(hdr, idx, pdu);
@@ -706,31 +572,6 @@ static void rlcUmmCreatePdu(RlcCb *gCb, RlcDlRbCb *rbCb, Buffer *pdu, uint8_t fi
    return;
 }
 
-/**
- * @brief  Handler to estimate the header size of the RLC SDUs 
- *         present in the SDU queue.
- *       
- * @details
- *     This function is used to update the estimated header size variable in RB.
- *     This function is called when a SDU is queued and when a PDU is formed and
- *     sent to the lower layer.
- *
- * @param[in] umDl  UM mode downlink control block
- *
- * @return  Void
-*/ 
-static void rlcUmmEstHdrSz(RlcUmDl *umDl)
-{
-   /* The header size is estimated as :
-          If sdu count = 0 then 0
-          else sdu count * 2 + 1; the 1 is added for the FI and SN byte; 
-          2 for one LI and E
-    */   
-   umDl->estHdrSz = (umDl->sduQ.count)?((umDl->sduQ.count << 1) + 1) : 0;
-   
-   return;
-}
-
 /**
  * @brief   Handler to discard a SDU.
  *       
index 7db5db7..4dc9526 100755 (executable)
@@ -259,6 +259,7 @@ uint8_t rlcSendDedLcDlData(Pst *post, SpId spId, RguDDatReqInfo *datReqInfo)
       dlData->slotInfo.sfn = datPerUe.transId >> 16;
       dlData->slotInfo.slot = datPerUe.transId & 0xffff;
       dlData->numPdu = 0;
+      dlData->numLc = 0;
 
       for(tbIdx = 0; tbIdx < datPerUe.nmbOfTbs; tbIdx++)
       {
@@ -300,6 +301,12 @@ uint8_t rlcSendDedLcDlData(Pst *post, SpId spId, RguDDatReqInfo *datReqInfo)
 
                dlData->numPdu++;
             }/* For per PDU */
+           dlData->boStatus[dlData->numLc].cellId = datReqInfo->cellId;
+            GET_UE_IDX(datPerUe.rnti, dlData->boStatus[dlData->numLc].ueIdx);
+           dlData->boStatus[dlData->numLc].commCh = false;
+           dlData->boStatus[dlData->numLc].lcId = datPerLch.lcId;
+           dlData->boStatus[dlData->numLc].bo = datPerLch.boReport.bo + datPerLch.boReport.estRlcHdrSz;
+           dlData->numLc++;
          }/* For Data per Lch */
       }/* For Data per Tb */
 
@@ -313,7 +320,7 @@ uint8_t rlcSendDedLcDlData(Pst *post, SpId spId, RguDDatReqInfo *datReqInfo)
             RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlData->pduInfo[pduIdx].pduBuf,\
                dlData->pduInfo[pduIdx].pduLen);
          }
-          RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlData, sizeof(RlcData));
+         RLC_FREE_SHRABL_BUF(pst.region, pst.pool, dlData, sizeof(RlcData));
          RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_DL, RLC_POOL,
              datReqInfo, sizeof(RguDDatReqInfo));
          return RFAILED;
@@ -497,7 +504,7 @@ uint8_t rlcUtlSendToMac(RlcCb *gCb, SuId suId, KwDStaIndInfo *staIndInfo)
 
 #ifdef CCPU_OPT
                datReqTb->lchData[count].boReport.estRlcHdrSz = 
-                  datReq.boRep.estHdrSz;
+                 datReq.boRep.estHdrSz;
                datReqTb->lchData[count].boReport.staPduPrsnt = 
                   datReq.boRep.staPduPrsnt;
 #endif /* CCPU_OPT */
@@ -636,7 +643,7 @@ uint8_t rlcUtlSendDedLcBoStatus(RlcCb *gCb, RlcDlRbCb *rbCb, int32_t bo, \
    boStatus->ueIdx = rbCb->rlcId.ueId;
    boStatus->commCh = FALSE; 
    boStatus->lcId = rbCb->lch.lChId;
-   boStatus->bo = bo;
+   boStatus->bo = bo + estHdrSz;
 
    FILL_PST_RLC_TO_MAC(pst, RLC_DL_INST, EVENT_BO_STATUS_TO_MAC);
    /* Send Status Response to MAC layer */
@@ -711,41 +718,6 @@ CmLListCp   *sduQ
    return;
 }
 
-/**
- *
- * @brief 
- *    Handler for calculating the Length Indicator (LI) length for a SDU 
- * 
- * @detail:
- *    This function is used to calculate the LI (Length Indicator) length
- *    which has to be substracted from the pduSize to correctly match the
- *    formed PDU(s) size with the  size requested by MAC.
- *
- * @param[in]      gCb      RLC instance control block 
- * @param[in]      numLi    Number of LIs already present 
- * @param[in]      msgLen   Size of the SDU
- * @param[in/out]  pduSz    Size of the pDU to be formed
- *
- * @return  void 
- */
-void rlcUtlCalcLiForSdu(RlcCb *gCb, uint16_t numLi, MsgLen msgLen, int16_t *pduSz)
-{
-   if ( (*pduSz > msgLen)  && (msgLen < RLC_2K_BYTE))
-   {
-      if(0 == (numLi & RLC_BIT0)) /* check if number of LIs are odd or even */
-      {  
-         /* if number of LI's are even 2 bytes needed */
-         *pduSz -= 2;
-      }
-      else
-      {
-         /* if number of LI's are odd one byte needed */
-         *pduSz -= 1;
-      }
-   }
-   return;
-}
-
 /**
  *
  * @brief 
@@ -777,11 +749,6 @@ Void rlcDlUtlSetReestInProgressForRB(RlcCb *gCb,RlcDlRbCb *rbCb)
          rlcStopTmr(gCb, (PTR)rbCb, EVENT_RLC_AMDL_POLL_RETX_TMR);
       }
    }
-   else
-   {
-      rbCb->m.umDl.estHdrSz= 0;
-   }
-
    rlcUtlSendDedLcBoStatus(gCb, rbCb, 0, 0, FALSE,0);
 
    return;
index 0644420..ce1901f 100644 (file)
@@ -102,7 +102,7 @@ typedef enum
 
 typedef enum
 {
-   UM_SIZE_6,
+   UM_SIZE_6 = 1,
    UM_SIZE_12
 }SnLenUm;
 
index 5c46055..b8faa21 100644 (file)
@@ -76,6 +76,8 @@ typedef struct rlcData
    SlotIndInfo   slotInfo;     /*!< Timing info */
    uint8_t       numPdu;       /*!< Number of RLC PDUs */
    RlcPduInfo    pduInfo[MAX_NUM_PDU];
+   uint8_t       numLc;
+   RlcBoStatus   boStatus[MAX_NUM_LC];     /*!< Buffer occupancy */
 }RlcData;
 
 /* Function pointers */
index 47276dd..114154b 100644 (file)
@@ -626,7 +626,7 @@ S16 cuEgtpDecodeHdr(Buffer *mBuf)
 
 S16 cuEgtpDatReq()
 {
-   uint8_t cnt = 0;
+   uint16_t cnt = 0;
    EgtpMsg  egtpMsg;
 
    /* Build Application message that is supposed to come from app to egtp */
index 657a46c..0a64c01 100644 (file)
@@ -811,7 +811,7 @@ uint8_t egtpSendMsg(Buffer *mBuf)
 uint8_t egtpRecvMsg()
 {
    uint8_t        ret;           /* Return value */
-   uint8_t        nMsg;          /* Number of messages to read from UDP socked */
+   uint16_t       nMsg;          /* Number of messages to read from UDP socked */
    uint16_t       bufLen;        /* Length of received buffer */
    Buffer         *recvBuf;      /* Received buffer */
    CmInetAddr     fromAddr;      /* Egtp data sender address */
@@ -834,8 +834,8 @@ uint8_t egtpRecvMsg()
          DU_LOG("\nDEBUG  -->  EGTP : Received DL Message[%d]\n", nMsg+1);
          ODU_PRINT_MSG(recvBuf, 0 ,0);
          egtpHdlRecvData(recvBuf);
+         nMsg++;
       }
-      nMsg++;
    }
    
    return ROK;
index e17890a..878b130 100644 (file)
@@ -104,28 +104,42 @@ uint8_t duHdlEgtpDlData(EgtpMsg  *egtpMsg)
    DU_LOG("\nDEBUG   -->  DU_APP : Processing DL data");
 #ifdef EGTP_TEST
    Pst pst;
-   KwuDatReqInfo datReqInfo;
-
-   datReqInfo.rlcId.rbId = RB_ID;
-   datReqInfo.rlcId.rbType = CM_LTE_DRB;
-   datReqInfo.rlcId.ueId = UE_ID;
-   datReqInfo.rlcId.cellId = NR_CELL_ID;
-
-   datReqInfo.sduId = ++sduId;
-   datReqInfo.lcType = CM_LTE_LCH_DTCH;
-
-   /* Filling pst and Sending to RLC DL */
-   pst.selector  = ODU_SELECTOR_LWLC;
-   pst.srcEnt    = ENTDUAPP;
-   pst.dstEnt    = ENTRLC;
-   pst.dstInst   = RLC_DL_INST;
-   pst.dstProcId = DU_PROC;
-   pst.srcProcId = DU_PROC;
-   pst.region    = duCb.init.region;
-
-   //cmPkKwuDatReq(&pst, &datReqInfo, egtpMsg->msg);
-#else
-   //duBuildAndSendDlRrcMsgToRlc();
+   uint8_t ret;
+   MsgLen copyLen;
+   RlcDlRrcMsgInfo  *dlRrcMsgInfo = NULLP;
+
+   DU_ALLOC_SHRABL_BUF(dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
+   if(!dlRrcMsgInfo)
+   {
+      DU_LOG("\nDU APP : Memory allocation failed for dlRrcMsgInfo in \
+         duBuildAndSendDlRrcMsgToRlc");
+      ODU_PUT_MSG_BUF(egtpMsg->msg);
+      return RFAILED;
+   }
+
+   /* Filling up the RRC msg info */
+   dlRrcMsgInfo->cellId = NR_CELL_ID;
+   dlRrcMsgInfo->ueIdx = UE_ID;
+   dlRrcMsgInfo->rbType = CM_LTE_DRB;
+   dlRrcMsgInfo->rbId   = RB_ID;
+   dlRrcMsgInfo->lcType = CM_LTE_LCH_DTCH;
+   dlRrcMsgInfo->lcId   = 4;
+   dlRrcMsgInfo->execDup = false;
+   dlRrcMsgInfo->deliveryStaRpt = false;
+   ODU_GET_MSG_LEN(egtpMsg->msg, &dlRrcMsgInfo->msgLen);
+   DU_ALLOC_SHRABL_BUF(dlRrcMsgInfo->rrcMsg, dlRrcMsgInfo->msgLen);
+   ODU_COPY_MSG_TO_FIX_BUF(egtpMsg->msg, 0, dlRrcMsgInfo->msgLen, dlRrcMsgInfo->rrcMsg, (MsgLen *)&copyLen);
+   ODU_PUT_MSG_BUF(egtpMsg->msg);
+
+   /* Filling post structure and sending msg */
+   FILL_PST_DUAPP_TO_RLC(pst, RLC_DL_INST, EVENT_DL_RRC_MSG_TRANS_TO_RLC);
+   DU_LOG("\nDU_APP: Sending Dl User Msg to RLC \n");
+   ret = (*duSendDlRrcMsgToRlcOpts[pst.selector])(&pst, dlRrcMsgInfo);
+   if(ret != ROK)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlRrcMsgInfo, sizeof(RlcDlRrcMsgInfo));
+      return RFAILED;
+   }
 #endif
    return ROK;
 }