]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/netapi.git/blobdiff - ti/runtime/netapi/src/netapi_init.c
Set qmQueMgmtProxyDataReg to NULL for k1, k2h
[keystone-rtos/netapi.git] / ti / runtime / netapi / src / netapi_init.c
index 90187930427ae2dff10f94eeecddceea50b0602b..69934e7d51adc28cd6e9974de552e73e3693d206 100755 (executable)
@@ -153,12 +153,11 @@ int netapip_qmSetupMemRegion(
     result = Qmss_insertMemoryRegion (&memInfo);
     if (result < QMSS_SOK)  
     {
-      netapi_Log (">function setup_qm_region: Qmss_insertMemoryRegion returned error code %d\n", result);
-      return (-1);
+        netapi_Log ("netapip_qmSetupMemRegion: Qmss_insertMemoryRegion returned error code %d\n", result);
+        return (-1);
     }
 
     return 1;
-
 }
 
 /********************************************************************
@@ -173,7 +172,7 @@ int netapip_startQm(void)
      result = Qmss_start();
      if (result != QMSS_SOK)
      {
-         netapi_Log (">start_qm: Qmss_start failed with error code %d\n", result);
+         netapi_Log ("netapip_startQm: Qmss_start failed with error code %d\n", result);
          return (-1);
      }
      return 1;
@@ -209,15 +208,13 @@ uint8_t paBuf0[NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF0]ALIGN(CACHE_LINESZ);
 #define NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF1    128 * TUNE_NETAPI_MAX_NUM_MAC
 uint8_t paBuf1[NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF1]ALIGN(CACHE_LINESZ);
 
-//#define NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF2   768 
-//#define NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF2   6144
-#define NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF2   12288
+#define NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF2   13824
 
 
 uint8_t paBuf2[NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF2]ALIGN(CACHE_LINESZ);
 
 /* Memory used for SA LLD global Handle */
-#define NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE    384
+#define NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE    512
 uint8_t salldHandle[NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE]ALIGN(CACHE_LINESZ);
 
 #if 0  //need to alloc this since we need phy addr also 
@@ -290,7 +287,8 @@ int netapip_initNwal(
                       Pktlib_createHeap(&heapCfg, &errCode);
     if(nwalGlobCfg.pa2SaBufPool.bufPool[0].heapHandle == NULL)
     {
-        netapi_Log (">Pktlib_createHeap:Heap Creation Failed for PA to SA Buffer Pool , Error Code: %d\n",errCode); 
+        netapi_Log ("netapip_initNwal: Pktlib_createHeap:Heap Creation Failed for PA to SA Buffer Pool, Error Code: %d\n",
+                    errCode); 
         netapipErrTeardown();
         return -1;
     }
@@ -308,7 +306,8 @@ int netapip_initNwal(
         Pktlib_createHeap(&heapCfg, &errCode);
     if(nwalGlobCfg.sa2PaBufPool.bufPool[0].heapHandle == NULL)
     {
-        netapi_Log (">Pktlib_createHeap:Heap Creation Failed for SA to PA Buffer Pool  , Error Code: %d\n",errCode); 
+        netapi_Log ("netapip_initNwal: Pktlib_createHeap:Heap Creation Failed for SA to PA Buffer Pool, Error Code: %d\n",
+                     errCode); 
         netapipErrTeardown();
         return -1;
     }
@@ -339,7 +338,7 @@ int netapip_initNwal(
                                    aligns);
     if(nwalRetVal != nwal_OK)
     {
-        netapi_Log ("netapi: init_nwal - nwal_getBufferReq Failed %d\n", nwalRetVal);
+        netapi_Log ("netapip_initNwal: nwal_getBufferReq Failed %d\n", nwalRetVal);
         return nwal_FALSE;
     }
 
@@ -356,7 +355,6 @@ int netapip_initNwal(
     bases[nwal_BUF_INDEX_INT_HANDLES] = (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)nwalHandleMem);
     if(NWAL_CHAN_HANDLE_SIZE  < sizes[nwal_BUF_INDEX_INT_HANDLES])
     {
-        netapi_Log("one\n");
         /* Resize Memory */
         while(1);
     }
@@ -365,18 +363,13 @@ int netapip_initNwal(
     if((NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF0) < sizes[nwal_BUF_INDEX_PA_LLD_BUF0])
     {
         /* Resize Memory */
-        netapi_Log("two\n");
         while(1);
     }
     count++;
 
     bases[nwal_BUF_INDEX_PA_LLD_BUF1] = (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)paBuf1);
-    netapi_Log("NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF1 %d, size[nwal_BUF_INDEX_PA_LLD_BUF1] %d\n",
-        NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF1, sizes[nwal_BUF_INDEX_PA_LLD_BUF1]);
     if((NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF1) < sizes[nwal_BUF_INDEX_PA_LLD_BUF1])
     {
-        netapi_Log("NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF1 %d, size[nwal_BUF_INDEX_PA_LLD_BUF1] %d\n",
-            NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF1, sizes[nwal_BUF_INDEX_PA_LLD_BUF1]);
         /* Resize Memory */
         while(1);
     }
@@ -385,7 +378,6 @@ int netapip_initNwal(
     bases[nwal_BUF_INDEX_PA_LLD_BUF2] = (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)paBuf2);
     if((NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF2) < sizes[nwal_BUF_INDEX_PA_LLD_BUF2])
     {
-        netapi_Log("four\n");
         /* Resize Memory */
         while(1);
     }
@@ -394,7 +386,6 @@ int netapip_initNwal(
     bases[nwal_BUF_INDEX_SA_LLD_HANDLE] = (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)salldHandle);
     if((NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE) < sizes[nwal_BUF_INDEX_SA_LLD_HANDLE])
     {
-        netapi_Log("five\n");
         /* Resize Memory */
         while(1);
     }
@@ -407,7 +398,6 @@ int netapip_initNwal(
     if((NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE_PER_CHAN * TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2) <
         sizes[nwal_BUF_INDEX_SA_LLD_CHAN_HANDLE])
     {
-        netapi_Log("netapip_initNwal:  sizes[nwal_BUF_INDEX_SA_LLD_CHAN_HANDLE] %d\n",  sizes[nwal_BUF_INDEX_SA_LLD_CHAN_HANDLE]);
         /* Resize Memory */
         while(1);
     }
@@ -431,11 +421,11 @@ int netapip_initNwal(
                              &p_nwal_context->nwalInstHandle);
     if(nwalRetVal != nwal_OK)
     {
-        netapi_Log ("netapi: init_nwal- nwal_create Failed %d\n",nwalRetVal);
+        netapi_Log ("netapip_initNwal: nwal_create Failed %d\n",nwalRetVal);
         while(1);
     }
 
-    netapi_Log("netapi: init_nwal - Global and Local Network initialization Successful \n");
+    netapi_Log("netapip_initNwal- Global and Local Network initialization Successful \n");
     return 1;
 }
 
@@ -617,11 +607,9 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle)
        - memory mapped peripherals we use, such as QMSS, PA, etc */
     result = hplib_vmInit(&netapi_VM_VirtAddr[0], 2, &netapi_VM_MempoolAttr[0]);
 
-    /* TODO: at this point, we need to create the QM regions which need to moved out of the above 
-    netapi_VM_memory_setup() call, also need to move out the SA context stuff */
 
-    if (result == hplib_OK) netapi_Log("netapi: system init - memory set  up OK\n");
-    else {netapi_Log(">netap: system init - memory set up failed\n"); return -1;}
+    if (result == hplib_OK) netapi_Log("netapip_systemInit: - memory set  up OK\n");
+    else {netapi_Log("netapip_systemInit: - memory set up failed\n"); return -1;}
 
 
 #ifdef NETAPI_ENABLE_SECURITY
@@ -631,10 +619,10 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle)
                                         SEC_CONTEXT_SZ), 128, 0);
     if (!netapi_VM_SaContextVaddr)
     {
-        netapi_Log("netapi ERROR: Failed to map SA context memory region\n");
+        netapi_Log("netapip_systemInit: Failed to map SA context memory region\n");
         return (-1);
     }
-    netapi_Log(">hplib VM_SaContext: Memory mapped/allocated at address %p.\n", netapi_VM_SaContextVaddr);
+    netapi_Log("netapip_systemInit: SA Memory mapped/allocated at address %p.\n", netapi_VM_SaContextVaddr);
 
 #else
    netapi_VM_SaContextVaddr= (char *) NULL;
@@ -644,21 +632,21 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle)
     since number of regions created is appliction specific, put this in netapip_systemInit */
     /* (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);
+                                  (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("netapi local desc region=%x global desc region=%x\n", netapi_VM_QMemLocalDescRam, netapi_VM_QMemGlobalDescRam);
+                                  (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");
 #endif
-     netapi_Log("netapip_systemInit: returned from netapip_initTimer\n");
 
     /* Initialize Queue Manager Sub System */
     result = netapip_initQm (netapi_global.cfg.def_max_descriptors); 
@@ -686,7 +674,7 @@ int netapip_systemInit(NETAPI_HANDLE_T * handle)
                       TUNE_NETAPI_DESC_SIZE,
                       (unsigned int *) netapi_VM_QMemGlobalDescRam,
                       TUNE_NETAPI_QM_GLOBAL_REGION);
-    if(result <0) {netapi_Log("netapi; can't setup QM shared region\n"); return -1;}
+    if(result <0) {netapi_Log("netapip_systemInit: can't setup QM shared region\n"); return -1;}
 
 netapi_Log("netapip_systemInit: returned from netapip_qmSetupMemRegion\n");
 #if 0 //todo setup 2nd region
@@ -830,9 +818,9 @@ void netapi_dump_internal_heap_stats(void)
 {
     Pktlib_HeapStats    pktLibHeapStats;
     Pktlib_getHeapStats(netapi_get_global()->nwal_context.pa2sa_heap,&pktLibHeapStats);
-    netapi_Log("PA2SA(ingress) stats>  #free=%d #zb=%d #garbage=%d\n", pktLibHeapStats.numFreeDataPackets,
+    printf("PA2SA(ingress) stats>  #free=%d #zb=%d #garbage=%d\n", pktLibHeapStats.numFreeDataPackets,
                                 pktLibHeapStats.numZeroBufferPackets, pktLibHeapStats.numPacketsinGarbage);
-    netapi_Log("               >  #dataBufThreshStatus=%d #dataBufStarvCounter=%d #zBufThreshStatus=%d #zBufStarvCounter=%d \n",
+    printf("               >  #dataBufThreshStatus=%d #dataBufStarvCounter=%d #zBufThreshStatus=%d #zBufStarvCounter=%d \n",
                         pktLibHeapStats.dataBufferThresholdStatus,pktLibHeapStats.dataBufferStarvationCounter,
                         pktLibHeapStats.zeroDataBufferThresholdStatus, pktLibHeapStats.zeroDataBufferStarvationCounter);
 #if 0
@@ -844,9 +832,9 @@ netapi_Log("               >  #dataBufThreshStatus=%d #dataBufStarvCounter=%d #z
                         pktLibHeapStats.zeroDataBufferThresholdStatus, pktLibHeapStats.zeroDataBufferStarvationCounter);
 #endif
     Pktlib_getHeapStats(netapi_get_global()->nwal_context.sa2pa_heap,&pktLibHeapStats);
-    netapi_Log("SA2PA stats>  #free=%d #zb=%d #garbage=%d\n", pktLibHeapStats.numFreeDataPackets,
+    printf("SA2PA stats>  #free=%d #zb=%d #garbage=%d\n", pktLibHeapStats.numFreeDataPackets,
                                 pktLibHeapStats.numZeroBufferPackets, pktLibHeapStats.numPacketsinGarbage);
-    netapi_Log("               >  #dataBufThreshStatus=%d #dataBufStarvCounter=%d #zBufThreshStatus=%d #zBufStarvCounter=%d \n",
+    printf("               >  #dataBufThreshStatus=%d #dataBufStarvCounter=%d #zBufThreshStatus=%d #zBufStarvCounter=%d \n",
                         pktLibHeapStats.dataBufferThresholdStatus,pktLibHeapStats.dataBufferStarvationCounter,
                         pktLibHeapStats.zeroDataBufferThresholdStatus, pktLibHeapStats.zeroDataBufferStarvationCounter);