#endif
#include "cm_lte.x"
-
+#include "du_log.h"
\f
/* local defines */
/*ccpu00142274 - UL mem based flow control changes */
}CmMemDoubleFree;
PTR prvAllocPtr[8];
-uint8_t stopBtInfo = FALSE;
+extern uint8_t stopBtInfo = FALSE;
Buffer *palBuffer;
-Buffer *mtTskBuffer1;
-Buffer *mtTskBuffer2;
+extern Buffer *mtTskBuffer1;
+extern Buffer *mtTskBuffer2;
#ifdef SS_USE_ICC_MEMORY
static pthread_mutex_t iccAllocFreeLock;
#endif
uint32_t num_times = 0;
-pthread_t tmpRegTidMap[20];
-Bool g_usettitmr;
+extern pthread_t tmpRegTidMap[20];
+extern Bool g_usettitmr;
void DumpLayersDebugInformation()
{
DumpSSIDemandQDebugInformation();
return RFAILED;
}
SUnlock(&memDoubleFreeLock);
- SPutSBuf(regionCb->region, 0, (Data *)memNode, sizeof(CmMemDoubleFree));
+ SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,regionCb->region, 0, (Data *)memNode, sizeof(CmMemDoubleFree));
return ROK;
}
CmMemDoubleFree *memNode;
- SGetSBuf(regionCb->region, 0, (Data **)&memNode, sizeof(CmMemDoubleFree));
+ SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,regionCb->region, 0, (Data **)&memNode, sizeof(CmMemDoubleFree));
if(memNode == NULLP)
{
return RFAILED;
{
S16 ret;
-
if((SLock(&dynAllocFreeLock)) != ROK)
{
printf("cmDynAllocWithLock: Failed to get the dyn lock\n");
#if (ERRCLASS & ERRCLS_INT_PAR)
/* error check on parameters */
- if ((regCb == NULLP) || (size == NULLP) || !(*size) || (ptr == NULLP))
+ if(regCb == NULLP)
+ {
+ DU_LOG("\nERROR --> CM: cmDynAlloc(): Received memory region pointer is null");
+ return RFAILED;
+ }
+
+ if(ptr == NULLP)
+ {
+ DU_LOG("\nERROR --> CM: cmDynAlloc(): Received memory block pointer is null");
+ return RFAILED;
+ }
+
+ if(size == NULLP)
{
+ DU_LOG("\nERROR --> CM: cmDynAlloc(): Received memory size pointer null");
+ return RFAILED;
+ }
+
+ if(!(*size))
+ {
+ DU_LOG("\nERROR --> CM: cmDynAlloc(): Received memory block size is 0");
return RFAILED;
}
#endif
#if (ERRCLASS & ERRCLS_DEBUG)
if (regCb->mapTbl[idx].bktIdx == 0xFF)
- {
- printf("Failed to get the buffer of size %d\n", *size);
+ {
+ DU_LOG("\nERROR --> CM: cmDynAlloc(): Failed to get the buffer of size %d\n", *size);
/* Some fatal error in the map table initialization. */
return RFAILED;
}
#endif
if (idx > 512)
{
+ DU_LOG("\nERROR --> CM: cmDynAlloc(): idx value is greater than 512");
return RFAILED;
}
/* Dequeue the memory block and return it to the user */
if(dynMemElem == NULLP)
{
#ifndef ALIGN_64BIT
- printf("Failed to get the buffer of size %ld\n", *size);
+ DU_LOG("\nERROR --> CM: cmDynAlloc(): Failed to get the buffer of size %ld\n", *size);
#else
- printf("Failed to get the buffer of size %d\n", *size);
+ printf("\nERROR --> CM: cmDynAlloc(): Failed to get the buffer of size %d\n", *size);
#endif
return RFAILED;
}
*ptr = dynMemElem->nextBktPtr;
if (*ptr == NULLP)
{
+ DU_LOG("\nERROR --> CM: cmDynAlloc(): nextBktPtr is null");
return RFAILED;
}
dynMemElem->nextBktPtr = *((CmMmEntry **)(*ptr));
/* If the size is not matching, return failure to caller */
#ifndef ALIGN_64BIT
- printf("Failed to get the buffer of size %ld\n", *size);
+ DU_LOG("\nERROR --> CM : cmDynAlloc(): Failed to get the buffer of size %ld\n", *size);
#else
- printf("Failed to get the buffer of size %d\n", *size);
+ DU_LOG("\nERROR --> CM: cmDynAlloc(): Failed to get the buffer of size %d\n", *size);
#endif
return RFAILED;
*ptr = (Data *)malloc(*size);
if ( (*ptr) == NULLP)
- return RFAILED;
+ {
+ DU_LOG("\nERROR --> CM : cmDynAlloc(): Data ptr is null");
+ return RFAILED;
+ }
/* avail_size -= *size; */
return ROK;
#endif /* USE_PURE */
#if (ERRCLASS & ERRCLS_INT_PAR)
/* error check on parameters */
- if ((regCb == NULLP) || (size == NULLP) || !(*size) || (ptr == NULLP))
+ if(regCb == NULL)
{
+ DU_LOG("\nERROR --> CM: cmDynAlloc(): Received memory region pointer is null");
+ return RFAILED;
+ }
+
+ if(ptr == NULLP)
+ {
+ DU_LOG("\nERROR --> CM: cmDynAlloc(): Received memory block pointer is null");
+ return RFAILED;
+ }
+
+ if(size == NULLP)
+ {
+ DU_LOG("\nERROR --> CM: cmDynAlloc(): Received memory size pointer null");
+ return RFAILED;
+ }
+
+ if(!(*size))
+ {
+ DU_LOG("\nERROR --> CM: cmDynAlloc(): Received memory block size is 0");
return RFAILED;
}
#endif
#if (ERRCLASS & ERRCLS_INT_PAR)
if ((memType != CMM_STATIC_MEM_FLAG) && (memType != CMM_DYNAMIC_MEM_FLAG))
{
+ DU_LOG("\nERROR --> CM : cmAlloc(): memType[%d] is invalid",memType);
return RFAILED;
}
#endif /* (ERRCLASS & ERRCLS_INT_PAR) */
if (regCb->mapTbl[idx].bktIdx == 0xFF)
{
/* Some fatal error in the map table initialization. */
+ DU_LOG("\nERROR --> CM : cmAlloc(): bktIdx is invalid");
return RFAILED;
}
#endif
#else
(Void) SUnlock(&(bkt->bktLock));
#endif
+ DU_LOG("\nERROR --> CM : cmAlloc(): Sanity check returns failure");
/* return RFAILED */
return RFAILED;
}
}
/* No memory available */
+ DU_LOG("\nERROR --> CM : cmAlloc(): No memory available in heap");
return RFAILED;
#else /* use pure is on */
/*cm_mem_c_001.main_27 SSI-4GMX specfic changes*/
*ptr = (Data*) malloc(*size);
#endif
if ( (*ptr) == NULLP)
+ {
+ DU_LOG("\nERROR --> CM : cmAlloc(): ptr is null");
return RFAILED;
+ }
avail_size -= *size;
return ROK;
#endif /* USE_PURE */
)
{
S16 ret;
-
+
if((SLock(&dynAllocFreeLock)) != ROK)
{
printf("dynAllocWithLock: Failed to get the DYN lock\n");
/* error check on parameters */
if ((regCb == NULLP) || (!size) || (ptr == NULLP))
{
+ DU_LOG("\nERROR --> CM : cmDynFree(): Received memory region[%p] or size[%p] or block[%p] is invalid",regCb,size,ptr);
return RFAILED;
}
if (ptr >= ((CmMmRegCb *)regCb)->regInfo.start +
((CmMmRegCb *)regCb)->regInfo.size)
{
+ DU_LOG("\nERROR --> CM : cmDynFree(): Memory block[%p] not from region[%d]", ptr, ((CmMmRegCb *)regCb)->region);
return RFAILED;
}
/* cm_mem_c_001.main_20 Addition */
if (ptr < regCb->regInfo.start)
{
- return RFAILED;
+ DU_LOG("\nERROR --> CM : cmDynFree(): Memory block[%p] not from region[%d]", ptr, ((CmMmRegCb *)regCb)->region);
+ return RFAILED;
}
#endif
#if (ERRCLASS & ERRCLS_DEBUG)
if (regCb->mapTbl[idx].bktIdx == 0xFF)
{
+ DU_LOG("\nERROR --> CM : cmDynFree(): bktIdx is not valid");
/* Some fatal error in the map table initialization. */
return RFAILED;
}
#ifdef SS_MEM_WL_DEBUG
if (size > bkt->size)
{
- printf("Size = %d bucket size = %d\n", size, bkt->size);
+ DU_LOG("Size = %d bucket size = %d\n", size, bkt->size);
exit(-1);
bkt = &(regCb->bktTbl[bktIdx = regCb->mapTbl[++idx].bktIdx]);
}
if(size > bkt->size)
{
- printf("2nd time Size = %d bucket size = %d\n", size, bkt->size);
+ DU_LOG("2nd time Size = %d bucket size = %d\n", size, bkt->size);
exit(-1);
uint8_t *tmpptr = NULLP;
printf("Bucket Size wrong \n");
/* Check if the bucket index, if its not valid, return failure */
if(dynMemElem == NULLP)
{
+ DU_LOG("\nERROR --> CM : cmDynFree(): dynMemElem is null");
return RFAILED;
}
memset(ptr, (regCb->region+1), bkt->size);
#endif
-
/* Get the bucket node from the index returned and allocate the memory */
*((CmMmEntry **)ptr) = dynMemElem->nextBktPtr;
dynMemElem->nextBktPtr = ptr;
/* error check on parameters */
if ((regCb == NULLP) || (!size) || (ptr == NULLP))
{
+ DU_LOG("\nERROR --> CM : cmFree(): Received memory region[%p] or size[%p] or block[%p] is invalid",regCb,size,ptr);
return RFAILED;
}
if (ptr >= ((CmMmRegCb *)regCb)->regInfo.start +
((CmMmRegCb *)regCb)->regInfo.size)
{
+ DU_LOG("\nERROR --> CM : cmFree(): Memory block[%p] not from region[%d]",ptr,regCb.region);
return RFAILED;
}
/* cm_mem_c_001.main_20 Addition */
if (ptr < regCb->regInfo.start)
{
+ DU_LOG("\nERROR --> CM : cmFree(): Memory block[%p] not from region[%d]",ptr,regCb.region);
return RFAILED;
}
if (regCb->mapTbl[idx].bktIdx == 0xFF)
{
/* Some fatal error in the map table initialization. */
+ DU_LOG("\nERROR --> CM : cmFree(): Invalid bktIdx");
return RFAILED;
}
#endif
#endif
/* handle RTRAMPLINGNOK in SFree/SPutSBuf */
+ DU_LOG("\nERROR --> CM : cmFree(): Sanity check returns failure");
return (RTRAMPLINGNOK);
}
}
#endif
/* handle RDBLFREE in SFree/SPutSBuf */
+ DU_LOG("\nERROR --> CM : cmFree(): Memory block is already freed");
return (RDBLFREE);
}
if (CMM_IS_STATIC(ptrHdr->memFlags))
#endif
/* handle RTRAMPLINGNOK in SFree/SPutSBuf */
+ DU_LOG("\nERROR --> CM : cmFree(): Sanity check returns failure");
return (RTRAMPLINGNOK);
}
}
#else
free(funcNm[i]);
#endif
- /* SPutSBuf(DFLT_REGION, DFLT_POOL, funcNm[i], sizeof(uint32_t) * CM_MAX_STACK_TRACE); */
+ /* SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,DFLT_REGION, DFLT_POOL, funcNm[i], sizeof(uint32_t) * CM_MAX_STACK_TRACE); */
}
#endif /* SS_MEM_LEAK_SOl */
/*cm_mem_c_001.main_27 SSI-4GMX specfic changes*/
#else
funcNm = (S8 **)calloc(1, (sizeof(uint32_t) * CM_MAX_STACK_TRACE));
#endif
- /* SGetSBuf(DFLT_REGION, DFLT_POOL, &funcNm, sizeof(uint32_t) * CM_MAX_STACK_TRACE); */
+ /* SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,DFLT_REGION, DFLT_POOL, &funcNm, sizeof(uint32_t) * CM_MAX_STACK_TRACE); */
traceSize = backtrace((Void **)funcNm, CM_MAX_STACK_TRACE);
#else /* SS_MEM_LEAK_SOL */
traceSize = backtrace(trace, CM_MAX_STACK_TRACE);
#else
allocInfo = (MemAllocInfo *)calloc(1, sizeof(MemAllocInfo));
#endif
- /* SGetSBuf(DFLT_REGION, DFLT_POOL, &allocInfo, sizeof(MemAllocInfo)); */
+ /* SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,DFLT_REGION, DFLT_POOL, &allocInfo, sizeof(MemAllocInfo)); */
allocInfo->memAddr = addr;
allocInfo->reqSz = reqSz;
allocInfo->allocSz = allocSz;
#else
buffer = (S8 *)calloc(1, 510);
#endif
- /* SGetSBuf(DFLT_REGION, DFLT_POOL, &buffer, 510); */
+ /* SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,DFLT_REGION, DFLT_POOL, &buffer, 510); */
(void) cmAddrToSymStr((void *)pc, buffer, 505);
bt->bt_buffer[bt->bt_actcount++] = (S8 *)buffer;
/* allocate memory for bins */
if (nmbBins)
{
- if (SGetSBuf(region, pool, (Data **) &hashListCp->hashList,
+ if (SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,region, pool, (Data **) &hashListCp->hashList,
(Size)(nmbBins * sizeof(CmMmHashListEnt))) != ROK)
return RFAILED;
/* deallocate memory for bins */
if (hashListCp->numOfbins)
- (Void) SPutSBuf(region, pool,
+ (Void) SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,region, pool,
(Data *) hashListCp->hashList,
(Size) (hashListCp->numOfbins * sizeof(CmMmHashListEnt)));