1 /****************************************************************************
2 * FILE: netapi_init.c
3 * Global, Private initialization and cleanup routines and defines of NETAPI
4 *
5 * DESCRIPTION: Functions to initialize and cleanup framework resources
6 * for running NETAPI
7 *
8 * REVISION HISTORY:
9 *
10 * Copyright (c) Texas Instruments Incorporated 2013
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 *
16 * Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 *
19 * Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the
22 * distribution.
23 *
24 * Neither the name of Texas Instruments Incorporated nor the names of
25 * its contributors may be used to endorse or promote products derived
26 * from this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 ***************************************************************************/
42 #include "netapi.h"
43 #include "netapi_loc.h"
44 #include <sys/types.h>
45 #include <sys/stat.h>
46 #include <fcntl.h>
47 #include <sys/mman.h>
48 #include <errno.h>
49 #include <unistd.h>
51 #include "ti/drv/nwal/nwal.h"
53 /* CSL RL includes */
54 #include <ti/csl/cslr_device.h>
55 #include <ti/csl/cslr_qm_config.h>
56 #include <ti/csl/cslr_qm_descriptor_region_config.h>
57 #include <ti/csl/cslr_qm_queue_management.h>
58 #include <ti/csl/cslr_qm_queue_status_config.h>
59 #include <ti/csl/cslr_qm_intd.h>
60 #include <ti/csl/cslr_pdsp.h>
61 #include <ti/csl/csl_qm_queue.h>
62 #include <ti/csl/cslr_cppidma_global_config.h>
63 #include <ti/csl/cslr_cppidma_rx_channel_config.h>
64 #include <ti/csl/cslr_cppidma_rx_flow_config.h>
65 #include <ti/csl/cslr_cppidma_tx_channel_config.h>
66 #include <ti/csl/cslr_cppidma_tx_scheduler_config.h>
67 #include <ti/csl/csl_cppi.h>
68 #include <ti/csl/csl_pscAux.h>
69 #include <ti/csl/csl_semAux.h>
70 #include <ti/csl/csl_cacheAux.h>
71 #include <ti/csl/csl_xmcAux.h>
72 #include <ti/drv/qmss/qmss_qm.h>
74 extern NETAPI_SHM_T* pnetapiShm;
75 /* Global variablesto hold virtual address of various subsystems */
76 extern hplib_virtualAddrInfo_T netapi_VM_VirtAddr[];
78 /* Global variables which needs to be populated with memory pool attributes
79 which is passed to HPLIB for memory pool initialization*/
80 extern hplib_memPoolAttr_T netapi_VM_MempoolAttr[];
81 extern unsigned char *netapi_VM_QMemLocalDescRam;
82 extern unsigned char *netapi_VM_QMemGlobalDescRam;
83 extern unsigned char *netapi_VM_SaContextVaddr;
85 extern Pktlib_HeapIfTable netapi_pktlib_ifTable;
86 extern NETAPI_PROC_GLOBAL_T netapi_proc_global;
89 /* TODO verify: */
90 #define CACHE_LINESZ 64
93 #define ALIGN(x) __attribute__((aligned (x)))
95 /*****************************************************************************
96 * Global Resources shared by all Cores
97 *****************************************************************************/
98 uint8_t *QMemGlobDescRam = 0;
99 uint8_t *cppiMemPaSaLinkBuf = 0;
100 uint8_t *cppiMemSaPaLinkBuf = 0;
104 #if 0
105 /*****************************************************************************
106 * Local Resource allocated at each Core
107 *****************************************************************************/
108 /* Descriptors in global shared */
109 uint8_t *QMemLocDescRam = NULL;
110 uint8_t *cppiMemRxPktLinkBuf = NULL;
111 uint8_t *cppiMemTxPktLinkBuf = NULL;
112 uint8_t *cppiMemRxCtlLinkBuf = NULL;
113 uint8_t *cppiMemTxCtlLinkBuf = NULL;
115 #endif
119 NETCP_CFG_GLOB_DEVICE_PARAMS_T *p_netapi_device_cfg_local;
122 /********************************************************************
123 * FUNCTION PURPOSE: Internal NETAPI function to setup the QM memory region
124 ********************************************************************
125 * DESCRIPTION: Internal NETAPI function to setup the QM memory region,
126 * once per SOC
127 ********************************************************************/
128 int netapip_qmSetupMemRegion(
129 uint32_t numDesc,
130 uint32_t descSize,
131 uint32_t* pDescMemBase,
132 Qmss_MemRegion memRegion)
133 {
134 Qmss_MemRegInfo memInfo;
135 Int32 result;
136 Int n;
137 static int netapi_qm_region_index=0;
139 memset(&memInfo,0,sizeof(Qmss_MemRegInfo));
140 memInfo.descBase = pDescMemBase;
141 memInfo.descSize = descSize;
142 memInfo.descNum = numDesc;
143 memInfo.manageDescFlag = Qmss_ManageDesc_MANAGE_DESCRIPTOR;
144 memInfo.memRegion = memRegion;
146 if(memRegion == TUNE_NETAPI_QM_GLOBAL_REGION)
147 {
148 memInfo.startIndex = TUNE_NETAPI_QM_START_INDEX; //was 0
149 netapi_qm_region_index += numDesc;
150 }else if(memRegion ==NETAPI_LOCAL_REGION)
151 {
152 /* 2nd region for descriptors (perhaps private?) */
153 memInfo.startIndex = netapi_qm_region_index;
154 }
155 else
156 {
157 return -1 ;
158 }
160 memset (pDescMemBase, 0, (descSize * numDesc));
162 result = Qmss_insertMemoryRegion (&memInfo);
163 if (result < QMSS_SOK)
164 {
165 netapi_Log ("netapip_qmSetupMemRegion: Qmss_insertMemoryRegion returned error code %d\n", result);
166 return (-1);
167 }
169 return 1;
170 }
172 /********************************************************************
173 * FUNCTION PURPOSE: Internal NETAPI function to start QM
174 ********************************************************************
175 * DESCRIPTION: Internal NETAPI function to start QM
176 * once per thread/core
177 ********************************************************************/
178 int netapip_startQm(void* rmClientServiceHandle)
179 {
180 int32_t result;
181 Qmss_StartCfg startCfg;
183 startCfg.rmServiceHandle = rmClientServiceHandle;
184 startCfg.pQmssGblCfgParams = NULL;
185 //result = Qmss_start();
186 result = Qmss_startCfg(&startCfg);
187 if (result != QMSS_SOK)
188 {
189 netapi_Log ("netapip_startQm: Qmss_start failed with error code %d\n", result);
190 return (-1);
191 }
192 return 1;
193 }
196 /*** NWAL Memory Buffer Configuration ***/
197 #define NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_HANDLE 3400
198 uint8_t nwalInstMem[NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_HANDLE]ALIGN(CACHE_LINESZ);
200 #define NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_MAC 256
201 #define NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_IPSEC_HANDLE_PER_CHAN 256
202 #define NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_IP 128
203 #define NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_PORT 128
204 #define NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_L2L3_HDR 128
205 #define NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_LOC_CONTEXT 384
206 #define NWAL_CHAN_HANDLE_SIZE ((NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_MAC * TUNE_NETAPI_MAX_NUM_MAC) + \
207 (NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_IPSEC_HANDLE_PER_CHAN * TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2) + \
208 (NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_IP * TUNE_NETAPI_MAX_NUM_IP) + \
209 (NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_PORT * TUNE_NETAPI_MAX_NUM_PORTS)+ \
210 (NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_LOC_CONTEXT * TUNE_NETAPI_NUM_CORES) + \
211 (NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_PER_L2L3_HDR * TUNE_NETAPI_MAX_NUM_L2_L3_HDRS))
213 uint8_t nwalHandleMem[NWAL_CHAN_HANDLE_SIZE]ALIGN(CACHE_LINESZ);
216 typedef struct NETAPI_PA_SHM_Tag
217 {
218 /* todo: Check if below size information can be made available from pa interface file */
219 #define NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF0 256
220 /* PA instance */
221 /* Memory used for the PA Instance. Needs to be assigned global uncached memory for chip */
222 uint8_t paBuf0[NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF0]ALIGN(CACHE_LINESZ);
224 /* Memory used for PA handles */
225 #define NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF1 128 * TUNE_NETAPI_MAX_NUM_MAC
226 uint8_t paBuf1[NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF1]ALIGN(CACHE_LINESZ);
228 #define NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF2 14592
231 uint8_t paBuf2[NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF2]ALIGN(CACHE_LINESZ);
232 } NETAPI_PA_SHM_T;
235 typedef struct NETAPI_SA_SHM_Tag
236 {
237 /* Memory used for SA LLD global Handle */
238 #define NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE 512
239 uint8_t salldHandle[NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE]ALIGN(CACHE_LINESZ);
241 /* Memory used by SA LLD per Channel */
242 #define NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE_PER_CHAN 512
243 uint8_t salldChanHandle[NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE_PER_CHAN * TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2]ALIGN(CACHE_LINESZ);
244 } NETAPI_SA_SHM_T;
246 /********************************************************************
247 * FUNCTION PURPOSE: NETAPI internal function to gracefully cleanup when startup
248 * issue occurs.
249 ********************************************************************
250 * DESCRIPTION: NETAPI internal function to gracefully cleanup when startup
251 * issue occurs.
252 ********************************************************************/
253 void netapipErrTeardown() { netapip_cleanupAtStart(); exit(-99); }
255 /********************************************************************
256 * FUNCTION PURPOSE: Internal NETAPI function to initialize NWAL subsystem
257 ********************************************************************
258 * DESCRIPTION: Internal NETAPI function to initialize NWAL subsytem
259 ********************************************************************/
260 int netapip_initNwal(
261 int region2use,
262 Pktlib_HeapIfTable * p_table,
263 NETAPI_NWAL_GLOBAL_CONTEXT_T * p_nwal_context,
264 NETAPI_CFG_T*p_cfg)
265 {
266 nwalSizeInfo_t nwalSizeInfo;
267 nwal_RetValue nwalRetVal;
268 nwalGlobCfg_t nwalGlobCfg;
269 uint8_t count;
270 int sizes[nwal_N_BUFS];
271 int aligns[nwal_N_BUFS];
272 void* bases[nwal_N_BUFS];
273 Pktlib_HeapCfg heapCfg;
274 int32_t errCode = 0;
275 void* pBase = NULL;
276 NETAPI_PA_SHM_T* paEntry = NULL;
277 NETAPI_SA_SHM_T* saEntry = NULL;
279 memset(p_nwal_context,0,sizeof( NETAPI_NWAL_GLOBAL_CONTEXT_T) );
280 memset(&nwalGlobCfg,0,sizeof(nwalGlobCfg_t ) );
282 pBase = hplib_shmOpen();
283 if (pBase)
284 {
285 if(hplib_shmAddEntry(pBase, sizeof(NETAPI_PA_SHM_T), PA_ENTRY) == hplib_OK)
286 {
287 paEntry = (NETAPI_PA_SHM_T*)hplib_shmGetEntry(pBase,PA_ENTRY);
288 nwalGlobCfg.instPoolBaseAddr = (void *)paEntry;
289 }
290 else
291 {
292 netapi_Log("netapip_initNwal: Unable to Add shared memory segment for PASS\n");
293 return -1;
294 }
295 if(hplib_shmAddEntry(pBase, sizeof(NETAPI_SA_SHM_T), SA_ENTRY) == hplib_OK)
296 {
297 saEntry = (NETAPI_SA_SHM_T*)hplib_shmGetEntry(pBase,SA_ENTRY);
298 nwalGlobCfg.instPoolSaBaseAddr = (void*) saEntry;
299 }
300 else
301 {
302 netapi_Log("netapip_initNwal: Unable to Add shared memory segment for SASS\n");
303 return -1;
304 }
306 }
307 /* Initialize Buffer Pool for NetCP PA to SA packets */
308 nwalGlobCfg.pa2SaBufPool.numBufPools = 1;
309 nwalGlobCfg.pa2SaBufPool.bufPool[0].descSize = TUNE_NETAPI_DESC_SIZE;
310 nwalGlobCfg.pa2SaBufPool.bufPool[0].bufSize = p_cfg->def_heap_buf_size;
312 /* Initialize the heap configuration. */
313 memset ((void *)&heapCfg, 0, sizeof(Pktlib_HeapCfg));
314 /* Populate the heap configuration */
315 heapCfg.name = "nwal PA2SA";
316 heapCfg.memRegion = region2use;
317 heapCfg.sharedHeap = 0;
318 heapCfg.useStarvationQueue = 0;
319 heapCfg.dataBufferSize = p_cfg->def_heap_buf_size;
320 heapCfg.numPkts = TUNE_NETAPI_CONFIG_MAX_PA_TO_SA_DESC;
321 heapCfg.numZeroBufferPackets= 0;
322 heapCfg.heapInterfaceTable.data_malloc = p_table->data_malloc;
323 heapCfg.heapInterfaceTable.data_free = p_table->data_free;
324 heapCfg.dataBufferPktThreshold = 0;
325 heapCfg.zeroBufferPktThreshold = 0;
328 nwalGlobCfg.pa2SaBufPool.bufPool[0].heapHandle = p_nwal_context->pa2sa_heap=
329 Pktlib_createHeap(&heapCfg, &errCode);
330 if(nwalGlobCfg.pa2SaBufPool.bufPool[0].heapHandle == NULL)
331 {
332 netapi_Log ("netapip_initNwal: Pktlib_createHeap:Heap Creation Failed for PA to SA Buffer Pool, Error Code: %d\n",
333 errCode);
334 netapipErrTeardown();
335 return -1;
336 }
338 /* Initialize Buffer Pool for NetCP SA to PA packets */
339 nwalGlobCfg.sa2PaBufPool.numBufPools = 1;
340 nwalGlobCfg.sa2PaBufPool.bufPool[0].descSize = TUNE_NETAPI_DESC_SIZE;
341 nwalGlobCfg.sa2PaBufPool.bufPool[0].bufSize = p_cfg->def_heap_buf_size;
343 /* Populate the heap configuration */
344 heapCfg.name = "nwal SA2PA";
345 heapCfg.numPkts = TUNE_NETAPI_CONFIG_MAX_SA_TO_PA_DESC;
347 nwalGlobCfg.sa2PaBufPool.bufPool[0].heapHandle = p_nwal_context->sa2pa_heap=
348 Pktlib_createHeap(&heapCfg, &errCode);
349 if(nwalGlobCfg.sa2PaBufPool.bufPool[0].heapHandle == NULL)
350 {
351 netapi_Log ("netapip_initNwal: Pktlib_createHeap:Heap Creation Failed for SA to PA Buffer Pool, Error Code: %d\n",
352 errCode);
353 netapipErrTeardown();
354 return -1;
355 }
357 nwalGlobCfg.hopLimit = 5;/* Default TTL / Hop Limit */
358 nwalGlobCfg.paPowerOn = nwal_TRUE;
359 nwalGlobCfg.saPowerOn = nwal_TRUE;
360 nwalGlobCfg.paFwActive = nwal_TRUE;
361 nwalGlobCfg.saFwActive = nwal_FALSE;
364 /* Update nwal cfg with virtual PA and SA addresses */
367 nwalGlobCfg.paVirtBaseAddr = (uint32_t) netapi_VM_VirtAddr->passCfgVaddr;
368 nwalGlobCfg.saVirtBaseAddr = (uint32_t) netapi_VM_VirtAddr->passCfgVaddr +
369 CSL_NETCP_CFG_SA_CFG_REGS -
370 CSL_NETCP_CFG_REGS;
371 ;
373 nwalGlobCfg.rxDefPktQ = QMSS_PARAM_NOT_SPECIFIED;
376 /* Get the Buffer Requirement from NWAL */
377 memset(&nwalSizeInfo,0,sizeof(nwalSizeInfo));
378 nwalSizeInfo.nMaxMacAddress = TUNE_NETAPI_MAX_NUM_MAC;
379 nwalSizeInfo.nMaxIpAddress = TUNE_NETAPI_MAX_NUM_IP;
380 nwalSizeInfo.nMaxL4Ports = TUNE_NETAPI_MAX_NUM_PORTS;
381 nwalSizeInfo.nMaxIpSecChannels = TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS;//we allocate 2 per channel
382 nwalSizeInfo.nMaxDmSecChannels = TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS;//we allocate 2 per channel
383 nwalSizeInfo.nMaxL2L3Hdr = TUNE_NETAPI_MAX_NUM_L2_L3_HDRS;
384 nwalSizeInfo.nProc = TUNE_NETAPI_NUM_CORES;
385 nwalRetVal = nwal_getBufferReq(&nwalSizeInfo,
386 sizes,
387 aligns);
388 if(nwalRetVal != nwal_OK)
389 {
390 netapi_Log ("netapip_initNwal: nwal_getBufferReq Failed %d\n", nwalRetVal);
391 return nwal_FALSE;
392 }
394 /* Check for memory size requirement and update the base */
395 count = 0;
396 bases[nwal_BUF_INDEX_INST] = (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)nwalInstMem);
397 if(NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_HANDLE < sizes[nwal_BUF_INDEX_INST])
398 {
399 printf(" 1memSize issue %d %d\n",
400 sizes[nwal_BUF_INDEX_INST], NETAPI_NWAL_CONFIG_BUFSIZE_NWAL_HANDLE);
401 /* Resize Memory */
402 return nwal_FALSE;
403 //while(1);
404 }
405 count++;
407 bases[nwal_BUF_INDEX_INT_HANDLES] = (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)nwalHandleMem);
408 if(NWAL_CHAN_HANDLE_SIZE < sizes[nwal_BUF_INDEX_INT_HANDLES])
409 {
410 /* Resize Memory */
411 printf(" 2memSize issue %d %d\n",
412 sizes[nwal_BUF_INDEX_INT_HANDLES], NWAL_CHAN_HANDLE_SIZE);
413 /* Resize Memory */
414 return nwal_FALSE;
415 //while(1);
417 }
418 count++;
419 bases[nwal_BUF_INDEX_PA_LLD_BUF0] =
420 (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)paEntry->paBuf0);
421 if((NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF0) < sizes[nwal_BUF_INDEX_PA_LLD_BUF0])
422 {
423 printf(" 3memSize issue %d %d\n",
424 sizes[nwal_BUF_INDEX_PA_LLD_BUF0], NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF0);
425 /* Resize Memory */
426 return nwal_FALSE;
427 //while(1);
429 }
430 count++;
432 bases[nwal_BUF_INDEX_PA_LLD_BUF1] =
433 (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)paEntry->paBuf1);
434 if((NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF1) < sizes[nwal_BUF_INDEX_PA_LLD_BUF1])
435 {
436 printf(" 4memSize issue %d %d\n",
437 sizes[nwal_BUF_INDEX_PA_LLD_BUF1], NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF1);
438 /* Resize Memory */
439 return nwal_FALSE;
440 //while(1);
442 }
443 count++;
445 bases[nwal_BUF_INDEX_PA_LLD_BUF2] =
446 (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)paEntry->paBuf2);
447 if((NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF2) < sizes[nwal_BUF_INDEX_PA_LLD_BUF2])
448 {
449 printf(" 5memSize issue %d %d\n",
450 sizes[nwal_BUF_INDEX_PA_LLD_BUF2], NETAPI_NWAL_CONFIG_BUFSIZE_PA_BUF2);
451 /* Resize Memory */
452 return nwal_FALSE;
453 //while(1);
455 }
456 count++;
457 #ifdef NETAPI_ENABLE_SECURITY
458 bases[nwal_BUF_INDEX_SA_LLD_HANDLE] =
459 (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)saEntry->salldHandle);
460 if((NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE) < sizes[nwal_BUF_INDEX_SA_LLD_HANDLE])
461 {
462 printf(" 6memSize issue %d %d\n",
463 sizes[nwal_BUF_INDEX_SA_LLD_HANDLE],
464 NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE);
465 /* Resize Memory */
466 return nwal_FALSE;
467 //while(1);
469 }
470 count++;
472 bases[nwal_BUF_INDEX_SA_CONTEXT] = (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)netapi_VM_SaContextVaddr);
473 /* also save this here for easy access to sa_start */
474 nwalGlobCfg.scPoolBaseAddr = bases[nwal_BUF_INDEX_SA_CONTEXT];
475 count++;
477 bases[nwal_BUF_INDEX_SA_LLD_CHAN_HANDLE] =
478 (uint32_t *)Osal_nwalLocToGlobAddr((uint32_t)saEntry->salldChanHandle);
479 if((NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE_PER_CHAN * TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2) <
480 sizes[nwal_BUF_INDEX_SA_LLD_CHAN_HANDLE])
481 {
482 printf(" 7memSize issue %d %d\n",
483 sizes[nwal_BUF_INDEX_SA_LLD_CHAN_HANDLE],
484 NETAPI_NWAL_CONFIG_BUFSIZE_SA_LLD_HANDLE_PER_CHAN * TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2);
485 /* Resize Memory */
486 return nwal_FALSE;
487 //while(1);
489 }
490 count++;
491 #else
492 bases[nwal_BUF_INDEX_SA_LLD_HANDLE] = 0;
493 bases[nwal_BUF_INDEX_SA_CONTEXT] = 0;
494 bases[nwal_BUF_INDEX_SA_LLD_CHAN_HANDLE] = 0;
495 count = count+3;
496 #endif
498 /* Initialize NWAL module */
499 nwalRetVal = nwal_create(&nwalGlobCfg,
500 &nwalSizeInfo,
501 sizes,
502 bases,
503 &p_nwal_context->nwalInstHandle);
504 if(nwalRetVal != nwal_OK)
505 {
506 netapi_Log ("netapip_initNwal: nwal_create Failed %d\n",nwalRetVal);
507 return nwal_FALSE;
508 //while(1);
509 }
511 netapi_Log("netapip_initNwal- Global and Local Network initialization Successful \n");
512 return 1;
513 }
515 /********************************************************************
516 * FUNCTION PURPOSE: Internal NETAPI function to start NWAL
517 ********************************************************************
518 * DESCRIPTION: Internal NETAPI function to start NWAL, per thread/core
519 ********************************************************************/
520 int netapip_startNwal(Pktlib_HeapHandle pkt_heap,
521 Pktlib_HeapHandle cmd_rx_heap,
522 Pktlib_HeapHandle cmd_tx_heap,
523 NETAPI_NWAL_LOCAL_CONTEXT_T *p,
524 NETAPI_CFG_T *p_cfg,
525 NETAPI_NWAL_GLOBAL_CONTEXT_T * p_nwal_glob_context )
526 {
527 nwalLocCfg_t nwalLocCfg;
528 int count=0;
529 static int first_time = 0;
530 nwal_RetValue nwalRetVal;
532 memset(&nwalLocCfg,0,sizeof(nwalLocCfg));
534 /* Update the Start of Packet Offset for the default flows created
535 * by NWAL
536 */
537 nwalLocCfg.rxSopPktOffset = p_cfg->def_flow_pkt_rx_offset;
538 nwalLocCfg.rxPktTailRoomSz = p_cfg->def_heap_tailroom_size;
540 /* Call back registration for the core */
541 nwalLocCfg.pRxPktCallBack = netapip_pktioNWALRxPktCallback;
542 nwalLocCfg.pCmdCallBack = netapip_netcpCfgNWALCmdCallBack;
543 nwalLocCfg.pPaStatsCallBack = netapip_netcpCfgNWALCmdPaStatsReply;
545 nwalLocCfg.pRxDmCallBack= netapip_pktioNWALSBPktCallback; //sideband mode callback
547 /* Initialize Buffer Pool for Control packets from NetCP to Host */
548 nwalLocCfg.rxCtlPool.numBufPools = 1;
549 nwalLocCfg.rxCtlPool.bufPool[0].descSize = TUNE_NETAPI_DESC_SIZE;
550 nwalLocCfg.rxCtlPool.bufPool[0].bufSize = TUNE_NETAPI_CONFIG_MAX_CTL_RXTX_BUF_SIZE;
551 nwalLocCfg.rxCtlPool.bufPool[0].heapHandle = cmd_rx_heap;
553 /* Initialize Buffer Pool for Control packets from Host to NetCP */
554 nwalLocCfg.txCtlPool.numBufPools = 1;
555 nwalLocCfg.txCtlPool.bufPool[0].descSize = TUNE_NETAPI_DESC_SIZE;
556 nwalLocCfg.txCtlPool.bufPool[0].bufSize = TUNE_NETAPI_CONFIG_MAX_CTL_RXTX_BUF_SIZE;
557 nwalLocCfg.txCtlPool.bufPool[0].heapHandle = cmd_tx_heap;
559 /* Initialize Buffer Pool for Packets from NetCP to Host */
560 nwalLocCfg.rxPktPool.numBufPools = 1;
561 nwalLocCfg.rxPktPool.bufPool[0].descSize = TUNE_NETAPI_DESC_SIZE;
562 nwalLocCfg.rxPktPool.bufPool[0].bufSize = p_cfg->def_heap_buf_size;
563 nwalLocCfg.rxPktPool.bufPool[0].heapHandle = pkt_heap;
565 /* Initialize Buffer Pool for Packets from Host to NetCP */
566 nwalLocCfg.txPktPool.numBufPools = 1;
567 nwalLocCfg.txPktPool.bufPool[0].descSize = TUNE_NETAPI_DESC_SIZE;
568 nwalLocCfg.txPktPool.bufPool[0].bufSize = p_cfg->def_heap_buf_size;
569 nwalLocCfg.txPktPool.bufPool[0].heapHandle = pkt_heap;
571 memcpy(&p->nwalLocCfg,&nwalLocCfg,sizeof(nwalLocCfg_t));
572 while(1)
573 {
574 nwalRetVal = nwal_start(p_nwal_glob_context->nwalInstHandle,&nwalLocCfg);
575 if(nwalRetVal == nwal_ERR_INVALID_STATE)
576 {
577 continue;
578 }
579 break;
580 }
582 if(nwalRetVal != nwal_OK)
583 {
584 netapi_Log (">nwal_start:Failed ->err %d !!!\n", nwalRetVal);
585 return -1;
586 }
587 p->state = NETAPI_NW_CXT_LOC_ACTIVE;
588 return 1;
591 }
592 /***********************************************************************
593 * FUNCTION PURPOSE: Internal NETAPI function to initialize the 64 bit timer.
594 ***********************************************************************
595 * DESCRIPTION: Internal NETAPI function to initialize the 64 bit timer. for tci6614 ONLY
596 **********************************************************************/
597 int netapip_initTimer(void)
598 {
599 #ifdef CORTEX_A8
600 return t64_start();
601 #else
602 return 0;
603 #endif
604 }
609 /***************************************************************************
610 * FUNCTION PURPOSE: NETAPI internal function for virtual memory allocation.
611 ***************************************************************************
612 * DESCRIPTION: NETAPI internal function for virtual memory allocation.
613 **************************************************************************/
615 static uint8_t* netapip_sharedMemoryMalloc(uint32_t size)
616 {
617 //printf("netapip_sharedMemoryMalloc called for size: %d\n", size);
618 return (uint8_t *)hplib_vmMemAlloc(size +
619 pnetapiShm->netapi_global.cfg.def_heap_extra_size ,
620 128,
621 0);
622 }
624 /********************************************************************
625 * FUNCTION PURPOSE: NETAPI internal function for virtual memory free.
626 ********************************************************************
627 * DESCRIPTION: NETAPI internal function for virtual memory free.
628 ********************************************************************/
629 static void netapip_sharedMemoryFree(uint8_t* ptr, uint32_t size)
630 {
631 /* Do Nothing. */
632 //printf("netapip_sharedMemoryMalloc called for size: %d\n", size);
633 //hplib_vmMemFree(ptr, size + pnetapiShm->netapi_global.cfg.def_heap_extra_size,0);
634 netapi_Log("netapi Unexpected. need to provide a free () for some reason!! \n");
635 return;
636 }
638 //defensive: clean out stuff hanging around
639 //
640 // open a bunch of free queues and zap them
641 #define NQUEUES2CLEAR 35
642 static Qmss_QueueHnd tempQH[NQUEUES2CLEAR];
643 void netapip_cleanupAtStart(void)
644 {
645 int i;
646 uint8_t isAllocated;
648 for(i=0;i<NQUEUES2CLEAR;i++)
649 {
650 tempQH[i] = Qmss_queueOpen(Qmss_QueueType_GENERAL_PURPOSE_QUEUE,
651 QMSS_PARAM_NOT_SPECIFIED, &isAllocated);
652 netapip_zapQ(tempQH[i]);
653 }
655 for(i=0;i<NQUEUES2CLEAR;i++)
656 {
657 Qmss_queueClose(tempQH[i]);
658 }
659 }
663 /********************************************************************
664 * FUNCTION PURPOSE: NETAPI internal function system initialization
665 ********************************************************************
666 * DESCRIPTION: NETAPI internal function system initialization
667 ********************************************************************/
668 int netapip_systemInit(NETAPI_HANDLE_T * handle,
669 Bool global_master_process)
670 {
672 int32_t result;
673 Pktlib_HeapHandle sharedHeapHandle;
674 Pktlib_HeapHandle controlRxHeapHandle,controlTxHeapHandle;
675 Pktlib_HeapCfg heapCfg;
676 int32_t errCode = 0;
677 int count=0;
679 #ifdef NETAPI_USE_DDR
680 /* Init attributes for DDR */
681 netapi_VM_MempoolAttr[0].attr = HPLIB_ATTR_KM_CACHED0;
682 netapi_VM_MempoolAttr[0].phys_addr = 0;
683 netapi_VM_MempoolAttr[0].size = 0;
685 /* Init attributes for un-cached MSMC */
686 netapi_VM_MempoolAttr[1].attr = HPLIB_ATTR_UN_CACHED;
687 netapi_VM_MempoolAttr[1].phys_addr = CSL_MSMC_SRAM_REGS;
688 netapi_VM_MempoolAttr[1].size = TUNE_NETAPI_PERM_MEM_SZ;
689 #else
690 netapi_VM_MempoolAttr[1].attr = HPLIB_ATTR_KM_CACHED0;
691 netapi_VM_MempoolAttr[1].phys_addr = 0;
692 netapi_VM_MempoolAttr[1].size = 0;
694 /* Init attributes for un-cached MSMC */
695 netapi_VM_MempoolAttr[0].attr = HPLIB_ATTR_UN_CACHED;
696 netapi_VM_MempoolAttr[0].phys_addr = CSL_MSMC_SRAM_REGS;
697 netapi_VM_MempoolAttr[0].size = TUNE_NETAPI_PERM_MEM_SZ;
698 #endif
699 /* initialize all the memory we are going to use
700 - chunk for buffers, descriptors
701 - memory mapped peripherals we use, such as QMSS, PA, etc */
702 result = hplib_vmInit(&netapi_VM_VirtAddr[0],
703 2,
704 &netapi_VM_MempoolAttr[0]);
706 if (result == hplib_OK)
707 netapi_Log("netapip_systemInit: - hplib_vmInit pass\n");
708 else
709 {
710 netapi_Log("netapip_systemInit: - hplib_vmInit fail\n");
711 return -1;
712 }
716 if (global_master_process == NETAPI_TRUE)
717 {
718 hplib_initMallocArea(0);
719 hplib_initMallocArea(1);
720 }
721 else
722 {
723 if (hplib_checkMallocArea(0) != hplib_OK)
724 return -1;
725 if (hplib_checkMallocArea(1) != hplib_OK)
726 return -1;
727 }
730 if(global_master_process == NETAPI_FALSE)
731 {
732 /****************************************************
733 * partial initialization. For process, not for SOC
734 ***************************************************/
736 /* Start the QMSS. */
737 if (netapip_startQm(pnetapiShm->netapi_global.cfg.rmHandle) != 1)
738 {
739 netapi_Log("netapip_systemInit: returned from netapip_startQm with failure\n");
740 return -1;
741 }
743 //open shared heap handle but create new controlRx & Tx heaps for this
744 //process
745 netapi_pktlib_ifTable.data_malloc = netapip_sharedMemoryMalloc;
746 netapi_pktlib_ifTable.data_free = netapip_sharedMemoryFree;
747 sharedHeapHandle = Pktlib_findHeapByName("netapi");
748 if (!sharedHeapHandle) { netapi_Log(">'netapi' Pktlib_findHeapByName failed\n");return -1;}
749 handle->netcp_heap= sharedHeapHandle;
751 /* Update for Control */
752 heapCfg.name = "netapi_control_rx";/*todo:add random#*/
753 heapCfg.sharedHeap = 1;
754 heapCfg.dataBufferSize = TUNE_NETAPI_CONFIG_MAX_CTL_RXTX_BUF_SIZE;
755 heapCfg.numPkts = TUNE_NETAPI_CONFIG_NUM_CTL_RX_BUF;
756 heapCfg.numZeroBufferPackets= 0;
757 controlRxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
758 if (!controlRxHeapHandle) { netapi_Log("netapi -'netapi_control_rx' heap create failed, Error Code: %d\n",errCode); return -1;}
759 handle->netcp_control_rx_heap= controlRxHeapHandle;
760 heapCfg.name = "netapi_control_tx";
761 heapCfg.numPkts = TUNE_NETAPI_CONFIG_NUM_CTL_TX_BUF;
762 controlTxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
763 if (!controlTxHeapHandle) { netapi_Log("netapi -'netapi_control_tx' heap create failed, Error Code: %d\n",errCode); return -1;}
764 handle->netcp_control_tx_heap= controlTxHeapHandle;
766 /* Common Initialization for all threads in process */
767 while(count < TUNE_NETAPI_MAX_NUM_TRANS)
768 {
769 netapi_proc_global.nwal_context.transInfos[count].transId = count;
770 count++;
771 }
772 result = netapip_startNwal(sharedHeapHandle,
773 controlRxHeapHandle,
774 controlTxHeapHandle,
775 &handle->nwal_local,
776 &pnetapiShm->netapi_global.cfg,
777 &pnetapiShm->netapi_global.nwal_context);
778 if (result<0)
779 {
780 netapi_Log("netapi start_nwal() failed\n");
781 return -1;
782 }
783 netapi_Log("netapip_systemInit: returned from netapip_startNwal\n");
784 }
786 #ifdef NETAPI_ENABLE_SECURITY
787 #define SEC_CONTEXT_SZ 384 //not tunable
788 /* allocate 2x number of tunnels since we need one for inflow and one for data mode */
789 netapi_VM_SaContextVaddr = hplib_vmMemAlloc((TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2 *
790 SEC_CONTEXT_SZ), 128, 0);
791 if (!netapi_VM_SaContextVaddr)
792 {
793 netapi_Log("netapip_systemInit: Failed to map SA context memory region\n");
794 return (-1);
795 }
796 netapi_Log("netapip_systemInit: SA Memory mapped/allocated at address %p.\n", netapi_VM_SaContextVaddr);
798 #else
799 netapi_VM_SaContextVaddr= (char *) NULL;
800 #endif
802 /* (3) Allocate 2 QM regions from continguous chunk above */
803 netapi_VM_QMemGlobalDescRam =
804 (void *)hplib_vmMemAlloc((TUNE_NETAPI_NUM_GLOBAL_DESC *
805 TUNE_NETAPI_DESC_SIZE),
806 128, 0);
808 netapi_VM_QMemLocalDescRam =
809 (void *)hplib_vmMemAlloc((TUNE_NETAPI_NUM_LOCAL_DESC *
810 TUNE_NETAPI_DESC_SIZE),
811 128, 0);
812 netapi_Log("netapip_systemInit: desc region=%x global desc region=%x\n", netapi_VM_QMemLocalDescRam, netapi_VM_QMemGlobalDescRam);
814 //get timer running
815 #ifdef CORTEX_A8
816 netapip_initTimer();
817 netapi_Log("netapip_systemInit: returned from netapip_initTimer\n");
818 #endif
820 /* Initialize Queue Manager Sub System */
821 result = netapip_initQm (pnetapiShm->netapi_global.cfg.def_max_descriptors,
822 pnetapiShm->netapi_global.cfg.rmHandle);
824 if (result != 1)
825 {
826 netapi_Log("netapip_systemInit: returned from netapip_initQm with failure\n");
827 return -1;
828 }
830 /* Start the QMSS. */
831 if (netapip_startQm(pnetapiShm->netapi_global.cfg.rmHandle) != 1)
832 {
833 netapi_Log("netapip_systemInit: returned from netapip_startQm with failure\n");
834 return -1;
835 }
838 //clean our old junk in 1st bunch of queues that will be allocated to us
839 netapip_cleanupAtStart();
840 /* Initialize the global descriptor memory region. */
841 result= netapip_qmSetupMemRegion(
842 pnetapiShm->netapi_global.cfg.def_tot_descriptors_for_us,
843 TUNE_NETAPI_DESC_SIZE,
844 (unsigned int *) netapi_VM_QMemGlobalDescRam,
845 TUNE_NETAPI_QM_GLOBAL_REGION);
846 if(result <0)
847 {
848 netapi_Log("netapip_systemInit: can't setup QM shared region\n");
849 return -1;
850 }
852 /* Initialize CPPI CPDMA */
854 result = netapip_initCppi(pnetapiShm->netapi_global.cfg.rmHandle);
855 if (result != 1)
856 {
857 netapi_Log ("netapi: Error initializing CPPI SubSystem error code : %d\n",result);
858 return -1;
859 }
861 /* CPPI and Queue Manager are initialized. */
862 netapi_Log ("netapi: Queue Manager and CPPI are initialized.\n");
864 /* create main pkt heap */
865 /* Initialize the Shared Heaps. */
866 Pktlib_sharedHeapInit();
867 /* Populate the heap interface table. */
868 netapi_pktlib_ifTable.data_malloc = netapip_sharedMemoryMalloc;
869 netapi_pktlib_ifTable.data_free = netapip_sharedMemoryFree;
871 /* Initialize the heap configuration. */
872 memset ((void *)&heapCfg, 0, sizeof(Pktlib_HeapCfg));
873 /* Populate the heap configuration */
874 heapCfg.name = "netapi";
875 heapCfg.memRegion = TUNE_NETAPI_QM_GLOBAL_REGION;
876 heapCfg.sharedHeap = 1;
877 heapCfg.useStarvationQueue = 0;
878 heapCfg.dataBufferSize = pnetapiShm->netapi_global.cfg.def_heap_buf_size;
879 heapCfg.numPkts = pnetapiShm->netapi_global.cfg.def_heap_n_descriptors;
880 heapCfg.numZeroBufferPackets= pnetapiShm->netapi_global.cfg.def_heap_n_zdescriptors;
881 heapCfg.heapInterfaceTable.data_malloc = netapi_pktlib_ifTable.data_malloc;
882 heapCfg.heapInterfaceTable.data_free = netapi_pktlib_ifTable.data_free;
883 heapCfg.dataBufferPktThreshold = 0;
884 heapCfg.zeroBufferPktThreshold = 0;
886 /* Create Shared Heap with specified configuration. */
887 sharedHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
888 //todo -> cleanup on failure
889 if (!sharedHeapHandle) { netapi_Log(">'netapi' heap create failed, Error Code: %d\n",errCode); return -1;}
890 handle->netcp_heap= sharedHeapHandle;
892 /* Update for Control */
893 heapCfg.name = "netapi_control_rx";
894 heapCfg.sharedHeap = 1;
895 heapCfg.dataBufferSize = TUNE_NETAPI_CONFIG_MAX_CTL_RXTX_BUF_SIZE;
896 heapCfg.numPkts = TUNE_NETAPI_CONFIG_NUM_CTL_RX_BUF;
897 heapCfg.numZeroBufferPackets= 0;
899 controlRxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
900 //todo -> cleanup on failure
901 if (!controlRxHeapHandle) { netapi_Log("netapi -'netapi_control_rx' heap create failed, Error Code: %d\n",errCode); return -1;}
902 handle->netcp_control_rx_heap= controlRxHeapHandle;
905 heapCfg.name = "netapi_control_tx";
906 heapCfg.numPkts = TUNE_NETAPI_CONFIG_NUM_CTL_TX_BUF;
908 controlTxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
909 //todo -> cleanup on failure
910 if (!controlTxHeapHandle) { netapi_Log("netapi -'netapi_control_tx' heap create failed, Error Code: %d\n",errCode); return -1;}
911 handle->netcp_control_tx_heap= controlTxHeapHandle;
913 /* now NWAL */
914 result = netapip_initNwal(TUNE_NETAPI_QM_GLOBAL_REGION,
915 &netapi_pktlib_ifTable,
916 &pnetapiShm->netapi_global.nwal_context,
917 &pnetapiShm->netapi_global.cfg);
919 if (result<0) {netapi_Log("netapi init_nwal() failed\n"); return -1; }
920 netapi_Log("netapip_systemInit: returned from netapip_initNwal\n");
921 /* start NWAL */
924 /* Common Initialization for all cores */
925 while(count < TUNE_NETAPI_MAX_NUM_TRANS)
926 {
927 netapi_proc_global.nwal_context.transInfos[count].transId = count;
928 count++;
929 }
930 result = netapip_startNwal(sharedHeapHandle,
931 controlRxHeapHandle,
932 controlTxHeapHandle,
933 &handle->nwal_local,
934 &pnetapiShm->netapi_global.cfg,
935 &pnetapiShm->netapi_global.nwal_context);
936 if (result<0) {netapi_Log("netapi start_nwal() failed\n"); return -1; }
937 netapi_Log("netapip_systemInit: returned from netapip_startNwal\n");
938 return 0;
939 }
942 /****************************************************************************
943 * FUNCTION PURPOSE: NETAPI internal function which performs clean for linux user space
944 ****************************************************************************
945 * DESCRIPTION: NETAPI internal function which performs clean for linux user space
946 ***************************************************************************/
947 void netapip_zapQ(int queueNum)
948 {
949 int i;
950 if (!queueNum)
951 {
952 return;
953 }
954 for (i=0;;i+=1 )
955 {
956 /* Pop descriptor from source queue */
957 if (pktio_mQmssQueuePopRaw(queueNum) == NULL)
958 {
959 break;
960 }
961 }
962 }
965 /****************************************************************************
966 * FUNCTION PURPOSE: NETAPI internal function to display internal heap stats.
967 ****************************************************************************
968 * DESCRIPTION: NETAPI internal function to display internal heap stats.
969 ***************************************************************************/
970 void netapi_dump_internal_heap_stats(void)
971 {
972 Pktlib_HeapStats pktLibHeapStats;
973 Pktlib_getHeapStats(netapi_get_global()->nwal_context.pa2sa_heap,&pktLibHeapStats);
974 printf("PA2SA(ingress) stats> #free=%d #zb=%d #garbage=%d\n", pktLibHeapStats.numFreeDataPackets,
975 pktLibHeapStats.numZeroBufferPackets, pktLibHeapStats.numPacketsinGarbage);
976 printf(" > #dataBufThreshStatus=%d #dataBufStarvCounter=%d #zBufThreshStatus=%d #zBufStarvCounter=%d \n",
977 pktLibHeapStats.dataBufferThresholdStatus,pktLibHeapStats.dataBufferStarvationCounter,
978 pktLibHeapStats.zeroDataBufferThresholdStatus, pktLibHeapStats.zeroDataBufferStarvationCounter);
979 #if 0
980 Pktlib_getHeapStats(netapi_get_global()->nwal_context.pa2saTX_heap,&pktLibHeapStats);
981 netapi_Log("PA2SA(egress) stats> #free=%d #zb=%d #garbage=%d\n", pktLibHeapStats.numFreeDataPackets,
982 pktLibHeapStats.numZeroBufferPackets, pktLibHeapStats.numPacketsinGarbage);
983 netapi_Log(" > #dataBufThreshStatus=%d #dataBufStarvCounter=%d #zBufThreshStatus=%d #zBufStarvCounter=%d \n",
984 pktLibHeapStats.dataBufferThresholdStatus,pktLibHeapStats.dataBufferStarvationCounter,
985 pktLibHeapStats.zeroDataBufferThresholdStatus, pktLibHeapStats.zeroDataBufferStarvationCounter);
986 #endif
987 Pktlib_getHeapStats(netapi_get_global()->nwal_context.sa2pa_heap,&pktLibHeapStats);
988 printf("SA2PA stats> #free=%d #zb=%d #garbage=%d\n", pktLibHeapStats.numFreeDataPackets,
989 pktLibHeapStats.numZeroBufferPackets, pktLibHeapStats.numPacketsinGarbage);
990 printf(" > #dataBufThreshStatus=%d #dataBufStarvCounter=%d #zBufThreshStatus=%d #zBufStarvCounter=%d \n",
991 pktLibHeapStats.dataBufferThresholdStatus,pktLibHeapStats.dataBufferStarvationCounter,
992 pktLibHeapStats.zeroDataBufferThresholdStatus, pktLibHeapStats.zeroDataBufferStarvationCounter);
994 }