Merge branch 'multi-proc'
authorTinku Mannan <tmannan@ti.com>
Wed, 13 Aug 2014 17:15:06 +0000 (13:15 -0400)
committerTinku Mannan <tmannan@ti.com>
Wed, 13 Aug 2014 17:15:06 +0000 (13:15 -0400)
Conflicts:
ti/runtime/netapi/src/netapi_init.c
ti/runtime/netapi/src/netapi_loc.h
ti/runtime/netapi/test/net_test_bench.c
ti/runtime/netapi/test/net_test_router.c

1  2 
ti/runtime/netapi/applications/ipsec_offload/ipsecmgr/src/netapi_ipsecmgr.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/test/net_test_bench.c
ti/runtime/netapi/test/net_test_loopback.c
ti/runtime/netapi/test/net_test_router.c
ti/runtime/netapi/test/net_test_sa_utils.c
ti/runtime/netapi/test/net_test_utils.h
ti/runtime/netapi/utils/netapi_util_rm.c

index 461ee211bcc7017a426036f71258697ae3b5059e,93dbe0df6ea23c8012e4638363bd26a824681d23..6b500da3c28c6cd82dc96d18daac0c1457b24339
@@@ -246,9 -233,8 +233,8 @@@ static void* snoop_run_thread (void* ar
      cleanup_sa_sp();
      netapi_shutdown(netapi_handle);
  
-     if (use_rm)
          closeRm();
 -    return;
 +    return ((void*)NULL);
  }
  
  /**
index ffc828e1dc0bb7f5ca8f25a3b8d50f5dcf74ff10,fee32241c166b6bb5dc680a50cb24ca7ec2c0700..a21daf773d66b9f89583099fa77e32734261ad0f
@@@ -494,8 -538,30 +538,24 @@@ int netapip_initNwal
      bases[nwal_BUF_INDEX_SA_LLD_CHAN_HANDLE] = 0;
      count = count+3;
  #endif
 -    if(count != nwal_N_BUFS)
 -    {
 -        printf("count failure: %d\n", count);
 -        return nwal_FALSE;
 -        //while(1);
 -    }
  
      /* 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,
@@@ -671,9 -791,9 +787,9 @@@ int netapip_systemInit(NETAPI_HANDLE_T 
  
      int32_t             result;
      Pktlib_HeapHandle   sharedHeapHandle;
-     Pktlib_HeapHandle   controlRxHeapHandle,controlTxHeapHandle;    
+     Pktlib_HeapHandle   controlRxHeapHandle,controlTxHeapHandle;
      Pktlib_HeapCfg      heapCfg;
 -    int32_t             errCode;
 +    int32_t             errCode = 0;
      int count=0;
  
  #ifdef NETAPI_USE_DDR
          /****************************************************
           * 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);
 -
+         if (result != 1)
+         {
+              netapi_Log("netapip_systemInit: returned from netapip_initQm with failure\n");
+             return -1;
+         }
  
-         //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 (!sharedHeapHandle) { netapi_Log(">'netapi' Pktlib_findHeapByName failed\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;
index 99b7e525e6ae93c7ee878ae1fb89858d0078b3ae,6a7ac17240d24cf75e9d8a301c4f8afd235da374..f49a4d022d7587fa1c817d5ce2ffeda374e88b19
  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/runtime/hplib/hplib.h"
 +#include "ti/runtime/netapi/pktio.h"
 +#include "ti/runtime/netapi/netcp_cfg.h"
 +#include "ti/runtime/netapi/netapi_tune.h"
  
  
  extern hplib_virtualAddrInfo_T netapi_VM_VirtAddr[HPLIB_MAX_MEM_POOLS];
Simple merge
Simple merge
index 33a3b10533e4aa8ecee52e183359ded37c8f0295,70933a82ea3a8c56bc715cf3a622839c4b93fb73..37102aeb434e111e9b9d1eaec5414dd28f065470
@@@ -75,8 -72,8 +75,9 @@@
  #include <ti/drv/qmss/device/k2h/src/qmss_device.c>
  #include <ti/drv/cppi/device/k2h/src/cppi_device.c>
  #endif /* Device */
 +extern Rm_ServiceHandle   *rmClientServiceHandle;
  
+ extern Rm_ServiceHandle   *rmClientServiceHandle;
  #define netapi_timing_start hplib_mUtilGetPmuCCNT
  
  static int scnt=0;
@@@ -305,10 -302,7 +306,7 @@@ int main(int argc, char **argv
       //install signal handler for ^c
      signal(SIGINT,netTest_utilMySig);
  
- #if 1
 -        if (initRm())
 +    if (initRm())
      {
          printf("main: initRm() returned error\n");
          exit(1);
index d85a8f1b9db31dd3f2aa9f37f89f8f7527eb6a6b,5ee5dbb1a9374e18920cce991761fb340752b0a4..395322609ac021aa3c0ad7ce55e748205002300b
@@@ -908,12 -900,12 +909,12 @@@ void setup_netTestDSPFastPath(NETAPI_T 
      memset(&dsp_pktio_cfg, 0, sizeof (PKTIO_CFG_T));
      memset(&dsp_classi, 0, sizeof (NETCP_CFG_CLASSIFIER_T));
      memset(&dsp_route, 0, sizeof (NETCP_CFG_ROUTE_T));
-     char dsp_name[32];
+     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_GLOBAL | PKTIO_PKT;
+         dsp_pktio_cfg.flags2 = PKTIO_PKT;
          dsp_pktio_cfg.qnum = TEST_NWAL_BASE_REM_FP_RX_PKT_QUEUE + i;
          dsp_pktio_cfg.max_n = 8;