]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/netapi.git/commitdiff
Resolve Coverity warnings
authorTinku Mannan <tmannan@ti.com>
Thu, 20 Nov 2014 21:04:42 +0000 (16:04 -0500)
committerTinku Mannan <tmannan@ti.com>
Thu, 20 Nov 2014 21:05:40 +0000 (16:05 -0500)
20 files changed:
ti/runtime/netapi/applications/ipsec_offload/ipsecmgr/src/netapi_ipsecmgr.c
ti/runtime/netapi/netapi_util.h [changed mode: 0755->0644]
ti/runtime/netapi/pktio.h
ti/runtime/netapi/src/netapi.c [changed mode: 0755->0644]
ti/runtime/netapi/src/netapi_init.c
ti/runtime/netapi/src/netapi_sec.c
ti/runtime/netapi/src/netcp_cfg.c
ti/runtime/netapi/src/pdkv2/netapi_navig.c
ti/runtime/netapi/src/pdkv3/netapi_navig.c
ti/runtime/netapi/src/pktio.c
ti/runtime/netapi/test/fdb.h
ti/runtime/netapi/test/ifdma_test.c
ti/runtime/netapi/test/net_test_bench.c
ti/runtime/netapi/test/net_test_loopback.c
ti/runtime/netapi/test/net_test_router.c
ti/runtime/netapi/test/net_test_sa_utils.c
ti/runtime/netapi/test/net_test_utils.c
ti/runtime/netapi/test/net_test_utils.h
ti/runtime/netapi/test/nt_bridge.c
ti/runtime/netapi/test/router.c

index 892c2a7639cec73ba3b6abbb8c0d1fece518bd1e..185fce88223665708b73952adba0003534bde5c5 100644 (file)
@@ -789,7 +789,7 @@ int create_pktio_channel()
 {
     static int count = 0;
     int error = 0;
-    char name[19];
+    char name[PKTIO_MAX_NAME];
     PKTIO_HANDLE_T *pktio_channel;
     PKTIO_CFG_T pktio_cfg;
     NETCP_CFG_ROUTE_T route;
old mode 100755 (executable)
new mode 100644 (file)
index a5d7b04..642e395
@@ -49,7 +49,6 @@ extern "C" {
 #endif
 
 #include <stdint.h>
-#include "netapi.h"
 #include "./src/netapi_loc.h"
 
 
index f58ec8723701511d50e6f3181167809caad1fc00..81d50b481377bbaa99a44a848efbcaaa91c95e76 100755 (executable)
@@ -96,7 +96,7 @@ extern "C" {
  * @ingroup pktio_constants
  *      This defines the maximum length of a pktio channel name
  */
-#define PKTIO_MAX_NAME 19
+#define PKTIO_MAX_NAME 20
 
 /**
  *  @ingroup pktio_structures
old mode 100755 (executable)
new mode 100644 (file)
index 5cc8e52..4108bb6
@@ -144,14 +144,12 @@ NETAPI_T netapi_init(int                master,
 
         if (pBase == NULL)
         {
-            printf("netapi_init: hplib_shmCreate failure\n");
             return NULL;
         }
 
         if (hplib_shmAddEntry(pBase, sizeof(NETAPI_SHM_T), NETAPI_ENTRY) !=
             hplib_OK)
         {
-            netapi_Log("netapi_init: hplib_shmAddEntry failed for NETAPI_ENTRY\n");
             return NULL;
         }
         hplib_utilOsalCreate();
@@ -161,11 +159,7 @@ NETAPI_T netapi_init(int                master,
     else
     {
         pBase = hplib_shmOpen(HPLIB_SHM_SIZE);
-        if (!pBase)
-        {
-            netapi_Log("netapi_init: hplib_shmOpen error\n");
-        }
-        else
+        if (pBase)
             Osal_start(pBase);
     }
 
@@ -175,6 +169,7 @@ NETAPI_T netapi_init(int                master,
         p->pktios[i] = calloc(1,sizeof(PKTIO_HANDLE_T));
         if (!p->pktios[i])
         {
+            free(p);
             return NULL;
         }
         else
@@ -300,7 +295,6 @@ NETAPI_T netapi_init(int                master,
     }
     else
     {
-        netapi_Log("netapi_init: no master specified\n");
         goto ERR_netapi_init;
     }
 
@@ -321,6 +315,7 @@ ERR_netapi_init:
         free(p->p_sched);
     }
 #endif
+    free(p);
     return NULL;
 }
 
@@ -340,7 +335,6 @@ void netapi_shutdown(NETAPI_T h)
     void * map_base;
     hplib_VirtMemPoolheader_T *poolHdr;
 
-    netapi_Log("netapi: WARNING shutdown may not be fully implemented\n");
     if (p->master == NETAPI_SYS_MASTER)
     {
     
@@ -361,7 +355,6 @@ void netapi_shutdown(NETAPI_T h)
         {
             if (p->createdHeaps[i])
             {
-                printf("netapi_shutdown: heapPtr[%d]: 0x%x\n", i, p->createdHeaps);
                 netapi_closeHeap(h,p->createdHeaps[i]);
                 p->createdHeaps[i]=NULL;
             }
@@ -372,7 +365,6 @@ void netapi_shutdown(NETAPI_T h)
         hplib_resetMallocArea(0);
         Qmss_removeMemoryRegion(p->memRegion,0);
         hplib_vmTeardown();
-        printf("netapi_shutdown: calling hplib_shmDelete\n");
         hplib_shmDelete();
     }
     else if (p->master == NETAPI_PROC_MASTER)
@@ -385,7 +377,6 @@ void netapi_shutdown(NETAPI_T h)
         {
             if (p->createdHeaps[i])
             {
-                printf("netapi_shutdown: heapPtr[%d]: 0x%x\n", i, p->createdHeaps);
                 netapi_closeHeap(h,p->createdHeaps[i]);
                 p->createdHeaps[i]=NULL;
             }
@@ -413,7 +404,6 @@ void netapi_shutdown(NETAPI_T h)
 #endif
 
     free(p);
-    printf("netapi_shutdown: complete\n");
     return;
 }
 
index b193630fc048c6c4d0795b5cb90ae1d87c777bc7..87bc8a9d68089b8cdb95b1d28b51e77e77604a1d 100755 (executable)
@@ -192,7 +192,6 @@ int netapip_startQm(void* rmClientServiceHandle)
      result = Qmss_startCfg(&startCfg);
      if (result != QMSS_SOK)
      {
-         netapi_Log ("netapip_startQm: Qmss_start failed with error code %d\n", result);
          return (-1);
      }
      return 1;
@@ -307,7 +306,6 @@ int netapip_initNwal(
         }
         else
         {
-            netapi_Log("netapip_initNwal: Unable to Add shared memory segment for PASS\n");
             return -1;
         }
         if(hplib_shmAddEntry(pBase, sizeof(NETAPI_SA_SHM_T), SA_ENTRY) == hplib_OK)
@@ -317,18 +315,14 @@ int netapip_initNwal(
         }
         else
         {
-            netapi_Log("netapip_initNwal: Unable to Add shared memory segment for SASS\n");
             return -1;
         }
         if(hplib_shmAddEntry(pBase, sizeof(NETAPI_NWAL_SHM_T), NWAL_ENTRY) == hplib_OK)
         {
-            printf("netapip_initNwal: calling shmGetEntry for nwal\n");
             nwalEntry = (NETAPI_NWAL_SHM_T*)hplib_shmGetEntry(pBase,NWAL_ENTRY);
-            printf("netapip_initNwal: base address of nwal entry: 0x%x\n", (uint32_t) nwalEntry);
         }
         else
         {
-            netapi_Log("netapip_initNwal: Unable to Add shared memory segment for SASS\n");
             return -1;
         }
         
@@ -358,8 +352,6 @@ int netapip_initNwal(
                       Pktlib_createHeap(&heapCfg, &errCode);
     if(nwalGlobCfg.pa2SaBufPool.bufPool[0].heapHandle == NULL)
     {
-        netapi_Log ("netapip_initNwal: Pktlib_createHeap:Heap Creation Failed for PA to SA Buffer Pool, Error Code: %d\n",
-                    errCode); 
         netapipErrTeardown();
         return -1;
     }
@@ -377,8 +369,6 @@ int netapip_initNwal(
         p_nwal_context->sa2pa_heap = Pktlib_createHeap(&heapCfg, &errCode);
     if(nwalGlobCfg.sa2PaBufPool.bufPool[0].heapHandle == NULL)
     {
-        netapi_Log ("netapip_initNwal: Pktlib_createHeap:Heap Creation Failed for SA to PA Buffer Pool, Error Code: %d\n",
-                     errCode); 
         netapipErrTeardown();
         return -1;
     }
@@ -417,7 +407,6 @@ int netapip_initNwal(
                                    aligns);
     if(nwalRetVal != nwal_OK)
     {
-        netapi_Log ("netapip_initNwal: nwal_getBufferReq Failed %d\n", nwalRetVal);
         return nwal_FALSE;
     }
 
@@ -429,8 +418,6 @@ int netapip_initNwal(
 
     if(NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_HANDLE < sizes[nwal_BUF_INDEX_INST])
     {
-        printf(" 1memSize issue %d %d\n", 
-            sizes[nwal_BUF_INDEX_INST], NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_HANDLE);
         /* Resize Memory */
         return nwal_FALSE;
         //while(1);
@@ -445,9 +432,6 @@ int netapip_initNwal(
     if(NWAL_CHAN_HANDLE_SIZE  < sizes[nwal_BUF_INDEX_INT_HANDLES])
     {
         /* Resize Memory */
-        printf(" 2memSize issue %d %d\n", 
-            sizes[nwal_BUF_INDEX_INT_HANDLES], NWAL_CHAN_HANDLE_SIZE);
-        /* Resize Memory */
         return nwal_FALSE;
         //while(1);
 
@@ -457,8 +441,6 @@ int netapip_initNwal(
         (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)paEntry->paBuf0);
     if((NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF0) < sizes[nwal_BUF_INDEX_PA_LLD_BUF0])
     {
-        printf(" 3memSize issue %d %d\n", 
-            sizes[nwal_BUF_INDEX_PA_LLD_BUF0], NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF0);
         /* Resize Memory */
         return nwal_FALSE;
         //while(1);
@@ -470,8 +452,6 @@ int netapip_initNwal(
         (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)paEntry->paBuf1);
     if((NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF1) < sizes[nwal_BUF_INDEX_PA_LLD_BUF1])
     {
-        printf(" 4memSize issue %d %d\n", 
-            sizes[nwal_BUF_INDEX_PA_LLD_BUF1], NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF1);
         /* Resize Memory */
         return nwal_FALSE;
         //while(1);
@@ -483,8 +463,6 @@ int netapip_initNwal(
         (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)paEntry->paBuf2);
     if((NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF2) < sizes[nwal_BUF_INDEX_PA_LLD_BUF2])
     {
-        printf(" 5memSize issue %d %d\n", 
-            sizes[nwal_BUF_INDEX_PA_LLD_BUF2], NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF2);
         /* Resize Memory */
         return nwal_FALSE;
         //while(1);
@@ -496,9 +474,6 @@ int netapip_initNwal(
         (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)saEntry->salldHandle);
     if((NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE) < sizes[nwal_BUF_INDEX_SA_LLD_HANDLE])
     {
-        printf(" 6memSize issue %d %d\n", 
-            sizes[nwal_BUF_INDEX_SA_LLD_HANDLE], 
-            NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE);
         /* Resize Memory */
         return nwal_FALSE;
         //while(1);
@@ -516,9 +491,6 @@ int netapip_initNwal(
     if((NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE_PER_CHAN * TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2) <
         sizes[nwal_BUF_INDEX_SA_LLD_CHAN_HANDLE])
     {
-        printf(" 7memSize issue %d %d\n", 
-            sizes[nwal_BUF_INDEX_SA_LLD_CHAN_HANDLE], 
-            NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE_PER_CHAN * TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2);
         /* Resize Memory */
         return nwal_FALSE;
         //while(1);
@@ -534,7 +506,6 @@ int netapip_initNwal(
 
     /* Initialize NWAL module */
     nwal_getLocContextBufferReq(nwalSizeInfo.nProc, &localCtxSize);
-    printf("testNwGlobInit: localCtxSize: 0x%x\n", localCtxSize);
 
     pNwalLocCtxMem = malloc(localCtxSize);
     nwal_createProc(bases[nwal_BUF_INDEX_INST],
@@ -547,15 +518,11 @@ int netapip_initNwal(
                              sizes,
                              bases,
                              &gPNwalInstHandle);
-    //printf("netapip_initNwal: nwalInstanceHandle: 0x%x\n", gPNwalGlobCtx);
     if(nwalRetVal != nwal_OK)
     {
-        netapi_Log ("netapip_initNwal: nwal_create Failed %d\n",nwalRetVal);
         return nwal_FALSE;
-        //while(1);
     }
 
-    netapi_Log("netapip_initNwal- Global and Local Network initialization Successful \n");
     return 1;
 }
 
@@ -659,7 +626,6 @@ int netapip_startNwal(Pktlib_HeapHandle pkt_heap,
             pNwalLocCtxMem = malloc(localCtxSize);
             if (pNwalLocCtxMem == NULL)
             {
-                netapi_Log ("netapip_startNwal:malloc failure for nwal local context memory\n");
                 return -1;
             }
             nwalBaseAddrCfg.pSaVirtBaseAddr = baseAddr;
@@ -685,11 +651,8 @@ int netapip_startNwal(Pktlib_HeapHandle pkt_heap,
 
     if(nwalRetVal != nwal_OK)
     {
-        netapi_Log (">nwal_start:Failed ->err %d !!!\n", nwalRetVal);
         return -1;
     }
-    else
-        printf("netapip_startnwal: complete !!!!!!!!!!!!!!!!!!!\n");
     p->state = NETAPI_NW_CXT_LOC_ACTIVE;
     return 1;
 
@@ -720,7 +683,6 @@ int netapip_initTimer(void)
 
 static uint8_t* netapip_sharedMemoryMalloc(uint32_t size)
 {
-    //printf("netapip_sharedMemoryMalloc called for size: %d\n", size);
     return  (uint8_t *)hplib_vmMemAlloc(size + 
                                     pnetapiShm->netapi_global.cfg.def_heap_extra_size ,
                                     128,
@@ -735,9 +697,6 @@ static uint8_t* netapip_sharedMemoryMalloc(uint32_t size)
 static void netapip_sharedMemoryFree(uint8_t* ptr, uint32_t size)
 {
     /* Do Nothing. */
-    //printf("netapip_sharedMemoryMalloc called for size: %d\n", size);
-    //hplib_vmMemFree(ptr, size + pnetapiShm->netapi_global.cfg.def_heap_extra_size,0);
-    netapi_Log("netapi Unexpected.  need to provide a free () for some reason!! \n");
     return;
 }
 
@@ -809,11 +768,8 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
                           2,
                           &netapi_VM_MempoolAttr[0]);
 
-    if (result == hplib_OK)
-        netapi_Log("netapip_systemInit: - hplib_vmInit pass\n");
-    else
+    if (result != hplib_OK)
     {
-        netapi_Log("netapip_systemInit: - hplib_vmInit fail\n");
         return -1;
     }
 
@@ -828,10 +784,8 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
                                         SEC_CONTEXT_SZ), 128, 0);
         if (!netapi_VM_SaContextVaddr)
         {
-            netapi_Log("netapip_systemInit: Failed to map SA context memory region\n");
             return (-1);
         }
-        netapi_Log("netapip_systemInit: SA Memory mapped/allocated at address %p.\n", netapi_VM_SaContextVaddr);
 #else
             netapi_VM_SaContextVaddr= (char *) NULL;
 #endif
@@ -848,21 +802,17 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
                 TUNE_NETAPI_DESC_SIZE),
                 128,
                 0);
-        netapi_Log("netapip_systemInit(sysMaster): desc region=%x global desc region=%x\n",
-            netapi_VM_QMemLocalDescRam, netapi_VM_QMemGlobalDescRam);
         /* Initialize Queue Manager Sub System */
         result = netapip_initQm (pnetapiShm->netapi_global.cfg.def_max_descriptors,
                                  pRmClientHandle);
         
         if (result != 1)
         {
-             netapi_Log("netapip_systemInit: returned from netapip_initQm with failure\n");
             return -1;
         }
         /* Start the QMSS. */
         if (netapip_startQm(pRmClientHandle) != 1)
         {
-            netapi_Log("netapip_systemInit: returned from netapip_startQm with failure\n");
             return -1;
         }
 
@@ -877,18 +827,15 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
                            pnetapiShm->netapi_global.cfg.start_index);
         if(result <0)
         {
-            netapi_Log("netapip_systemInit: can't setup QM shared region\n");
             return -1;
         }
         /* Initialize CPPI CPDMA */
         result = netapip_initCppi(pRmClientHandle);
         if (result != 1)
         {
-            netapi_Log ("netapi: Error initializing CPPI SubSystem error code : %d\n",result);
             return -1;
         }
         /* CPPI and Queue Manager are initialized. */
-        netapi_Log ("netapi: Queue Manager and CPPI are initialized.\n");
 
         /* create main pkt heap */
         /* Initialize the Shared Heaps. */
@@ -900,9 +847,7 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
         memset ((void *)&heapCfg, 0, sizeof(Pktlib_HeapCfg));
         /* Populate the heap configuration */
         heapCfg.name                = "netapi";
-//        heapCfg.memRegion           = TUNE_NETAPI_QM_GLOBAL_REGION;
         heapCfg.memRegion = memInfo.memRegion;
-        printf("netapip_systemInit: memRegion: %d\n",memInfo.memRegion);
         heapCfg.sharedHeap          = 1;
         heapCfg.useStarvationQueue  = 0;
         heapCfg.dataBufferSize      = pnetapiShm->netapi_global.cfg.def_heap_buf_size;
@@ -915,10 +860,8 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
 
         /* Create Shared Heap with specified configuration. */
         sharedHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
-        if (!sharedHeapHandle) { netapi_Log(">'netapi' heap create failed, Error Code: %d\n",errCode); return -1;}
+        if (!sharedHeapHandle) { return -1;}
         handle->netcp_heap= sharedHeapHandle;
-        printf("netapi_systemInit: netapi heap handle: 0x%x\n", 
-            handle->netcp_heap);
         /* Update for Control */
         heapCfg.name                = "netapi_control_rx";
         heapCfg.sharedHeap          = 1;
@@ -928,7 +871,7 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
     
         controlRxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
         //todo -> cleanup on failure
-        if (!controlRxHeapHandle) { netapi_Log("netapi -'netapi_control_rx' heap create failed, Error Code: %d\n",errCode); return -1;}
+        if (!controlRxHeapHandle) { return -1;}
         handle->netcp_control_rx_heap= controlRxHeapHandle;
     
     
@@ -937,15 +880,14 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
     
         controlTxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
     //todo -> cleanup on failure
-    if (!controlTxHeapHandle) { netapi_Log("netapi -'netapi_control_tx' heap create failed, Error Code: %d\n",errCode); return -1;}
+    if (!controlTxHeapHandle) { return -1;}
     handle->netcp_control_tx_heap= controlTxHeapHandle;
              /* now NWAL */
         result = netapip_initNwal(memInfo.memRegion,
                               &netapi_pktlib_ifTable,
                               &pnetapiShm->netapi_global.nwal_context,
                               &pnetapiShm->netapi_global.cfg);
-        if (result<0) {netapi_Log("netapi  init_nwal() failed\n"); return -1; }
-            netapi_Log("netapip_systemInit: returned from netapip_initNwal\n");
+        if (result<0) { return -1; }
         /* Common Initialization for all cores */
         while(count < TUNE_NETAPI_MAX_NUM_TRANS)
         {
@@ -959,8 +901,7 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
                                    &pnetapiShm->netapi_global.cfg,
                                    &pnetapiShm->netapi_global.nwal_context,
                                    handle->master);
-        if (result<0) {netapi_Log("netapi start_nwal() failed\n"); return -1; }
-        netapi_Log("netapip_systemInit: returned from netapip_startNwal\n");
+        if (result<0) { return -1; }
     }
     else
     {
@@ -975,12 +916,10 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
                                                 SEC_CONTEXT_SZ), 128, 0);
                 if (!netapi_VM_SaContextVaddr)
                 {
-                    netapi_Log("netapip_systemInit: Failed to map SA context memory region\n");
                     return (-1);
                 }
-                netapi_Log("netapip_systemInit: SA Memory mapped/allocated at address %p.\n", netapi_VM_SaContextVaddr);
 #else
-                    netapi_VM_SaContextVaddr= (char *) NULL;
+                netapi_VM_SaContextVaddr= (char *) NULL;
 #endif
 
 
@@ -997,9 +936,6 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
                 TUNE_NETAPI_DESC_SIZE),
                 128,
                 0);
-        netapi_Log("netapip_systemInit(procMaster): desc region=%x global desc region=%x\n",
-            netapi_VM_QMemLocalDescRam, netapi_VM_QMemGlobalDescRam);
-
 
         /****************************************************
          * partial initialization.  For process, not for SOC
@@ -1008,14 +944,12 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
                                  pRmClientHandle);
         if (result != 1)
         {
-             netapi_Log("netapip_systemInit: returned from netapip_initQm with failure\n");
             return -1;
         }
 
         /* Start the QMSS. */
         if (netapip_startQm(pRmClientHandle) != 1)
         {
-            netapi_Log("netapip_systemInit: returned from netapip_startQm with failure\n");
             return -1;
         }
 
@@ -1027,18 +961,15 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
                            pnetapiShm->netapi_global.cfg.start_index);
         if(result <0)
         {
-            netapi_Log("netapip_systemInit: can't setup QM shared region\n");
             return -1;
         }
         /* Initialize CPPI CPDMA */
         result = netapip_initCppi(pRmClientHandle);
         if (result != 1)
         {
-            netapi_Log ("netapi: Error initializing CPPI SubSystem error code : %d\n",result);
             return -1;
         }
         /* CPPI and Queue Manager are initialized. */
-        netapi_Log ("netapi: Queue Manager and CPPI are initialized.\n");
 
         /* create main pkt heap for this process */
         /* Initialize the Shared Heaps. */
@@ -1065,10 +996,8 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
         /* Create Shared Heap with specified configuration. */
         sharedHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
         //todo -> cleanup on failure
-        if (!sharedHeapHandle) { netapi_Log(">'netapi' heap create failed, Error Code: %d\n",errCode); return -1;}
+        if (!sharedHeapHandle) { return -1;}
         handle->netcp_heap= sharedHeapHandle;
-        printf("netapi_systemInit: netapi heap handle: 0x%x\n", 
-           handle->netcp_heap);
 
         //open shared heap handle but create new controlRx & Tx heaps for this
         //process
@@ -1079,13 +1008,13 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
         heapCfg.numPkts             = TUNE_NETAPI_CONFIG_NUM_CTL_RX_BUF;
         heapCfg.numZeroBufferPackets= 0;
         controlRxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
-        if (!controlRxHeapHandle) { netapi_Log("netapi -'netapi_control_rx' heap create failed, Error Code: %d\n",errCode); return -1;}
+        if (!controlRxHeapHandle) { return -1;}
 
         handle->netcp_control_rx_heap= controlRxHeapHandle;
         heapCfg.name                = "netapi_control_tx";
         heapCfg.numPkts             = TUNE_NETAPI_CONFIG_NUM_CTL_TX_BUF;
         controlTxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
-        if (!controlTxHeapHandle) { netapi_Log("netapi -'netapi_control_tx' heap create failed, Error Code: %d\n",errCode); return -1;}
+        if (!controlTxHeapHandle) { return -1;}
         handle->netcp_control_tx_heap= controlTxHeapHandle;
 
         /* Common Initialization for all threads in process */
@@ -1103,16 +1032,13 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
                                handle->master);
         if (result<0)
         {
-            netapi_Log("netapi start_nwal() failed\n");
             return -1;
         }
-        netapi_Log("netapip_systemInit: returned from netapip_startNwal\n");
     }
 
     //get timer running
 #ifdef CORTEX_A8
         netapip_initTimer();
-        netapi_Log("netapip_systemInit: returned from netapip_initTimer\n");
 #endif
 
 
@@ -1158,14 +1084,6 @@ void netapi_dump_internal_heap_stats(void)
     printf("               >  #dataBufThreshStatus=%d #dataBufStarvCounter=%d #zBufThreshStatus=%d #zBufStarvCounter=%d \n",
                         pktLibHeapStats.dataBufferThresholdStatus,pktLibHeapStats.dataBufferStarvationCounter,
                         pktLibHeapStats.zeroDataBufferThresholdStatus, pktLibHeapStats.zeroDataBufferStarvationCounter);
-#if 0
-Pktlib_getHeapStats(netapi_get_global()->nwal_context.pa2saTX_heap,&pktLibHeapStats);
-netapi_Log("PA2SA(egress) stats>  #free=%d #zb=%d #garbage=%d\n", pktLibHeapStats.numFreeDataPackets,
-                                pktLibHeapStats.numZeroBufferPackets, pktLibHeapStats.numPacketsinGarbage);
-netapi_Log("               >  #dataBufThreshStatus=%d #dataBufStarvCounter=%d #zBufThreshStatus=%d #zBufStarvCounter=%d \n",
-                        pktLibHeapStats.dataBufferThresholdStatus,pktLibHeapStats.dataBufferStarvationCounter,
-                        pktLibHeapStats.zeroDataBufferThresholdStatus, pktLibHeapStats.zeroDataBufferStarvationCounter);
-#endif
     Pktlib_getHeapStats(netapi_get_global()->nwal_context.sa2pa_heap,&pktLibHeapStats);
     printf("SA2PA stats>  #free=%d #zb=%d #garbage=%d\n", pktLibHeapStats.numFreeDataPackets,
                                 pktLibHeapStats.numZeroBufferPackets, pktLibHeapStats.numPacketsinGarbage);
index b7442b30a7fd765f5c835e2c52da332bd38da756..9c6c6a2d00fc627fdbc55b3cde1e09041f48a66b 100755 (executable)
@@ -166,7 +166,6 @@ NETCP_CFG_SA_T netapi_secAddSA(NETAPI_T h,
         return -1;
     }
     appId |=  (tunnelId << NETAPI_NETCP_MATCH_ID_SHIFT);
-    netapi_Log("netapi_secAddSA: app id: 0x%x\n", appId);
 
     *p_data_mode_handle= NULL;  
     *p_inflow_mode_handle= NULL;
@@ -266,8 +265,6 @@ NETCP_CFG_SA_T netapi_secAddSA(NETAPI_T h,
                 pTransInfo->state = NETAPI_NWAL_HANDLE_STATE_IDLE;
                 pTransInfo->inUse = nwal_FALSE;
                 *perr = NETAPI_ERR_PA_FW;
-                netapi_Log ("netapi_sec - ERROR returned by NETCP PA firmware %d\n",
-                        *perr);
                 netapip_netcpCfgDeleteSa(&netapi_get_global()->nwal_context,tunnelId);
                 return -1;
             }
@@ -288,11 +285,7 @@ NETCP_CFG_SA_T netapi_secAddSA(NETAPI_T h,
                                      NWAL_SA_DIR_OUTBOUND,
                                      p_inflow_mode_handle,
                                      &swInfo0,
-                                     &swInfo1) == nwal_TRUE)
-            {
-                //netapi_Log("netapisecAddSA swInfo0: 0x%x, swInfo1: 0x%x\n", swInfo0, swInfo1);
-            }
-            else
+                                     &swInfo1) != nwal_TRUE)
                 netapi_Log("netapisecAddSA: call to nwal_getSecAssoc() returned error\n");
         }
     }
@@ -338,13 +331,10 @@ NETCP_CFG_SA_T netapi_secAddSA(NETAPI_T h,
         if(retValue != nwal_OK)
         {
             *perr = NETAPI_ERR_NWAL_ERR0;
-            netapi_Log ("netapi_secAddSA: nwal_setDMSecAssoc() returned Error Code %d\n",
-            retValue);
             netapip_netcpCfgDeleteSa(&netapi_get_global()->nwal_context,tunnelId);
             return -1;
         }
 
-        //netapi_Log("netapi_secAddSA: Creating sideband mode SA for %d ( mac %d)\n", tunnelId, iface_no); 
         *p_data_mode_handle = dm_handle;
         memset(&dmPSCmdInfo, 0, sizeof(nwalTxDmPSCmdInfo_t));
         retValue =  nwal_initDMPSCmdInfo(netapip_returnNwalInstanceHandle(h),
@@ -384,7 +374,6 @@ void netapi_secInflowMode(int iface,
                           int on)
 {
     /* NOT_IMPLEMENTED */
-    netapi_Log("netapi_secInflowMode:  dynamic switch between inflow and sideband is NOT_IMPLEMENTED\n");
 }
 
 /********************************************************************
@@ -462,8 +451,6 @@ static void netapi_secDelSA_internal(NETAPI_T h,
         else if(retValue !=  nwal_OK)
         {
                 *perr = NETAPI_ERR_NWAL_ERR0;
-                netapi_Log ("netcp_cfg - ERROR: netapi_secDelSA_internal returned Error Code %d\n",
-                            retValue);
                 netapip_freeTransInfo(pTransInfo);
                 netapip_netcpCfgDeleteSa(&netapi_get_global()->nwal_context,tunnelId);
         }
@@ -482,12 +469,9 @@ static void netapi_secDelSA_internal(NETAPI_T h,
                 *perr = NETAPI_ERR_PA_FW;
                  if (!flags) 
                     netapip_netcpCfgDeleteSa(&netapi_get_global()->nwal_context, tunnelId);
-                netapi_Log ("netapi_sec - ERROR returned by NETCP PA firmware %d\n",
-                        *perr);
                 return;
            }
         }
-        netapi_Log ("netapi sec: inflow tunnel %d (iface %d) deleted\n",tunnelId,iface_no);
         netapip_freeTransInfo(pTransInfo);
     }
     if (handle_sideband)
@@ -497,14 +481,9 @@ static void netapi_secDelSA_internal(NETAPI_T h,
         if(retValue !=  nwal_OK)
         {
             *perr = NETAPI_ERR_NWAL_ERR0;
-             netapi_Log ("netapi_sec  - ERROR: nwal_delDMSA returned Error Code %d\n",
-                    retValue);
-
         }
-        else 
-            netapi_Log("netapi_sec: Sideband SA deleted\n");
     }
-   
+
     /* zap the entry */
     if (!flags)
         netapip_netcpCfgDeleteSa(&netapi_get_global()->nwal_context, tunnelId);
@@ -633,8 +612,6 @@ NETCP_CFG_IPSEC_POLICY_T netapi_secAddRxPolicy(NETAPI_T h,
     if(retValue !=  nwal_OK)
     {
         *perr = NETAPI_ERR_NWAL_ERR0;
-        netapi_Log ("netapi sec - ERROR: nwal_setPolicy returned Error Code %d\n",
-                    retValue);
         netapip_freeTransInfo(pTransInfo);
         
         netapip_netcpCfgDeletePolicy(&netapi_get_global()->nwal_context,policyId);
@@ -653,13 +630,10 @@ NETCP_CFG_IPSEC_POLICY_T netapi_secAddRxPolicy(NETAPI_T h,
         {
             netapip_freeTransInfo(pTransInfo);
             *perr = NETAPI_ERR_PA_FW;
-            netapi_Log ("netapi_sec - ERROR2: netapi_secAddRxPolicy returned Error Code %d\n",
-                    *perr);
             netapip_netcpCfgDeletePolicy(&netapi_get_global()->nwal_context,policyId);
             return -1;
         }
     }
-    netapi_Log ("netapi sec: SA %d added to tunnel %d  mac %d\n", policyId, tunnelId, iface_no);
 
     /* save stuff */
     netapip_netcpCfgInsertPolicy(&netapi_get_global()->nwal_context,
@@ -718,8 +692,6 @@ static void netapi_secDelRxPolicy_internal(NETAPI_T h,
     if(retValue !=  nwal_OK)
     {
         *perr = NETAPI_ERR_NWAL_ERR0;
-        netapi_Log ("netapi sec - ERROR: netapi_secDelRxPolicy_internal returned Error Code %d\n",
-                    retValue);
         netapip_freeTransInfo(pTransInfo);
         goto ERR_netapi_secDelRxPolicy_internal;
     }
@@ -736,8 +708,6 @@ static void netapi_secDelRxPolicy_internal(NETAPI_T h,
         {
             netapip_freeTransInfo(pTransInfo);
             *perr = NETAPI_ERR_PA_FW;
-            netapi_Log ("netapi_sec - ERROR2: netapi_secDelRxPolicy_internal returned Error Code %d\n",
-                    *perr);
             //zap the entry
             if (!flags)
                 netapip_netcpCfgDeletePolicy(&netapi_get_global()->nwal_context, policyId);
@@ -745,7 +715,6 @@ static void netapi_secDelRxPolicy_internal(NETAPI_T h,
             
         }
     }
-    netapi_Log ("netapi sec: policy %d (iface %d) deleted\n",policyId,(policy_app_id&0xff));
     netapip_freeTransInfo(pTransInfo);
     /* zap the entry */
     if (!flags)
@@ -823,8 +792,6 @@ void netapi_secGetChanCtxInfo(NETAPI_T h,
     memset(pInfo, 0, sizeof(nwalChanCxtInfo_t));
 
     stage = netapi_cfgGetMatchStage(appId);
-    netapi_Log("netapi_secGetChanCtxInfo: app id: 0x%x, stage: 0x%x\n", appId, stage);
-
 
     switch (stage)
     {
@@ -838,8 +805,6 @@ void netapi_secGetChanCtxInfo(NETAPI_T h,
                 nwal_getChanCxtInfo(&netapi_get_global()->nwal_context,
                             handle_inflow,
                             pInfo);
-                netapi_Log("netapi_secGetChanCtxInfo: outerIP: 0x%x, SA chan handle: 0x%x, bitmap: 0x%x\n",
-                    pInfo->paOuterIpHandle, pInfo->saChanHandle, pInfo->validBitMap);
             }
             break;
         case 2:
@@ -852,12 +817,9 @@ void netapi_secGetChanCtxInfo(NETAPI_T h,
                 nwal_getChanCxtInfo(&netapi_get_global()->nwal_context,
                             handle_policy,
                             pInfo);
-                netapi_Log("netapi_secGetChanCtxInfo: innerIP: 0x%x, bitmap: 0x%x\n",
-                    pInfo->paInnerIpHandle, pInfo->validBitMap);
             }
             break;
         default:
-            netapi_Log("netapi_secGetChanCtxInfo:Invalid APPID provided\n");
             break;
     }
     return;
index 657885c94deca9c764dad3a430be886decf726af..5ea355975e3d0e56a8bbbee4df0dd0ba21245bc4 100755 (executable)
@@ -77,7 +77,6 @@ NetapiNwalTransInfo_t * netapip_getFreeTransInfo(NETAPI_HANDLE_T *p_handle,
     p_handle->spinLock.unlock(&pnetapiShm->netapi_netcp_cfg_lock);
     /* trouble.  need to wait for one to free up*/
     /* to do: handle this by forcing a poll of cntrl queue*/
-    netapi_Log(">netcp_cfg: trying to get free transaction slot but all full!!\n");
     return NULL;
 
 }
@@ -307,8 +306,6 @@ void netapip_netcpCfgInsertSa(NETAPI_NWAL_GLOBAL_CONTEXT_T *p,
     p->tunnel[sa_slot].swInfo0 = swInfo0;
     p->tunnel[sa_slot].swInfo1 = swInfo1;
     p->tunnel[sa_slot].user_data = user_data;
-    //netapi_Log("netapip_netcpCfgInsertSa: swInfo0 0x%x, swInfo1: 0x%x, user data: %d\n",
-//        p->tunnel[sa_slot].swInfo0, p->tunnel[sa_slot].swInfo1, (uint32_t)p->tunnel[sa_slot].user_data);
 
     if (dmPSCmdInfo)
     {
@@ -535,11 +532,8 @@ static void netapip_netcpCfgInsertMac(NETAPI_NWAL_GLOBAL_CONTEXT_T *p,
         p->interfaces[iface_no].state = state;
         //todo p->interfaces[iface_no].vlan = vlan;
         p->interfaces[iface_no].nwal_handle = handle; //save handle assoicated with this rule
-        netapi_Log("netapip_netcpCfgInsertMac, global context 0x%x\n", p);
-    }
-    else 
-        netapi_Log(">netapip_netcpCfgInsertMac insert interface # out of range %d\n",iface_no);
 
+    }
 }
 
 /*******************************************************************************
@@ -758,7 +752,6 @@ void netapi_netcpCfgReqStats(NETAPI_T  h,
     if(ret !=  nwal_OK)
     {
         *err = NETAPI_ERR_BUSY;  //no resources??
-        netapi_Log("> netapi_netcpCfg reqStats failed, err=%d\n",ret);
         netapip_freeTransInfo(pTransInfo);
         return;
     }
@@ -879,8 +872,6 @@ NETCP_CFG_MACIF_T  netapi_netcpCfgCreateMacInterface(NETAPI_T  h,
     if(retValue !=  nwal_OK)
     {
         *err = NETAPI_ERR_NWAL_ERR0;
-        netapi_Log ("netapi_netcpCfg - ERROR: nwal_setMacIface returned Error Code %d\n",
-                    retValue);
         netapip_freeTransInfo(pTransInfo);
         return -1;
     }
@@ -901,13 +892,10 @@ NETCP_CFG_MACIF_T  netapi_netcpCfgCreateMacInterface(NETAPI_T  h,
         {
             netapip_freeTransInfo(pTransInfo);
             *err = NETAPI_ERR_PA_FW;
-            netapi_Log (">netapi_netcpCfgCreateMacInterface - ERROR returned by NETCP PA firmware %d\n",
-                    *err);
             return -1;
         }
 
     }
-    netapi_Log ("netapi_netcpCfg: MAC i/f %d added\n", iface_no);
     netapip_netcpCfgInsertMac(&netapi_get_global()->nwal_context, 
                           p_mac, iface_no, state,vlan,
                           (void *) pTransInfo->handle);
@@ -960,8 +948,6 @@ void netapi_netcpCfgDelMac(NETAPI_T h,
     if(ret !=  nwal_OK)
     {
         *err = NETAPI_ERR_NWAL_ERR0;
-        netapi_Log ("netapi_netcpCfg - ERROR: nwal_delMacIface returned Error Code %d\n",
-                    ret);
         netapip_freeTransInfo(pTransInfo);
         return;
     }
@@ -981,13 +967,10 @@ void netapi_netcpCfgDelMac(NETAPI_T h,
         {
             netapip_freeTransInfo(pTransInfo);
             *err = NETAPI_ERR_PA_FW;
-            netapi_Log (">netapi_netcpCfgCreateMacInterface - ERROR returned by NETCP PA firmware %d\n",
-                    *err);
             netapip_netcpCfgDeleteMac(&netapi_get_global()->nwal_context,  iface_no);
             return;
         }
     }
-    netapi_Log ("netapi_netcpCfg: MAC i/f %d deleted\n",iface_no);
     netapip_freeTransInfo(pTransInfo);
     //zap the entry
     netapip_netcpCfgDeleteMac(&netapi_get_global()->nwal_context,  iface_no);
@@ -1042,8 +1025,6 @@ static NETCP_CFG_IP_T  netapip_netcpCfgAddIpInternal(NETAPI_T  h,
 
     if (iface_no != NETCP_CFG_NO_INTERFACE)
     {
-        netapi_Log("netapip_netcpCfgAddIpInternal, in_use %d\n", netapi_get_global()->nwal_context.interfaces[iface_no].in_use);
-        netapi_Log("netapip_netcpCfgAddIpInternal, p 0x%x\n", &netapi_get_global()->nwal_context);
         if(netapi_get_global()->nwal_context.interfaces[iface_no].in_use)
         {
             n_handle =  netapi_get_global()->nwal_context.interfaces[iface_no].nwal_handle;
@@ -1145,8 +1126,6 @@ static NETCP_CFG_IP_T  netapip_netcpCfgAddIpInternal(NETAPI_T  h,
     if(retValue !=  nwal_OK)
     {
         *err = NETAPI_ERR_NWAL_ERR0;
-        netapi_Log ("netcp_cfg: nwal_setIP returned Error Code %d\n",
-                    retValue);
         netapip_freeTransInfo(pTransInfo);
         //zap the entry
         if (flag)
@@ -1173,13 +1152,11 @@ static NETCP_CFG_IP_T  netapip_netcpCfgAddIpInternal(NETAPI_T  h,
         {
             netapip_freeTransInfo(pTransInfo);
             *err = NETAPI_ERR_PA_FW;
-            netapi_Log ("netapip_netcpCfgAddIpInternal - ERROR returned by NETCP PA firmware %d\n", *err);
             return -1;
         }
     }
     if (flag)
     {
-        netapi_Log ("netcp_cfg: IP added to interface %d (slot%d)\n", iface_no, ip_slot);
         netapip_netcpCfgInsertIp(&netapi_get_global()->nwal_context,
                                  ipType, 
                                  ip_addr,
@@ -1283,8 +1260,6 @@ static void netapip_netcpCfgDelIpInternal(NETAPI_T h,
     if(ret !=  nwal_OK)
     {
         *err = NETAPI_ERR_NWAL_ERR0;
-        netapi_Log ("netcp_cfg - ERROR: nwal_delMacIface returned Error Code %d\n",
-                    ret);
         netapip_freeTransInfo(pTransInfo);
         return ;
     }
@@ -1304,7 +1279,6 @@ static void netapip_netcpCfgDelIpInternal(NETAPI_T h,
         {
             netapip_freeTransInfo(pTransInfo);
             *err = NETAPI_ERR_PA_FW;
-            netapi_Log ("netapip_netcpCfgDelIpInternal - ERROR returned by NETCP PA firmware %d\n", *err);
             return;
         }
     }
@@ -1383,7 +1357,6 @@ NETCP_CFG_CLASS_T netapi_netcpCfgAddClass(NETAPI_T                  h,
     switch(p_class->classType)
     {
         default:
-            netapi_Log(">netapi_netcpCfg : classifier type %d not supported\n",p_class->classType);
             break;
         case(NETCP_CFG_CLASS_TYPE_L3_L4):
             n->spinLock.lock(&pnetapiShm->netapi_netcp_cfg_l3_classi_lock);
@@ -1540,8 +1513,6 @@ NETCP_CFG_CLASS_T netapi_netcpCfgAddClass(NETAPI_T                  h,
             if(retValue !=  nwal_OK)
             {
                 *err = NETAPI_ERR_NWAL_ERR0;
-                netapi_Log ("netcp_cfg - ERROR: nwal_delMacIface returned Error Code %d\n",
-                        retValue);
                 netapip_freeTransInfo(pTransInfo);
                 netapip_netcpCfgDeleteClass(&netapi_get_global()->nwal_context, class_slot);
                 if(p_class->classType== NETCP_CFG_CLASS_TYPE_L3_L4)
@@ -1565,13 +1536,11 @@ NETCP_CFG_CLASS_T netapi_netcpCfgAddClass(NETAPI_T                  h,
                     netapip_freeTransInfo(pTransInfo);
                     *err = NETAPI_ERR_PA_FW;
                     netapip_netcpCfgDeleteClass(&netapi_get_global()->nwal_context, class_slot);
-                    netapi_Log (">netcp_cfgAddClass - ERROR returned by NETCP PA firmware %d\n", *err);
                     if(p_class->classType== NETCP_CFG_CLASS_TYPE_L3_L4)
                         n->spinLock.unlock(&pnetapiShm->netapi_netcp_cfg_l3_classi_lock);
                     return -1;
                 }
             }
-            netapi_Log ("netcp_cfg: L4 Classifer added to interface %d ip %d (slot%d)\n", iface_no, ip_slot, class_slot);
             netapip_netcpCfgInsertClass(&netapi_get_global()->nwal_context, 
                                    class_slot,
                                  p_class->classType, 
@@ -1645,7 +1614,6 @@ void netapi_netcpCfgDelClass(NETAPI_T           h,
     if(retValue !=  nwal_OK)
     {
         *err = NETAPI_ERR_NWAL_ERR0;
-         netapi_Log ("netcp_cfg - ERROR: nwal_delMacIface returned Error Code %d\n", retValue);
          netapip_freeTransInfo(pTransInfo);
          goto ERR_netapi_netcpCfgDelClass;  /* todo: what about the L3? */
     }
@@ -1666,10 +1634,8 @@ void netapi_netcpCfgDelClass(NETAPI_T           h,
     {
         netapip_freeTransInfo(pTransInfo);
         *err = NETAPI_ERR_PA_FW;
-         netapi_Log (">netapi_netcpCfgDelClass - ERROR returned by NETCP PA firmware %d\n", *err);
          goto ERR_netapi_netcpCfgDelClass;
     }
-    netapi_Log ("netcp_cfg: Classifer deleted\n");
     pTransInfo->state =  NETAPI_NWAL_HANDLE_STATE_IDLE;
     pTransInfo->inUse = nwal_FALSE;
 
@@ -1828,8 +1794,6 @@ NETCP_CFG_FLOW_HANDLE_T netapi_netcpCfgAddFlow(NETAPI_T                 h,
                                         slot,
                                         p_cfg->dma_index,
                                         (void*) FlowHnd);
-    netapi_Log(">netcp cfg:  flow %d created in dma index %d\n",
-        ((NETCP_CFG_FLOW_T *) retVal)->flowid, p_cfg->dma_index);
     return (retVal);
 }
 
@@ -1947,8 +1911,6 @@ void netapip_netcpCfgNWALCmdCallBack(nwal_AppId        appHandle,
 
     if(ret != nwal_OK)
     {
-        netapi_Log ("netcp_cfg : netapip_netcpCfgNWALCmdCallBack returned Error Code %d for trans_id %d\n",
-                    ret, trans_id);
         // update error code that is fialed  in p_trans */
         //todo: atomic inc
         p_trans->state = NETAPI_NWAL_HANDLE_STATE_ERR;
@@ -2022,8 +1984,6 @@ void netapip_netcpCfgNWALCmdCallBack(nwal_AppId        appHandle,
             }
             default:
             {
-                netapi_Log ("netcp cfg> Invalid transaction type %d for trans_id: %d\n",
-                    p_trans->transType,trans_id);
                 break;
             }
         }
index ea9c6f2fd27c89737fe22d0bc42f0fd6f5fc285c..35069b507586b151cf77824e2abbd397fd9079c7 100755 (executable)
@@ -171,7 +171,6 @@ int netapip_initCppi(void* rmClientServiceHandle)
     result = Cppi_init (netapi_cppiGblCfgParams);
     if (result != CPPI_SOK)
     {
-      netapi_Log (">function cppi_init: Cppi_init failed with error code %d\n", result);
       return (-1);
     }
     if (rmClientServiceHandle)
@@ -298,7 +297,6 @@ int netapip_initQm(int max_descriptors, void* rmClientServiceHandle))
     netapi_qmssGblCfgParams.qmQueMgmtProxyDataReg = NULL;
     result = Qmss_init (&qmssInitConfig, &netapi_qmssGblCfgParams);
     if (result != QMSS_SOK)  {
-        netapi_Log (">function init_qm: qmss_Init failed with error code %d\n", result);
         return (nwal_FALSE);
     }
     return 1;
index 16ed1b758b4d588e947bb8e364b7c0e1ccd765d3..11ed60eeab4486b43dade1344d52cfa5800a40ea 100755 (executable)
@@ -143,7 +143,6 @@ int netapip_initCppi(void* rmClientServiceHandle)
 
     result = Cppi_init (&netapi_cppiGblCfgParams);
     if (result != CPPI_SOK)  {
-        netapi_Log ("function testNwGlobCppiInit: Cppi_init failed with error code %d\n", result);
         return (-1);
     }
 
@@ -262,7 +261,6 @@ int netapip_initQm(int max_descriptors, void* rmClientServiceHandle)
     result = Qmss_init (&qmssInitConfig, &netapi_qmssGblCfgParams);
     if (result != QMSS_SOK)
     {
-        netapi_Log ("function testNwGlobQmInit: qmss_Init failed with error code %d\n", result);
         return (nwal_FALSE);
     }
     return 1;
index f0c1ae06844b4cdfa5ffa6c36d7e0d68701acf46..64e38e9ee9b16ee2559e8c6d77b27aa4dee5bb11 100755 (executable)
@@ -406,7 +406,6 @@ static int netapip_pktioSendIpc(struct PKTIO_HANDLE_tag * pp,
                                int * err)
 {
     PKTIO_HANDLE_T *p=(PKTIO_HANDLE_T*) pp;
-    err=0;
     Qmss_queuePushDesc (p->q, (void*)pkt);
     *err = NETAPI_ERR_OK;
     return 1;
index 43a75bfb3dff8b96dfbe18da1af71821cdb575d5..952153b4c15033d163f70bcd61e8fb0f2c5c3934 100755 (executable)
@@ -48,7 +48,7 @@
 #define __u32  unsigned int
 #define FDBMAX 128
 #define PFDBMAX 8
-#define OFFMAX  16
+#define OFFMAX  32
 #define THRESH_OFF  50   //aging timer threshold: don't bother offloading entries < THRESH_OFF
 
 #define MAX_INTERFACES 2
index 657f3ddccb78293237cda0145692b6f4a9915c8d..da6bebc8dc9c9cb9a4a722c910298d1c2ae85c81 100755 (executable)
@@ -186,7 +186,7 @@ cpu_set_t cpu_set;
     CPU_SET( 1, &cpu_set);
     hplib_utilSetupThread(1, &cpu_set,hplib_spinLock_Type_LOL);
 
-     for(;!((volatile)QUIT);)
+     for(;!((volatile int)QUIT);)
      {
          np = netapi_pktioPoll(rx_chan,NULL,&err);
          pkt_rx+=np;
@@ -218,7 +218,7 @@ cpu_set_t cpu_set;
       //generate packets internally by allocating from OurHeap (the NETAPI 
       //default) and send to receiver via ifdma pktio channel
       sleep(5);
-      for(i=0;!((volatile) QUIT);i++)
+      for(i=0;!((volatile int) QUIT);i++)
       {
           tip=Pktlib_allocPacket(OurHeap,IFDMA_PKT_LEN);
           if (!tip) 
index 8e3f8865fddd5cefd69e9ebf3e82fdea50bdee4c..6917a259bca7d40ec13a2e02b03b39404698b774 100755 (executable)
@@ -254,7 +254,7 @@ unsigned long t2;
     start_time = hplib_mUtilGetTimestamp();
 
      //DAL we poll the default pktio channel for pkts from net
-      for(i=0;!((volatile) QUIT);i++)
+      for(i=0;!((volatile int) QUIT);i++)
       {
         t1 = netapi_timing_start();
         np = netapi_pktioPoll(netcp_rx_chan,NULL,&err);
@@ -393,7 +393,7 @@ netapi_netcpCfgCreateMacInterface(
 {
        pthread_t *thrs;
         int procs =1; 
-        char c;
+        int c;
         thrs = malloc( sizeof( pthread_t ) * procs );
         if (thrs == NULL)
         {
@@ -551,56 +551,62 @@ pkt_cb_cycles += (t2-t1);
 //sonme benchmarks
 void benchmarks1(void)
 {
-int i,j;
-unsigned long v1pop;
-unsigned long v2pop;
-unsigned long v1push;
-unsigned long v2push;
-unsigned long v1read;
-unsigned long v2read;
-unsigned long v1write;
-unsigned long v2write;
-unsigned long v1read2;
-unsigned long v2read2;
+    int i,j;
+    unsigned long v1pop;
+    unsigned long v2pop;
+    unsigned long v1push;
+    unsigned long v2push;
+    unsigned long v1read;
+    unsigned long v2read;
+    unsigned long v1write;
+    unsigned long v2write;
+    unsigned long v1read2;
+    unsigned long v2read2;
 #define N 100
-Ti_Pkt  pkts[N];
-unsigned char * p_pkt;
-int len;
-int sum=0;
-int sum2=0;
-char *p=(char *) malloc(1000);
-//alloc
-v1pop=netapi_timing_start();
-for(i=0;i<N;i++)   pkts[i]= Pktlib_allocPacket(OurHeap,1000);
-v2pop = netapi_timing_start();
-
-//write access
-Pktlib_getDataBuffer(pkts[0],(uint8_t**)&p_pkt,&len);
-v1write=netapi_timing_start();
-for(i=0;i<1000;i++) p_pkt[i]=i;
-v2write=netapi_timing_start();
-
-//read access
-v1read=netapi_timing_start();
-for(j=0;j<10;j++)
-for(i=0;i<1000;i++) sum+=p_pkt[i];
-v2read=netapi_timing_start();
-
-// access (from malloc)
-v1read2=netapi_timing_start();
-for(i=0;i<1000;i++) sum2+=p[i];
-v2read2=netapi_timing_start();
-
-//free packet
-v1push=netapi_timing_start();
-for(i=0;i<N;i++)   Pktlib_freePacket(pkts[i]);
-v2push = netapi_timing_start();
-
-//resutls
-printf("allocs= %d  free=%d   write=%d  read=%d read-malloc=%d (sum=%d %d)\n",
-        (v2pop-v1pop)/N, (v2push-v1push)/N,  (v2write-v1write)/1000, (v2read-v1read)/10000,
-        (v2read2-v1read2)/1000,sum,sum2);
-
+    Ti_Pkt  pkts[N];
+    unsigned char * p_pkt;
+    int len;
+    int sum=0;
+    int sum2=0;
+    char *p=(char *) malloc(1000);
+
+    if(p)
+    {
+        for(i=0;i<1000;i++)
+            p[i] = i;
+        //alloc
+        v1pop=netapi_timing_start();
+        for(i=0;i<N;i++)   pkts[i]= Pktlib_allocPacket(OurHeap,1000);
+        v2pop = netapi_timing_start();
+
+        //write access
+        Pktlib_getDataBuffer(pkts[0],(uint8_t**)&p_pkt,&len);
+        v1write=netapi_timing_start();
+        for(i=0;i<1000;i++) p_pkt[i]=i;
+        v2write=netapi_timing_start();
+
+        //read access
+        v1read=netapi_timing_start();
+        for(j=0;j<10;j++)
+        for(i=0;i<1000;i++) sum+=p_pkt[i];
+        v2read=netapi_timing_start();
+
+        // access (from malloc)
+        v1read2=netapi_timing_start();
+        for(i=0;i<1000;i++) sum2+=p[i];
+        v2read2=netapi_timing_start();
+
+        //free packet
+        v1push=netapi_timing_start();
+        for(i=0;i<N;i++)   Pktlib_freePacket(pkts[i]);
+        v2push = netapi_timing_start();
+
+        //resutls
+        printf("allocs= %d  free=%d   write=%d  read=%d read-malloc=%d (sum=%d %d)\n",
+                (v2pop-v1pop)/N, (v2push-v1push)/N,  (v2write-v1write)/1000, (v2read-v1read)/10000,
+                (v2read2-v1read2)/1000,sum,sum2);
+        free(p);
+    }
 
 };
 
index d9adaf11bda2461aab25498a35bfe29d70e12427..d88fc9f354f7804ed7baacd327eadc19605e3d3f 100755 (executable)
@@ -69,7 +69,7 @@
 
 
 extern int QUIT;
-extern netTestStats_T stats[TUNE_NETAPI_NUM_CORES];
+extern netTestStats_T stats[];
 extern paSysStats_t netcp_stats;
 
 extern Rm_ServiceHandle   *rmClientServiceHandle;
@@ -182,7 +182,7 @@ void flip_and_send_pkt(Ti_Pkt *tip,  unsigned char * p_pkt, int len, int flag, u
 #else
 int coreid=0;
 #endif
-              // netTest_utilDumpBuffer((long*)p_pkt,len);
+    // netTest_utilDumpBuffer((long*)p_pkt,len);
     Pktlib_setPacketLen(tip,len);
     //flip the mac address
     memcpy(&mac_temp,&p_pkt[0],6);
@@ -374,10 +374,7 @@ int coreid=0;
                  memcpy(&p_pkt[netTest_MAC_HEADER_LEN+netTest_IP_HEADER_LEN],&p_sa_info_tx->spi,4);
             }
             else
-            {
-                printf("flip_and_send_pkt: invalid ESP protocol\n");
                 return;
-            }
 
             meta_tx.pseudoHdrChecksum =
             netTest_utilGetIPv4PsudoChkSum(&p_pkt[meta_tx.ipOffBytes],8+ meta_tx.ploadLen);
@@ -907,14 +904,14 @@ void setup_netTestDSPFastPath(NETAPI_T handle)
     PKTIO_CFG_T dsp_pktio_cfg;
     NETCP_CFG_CLASSIFIER_T dsp_classi;
     NETCP_CFG_ROUTE_T dsp_route;
+    char dsp_name[PKTIO_MAX_NAME];
 
     memset(&dsp_pktio_cfg, 0, sizeof (PKTIO_CFG_T));
     memset(&dsp_classi, 0, sizeof (NETCP_CFG_CLASSIFIER_T));
     memset(&dsp_route, 0, sizeof (NETCP_CFG_ROUTE_T));
-    char dsp_name[PKTIO_MAX_NAME];
     for (i = 0; i < CPU_NUM_REM_FAST_PATH_CORES; i++)
     {
-        snprintf(&dsp_name[0],32, "%s%d","dsp_chan", i);
+        snprintf(&dsp_name[0],PKTIO_MAX_NAME-1, "%s%d","dsp_chan", i);
         dsp_pktio_cfg.flags1 = PKTIO_RX;
         dsp_pktio_cfg.flags2 = PKTIO_PKT;
         dsp_pktio_cfg.qnum = TEST_NWAL_BASE_REM_FP_RX_PKT_QUEUE + i;
@@ -926,10 +923,6 @@ void setup_netTestDSPFastPath(NETAPI_T handle)
                                                (PKTIO_CB)recv_cb,
                                                &dsp_pktio_cfg,
                                                &err);
-        if (!dsp_pktio_channels[i])
-        {
-            netapi_Log("setup_netTestDSPFastPath: failed for core %d\n", i);
-        }
 
         dsp_classi.classType =NETCP_CFG_CLASS_TYPE_L4;
         dsp_classi.u.c_l4.iface = netTestCfg.dsp_mac;
@@ -1063,10 +1056,6 @@ void fast_path_thread(uint32_t index)
 #else
     for (i = netTestCfg.fp_proc_start[index]; i <= netTestCfg.fp_proc_end[index];i++)
     {
-        netapi_Log("fast_path_thread: start core %d end core %d\n",
-                netTestCfg.fp_proc_start[index],
-                netTestCfg.fp_proc_end[index]);
-        netapi_Log("fast_path_thread: setting cpu %d to cpu_set\n", i);
         CPU_SET( i, &cpu_set);
     }
     hplib_utilSetupThread(thread_num, &cpu_set, hplib_spinLock_Type_LOL);
@@ -1105,14 +1094,12 @@ void fast_path_thread(uint32_t index)
         {
         printf("sched create failed for core%d\n",thread_num);
         goto ERR_fast_path_thread;
-        //exit(1);
     }
 
  
     scheduler[thread_num]->config.yield = NETAPI_FALSE;
     scheduler[thread_num]->config.pollGarbageQ = NETAPI_FALSE;
     scheduler[thread_num]->config.pollCtrlQ = NETAPI_FALSE;
-     //sleep(100000);
    /* Entry point to scheduler */
     printf("Fast Path thread: %d setup complete, running on ARM CORE: %d\n", i,i);
     netapi_schedRun(scheduler[thread_num], &err);
@@ -1137,6 +1124,7 @@ int main(int argc, char **argv)
     Pktlib_HeapIfTable*  pPktifTable;
     FILE * fpr = NULL;
     int c;
+    int configFilePresent = 0;
 
     static char usage[] = "usage: %s -f < config File Name> -t <masterType: procMaster or sysMater> >\n";
 #ifdef netTest_MULTI_THREAD
@@ -1152,7 +1140,8 @@ int main(int argc, char **argv)
        {
             case 'f':
                 fpr = fopen(optarg, "r");
-                printf("main: filename1 %s\n", optarg);
+                if(fpr)
+                    configFilePresent =1;
                 break;
             case 't':
                 if(strcmp("sysMaster", optarg) == 0)
@@ -1167,7 +1156,6 @@ int main(int argc, char **argv)
                 {
                     printf("%s\n", usage);
                 }
-                printf("optionValue %s: %d\n", optarg, masterType);
                 break;
 
             case '?':
@@ -1179,8 +1167,16 @@ int main(int argc, char **argv)
         }
     }
 
-    if (fpr ==NULL)
+    if (!configFilePresent)
+    {
         fpr = fopen(input_file_name, "r");
+        if (fpr == NULL)
+        {
+            printf("main: Missing config file\n");
+            exit(EXIT_FAILURE);
+        }
+    }
+
     if (initRm())
     {
         printf("main: initRm() returned error\n");
index 66f7cf5f9662c950845f6ef4e829042d31872996..20b61a00860864ea28a537cdbe52e916ba289b6e 100755 (executable)
@@ -121,7 +121,7 @@ void recv_cb_router(struct PKTIO_HANDLE_Tag * channel, Ti_Pkt* p_recv[],
                          uint64_t ts );
 
 
-extern netTestStats_T stats[TUNE_NETAPI_NUM_CORES];
+extern netTestStats_T stats[];
 extern paSysStats_t netcp_stats;
 
 /*******************************************
index 8f2b92c0fb2dabab0c728f1b8f2521464a399044..cdb87a1fce639202ee72316b2c29f06042418df5 100755 (executable)
@@ -678,8 +678,6 @@ void  netTest_utilBuildSADB(int i)
            trie_insert(p_trie_sa_tx,(char *)&tmp_tunnel,4, (void *) &sa_info[i]);
         }
     }
-    else
-        netapi_Log("netTest_utilBuildSADB(): invalid encryption/authentication combination selected\n");
 
 }
 NETCP_CFG_ROUTE_T routeInfo;
@@ -699,13 +697,11 @@ int netTest_utilCreateDefaultFlow(NETAPI_T handle, int masterType)
 
     if (nwal_CreateGenPurposeQueue (&qHandle) == nwal_OK)
     {
-        printf("netTest_utilCreateDefaultFlow: qHandle: 0x%x\n", qHandle);
         pktio_cfg.qnum = qHandle ;
         pktio_cfg.max_n = 8;
     }
     else
     {
-        netapi_Log("netTest_utilCreateDefaultFlow:GenPurposeQueue create failure\n");
         return -1;
     }
 
@@ -729,14 +725,14 @@ int netTest_utilCreateDefaultFlow(NETAPI_T handle, int masterType)
 
     if (!pPktioHandle)
     {
-        netapi_Log("netTest_utilCreateDefaultFlow: failed for %d\n", masterType);
+        return -1;
     }
     routeInfo.p_dest_q = pPktioHandle;
     
     routeInfo.p_flow = (NETCP_CFG_FLOW_T*)NETCP_DEFAULT_FLOW;
     routeInfo.valid_params = NETCP_CFG_VALID_PARAM_ROUTE_TYPE;
 
-    printf("netTest_utilCreateDefaultFlow setup complete\n");
+    return 0;
 }
 int netTest_utilCreateSecAssoc(void)
 {
@@ -765,7 +761,6 @@ int netTest_utilCreateSecAssoc(void)
             &err);
             if (err)
             {
-                netapi_Log("addRxSa failed %d\n",err);
                 exit(1);
             }
 
@@ -784,7 +779,6 @@ int netTest_utilCreateSecAssoc(void)
                              &err);
                 if (err)
                 {
-                    netapi_Log("addSaPolicy failed  %d for index %d\n",err,i); 
                     exit(1);
                 }
             }
@@ -808,7 +802,7 @@ int netTest_utilCreateSecAssoc(void)
                 &(sa_info[i].tx_inflow_mode_handle),
                 (void*)saId,
                 &err);
-            if (err) {netapi_Log("addTxSa failed %d\n",err); exit(1);}
+            if (err) {exit(1);}
         }
     }
     return err;
@@ -825,7 +819,6 @@ void netTest_utilDeleteSecAssoc()
         {
             if (rx_policy[i])
                 netapi_secDelRxPolicy(netapi_handle, rx_policy[i], &err);
-            if (err == 0) netapi_Log("polcicy deleted  %d\n", i );
                 //delete tunnels
             netapi_secDelSA(netapi_handle, 0, sa_info[i].rx_tunnel, &err);
         }
index 19dacdd5ac79a80281a9a6213a6d7d91e525f407..18b3cff79f8f084989573195f0b911b0344db2e6 100755 (executable)
@@ -107,10 +107,10 @@ void netTest_utilMySig(int x)
 {
     QUIT=1;
     scnt+=1;
-    netapi_Log(">net_test: recv'd signal %d cnt=%d\n",x,scnt);
+    printf(">net_test: recv'd signal %d cnt=%d\n",x,scnt);
     if (scnt > 10)
     {
-        netapi_Log(">net_test: WARNING EXITING WITH PROPER SHUTDOWN, LUTS LEFT ACTIVE\n");
+        printf(">net_test: WARNING EXITING WITH PROPER SHUTDOWN, LUTS LEFT ACTIVE\n");
         exit(1);
     }
 }
@@ -120,19 +120,19 @@ unsigned long netTest_utilPeek(unsigned long * p)
 }
 void netTest_utilDumpDescr(unsigned long *p, int n)
 {
-    netapi_Log("--------dump of descriptor %d %x\n", n, (int) p);
-    netapi_Log("> %x %x %x %x %x %x %x %x\n",p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7]);
-    netapi_Log("> %x %x %x %x %x %x %x %x\n",p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15]);
-    netapi_Log("-----------------------------\n");
+    printf("--------dump of descriptor %d %x\n", n, (int) p);
+    printf("> %x %x %x %x %x %x %x %x\n",p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7]);
+    printf("> %x %x %x %x %x %x %x %x\n",p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15]);
+    printf("-----------------------------\n");
 }
 void netTest_utilDumpHeader(unsigned long *p, int n, int a, int r)
 {
-    netapi_Log("--------dump of header %d %x appID=%x flag1=%x\n", n, (int) p,a,r);
-    netapi_Log("> %x %x %x %x %x %x %x %x\n",p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7]);
-    netapi_Log("> %x %x %x %x %x %x %x %x\n",p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15]);
-    netapi_Log("> %x %x %x %x %x %x %x %x\n",p[16],p[17],p[18],p[19],p[20],p[21],p[22],p[23]);
-    netapi_Log("> %x %x %x %x %x %x %x %x\n",p[24],p[25],p[26],p[27],p[28],p[29],p[30],p[31]);
-    netapi_Log("-----------------------------\n");
+    printf("--------dump of header %d %x appID=%x flag1=%x\n", n, (int) p,a,r);
+    printf("> %x %x %x %x %x %x %x %x\n",p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7]);
+    printf("> %x %x %x %x %x %x %x %x\n",p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15]);
+    printf("> %x %x %x %x %x %x %x %x\n",p[16],p[17],p[18],p[19],p[20],p[21],p[22],p[23]);
+    printf("> %x %x %x %x %x %x %x %x\n",p[24],p[25],p[26],p[27],p[28],p[29],p[30],p[31]);
+    printf("-----------------------------\n");
 }
 
 void   netTest_utilDumpBuffer
@@ -155,7 +155,7 @@ void   netTest_utilDumpBuffer
 
     tmp_buf = (uint8_t *)(buf);
 
-    netapi_Log("netapi *:  - 8 bit word hex Length: %d Start \n",buf_length);
+    printf("netapi *:  - 8 bit word hex Length: %d Start \n",buf_length);
     do
     {
     row_count = (dump_size - count);
@@ -174,27 +174,27 @@ void   netTest_utilDumpBuffer
         {
             case 4:
             {
-                netapi_Log("netapi *:%02d : %02x    %02x    %02x    %02x \n",
+                printf("netapi *:%02d : %02x    %02x    %02x    %02x \n",
                       count,tmp_buf[0],tmp_buf[1],tmp_buf[2],tmp_buf[3]);
                 break;
             }
             case 3:
             {
-                netapi_Log("netapi *: %02d : %02x    %02x    %02x \n",
+                printf("netapi *: %02d : %02x    %02x    %02x \n",
                       count,tmp_buf[0],tmp_buf[1],tmp_buf[2]);
                 break;
             }
 
             case 2:
             {
-                netapi_Log("netapi *: %02d : %02x    %02x \n",
+                printf("netapi *: %02d : %02x    %02x \n",
                       count,tmp_buf[0],tmp_buf[1]);
                 break;
             }
 
             case 1:
             {
-                netapi_Log("netapi *: %02d : %02x \n",
+                printf("netapi *: %02d : %02x \n",
                       count,tmp_buf[0]);
                 break;
             }
@@ -206,7 +206,7 @@ void   netTest_utilDumpBuffer
 
     }while(count < dump_size);
 
-    netapi_Log("netapi *:  - Byte hex Dump End \n");
+    printf("netapi *:  - Byte hex Dump End \n");
 
 }
 long netTest_utilHtonl(long x)
@@ -981,7 +981,7 @@ void netTest_utilProcessConfigFile(FILE * fpr, netTestConfigFile_t *pConfig)
     char * d9, *d10, *d11, *d12;
     char * d13, *d14, *d15, *d16, *d17;
     char tokens[] = " :=;\n";
-    char temp_str[50];
+    char temp_str[TEMP_STR_LEN];
     memset(line, 0, MAX_LINE_LENGTH + 1);
     memset(pConfig, 0, sizeof(netTestConfigFile_t));
     while (fgets(line, MAX_LINE_LENGTH + 1, fpr))
@@ -1029,7 +1029,7 @@ void netTest_utilProcessConfigFile(FILE * fpr, netTestConfigFile_t *pConfig)
 
         for(i=0;i<MAX_SEC_INDEX;i++)
         {
-            sprintf(temp_str,"sa%d",i);
+            snprintf(temp_str, TEMP_STR_LEN-1, "sa%d",i);
             CHECK_SET_PARAM_SA(temp_str, 
                               (char*)&pConfig->sa_config[i][0].dir,
                               (char*)&pConfig->sa_config[i][0].spi,
@@ -1052,33 +1052,33 @@ void netTest_utilProcessConfigFile(FILE * fpr, netTestConfigFile_t *pConfig)
 
         for(i=0;i<MAX_ROUTES;i++)
         {
-            sprintf(temp_str,"route%d",i);
+            snprintf(temp_str, TEMP_STR_LEN-1, "route%d",i);
             CHECK_SET_PARAM2(temp_str,&pConfig->routes[i][0],&pConfig->ports[i][0] );
         }
 
         for(i=0;i<MAX_ROUTES;i++)
         {
-            sprintf(temp_str,"dstip%d",i);
+            snprintf(temp_str, TEMP_STR_LEN-1, "dstip%d",i);
             CHECK_SET_PARAM2(temp_str,&pConfig->dst_ips[i][0],&pConfig->paths[i][0] );
         }
         for(i=0;i<NET_TEST_MAX_MAC;i++)
         {
-            sprintf(temp_str,"mac%d",i);
+            snprintf(temp_str, TEMP_STR_LEN-1, "mac%d",i);
             CHECK_SET_PARAM2(temp_str,&pConfig->mac[i][0],&pConfig->switch_port[i][0] );
         }
         for(i=0;i<NET_TEST_MAX_IP;i++)
         {
-            sprintf(temp_str,"ip%d",i);
+            snprintf(temp_str, TEMP_STR_LEN-1, "ip%d",i);
             CHECK_SET_PARAM2(temp_str,&pConfig->ip[i][0], &pConfig->attach_iface[i][0]);
         }
         for(i=0;i<NET_TEST_MAX_FP_THREAD;i++)
         {
-            sprintf(temp_str,"fp%d",i);
+            snprintf(temp_str, TEMP_STR_LEN-1, "fp%d",i);
             CHECK_SET_PARAM2(temp_str, &pConfig->fp_thread_num[i][0],&pConfig->fp[i][0]);
         }
         for(i=0;i<NET_TEST_MAX_SP_THREAD;i++)
         {
-            sprintf(temp_str,"sp%d",i);
+            snprintf(temp_str, TEMP_STR_LEN-1, "sp%d",i);
             CHECK_SET_PARAM2(temp_str, &pConfig->sp_thread_num[i][0],&pConfig->sp[i][0]);
         }
     }
@@ -1322,12 +1322,8 @@ void netTest_utilCreateInterfaces(uint8_t num_macs, uint8_t num_ips)
                           1, 
                           &err);
        if (err)
-       {
-            netapi_Log("addmac %d failed %d\n",i, err);
-        //exit(1); 
-       }
-       else
-        netapi_Log("netTest_utilCreateInterfaces: added mac sucess\n");
+           netapi_Log("netapi_netcpCfgCreateMacInterface failed with error: %d\n",err);
+
     }
     for (i = 0; i < num_ips; i++)
     {
@@ -1343,12 +1339,8 @@ void netTest_utilCreateInterfaces(uint8_t num_macs, uint8_t num_ips)
                           (void*)NULL,
                           &err
                           );
-        if (err) {
-            netapi_Log("netTest_utilCreateInterfaces: add ip %d failed %d\n", i, err);
-        //exit(1); 
-        }
-        else
-            netapi_Log("netTest_utilCreateInterfaces: added ip sucess\n");
+        if (err)
+            netapi_Log("netapi_netcpCfgAddIp: add ip failed with error %d\n", err);
     }
 }
 
index 8d1c3b7a40871aef62eea6cffe2c207b6d60254b..d6f611fe6b06376827466c3a22ddb45b6925fca3 100755 (executable)
@@ -15,6 +15,8 @@
 #define MAX_LINE_LENGTH 512
 #define MAX_ROUTES 16
 
+#define TEMP_STR_LEN 32
+
 #define BE(x) ( (((x)&0xff000000)>>24) | (((x)&0xff0000)>>8) | (((x)&0xff00)<<8) | (((x)&0xff)<<24)  )
 
 /* The input strings requirEd for parsing certain configuration
index 021d9b1b8837c37bc7049a7a2d97fc6e2b420891..503a174e6302c105428098374574644b6fc6b6c8 100755 (executable)
@@ -340,7 +340,7 @@ void ntBrideProcessCfgFile(FILE * fpr, ntBridgeCfgFile_T *pConfig)
     char *key, *ep;
     char * d1, *d2, *d3;
     char tokens[] = " :=;\n";
-    char temp_str[50];
+    char temp_str[TEMP_STR_LEN];
     memset(line, 0, MAX_LINE_LENGTH + 1);
     //memset(pConfig, 0, sizeof(netTestConfigFile_t));
     while (fgets(line, MAX_LINE_LENGTH + 1, fpr))
@@ -378,7 +378,7 @@ void ntBrideProcessCfgFile(FILE * fpr, ntBridgeCfgFile_T *pConfig)
 
         for(i=0;i<MAX_DSCP_ENTRIES;i++)
         {
-            sprintf(temp_str,"dscp_map_%d",i);
+            snprintf(temp_str,TEMP_STR_LEN-1,"dscp_map_%d",i);
 
             CHECK_SET_PARAM2(temp_str,&pConfig->dscpMapF[i][0],&pConfig->dscpMapQ[i][0]);
         }
@@ -399,7 +399,7 @@ void ntBrideProcessAleCfgFile(FILE * fpr, ntBridgeAleCfgFile_T *pConfig)
     char *key, *ep;
     char * d1, *d2, *d3;
     char tokens[] = " =;\n";
-    char temp_str[50];
+    char temp_str[TEMP_STR_LEN];
     memset(line, 0, MAX_LINE_LENGTH + 1);
     //memset(pConfig, 0, sizeof(netTestConfigFile_t));
     while (fgets(line, MAX_LINE_LENGTH + 1, fpr))
@@ -424,7 +424,7 @@ void ntBrideProcessAleCfgFile(FILE * fpr, ntBridgeAleCfgFile_T *pConfig)
         
         for(i=0;i< 32;i++)
         {
-            sprintf(temp_str,"mac%d",i);
+            snprintf(temp_str,TEMP_STR_LEN-1,"mac%d",i);
             CHECK_SET_PARAM2(temp_str,&pConfig->mac[i][0],&pConfig->switch_port[i][0]);
         }
     }
@@ -667,7 +667,7 @@ unsigned long t2;
     start_time = hplib_mUtilGetTimestamp();
 
     /* Poll the default pktio channel for pkts from network */
-    for(i=0;!((volatile) QUIT);i++)
+    for(i=0;!((volatile int) QUIT);i++)
     {
         if (FAST)
         {
@@ -859,9 +859,9 @@ int main(int argc, char **argv)
 
     for(i = 0; i < MAX_INTERFACES; i++)
     {
-        char temp_str[50] = {0};
+        char temp_str[PKTIO_MAX_NAME] = {0};
         direct_to_cpsw_cfg.qnum = netTestQosShapperCfg[i].queueBase;
-        sprintf(temp_str,"cpsw_tx%d",i);
+        snprintf(temp_str, PKTIO_MAX_NAME, "cpsw_tx%d",i);
         cpsw_tx_chan[i]= netapi_pktioCreate(netapi_handle,&temp_str[0],NULL,
                                      &direct_to_cpsw_cfg, &err); 
         if (!cpsw_tx_chan[i])
@@ -939,7 +939,7 @@ int main(int argc, char **argv)
     {
         pthread_t *thrs;
         int procs =1; 
-        char c;
+        int c;
         thrs = malloc( sizeof( pthread_t ) * procs );
         if (thrs == NULL)
         {
@@ -1067,21 +1067,6 @@ int main(int argc, char **argv)
            {
               netTest_utilDumpHeader(&last_header[0], 0,0,0);
            }
-#if 0
-           else if (c=='S')
-           {
-             int j;
-             printf(" pktsz     npkts    cycles/pkt_ckksum\n");
-             for(j=0;j<NCSUM;j++) 
-             {
-                if(!csum_num[j]) continue;
-                printf("%d   %ld    %lld\n", j,
-                              csum_num[j],
-                              (unsigned long long) csum_tim[j]/csum_num[j]);
-
-             }
-           }
-#endif
            else if (c == 'z')
             {
                 nwalCtlInfo_t nwalCtrl;
@@ -1201,7 +1186,7 @@ void recv_cb_net(struct PKTIO_HANDLE_Tag * channel, Ti_Pkt* p_recv[],
            cs1= netapi_timing_start();
            val= (unsigned long) checksum((unsigned short *)p_pkt,len);
            cs2= netapi_timing_start();
-           templen = (len > NCSUM)? NCSUM-1: len;
+           templen = (len >= NCSUM)? NCSUM-1: len;
            csum_num[templen]+=1;
            csum_val[templen]+=val;
            csum_tim[templen]+= (unsigned long long) (cs2-cs1); 
index 00e341e8dcdd95d9281db96fc25dae767b736e73..d5805785bc9483e949649a4f8213ed74c949bd2e 100755 (executable)
@@ -120,7 +120,8 @@ memcpy(&sb[14],Phead,20);  //copy outer ip header into buffer
 
 //build esp header
 memcpy(&sb[14+20],(unsigned char *)&p_sec->spi,4);
-seq=BE(p_sec->seq++); //TODO: multicore safe ;  CHECK to make sure that SA does this, if so remove this code
+seq=BE(p_sec->seq); //TODO: multicore safe ;  CHECK to make sure that SA does this, if so remove this code
+p_sec->seq+=1;
 memcpy(&sb[14+24],(unsigned char *)&seq,4);
 
 //IV: don't need:   Sa does it.