]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/netapi.git/commitdiff
Integrate net_test_router with RM. DEV.NETAPI.01.01.00.02
authorTinku Mannan <tmannan@ti.com>
Fri, 25 Jul 2014 14:00:31 +0000 (10:00 -0400)
committerTinku Mannan <tmannan@ti.com>
Fri, 25 Jul 2014 14:00:31 +0000 (10:00 -0400)
ti/runtime/netapi/test/net_test_loopback.c
ti/runtime/netapi/test/net_test_router.c

index 2dac9a251fe0656427ee383f0b73ef65cc781a3a..d85a8f1b9db31dd3f2aa9f37f89f8f7527eb6a6b 100755 (executable)
@@ -73,6 +73,7 @@ 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;
@@ -1067,13 +1068,16 @@ void fast_path_thread(uint32_t index)
     }
     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);
 
@@ -1146,6 +1150,7 @@ int main(int argc, char **argv)
         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));
index 2d753a59dac95f235d920c0eda61373bd7859498..44c6cf0c0b577bead71882f3894f4f595803fce2 100755 (executable)
@@ -71,6 +71,9 @@ extern int QUIT;
 #endif
 /* Global definitions */
 
+extern Rm_ServiceHandle   *rmClientServiceHandle;
+
+hplib_spinLock_T net_test_thread_lock;
 netTestConfig_t netTestCfg;
 static  netTestConfigFile_t config_file;
 
@@ -406,13 +409,16 @@ void fast_path_thread(uint32_t index)
     }
     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);
     NETAPI_HANDLE_T * n = (NETAPI_HANDLE_T *) worker_nh[thread_num];
 
    /* open netcp RX channel */
@@ -470,6 +476,13 @@ int main(int argc, char **argv)
     }
     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);