diff --git a/ti/runtime/netapi/test/net_test_loopback.c b/ti/runtime/netapi/test/net_test_loopback.c
index ccc15f034189809da9f92737d56ee4185d9983b0..d85a8f1b9db31dd3f2aa9f37f89f8f7527eb6a6b 100755 (executable)
*****************************************************************************/
-#include "net_test.h"
+#include "netapi.h"
+#include "net_test_sa_utils.h"
+#include "net_test_utils.h"
+#include "net_test_thread_utils.h"
#include "ti/drv/nwal/test/fw_rm.h"
#include <signal.h>
#include <pthread.h>
#if defined(DEVICE_K2H)
-#include <ti/runtime/hplib/device/k2h/src/hplib_device.c>
-#include <ti/runtime/netapi/device/k2h/src/netapi_device.c>
#include <ti/drv/qmss/device/k2h/src/qmss_device.c>
#include <ti/drv/cppi/device/k2h/src/cppi_device.c>
#elif defined (DEVICE_K2K)
-#include <ti/runtime/hplib/device/k2k/src/hplib_device.c>
-#include <ti/runtime/netapi/device/k2k/src/netapi_device.c>
#include <ti/drv/qmss/device/k2k/src/qmss_device.c>
#include <ti/drv/cppi/device/k2k/src/cppi_device.c>
#elif defined (DEVICE_K2L)
-#include <ti/runtime/hplib/device/k2l/src/hplib_device.c>
-#include <ti/runtime/netapi/device/k2l/src/netapi_device.c>
#include <ti/drv/qmss/device/k2l/src/qmss_device.c>
#include <ti/drv/cppi/device/k2l/src/cppi_device.c>
#elif defined (DEVICE_K2E)
-#include <ti/runtime/hplib/device/k2e/src/hplib_device.c>
-#include <ti/runtime/netapi/device/k2e/src/netapi_device.c>
#include <ti/drv/qmss/device/k2e/src/qmss_device.c>
#include <ti/drv/cppi/device/k2e/src/cppi_device.c>
#else /*Default */
-#include <ti/runtime/hplib/device/k2h/src/hplib_device.c>
-#include <ti/runtime/netapi/device/k2h/src/netapi_device.c>
#include <ti/drv/qmss/device/k2h/src/qmss_device.c>
#include <ti/drv/cppi/device/k2h/src/cppi_device.c>
#endif /* Device */
extern netTestStats_T stats[TUNE_NETAPI_NUM_CORES];
extern paSysStats_t netcp_stats;
+extern Rm_ServiceHandle *rmClientServiceHandle;
+hplib_spinLock_T net_test_thread_lock;
+
netTestConfig_t netTestCfg;
static netTestConfigFile_t config_file;
TUNE_NETAPI_DEFAULT_BUFFER_SIZE+128+128, //size of buffers in default heap
128, //tail room
256, //extra room
- 0
+ 0,
+ NULL
};
NETAPI_T netapi_handle;
int coreid=0;
#endif
//nwal_AppId time;
- unsigned long time, delta_time;
+ unsigned long time = 0;
+ unsigned long delta_time = 0;
/* loop over received pkts */
for(i=0;i<n_pkts;i++)
{
}
if(coreid<TUNE_NETAPI_NUM_CORES)
+ {
stats[coreid].rx+=1;
- if (ifno < TUNE_NETAPI_MAX_NUM_MAC)
- stats[coreid].if_rx[ifno]+=1;
-
+ if (ifno < TUNE_NETAPI_MAX_NUM_MAC)
+ stats[coreid].if_rx[ifno]+=1;
+ }
#ifdef DEBUG_DESC
- if (stats[coreid].rx<16)
- {
- netapi_Log(">rx dmp..");
- netTest_utilDumpDescr((long *) tip, stats[coreid].rx);
- }
- else if (stats[coreid].rx>99)
+ if(coreid<TUNE_NETAPI_NUM_CORES)
{
- netapi_Log(">rx dmp..");
- netTest_utilDumpDescr((long *) tip,stats[coreid].rx);
+ if (stats[coreid].rx<16)
+ {
+ netapi_Log(">rx dmp..");
+ netTest_utilDumpDescr((long *) tip, stats[coreid].rx);
+ }
+ else if (stats[coreid].rx>99)
+ {
+ netapi_Log(">rx dmp..");
+ netTest_utilDumpDescr((long *) tip,stats[coreid].rx);
+ }
}
#endif
#if 0
char dsp_name[32];
for (i = 0; i < CPU_NUM_REM_FAST_PATH_CORES; i++)
{
- sprintf(&dsp_name[0],"%s%d","dsp_chan", i);
+ snprintf(&dsp_name[0],32, "%s%d","dsp_chan", i);
dsp_pktio_cfg.flags1 = PKTIO_RX;
dsp_pktio_cfg.flags2 = PKTIO_GLOBAL | PKTIO_PKT;
dsp_pktio_cfg.qnum = TEST_NWAL_BASE_REM_FP_RX_PKT_QUEUE + i;
#else
for (i = netTestCfg.sp_proc_start[index]; i <= netTestCfg.sp_proc_end[index];i++)
{
- printf("slow_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);
#endif
- worker_nh[thread_num] = netapi_init(NETAPI_CORE_MASTER,
- NULL,
- &hplibDeviceGblCfgParam,
- &netapiDeviceGblCfgParam);
+ worker_nh[thread_num] = netapi_init(NETAPI_CORE_MASTER,NULL);
if (worker_nh[thread_num] == NULL)
{
printf("sched create failed for core%d\n",thread_num);
goto ERR_slow_path_thread;
}
- scheduler[thread_num]->config.yield = TRUE;
- scheduler[thread_num]->config.pollGarbageQ = TRUE;
- scheduler[thread_num]->config.pollCtrlQ = TRUE;
+ scheduler[thread_num]->config.yield = NETAPI_TRUE;
+ scheduler[thread_num]->config.pollGarbageQ = NETAPI_TRUE;
+ scheduler[thread_num]->config.pollCtrlQ = NETAPI_TRUE;
printf("Slow Path thread: %d setup complete, running on ARM CORE: %d\n", i,i);
/* Entry point to scheduler */
netapi_schedRun(scheduler[thread_num], &err);
ERR_slow_path_thread:
+ printf("slow_path_thread: calling netapi_shutdown\n");
netapi_shutdown(worker_nh[thread_num]);
}
#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",
+ 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);
}
hplib_utilSetupThread(thread_num, &cpu_set, hplib_spinLock_Type_LOL);
#endif
- worker_nh[thread_num]=netapi_init(NETAPI_CORE_MASTER,
- NULL,
- &hplibDeviceGblCfgParam,
- &netapiDeviceGblCfgParam);
+ hplib_mSpinLockLock(&net_test_thread_lock);
+ worker_nh[thread_num]=netapi_init(NETAPI_CORE_MASTER,NULL);
+
if (worker_nh[thread_num] == NULL)
{
printf("fast_path_thread: netapi_init failure, exiting\n");
+ hplib_mSpinLockUnlock(&net_test_thread_lock);
exit(1);
}
+ hplib_mSpinLockUnlock(&net_test_thread_lock);
/* open netcp default RX channels*/
rx_chan = netapi_pktioOpen(worker_nh[thread_num], NETCP_RX, (PKTIO_CB) recv_cb, &netcp_rx_cfg, &err);
}
- scheduler[thread_num]->config.yield = FALSE;
- scheduler[thread_num]->config.pollGarbageQ = FALSE;
- scheduler[thread_num]->config.pollCtrlQ = FALSE;
+ 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);
ERR_fast_path_thread:
netapi_pktioClose(rx_chan, &err);
netapi_pktioClose(sb_rx_chan, &err);
-
+
+ printf("fast_path_thread: calling netapi_shutdown\n");
netapi_shutdown(worker_nh[thread_num]);
}
printf("Cant open config file: filepath %s, %s\n", input_file_name, strerror(errno));
exit(1);
}
- else
+
+ if (initRm())
{
- memset(&config_file, 0, sizeof(netTestConfigFile_t));
- memset(&netTestCfg, 0, sizeof(netTestConfig_t));
-
- netTest_utilProcessConfigFile(fpr,&config_file);
+ printf("main: initRm() returned error\n");
+ exit(1);
+ }
+ hplib_mSpinLockInit(&net_test_thread_lock );
+ our_netapi_default_cfg.rmHandle = rmClientServiceHandle;
+ memset(&config_file, 0, sizeof(netTestConfigFile_t));
+ memset(&netTestCfg, 0, sizeof(netTestConfig_t));
- netTest_utilParseMac(&config_file);
+ netTest_utilProcessConfigFile(fpr,&config_file);
- /* parse slow path/fast path thread configuration parameters */
- netTest_utilParseThreadParams(&config_file);
+ netTest_utilParseMac(&config_file);
- netTest_utilParseIP(&config_file);
+ /* parse slow path/fast path thread configuration parameters */
+ netTest_utilParseThreadParams(&config_file);
- netTest_utilParseIpsecMode(&config_file);
+ netTest_utilParseIP(&config_file);
- /* DSP mac processing */
- parse_dsp_mac(&config_file.dsp_mac[0]);
+ netTest_utilParseIpsecMode(&config_file);
- /* DSP IP processing */
- parse_dsp_ip(&config_file.dsp_ip[0]);
+ /* DSP mac processing */
+ parse_dsp_mac(&config_file.dsp_mac[0]);
- /* IPSEC interface number processing */
- parse_simple_param_u32((char*)&config_file.ipsec_if_no[0], &netTestCfg.ipsec_if_no);
+ /* DSP IP processing */
+ parse_dsp_ip(&config_file.dsp_ip[0]);
- netTest_utilParseSA(&config_file);
+ /* IPSEC interface number processing */
+ parse_simple_param_u32((char*)&config_file.ipsec_if_no[0], &netTestCfg.ipsec_if_no);
- parse_simple_param_u32(&config_file.dest_udp_port_config, &netTestCfg.dest_udp_port_config);
- }
+ netTest_utilParseSA(&config_file);
+
+ parse_simple_param_u32(&config_file.dest_udp_port_config, &netTestCfg.dest_udp_port_config);
memset(&sa_info, 0, sizeof(sa_info));
hplib_utilSetupThread(0, &cpu_set, hplib_spinLock_Type_LOL);
#endif
- /* hplib_globalDeviceConfigParams_t hplibDeviceGblCfgParam/
/* create netapi */
+
netapi_handle = netapi_init(NETAPI_SYS_MASTER,
- &our_netapi_default_cfg,
- &hplibDeviceGblCfgParam,
- &netapiDeviceGblCfgParam);
+ &our_netapi_default_cfg);
if (netapi_handle == NULL)
{
printf("main: netapi_init failure, exiting\n");
+ closeRm();
exit(1);
}
-
-
/* configure expection packet handling with netapi */
netapi_netcpCfgExceptions(netapi_handle,
NETCP_CFG_ALL_EXCEPTIONS,
if (!ourHeap)
{
printf("Pktlib_findHeapByName() fail\n");
+ closeRm();
exit(1);
}
/* create scheduler instance */
our_sched =netapi_schedOpen(netapi_handle,&our_sched_cfg, &err);
- if (!our_sched) {printf("sched create failed\n"); exit(1);}
+ if (!our_sched)
+ {
+ printf("sched create failed\n");
+ closeRm();
+ exit(1);
+ }
/*create net_test MAC interfaces, attach IP to created MAC interfaces */
if (!p_trie_sa_rx || !p_trie_sa_tx)
{
printf("trie alloc for SA failed\n");
+ closeRm();
exit(1);
}
printf("\n Enter 's' for stats or 'q'to quit net_test_loopback app, or 'h' for help\n");
- char c;
- //this thread of execution (main) now just waits on user input
- for(;;)
- {
- printf(">");
- c=getchar();
- if (c=='q')
- {
- QUIT=1;
- printf("net_test_loopback: please wait for application shutdown and resource cleanup\n");
- break;
- }
- else if (c=='s') netTest_utilsStatsCb(netapi_handle, &netcp_stats);
- else if (c=='h') printf("'q' to quit, 's' for stats, 'h' for help\n");
- }
- netTest_utilRemoveSpFpThreads(netTestCfg.num_sp_threads, netTestCfg.num_fp_threads);
+ int c;
+ //this thread of execution (main) now just waits on user input
+ for(;;)
+ {
+ printf(">");
+ c=getchar();
+ if (c=='q')
+ {
+ QUIT=1;
+ printf("net_test_loopback: please wait for application shutdown and resource cleanup\n");
+ break;
+ }
+ else if (c=='s') netTest_utilsStatsCb(netapi_handle, &netcp_stats);
+ else if (c=='h') printf("'q' to quit, 's' for stats, 'h' for help\n");
+ }
+
+ netTest_utilRemoveSpFpThreads(netTestCfg.num_sp_threads, netTestCfg.num_fp_threads);
}
#else
/*********************************************/
#endif
netapi_shutdown(netapi_handle);
+ closeRm();
printf("net_test shutdown complete\n");
}
/* Stub functions */
Trie * route_init(void)
{
+ return NULL;
}
void route_add(Trie * Pt, unsigned long * Pdest_ipBE, void * Pour_route)
{