index 89b292336bed2a8041f9ca05f78e68af37bc6f9d..44c6cf0c0b577bead71882f3894f4f595803fce2 100755 (executable)
******************************************************************************/
-#include "trie.h"
+#include "netapi.h"
+#include "net_test_sa_utils.h"
+#include "net_test_utils.h"
+#include "net_test_thread_utils.h"
#include <signal.h>
#include <pthread.h>
#include "router.h"
extern int QUIT;
+
+#if defined(DEVICE_K2H)
+#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/drv/qmss/device/k2k/src/qmss_device.c>
+#include <ti/drv/cppi/device/k2k/src/cppi_device.c>
+#elif defined (DEVICE_K2L)
+#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/drv/qmss/device/k2e/src/qmss_device.c>
+#include <ti/drv/cppi/device/k2e/src/cppi_device.c>
+#else /*Default */
+#include <ti/drv/qmss/device/k2h/src/qmss_device.c>
+#include <ti/drv/cppi/device/k2h/src/cppi_device.c>
+#endif
/* Global definitions */
+extern Rm_ServiceHandle *rmClientServiceHandle;
+
+hplib_spinLock_T net_test_thread_lock;
netTestConfig_t netTestCfg;
static netTestConfigFile_t config_file;
TUNE_NETAPI_DEFAULT_NUM_BUFFERS, //#descriptors+buffers in default heap
64, //#descriptors w/o buffers in default heap
TUNE_NETAPI_DEFAULT_BUFFER_SIZE+128+128, //size of buffers in default heap
-128 , //tail room
-256 //extra room
+128, //tail room
+256, //extra room
+0,
+NULL
};
printf("slow_path_thread: setting cpu %d to cpu_set\n", i);
CPU_SET( i, &cpu_set);
}
- hplib_utilSetupThread(0, &cpu_set);
+ hplib_utilSetupThread(0, &cpu_set, hplib_spinLock_Type_LOL);
#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_utilSetupThread(thread_num, &cpu_set, hplib_spinLock_Type_LOL);
#endif
- worker_nh[thread_num]=netapi_init(NETAPI_CORE_MASTER,NULL);
+ worker_nh[thread_num]=netapi_init(NETAPI_CORE_MASTER,
+ NULL);
if (worker_nh[thread_num] == NULL)
{
printf("slow_path_thread: netapi_init failure, exiting\n");
netapi_Log("sched create failed for core%d\n",thread_num);
exit(1);
}
- scheduler[thread_num]->config.yield = FALSE;
- scheduler[thread_num]->config.pollGarbageQ = TRUE;
- scheduler[thread_num]->config.pollCtrlQ = TRUE;
+ scheduler[thread_num]->config.yield = NETAPI_FALSE;
+ scheduler[thread_num]->config.pollGarbageQ = NETAPI_TRUE;
+ scheduler[thread_num]->config.pollCtrlQ = NETAPI_TRUE;
/*********************************************/
/**************Entry point into scheduler ****/
/*********************************************/
printf("fast_path_thread: setting cpu %d to cpu_set\n", i);
CPU_SET( i, &cpu_set);
}
- hplib_utilSetupThread(thread_num, &cpu_set);
+ hplib_utilSetupThread(thread_num, &cpu_set, hplib_spinLock_Type_LOL);
#else
for (i = netTestCfg.fp_proc_start[index]; i <= netTestCfg.fp_proc_end[index];i++)
{
printf("fast_path_thread: setting cpu %d to cpu_set\n", i);
CPU_SET( i, &cpu_set);
}
- hplib_utilSetupThread(thread_num, &cpu_set);
+ hplib_utilSetupThread(thread_num, &cpu_set, hplib_spinLock_Type_LOL);
#endif
- worker_nh[thread_num]=netapi_init(NETAPI_CORE_MASTER,NULL);
+ 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);
NETAPI_HANDLE_T * n = (NETAPI_HANDLE_T *) worker_nh[thread_num];
/* open netcp RX channel */
/*********************************************/
/**************Entry point into scheduler ****/
/*********************************************/
- 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);
netapi_schedRun(scheduler[thread_num], &err);
netapi_Log("fast_path_thread: core %d worker thread done\n",thread_num);
}
else
{
+ 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));
netTest_utilProcessConfigFile(fpr,&config_file);
/* assign main net_test thread to run on core 0 */
CPU_ZERO( &cpu_set);
CPU_SET( 0, &cpu_set);
- hplib_utilSetupThread(0, &cpu_set);
+ hplib_utilSetupThread(0, &cpu_set, hplib_spinLock_Type_LOL);
#endif
/* create netapi */
- netapi_handle = netapi_init(NETAPI_SYS_MASTER, &our_netapi_default_cfg);
+ netapi_handle = netapi_init(NETAPI_SYS_MASTER,
+ &our_netapi_default_cfg);
+
if (netapi_handle == NULL)
{
printf("main: netapi_init failure, exiting\n");
#ifdef netTest_MULTI_THREAD
{
- char c;
+ int c;
/* create and set affinity of slow path and fast path threads to
* specific CPU cores as specified in the net_test_config.txt file */
netTest_utilCreateSpFpThreads(netTestCfg.num_sp_threads,
for(i=0;i<n_pkts;i++)
{
ifno = ((unsigned int)meta[i].u.rx_meta->appId)&0xff;
- if(coreid<TUNE_NETAPI_NUM_CORES) stats[coreid].rx+=1;
- if (ifno < TUNE_NETAPI_MAX_NUM_MAC) stats[coreid].if_rx[ifno]+=1;
+ if(coreid<TUNE_NETAPI_NUM_CORES)
+ {
+ stats[coreid].rx+=1;
+ if (ifno < TUNE_NETAPI_MAX_NUM_MAC)
+ stats[coreid].if_rx[ifno]+=1;
+ }
tip = p_recv[i];
Pktlib_getDataBuffer(tip,(uint8_t**)&p_pkt,&templen);//ignore templen
len = Pktlib_getPacketLen(tip)-4;//real length, subtract mac trailer
- stats[coreid].rx+=1;
appid = ((unsigned int)meta[i].u.rx_meta->appId)&0xff000000;
switch(appid)
{