Multi-proc support in NETAPI
authorTinku Mannan <tmannan@ti.com>
Tue, 17 Jun 2014 18:54:37 +0000 (14:54 -0400)
committerTinku Mannan <tmannan@ti.com>
Tue, 17 Jun 2014 18:54:37 +0000 (14:54 -0400)
ti/runtime/netapi/netapi_util.h
ti/runtime/netapi/src/netapi.c
ti/runtime/netapi/src/netapi_init.c
ti/runtime/netapi/src/netapi_loc.h
ti/runtime/netapi/src/netapi_sec.c
ti/runtime/netapi/src/pktio.c
ti/runtime/netapi/utils/netapi_util_rm.c

index 7e914727d53a4119832ff60f41cab3121ac12dce..a5d7b04de798cd86909505f9778983fd4a75cbc0 100755 (executable)
@@ -49,6 +49,7 @@ extern "C" {
 #endif
 
 #include <stdint.h>
+#include "netapi.h"
 #include "./src/netapi_loc.h"
 
 
@@ -146,12 +147,14 @@ static inline int netapi_unregisterHeap(NETAPI_T p,
 static inline int netapi_closeHeap(NETAPI_T p,
                                    Pktlib_HeapHandle h)
 {
+    NETAPI_HANDLE_T *pp = (NETAPI_HANDLE_T *) p;
     Qmss_QueueHnd q;
     Pktlib_garbageCollection(h);
     q = Pktlib_getZeroHeapQueue(h);
     netapip_zapQ(q);
     q= Pktlib_getInternalHeapQueue(h);
-    netapip_zapQ(q);
+    if (pp->master == 2)
+        netapip_zapQ(q);
     return 1;
 }
 /**
index 317b7f0d41cc8ac9d41bd7a80ace45b028e6c828..7c005e29cf75e17a3c19e8b83c8bb326675896a8 100755 (executable)
@@ -48,6 +48,7 @@
 
 void* pBase;
 NETAPI_SHM_T* pnetapiShm;
+void *pRmClientHandle = NULL;
 
 static NETAPI_CFG_T netapi_default_cfg=
 {
@@ -164,6 +165,8 @@ NETAPI_T netapi_init(int                master,
         {
             netapi_Log("netapi_init: hplib_shmOpen error\n");
         }
+        else
+            Osal_start(pBase);
     }
 
     /*ALL:  create space for our local pktios */
@@ -174,6 +177,11 @@ NETAPI_T netapi_init(int                master,
         {
             return NULL;
         }
+        else
+        {
+            PKTIO_ENTRY_T *pe = (PKTIO_ENTRY_T*)p->pktios[i];
+            pe->qn.qNum = -1;
+        }
     }
 
 #ifdef NETAPI_INCLUDE_SCHED
@@ -235,6 +243,8 @@ NETAPI_T netapi_init(int                master,
     if ((master == NETAPI_SYS_MASTER)||(master == NETAPI_PROC_MASTER))
     {
         p_master=netapi_proc_master = p;
+        if (p_cfg->rmHandle)
+            pRmClientHandle = p_cfg->rmHandle;
     }
     else
     {
@@ -277,7 +287,7 @@ NETAPI_T netapi_init(int                master,
     else if (master == NETAPI_CORE_MASTER)
     {
         /* Start the QMSS. */
-        if (netapip_startQm(pnetapiShm->netapi_global.cfg.rmHandle) != 1)
+        if (netapip_startQm(pRmClientHandle) != 1)
         {
             goto ERR_netapi_init;
         }
@@ -286,7 +296,8 @@ NETAPI_T netapi_init(int                master,
                           p_master->netcp_control_tx_heap, 
                           &p->nwal_local,
                           &pnetapiShm->netapi_global.cfg,
-                          &pnetapiShm->netapi_global.nwal_context);
+                          &pnetapiShm->netapi_global.nwal_context,
+                          master);
     }
     else
     {
@@ -353,12 +364,18 @@ void netapi_shutdown(NETAPI_T h)
         //loop over registered heaps
         for(i=0;i<TUNE_NETAPI_MAX_HEAPS;i++)
         {
-            if (p->createdHeaps[i])  {netapi_closeHeap(h,p->createdHeaps[i]);p->createdHeaps[i]=NULL;}
+            if (p->createdHeaps[i])
+            {
+                printf("netapi_shutdown: heapPtr[%d]: 0x%x\n", i, p->createdHeaps);
+                netapi_closeHeap(h,p->createdHeaps[i]);
+                p->createdHeaps[i]=NULL;
+            }
         }
         netapip_cleanupAtStart();  //clear 1st 50 not-specified queues
         //netapip_cleanupAtStart();  //clear 1st 50 not-specified queues
         //reset DDR malloc area
         hplib_resetMallocArea(0);
+        Qmss_removeMemoryRegion(p->memRegion,0);
         hplib_vmTeardown();
         printf("netapi_shutdown: calling hplib_shmDelete\n");
         hplib_shmDelete();
@@ -371,8 +388,14 @@ void netapi_shutdown(NETAPI_T h)
         //loop over registered heaps (again local to our process)
         for(i=0;i<TUNE_NETAPI_MAX_HEAPS;i++)
         {
-            if (p->createdHeaps[i])  {netapi_closeHeap(h,p->createdHeaps[i]);p->createdHeaps[i]=NULL;}
+            if (p->createdHeaps[i])
+            {
+                printf("netapi_shutdown: heapPtr[%d]: 0x%x\n", i, p->createdHeaps);
+                netapi_closeHeap(h,p->createdHeaps[i]);
+                p->createdHeaps[i]=NULL;
+            }
         }
+        Qmss_removeMemoryRegion(p->memRegion,0);
         hplib_vmTeardown();
     }
     //TODO other master types
index 12d7cf70c4713233e8db78a72dcab19eae5df650..fee32241c166b6bb5dc680a50cb24ca7ec2c0700 100755 (executable)
 #include <ti/csl/csl_xmcAux.h>
 #include <ti/drv/qmss/qmss_qm.h>
 
+
+/* pointer to NWAL local context memory block used by NWAL for local 
+   context intance*/
+void* pNwalLocCtxMem = NULL;
+extern void *pRmClientHandle;
+
+nwal_Handle gPNwalInstHandle = NULL;
+
+
 extern NETAPI_SHM_T* pnetapiShm;
 /* Global variablesto hold virtual address of various subsystems */
 extern hplib_virtualAddrInfo_T netapi_VM_VirtAddr[];
@@ -84,6 +93,7 @@ extern unsigned char *netapi_VM_SaContextVaddr;
 
 extern Pktlib_HeapIfTable  netapi_pktlib_ifTable;
 extern NETAPI_PROC_GLOBAL_T netapi_proc_global;
+extern NETAPI_HANDLE_T * netapi_proc_master;
 
 
 /* TODO verify: */
@@ -117,6 +127,7 @@ uint8_t *cppiMemTxCtlLinkBuf = NULL;
 
 
 NETCP_CFG_GLOB_DEVICE_PARAMS_T   *p_netapi_device_cfg_local;
+Qmss_MemRegInfo   memInfo;
 
 
 /********************************************************************
@@ -129,9 +140,9 @@ int netapip_qmSetupMemRegion(
                       uint32_t          numDesc,
                       uint32_t          descSize,
                       uint32_t*         pDescMemBase,
-                      Qmss_MemRegion    memRegion)
+                      int               memRegion)
 {
-    Qmss_MemRegInfo   memInfo;
+    //Qmss_MemRegInfo   memInfo;
     Int32             result;
     Int               n;
     static int  netapi_qm_region_index=0;
@@ -141,8 +152,9 @@ int netapip_qmSetupMemRegion(
     memInfo.descSize       = descSize;
     memInfo.descNum        = numDesc;
     memInfo.manageDescFlag = Qmss_ManageDesc_MANAGE_DESCRIPTOR;
-    memInfo.memRegion      = memRegion;
-
+    //memInfo.memRegion      = memRegion;
+    memInfo.memRegion = -1;
+#if 0
     if(memRegion == TUNE_NETAPI_QM_GLOBAL_REGION)
     {
         memInfo.startIndex = TUNE_NETAPI_QM_START_INDEX;  //was 0
@@ -156,16 +168,18 @@ int netapip_qmSetupMemRegion(
     {
         return -1 ;
     }
-
+#endif
     memset (pDescMemBase, 0, (descSize * numDesc));
 
     result = Qmss_insertMemoryRegion (&memInfo);
+    
     if (result < QMSS_SOK)  
     {
         netapi_Log ("netapip_qmSetupMemRegion: Qmss_insertMemoryRegion returned error code %d\n", result);
         return (-1);
     }
-
+    printf("netapip_qmSetupMemRegion: region: %d\n", memInfo.memRegion);
+    netapi_proc_master->memRegion = memInfo.memRegion;
     return 1;
 }
 
@@ -195,22 +209,25 @@ int netapip_startQm(void* rmClientServiceHandle)
 
 /*** NWAL Memory Buffer Configuration ***/
 #define NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_HANDLE     3400
-uint8_t nwalInstMem[NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_HANDLE]ALIGN(CACHE_LINESZ);
+//uint8_t nwalInstMem[NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_HANDLE]ALIGN(CACHE_LINESZ);
+
 
 #define NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_MAC                    256
 #define NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_IPSEC_HANDLE_PER_CHAN      256
 #define NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_IP                     128
 #define NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_PORT                   128
 #define NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_L2L3_HDR               128
-#define NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_LOC_CONTEXT            384
 #define NWAL_CHAN_HANDLE_SIZE    ((NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_MAC * TUNE_NETAPI_MAX_NUM_MAC) + \
                                   (NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_IPSEC_HANDLE_PER_CHAN * TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2) + \
                                   (NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_IP * TUNE_NETAPI_MAX_NUM_IP) + \
                                   (NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_PORT * TUNE_NETAPI_MAX_NUM_PORTS)+ \
-                                  (NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_LOC_CONTEXT * TUNE_NETAPI_NUM_CORES) + \
                                   (NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_L2L3_HDR * TUNE_NETAPI_MAX_NUM_L2_L3_HDRS))
 
-uint8_t nwalHandleMem[NWAL_CHAN_HANDLE_SIZE]ALIGN(CACHE_LINESZ);
+typedef struct NETAPI_NWAL_SHM_Tag
+{
+    uint8_t nwalInstMem[NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_HANDLE]ALIGN(CACHE_LINESZ);
+    uint8_t nwalHandleMem[NWAL_CHAN_HANDLE_SIZE]ALIGN(CACHE_LINESZ);
+} NETAPI_NWAL_SHM_T;
 
 
 typedef struct NETAPI_PA_SHM_Tag
@@ -243,6 +260,13 @@ uint8_t salldHandle[NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE]ALIGN(CACHE_LINESZ)
 uint8_t salldChanHandle[NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE_PER_CHAN * TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2]ALIGN(CACHE_LINESZ);
 } NETAPI_SA_SHM_T;
 
+
+
+
+
+
+
+
 /********************************************************************
 * FUNCTION PURPOSE:  NETAPI internal function to gracefully cleanup when startup
 *                                  issue occurs.
@@ -275,7 +299,8 @@ int netapip_initNwal(
     void* pBase = NULL;
     NETAPI_PA_SHM_T* paEntry = NULL;
     NETAPI_SA_SHM_T* saEntry = NULL;
-
+    NETAPI_NWAL_SHM_T* nwalEntry = NULL;
+    uint32_t localCtxSize = 0;
     memset(p_nwal_context,0,sizeof( NETAPI_NWAL_GLOBAL_CONTEXT_T) );
     memset(&nwalGlobCfg,0,sizeof(nwalGlobCfg_t ) );
 
@@ -302,6 +327,17 @@ int netapip_initNwal(
             netapi_Log("netapip_initNwal: Unable to Add shared memory segment for SASS\n");
             return -1;
         }
+        if(hplib_shmAddEntry(pBase, sizeof(NETAPI_NWAL_SHM_T), NWAL_ENTRY) == hplib_OK)
+        {
+            printf("netapip_initNwal: calling shmGetEntry for nwal\n");
+            nwalEntry = (NETAPI_NWAL_SHM_T*)hplib_shmGetEntry(pBase,NWAL_ENTRY);
+            printf("netapip_initNwal: base address of nwal entry: 0x%x\n", (uint32_t) nwalEntry);
+        }
+        else
+        {
+            netapi_Log("netapip_initNwal: Unable to Add shared memory segment for SASS\n");
+            return -1;
+        }
         
     }
     /* Initialize Buffer Pool for NetCP PA to SA packets */
@@ -344,8 +380,8 @@ int netapip_initNwal(
     heapCfg.name                = "nwal SA2PA";
     heapCfg.numPkts             = TUNE_NETAPI_CONFIG_MAX_SA_TO_PA_DESC;
 
-    nwalGlobCfg.sa2PaBufPool.bufPool[0].heapHandle = p_nwal_context->sa2pa_heap=
-        Pktlib_createHeap(&heapCfg, &errCode);
+    nwalGlobCfg.sa2PaBufPool.bufPool[0].heapHandle = 
+        p_nwal_context->sa2pa_heap = Pktlib_createHeap(&heapCfg, &errCode);
     if(nwalGlobCfg.sa2PaBufPool.bufPool[0].heapHandle == NULL)
     {
         netapi_Log ("netapip_initNwal: Pktlib_createHeap:Heap Creation Failed for SA to PA Buffer Pool, Error Code: %d\n",
@@ -365,11 +401,12 @@ int netapip_initNwal(
 
 
     nwalGlobCfg.paVirtBaseAddr = (uint32_t) netapi_VM_VirtAddr->passCfgVaddr;
+
+
     nwalGlobCfg.saVirtBaseAddr = (uint32_t) netapi_VM_VirtAddr->passCfgVaddr +
                                   CSL_NETCP_CFG_SA_CFG_REGS -
                                   CSL_NETCP_CFG_REGS;
         ;
-
     nwalGlobCfg.rxDefPktQ = QMSS_PARAM_NOT_SPECIFIED;
 
 
@@ -393,7 +430,10 @@ int netapip_initNwal(
 
 /* Check for memory size requirement and update the base */
     count = 0;
-    bases[nwal_BUF_INDEX_INST] = (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)nwalInstMem);
+    //bases[nwal_BUF_INDEX_INST] = (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)nwalInstMem);
+    bases[nwal_BUF_INDEX_INST] = 
+                (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)nwalEntry->nwalInstMem);
+
     if(NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_HANDLE < sizes[nwal_BUF_INDEX_INST])
     {
         printf(" 1memSize issue %d %d\n", 
@@ -404,7 +444,11 @@ int netapip_initNwal(
     }
     count++;
 
-    bases[nwal_BUF_INDEX_INT_HANDLES] = (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)nwalHandleMem);
+    //bases[nwal_BUF_INDEX_INT_HANDLES] = (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)nwalHandleMem);
+    bases[nwal_BUF_INDEX_INT_HANDLES] = 
+                    (uint32_t *) Osal_nwalLocToGlobAddr((uint32_t)nwalEntry->nwalHandleMem);
+
+    
     if(NWAL_CHAN_HANDLE_SIZE  < sizes[nwal_BUF_INDEX_INT_HANDLES])
     {
         /* Resize Memory */
@@ -502,11 +546,29 @@ int netapip_initNwal(
     }
 
     /* Initialize NWAL module */
+    nwal_getLocContextBufferReq(nwalSizeInfo.nProc, &localCtxSize);
+    printf("testNwGlobInit: localCtxSize: 0x%x\n", localCtxSize);
+
+    pNwalLocCtxMem = malloc(localCtxSize);
+    nwal_createProc(bases[nwal_BUF_INDEX_INST],
+                          pNwalLocCtxMem,
+                          (void*)nwalGlobCfg.saVirtBaseAddr,
+                          nwalGlobCfg.instPoolSaBaseAddr,
+                          nwalGlobCfg.scPoolBaseAddr,
+                          (void*)nwalGlobCfg.paVirtBaseAddr,
+                          nwalGlobCfg.instPoolBaseAddr);
+    
+
+    if (pNwalLocCtxMem)
+        printf("netapip_initNwal: passing 0x%x to nwal as local ctx intance:n",
+                pNwalLocCtxMem);
     nwalRetVal = nwal_create(&nwalGlobCfg,
                              &nwalSizeInfo,
                              sizes,
                              bases,
-                             &p_nwal_context->nwalInstHandle);
+                             //&p_nwal_context->nwalInstHandle
+                             &gPNwalInstHandle);
+    //printf("netapip_initNwal: nwalInstanceHandle: 0x%x\n", gPNwalGlobCtx);
     if(nwalRetVal != nwal_OK)
     {
         netapi_Log ("netapip_initNwal: nwal_create Failed %d\n",nwalRetVal);
@@ -528,15 +590,26 @@ int netapip_startNwal(Pktlib_HeapHandle pkt_heap,
                       Pktlib_HeapHandle cmd_tx_heap,
                       NETAPI_NWAL_LOCAL_CONTEXT_T *p,
                       NETAPI_CFG_T *p_cfg,
-                      NETAPI_NWAL_GLOBAL_CONTEXT_T * p_nwal_glob_context  )
+                      NETAPI_NWAL_GLOBAL_CONTEXT_T * p_nwal_glob_context,
+                      int master)
 {
     nwalLocCfg_t    nwalLocCfg;
     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;
 
+    uint32_t            baseAddr;
+    void*               instPoolSaBaseAddr;
+    void*               pScPoolBaseAddr;
+    void*               pInstPoolPaBaseAddr;
+    void*               paVirtBaseAddr;
+    uint32_t          localCtxSize;
     /* Update the Start of Packet Offset for the default flows created 
      * by NWAL
      */
@@ -562,7 +635,7 @@ int netapip_startNwal(Pktlib_HeapHandle pkt_heap,
     nwalLocCfg.txCtlPool.bufPool[0].bufSize = TUNE_NETAPI_CONFIG_MAX_CTL_RXTX_BUF_SIZE;
     nwalLocCfg.txCtlPool.bufPool[0].heapHandle =  cmd_tx_heap;
 
-/* Initialize Buffer Pool for Packets from NetCP to Host */
+/* Initialize Buffer Pool for L4 Packets from NetCP to Host */
     nwalLocCfg.rxPktPool.numBufPools = 1;
     nwalLocCfg.rxPktPool.bufPool[0].descSize = TUNE_NETAPI_DESC_SIZE;
     nwalLocCfg.rxPktPool.bufPool[0].bufSize =  p_cfg->def_heap_buf_size;
@@ -574,10 +647,51 @@ int netapip_startNwal(Pktlib_HeapHandle pkt_heap,
     nwalLocCfg.txPktPool.bufPool[0].bufSize =  p_cfg->def_heap_buf_size;
     nwalLocCfg.txPktPool.bufPool[0].heapHandle = pkt_heap;
 
+
+
+
     memcpy(&p->nwalLocCfg,&nwalLocCfg,sizeof(nwalLocCfg_t));
     while(1)
     {
-        nwalRetVal = nwal_start(p_nwal_glob_context->nwalInstHandle,&nwalLocCfg);
+        if(master == NETAPI_PROC_MASTER)
+        {
+            pBase = hplib_shmOpen();
+            nwalEntry = (NETAPI_NWAL_SHM_T*)hplib_shmGetEntry(pBase,NWAL_ENTRY);
+
+                baseAddr = (void*) netapi_VM_VirtAddr->passCfgVaddr +
+                                              CSL_NETCP_CFG_SA_CFG_REGS -
+                                              CSL_NETCP_CFG_REGS;
+                 saEntry = (NETAPI_SA_SHM_T*)hplib_shmGetEntry(pBase,SA_ENTRY);
+                 instPoolSaBaseAddr = (void*) saEntry;
+            
+                 pScPoolBaseAddr = Osal_nwalLocToGlobAddr((uint32_t)netapi_VM_SaContextVaddr);
+
+
+                 paVirtBaseAddr = (void*) netapi_VM_VirtAddr->passCfgVaddr;
+                 paEntry = (NETAPI_PA_SHM_T*)hplib_shmGetEntry(pBase,PA_ENTRY);
+                 pInstPoolPaBaseAddr = (void *)paEntry;
+
+            nwal_getLocContextBufferReq(TUNE_NETAPI_NUM_CORES, &localCtxSize);
+            printf("testNwGlobInit: localCtxSize: 0x%x\n", localCtxSize);
+            pNwalLocCtxMem = malloc(localCtxSize);
+            if (pNwalLocCtxMem == NULL)
+            {
+                netapi_Log ("netapip_startNwal:malloc failure for nwal local context memory\n");
+                return -1;
+            }
+            /* this is 1 time per process */
+            nwal_createProc(nwalEntry,
+                            pNwalLocCtxMem,
+                            baseAddr,
+                            instPoolSaBaseAddr,
+                            pScPoolBaseAddr,
+                            paVirtBaseAddr,
+                            pInstPoolPaBaseAddr);
+        }
+        /* this is for every thread including 1st thread of the process */
+        netapi_proc_master->spinLock.lock(&pnetapiShm->netapi_util_lock);
+        nwalRetVal = nwal_start(gPNwalInstHandle,&nwalLocCfg);
+        netapi_proc_master->spinLock.unlock(&pnetapiShm->netapi_util_lock);
         if(nwalRetVal == nwal_ERR_INVALID_STATE)
         {
             continue;
@@ -590,6 +704,8 @@ int netapip_startNwal(Pktlib_HeapHandle pkt_heap,
         netapi_Log (">nwal_start:Failed ->err %d !!!\n", nwalRetVal);
         return -1;
     }
+    else
+        printf("netapip_startnwal: complete !!!!!!!!!!!!!!!!!!!\n");
     p->state = NETAPI_NW_CXT_LOC_ACTIVE;
     return 1;
 
@@ -675,7 +791,7 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
 
     int32_t             result;
     Pktlib_HeapHandle   sharedHeapHandle;
-    Pktlib_HeapHandle   controlRxHeapHandle,controlTxHeapHandle;    
+    Pktlib_HeapHandle   controlRxHeapHandle,controlTxHeapHandle;
     Pktlib_HeapCfg      heapCfg;
     int32_t             errCode;
     int count=0;
@@ -715,12 +831,149 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
         return -1;
     }
 
-
-
     if (global_master_process == NETAPI_TRUE)
     {
         hplib_initMallocArea(0);
         hplib_initMallocArea(1);
+#ifdef NETAPI_ENABLE_SECURITY
+#define SEC_CONTEXT_SZ 384  //not tunable
+        /* allocate 2x number of tunnels since we need one for inflow and one for data mode */
+        netapi_VM_SaContextVaddr = hplib_vmMemAlloc((TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2 *
+                                        SEC_CONTEXT_SZ), 128, 0);
+        if (!netapi_VM_SaContextVaddr)
+        {
+            netapi_Log("netapip_systemInit: Failed to map SA context memory region\n");
+            return (-1);
+        }
+        netapi_Log("netapip_systemInit: SA Memory mapped/allocated at address %p.\n", netapi_VM_SaContextVaddr);
+#else
+            netapi_VM_SaContextVaddr= (char *) NULL;
+#endif
+
+        /* (3) Allocate 2 QM regions from continguous chunk above */
+        netapi_VM_QMemGlobalDescRam = 
+                (void *)hplib_vmMemAlloc((TUNE_NETAPI_NUM_GLOBAL_DESC *
+                TUNE_NETAPI_DESC_SIZE),
+                128,
+                0);
+
+        netapi_VM_QMemLocalDescRam =
+                (void *)hplib_vmMemAlloc((TUNE_NETAPI_NUM_LOCAL_DESC *
+                TUNE_NETAPI_DESC_SIZE),
+                128,
+                0);
+        netapi_Log("netapip_systemInit(sysMaster): desc region=%x global desc region=%x\n",
+            netapi_VM_QMemLocalDescRam, netapi_VM_QMemGlobalDescRam);
+        /* Initialize Queue Manager Sub System */
+        result = netapip_initQm (pnetapiShm->netapi_global.cfg.def_max_descriptors,
+                                 pRmClientHandle);
+        
+        if (result != 1)
+        {
+             netapi_Log("netapip_systemInit: returned from netapip_initQm with failure\n");
+            return -1;
+        }
+        /* Start the QMSS. */
+        if (netapip_startQm(pRmClientHandle) != 1)
+        {
+            netapi_Log("netapip_systemInit: returned from netapip_startQm with failure\n");
+            return -1;
+        }
+
+        //clean our old junk in 1st bunch of queues that will be allocated to us
+        netapip_cleanupAtStart();
+         /* Initialize the global descriptor memory region. */
+        result= netapip_qmSetupMemRegion( 
+                           pnetapiShm->netapi_global.cfg.def_tot_descriptors_for_us,
+                           TUNE_NETAPI_DESC_SIZE,
+                           (unsigned int *) netapi_VM_QMemGlobalDescRam,
+                           TUNE_NETAPI_QM_GLOBAL_REGION);
+        if(result <0)
+        {
+            netapi_Log("netapip_systemInit: can't setup QM shared region\n");
+            return -1;
+        }
+        /* Initialize CPPI CPDMA */
+        result = netapip_initCppi(pRmClientHandle);
+        if (result != 1)
+        {
+            netapi_Log ("netapi: Error initializing CPPI SubSystem error code : %d\n",result);
+            return -1;
+        }
+        /* CPPI and Queue Manager are initialized. */
+        netapi_Log ("netapi: Queue Manager and CPPI are initialized.\n");
+
+        /* create main pkt heap */
+        /* Initialize the Shared Heaps. */
+        Pktlib_sharedHeapInit();
+        /* Populate the heap interface table. */
+        netapi_pktlib_ifTable.data_malloc             = netapip_sharedMemoryMalloc;
+        netapi_pktlib_ifTable.data_free               = netapip_sharedMemoryFree;
+        /* Initialize the heap configuration. */
+        memset ((void *)&heapCfg, 0, sizeof(Pktlib_HeapCfg));
+        /* Populate the heap configuration */
+        heapCfg.name                = "netapi";
+//        heapCfg.memRegion           = TUNE_NETAPI_QM_GLOBAL_REGION;
+        heapCfg.memRegion = memInfo.memRegion;
+        printf("netapip_systemInit: memRegion: %d\n",memInfo.memRegion);
+        heapCfg.sharedHeap          = 1;
+        heapCfg.useStarvationQueue  = 0;
+        heapCfg.dataBufferSize      = pnetapiShm->netapi_global.cfg.def_heap_buf_size;
+        heapCfg.numPkts             = pnetapiShm->netapi_global.cfg.def_heap_n_descriptors;
+        heapCfg.numZeroBufferPackets= pnetapiShm->netapi_global.cfg.def_heap_n_zdescriptors;
+        heapCfg.heapInterfaceTable.data_malloc  = netapi_pktlib_ifTable.data_malloc;
+        heapCfg.heapInterfaceTable.data_free    = netapi_pktlib_ifTable.data_free;
+        heapCfg.dataBufferPktThreshold   = 0;
+        heapCfg.zeroBufferPktThreshold   = 0;
+
+        /* Create Shared Heap with specified configuration. */
+        sharedHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
+        if (!sharedHeapHandle) { netapi_Log(">'netapi' heap create failed, Error Code: %d\n",errCode); return -1;}
+        handle->netcp_heap= sharedHeapHandle;
+        printf("netapi_systemInit: netapi heap handle: 0x%x\n", 
+            handle->netcp_heap);
+        /* Update for Control */
+        heapCfg.name                = "netapi_control_rx";
+        heapCfg.sharedHeap          = 1;
+        heapCfg.dataBufferSize      = TUNE_NETAPI_CONFIG_MAX_CTL_RXTX_BUF_SIZE;
+        heapCfg.numPkts             = TUNE_NETAPI_CONFIG_NUM_CTL_RX_BUF;
+        heapCfg.numZeroBufferPackets= 0;
+    
+        controlRxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
+        //todo -> cleanup on failure
+        if (!controlRxHeapHandle) { netapi_Log("netapi -'netapi_control_rx' heap create failed, Error Code: %d\n",errCode); return -1;}
+        handle->netcp_control_rx_heap= controlRxHeapHandle;
+    
+    
+        heapCfg.name                = "netapi_control_tx";
+        heapCfg.numPkts             = TUNE_NETAPI_CONFIG_NUM_CTL_TX_BUF;
+    
+        controlTxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
+    //todo -> cleanup on failure
+    if (!controlTxHeapHandle) { netapi_Log("netapi -'netapi_control_tx' heap create failed, Error Code: %d\n",errCode); return -1;}
+    handle->netcp_control_tx_heap= controlTxHeapHandle;
+             /* now NWAL */
+        result = netapip_initNwal(memInfo.memRegion,
+                              &netapi_pktlib_ifTable,
+                              &pnetapiShm->netapi_global.nwal_context,
+                              &pnetapiShm->netapi_global.cfg);
+        if (result<0) {netapi_Log("netapi  init_nwal() failed\n"); return -1; }
+            netapi_Log("netapip_systemInit: returned from netapip_initNwal\n");
+        /* Common Initialization for all cores */
+        while(count < TUNE_NETAPI_MAX_NUM_TRANS)
+        {
+            netapi_proc_global.nwal_context.transInfos[count].transId = count;
+            count++;
+        }
+        result = netapip_startNwal(sharedHeapHandle, 
+                                   controlRxHeapHandle,
+                                   controlTxHeapHandle,
+                                   &handle->nwal_local,
+                                   &pnetapiShm->netapi_global.cfg,
+                                   &pnetapiShm->netapi_global.nwal_context,
+                                   handle->master);
+        if (result<0) {netapi_Log("netapi start_nwal() failed\n"); return -1; }
+        netapi_Log("netapip_systemInit: returned from netapip_startNwal\n");
     }
     else
     {
@@ -728,30 +981,112 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
             return -1;
         if (hplib_checkMallocArea(1) != hplib_OK)
             return -1;
-    }
+#if 1
+#ifdef NETAPI_ENABLE_SECURITY
+                /* allocate 2x number of tunnels since we need one for inflow and one for data mode */
+                netapi_VM_SaContextVaddr = hplib_vmMemAlloc((TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2 *
+                                                SEC_CONTEXT_SZ), 128, 0);
+                if (!netapi_VM_SaContextVaddr)
+                {
+                    netapi_Log("netapip_systemInit: Failed to map SA context memory region\n");
+                    return (-1);
+                }
+                netapi_Log("netapip_systemInit: SA Memory mapped/allocated at address %p.\n", netapi_VM_SaContextVaddr);
+#else
+                    netapi_VM_SaContextVaddr= (char *) NULL;
+#endif
 
 
-    if(global_master_process == NETAPI_FALSE)
-    {
+
+        /* (3) Allocate 2 QM regions from continguous chunk above */
+        netapi_VM_QMemGlobalDescRam = 
+                (void *)hplib_vmMemAlloc((TUNE_NETAPI_NUM_GLOBAL_DESC *
+                TUNE_NETAPI_DESC_SIZE),
+                128,
+                0);
+
+        netapi_VM_QMemLocalDescRam =
+                (void *)hplib_vmMemAlloc((TUNE_NETAPI_NUM_LOCAL_DESC *
+                TUNE_NETAPI_DESC_SIZE),
+                128,
+                0);
+        netapi_Log("netapip_systemInit(procMaster): desc region=%x global desc region=%x\n",
+            netapi_VM_QMemLocalDescRam, netapi_VM_QMemGlobalDescRam);
+
+#endif
+
         /****************************************************
          * partial initialization.  For process, not for SOC
          ***************************************************/
-       
-       /* Start the QMSS. */
-       if (netapip_startQm(pnetapiShm->netapi_global.cfg.rmHandle) != 1)
-       {
-          netapi_Log("netapip_systemInit: returned from netapip_startQm with failure\n");
-          return -1;
-       }
+        result = netapip_initQm (pnetapiShm->netapi_global.cfg.def_max_descriptors,
+                                 pRmClientHandle);
 
-        //open shared heap handle but create new controlRx & Tx heaps for this
-        //process
-        netapi_pktlib_ifTable.data_malloc  = netapip_sharedMemoryMalloc;
-        netapi_pktlib_ifTable.data_free    = netapip_sharedMemoryFree;
-        sharedHeapHandle = Pktlib_findHeapByName("netapi");
+        if (result != 1)
+        {
+             netapi_Log("netapip_systemInit: returned from netapip_initQm with failure\n");
+            return -1;
+        }
+
+        /* Start the QMSS. */
+        if (netapip_startQm(pRmClientHandle) != 1)
+        {
+            netapi_Log("netapip_systemInit: returned from netapip_startQm with failure\n");
+            return -1;
+        }
+#if 1
+        result= netapip_qmSetupMemRegion( 
+                           pnetapiShm->netapi_global.cfg.def_tot_descriptors_for_us,
+                           TUNE_NETAPI_DESC_SIZE,
+                           (unsigned int *) netapi_VM_QMemGlobalDescRam,
+                           TUNE_NETAPI_QM_GLOBAL_REGION);
+        if(result <0)
+        {
+            netapi_Log("netapip_systemInit: can't setup QM shared region\n");
+            return -1;
+        }
+#endif
+        /* Initialize CPPI CPDMA */
+        result = netapip_initCppi(pRmClientHandle);
+        if (result != 1)
+        {
+            netapi_Log ("netapi: Error initializing CPPI SubSystem error code : %d\n",result);
+            return -1;
+        }
+        /* CPPI and Queue Manager are initialized. */
+        netapi_Log ("netapi: Queue Manager and CPPI are initialized.\n");
+
+        /* create main pkt heap for this process */
+        /* Initialize the Shared Heaps. */
+        Pktlib_sharedHeapInit();
+        /* Populate the heap interface table. */
+        netapi_pktlib_ifTable.data_malloc             = netapip_sharedMemoryMalloc;
+        netapi_pktlib_ifTable.data_free               = netapip_sharedMemoryFree;
+        /* Initialize the heap configuration. */
+        memset ((void *)&heapCfg, 0, sizeof(Pktlib_HeapCfg));
+        /* Populate the heap configuration */
+        heapCfg.name                = "netapi";
+        //heapCfg.memRegion           = TUNE_NETAPI_QM_GLOBAL_REGION;
+        heapCfg.memRegion = memInfo.memRegion;
+        heapCfg.sharedHeap          = 1;
+        heapCfg.useStarvationQueue  = 0;
+        heapCfg.dataBufferSize      = pnetapiShm->netapi_global.cfg.def_heap_buf_size;
+        heapCfg.numPkts             = pnetapiShm->netapi_global.cfg.def_heap_n_descriptors;
+        heapCfg.numZeroBufferPackets= pnetapiShm->netapi_global.cfg.def_heap_n_zdescriptors;
+        heapCfg.heapInterfaceTable.data_malloc  = netapi_pktlib_ifTable.data_malloc;
+        heapCfg.heapInterfaceTable.data_free    = netapi_pktlib_ifTable.data_free;
+        heapCfg.dataBufferPktThreshold   = 0;
+        heapCfg.zeroBufferPktThreshold   = 0;
+        
+        /* Create Shared Heap with specified configuration. */
+        sharedHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
+        //todo -> cleanup on failure
         if (!sharedHeapHandle) { netapi_Log(">'netapi' heap create failed, Error Code: %d\n",errCode); return -1;}
         handle->netcp_heap= sharedHeapHandle;
+        printf("netapi_systemInit: netapi heap handle: 0x%x\n", 
+           handle->netcp_heap);
 
+        //open shared heap handle but create new controlRx & Tx heaps for this
+        //process
         /* Update for Control */
         heapCfg.name                = "netapi_control_rx";/*todo:add random#*/
         heapCfg.sharedHeap          = 1;
@@ -760,6 +1095,7 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
         heapCfg.numZeroBufferPackets= 0;
         controlRxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
         if (!controlRxHeapHandle) { netapi_Log("netapi -'netapi_control_rx' heap create failed, Error Code: %d\n",errCode); return -1;}
+
         handle->netcp_control_rx_heap= controlRxHeapHandle;
         heapCfg.name                = "netapi_control_tx";
         heapCfg.numPkts             = TUNE_NETAPI_CONFIG_NUM_CTL_TX_BUF;
@@ -778,7 +1114,8 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
                                controlTxHeapHandle,
                                &handle->nwal_local,
                                &pnetapiShm->netapi_global.cfg,
-                               &pnetapiShm->netapi_global.nwal_context);
+                               &pnetapiShm->netapi_global.nwal_context,
+                               handle->master);
         if (result<0)
         {
             netapi_Log("netapi start_nwal() failed\n");
@@ -787,158 +1124,14 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle,
         netapi_Log("netapip_systemInit: returned from netapip_startNwal\n");
     }
 
-#ifdef NETAPI_ENABLE_SECURITY
-#define SEC_CONTEXT_SZ 384  //not tunable
-/* allocate 2x number of tunnels since we need one for inflow and one for data mode */
-    netapi_VM_SaContextVaddr = hplib_vmMemAlloc((TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2 *
-                                        SEC_CONTEXT_SZ), 128, 0);
-    if (!netapi_VM_SaContextVaddr)
-    {
-        netapi_Log("netapip_systemInit: Failed to map SA context memory region\n");
-        return (-1);
-    }
-    netapi_Log("netapip_systemInit: SA Memory mapped/allocated at address %p.\n", netapi_VM_SaContextVaddr);
-
-#else
-   netapi_VM_SaContextVaddr= (char *) NULL;
-#endif
-
-    /* (3) Allocate 2 QM regions from continguous chunk above */
-    netapi_VM_QMemGlobalDescRam = 
-                                  (void *)hplib_vmMemAlloc((TUNE_NETAPI_NUM_GLOBAL_DESC *
-                                                            TUNE_NETAPI_DESC_SIZE),
-                                                             128, 0);
-
-    netapi_VM_QMemLocalDescRam =
-                                  (void *)hplib_vmMemAlloc((TUNE_NETAPI_NUM_LOCAL_DESC *
-                                                            TUNE_NETAPI_DESC_SIZE),
-                                                            128, 0);
-    netapi_Log("netapip_systemInit: desc region=%x global desc region=%x\n", netapi_VM_QMemLocalDescRam, netapi_VM_QMemGlobalDescRam);
-
     //get timer running
 #ifdef CORTEX_A8
-    netapip_initTimer();
-    netapi_Log("netapip_systemInit: returned from netapip_initTimer\n");
+        netapip_initTimer();
+        netapi_Log("netapip_systemInit: returned from netapip_initTimer\n");
 #endif
 
-    /* Initialize Queue Manager Sub System */
-    result = netapip_initQm (pnetapiShm->netapi_global.cfg.def_max_descriptors,
-                             pnetapiShm->netapi_global.cfg.rmHandle);
-    
-    if (result != 1)
-    {
-         netapi_Log("netapip_systemInit: returned from netapip_initQm with failure\n");
-        return -1;
-    }
 
-    /* Start the QMSS. */
-    if (netapip_startQm(pnetapiShm->netapi_global.cfg.rmHandle) != 1)
-    {
-      netapi_Log("netapip_systemInit: returned from netapip_startQm with failure\n");
-        return -1;
-    }
-    
 
-    //clean our old junk in 1st bunch of queues that will be allocated to us
-    netapip_cleanupAtStart();
-    /* Initialize the global descriptor memory region. */
-    result= netapip_qmSetupMemRegion( 
-                      pnetapiShm->netapi_global.cfg.def_tot_descriptors_for_us,
-                      TUNE_NETAPI_DESC_SIZE,
-                      (unsigned int *) netapi_VM_QMemGlobalDescRam,
-                      TUNE_NETAPI_QM_GLOBAL_REGION);
-    if(result <0)
-    {
-        netapi_Log("netapip_systemInit: can't setup QM shared region\n");
-        return -1;
-    }
-
-    /* Initialize CPPI CPDMA */
-
-    result = netapip_initCppi(pnetapiShm->netapi_global.cfg.rmHandle);
-    if (result != 1)
-    {
-        netapi_Log ("netapi: Error initializing CPPI SubSystem error code : %d\n",result);
-        return -1;
-    }
-
-    /* CPPI and Queue Manager are initialized. */
-    netapi_Log ("netapi: Queue Manager and CPPI are initialized.\n");
-
-    /* create main pkt heap */
-    /* Initialize the Shared Heaps. */
-    Pktlib_sharedHeapInit();
-    /* Populate the heap interface table. */
-    netapi_pktlib_ifTable.data_malloc             = netapip_sharedMemoryMalloc;
-    netapi_pktlib_ifTable.data_free               = netapip_sharedMemoryFree;
-
-    /* Initialize the heap configuration. */
-    memset ((void *)&heapCfg, 0, sizeof(Pktlib_HeapCfg));
-    /* Populate the heap configuration */
-    heapCfg.name                = "netapi";
-    heapCfg.memRegion           = TUNE_NETAPI_QM_GLOBAL_REGION;
-    heapCfg.sharedHeap          = 1;
-    heapCfg.useStarvationQueue  = 0;
-    heapCfg.dataBufferSize      = pnetapiShm->netapi_global.cfg.def_heap_buf_size;
-    heapCfg.numPkts             = pnetapiShm->netapi_global.cfg.def_heap_n_descriptors;
-    heapCfg.numZeroBufferPackets= pnetapiShm->netapi_global.cfg.def_heap_n_zdescriptors;
-    heapCfg.heapInterfaceTable.data_malloc  = netapi_pktlib_ifTable.data_malloc;
-    heapCfg.heapInterfaceTable.data_free    = netapi_pktlib_ifTable.data_free;
-    heapCfg.dataBufferPktThreshold   = 0;
-    heapCfg.zeroBufferPktThreshold   = 0;
-
-    /* Create Shared Heap with specified configuration. */
-    sharedHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
-    //todo -> cleanup on failure
-    if (!sharedHeapHandle) { netapi_Log(">'netapi' heap create failed, Error Code: %d\n",errCode); return -1;}
-    handle->netcp_heap= sharedHeapHandle;
-
-    /* Update for Control */
-    heapCfg.name                = "netapi_control_rx";
-    heapCfg.sharedHeap          = 1;
-    heapCfg.dataBufferSize      = TUNE_NETAPI_CONFIG_MAX_CTL_RXTX_BUF_SIZE;
-    heapCfg.numPkts             = TUNE_NETAPI_CONFIG_NUM_CTL_RX_BUF;
-    heapCfg.numZeroBufferPackets= 0;
-
-    controlRxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
-   //todo -> cleanup on failure
-   if (!controlRxHeapHandle) { netapi_Log("netapi -'netapi_control_rx' heap create failed, Error Code: %d\n",errCode); return -1;}
-   handle->netcp_control_rx_heap= controlRxHeapHandle;
-
-   
-   heapCfg.name                = "netapi_control_tx";
-   heapCfg.numPkts             = TUNE_NETAPI_CONFIG_NUM_CTL_TX_BUF;
-
-   controlTxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
-   //todo -> cleanup on failure
-   if (!controlTxHeapHandle) { netapi_Log("netapi -'netapi_control_tx' heap create failed, Error Code: %d\n",errCode); return -1;}
-   handle->netcp_control_tx_heap= controlTxHeapHandle;
-
-    /* now NWAL */
-    result = netapip_initNwal(TUNE_NETAPI_QM_GLOBAL_REGION,
-                              &netapi_pktlib_ifTable,
-                              &pnetapiShm->netapi_global.nwal_context,
-                              &pnetapiShm->netapi_global.cfg);
-
-    if (result<0) {netapi_Log("netapi  init_nwal() failed\n"); return -1; }
- netapi_Log("netapip_systemInit: returned from netapip_initNwal\n");
-    /* start NWAL */
-
-
-    /* Common Initialization for all cores */
-    while(count < TUNE_NETAPI_MAX_NUM_TRANS)
-    {
-        netapi_proc_global.nwal_context.transInfos[count].transId = count;
-        count++;
-    }
-    result = netapip_startNwal(sharedHeapHandle, 
-                               controlRxHeapHandle,
-                               controlTxHeapHandle,
-                               &handle->nwal_local,
-                               &pnetapiShm->netapi_global.cfg,
-                               &pnetapiShm->netapi_global.nwal_context);
-    if (result<0) {netapi_Log("netapi start_nwal() failed\n"); return -1; }
-    netapi_Log("netapip_systemInit: returned from netapip_startNwal\n");
     return 0;
 }
 
index 1be8cd4aa898545009de7708634961a18294e02e..a809dc5c3879ee5d4ff2ab296ee334e6886e4a8b 100755 (executable)
 extern "C" {
 #endif
 
-
-
 #include "ti/drv/nwal/nwal_util.h"
 #include "ti/runtime/netapi/pktio.h"
 #include "ti/drv/nwal/nwal.h"
-#include "ti/drv/nwal/nwal_util.h"
+//#include "ti/drv/nwal/nwal_util.h"
 #include "ti/runtime/hplib/hplib.h"
 
 
 extern hplib_virtualAddrInfo_T netapi_VM_VirtAddr[HPLIB_MAX_MEM_POOLS];
 extern unsigned char *netapi_VM_SaContextVaddr;
 
-#define NETAPI_TRUE 1
-#define NETAPI_FALSE 0
-
+#define     NETAPI_FALSE 0
+#define     NETAPI_TRUE 1
 /***********************************************
  *  GLOBAL AREA
  *   short term:  this is global to process
@@ -240,7 +237,7 @@ typedef struct NETAPI_HANDLE_Tag
     /* thread cookie */
     void*                      cookie;  /*set by calling thread */
     HPLIB_SPINLOCK_IF_T        spinLock;
-    //uint32_t                   fNssGen2;
+    int                         memRegion;
 } NETAPI_HANDLE_T;
 
 typedef struct NETAPI_SHM_Tag
@@ -267,7 +264,8 @@ int netapip_startNwal(Pktlib_HeapHandle             pkt_heap,
                       Pktlib_HeapHandle             cmd_heapTx,
                       NETAPI_NWAL_LOCAL_CONTEXT_T*  p,
                       NETAPI_CFG_T*                 p_cfg,
-                      NETAPI_NWAL_GLOBAL_CONTEXT_T* p_nwal_glob_context );
+                      NETAPI_NWAL_GLOBAL_CONTEXT_T* p_nwal_glob_context,
+                      int                          master);
 
 int netapip_initTimer(void);
 int netapip_qmSetupMemRegion(unsigned int          numDesc,
@@ -325,24 +323,30 @@ NETAPI_PROC_GLOBAL_T * netapi_get_proc_global(void);
 //add a pktio name (and queue) to global list
 static inline int  netapip_addGlobalPktio(NETAPI_T p, char *name, Qmss_Queue * qn)
 {
-NETAPI_HANDLE_T *pp = (NETAPI_HANDLE_T *) p;
-PKTIO_ENTRY_T *pe;
-int i;
-//find a free slot
-pe = &((NETAPI_GLOBAL_T *)(pp->global))->pktios[0];
-
-for(i=0;i<NETAPI_MAX_PKTIO; i++,pe++)
- {
-   if (pe->qn.qNum ==  -1)
-   {
-     pe->qn.qNum=qn->qNum;
-     pe->qn.qMgr=qn->qMgr;
-     strncpy(pe->name, name, PKTIO_MAX_NAME);
-     return 1;
-   }
-   pe+=1;
- }
- return 0;  //no room
+    NETAPI_HANDLE_T *pp = (NETAPI_HANDLE_T *) p;
+    PKTIO_ENTRY_T *pe;
+    int i;
+    //find a free slot
+     pe = &((NETAPI_GLOBAL_T *)(pp->global))->pktios[0];
+    //pe = &(pnetapiShm->netapi_global.pktios[0]);
+
+    
+    
+    //for(i=0;i<NETAPI_MAX_PKTIO; i++,pe++)
+     for(i=0;i<NETAPI_MAX_PKTIO; i++)
+     {
+       //pe = &(pnetapiShm->netapi_global.pktios[i]);
+       pe = &((NETAPI_GLOBAL_T *)(pp->global))->pktios[i];
+       if (pe->qn.qNum ==  -1)
+       {
+         pe->qn.qNum=qn->qNum;
+         pe->qn.qMgr=qn->qMgr;
+         strncpy(pe->name, name, PKTIO_MAX_NAME);
+         return 1;
+       }
+       //pe+=1;
+     }
+     return 0;  //no room
 }
 
 //delete a pktio name (and queue) to global list
index 5967591205d22e798f69551183a93d351cd48079..45ce577fed133123b9caee0ca711d5e20d52686b 100755 (executable)
@@ -555,7 +555,6 @@ NETCP_CFG_IPSEC_POLICY_T netapi_secAddRxPolicy(NETAPI_T h,
     if(retValue !=  nwal_OK)
     {
         *perr = NETAPI_ERR_NWAL_ERR0;
-        printf("netapi_secAddPolicy: error returned: %d\n", retValue);
         netapi_Log ("netapi sec - ERROR: nwal_setPolicy returned Error Code %d\n",
                     retValue);
         netapip_freeTransInfo(pTransInfo);
index fc1f9f78dc0ec04e4447178358b29565d5c7dbf9..f59142be8887e3c79aa6b889bce898e87a2cede4 100755 (executable)
@@ -1084,7 +1084,6 @@ PKTIO_HANDLE_T * netapi_pktioOpen(NETAPI_T  n,
            p->use_nwal = PKTIO_4_ADJ_NWAL;  //additonal RX q for nwal
            p->_poll = netapip_pktioPollNwalAdj;
            p->nwalInstanceHandle = netapip_returnNwalInstanceHandle(n); 
-           netapi_Log("netapi_pktioOpen: nwalInstanceHandle 0x%x\n", p->nwalInstanceHandle);
         } 
         else if (p_cfg->flags2 & PKTIO_SB)
         {
index 79281df330f44e79a24398d576b185b6f49bb34c..77d0de5c88ddb4b6269af4e5b14370a1b4adbe43 100755 (executable)
@@ -98,7 +98,7 @@ sock_h              rmClientSocket;
 char                rmClientName[RM_NAME_MAX_CHARS] = "RM_Client0";
 
 /* Client socket name */
-char                rmClientSockName[] = "/tmp/var/run/rm/rm_client";
+char                rmClientSockName[] = "/tmp/var/run/rm/rm_client0";
 
 /* Transport map stores the RM transport handle to IPC MessageQ queue mapping */
 Transport_MapEntry  rmTransportMap[MAX_MAPPING_ENTRIES];