Merge "PNF Registration to be sent after odu stack is up Issue-Id: ODUHIGH-349"
authorHariomGupta(HCL) <hariom.g@hcl.com>
Fri, 2 Jul 2021 15:00:39 +0000 (15:00 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Fri, 2 Jul 2021 15:00:39 +0000 (15:00 +0000)
16 files changed:
CMakeLists.txt
build/Makefile [new file with mode: 0644]
build/odu/makefile
src/5gnrmac/lwr_mac_fsm.c
src/5gnrmac/lwr_mac_fsm.h
src/5gnrmac/mac.h
src/5gnrmac/mac_msg_hdl.c
src/5gnrmac/mac_slot_ind.c
src/5gnrsch/sch.c
src/5gnrsch/sch_common.c
src/cm/common_def.h
src/du_app/du_cfg.c
src/du_app/du_f1ap_msg_hdl.c
src/phy_stub/phy_stub_msg_hdl.c
src/phy_stub/phy_stub_thread_hdl.c
test/unit_test.sh [new file with mode: 0644]

index 6d5864b..e5561c0 100644 (file)
@@ -1 +1,6 @@
 #sonar qube testing
+project( odu-l2 )
+cmake_minimum_required( VERSION 2.8.12.2)
+#No unit test present in this framework TBD in further releases.
+enable_testing()
+add_test(NAME drive_unit_tests COMMAND bash  ../test/unit_test.sh)
diff --git a/build/Makefile b/build/Makefile
new file mode 100644 (file)
index 0000000..2d02653
--- /dev/null
@@ -0,0 +1,2 @@
+sonarqube: 
+       cd odu;make -f makefile odu MACHINE=BIT64 MODE=TDD
index 868696e..a364182 100644 (file)
@@ -44,7 +44,11 @@ PARALLEL_COMP=-j $(NUM_PARALLEL)
 # # Other apsects of tool chain set here
 # # These should be made available appropriately to the builds
 ifeq ($(MACHINE),BIT64)
+ifeq ($(COVERAGE),1)
+CC          =gcc -m64 --coverage
+else
 CC          =gcc -m64
+endif
 CC_STRIP    =strip --strip-all
 CC_LINKER   =gcc -m64
 CCPP        =g++ -m64
@@ -209,7 +213,10 @@ du:
                $(Q)$(MAKE) -j -f $(COM_BUILD_DIR)/mac.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
                $(Q)$(MAKE) -j -f $(COM_BUILD_DIR)/sch.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
                $(Q)$(MAKE) -j -f $(COM_BUILD_DIR)/mt.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
+               
+ifneq ($(PHY), INTEL_L1)
                $(Q)$(MAKE) -j -f $(COM_BUILD_DIR)/phy_stub.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
+endif
 ifeq ($(O1_ENABLE),YES)
                $(Q)$(MAKE) -j -f $(COM_BUILD_DIR)/o1.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CCPP1)'
                $(Q)$(MAKE) -j -f $(COM_BUILD_DIR)/ves.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CCPP1)'
@@ -230,7 +237,10 @@ clean_odu:
                $(Q)$(MAKE) -j -f $(COM_BUILD_DIR)/mac.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
                $(Q)$(MAKE) -j -f $(COM_BUILD_DIR)/sch.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
                $(Q)$(MAKE) -j -f $(COM_BUILD_DIR)/mt.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
+               
+ifneq ($(PHY), INTEL_L1)
                $(Q)$(MAKE) -j -f $(COM_BUILD_DIR)/phy_stub.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
+endif
 ifeq ($(O1_ENABLE),YES)
                $(Q)$(MAKE) -j -f $(COM_BUILD_DIR)/o1.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CCPP1)'
                $(Q)$(MAKE) -j -f $(COM_BUILD_DIR)/ves.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CCPP1)'
index 4fea616..ffef575 100644 (file)
@@ -54,6 +54,8 @@ uint8_t UnrestrictedSetNcsTable[MAX_ZERO_CORR_CFG_IDX];
 void fapiMacConfigRsp(uint16_t cellId);
 uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo, p_fapi_api_queue_elem_t prevElem);
 uint16_t fillUlTtiReq(SlotIndInfo currTimingInfo, p_fapi_api_queue_elem_t prevElem);
+uint16_t fillUlDciReq(SlotIndInfo currTimingInfo, p_fapi_api_queue_elem_t prevElem);
+uint8_t lwr_mac_procStopReqEvt(SlotIndInfo slotInfo, p_fapi_api_queue_elem_t  prevElem);
 
 void lwrMacLayerInit(Region region, Pool pool)
 {
@@ -2356,19 +2358,14 @@ uint8_t lwr_mac_procStartReqEvt(void *msg)
  *
  ********************************************************************/
 
-uint8_t lwr_mac_procStopReqEvt(void *msg)
+uint8_t lwr_mac_procStopReqEvt(SlotIndInfo slotInfo, p_fapi_api_queue_elem_t  prevElem)
 {
 #ifdef INTEL_FAPI
-   SlotIndInfo       *slotInfo;
-   fapi_msg_header_t *msgHeader;
    fapi_stop_req_t   *stopReq;
    fapi_vendor_msg_t *vendorMsg;
-   p_fapi_api_queue_elem_t  headerElem;
    p_fapi_api_queue_elem_t  stopReqElem;
    p_fapi_api_queue_elem_t  vendorMsgElem;
 
-   slotInfo = (SlotIndInfo *)msg;
-
    /* Allocte And fill Vendor msg */
    LWR_MAC_ALLOC(vendorMsgElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_vendor_msg_t)));
    if(!vendorMsgElem)
@@ -2379,8 +2376,8 @@ uint8_t lwr_mac_procStopReqEvt(void *msg)
    FILL_FAPI_LIST_ELEM(vendorMsgElem, NULLP, FAPI_VENDOR_MESSAGE, 1, sizeof(fapi_vendor_msg_t));
    vendorMsg = (fapi_vendor_msg_t *)(vendorMsgElem + 1);
    fillMsgHeader(&vendorMsg->header, FAPI_VENDOR_MESSAGE, sizeof(fapi_vendor_msg_t));
-   vendorMsg->stop_req_vendor.sfn = slotInfo->sfn;
-   vendorMsg->stop_req_vendor.slot = slotInfo->slot;
+   vendorMsg->stop_req_vendor.sfn = slotInfo.sfn;
+   vendorMsg->stop_req_vendor.slot = slotInfo.slot;
 
    /* Fill FAPI stop req */
    LWR_MAC_ALLOC(stopReqElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_stop_req_t)));
@@ -2396,24 +2393,9 @@ uint8_t lwr_mac_procStopReqEvt(void *msg)
    memset(stopReq, 0, sizeof(fapi_stop_req_t));
    fillMsgHeader(&stopReq->header, FAPI_STOP_REQUEST, sizeof(fapi_stop_req_t));
 
-   /* Fill message header */
-   LWR_MAC_ALLOC(headerElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_msg_header_t)));
-   if(!headerElem)
-   {
-      DU_LOG("\nERROR  -->  LWR_MAC: Memory allocation failed for header in stop req");
-      LWR_MAC_FREE(stopReqElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_stop_req_t)));
-      LWR_MAC_FREE(vendorMsgElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_vendor_msg_t)));
-      return RFAILED;
-   }
-   FILL_FAPI_LIST_ELEM(headerElem, stopReqElem, FAPI_VENDOR_MSG_HEADER_IND, 1, \
-      sizeof(fapi_msg_header_t));
-   msgHeader = (fapi_msg_header_t *)(headerElem + 1);
-   msgHeader->num_msg = 2; /* Stop req msg and vendor specific msg */
-   msgHeader->handle = 0;
-
    /* Send to PHY */
    DU_LOG("\nINFO  -->  LWR_MAC: Sending Stop Request to Phy");
-   LwrMacSendToL1(headerElem);
+   prevElem->p_next = stopReqElem;
 
 #endif
    return ROK;
@@ -3165,7 +3147,7 @@ uint8_t calcTxDataReqPduCount(DlSchedInfo *dlInfo)
 uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc, uint16_t pduIndex, MacCellCfg *macCellCfg,
       PdschCfg pdschCfg)
 {
-   uint16_t payloadSize = 0;
+   uint32_t payloadSize = 0;
    uint8_t *sib1Payload = NULLP;
    fapi_api_queue_elem_t *payloadElem = NULLP;
 #ifdef INTEL_WLS_MEM
@@ -3177,8 +3159,8 @@ uint8_t fillSib1TxDataReq(fapi_tx_pdu_desc_t *pduDesc, uint16_t pduIndex, MacCel
 
    /* fill the TLV */
    payloadSize = pdschCfg.codeword[0].tbSize;
-   pduDesc[pduIndex].tlvs[0].tl.tag = FAPI_TX_DATA_PTR_TO_PAYLOAD_64;
-   pduDesc[pduIndex].tlvs[0].tl.length = payloadSize;
+   pduDesc[pduIndex].tlvs[0].tl.tag = ((payloadSize & 0xff0000) >> 8) | FAPI_TX_DATA_PTR_TO_PAYLOAD_64;
+   pduDesc[pduIndex].tlvs[0].tl.length = (payloadSize & 0x0000ffff);
    LWR_MAC_ALLOC(sib1Payload, payloadSize);
    if(sib1Payload == NULLP)
    {
@@ -3359,6 +3341,7 @@ uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo)
    fapi_msg_header_t *msgHeader = NULLP;
    p_fapi_api_queue_elem_t dlTtiElem;
    p_fapi_api_queue_elem_t headerElem;
+   p_fapi_api_queue_elem_t prevElem;
 
    if(lwrMacCb.phyState == PHY_STATE_RUNNING)
    {
@@ -3375,158 +3358,188 @@ uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo)
       if(dlTtiElem)
       {
          FILL_FAPI_LIST_ELEM(dlTtiElem, NULLP, FAPI_DL_TTI_REQUEST, 1, \
-           sizeof(fapi_dl_tti_req_t));
+               sizeof(fapi_dl_tti_req_t));
 
-        /* Fill message header */
-        LWR_MAC_ALLOC(headerElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_msg_header_t)));
-        if(!headerElem)
-        {
-           DU_LOG("\nERROR  -->  LWR_MAC: Memory allocation failed for header in DL TTI req");
-           LWR_MAC_FREE(dlTtiElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_dl_tti_req_t)));
-           return RFAILED;
-        }
-        FILL_FAPI_LIST_ELEM(headerElem, dlTtiElem, FAPI_VENDOR_MSG_HEADER_IND, 1, \
-              sizeof(fapi_msg_header_t));
-        msgHeader = (fapi_msg_header_t *)(headerElem + 1);
-        msgHeader->num_msg = 1;
-        msgHeader->handle = 0;
+         /* Fill message header */
+         LWR_MAC_ALLOC(headerElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_msg_header_t)));
+         if(!headerElem)
+         {
+            DU_LOG("\nERROR  -->  LWR_MAC: Memory allocation failed for header in DL TTI req");
+            LWR_MAC_FREE(dlTtiElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_dl_tti_req_t)));
+            return RFAILED;
+         }
+         FILL_FAPI_LIST_ELEM(headerElem, dlTtiElem, FAPI_VENDOR_MSG_HEADER_IND, 1, \
+               sizeof(fapi_msg_header_t));
+         msgHeader = (fapi_msg_header_t *)(headerElem + 1);
+         msgHeader->num_msg = 1;
+         msgHeader->handle = 0;
 
          /* Fill Dl TTI Request */
-        dlTtiReq = (fapi_dl_tti_req_t *)(dlTtiElem +1);
-        memset(dlTtiReq, 0, sizeof(fapi_dl_tti_req_t));
-        fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, sizeof(fapi_dl_tti_req_t));
-
-        dlTtiReq->sfn  = dlTtiReqTimingInfo.sfn;
-        dlTtiReq->slot = dlTtiReqTimingInfo.slot;
-        dlTtiReq->nPdus = calcDlTtiReqPduCount(&currDlSlot->dlInfo);  /* get total Pdus */
-        nPdu = dlTtiReq->nPdus;
-        dlTtiReq->nGroup = 0;
-        if(dlTtiReq->nPdus > 0)
-        {
-           if(currDlSlot->dlInfo.isBroadcastPres)
-           {
-              if(currDlSlot->dlInfo.brdcstAlloc.ssbTrans)
-              {
-                 if(dlTtiReq->pdus != NULLP)
-                 {
-                    for(idx = 0; idx < currDlSlot->dlInfo.brdcstAlloc.ssbIdxSupported; idx++)
-                    {
-                       fillSsbPdu(&dlTtiReq->pdus[numPduEncoded], &macCellCfg,\
-                             currDlSlot, idx, dlTtiReq->sfn);
-                       numPduEncoded++;
-                    }
-                 }
-                 DU_LOG("\033[1;31m");
-                 DU_LOG("\nDEBUG  -->  LWR_MAC: MIB sent..");
-                 DU_LOG("\033[0m");
-              }
-              if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
-              {
-                 /* Filling SIB1 param */
-                 if(numPduEncoded != nPdu)
-                 {
-                    rntiType = SI_RNTI_TYPE;
-                    fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded],&currDlSlot->dlInfo,\
-                          rntiType, CORESET_TYPE0);
-                    numPduEncoded++;
-                    fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
-                          &currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdschCfg,
-                          currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.bwp,
-                          pduIndex);
-                    pduIndex++;
-                    numPduEncoded++;
-                 }
-                 DU_LOG("\033[1;34m");
+         dlTtiReq = (fapi_dl_tti_req_t *)(dlTtiElem +1);
+         memset(dlTtiReq, 0, sizeof(fapi_dl_tti_req_t));
+         fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, sizeof(fapi_dl_tti_req_t));
+
+         dlTtiReq->sfn  = dlTtiReqTimingInfo.sfn;
+         dlTtiReq->slot = dlTtiReqTimingInfo.slot;
+         dlTtiReq->nPdus = calcDlTtiReqPduCount(&currDlSlot->dlInfo);  /* get total Pdus */
+         nPdu = dlTtiReq->nPdus;
+         dlTtiReq->nGroup = 0;
+         if(dlTtiReq->nPdus > 0)
+         {
+            if(currDlSlot->dlInfo.isBroadcastPres)
+            {
+               if(currDlSlot->dlInfo.brdcstAlloc.ssbTrans)
+               {
+                  if(dlTtiReq->pdus != NULLP)
+                  {
+                     for(idx = 0; idx < currDlSlot->dlInfo.brdcstAlloc.ssbIdxSupported; idx++)
+                     {
+                        fillSsbPdu(&dlTtiReq->pdus[numPduEncoded], &macCellCfg,\
+                              currDlSlot, idx, dlTtiReq->sfn);
+                        numPduEncoded++;
+                     }
+                  }
+                  DU_LOG("\033[1;31m");
+                  DU_LOG("\nDEBUG  -->  LWR_MAC: MIB sent..");
+                  DU_LOG("\033[0m");
+               }
+               if(currDlSlot->dlInfo.brdcstAlloc.sib1Trans)
+               {
+                  /* Filling SIB1 param */
+                  if(numPduEncoded != nPdu)
+                  {
+                     rntiType = SI_RNTI_TYPE;
+                     fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded],&currDlSlot->dlInfo,\
+                           rntiType, CORESET_TYPE0);
+                     numPduEncoded++;
+                     fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
+                           &currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.sib1PdschCfg,
+                           currDlSlot->dlInfo.brdcstAlloc.sib1Alloc.bwp,
+                           pduIndex);
+                     dlTtiReq->ue_grp_info[dlTtiReq->nGroup].pduIdx[pduIndex] = pduIndex;
+                     pduIndex++;
+                     numPduEncoded++;
+                  }
+
+                  DU_LOG("\033[1;34m");
                   DU_LOG("\nDEBUG  -->  LWR_MAC: SIB1 sent...");
-                 DU_LOG("\033[0m");
-              }
-           }
-           if(currDlSlot->dlInfo.rarAlloc != NULLP)
-           {
-              /* Filling RAR param */
-              rntiType = RA_RNTI_TYPE;
-              fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
-                    &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
-              numPduEncoded++;
-              fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
-                    &currDlSlot->dlInfo.rarAlloc->rarPdschCfg,
-                    currDlSlot->dlInfo.rarAlloc->bwp,
-                    pduIndex);
-              numPduEncoded++;
-              pduIndex++;
-
-              DU_LOG("\033[1;32m");
-              DU_LOG("\nDEBUG  -->  LWR_MAC: RAR sent...");
-              DU_LOG("\033[0m");
-           }
-           if(currDlSlot->dlInfo.dlMsgAlloc != NULLP)
-           {
-              if(currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPdu != NULLP)
-              {
-                 /* Filling Msg4 param */
-                 DU_LOG("\033[1;32m");
-                 if(currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.isMsg4Pdu)
-                 {
-                    rntiType = TC_RNTI_TYPE;
-                    fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
-                          &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
-                    DU_LOG("\nDEBUG  -->  LWR_MAC: MSG4 sent...");
-                 }
-                 else
-                 { 
-                    /* Filling other DL msg params */
-                    rntiType = C_RNTI_TYPE;
-                    fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
-                          &currDlSlot->dlInfo, rntiType, CORESET_TYPE1);
-                    DU_LOG("\nDEBUG  -->  LWR_MAC: DL MSG sent...");
+                  DU_LOG("\033[0m");
+               }
+            }
+            if(currDlSlot->dlInfo.rarAlloc != NULLP)
+            {
+               /* Filling RAR param */
+               rntiType = RA_RNTI_TYPE;
+               fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
+                     &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
+               numPduEncoded++;
+               fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
+                     &currDlSlot->dlInfo.rarAlloc->rarPdschCfg,
+                     currDlSlot->dlInfo.rarAlloc->bwp,
+                     pduIndex);
+               numPduEncoded++;
+               pduIndex++;
+
+               DU_LOG("\033[1;32m");
+               DU_LOG("\nDEBUG  -->  LWR_MAC: RAR sent...");
+               DU_LOG("\033[0m");
+            }
+            if(currDlSlot->dlInfo.dlMsgAlloc != NULLP)
+            {
+               if(currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPdu != NULLP)
+               {
+                  /* Filling Msg4 param */
+                  DU_LOG("\033[1;32m");
+                  if(currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.isMsg4Pdu)
+                  {
+                     rntiType = TC_RNTI_TYPE;
+                     fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
+                           &currDlSlot->dlInfo, rntiType, CORESET_TYPE0);
+                     DU_LOG("\nDEBUG  -->  LWR_MAC: MSG4 sent...");
                   }
-                 DU_LOG("\033[0m");
-
-                 numPduEncoded++;
-                 fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
-                       &currDlSlot->dlInfo.dlMsgAlloc->dlMsgPdschCfg,
-                       currDlSlot->dlInfo.dlMsgAlloc->bwp,
-                       pduIndex);
-                 numPduEncoded++;
-                 pduIndex++;
-              }
+                  else
+                  { 
+                     /* Filling other DL msg params */
+                     rntiType = C_RNTI_TYPE;
+                     fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \
+                           &currDlSlot->dlInfo, rntiType, CORESET_TYPE1);
+                     DU_LOG("\nDEBUG  -->  LWR_MAC: DL MSG sent...");
+                  }
+                  DU_LOG("\033[0m");
+
+                  numPduEncoded++;
+                  fillPdschPdu(&dlTtiReq->pdus[numPduEncoded],
+                        &currDlSlot->dlInfo.dlMsgAlloc->dlMsgPdschCfg,
+                        currDlSlot->dlInfo.dlMsgAlloc->bwp,
+                        pduIndex);
+                  numPduEncoded++;
+                  pduIndex++;
+               }
                else
-              {
+               {
                   MAC_FREE(currDlSlot->dlInfo.dlMsgAlloc, sizeof(DlMsgAlloc));
-                 currDlSlot->dlInfo.dlMsgAlloc = NULLP;
-              }
-           }
+                  currDlSlot->dlInfo.dlMsgAlloc = NULLP;
+               }
+            }
+
+            dlTtiReq->ue_grp_info[dlTtiReq->nGroup].nUe = MAX_NUM_UE_PER_TTI;
+            dlTtiReq->nGroup++;
 
 #ifdef ODU_SLOT_IND_DEBUG_LOG      
-           DU_LOG("\nDEBUG  -->  LWR_MAC: Sending DL TTI Request");
+            DU_LOG("\nDEBUG  -->  LWR_MAC: Sending DL TTI Request");
 #endif     
-           /* Intel L1 expects UL_TTI.request following DL_TTI.request */
-           msgHeader->num_msg++;
+
+            /* Intel L1 expects UL_TTI.request following DL_TTI.request */
             fillUlTtiReq(currTimingInfo, dlTtiElem);
-           /* send Tx-DATA req message */
-           msgHeader->num_msg++;
-           sendTxDataReq(dlTtiReqTimingInfo, &currDlSlot->dlInfo, dlTtiElem->p_next);
-            LwrMacSendToL1(headerElem);
-        }
-        else
-        {
+            msgHeader->num_msg++;
+
+            /* Intel L1 expects UL_DCI.request following DL_TTI.request */
+            fillUlDciReq(currTimingInfo, dlTtiElem->p_next);
+            msgHeader->num_msg++;
+
+            /* send Tx-DATA req message */
+            sendTxDataReq(dlTtiReqTimingInfo, &currDlSlot->dlInfo, dlTtiElem->p_next->p_next);
+            if(dlTtiElem->p_next->p_next->p_next)
+            {
+               msgHeader->num_msg++;
+               prevElem = dlTtiElem->p_next->p_next->p_next;
+            }
+            else
+               prevElem = dlTtiElem->p_next->p_next;
+         }
+         else
+         {
 #ifdef ODU_SLOT_IND_DEBUG_LOG      
-           DU_LOG("\nDEBUG  -->  LWR_MAC: Sending DL TTI Request");
+            DU_LOG("\nDEBUG  -->  LWR_MAC: Sending DL TTI Request");
 #endif     
 
-           /* Intel L1 expects UL_TTI.request following DL_TTI.request */
-           msgHeader->num_msg++;
-           fillUlTtiReq(currTimingInfo, dlTtiElem);
-            LwrMacSendToL1(headerElem);
-        }
-        memset(currDlSlot, 0, sizeof(MacDlSlot));
-        return ROK;
+            /* Intel L1 expects UL_TTI.request following DL_TTI.request */
+            fillUlTtiReq(currTimingInfo, dlTtiElem);
+            msgHeader->num_msg++;
+
+            /* Intel L1 expects UL_DCI.request following DL_TTI.request */
+            fillUlDciReq(currTimingInfo, dlTtiElem->p_next);
+            msgHeader->num_msg++;
+
+            prevElem = dlTtiElem->p_next->p_next;
+         }
+
+         if(macCb.macCell[cellIdx]->state == CELL_TO_BE_STOPPED)
+         {
+            /* Intel L1 expects UL_DCI.request following DL_TTI.request */
+            lwr_mac_procStopReqEvt(currTimingInfo, prevElem);
+            msgHeader->num_msg++;
+            macCb.macCell[cellIdx]->state = CELL_STOP_IN_PROGRESS;
+         }
+         LwrMacSendToL1(headerElem);
+         memset(currDlSlot, 0, sizeof(MacDlSlot));
+         return ROK;
       }
       else
       {
-        DU_LOG("\nERROR  -->  LWR_MAC: Failed to allocate memory for DL TTI Request");
-        memset(currDlSlot, 0, sizeof(MacDlSlot));
-        return RFAILED;
+         DU_LOG("\nERROR  -->  LWR_MAC: Failed to allocate memory for DL TTI Request");
+         memset(currDlSlot, 0, sizeof(MacDlSlot));
+         return RFAILED;
       }
    }
    else
@@ -4194,7 +4207,7 @@ uint8_t fillUlDciPdcchPdu(fapi_dci_pdu_t *ulDciReqPdu, DlSchedInfo *dlInfo, uint
  *         RFAILED - failure
  *
  ******************************************************************/
-uint16_t fillUlDciReq(SlotIndInfo currTimingInfo)
+uint16_t fillUlDciReq(SlotIndInfo currTimingInfo, p_fapi_api_queue_elem_t prevElem)
 {
 #ifdef INTEL_FAPI
    uint8_t      cellIdx =0;
@@ -4202,9 +4215,7 @@ uint16_t fillUlDciReq(SlotIndInfo currTimingInfo)
    SlotIndInfo  ulDciReqTimingInfo ={0};
    MacDlSlot    *currDlSlot = NULLP;
    fapi_ul_dci_req_t        *ulDciReq =NULLP;
-   fapi_msg_header_t        *msgHeader =NULLP;
    p_fapi_api_queue_elem_t  ulDciElem;
-   p_fapi_api_queue_elem_t  headerElem;
 
    if(lwrMacCb.phyState == PHY_STATE_RUNNING)
    {
@@ -4212,8 +4223,6 @@ uint16_t fillUlDciReq(SlotIndInfo currTimingInfo)
       memcpy(&ulDciReqTimingInfo, &currTimingInfo, sizeof(SlotIndInfo));
       currDlSlot = &macCb.macCell[cellIdx]->dlSlot[ulDciReqTimingInfo.slot % MAX_SLOTS];
 
-      if(currDlSlot->dlInfo.ulGrant != NULLP)
-      {
          LWR_MAC_ALLOC(ulDciElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_ul_dci_req_t)));
          if(ulDciElem)
         {
@@ -4225,6 +4234,8 @@ uint16_t fillUlDciReq(SlotIndInfo currTimingInfo)
 
             ulDciReq->sfn  = ulDciReqTimingInfo.sfn;
             ulDciReq->slot = ulDciReqTimingInfo.slot;
+          if(currDlSlot->dlInfo.ulGrant != NULLP)
+          {
             ulDciReq->numPdus = 1;  // No. of PDCCH PDUs
             if(ulDciReq->numPdus > 0)
             {
@@ -4234,32 +4245,12 @@ uint16_t fillUlDciReq(SlotIndInfo currTimingInfo)
               /* free UL GRANT at SCH */
               MAC_FREE(currDlSlot->dlInfo.ulGrant, sizeof(DciInfo));
               currDlSlot->dlInfo.ulGrant = NULLP;
-
-              /* Fill message header */
-              LWR_MAC_ALLOC(headerElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_msg_header_t)));
-              if(!headerElem)
-              {
-                 DU_LOG("\nERROR  -->  LWR_MAC: Memory allocation failed for UL DCI req header");
-                 LWR_MAC_FREE(ulDciElem, (sizeof(fapi_api_queue_elem_t) + sizeof(fapi_ul_dci_req_t)));
-                 return RFAILED;
-              }
-              FILL_FAPI_LIST_ELEM(headerElem, ulDciElem, FAPI_VENDOR_MSG_HEADER_IND, 1, \
-                 sizeof(fapi_msg_header_t));
-              msgHeader = (fapi_msg_header_t *)(headerElem + 1);
-              msgHeader->num_msg = 1;
-              msgHeader->handle = 0;
+            }
 #ifdef ODU_SLOT_IND_DEBUG_LOG
               DU_LOG("\nDEBUG  -->  LWR_MAC: Sending UL DCI Request");
 #endif
-              LwrMacSendToL1(headerElem);
-            }
         }
-         else
-         {
-            DU_LOG("\nERROR  -->  LWR_MAC: Failed to allocate memory for UL DCI Request");
-            memset(currDlSlot, 0, sizeof(MacDlSlot));
-            return RFAILED;
-         }
+               prevElem->p_next = ulDciElem;
       }
    }
    else
@@ -4306,7 +4297,7 @@ lwrMacFsmHdlr fapiEvtHdlr[MAX_STATE][MAX_EVENT] =
       lwr_mac_procConfigReqEvt,
       lwr_mac_procConfigRspEvt,
       lwr_mac_procInvalidEvt,
-      lwr_mac_procStopReqEvt,
+      lwr_mac_procInvalidEvt,
    }
 };
 
index 96cff05..b64224e 100644 (file)
@@ -57,11 +57,9 @@ uint8_t lwr_mac_procParamRspEvt(void *msg);
 uint8_t lwr_mac_procConfigReqEvt(void *msg);
 uint8_t lwr_mac_procConfigRspEvt(void *msg);
 uint8_t lwr_mac_procStartReqEvt(void *msg);
-uint8_t lwr_mac_procStopReqEvt(void *msg);
 void sendToLowerMac(uint16_t, uint32_t, void *);
 void procPhyMessages(uint16_t msgType, uint32_t msgSize, void *msg);
 uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo);
-uint16_t fillUlDciReq(SlotIndInfo currTimingInfo);
 typedef uint8_t (*lwrMacFsmHdlr)(void *);
 void lwrMacLayerInit(Region region, Pool pool);
 
index e64cba2..9a9127b 100644 (file)
 
 typedef struct macCellCb MacCellCb;
 
+typedef enum
+{
+   CELL_STATE_UP,
+   CELL_TO_BE_STOPPED,
+   CELL_STOP_IN_PROGRESS,
+}CellState;       
+
 typedef enum
 {
    UE_STATE_INACTIVE,
@@ -179,6 +186,7 @@ typedef struct macUeCb
 struct macCellCb
 {
    uint16_t    cellId;
+   CellState   state;
    uint8_t     crntiMap;
    MacRaCbInfo macRaCb[MAX_NUM_UE];
    MacDlSlot   dlSlot[MAX_SLOTS];
index 09056e8..181d05e 100644 (file)
@@ -477,16 +477,12 @@ uint8_t MacProcCellStop(Pst *pst, OduCellId  *cellId)
 {
 #ifdef INTEL_FAPI
    uint16_t      cellIdx; 
-   SlotIndInfo   slotInfo;
 
    DU_LOG("\nINFO  -->  MAC : Sending cell stop request to Lower Mac");
    GET_CELL_IDX(cellId->cellId, cellIdx);
    if(macCb.macCell[cellIdx])
    {
-      slotInfo.cellId = cellId->cellId;
-      slotInfo.sfn = macCb.macCell[cellIdx]->currTime.sfn;
-      slotInfo.slot = macCb.macCell[cellIdx]->currTime.slot;
-      sendToLowerMac(FAPI_STOP_REQUEST, 0, &slotInfo);
+      macCb.macCell[cellIdx]->state = CELL_TO_BE_STOPPED;
    }
 #endif
 
index dcbf870..27088ed 100644 (file)
@@ -326,11 +326,6 @@ uint8_t macProcSlotInd(SlotIndInfo slotInd)
    /* Trigger for DL TTI REQ */
    fillDlTtiReq(slotInd);
 
-   /* TODO : check if this too needs to be sent in sequence with Dl and Ul TTI req.
-    * If so , move trigger for fillUlDciReq to lower mac */
-   /* Trigger for UL DCI REQ */
-   fillUlDciReq(slotInd);
-
    return ROK;
 }  /* macProcSlotInd */
 
@@ -353,6 +348,7 @@ uint8_t macProcSlotInd(SlotIndInfo slotInd)
 uint8_t fapiMacSlotInd(Pst *pst, SlotIndInfo *slotInd)
 {
    uint8_t               ret = ROK;
+   uint16_t              cellIdx;
    volatile uint32_t     startTime=0;
 
 #ifdef ODU_SLOT_IND_DEBUG_LOG
@@ -362,6 +358,12 @@ uint8_t fapiMacSlotInd(Pst *pst, SlotIndInfo *slotInd)
    ODU_START_TASK(&startTime, PID_MAC_TTI_IND);
    gSlotCount++;
 
+   if(gSlotCount == 1)
+   {
+          GET_CELL_IDX(slotInd->cellId, cellIdx);
+          macCb.macCell[cellIdx]->state = CELL_STATE_UP;
+   }
+
 /* When testing L2 with Intel-L1, any changes specific to 
  * timer mode testing must be guarded under INTEL_TIMER_MODE*/
 #ifndef INTEL_TIMER_MODE
index ebdab07..3be7fba 100644 (file)
@@ -684,7 +684,8 @@ void fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots, SchSib1Cfg
    uint8_t mValue = 0;
    uint8_t firstSymbol = 0; /* need to calculate using formula mentioned in 38.213 */
    uint8_t slotIndex = 0;
-   uint8_t FreqDomainResource[6] = {0};
+   /* TODO : This should be filled through freqDomRscAllocType0() */
+   uint8_t FreqDomainResource[6] = {15, 0, 0, 0, 0, 0};
    uint16_t tbSize = 0;
    uint8_t numPdschSymbols = 11; /* considering pdsch region from symbols 3 to 13 */
    uint8_t ssbIdx = 0;
@@ -717,7 +718,7 @@ void fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots, SchSib1Cfg
    sib1SchCfg->n0 = slotIndex;
 
    /* calculate the PRBs */
-   freqDomRscAllocType0(((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
+   //freqDomRscAllocType0(((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
    /* fill BWP */
    switch(bandwidth)
@@ -793,7 +794,7 @@ void fillSchSib1Cfg(uint8_t mu, uint8_t bandwidth, uint8_t numSlots, SchSib1Cfg
    pdsch->dmrs.dlDmrsScramblingId            = pci;
    pdsch->dmrs.scid                          = 0;
    pdsch->dmrs.numDmrsCdmGrpsNoData          = 1;
-   pdsch->dmrs.dmrsPorts                     = 0;
+   pdsch->dmrs.dmrsPorts                     = 0x0001;
    pdsch->dmrs.mappingType                   = DMRS_MAP_TYPE_A; /* Type-A */
    pdsch->dmrs.nrOfDmrsSymbols               = NUM_DMRS_SYMBOLS;
    pdsch->dmrs.dmrsAddPos                    = DMRS_ADDITIONAL_POS;
index f6c8011..448434c 100644 (file)
@@ -806,7 +806,7 @@ uint8_t schDlRsrcAllocDlMsg(DlMsgAlloc *dlMsgAlloc, SchCellCb *cell, uint16_t cr
       pdsch->codeword[cwCount].rvIndex = 0;
       tbSize = schCalcTbSize(*accumalatedSize + TX_PAYLOAD_HDR_LEN);
       if(tbSize < *accumalatedSize)
-         *accumalatedSize = tbSize;
+         *accumalatedSize = tbSize - TX_PAYLOAD_HDR_LEN;
       pdsch->codeword[cwCount].tbSize = tbSize;
    }
    pdsch->dataScramblingId = cell->cellCfg.phyCellId;
index af3ccca..c60670a 100644 (file)
@@ -57,6 +57,7 @@
 /* MAX values */
 #define MAX_NUM_CELL 1
 #define MAX_NUM_UE   1
+#define MAX_NUM_UE_PER_TTI 1
 #define MAX_NUM_LC   11
 #define MAX_NUM_SRB  3    /* Max. no of Srbs */
 #define MAX_NUM_DRB  29   /* spec 38.331, maxDRB */
index e9e8c26..b98c2cd 100644 (file)
@@ -74,6 +74,7 @@ char encBuf[ENC_BUF_MAX_LEN];
      8   UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL
      9   UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL    UL  
  */
+
 #ifdef NR_TDD
 /*******************************************************************
  *
index 234a973..8c776c4 100644 (file)
@@ -11795,7 +11795,7 @@ void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck)
 
 uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
 {
-   uint8_t  ieIdx=0, arrIdx=0;
+   uint8_t  ieIdx=0, arrIdx=0,ret=ROK;
    uint8_t  ueId =0 , ueIdx =0;
    uint16_t cellId =0, cellIdx =0, crnti=0;
    CmLList *f1apPduNode = NULLP;
@@ -11822,42 +11822,59 @@ uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
             switch(gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->id)
             {
                case ProtocolIE_ID_id_Served_Cells_To_Delete_List:
-               {
-                  cellsToDelete = &gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
-                  Served_Cells_To_Delete_List;
-                  if(cellsToDelete->list.array)
                   {
-                     if(cellsToDelete->list.array[arrIdx])
+                     cellsToDelete = &gnbDuConfigUpdate->protocolIEs.list.array[ieIdx]->value.choice.\
+                                     Served_Cells_To_Delete_List;
+                     if(cellsToDelete->list.array)
                      {
-                        deleteItemIe = (Served_Cells_To_Delete_ItemIEs_t*)cellsToDelete->list.array[arrIdx];
-                        deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
-                        if(deleteItem->oldNRCGI.nRCellIdentity.buf)
+                        if(cellsToDelete->list.array[arrIdx])
                         {
-                           cellIdentity = &deleteItem->oldNRCGI.nRCellIdentity;
-                           bitStringToInt(cellIdentity, &cellId);
+                           deleteItemIe = (Served_Cells_To_Delete_ItemIEs_t*)cellsToDelete->list.array[arrIdx];
+                           deleteItem=&deleteItemIe->value.choice.Served_Cells_To_Delete_Item;
+                           if(deleteItem->oldNRCGI.nRCellIdentity.buf)
+                           {
+                              cellIdentity = &deleteItem->oldNRCGI.nRCellIdentity;
+                              bitStringToInt(cellIdentity, &cellId);
+                           }
                         }
                      }
-                  }
 
-                  GET_CELL_IDX(cellId, cellIdx);
-                  if(duCb.actvCellLst[cellIdx] != NULLP)
-                  {
-                     for(ueIdx = 0; ueIdx < duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++)
+                     GET_CELL_IDX(cellId, cellIdx);
+                     if(duCb.actvCellLst[cellIdx] != NULLP)
                      {
-                        crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
-                        GET_UE_IDX(crnti,ueId);
-                        BuildAndSendUeContextReleaseReq(cellId, ueId);
+                        if(duCb.actvCellLst[cellIdx]->numActvUes == 0)
+                        {
+                           duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS;
+                           ret = duSendCellDeletReq(cellId);
+                           if(ret == RFAILED)
+                           {
+                              DU_LOG("ERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to send cell delete\
+                              request for cellId[%d]", cellId);
+                           }
+                        }
+                        else
+                        {
+                           for(ueIdx = 0; ueIdx < duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++)
+                           {
+                              crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
+                              GET_UE_IDX(crnti,ueId);
+                              ret = BuildAndSendUeContextReleaseReq(cellId, ueId);
+                              if(ret == RFAILED)
+                              {
+                                 DU_LOG("ERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to build and send UE delete\
+                                 request for cellId[%d]", cellId);
+                              }
+                           }
+                        }
                      }
-                  }
-                  else
-                  {
-                     DU_LOG("ERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%d] not found", cellId);
-                     return RFAILED;
+                     else
+                     {
+                        DU_LOG("ERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%d] not found", cellId);
+                        ret = RFAILED;
+                     }
+                     break;
                   }
 
-                  break;
-               }
-
                default:
                   break;
             }
@@ -11867,7 +11884,7 @@ uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
    
    FreeDUConfigUpdate(f1apMsgPdu);
    deleteFromReservedF1apPduList(f1apPduNode);
-   return ROK;
+   return ret;
 }
 
 /*******************************************************************
index ebe33a3..502f3a3 100644 (file)
@@ -1547,32 +1547,32 @@ void l1ProcessFapiRequest(uint8_t msgType, uint32_t msgLen, void *msg)
    {
 #ifdef INTEL_FAPI
       case FAPI_PARAM_REQUEST:
-        l1HdlParamReq(msgLen, msg);
-        break;
+         l1HdlParamReq(msgLen, msg);
+         break;
       case FAPI_CONFIG_REQUEST:
-        l1HdlConfigReq(msgLen, msg);
-        break;
+         l1HdlConfigReq(msgLen, msg);
+         break;
       case FAPI_START_REQUEST:
-        l1HdlStartReq(msgLen, msg);
-        break;
+         l1HdlStartReq(msgLen, msg);
+         break;
       case FAPI_DL_TTI_REQUEST:
-        l1HdlDlTtiReq(msgLen, msg);
-        break;
+         l1HdlDlTtiReq(msgLen, msg);
+         break;
       case FAPI_TX_DATA_REQUEST:
-        l1HdlTxDataReq(msgLen, msg);
-        break;
+         l1HdlTxDataReq(msgLen, msg);
+         break;
       case FAPI_UL_TTI_REQUEST:
-        l1HdlUlTtiReq(msgLen, msg);
-        break;
+         l1HdlUlTtiReq(msgLen, msg);
+         break;
       case FAPI_STOP_REQUEST:
-        l1HdlStopReq(msgLen, msg);
-        break;
+         l1HdlStopReq(msgLen, msg);
+         break;
       case FAPI_UL_DCI_REQUEST:
-        l1HdlUlDciReq(msgLen, msg);
-        break;
+         l1HdlUlDciReq(msgLen, msg);
+         break;
       default:
-        DU_LOG("\nERROR  -->  PHY_STUB: Invalid message type[%x] received at PHY", msgType);
-        break;
+         DU_LOG("\nERROR  -->  PHY_STUB: Invalid message type[%x] received at PHY", msgType);
+         break;
 #endif
    }
 }
index f7912f7..0eed378 100644 (file)
@@ -66,7 +66,11 @@ void GenerateTicks()
    {
       clock_nanosleep(CLOCK_REALTIME, 0, &req, NULL); 
       /* Send Slot indication indication to lower mac */
-      l1BuildAndSendSlotIndication();
+      if(l1BuildAndSendSlotIndication() != ROK)
+      {
+         DU_LOG("\nERROR  --> PHY_STUB : GenerateTicks(): Failed to build and send Slot Indication");
+         return;
+      }
    }
 
    DU_LOG("\nINFO  --> PHY_STUB : Slot indication stopped");
diff --git a/test/unit_test.sh b/test/unit_test.sh
new file mode 100644 (file)
index 0000000..ae58a57
--- /dev/null
@@ -0,0 +1 @@
+cd odu;make clean_odu MACHINE=BIT64 MODE=TDD;make odu MACHINE=BIT64 MODE=TDD COVERAGE=1