summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8a6c473)
raw | patch | inline | side by side (parent: 8a6c473)
author | Tinku Mannan <tmannan@ti.com> | |
Thu, 20 Nov 2014 21:04:42 +0000 (16:04 -0500) | ||
committer | Tinku Mannan <tmannan@ti.com> | |
Thu, 20 Nov 2014 21:05:40 +0000 (16:05 -0500) |
20 files changed:
diff --git a/ti/runtime/netapi/applications/ipsec_offload/ipsecmgr/src/netapi_ipsecmgr.c b/ti/runtime/netapi/applications/ipsec_offload/ipsecmgr/src/netapi_ipsecmgr.c
index 892c2a7639cec73ba3b6abbb8c0d1fece518bd1e..185fce88223665708b73952adba0003534bde5c5 100644 (file)
{
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;
#endif
#include <stdint.h>
-#include "netapi.h"
#include "./src/netapi_loc.h"
index f58ec8723701511d50e6f3181167809caad1fc00..81d50b481377bbaa99a44a848efbcaaa91c95e76 100755 (executable)
* @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
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();
else
{
pBase = hplib_shmOpen(HPLIB_SHM_SIZE);
- if (!pBase)
- {
- netapi_Log("netapi_init: hplib_shmOpen error\n");
- }
- else
+ if (pBase)
Osal_start(pBase);
}
p->pktios[i] = calloc(1,sizeof(PKTIO_HANDLE_T));
if (!p->pktios[i])
{
+ free(p);
return NULL;
}
else
}
else
{
- netapi_Log("netapi_init: no master specified\n");
goto ERR_netapi_init;
}
free(p->p_sched);
}
#endif
+ free(p);
return NULL;
}
void * map_base;
hplib_VirtMemPoolheader_T *poolHdr;
- netapi_Log("netapi: WARNING shutdown may not be fully implemented\n");
if (p->master == NETAPI_SYS_MASTER)
{
{
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;
}
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)
{
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;
}
#endif
free(p);
- printf("netapi_shutdown: complete\n");
return;
}
index b193630fc048c6c4d0795b5cb90ae1d87c777bc7..87bc8a9d68089b8cdb95b1d28b51e77e77604a1d 100755 (executable)
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;
}
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)
}
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;
}
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;
}
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;
}
aligns);
if(nwalRetVal != nwal_OK)
{
- netapi_Log ("netapip_initNwal: nwal_getBufferReq Failed %d\n", nwalRetVal);
return nwal_FALSE;
}
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);
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);
(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);
(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);
(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);
(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);
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);
/* 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],
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;
}
pNwalLocCtxMem = malloc(localCtxSize);
if (pNwalLocCtxMem == NULL)
{
- netapi_Log ("netapip_startNwal:malloc failure for nwal local context memory\n");
return -1;
}
nwalBaseAddrCfg.pSaVirtBaseAddr = baseAddr;
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;
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,
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;
}
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;
}
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
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;
}
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. */
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;
/* 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;
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;
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)
{
&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
{
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
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
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;
}
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. */
/* 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
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 */
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
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)
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;
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;
}
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");
}
}
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),
int on)
{
/* NOT_IMPLEMENTED */
- netapi_Log("netapi_secInflowMode: dynamic switch between inflow and sideband is NOT_IMPLEMENTED\n");
}
/********************************************************************
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);
}
*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)
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);
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);
{
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,
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;
}
{
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);
}
}
- netapi_Log ("netapi sec: policy %d (iface %d) deleted\n",policyId,(policy_app_id&0xff));
netapip_freeTransInfo(pTransInfo);
/* zap the entry */
if (!flags)
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)
{
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:
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)
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;
}
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)
{
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);
+ }
}
/*******************************************************************************
if(ret != nwal_OK)
{
*err = NETAPI_ERR_BUSY; //no resources??
- netapi_Log("> netapi_netcpCfg reqStats failed, err=%d\n",ret);
netapip_freeTransInfo(pTransInfo);
return;
}
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;
}
{
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);
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;
}
{
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);
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;
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)
{
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,
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 ;
}
{
netapip_freeTransInfo(pTransInfo);
*err = NETAPI_ERR_PA_FW;
- netapi_Log ("netapip_netcpCfgDelIpInternal - ERROR returned by NETCP PA firmware %d\n", *err);
return;
}
}
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);
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)
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,
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? */
}
{
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;
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);
}
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;
}
default:
{
- netapi_Log ("netcp cfg> Invalid transaction type %d for trans_id: %d\n",
- p_trans->transType,trans_id);
break;
}
}
diff --git a/ti/runtime/netapi/src/pdkv2/netapi_navig.c b/ti/runtime/netapi/src/pdkv2/netapi_navig.c
index ea9c6f2fd27c89737fe22d0bc42f0fd6f5fc285c..35069b507586b151cf77824e2abbd397fd9079c7 100755 (executable)
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)
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;
diff --git a/ti/runtime/netapi/src/pdkv3/netapi_navig.c b/ti/runtime/netapi/src/pdkv3/netapi_navig.c
index 16ed1b758b4d588e947bb8e364b7c0e1ccd765d3..11ed60eeab4486b43dade1344d52cfa5800a40ea 100755 (executable)
result = Cppi_init (&netapi_cppiGblCfgParams);
if (result != CPPI_SOK) {
- netapi_Log ("function testNwGlobCppiInit: Cppi_init failed with error code %d\n", result);
return (-1);
}
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)
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)
#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)
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;
//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)
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);
{
pthread_t *thrs;
int procs =1;
- char c;
+ int c;
thrs = malloc( sizeof( pthread_t ) * procs );
if (thrs == NULL)
{
//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);
+ }
};
diff --git a/ti/runtime/netapi/test/net_test_loopback.c b/ti/runtime/netapi/test/net_test_loopback.c
index d9adaf11bda2461aab25498a35bfe29d70e12427..d88fc9f354f7804ed7baacd327eadc19605e3d3f 100755 (executable)
extern int QUIT;
-extern netTestStats_T stats[TUNE_NETAPI_NUM_CORES];
+extern netTestStats_T stats[];
extern paSysStats_t netcp_stats;
extern Rm_ServiceHandle *rmClientServiceHandle;
#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);
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);
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;
(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;
#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);
{
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);
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
{
case 'f':
fpr = fopen(optarg, "r");
- printf("main: filename1 %s\n", optarg);
+ if(fpr)
+ configFilePresent =1;
break;
case 't':
if(strcmp("sysMaster", optarg) == 0)
{
printf("%s\n", usage);
}
- printf("optionValue %s: %d\n", optarg, masterType);
break;
case '?':
}
}
- 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)
uint64_t ts );
-extern netTestStats_T stats[TUNE_NETAPI_NUM_CORES];
+extern netTestStats_T stats[];
extern paSysStats_t netcp_stats;
/*******************************************
diff --git a/ti/runtime/netapi/test/net_test_sa_utils.c b/ti/runtime/netapi/test/net_test_sa_utils.c
index 8f2b92c0fb2dabab0c728f1b8f2521464a399044..cdb87a1fce639202ee72316b2c29f06042418df5 100755 (executable)
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;
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;
}
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)
{
&err);
if (err)
{
- netapi_Log("addRxSa failed %d\n",err);
exit(1);
}
&err);
if (err)
{
- netapi_Log("addSaPolicy failed %d for index %d\n",err,i);
exit(1);
}
}
&(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;
{
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)
{
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);
}
}
}
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
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);
{
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;
}
}while(count < dump_size);
- netapi_Log("netapi *: - Byte hex Dump End \n");
+ printf("netapi *: - Byte hex Dump End \n");
}
long netTest_utilHtonl(long x)
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))
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]);
}
}
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++)
{
(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)
#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)
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))
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]);
}
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))
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]);
}
}
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)
{
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])
{
pthread_t *thrs;
int procs =1;
- char c;
+ int c;
thrs = malloc( sizeof( pthread_t ) * procs );
if (thrs == NULL)
{
{
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;
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)
//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.