]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/netapi.git/commitdiff
Multi-proc changes for integration with latest NWAL
authorTinku Mannan <tmannan@ti.com>
Thu, 14 Aug 2014 13:45:20 +0000 (09:45 -0400)
committerTinku Mannan <tmannan@ti.com>
Thu, 14 Aug 2014 13:45:20 +0000 (09:45 -0400)
ti/runtime/netapi/src/netapi_init.c
ti/runtime/netapi/test/net_test_loopback.c
ti/runtime/netapi/utils/netapi_util_rm.c

index a21daf773d66b9f89583099fa77e32734261ad0f..a8c0d147cae624f1aa009f00fcb89597a44d8741 100755 (executable)
@@ -290,6 +290,7 @@ int netapip_initNwal(
     nwalSizeInfo_t  nwalSizeInfo;
     nwal_RetValue   nwalRetVal;
     nwalGlobCfg_t   nwalGlobCfg;
     nwalSizeInfo_t  nwalSizeInfo;
     nwal_RetValue   nwalRetVal;
     nwalGlobCfg_t   nwalGlobCfg;
+    nwalBaseAddrCfg_t nwalBaseAddrCfg;
     uint8_t         count;
     int             sizes[nwal_N_BUFS];
     int             aligns[nwal_N_BUFS];
     uint8_t         count;
     int             sizes[nwal_N_BUFS];
     int             aligns[nwal_N_BUFS];
@@ -303,14 +304,14 @@ int netapip_initNwal(
     uint32_t localCtxSize = 0;
     memset(p_nwal_context,0,sizeof( NETAPI_NWAL_GLOBAL_CONTEXT_T) );
     memset(&nwalGlobCfg,0,sizeof(nwalGlobCfg_t ) );
     uint32_t localCtxSize = 0;
     memset(p_nwal_context,0,sizeof( NETAPI_NWAL_GLOBAL_CONTEXT_T) );
     memset(&nwalGlobCfg,0,sizeof(nwalGlobCfg_t ) );
-
+    memset (&nwalBaseAddrCfg, 0, sizeof(nwalBaseAddrCfg_t));
     pBase = hplib_shmOpen();
     if (pBase)
     {
         if(hplib_shmAddEntry(pBase, sizeof(NETAPI_PA_SHM_T), PA_ENTRY) == hplib_OK)
         {
             paEntry = (NETAPI_PA_SHM_T*)hplib_shmGetEntry(pBase,PA_ENTRY);
     pBase = hplib_shmOpen();
     if (pBase)
     {
         if(hplib_shmAddEntry(pBase, sizeof(NETAPI_PA_SHM_T), PA_ENTRY) == hplib_OK)
         {
             paEntry = (NETAPI_PA_SHM_T*)hplib_shmGetEntry(pBase,PA_ENTRY);
-            nwalGlobCfg.instPoolBaseAddr = (void *)paEntry;
+            nwalBaseAddrCfg.pInstPoolPaBaseAddr= (void *)paEntry;
         }
         else
         {
         }
         else
         {
@@ -320,7 +321,7 @@ int netapip_initNwal(
         if(hplib_shmAddEntry(pBase, sizeof(NETAPI_SA_SHM_T), SA_ENTRY) == hplib_OK)
         {
             saEntry = (NETAPI_SA_SHM_T*)hplib_shmGetEntry(pBase,SA_ENTRY);
         if(hplib_shmAddEntry(pBase, sizeof(NETAPI_SA_SHM_T), SA_ENTRY) == hplib_OK)
         {
             saEntry = (NETAPI_SA_SHM_T*)hplib_shmGetEntry(pBase,SA_ENTRY);
-            nwalGlobCfg.instPoolSaBaseAddr = (void*) saEntry;
+            nwalBaseAddrCfg.pInstPoolSaBaseAddr= (void*) saEntry;
         }
         else
         {
         }
         else
         {
@@ -400,10 +401,10 @@ int netapip_initNwal(
     /* Update nwal cfg with virtual PA and SA addresses */
 
 
     /* Update nwal cfg with virtual PA and SA addresses */
 
 
-    nwalGlobCfg.paVirtBaseAddr = (uint32_t) netapi_VM_VirtAddr->passCfgVaddr;
+    nwalBaseAddrCfg.paVirtBaseAddr = (uint32_t) netapi_VM_VirtAddr->passCfgVaddr;
 
 
 
 
-    nwalGlobCfg.saVirtBaseAddr = (uint32_t) netapi_VM_VirtAddr->passCfgVaddr +
+    nwalBaseAddrCfg.pSaVirtBaseAddr = (uint32_t) netapi_VM_VirtAddr->passCfgVaddr +
                                   CSL_NETCP_CFG_SA_CFG_REGS -
                                   CSL_NETCP_CFG_REGS;
         ;
                                   CSL_NETCP_CFG_SA_CFG_REGS -
                                   CSL_NETCP_CFG_REGS;
         ;
@@ -515,7 +516,7 @@ int netapip_initNwal(
 
     bases[nwal_BUF_INDEX_SA_CONTEXT] = (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)netapi_VM_SaContextVaddr);
     /* also save this here for easy access to sa_start */
 
     bases[nwal_BUF_INDEX_SA_CONTEXT] = (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)netapi_VM_SaContextVaddr);
     /* also save this here for easy access to sa_start */
-    nwalGlobCfg.scPoolBaseAddr = bases[nwal_BUF_INDEX_SA_CONTEXT];
+    nwalBaseAddrCfg.pScPoolBaseAddr= bases[nwal_BUF_INDEX_SA_CONTEXT];
     count++;
 
     bases[nwal_BUF_INDEX_SA_LLD_CHAN_HANDLE] =
     count++;
 
     bases[nwal_BUF_INDEX_SA_LLD_CHAN_HANDLE] =
@@ -546,21 +547,16 @@ int netapip_initNwal(
     pNwalLocCtxMem = malloc(localCtxSize);
     nwal_createProc(bases[nwal_BUF_INDEX_INST],
                           pNwalLocCtxMem,
     pNwalLocCtxMem = malloc(localCtxSize);
     nwal_createProc(bases[nwal_BUF_INDEX_INST],
                           pNwalLocCtxMem,
-                          (void*)nwalGlobCfg.saVirtBaseAddr,
-                          nwalGlobCfg.instPoolSaBaseAddr,
-                          nwalGlobCfg.scPoolBaseAddr,
-                          (void*)nwalGlobCfg.paVirtBaseAddr,
-                          nwalGlobCfg.instPoolBaseAddr);
-    
+                          &nwalBaseAddrCfg);
 
     if (pNwalLocCtxMem)
         printf("netapip_initNwal: passing 0x%x to nwal as local ctx intance:n",
                 pNwalLocCtxMem);
 
     if (pNwalLocCtxMem)
         printf("netapip_initNwal: passing 0x%x to nwal as local ctx intance:n",
                 pNwalLocCtxMem);
+    nwalGlobCfg.pBaseAddrCfg = &nwalBaseAddrCfg;
     nwalRetVal = nwal_create(&nwalGlobCfg,
                              &nwalSizeInfo,
                              sizes,
                              bases,
     nwalRetVal = nwal_create(&nwalGlobCfg,
                              &nwalSizeInfo,
                              sizes,
                              bases,
-                             //&p_nwal_context->nwalInstHandle
                              &gPNwalInstHandle);
     //printf("netapip_initNwal: nwalInstanceHandle: 0x%x\n", gPNwalGlobCtx);
     if(nwalRetVal != nwal_OK)
                              &gPNwalInstHandle);
     //printf("netapip_initNwal: nwalInstanceHandle: 0x%x\n", gPNwalGlobCtx);
     if(nwalRetVal != nwal_OK)
@@ -588,13 +584,14 @@ int netapip_startNwal(Pktlib_HeapHandle pkt_heap,
                       int master)
 {
     nwalLocCfg_t    nwalLocCfg;
                       int master)
 {
     nwalLocCfg_t    nwalLocCfg;
+    nwalBaseAddrCfg_t nwalBaseAddrCfg;
     int count=0;
     static int first_time = 0;
     nwal_RetValue       nwalRetVal;
     void* pBase = NULL;
     NETAPI_NWAL_SHM_T* nwalEntry = NULL;
     void* pNwalLocCtxMem = NULL;
     int count=0;
     static int first_time = 0;
     nwal_RetValue       nwalRetVal;
     void* pBase = NULL;
     NETAPI_NWAL_SHM_T* nwalEntry = NULL;
     void* pNwalLocCtxMem = NULL;
-    memset(&nwalLocCfg,0,sizeof(nwalLocCfg));
+
     NETAPI_SA_SHM_T* saEntry = NULL;
     NETAPI_PA_SHM_T* paEntry = NULL;
 
     NETAPI_SA_SHM_T* saEntry = NULL;
     NETAPI_PA_SHM_T* paEntry = NULL;
 
@@ -604,6 +601,10 @@ int netapip_startNwal(Pktlib_HeapHandle pkt_heap,
     void*               pInstPoolPaBaseAddr;
     void*               paVirtBaseAddr;
     uint32_t          localCtxSize;
     void*               pInstPoolPaBaseAddr;
     void*               paVirtBaseAddr;
     uint32_t          localCtxSize;
+
+    memset(&nwalLocCfg,0,sizeof(nwalLocCfg));
+    memset(&nwalBaseAddrCfg, 0, sizeof(nwalBaseAddrCfg_t));
+
     /* Update the Start of Packet Offset for the default flows created 
      * by NWAL
      */
     /* Update the Start of Packet Offset for the default flows created 
      * by NWAL
      */
@@ -673,14 +674,15 @@ int netapip_startNwal(Pktlib_HeapHandle pkt_heap,
                 netapi_Log ("netapip_startNwal:malloc failure for nwal local context memory\n");
                 return -1;
             }
                 netapi_Log ("netapip_startNwal:malloc failure for nwal local context memory\n");
                 return -1;
             }
+            nwalBaseAddrCfg.pSaVirtBaseAddr = baseAddr;
+            nwalBaseAddrCfg.pInstPoolSaBaseAddr = instPoolSaBaseAddr;
+            nwalBaseAddrCfg.pScPoolBaseAddr = pScPoolBaseAddr;
+            nwalBaseAddrCfg.paVirtBaseAddr = paVirtBaseAddr;
+            nwalBaseAddrCfg.pInstPoolPaBaseAddr = pInstPoolPaBaseAddr;
             /* this is 1 time per process */
             nwal_createProc(nwalEntry,
                             pNwalLocCtxMem,
             /* this is 1 time per process */
             nwal_createProc(nwalEntry,
                             pNwalLocCtxMem,
-                            baseAddr,
-                            instPoolSaBaseAddr,
-                            pScPoolBaseAddr,
-                            paVirtBaseAddr,
-                            pInstPoolPaBaseAddr);
+                            &nwalBaseAddrCfg);
         }
         /* this is for every thread including 1st thread of the process */
         netapi_proc_master->spinLock.lock(&pnetapiShm->netapi_util_lock);
         }
         /* this is for every thread including 1st thread of the process */
         netapi_proc_master->spinLock.lock(&pnetapiShm->netapi_util_lock);
index 395322609ac021aa3c0ad7ce55e748205002300b..ff6ce544da53fe2463e4a2d2c8faddaa4a5306af 100755 (executable)
@@ -1143,14 +1143,12 @@ int main(int argc, char **argv)
      /* install signal handler for ^c */
     signal(SIGINT,netTest_utilMySig);
 
      /* 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':
 
     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;
                 fpr = fopen(optarg, "r");
                 printf("main: filename1 %s\n", optarg);
                 break;
@@ -1179,6 +1177,8 @@ int main(int argc, char **argv)
         }
     }
 
         }
     }
 
+    if (fpr ==NULL)
+        fpr = fopen(input_file_name, "r");
     if (initRm())
     {
         printf("main: initRm() returned error\n");
     if (initRm())
     {
         printf("main: initRm() returned error\n");
index fd92dfc10f65cf990a96904e6f959fd3ca4c1f68..ef2908ac478bdde7d9c83169ab3170e6703d9fb8 100755 (executable)
@@ -95,10 +95,10 @@ Rm_ServiceHandle   *rmClientServiceHandle = NULL;
 sock_h              rmClientSocket;
 
 /* Client instance name (must match with RM Global Resource List (GRL) and policies */
 sock_h              rmClientSocket;
 
 /* Client instance name (must match with RM Global Resource List (GRL) and policies */
-char                rmClientName[RM_NAME_MAX_CHARS] = "RM_Client0";
+char                rmClientName[RM_NAME_MAX_CHARS] = "RM_Client_NETAPI";
 
 /* Client socket name */
 
 /* Client socket name */
-char                rmClientSockName[] = "/tmp/var/run/rm/rm_client0";
+char                rmClientSockName[] = "/tmp/var/run/rm/rm_client_netapi";
 
 /* Transport map stores the RM transport handle to IPC MessageQ queue mapping */
 Transport_MapEntry  rmTransportMap[MAX_MAPPING_ENTRIES];
 
 /* Transport map stores the RM transport handle to IPC MessageQ queue mapping */
 Transport_MapEntry  rmTransportMap[MAX_MAPPING_ENTRIES];