Trigger_macCellCfg 47/3147/3
authorbalajihands <balaji.shankaran@radisys.com>
Sat, 4 Apr 2020 14:34:25 +0000 (20:04 +0530)
committerbalajihands <balaji.shankaran@radisys.com>
Mon, 6 Apr 2020 07:01:46 +0000 (12:31 +0530)
Change-Id: Ib6c8ead71298b1276d2fb55c22c6c40988327183
Signed-off-by: balajihands <balaji.shankaran@radisys.com>
src/5gnrmac/lwr_mac_li.c
src/5gnrmac/rg.h
src/5gnrmac/rg_lmm.c
src/cm/du_app_mac_inf.c
src/cm/du_app_mac_inf.h
src/du_app/du_cell_mgr.c
src/du_app/du_cfg.c
src/du_app/du_cfg.h
src/du_app/du_msg_hdl.c

index 06323b1..001d2e3 100644 (file)
@@ -186,14 +186,14 @@ ClCellCb   *cellCb
 
    /* Filling SSB configuration */
    fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SS_PBCH_PWR, sizeof(U16), cellCfg.ssbCfg.ssbPbchPwr, &msgLen);
-   fillConfigTLV(nextTlv, configTlvs, CFG_TAG_BCH_PAYLOAD, sizeof(U16), cellCfg.ssbCfg.bchPayloadOption, &msgLen);
+   fillConfigTLV(nextTlv, configTlvs, CFG_TAG_BCH_PAYLOAD, sizeof(U16), cellCfg.ssbCfg.bchPayloadFlag, &msgLen);
    fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SCS_COMM, sizeof(U16), cellCfg.ssbCfg.scsCmn, &msgLen);
-   fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_OFFS_POINT_A, sizeof(U16), cellCfg.ssbCfg.ssbPrbOffset, &msgLen);
+   fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_OFFS_POINT_A, sizeof(U16), cellCfg.ssbCfg.ssbOffsetPointA, &msgLen);
    fillConfigTLV(nextTlv, configTlvs, CFG_TAG_BETA_PSS, sizeof(U16), cellCfg.ssbCfg.betaPss, &msgLen);
    fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_PERIOD, sizeof(U16), cellCfg.ssbCfg.ssbPeriod, &msgLen);
-   fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_SUBC_OFFS, sizeof(U16), cellCfg.ssbCfg.ssbSubcOffset, &msgLen);
+   fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_SUBC_OFFS, sizeof(U16), cellCfg.ssbCfg.ssbScOffset, &msgLen);
    fillConfigTLV(nextTlv, configTlvs, CFG_TAG_MIB, sizeof(U16), cellCfg.ssbCfg.mibPdu, &msgLen);
-   fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_MASK, sizeof(U16), cellCfg.ssbCfg.nSSBMask[0], &msgLen);
+   fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SSB_MASK, sizeof(U16), cellCfg.ssbCfg.ssbMask[0], &msgLen);
    fillConfigTLV(nextTlv, configTlvs, CFG_TAG_SS_PBCH_MULT_CARR_BAND, sizeof(U16), cellCfg.ssbCfg.multCarrBand, &msgLen);
    fillConfigTLV(nextTlv, configTlvs, CFG_TAG_MULT_CELL_SS_PBCH_CARR, sizeof(U16), cellCfg.ssbCfg.multCellCarr, &msgLen);
 
index 36ead1f..d416563 100755 (executable)
@@ -244,6 +244,26 @@ U32 macHeader[2];
 #define RG_MAX_DL_HARQ_NUM   8 
 #endif
 
+#define MAC_MEM_REGION     4
+#define MAC_POOL 1
+/* allocate and zero out a MAC static buffer */
+#define MAC_ALLOC(_datPtr, _size)                            \
+{                                                            \
+   S16 _ret;                                                 \
+   _ret = SGetSBuf(MAC_MEM_REGION, MAC_POOL,                 \
+                    (Data **)&_datPtr, _size);               \
+   if(_ret == ROK)                                           \
+      cmMemset((U8*)_datPtr, 0, _size);                      \
+   else                                                      \
+      _datPtr = NULLP;                                       \
+}
+
+/* free a static buffer */
+#define MAC_FREE(_datPtr, _size)                             \
+   if(_datPtr)                                               \
+      SPutSBuf(MAC_MEM_REGION, MAC_POOL,                     \
+         (Data *)_datPtr, _size);
+
 #define RG_LCG_ISCFGD(lcg) ((lcg)->lcgId != RG_INVALID_LCG_ID)
 /* Corrected the check for dlCcchId */
 #define RG_DLCCCH_ISCFGD(cell) ((cell)->dlCcchId != RG_INVALID_LC_ID)
index 0e74458..7c72755 100755 (executable)
@@ -57,6 +57,7 @@ static int RLOG_MODULE_ID=4096;
 #include "rgr.h"           /* LRG Interface defines */
 #include "rg.h"            /* MAC defines */
 #include "rg_err.h"        /* MAC error defines */
+#include "du_log.h"
 
 /* header/extern include files (.x) */
 #include "gen.x"           /* general */
@@ -130,13 +131,13 @@ RgMngmt       *cfm,
 Pst           *cfmPst
 ));
 
-extern U16 cmPackMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
+extern U16 packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
 
-packMacCellCfgCfm packMacCellCfmOpts[] =
+packMacCellCfgConfirm packMacCellCfmOpts[] =
 {
-   cmPackMacCellCfgCfm,      /* packing for loosely coupled */
+   packMacCellCfgCfm,      /* packing for loosely coupled */
    duHandleMacCellCfgCfm,      /* packing for tightly coupled */
-   cmPackMacCellCfgCfm,    /* packing for light weight loosly coupled */
+   packMacCellCfgCfm,    /* packing for light weight loosly coupled */
 };
 \f
 /**
@@ -2133,6 +2134,14 @@ S16 MacHdlCellCfgReq
    Inst inst = pst->dstInst;
 
    cellCb = rgCb[inst].cell;
+   MAC_ALLOC(cellCb,sizeof(RgCellCb));
+
+   if(cellCb == NULLP)
+   {
+      DU_LOG("\nMAC : cellCb is NULL at handling of macCellCfg\n");
+      return RFAILED;
+   }
+
    memcpy(&cellCb->macCellCfg,macCellCfg,sizeof(MacCellCfg));
 
    macCellCfgFillCfmPst(pst,&cnfPst);
index bb14893..6a45251 100644 (file)
@@ -53,7 +53,7 @@
  *         RFAILED - failure
  *
  ***************************************************************************/
-S16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
+U16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
 {
    if(pst->selector == DU_SELECTOR_LC)
    {
@@ -72,6 +72,7 @@ S16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg)
       /* pack the address of the structure */
       CMCHKPK(cmPkPtr,(PTR)macCellCfg, mBuf);
 
+      DU_LOG("\nDU-APP : MAC CELL config sent");
       RETVALUE(SPstTsk(pst,mBuf));
    } 
 }
@@ -123,7 +124,7 @@ void unpackDuMacCellCfg(
  *
  * @details
  *
- *      Function : cmPackMacCellCfgCfm
+ *      Function : packMacCellCfgCfm
  *
  *      Functionality:
  *           packs the transaction ID  
@@ -134,7 +135,7 @@ void unpackDuMacCellCfg(
  *         RFAILED - failure
  *
  ***************************************************************************/
-U16 cmPackMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
+U16 packMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
 {
    if(pst->selector == DU_SELECTOR_LC)
    {
@@ -154,6 +155,7 @@ U16 cmPackMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
       /* only LC is supported */
       return RFAILED;
    }
+   return ROK;
 }
 
 /**************************************************************************
@@ -173,7 +175,7 @@ U16 cmPackMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm)
  *         RFAILED - failure
  *
  ***************************************************************************/
-S16 unpackMacCellCfgCfm(
+U16 unpackMacCellCfgCfm(
    DuMacCellCfgCfm func, 
    Pst *pst,
    Buffer *mBuf)
@@ -191,6 +193,7 @@ S16 unpackMacCellCfgCfm(
    {
       /* only loose coupling is suported */
    }
+   return ROK;
 }
 
 /**********************************************************************
index 335c182..51d0bee 100644 (file)
 
 #define NUM_SSB                1       /* max value is 64 */
 #define SSB_MASK_SIZE  1       /* SSB mask size is 32bit for sub6 */
+#define SIB1_NEW_TX_PERIOD      160
+#define SIB1_REPETITION_PERIOD   20
+#define CORESET_0_INDEX      0
+#define SEARCHSPACE_0_INDEX   0
+#define SIB1_MCS  4
 
 
 /* Event IDs */
@@ -112,16 +117,16 @@ typedef struct carrierCfg
 
 typedef struct ssbCfg
 {
-   U32         ssbPbchPwr;       /* SSB block power */
-   BchPduOpt   bchPayloadOption;       /* Options for generation of payload */
-   U8          scsCmn;           /* subcarrier spacing for common */
-   U16         ssbPrbOffset;     /* SSB PRB offset from point A */
+   uint32_t    ssbPbchPwr;       /* SSB block power */
+   BchPduOpt   bchPayloadFlag;   /* Options for generation of payload */
+   uint8_t     scsCmn;           /* subcarrier spacing for common */
+   uint16_t    ssbOffsetPointA;  /* SSB subcarrier offset from point A */
    BetaPss     betaPss;
    SSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
-   U8          ssbSubcOffset;    /* Subcarrier Offset */
-   U32         mibPdu;           /* MIB payload */
-   U32         nSSBMask[SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
-   U8          beamId[NUM_SSB];
+   uint8_t     ssbScOffset;       /* Subcarrier Offset */
+   uint8_t     mibPdu[3];           /* MIB payload */
+   uint32_t    ssbMask[SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
+   uint8_t     beamId[NUM_SSB];
    Bool        multCarrBand;     /* Multiple carriers in a band */
    Bool        multCellCarr;     /* Multiple cells in single carrier */
 }SsbCfg;
@@ -155,6 +160,17 @@ typedef struct tddCfg
    SlotConfig         slotCfg[MAXIMUM_TDD_PERIODICITY][MAX_SYMB_PER_SLOT]; 
 }TDDCfg;
 
+typedef struct sib1CellCfg
+{
+   uint8_t  *sib1Pdu;
+   uint16_t sib1PduLen;
+   uint16_t sib1NewTxPeriod;
+   uint16_t sib1RepetitionPeriod;
+   uint8_t coresetZeroIndex;     /* derived from 4 LSB of pdcchSib1 present in MIB */
+   uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
+   uint16_t sib1Mcs;
+} Sib1CellCfg; 
+
 typedef struct macCellCfg
 {
    U16            transId;
@@ -170,6 +186,7 @@ typedef struct macCellCfg
    PrachCfg       prachCfg;   /* PRACH Configuration */
    TDDCfg         tddCfg;     /* TDD periodicity and slot configuration */
    RSSIMeasUnit   rssiUnit;   /* RSSI measurement unit */
+   Sib1CellCfg    sib1Cfg;
 }MacCellCfg;
 
 typedef struct macCellCfgCfm
@@ -178,12 +195,12 @@ typedef struct macCellCfgCfm
 }MacCellCfgCfm;
 
 /* function pointers for packing macCellCfg Request */
-typedef S16 (*packMacCellCfgReq) ARGS((
+typedef U16 (*packMacCellCfgReq) ARGS((
    Pst           *pst,
    MacCellCfg    *macCellCfg
 ));
 
-typedef S16 (*packMacCellCfgCfm) ARGS((
+typedef S16 (*packMacCellCfgConfirm) ARGS((
    Pst              *pst,
    MacCellCfgCfm    *macCellCfgCfm
 ));
@@ -197,7 +214,7 @@ typedef S16 (*DuMacCellCfgCfm)     ARGS((
         MacCellCfgCfm *macCellCfgCfm         /* Config Structure */
      ));
 
-S16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
+U16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
 
 EXTERN S16 MacHdlCellCfgReq
 (
@@ -210,7 +227,7 @@ void cmUnpackLwLcMacCellCfg(
    Pst *pst,
    Buffer *mBuf);
 
-S16 unpackMacCellCfgCfm(
+U16 unpackMacCellCfgCfm(
    DuMacCellCfgCfm func,
    Pst *pst,
    Buffer *mBuf);
index 961ea31..41b2c58 100644 (file)
@@ -44,13 +44,13 @@ extern S16 duBuildAndSendMacCellCfg();
  * ****************************************************************/
 S16 procCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
 {
-   U16 idx;
-   S16 ret;
+   U16 idx = 0;
+   S16 ret = ROK;
 
    for(idx=0; idx<cellsToActivate.list.count; idx++)
    {
       U16 nci = 0;
-      U16 pci;
+      U16 pci = 0;
       DuCellCb *cellCb = NULLP;
 
       Cells_to_be_Activated_List_Item_t cell = cellsToActivate.list.array[idx]->\
@@ -81,15 +81,17 @@ S16 procCellsToBeActivated(Cells_to_be_Activated_List_t cellsToActivate)
       /* Now remove this cell from configured list and move to active list */
       duCb.cfgCellLst[nci-1] = NULLP;
       duCb.actvCellLst[nci-1] = cellCb;
-   }
 
-   /* Start sending scheduler config */
-   if(ret == ROK)
-   {
-      //TODO: uncomment later duSendSchGnbCfg(); 
+      /* Build and send Mac Cell Cfg for the number of active cells */
+      ret = duBuildAndSendMacCellCfg();
+      if(ret != ROK)
+      {
+         DU_LOG("\nDU APP : macCellCfg build and send failed");
+         return RFAILED;
+      }
    }
 
-   return ROK;
+   return ret;
 }
 
 /******************************************************************
@@ -170,10 +172,6 @@ S16 procF1SetupRsp(F1AP_PDU_t *f1apMsg)
    SPutSBuf(DU_APP_MEM_REGION, DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t));
 #endif
  
-   /* Build and send Mac Cell Cfg Paramaters */
-   //ret = duBuildAndSendMacCellCfg();
-   ret = BuildAndSendDUConfigUpdate();
-
    return ret;
 }
 
index cbebd46..7217d10 100644 (file)
@@ -136,15 +136,17 @@ S16 readMacCfg()
 
    /* SSB configuration */
    duCfgParam.macCellCfg.ssbCfg.ssbPbchPwr = SSB_PBCH_PWR;
-   duCfgParam.macCellCfg.ssbCfg.bchPayloadOption = BCH_PAYLOAD;
+   duCfgParam.macCellCfg.ssbCfg.bchPayloadFlag = BCH_PAYLOAD;
    duCfgParam.macCellCfg.ssbCfg.scsCmn = SUBCARRIER_SPACING;
-   duCfgParam.macCellCfg.ssbCfg.ssbPrbOffset = PRB_OFFSET;
+   duCfgParam.macCellCfg.ssbCfg.ssbOffsetPointA = OFFSET_TO_POINT_A;
    duCfgParam.macCellCfg.ssbCfg.betaPss = BETA_PSS;
    duCfgParam.macCellCfg.ssbCfg.ssbPeriod = SSB_PERIODICITTY;
-   duCfgParam.macCellCfg.ssbCfg.ssbSubcOffset = SSB_SUBCARRIER_OFFSET;
-   duCfgParam.macCellCfg.ssbCfg.mibPdu = 104;
-   duCfgParam.macCellCfg.ssbCfg.nSSBMask[0] = 2162721;
-   duCfgParam.macCellCfg.ssbCfg.nSSBMask[1] = 0;
+   duCfgParam.macCellCfg.ssbCfg.ssbScOffset = SSB_SUBCARRIER_OFFSET;
+   duCfgParam.macCellCfg.ssbCfg.mibPdu[0] = 0x01;
+   duCfgParam.macCellCfg.ssbCfg.mibPdu[1] = 0x01;
+   duCfgParam.macCellCfg.ssbCfg.mibPdu[2] = 0x84;
+   duCfgParam.macCellCfg.ssbCfg.ssbMask[0] = 1; /* only one SSB is transmitted */
+   duCfgParam.macCellCfg.ssbCfg.ssbMask[1] = 0;
    duCfgParam.macCellCfg.ssbCfg.multCarrBand = SSB_MULT_CARRIER_BAND;
    duCfgParam.macCellCfg.ssbCfg.multCellCarr = MULT_CELL_CARRIER;
 
@@ -178,6 +180,17 @@ S16 readMacCfg()
    /* RSSI Measurement configuration */
    duCfgParam.macCellCfg.rssiUnit = RSS_MEASUREMENT_UNIT;
 
+   /* fill SIB1 configuration */
+   duCfgParam.macCellCfg.sib1Cfg.sib1PduLen = duCfgParam.srvdCellLst[0].duSysInfo.sib1Len;
+   DU_ALLOC(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu,duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
+   memcpy(duCfgParam.macCellCfg.sib1Cfg.sib1Pdu, duCfgParam.srvdCellLst[0].duSysInfo.sib1Msg, \
+          duCfgParam.srvdCellLst[0].duSysInfo.sib1Len);
+   duCfgParam.macCellCfg.sib1Cfg.sib1NewTxPeriod = SIB1_NEW_TX_PERIOD;
+   duCfgParam.macCellCfg.sib1Cfg.sib1RepetitionPeriod = SIB1_REPETITION_PERIOD;
+   duCfgParam.macCellCfg.sib1Cfg.coresetZeroIndex = CORESET_0_INDEX;
+   duCfgParam.macCellCfg.sib1Cfg.searchSpaceZeroIndex = SEARCHSPACE_0_INDEX;
+   duCfgParam.macCellCfg.sib1Cfg.sib1Mcs = SIB1_MCS;
+
    /* This should be calculated based on
       (number of mandatory parameters) + (number of otional parameters being filled) */
    duCfgParam.macCellCfg.numTlv = 39;
@@ -428,6 +441,7 @@ S16 readCfg()
                        return RFAILED;
                }
                strcpy(duCfgParam.srvdCellLst[i].duSysInfo.mibMsg, encBuf);
+                duCfgParam.srvdCellLst[i].duSysInfo.mibLen = encBufSize;
 
       /*gnb DU System Info mib msg*/
       BuildSib1Msg();
@@ -438,11 +452,9 @@ S16 readCfg()
          DU_LOG("\nDU_APP: Memory allocation failure");
                        return RFAILED;
                }
-               for(int x=0; x<encBufSize; x++)
-               {
-                  duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg[x]=\
-                       encBuf[x];
-          }
+               memcpy(duCfgParam.srvdCellLst[i].duSysInfo.sib1Msg,\
+                      encBuf,encBufSize);
+                duCfgParam.srvdCellLst[i].duSysInfo.sib1Len = encBufSize;
 
    }
 
index 395c1ce..fd9b020 100644 (file)
@@ -60,7 +60,7 @@
 #define SSB_PBCH_PWR 0
 #define BCH_PAYLOAD MAC_GEN_FULL_PBCH_PAYLD
 #define SUBCARRIER_SPACING 3
-#define PRB_OFFSET 0
+#define OFFSET_TO_POINT_A 0
 #define BETA_PSS BETA_PSS_0DB
 #define SSB_PERIODICITTY SSB_PRDCTY_MS_20
 #define SSB_SUBCARRIER_OFFSET 0
@@ -536,7 +536,9 @@ typedef struct f1DuCellInfo
 typedef struct f1DuSysInfo
 {
    uint8_t   *mibMsg;   /* MIB message */
+   uint16_t  mibLen;
    uint8_t   *sib1Msg;  /* SIB1 message */
+   uint16_t  sib1Len;
 }F1DuSysInfo;
 
 typedef struct f1CuSysInfo
index ab80cea..dfd0e7d 100644 (file)
@@ -1580,6 +1580,8 @@ S16 duHandleMacCellCfgCfm(MacCellCfgCfm *macCellCfgCfm)
       /* free the memory allocated during sending macCellCfg request */
       DU_FREE(duCb.duMacCellCfg,sizeof(MacCellCfg));
       duCb.duMacCellCfg = NULLP;
+      DU_LOG("\nDU-APP : MAC CELL config confirm recieved\n");
+
 
       /* Build and send GNB-DU config update */
       ret = BuildAndSendDUConfigUpdate();