Merge "Cleanup of message sib1"
[o-du/l2.git] / src / mt / mt_ss.c
index b72c9e3..427c89d 100644 (file)
 #include "sys/syscall.h"
 #endif
 
-#ifdef RGL_SPECIFIC_CHANGES
+#if defined(RGL_SPECIFIC_CHANGES) || defined(INTEL_WLS)
 #include <wls_lib.h>
 #include <hugetlbfs.h>
 #endif
 
+#ifdef INTEL_WLS
+EXTERN void LwrMacRecvPhyMsg();
+#endif
+
 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
 EXTERN S16 rgBatchProc (Void);
 #endif
@@ -626,19 +630,11 @@ PUBLIC MtMemCfg mtMemoCfg =
          {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS},   /* block size, no. of blocks */
          {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}    /* block size, no. of blocks */
 #else
-#if 0
-        {256, 500000},
-         {512, 11000},
-         {2048, 100000},
-         {8192, 75128},
-        {16384, 4096}
-#else  /* Page boundary alignment */
          {256, 491520}, /* 60 pages of 2M*/
          {512, 12288},  /* 3 pages of 2M */
          {2048, 99328}, /* 97 Pages of 2M */
          {8192, 75008}, /* 293 Pages of 2M */
          {16384, 4096}  /* 32 pages of 2M */
-#endif
 #endif        
       }
     },
@@ -695,7 +691,19 @@ PUBLIC MtMemCfg mtMemoCfg =
         {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS},   /* block size, no. of blocks */
         {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}    /* block size, no. of blocks */
       }
+    },
+    {
+       SS_DFLT_REGION + 4,                         /* region id */
+       MT_MAX_BKTS,                            /* number of buckets */
+       MT_HEAP_SIZE,                           /* heap size */
+       {
+          {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS},   /* block size, no. of blocks */
+          {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS},    /* block size, no. of blocks */
+          {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS},   /* block size, no. of blocks */
+          {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}    /* block size, no. of blocks */
+       }
     }
+
 #endif /* SS_LOCKLESS_MEMORY */
     STATIC_MEM_CFG
   }
@@ -769,7 +777,7 @@ PRIVATE int SOpenWlsIntf()
    hdl = WLS_Open(WLS_DEVICE_NAME, 1);
 #endif
 #else
-   hdl = WLS_Open(WLS_DEVICE_NAME, 0);
+   hdl = WLS_Open(WLS_DEVICE_NAME, WLS_MASTER_CLIENT, (512 *1024 * 1024));
 #endif
 
    osCp.wls.intf = hdl;
@@ -1394,7 +1402,6 @@ Region reg;
 {
    CmMmGlobRegCb        *globReg;
    CmMmGlobalBktCb      *bktCb;
-   U8                    blkCnt;
    U8 bktIdx= reg;
  TRC3(isMemThreshReached)
 
@@ -1506,7 +1513,7 @@ PUBLIC S16 SPartitionWlsMemory()
    for (i = 0; i < 1; i++)
    {
       mtRegMemSz[i].startAddr = regMemStrtAddr;
-      CM_LOG_DEBUG(CM_LOG_ID_MT, "Global Region-->Bkt[%d] Addr:%p\n", i, mtRegMemSz[i].startAddr);
+      //CM_LOG_DEBUG(CM_LOG_ID_MT, "Global Region-->Bkt[%d] Addr:%p\n", i, mtRegMemSz[i].startAddr);
 
       numHugePg = DIV_ROUND_OFFSET(mtRegMemSz[i].reqdSz, hugePageSize);
       reqdSz    = numHugePg * hugePageSize;
@@ -4901,6 +4908,11 @@ Ptr tskPtr;                     /* pointer to task entry */
 #endif   
    while (1)
    {
+#ifndef ODU_TEST_STUB
+#ifdef INTEL_WLS
+      LwrMacRecvPhyMsg();
+#endif
+#endif
       /* Wait for a message from the demand queue */
 #ifdef SS_CDMNDQ_SUPPORT
       ret = ssCDmndQWait(&sTsk->dQ);
@@ -8632,10 +8644,7 @@ PUBLIC S16 SInitLock(SLockId *l, U8 t)
 PUBLIC Void ssRegMainThread(Void)
 {
 
-#if 0
-#else
    if(SS_INVALID_THREAD_REG_MAP != SS_GET_THREAD_MEM_REGION())
-#endif
    {
       printf("not able to get different Id for main thread\n");
       exit(1);
@@ -8644,14 +8653,11 @@ PUBLIC Void ssRegMainThread(Void)
     * Main thread. The thread should not perform any allocation except 
     * the initial configuratin 
     */
-#if 0
-#else
 #ifdef XEON_SPECIFIC_CHANGES
    SS_GET_THREAD_MEM_REGION() = mtMemoCfg.numRegions;
 #else   
    SS_GET_THREAD_MEM_REGION() = 
 #endif      
-#endif
                                                                   DFLT_REGION;
 }
 
@@ -8694,11 +8700,8 @@ Region       region       /* Region associated with thread */
    /* Here  0xFF is considered as invalid region and if the mapping table
     * contains 0xFF, that mapping entry is free
     */
-#if 0
-#else
    if(SS_INVALID_THREAD_REG_MAP != 
             osCp.threadMemoryRegionMap[((threadId >> SS_MEM_THREAD_ID_SHIFT) % SS_MAX_THREAD_REGION_MAP)])
-#endif
    {
       /* Klock work fix ccpu00148484 */
       if(!(createdThreads < SS_MAX_THREAD_CREATE_RETRY))
@@ -8713,15 +8716,12 @@ Region       region       /* Region associated with thread */
    /* If we found free mapping table entry, place the region and send pthread_cancel
     * for all the thread Ids which are created before this 
     */
-#if 0
-#else
    osCp.threadMemoryRegionMap[((threadId >> SS_MEM_THREAD_ID_SHIFT) % SS_MAX_THREAD_REGION_MAP)] = region;
 #ifdef XEON_SPECIFIC_CHANGES
    printf("ThreadId %ld, Thread Idx %d, Region %d\n", threadId,
           ((threadId >> SS_MEM_THREAD_ID_SHIFT) % 
           SS_MAX_THREAD_REGION_MAP), region);
 #endif   
-#endif
    for(indx = 0; indx < createdThreads; indx++)
    {
 #ifdef XEON_SPECIFIC_CHANGES