[Epic-ID: ODUHIGH-475][Task-ID: ODUHIGH-476]Integration fixes upto PRACH scheduling...
[o-du/l2.git] / src / mt / ss_msg.c
index 0cb2bb3..87e1037 100644 (file)
@@ -649,7 +649,9 @@ Buffer *mBuf
    CM_MEM_GET_REGION(tmpThrReg)
    if(tmpThrReg == 0xFF)
    {
+#ifdef ERROR_PRINT
       printf("\n Not able to get region \n");
+#endif
       return RFAILED;
    }
 #endif
@@ -1269,7 +1271,7 @@ Size size                       /* size requested */
 #endif
    /*size = tmpSize - 4;*/
    {
-      /*printf("ptr = %p *ptr = %p\n",ptr,*ptr);*/
+      /*printf("\nptr = %p *ptr = %p\n",ptr,*ptr);*/
 #ifdef XEON_SPECIFIC_CHANGES
       pthread_mutex_lock(&(memLock));
 #endif      
@@ -1280,7 +1282,7 @@ Size size                       /* size requested */
       /* store the index in the memory allocated itself */
       /**((uint32_t*)*((uint32_t*)allocatedPtr)) = idx;*/
       *((uint32_t*)allocatedPtr) = idx;
-      /*printf("region = %d idx = %d ptr = %p *ptr = %p actual = %p allocated = %p content = %d\n",region, idx, ptr, *ptr, actualPtr, allocatedPtr, *((uint32_t*)allocatedPtr));*/
+      /*printf("\nregion = %d idx = %d ptr = %p *ptr = %p actual = %p allocated = %p content = %d\n",region, idx, ptr, *ptr, actualPtr, allocatedPtr, *((uint32_t*)allocatedPtr));*/
 
       LogForStaticMemLeak(&SMemLeakInfo[region],
                           file,
@@ -2521,9 +2523,9 @@ MsgLen cnt,                 /* count */
 Buffer *mBuf
 )
 {
-   SsMsgInfo *minfo;
-   Buffer *tmp;
-   MsgLen numBytes;
+   SsMsgInfo *minfo = NULLP;
+   Buffer *tmp = NULLP;
+   MsgLen numBytes =0;
 #ifdef T2K_MEM_LEAK_DBG
    char* file = __FILE__;
    uint32_t line = __LINE__;
@@ -3370,10 +3372,10 @@ Data *dstBuf,               /* destination buffer */
 MsgLen *cCnt
 )
 {
-   Data *cptr;
-   Buffer *tmp;
-   SsMsgInfo *minfo;
-   MsgLen numBytes;
+   Data *cptr = NULLP;
+   Buffer *tmp = NULLP;
+   SsMsgInfo *minfo = NULLP;
+   MsgLen numBytes =0;
 
 #if (ERRCLASS & ERRCLS_INT_PAR)
    /* check source message buffer */
@@ -3631,7 +3633,9 @@ Buffer **dstBuf
                (Void) SPutDBuf(minfo1->region, minfo1->pool, newblk);
                newblk = curblk;
             }
-            printf("Failed to get the buffer of size %s %d\n", __FILE__, __LINE__);
+#ifdef ERROR_PRINT
+            printf("\nFailed to get the buffer of size %s %d\n", __FILE__, __LINE__);
+#endif            
             (Void) SPutMsg(*dstBuf);
             return (ROUTRES);
          }
@@ -4100,7 +4104,9 @@ Buffer **bufPtr
 #ifndef SS_DBUF_REFLOCK_DISABLE
    if((SInitLock (&(dptr->dBufLock), SS_LOCK_MUTEX)) != 0)
    {
-      printf("Falied to destroy lock\n");
+#ifdef ERROR_PRINT
+      printf("\nFalied to destroy lock\n");
+#endif
    }
 #endif
 
@@ -4146,11 +4152,11 @@ Buffer *buf
 )
 #endif
 {
-   register SsDblk *dptr;
+   register SsDblk *dptr = NULLP;
    /* ss021.103 - Addition to check return value of SFree */
-   S16 ret;
+   S16 ret = ROK;
 #if (defined(SS_USE_ZBC_MEMORY) && defined (TENB_DPDK_BUF))
-   Data  *dpdkBuf;
+   Data  *dpdkBuf = NULLP;
 #endif   
  
  
@@ -4257,7 +4263,9 @@ Buffer *buf
         ret = SUnlock(&dptr->dBufLock) ;
         if((SDestroyLock(&dptr->dBufLock)) != 0)
         {
-            printf("Falied to destroy lock\n");
+#ifdef ERROR_PRINT
+            printf("\nFalied to destroy lock\n");
+#endif
         }
 #endif
       /* free buffer to region */
@@ -5369,22 +5377,22 @@ S16 src,                    /* source id */
 S16 dst                     /* destination id */
 )
 {
-   QLen qlen;               /* queue length */
-       MsgLen mlen;             /* message length */
+   QLen qlen =0;               /* queue length */
+   MsgLen mlen =0;             /* message length */
 /*
  * SDeRegTTsk patch
  */
        /* ss038.103 : 102061 Changed to MsgLen from S16 */
-       MsgLen i;                /* counter */
-       S16 j;                   /* counter */
-   S16 k;                   /* counter */
-   uint8_t data;                 /* data */
+   MsgLen i =0;                /* counter */
+   S16 j =0;                   /* counter */
+   S16 k =0;                   /* counter */
+   uint8_t data =0;                 /* data */
    uint8_t tdata[16] = {0};            /* temporary data */
-   S8 prntBuf[256];         /* print buffer */
-   Buffer *tmp;             /* buffer ptr */
-   Data *cptr;
+   S8 prntBuf[256] ={0};         /* print buffer */
+   Buffer *tmp = NULLP;             /* buffer ptr */
+   Data *cptr =NULLP;
 /* ss012.13: Addition */
-   Data reg;
+   Data reg =0;
 
 
 
@@ -5401,6 +5409,7 @@ S16 dst                     /* destination id */
    mlen = ((SsMsgInfo*)(mBuf->b_rptr))->len;
    reg = ((SsMsgInfo*)(mBuf->b_rptr))->region;
    /*ss013.301: Fixed Warnings for 32/64 bit compilation*/
+#ifdef DEBUG_PRINT
    sprintf(prntBuf,"\nmsg: qlen: %04d mlen: %04d   %02d-->%02d region: %02d\n",
            (uint16_t)qlen,(uint16_t)mlen,src,dst,reg);
    SPrint( prntBuf);
@@ -5410,6 +5419,7 @@ S16 dst                     /* destination id */
    SPrint((S8*) "dat: ");
 #ifdef XEON_SPECIFIC_CHANGES
    printf("\ndat: ");
+#endif   
 #endif   
 
    if (mlen == 0)
@@ -5433,9 +5443,11 @@ S16 dst                     /* destination id */
             /* print hex */
             tdata[j]=data;
             sprintf( prntBuf,"%02x ",(uint16_t) data);
+#ifdef DEBUG_PRINT
             SPrint( prntBuf);
 #ifdef XEON_SPECIFIC_CHANGES
    printf("%s\n", prntBuf);
+#endif
 #endif   
             if (cptr == tmp->b_wptr)
             {
@@ -5451,9 +5463,11 @@ S16 dst                     /* destination id */
          else
          {
             sprintf( prntBuf,"   ");
+#ifdef DEBUG_PRINT
             SPrint( prntBuf );
 #ifdef XEON_SPECIFIC_CHANGES
    printf("%s\n", prntBuf);
+#endif
 #endif   
          }
       } 
@@ -5465,25 +5479,31 @@ S16 dst                     /* destination id */
          {
             /* print character if printable */
             sprintf(prntBuf,"%c",tdata[k]);
+#ifdef DEBUG_PRINT
             SPrint( prntBuf);
 #ifdef XEON_SPECIFIC_CHANGES
    printf("%s\n", prntBuf);
+#endif
 #endif   
          }
          else
          {
             /* print . if non printable */
+#ifdef DEBUG_PRINT
             SPrint((S8*) ".");
 #ifdef XEON_SPECIFIC_CHANGES
    printf(".");
 #endif   
+#endif
          }
       }
       sprintf(prntBuf,"\n     ");
+#ifdef DEBUG_PRINT
       SPrint(prntBuf);
 #ifdef XEON_SPECIFIC_CHANGES
    printf("%s\n", prntBuf);
 #endif   
+#endif
    }
    return ROK;
 
@@ -7291,7 +7311,7 @@ Buffer *dstBuf              /* message 2 */
             idx -= sCnt;
             /* deallocate the sBuf here */
             tmp = sBuf->b_cont;
-            /* printf("SMovPartMsg() sBuf is completely copied sBuf->b_cont(%p)\n", sBuf->b_cont); */
+            /* printf("\nSMovPartMsg() sBuf is completely copied sBuf->b_cont(%p)\n", sBuf->b_cont); */
             (Void)SPutDBuf(sMinfo->region, sMinfo->pool, sBuf);
             srcBuf->b_cont = sBuf = tmp;
          }
@@ -7558,7 +7578,9 @@ Buffer** mBuf
 #ifndef SS_DBUF_REFLOCK_DISABLE
    if((SInitLock (&(dptr->dBufLock), SS_LOCK_MUTEX)) != 0)
    {
-      printf("Falied to destroy lock\n");
+#ifdef ERROR_PRINT
+      printf("\nFalied to destroy lock\n");
+#endif     
    }
 #endif
 
@@ -7668,7 +7690,9 @@ Buffer *buf
          ret = SUnlock(&dptr->dBufLock) ;
          if((SDestroyLock(&dptr->dBufLock)) != 0)
          {
-             printf("Falied to destroy lock\n");
+#ifdef ERROR_PRINT
+             printf("\nFalied to destroy lock\n");
+#endif
          }
 #endif
 #ifdef SS_HISTOGRAM_SUPPORT 
@@ -7789,7 +7813,9 @@ Buffer** mBuf
 #ifndef SS_DBUF_REFLOCK_DISABLE
    if((SInitLock (&(dptr->dBufLock), SS_LOCK_MUTEX)) != 0)
    {
-      printf("Falied to destroy lock\n");
+#ifdef ERROR_PRINT
+      printf("\nFalied to destroy lock\n");
+#endif
    }
 #endif
 
@@ -7800,7 +7826,7 @@ Buffer** mBuf
    minfo->len    = totalLen;
    minfo->endptr = newblk;
 
-   //printf("Mbuf PTR = %x, DBlk PTR = %x, PTR = %x\n", *mBuf, newblk, ptr);
+   //printf("\nMbuf PTR = %x, DBlk PTR = %x, PTR = %x\n", *mBuf, newblk, ptr);
    return ROK;
 }
 #endif /* INTEL_WLS */
@@ -7828,7 +7854,7 @@ Void SResetMBuf(Buffer *mbuf)
    if(tmp)
    {
 
-    //    printf("SResetMBuf The write & read ptr is %p %p %p %p \n", tmp->b_wptr, tmp->b_rptr, tmp->b_datap->db_base, tmp->b_datap->db_lim );
+    //    printf("\nSResetMBuf The write & read ptr is %p %p %p %p \n", tmp->b_wptr, tmp->b_rptr, tmp->b_datap->db_base, tmp->b_datap->db_lim );
 //      tmp->b_wptr = tmp->b_rptr = tmp->b_datap->db_base;
       tmp->b_wptr = tmp->b_rptr = (tmp->b_datap->db_base + 5);
       tmp->b_datap->db_ref = 1;
@@ -7936,7 +7962,9 @@ Buffer** mBuf
 #ifndef SS_DBUF_REFLOCK_DISABLE
    if((SInitLock (&(dptr->dBufLock), SS_LOCK_MUTEX)) != 0)
    {
-      printf("Falied to destroy lock\n");
+#ifdef ERROR_PRINT
+      printf("\nFalied to destroy lock\n");
+#endif
    }
 #endif
 
@@ -7947,7 +7975,7 @@ Buffer** mBuf
    minfo->len    = totalLen;
    minfo->endptr = newblk;
 
-   //printf("Mbuf PTR = %x, DBlk PTR = %x, PTR = %x\n", *mBuf, newblk, ptr);
+   //printf("\nMbuf PTR = %x, DBlk PTR = %x, PTR = %x\n", *mBuf, newblk, ptr);
    return ROK;
 }
 
@@ -7973,7 +8001,7 @@ S16 SPutSBufDpdk
 Data *ptr                     /* pointer to buffer */
 )
 {
-    S16   ret;
+    S16   ret = ROK;
     uint32_t   flags = 0;
 
     ntl_free(mtGetNtlHdl(), ptr);