diff --git a/ti/runtime/netapi/test/net_test_loopback.c b/ti/runtime/netapi/test/net_test_loopback.c
index e94281931f51e262b46d49a22307ff8638fe11e9..f8b901b292c140d2287365174d53d671dde35462 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>
extern paSysStats_t netcp_stats;
extern Rm_ServiceHandle *rmClientServiceHandle;
+hplib_spinLock_T net_test_thread_lock;
netTestConfig_t netTestCfg;
static netTestConfigFile_t config_file;
-char input_file_name[] = "/etc/netapi/net_test_config.txt";
+char input_file_name[] = "/etc/transportnetlib/test/net_test_config.txt";
nwal_RetValue nwalRetVal;
Pktlib_HeapHandle ourHeap;
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[PKTIO_MAX_NAME];
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_PKT;
dsp_pktio_cfg.qnum = TEST_NWAL_BASE_REM_FP_RX_PKT_QUEUE + i;
#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
+ 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);
/* install signal handler for ^c */
signal(SIGINT,netTest_utilMySig);
- fpr = fopen(input_file_name, "r");
while ((c = getopt (argc, argv, "f:t:?")) != -1)
{
switch (c)
{
case 'f':
- fclose(fpr);
fpr = fopen(optarg, "r");
printf("main: filename1 %s\n", optarg);
break;
}
}
+ if (fpr ==NULL)
+ fpr = fopen(input_file_name, "r");
if (initRm())
{
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));
- char c;
+ int c;
//this thread of execution (main) now just waits on user input
for(;;)
{
/* close pktio channels we opened via open_pktio_tx_channels() */
close_pktio_channels();
#ifdef netTest_DSP_FASTPATH
- teardown_netTestDSPFastPath();
+ if (masterType == NETAPI_SYS_MASTER)
+ {
+ teardown_netTestDSPFastPath();
+ }
#endif
netapi_shutdown(netapi_handle);
/* Stub functions */
Trie * route_init(void)
{
+ return NULL;
}
void route_add(Trie * Pt, unsigned long * Pdest_ipBE, void * Pour_route)
{