Replaced old SSI function with new macros jira id - ODUHIGH-212
[o-du/l2.git] / src / mt / ss_rbuf.c
index e0ef97c..5169291 100755 (executable)
@@ -88,7 +88,7 @@ U32 rngSize;
 #if (ERRCLASS & ERRCLS_DEBUG)
       SSLOGERROR(ERRCLS_DEBUG, ESSXXX, id, "Invalid RBUF ID");
 #endif
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
    if(SsRngInfoTbl[id].r_addr != 0)
    {
@@ -96,7 +96,7 @@ U32 rngSize;
       SSLOGERROR(ERRCLS_DEBUG, ESSXXX, id, 
             "Failed to Create Ring Buffer Id Ring already exist");
 #endif
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
    /* Get Element Size */
    
@@ -108,7 +108,7 @@ U32 rngSize;
 #if (ERRCLASS & ERRCLS_DEBUG)
       SSLOGERROR(ERRCLS_INT_PAR, ESSXXX, ERRZERO, "Allocating Ring  Failed!!!")
 #endif
-      RETVALUE(RFAILED);
+      return RFAILED;
    }
 #if (ERRCLASS & ERRCLS_DEBUG)
       SSLOGERROR(ERRCLS_DEBUG, ESSXXX, ring, 
@@ -128,7 +128,7 @@ U32 rngSize;
       SSLOGERROR(ERRCLS_INT_PAR, ESSXXX, ERRZERO, "Allocating Ring  Failed!!!")
 #endif
       free(ring);
-      RETVALUE(RFAILED);
+      return RFAILED;
     }
     /* Update Buffer Id Table */
     SsRngInfoTbl[id].r_addr   = ring;
@@ -141,7 +141,7 @@ U32 rngSize;
 #else
     printf("Ring Buffer Created with id =%d rSize:%d eSize:%d %lx\n",id,ring->size,ring->type,(PTR)ring);
 #endif
-    RETVALUE(ROK);
+    return ROK;
 }
 
 /*
@@ -169,7 +169,7 @@ U32 txRx;
 #if (ERRCLASS & ERRCLS_DEBUG)
       SSLOGERROR(ERRCLS_DEBUG, ESSXXX, id, "Invalid RBUF ID");
 #endif
-       RETVALUE(RFAILED);
+       return RFAILED;
     }
     if(SsRngInfoTbl[id].rngState < SS_RNG_CREATED)
     {
@@ -184,7 +184,7 @@ U32 txRx;
        printf("Attach Request in Invalid Ring State %d id%d \n",
          SsRngInfoTbl[id].rngState,id);
 #endif
-       RETVALUE(RFAILED);
+       return RFAILED;
     }
     if(txRx == SS_RNG_TX)
     {
@@ -196,7 +196,7 @@ U32 txRx;
         SsRngInfoTbl[id].rxEnt = ent;
         SsRngInfoTbl[id].rngState = SS_RNG_RX_ATTACHED;
     }
-    RETVALUE(ROK);
+    return ROK;
 }
 /* 
 Func: SConnectSRngBuf
@@ -216,7 +216,7 @@ U32 rxEnt;
 #endif
 {
    /* Send to Reciever ENT*/ 
-   RETVALUE(ROK)
+   return ROK
 }
 
 /*
@@ -225,10 +225,6 @@ Desc: Checks if Ring is full
 */
 inline static S16 IsFull(SsRngBuf* rBuf)
 {
-#if 0
-   /* write+1 == read implies ring is full */
-   return ((((rBuf->write + 1)> rBuf->size)?0:(rBuf->write+1))==rBuf->read);
-#endif
 #if 1
    if((rBuf->write+1) == rBuf->read)
    {
@@ -285,7 +281,7 @@ Void* elem;
    if (IsFull(ring))
    {
         SsRngInfoTbl[id].nWriteFail++;
-        RETVALUE(RFAILED);
+        return RFAILED;
    }
    /* TBD Avoid multiplication for optimisation */
    w_ptr = (U8*)ring->elem + (ring->write * ring->type);
@@ -301,7 +297,7 @@ Void* elem;
     ring->write = (wrIndex == ring->size)?0: wrIndex;
    /* Update Statistics */
    SsRngInfoTbl[id].n_write++;
-   RETVALUE(ROK);
+   return ROK;
 }
 
 #ifdef ANSI
@@ -317,7 +313,7 @@ U32 id;
 
    S16 freeDist = (SsRngInfoTbl[id].n_write- SsRngInfoTbl[id].n_read);
 
-       RETVALUE(freeDist);
+       return (freeDist);
 }
 /*
 Func: SDeqSRngBuf
@@ -344,7 +340,7 @@ Void *elem;
    if(IsEmpty(ring))
    {  
        SsRngInfoTbl[id].nReadFail++;
-       RETVALUE(RFAILED);
+       return RFAILED;
    }
    r_ptr = (U8*)ring->elem + (ring->read * ring->type);
    for(i=0; i<ring->type; i++)
@@ -357,7 +353,7 @@ Void *elem;
    rdIndex= ring->read + 1;
    ring->read = (rdIndex == ring->size)?0:rdIndex;
    SsRngInfoTbl[id].n_read++;
-   RETVALUE(ROK);
+   return ROK;
 }
 
 #ifdef ANSI
@@ -388,7 +384,7 @@ Pool pool;
       SsRngInfoTbl[id].rngState = SS_RNG_DESTROYED;
       SsRngInfoTbl[id].r_addr = 0;
    }
-   RETVALUE(ROK);
+   return ROK;
 }
 
 #ifdef ANSI
@@ -406,7 +402,7 @@ U32 i;
    Txt   prntBuf[100];
 
 #ifdef RGL_SPECIFIC_CHANGES
-   RETVALUE(ROK);
+   return ROK;
 #endif
    for(i=0; i< SS_RNG_BUF_MAX;i++)
    {
@@ -462,7 +458,7 @@ U32 i;
 #endif
       }
    }
-   RETVALUE(ROK)
+   return ROK
 }
 
 #ifdef ANSI
@@ -480,11 +476,11 @@ U32 rngId;
    if (IsFull(ring))
    {
       SsRngInfoTbl[rngId].nWriteFail++;
-      RETVALUE(NULLP);
+      return (NULLP);
    }
    else
    {
-      RETVALUE(((U8 *)ring->elem) + (ring->type * ring->write));
+      return (((U8 *)ring->elem) + (ring->type * ring->write));
    }
 }
 
@@ -503,11 +499,11 @@ U32 rngId;
    if(IsEmpty(ring))
    {
       SsRngInfoTbl[rngId].nReadFail++;
-      RETVALUE(NULLP);
+      return (NULLP);
    }
    else
    {
-      RETVALUE(((U8 *)ring->elem) + (ring->type * ring->read));
+      return (((U8 *)ring->elem) + (ring->type * ring->read));
    }
 }
 
@@ -576,40 +572,13 @@ S16 mtAddBufToRing(SsRngBufId ringId,void *bufPtr,U8 freeType)
       SsRngInfoTbl[ringId].pktDrop++;
       ret1 = RFAILED;
    }
-   RETVALUE(ret1);
+   return (ret1);
 }
 #endif
 #endif
 
 
 
-#if 0
-int main(int argc, char **argv) 
-{
-    SCreateSRngBuf(1,sizeof(SsRngBuf), 10);
-    rngElem* buf; 
-    /* Fill buffer with test elements 3 times */
-    buf = (SsRngBuf*)malloc(sizeof(rngBuf));
-    buf->ptr = 1;
-    SEnqSRngBuf(1, buf);
-    buf = (SsRngBuf*)malloc(sizeof(rngBuf));
-    buf->ptr = 2;
-    SEnqSRngBuf(1, buf);
-    buf = (SsRngBuf*)malloc(sizeof(rngBuf));
-    buf->ptr = 3;
-    SEnqSRngBuf(1, buf);
-
-   SDeqSRngBuf(1,buf);
-   printf("buf 1 = %d",buf->ptr);
-   SDeqSRngBuf(1,buf);
-   printf("buf 2 = %d",buf->ptr);
-   SDeqSRngBuf(1,buf);
-   printf("buf 3 = %d",buf->ptr);
-    return 0;
-}
-#endif
-
 /**********************************************************************
          End of file
 **********************************************************************/