From 53901c3e0222965c2dd8822add20a4fbd3d6a6da Mon Sep 17 00:00:00 2001 From: sphoorthi Date: Fri, 12 Feb 2021 10:24:07 +0530 Subject: [PATCH] Classification of CM logs Part-2 [JIRA ID - ODUHIGH-275] Change-Id: I5dfce781be1822ea5eb442a8f4cb8f80cdedd987 Signed-off-by: sphoorthi --- src/cm/cm_mem.c | 63 +++++++++++++++++++++++++++++---------------------------- src/cm/ctf.c | 6 +++--- src/cm/legtp.c | 14 ++++++------- src/cm/lsctp.c | 4 ++-- 4 files changed, 44 insertions(+), 43 deletions(-) diff --git a/src/cm/cm_mem.c b/src/cm/cm_mem.c index 4ef65d623..46c32de0a 100755 --- a/src/cm/cm_mem.c +++ b/src/cm/cm_mem.c @@ -294,7 +294,7 @@ void InsertToT2kMemLeakInfo(uint64_t address, uint32_t size, uint32_t lineNo, ch if(((uint64_t)(address - regMemLeakInfo.regStartAddr[region]) & regMinBktSzInfo[region].minBktSzMins1) !=0) { - printf("address in InsertToT2kMemLeakInfo is %ld size = %d file is %s line is %d \n", address, size, fileName, lineNo); + DU_LOG("\nINFO --> address in InsertToT2kMemLeakInfo is %ld size = %d file is %s line is %d \n", address, size, fileName, lineNo); } leakInfo = (((T2kMeamLeakInfo*)(regMemLeakInfo.gMemLeakInfo[region])) + index1); @@ -308,7 +308,8 @@ void InsertToT2kMemLeakInfo(uint64_t address, uint32_t size, uint32_t lineNo, ch leakInfo->prevRemLineNo = 0; leakInfo->prevRemFileName = '\0'; - //printf("InsertToT2kMemLeakInfo the adress from List Address = %x, index1 = %d from File=%s, line=%d \n",address,index1,fileName,lineNo); + //DU_LOG("\nINFO --> InsertToT2kMemLeakInfo the adress from List Address = %x, index1 = %d \ + from File=%s, line=%d \n",address,index1,fileName,lineNo); if(smallTick++ == 4096) { smallTick = 0; @@ -317,8 +318,8 @@ void InsertToT2kMemLeakInfo(uint64_t address, uint32_t size, uint32_t lineNo, ch } else { - printf("Something is wrong, trying to insert %ld index1 = %d file is %s line is %d \n",address, index1, fileName, lineNo); - printf("Address present :%ld, from File:%s, Line:%d, Size:%d, Age:%d", + DU_LOG("\nERROR --> Something is wrong, trying to insert %ld index1 = %d file is %s line is %d \n",address, index1, fileName, lineNo); + DU_LOG("\nINFO --> Address present :%ld, from File:%s, Line:%d, Size:%d, Age:%d", leakInfo->address, leakInfo->fileName, leakInfo->lineNo, leakInfo->size, leakInfo->age); @@ -339,7 +340,7 @@ void RemoveFromT2kMemLeakInfo(uint64_t address, char *file, uint32_t line,Region if(index1 >= T2K_MEM_LEAK_INFO_TABLE_SIZE) { - printf("index1 out of range = %d address is %ld file = %s line = %d. We are going to crash!!!\n", + DU_LOG("\nERROR --> index1 out of range = %d address is %ld file = %s line = %d. We are going to crash!!!\n", index1, address, file, @@ -358,14 +359,14 @@ void RemoveFromT2kMemLeakInfo(uint64_t address, char *file, uint32_t line,Region } else { - printf("Something is wrong, trying to remove %ld index1 = %d from File=%s, line=%d address present is %ld region%d \n",address, index1, file,line,leakInfo->address,region); + DU_LOG("\nERROR --> Something is wrong, trying to remove %ld index1 = %d from File=%s, line=%d address present is %ld region%d \n",address, index1, file,line,leakInfo->address,region); - printf("\n Last Del file %s line %d\n",leakInfo->lastDelFileName, + DU_LOG("\nINFO --> Last Del file %s line %d\n",leakInfo->lastDelFileName, leakInfo->lastDelLineNum); if(leakInfo->prevRemFileName != NULLP) { - printf("Previous File:%s, Previous Line:%d\n", + DU_LOG("\nINFO --> Previous File:%s, Previous Line:%d\n", leakInfo->prevRemFileName, leakInfo->prevRemLineNo); } } @@ -380,7 +381,7 @@ void DumpT2kMemLeakInfoToFile() if(fp == NULL) { - printf("Could not open file for dumping mem leak info\n"); + DU_LOG("\nERROR --> Could not open file for dumping mem leak info\n"); return; } for(reg=0; reg offset is %d region %d\n", offset, region); if(cmHashListInit(®Cb->brdcmSsiLstCp, 1000, offset, FALSE, CM_HASH_KEYTYPE_UINT32_MOD, region, 0) != ROK) { @@ -1205,7 +1206,7 @@ Data **prevptr; /* Initialize the elements with 0xAB */ memset(*ptr, 0xAB, *size); #endif -// printf("Pointer allocated %8p size %d\n", *ptr, *size); +// DU_LOG("\nINFO --> Pointer allocated %8p size %d\n", *ptr, *size); /* Store this pointer in hash list */ if ((bkt->nextBlk) && *ptr) #elif SS_LIGHT_MEM_LEAK_STS @@ -1310,7 +1311,7 @@ Data **prevptr; if (g_overused[bktIdx] == 0 && OVERUSED(bkt)) { g_overused[bktIdx] = 1; - /*printf("cmAlloc: bktIdx %u overused %u numAlloc %u\n", bktIdx, g_overused[bktIdx], bkt->numAlloc); */ + /*DU_LOG("\nINFO --> cmAlloc: bktIdx %u overused %u numAlloc %u\n", bktIdx, g_overused[bktIdx], bkt->numAlloc); */ } } #endif @@ -1703,13 +1704,13 @@ Size size size(%d) %8p, Bucket Id:%03d\n", size, ptrHdr->requestedSize, ptr, regCb->mapTbl[idx].bktIdx); #endif - printf("Passed size (%d) does not match with allocated \ + DU_LOG("\nERROR --> Passed size (%d) does not match with allocated \ size(%d) %8p, Bucket Id:%03d\n", size, ptrHdr->requestedSize, ptr, regCb->mapTbl[idx].bktIdx); abort(); } /* Validate the tail part to see if there is any over run */ -// printf("Pointer free request %8p, size %d\n", ptr, size); +// DU_LOG("\nINFO --> Pointer free request %8p, size %d\n", ptr, size); #endif /* validate the block to be freed for trampling */ @@ -1770,7 +1771,7 @@ Size size return (RTRAMPLINGNOK); } #ifdef BRDCM_SSI_MEM_LEAK_DEBUG_LEVEL1 - printf("Memory signature is invalid\n"); + DU_LOG("\nERROR --> Memory signature is invalid\n"); abort(); #endif } @@ -1806,7 +1807,7 @@ Size size (Void) SUnlock(&(bkt->bktLock)); #endif #ifdef BRDCM_SSI_MEM_LEAK_DEBUG_LEVEL1 - printf("Attempt to double deallocate memory at: %8p, Bucket Id:%03d,\ + DU_LOG("\nERROR --> Attempt to double deallocate memory at: %8p, Bucket Id:%03d,\ size %u bytes \n", ptr, regCb->mapTbl[idx].bktIdx, bkt->size); abort(); #endif @@ -2782,7 +2783,7 @@ Size size sprintf(dbgPrntBuf, "Passed size (%d) does not match with allocated size(%d):%8p, Bucket Id:%03d\n", size, ptrHdr->requestedSize, ptr, regCb->mapTbl[idx].bktIdx); #endif - printf("Passed size (%d) does not match with allocated size(%d):%8p, Bucket Id:%03d\n", + DU_LOG("\nERROR --> Passed size (%d) does not match with allocated size(%d):%8p, Bucket Id:%03d\n", size, ptrHdr->requestedSize, ptr, regCb->mapTbl[idx].bktIdx); abort(); } @@ -2826,7 +2827,7 @@ Size size } #endif #ifdef BRDCM_SSI_MEM_LEAK_DEBUG_LEVEL1 - printf("Memory signature is invalid\n"); + DU_LOG("\nERROR --> Memory signature is invalid\n"); abort(); #endif } @@ -2856,7 +2857,7 @@ Size size SDisplay(0, dbgPrntBuf); #endif /* DEBUGP */ #ifdef BRDCM_SSI_MEM_LEAK_DEBUG_LEVEL1 - printf("Attempt to double deallocate memory at: %8p, Bucket Id:%03d,\ + DU_LOG("\nERROR --> Attempt to double deallocate memory at: %8p, Bucket Id:%03d,\ size %u bytes \n", ptr, regCb->mapTbl[idx].bktIdx, bkt->size); abort(); #endif @@ -4587,13 +4588,13 @@ Void cmStartStopLeakLog(Void) { if (FALSE == gmemLkCb.isStarted) { - printf("!!leak capturing started\n"); + DU_LOG("\nINFO --> leak capturing started\n"); gmemLkCb.isStarted = TRUE; } else { gmemLkCb.isStarted = FALSE; - printf("!!leak capturing stopped\n"); + DU_LOG("\nINFO --> leak capturing stopped\n"); cmPrintLeakLog(); } return; @@ -4620,18 +4621,18 @@ Void cmPrintLeakLog(Void) static uint32_t leakCount =0; - printf("---- START OF LEAK LOG ----"); + DU_LOG("\nINFO --> START OF LEAK LOG "); SLock(&gmemLkCb.memLock); - printf("---- Lock Acquired ----"); + DU_LOG("\nINFO --> Lock Acquired"); for(indx = 0; indx < CM_MAX_ALLOC_ENTERIES; indx++) { if(gmemLkCb.allocInfo[indx].used == TRUE) { leakCount++; aBkt =(CmMmBlkHdr *)gmemLkCb.allocInfo[indx].memAddr; - printf("LeakCnt(%ld)Addr(0x%p)RqSz(%ld)", + DU_LOG("LeakCnt(%ld)Addr(0x%p)RqSz(%ld)", leakCount,gmemLkCb.allocInfo[indx].memAddr, aBkt->requestedSize); - printf("LineNo(%ld)funcName(%s)\n", + DU_LOG("LineNo(%ld)funcName(%s)\n", aBkt->lineNo, aBkt->currFuncName); gmemLkCb.allocInfo[indx].used = FALSE; cmPutFreeIndx(indx); @@ -4639,9 +4640,9 @@ Void cmPrintLeakLog(Void) //if(leakCount % 10 == 0) // sleep(1); } - printf("---- END OF LEAK LOG ----"); + DU_LOG("\nINFO --> END OF LEAK LOG "); SUnlock(&gmemLkCb.memLock); - printf("---- Lock Released ----"); + DU_LOG("\nINFO --> Lock Released"); leakCount =0; return; } @@ -5930,7 +5931,7 @@ uint8_t entId /* Tapa task which free the memory */ /* If hash list is full then print the error tna continue */ if(hashListCp->totalNumEntries == (CMM_HIST_MAX_MEM_BIN * CMM_HIST_MAX_MEM_ENTRY_PER_BIN)) { - printf("No place in the hash list. Increase the value of macro CMM_HIST_MAX_MEM_BIN and CMM_HIST_MAX_MEM_ENTRY_PER_BIN \n"); + DU_LOG("\nERROR --> No place in the hash list. Increase the value of macro CMM_HIST_MAX_MEM_BIN and CMM_HIST_MAX_MEM_ENTRY_PER_BIN \n"); return RFAILED; } /* End of if */ @@ -6004,7 +6005,7 @@ uint8_t entId if(hashListCp->totalNumEntries == (CMM_HIST_MAX_MEM_BIN * CMM_HIST_MAX_MEM_ENTRY_PER_BIN)) { - printf("No place in the hash list. Increase the value of macro CMM_HIST_MAX_MEM_BIN and CMM_HIST_MAX_MEM_ENTRY_PER_BIN\n"); + DU_LOG("\nERROR --> No place in the hash list. Increase the value of macro CMM_HIST_MAX_MEM_BIN and CMM_HIST_MAX_MEM_ENTRY_PER_BIN\n"); return RFAILED; } /* End of if */ @@ -6173,12 +6174,12 @@ CmMemEntries **entry } /* End of if (numEnt) */ else { - printf ("Unable to find the entry in hash list\n"); + DU_LOG("\nERROR --> Unable to find the entry in hash list\n"); return RFAILED; }/* End of else (numEnt) */ }/* end of for (numBin = 0) */ - printf("Unable to find the entry in the hash list\n"); + DU_LOG("\nERROR --> Unable to find the entry in the hash list\n"); return RFAILED; } /* end of cmHstGrmFindEntry */ diff --git a/src/cm/ctf.c b/src/cm/ctf.c index 4a943f29f..03bca9207 100755 --- a/src/cm/ctf.c +++ b/src/cm/ctf.c @@ -4561,7 +4561,7 @@ Buffer *mBuf #endif if(param->unLicnsdCfgPres) { - printf("pverma param->unLicnsdCfgPres cm/ctf -->%d\n",param->unLicnsdCfgPres); + DU_LOG("\nDEBUG --> pverma param->unLicnsdCfgPres cm/ctf -->%d\n",param->unLicnsdCfgPres); CMCHKPK(cmPkCtfUnLicnsdCellParam, ¶m->lteUCfg, mBuf); } CMCHKPK(oduUnpackUInt8, param->unLicnsdCfgPres, mBuf); @@ -4795,7 +4795,7 @@ Buffer *mBuf if(param->unLicnsdCfgPres) { - printf("pverma param->unLicnsdCfgPres 2 -->%d \n",param->unLicnsdCfgPres); + DU_LOG("\nDEBUG --> pverma param->unLicnsdCfgPres 2 -->%d \n",param->unLicnsdCfgPres); CMCHKUNPK(cmUnpkCtfUnLicnsdCellParam, ¶m->lteUCfg, mBuf); } #ifdef EMTC_ENABLE @@ -5009,7 +5009,7 @@ Buffer *mBuf CMCHKUNPK(SUnpkS16, ¶m->pilotSigPwr, mBuf); CMCHKUNPK(SUnpkS16, ¶m->priSigPwr, mBuf); CMCHKUNPK(SUnpkS16, ¶m->secSigPwr, mBuf); - printf("param->pilotSigPwr = %d\nparam->priSigPwr = %d\n param->secSigPwr = %d\n",param->pilotSigPwr,param->priSigPwr,param->secSigPwr); + DU_LOG("\nDEBUG --> param->pilotSigPwr = %d\nparam->priSigPwr = %d\n param->secSigPwr = %d\n",param->pilotSigPwr,param->priSigPwr,param->secSigPwr); #ifdef ENABLE_API_LOG CMCHKUNPK(oduPackUInt8, ¶m->enableAPILog, mBuf); #endif /* ENABLE_API_LOG */ diff --git a/src/cm/legtp.c b/src/cm/legtp.c index d4acd4a44..8407e3812 100644 --- a/src/cm/legtp.c +++ b/src/cm/legtp.c @@ -94,7 +94,7 @@ uint8_t packEgtpCfgReq(Pst *pst, EgtpConfig egtpCfg) if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK) { - printf("\nDU_APP : Failed to allocate memory"); + DU_LOG("\nERROR --> DU_APP : Failed to allocate memory"); return RFAILED; } if(egtpCfg.localIp.ipV4Pres) @@ -190,7 +190,7 @@ uint8_t packEgtpCfgCfm(Pst *pst, CmStatus cfm) if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK) { - printf("\nEGTP : Failed to allocate memory"); + DU_LOG("\nERROR --> EGTP : Failed to allocate memory"); return RFAILED; } @@ -249,7 +249,7 @@ uint8_t packEgtpSrvOpenReq(Pst *pst) if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK) { - printf("\nDU_APP : Failed to allocate memory"); + DU_LOG("\nERROR --> DU_APP : Failed to allocate memory"); return RFAILED; } @@ -302,7 +302,7 @@ uint8_t packEgtpSrvOpenCfm(Pst *pst, CmStatus cfm) if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK) { - printf("\nEGTP : Failed to allocate memory"); + DU_LOG("\nERROR --> EGTP : Failed to allocate memory"); return RFAILED; } @@ -364,7 +364,7 @@ uint8_t packEgtpTnlMgmtReq(Pst *pst, EgtpTnlEvt tnlEvt) if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK) { - printf("\nDU_APP : Failed to allocate memory"); + DU_LOG("\nERROR --> DU_APP : Failed to allocate memory"); return RFAILED; } @@ -434,7 +434,7 @@ uint8_t packEgtpTnlMgmtCfm(Pst *pst, EgtpTnlEvt tnlEvt) if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK) { - printf("\nEGTP : Failed to allocate memory"); + DU_LOG("\nERROR --> EGTP : Failed to allocate memory"); return RFAILED; } @@ -504,7 +504,7 @@ uint8_t packEgtpStartPollingReq(Pst *pst) if(ODU_GET_MSG_BUF(DFLT_REGION, pst->pool, &mBuf) != ROK) { - printf("\nDU_APP : Failed to allocate memory"); + DU_LOG("\nERROR --> DU_APP : Failed to allocate memory"); return RFAILED; } diff --git a/src/cm/lsctp.c b/src/cm/lsctp.c index 1641bc4be..12f673dcd 100644 --- a/src/cm/lsctp.c +++ b/src/cm/lsctp.c @@ -43,7 +43,7 @@ uint8_t cmPkSctpNtfy(Pst *pst, CmInetSctpNotification *ntfy) if(ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) { - printf("\nSCTP : Failed to allocate memory"); + DU_LOG("\nERROR --> SCTP : Failed to allocate memory"); return RFAILED; } @@ -56,7 +56,7 @@ uint8_t cmPkSctpNtfy(Pst *pst, CmInetSctpNotification *ntfy) if (ODU_POST_TASK(pst, mBuf) != ROK) { - printf("\nSCTP : ODU_POST_TASK failed while sending SCTP notification"); + DU_LOG("\nERROR --> SCTP : ODU_POST_TASK failed while sending SCTP notification"); return RFAILED; } -- 2.16.6