]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/netapi.git/commitdiff
Multi-core/multi thread changes
authorTinku Mannan <tmannan@ti.com>
Thu, 6 Dec 2012 19:26:09 +0000 (14:26 -0500)
committerTinku Mannan <tmannan@ti.com>
Thu, 6 Dec 2012 19:26:09 +0000 (14:26 -0500)
ti/runtime/netapi/build/Makefile
ti/runtime/netapi/src/netapi.c
ti/runtime/netapi/src/netapi_vm.c [deleted file]
ti/runtime/netapi/src/netapi_vm.h [deleted file]
ti/runtime/netapi/test/net_test.c
ti/runtime/netapi/test/net_test.h

index f6b0976f8b908fc093658a7ac806bf188bccb30d..93662c66afa5a445ffe7f6a00c914a9365316294 100755 (executable)
@@ -40,6 +40,7 @@ VPATH=$(SRCDIR):$(NETAPI_NAVIG_INIT_SRC)
 CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc -c
 AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar -r
 
+CSL_DEVICE ?= -DDEVICE_K2H
 
 #List the COMMONSRC Files
 COMMONSRCC = \
index 2639f12561035ace6e49ce46be844f03f1375c55..9914a79bc4e786cd25b070294f2934adc7f5e0ef 100755 (executable)
@@ -236,7 +236,7 @@ static int system_init(NETAPI_HANDLE_T * handle)
     Pktlib_HeapHandle   controlRxHeapHandle,controlTxHeapHandle;    
     Pktlib_HeapCfg      heapCfg;
     int32_t             errCode;
-
+#ifdef NETAPI_USE_DDR
     /* Init attributes for DDR */
     netapi_VM_MempoolAttr[0].attr = HPLIB_ATTR_KM_CACHED0;
     netapi_VM_MempoolAttr[0].phys_addr = 0;
@@ -246,6 +246,16 @@ static int system_init(NETAPI_HANDLE_T * handle)
     netapi_VM_MempoolAttr[1].attr = HPLIB_ATTR_UN_CACHED;
     netapi_VM_MempoolAttr[1].phys_addr = CSL_MSMC_SRAM_REGS;
     netapi_VM_MempoolAttr[1].size = TUNE_NETAPI_PERM_MEM_SZ;
+#else
+    netapi_VM_MempoolAttr[1].attr = HPLIB_ATTR_KM_CACHED0;
+    netapi_VM_MempoolAttr[1].phys_addr = 0;
+    netapi_VM_MempoolAttr[1].size = 0;
+
+       /* Init attributes for un-cached MSMC */
+    netapi_VM_MempoolAttr[0].attr = HPLIB_ATTR_UN_CACHED;
+    netapi_VM_MempoolAttr[0].phys_addr = CSL_MSMC_SRAM_REGS;
+    netapi_VM_MempoolAttr[0].size = TUNE_NETAPI_PERM_MEM_SZ;
+#endif
     /* initialize all the memory we are going to use
        - chunk for buffers, descriptors
        - memory mapped peripherals we use, such as QMSS, PA, etc */
@@ -268,6 +278,9 @@ static int system_init(NETAPI_HANDLE_T * handle)
         return (-1);
     }
     printf(">hplib VM_SaContext: Memory mapped/allocated at address %p.\n", netapi_VM_SaContextVaddr);
+//    *netapi_VM_SaContextVaddr = 'x';
+//    printf(" system Init: value being read  %c\n", netapi_VM_SaContextVaddr);
+//    *netapi_VM_SaContextVaddr = 0;
 
 #else
    netapi_VM_SaContextVaddr= (char *) NULL;
@@ -284,27 +297,34 @@ static int system_init(NETAPI_HANDLE_T * handle)
                                                             (void *)hplib_vmMemAlloc((TUNE_NETAPI_NUM_LOCAL_DESC *
                                                                                                         TUNE_NETAPI_DESC_SIZE),
                                                                                                         128, 0);
-    printf(">netapi local desc region=%x global desc region=%x\n", netapi_VM_QMemLocalDescRam, netapi_VM_QMemGlobalDescRam);
+    printf("netapi local desc region=%x global desc region=%x\n", netapi_VM_QMemLocalDescRam, netapi_VM_QMemGlobalDescRam);
 
     //get timer running
+#ifdef CORTEX_A8
     netapi_init_timer();
+#endif
+     printf("system_init: returned from netapi_init_timer\n");
 
     /* Initialize Queue Manager Sub System */
     result = netapi_init_qm (netapi_global.cfg.def_max_descriptors); 
+    
     if (result != 1)
     {
+         printf("system_init: returned from netapi_init_qm with failure\n");
         return -1;
     }
 
     /* Start the QMSS. */
     if (netapi_start_qm() != 1)
     {
+      printf("system_init: returned from netapi_start_qm with failure\n");
         return -1;
     }
+    
 
     //clean our old junk in 1st bunch of queues that will be allocated to us
     netapi_cleanup_at_start();
-
+ printf("system_init: returned from netapi_cleanup_at_start\n");
     /* Initialize the global descriptor memory region. */
     result= netapi_qm_setup_mem_region( 
                       netapi_global.cfg.def_tot_descriptors_for_us,
@@ -313,6 +333,7 @@ static int system_init(NETAPI_HANDLE_T * handle)
                       NETAPI_GLOBAL_REGION);
     if(result <0) {printf(">netapi; can't setup QM shared region\n"); return -1;}
 
+printf(">system_init: returned from netapi_qm_setup_mem_region\n");
 #if 0 //todo setup 2nd region
 /* Initialize the local memory region configuration. */
     result= netapi_qm_setup_mem_region( 
@@ -325,6 +346,7 @@ static int system_init(NETAPI_HANDLE_T * handle)
     /* Initialize CPPI CPDMA */
 
     result = netapi_init_cppi ();
+    printf(">system_init: returned from netapi_init_cppi\n");
     if (result != 1)
     {
         printf (">netapi: Error initializing CPPI SubSystem error code : %d\n",result);
@@ -337,7 +359,7 @@ static int system_init(NETAPI_HANDLE_T * handle)
     /* create main pkt heap */
     /* Initialize the Shared Heaps. */
     Pktlib_sharedHeapInit();
-
+    printf(">system_init: returned from Pktlib_sharedHeapInit\n");
     /* Populate the heap interface table. */
     netapi_pktlib_ifTable.data_malloc             = netapiSharedMemoryMalloc;
     netapi_pktlib_ifTable.data_free               = netapiSharedMemoryFree;
@@ -359,6 +381,7 @@ static int system_init(NETAPI_HANDLE_T * handle)
 
     /* Create Shared Heap with specified configuration. */
     sharedHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
+     printf(">system_init: returned from Pktlib_createHeap1\n");
     //todo -> cleanup on failure
     if (!sharedHeapHandle) { printf(">'netapi' heap create failed, Error Code: %d\n",errCode); return -1;}
     handle->netcp_heap= sharedHeapHandle;
@@ -372,6 +395,7 @@ static int system_init(NETAPI_HANDLE_T * handle)
     heapCfg.numZeroBufferPackets= 0;
 
     controlRxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
+     printf(">system_init: returned from Pktlib_createHeap2\n");
    //todo -> cleanup on failure
    if (!controlRxHeapHandle) { printf(">netapi -'netapi_control_rx' heap create failed, Error Code: %d\n",errCode); return -1;}
    handle->netcp_control_rx_heap= controlRxHeapHandle;
@@ -381,6 +405,7 @@ static int system_init(NETAPI_HANDLE_T * handle)
    heapCfg.numPkts             = TUNE_NETAPI_CONFIG_NUM_CTL_TX_BUF;
 
    controlTxHeapHandle = Pktlib_createHeap(&heapCfg, &errCode);
+    printf(">system_init: returned from Pktlib_createHeap3\n");
    //todo -> cleanup on failure
    if (!controlTxHeapHandle) { printf(">netapi -'netapi_control_tx' heap create failed, Error Code: %d\n",errCode); return -1;}
    handle->netcp_control_tx_heap= controlTxHeapHandle;
@@ -392,7 +417,7 @@ static int system_init(NETAPI_HANDLE_T * handle)
                               &netapi_global.nwal_context,
                               &netapi_global.cfg);
     if (result<0) {printf(">netapi  init_nwal() failed\n"); return -1; }
-
+ printf(">system_init: returned from netapi_init_nwal\n");
     /* start NWAL */
     result = netapi_start_nwal(sharedHeapHandle, 
                                controlRxHeapHandle,
@@ -401,6 +426,7 @@ static int system_init(NETAPI_HANDLE_T * handle)
                                &netapi_global.cfg,
                                &netapi_global.nwal_context);
     if (result<0) {printf(">netapi start_nwal() failed\n"); return -1; }
+    printf(">system_init: returned from netapi_start_nwal\n");
     //** success **
 
 
diff --git a/ti/runtime/netapi/src/netapi_vm.c b/ti/runtime/netapi/src/netapi_vm.c
deleted file mode 100755 (executable)
index b732255..0000000
+++ /dev/null
@@ -1,374 +0,0 @@
-
-/******************************************************************************
- * FILE  netapi_vm.c
- * PURPOSE:  Memory allocator for NETAPI and related utilities
- *   -- using MSMC for descriptors/buffers (current), use CMA (future) 
- ******************************************************************************
- * FILE NAME:   netapi_vm.c
- *
- * DESCRIPTION: Memory allocator for netapi 
- * This is only a permanent memory allocator.
- *
- * REVISION HISTORY:
- *
- *  Copyright (c) Texas Instruments Incorporated 2010-2011
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include <ti/drv/nwal/nwal.h> 
-#include "netapi_vm.h"
-#include <sys/ioctl.h>
-#include "tools/module/netapimod.h"
-
-
-/***********************RAW MEMORY ALLOCATION & TRANSLATION*************************/
-/* Macro to align x to y */
-#define align(x,y)   ((x + y) & (~y))
-
-#define NETAPI_PERM_MEM_SZ  (TUNE_NETAPI_PERM_MEM_SZ) 
-
-
-
-#define MSMC_SRAM_BASE_ADDR CSL_MSMC_SRAM_REGS
-uint8_t *netapi_VM_mem_start_phy = (uint8_t*)0;
-uint8_t *netapi_VM_mem_start = (uint8_t*)0;
-uint8_t *netapi_VM_mem_end = (uint8_t*)0;
-uint8_t *netapi_VM_mem_end_phy = (uint8_t*)0;
-static uint8_t *netapi_VM_mem_alloc_ptr = (uint8_t*)0;
-static uint32_t netapi_VM_mem_size = 0;
-
-
-/* File descriptor for /dev/mem */ 
-static int dev_mem_fd;
-static int  our_netapi_module_fd;
-#define USE_MODULE_MMAP  //we will mmap through netapi kernel module, not /dev/mem
-#ifndef USE_MODULE_MMAP
-static int temp_fd;
-#endif
-
-//inialize the allocate area.
-nwal_Bool_t netapi_VM_memAllocInit
-(
-    uint8_t     *addr, /* Physical address */
-    uint32_t    size   /* Size of block */
-)
-{
-    void *map_base; 
-
-    //always open dev/mem, since we need for QM, CPPI, etc
-    if((dev_mem_fd = open("/dev/mem", (O_RDWR | O_SYNC))) == -1)
-    {
-        printf(">netapi_VM_memAllocInit: Failed to open \"dev/mem\" err=%s\n",
-               strerror(errno));
-        return nwal_FALSE;
-    }
-
-#ifdef NETAPI_USE_MSMC
-    // memory map in addr to addr+size  (msmc)
-    map_base = netapi_VM_memMap ((void *)addr, size); 
-
-    if (!map_base)
-    {
-        printf(">netapi_VM_memAllocInit: Failed to mmap addr (0x%x)", addr);
-        return nwal_FALSE;
-    }
-
-    printf(">netapi_VM_memAllocInit (uncached msmc) Phy Addr %x Memory (%d bytes) mapped at address %p.\n", addr,size,  map_base); 
-#else  
-    //use cached DDR.  This requires NETAPI kernel module
-    our_netapi_module_fd=netapi_utilModInit();
-
-    if (our_netapi_module_fd == -1) {
-        printf(">netapi_VM_memAllocInit: failed to open /dev/netapi: '%s'\n", strerror(errno));
-        return nwal_FALSE;
-    }
-    addr=  ( uint8_t *) netapi_utilGetPhysOfBufferArea();  //get address that was allocated for us by kernela module */
-    size = netapi_utilGetSizeOfBufferArea();   //get the size that was allocated
-#ifdef USE_MODULE_MMAP
-    map_base = (void *) netapi_utilGetVaOfBufferArea(NETAPIMOD_MMAP_DMA_MEM_OFFSET, size); //mmap into our space, return va
-#else
-    if(  (temp_fd = open("/dev/mem", O_RDWR )) == -1) {
-      printf(">netapi_VM_memAllocInit: failed to open dev/mem again cached err=%d\n",errno);
-      return nwal_FALSE; 
-    }
-
-    map_base = mmap(0,size , PROT_READ | PROT_WRITE, MAP_SHARED, temp_fd, addr);
-    if(map_base == (void *) -1) {
-       printf(">netapi_VM_memAllocInit: failed to mmap CMA area at phy %x err=%d\n",
-                    addr, errno); 
-       return nwal_FALSE;
-    }
-#endif
-    printf(">netapi_VM_memAllocInit: (cached ddr) Phy Addr %x Memory (%d bytes) mapped at address %p.\n", addr,size,  map_base); 
-#endif
-
-    netapi_VM_mem_alloc_ptr = netapi_VM_mem_start = map_base;
-    netapi_VM_mem_size = size;
-    netapi_VM_mem_end = netapi_VM_mem_start + netapi_VM_mem_size;
-    netapi_VM_mem_start_phy = addr;
-    netapi_VM_mem_end_phy = netapi_VM_mem_start_phy + netapi_VM_mem_size;
-    return nwal_TRUE;
-}
-
-//utility to return free amount in buffer/descriptor area
-int  netapi_getBufMemRemainder(void)
-{
-  return (int) ((unsigned int) netapi_VM_mem_end) -  ((unsigned int) netapi_VM_mem_alloc_ptr);
-}
-
-
-//------------------------------------------------------------------------
-//allocator function for our Buffer/Descriptor/SAcontext area (either MSMC
-//or kernel module provided CMA area in DDR
-//-----------------------------------------------------------------------
-void* netapi_VM_memAlloc
-(
-    uint32_t    size,
-    uint32_t    align
-)
-{
-    uint32_t key;
-    uint8_t *alloc_ptr;
-    void *p_block =NULL;
-
-    Osal_stubCsEnter();
-    alloc_ptr = (uint8_t*)align((uint32_t)netapi_VM_mem_alloc_ptr, align);
-    if ((alloc_ptr + size) < netapi_VM_mem_end)
-    {
-        p_block =(void *)alloc_ptr;
-        netapi_VM_mem_alloc_ptr = alloc_ptr + size;
-        Osal_stubCsExit(key);
-        memset (p_block, 0, size);
-    }
-    else 
-    {
-        Osal_stubCsExit(key);
-    }
-    return p_block;
-}
-uint32_t    xtraLogs=0;
-/* Api to map the give physical address to virtual memory space */
-void *netapi_VM_memMap
-(
-    void        *addr, /* Physical address */
-    uint32_t    size   /* Size of block */
-)
-{
-    void            *map_base,*virt_addr,*tmpAddr;
-    uint32_t        page_sz;
-    long            retval;
-    uint32_t        mask = (size-1);
-    uint32_t        offset;
-
-    retval = sysconf(_SC_PAGE_SIZE);
-    if (retval == -1)
-    {
-        printf(">netapi_VM_memMap: Failed to get page size err=%s\n",
-               strerror(errno));
-        return (void *)0;
-    }
-
-    page_sz = (uint32_t)retval;
-
-    if (size%page_sz)
-    {
-        printf(">netapi_VM_memMap: error: block size not aligned to page size\n");
-        return (void *)0;
-    }
-
-    if ((uint32_t)addr%page_sz)
-    {
-        printf(">netapi_VM_memMap: error: addr not aligned to page size\n");
-        return (void *)0;
-    }
-
-    map_base = mmap(0, size, (PROT_READ|PROT_WRITE), MAP_SHARED, dev_mem_fd, (off_t)addr & ~mask);
-    if(map_base == (void *) -1) 
-    {
-        printf(">netapi_VM_memMap: Failed to mmap \"dev/mem\" err=%s\n",
-               strerror(errno));
-        return (void *)0;
-    }
-    virt_addr = map_base + ((off_t)addr & mask);
-    if(xtraLogs)
-    {
-        printf(">netapi_VM_memMap:Memory mapped Begin Address 0x%x Read Value: 0x%x.\n", virt_addr,*((unsigned long *)virt_addr));
- //       offset = size/(sizeof(unsigned long));
-  //      tmpAddr = (unsigned long *)virt_addr + offset-1;
-        tmpAddr = (uint8_t *)virt_addr + 0x6800c;
-        printf("netapi_VM_memMap:Memory mapped End Address 0x%x Read Value: 0x%x.\n", (unsigned long *)tmpAddr ,*((unsigned long *)tmpAddr));
-        *((unsigned long *)tmpAddr) = 0x1234;
-        printf("netapi_VM_memMap:Memory mapped End Address 0x%x Write Value: 0x%x.\n", (unsigned long *)tmpAddr ,*((unsigned long *)tmpAddr));
-        
-    }
-    return(virt_addr);
-}
-
-/***************************************************************/
-/*************** Memory Initilaization**************************/
-/***************************************************************/
-/* for now use msmc */
-/* Total Permanent memory required in NWAL test
- * for Packet buffers & descriptor buffers
- */
-/* Global variables to hold virtual address of various subsystems */
-void *netapi_VM_qmssCfgVaddr;
-void *netapi_VM_qmssDataVaddr;
-void *netapi_VM_srioCfgVaddr;
-void *netapi_VM_passCfgVaddr;
-
-/* also for our descriptor area */
-unsigned char *netapi_VM_QMemLocalDescRam=NULL;
-unsigned char *netapi_VM_QMemGlobalDescRam=NULL;
-
-/* finaly SA context area */
-unsigned char *netapi_VM_SaContextVaddr=NULL;
-
-/************************************************
- * teardown VM memory
- ***********************************************/
-void netapi_VM_memory_teardown(void)
-{
-  netapi_utilModClose();
-  close(dev_mem_fd);
-#ifndef USE_MODULE_MMAP
-  close(temp_fd);
-#endif
-}
-/*************************************************
- * setup VM memory
- ************************************************/
-int netapi_VM_memory_setup(void)
-{
-/* (1) big chunck of memory out of MSMC or DDR via kernel CMA */
-#ifdef NETAPI_USE_DDR
- if (netapi_VM_memAllocInit( NULL, 0) == nwal_FALSE) {
-        printf(">netapi ERROR: netapi_V_MmemAllocInit from DDR/CMA failed\n");
-        return (-1);
-    }
-#else  //uncached MSMC 
-    if (netapi_VM_memAllocInit((uint8_t*)MSMC_SRAM_BASE_ADDR,
-                              NETAPI_PERM_MEM_SZ) == nwal_FALSE) {
-        printf(">netapi ERROR: netapi_V_MmemAllocInit from MSMC failed\n");
-        return (-1);
-    }
-#endif
-
-    /* (2) Create virtual memory maps for peripherals */
-    /* (2a) QMSS CFG Regs */
-    netapi_VM_qmssCfgVaddr = netapi_VM_memMap((void*)QMSS_CFG_BASE_ADDR,
-                                            QMSS_CFG_BLK_SZ);
-    if (!netapi_VM_qmssCfgVaddr)
-    {
-        printf(">netapi ERROR: Failed to map QMSS CFG registers\n");
-        return (-1);
-    }
-    printf(">netapi QMSS_CFG_BASE_ADDR:0x%x Memory mapped at address %p.\n",(void*)QMSS_CFG_BASE_ADDR, netapi_VM_qmssCfgVaddr);
-
-    /* (2b) QMSS DATA Regs */
-#ifdef USE_MODULE_MMAP
-    netapi_VM_qmssDataVaddr = (void *) netapi_utilGetVaOfBufferArea(NETAPIMOD_MMAP_QM_DATA_REG_MEM_OFFSET, QMSS_DATA_BLK_SZ);
-#else
-    netapi_VM_qmssDataVaddr = netapi_VM_memMap((void*)QMSS_DATA_BASE_ADDR,
-                                            QMSS_DATA_BLK_SZ);
-#endif
-
-    if (!netapi_VM_qmssDataVaddr)
-    {
-        printf(">netapi ERROR: Failed to map QMSS DATA registers\n");
-        return (-1);
-    }
-    printf(">netapi QMSS_DATA_BASE_ADDR:0x%x Memory mapped at address %p.\n",(void*)QMSS_DATA_BASE_ADDR, netapi_VM_qmssDataVaddr);
-
-    /* (2c)  SRIO CFG Regs */
-    netapi_VM_srioCfgVaddr = netapi_VM_memMap((void*)SRIO_CFG_BASE_ADDR,
-                                            SRIO_CFG_BLK_SZ);
-    if (!netapi_VM_srioCfgVaddr)
-    {
-        printf(">netapi ERROR: Failed to map SRIO CFG registers\n");
-        return (-1);
-    }
-    printf(">netapi SRIO_CFG_BASE_ADDR:0x%x Memory mapped at address %p.\n",(void*)SRIO_CFG_BASE_ADDR, netapi_VM_srioCfgVaddr);
-
-    /* (2d) PASS CFG Regs */
-    netapi_VM_passCfgVaddr = netapi_VM_memMap((void*)PASS_CFG_BASE_ADDR,
-                                            PASS_CFG_BLK_SZ);
-    if (!netapi_VM_passCfgVaddr)
-    {
-        printf(">netapi ERROR: Failed to map PASS CFG registers\n");
-        return (-1);
-    }
-    printf(">netapi PASS_CFG_BASE_ADDR:0x%x Memory mapped at address %p.\n",(void*)PASS_CFG_BASE_ADDR, netapi_VM_passCfgVaddr);
-
-    /* (2e)  SA COntext area */
-#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 = netapi_VM_memAlloc((TUNE_NETAPI_MAX_NUM_IPSEC_CHANNELS*2 *
-                                        SEC_CONTEXT_SZ),
-                                       128);
-   if (!netapi_VM_SaContextVaddr)
-    {
-        printf(">netapi ERROR: Failed to map SA context memory region\n");
-        return (-1);
-    }
-    printf(">netapi VM_SaContext: Memory mapped/allocated at address %p.\n", netapi_VM_SaContextVaddr);
-
-#else
-   netapi_VM_SaContextVaddr= (char *) NULL;
-#endif
-
-    /* (2f) Timer */
-    t64_memmap(dev_mem_fd);
-
-    /* (3) Allocate 2 QM regions from continguous chunk above */
-    netapi_VM_QMemGlobalDescRam = (void *)netapi_VM_memAlloc((TUNE_NETAPI_NUM_GLOBAL_DESC *
-                                        TUNE_NETAPI_DESC_SIZE),
-                                        128);
-    netapi_VM_QMemLocalDescRam = (void *)netapi_VM_memAlloc((TUNE_NETAPI_NUM_LOCAL_DESC *
-                                        TUNE_NETAPI_DESC_SIZE),
-                                        128);
-    printf(">netapi local desc region=%x global desc region=%x\n", netapi_VM_QMemLocalDescRam,netapi_VM_QMemGlobalDescRam);
-
-       return 1;
-
-}
-
diff --git a/ti/runtime/netapi/src/netapi_vm.h b/ti/runtime/netapi/src/netapi_vm.h
deleted file mode 100755 (executable)
index b9fbcdf..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/************************************************
- * FILE: netapi_vm.h
- * PURPOSE: netapi [virtual] memory management
- ************************************************/
-#ifndef __NETAPI_VM_H__
-#define __NETAPI_VM_H__
-#include "netapi_tune.h"
-#include "ti/drv/nwal/nwal.h"
-#include "netapi_util.h"
-
-#ifndef CSL_PA_SS_CFG_REGS
-#define CSL_PA_SS_CFG_REGS  CSL_NETCP_CFG_REGS
-#endif
-#ifndef CSL_PA_SS_CFG_CP_ACE_CFG_REGS
-#define CSL_PA_SS_CFG_CP_ACE_CFG_REGS (CSL_NETCP_CFG_REGS + 0xC0000)
-#endif
-
-/* Physical address map & size for various subsystems */
-#ifdef CSL_QM_SS_CFG_QUE_PEEK_REGS
-/* PDK Version 2 */
-#define QMSS_CFG_BASE_ADDR  CSL_QM_SS_CFG_QUE_PEEK_REGS
-#define QMSS_CFG_BLK_SZ (1*1024*1024)
-#define QMSS_DATA_BASE_ADDR 0x44020000
-#define QMSS_DATA_ARM_PROXY_QUEUE_DEQUEUE_REGS (0x44040000)
-#define QMSS_DATA_BLK_SZ (0x60000)
-#define SRIO_CFG_BASE_ADDR  CSL_SRIO_CONFIG_REGS
-#define PASS_CFG_BASE_ADDR  CSL_PA_SS_CFG_REGS
-#else
-#define QMSS_CFG_BASE_ADDR  CSL_QMSS_CFG_BASE
-#define QMSS_CFG_BLK_SZ ((CSL_QMSS_LINKING_RAM - CSL_QMSS_CFG_BASE) + 0x100000)
-#define QMSS_DATA_BASE_ADDR CSL_QMSS_DATA_QM1_QUEUE_MANAGEMENT_REGS
-#define QMSS_DATA_BASE_QUEUE_PROXY_ADDR CSL_QMSS_DATA_BASE
-#define QMSS_DATA_BLK_SZ ((CSL_QMSS_DATA_QM2_QUEUE_PROXY_REGS - QMSS_DATA_BASE_QUEUE_PROXY_ADDR) + 0x50000)
-#define SRIO_CFG_BASE_ADDR  CSL_SRIO_CFG_REGS
-#define PASS_CFG_BASE_ADDR  CSL_NETCP_CFG_REGS
-
-#endif
-#define PASS_CFG_BLK_SZ (1*1024*1024)
-#define SRIO_CFG_BLK_SZ (132*1024)
-
-/* Function to initialize memory allocator */
-nwal_Bool_t netapi_VM_memAllocInit
-(
-    uint8_t     *addr, /* Physical address */
-    uint32_t    size   /* Size of block */
-);
-
-/* Function to allocate memory */
-void* netapi_VM_memAlloc
-(
-    uint32_t    size, /* Size of block needed */
-    uint32_t    align /* Alignment of the block needed */
-);
-
-
-/* Function to map the give physical address to virtual memory space */
-void *netapi_VM_memMap
-(
-    void        *addr, /* Physical address */
-    uint32_t    size   /* Size of block */
-);
-
-//todo: put in netapi global region somewhere
-
-/* Global variables to hold virtual address of various hw subsystems */
-extern void *netapi_VM_qmssCfgVaddr;
-extern void *netapi_VM_qmssDataVaddr;
-extern void *netapi_VM_srioCfgVaddr;
-extern void *netapi_VM_passCfgVaddr;
-
-
-
-//qm regions: netapi defines two regions, 0,1
-extern unsigned char *netapi_VM_QMemLocalDescRam;
-extern unsigned char *netapi_VM_QMemGlobalDescRam;
-
-//SA context region
-extern unsigned char *netapi_VM_SaContextVaddr;
-
-
-#endif
-
index 3e1b8f1c06ff8c449a110a7c585e69621638d67f..cfd49f7cc3002cb780df7d49d2c854056540a35c 100755 (executable)
@@ -120,7 +120,6 @@ void dump_header(unsigned long *p, int n, int a, int r)
    printf("-----------------------------\n");
 }
 
-
 static void  netapi_dump_buf
 (
     unsigned long *                      buf,
@@ -515,8 +514,8 @@ NETAPI_SEC_SA_INFO_T rx_sa [7] = {
     nwal_IPV4, //v4
     { 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },  /* Src IP (them) -> set below */
     { 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },  /* dst IP (us)-> set below*/
-    0,/* replayWindow */
-    NWAL_SA_AALG_NULL,
+    64,/* replayWindow */
+    NWAL_SA_AALG_HMAC_SHA2_256,
     NWAL_SA_EALG_3DES_CBC,
     0,0  //na
 },
@@ -568,7 +567,7 @@ NETAPI_SEC_SA_INFO_T rx_sa [7] = {
     { 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },  /* Src IP (them) -> set below */
     { 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },  /* dst IP (us)-> set below*/
     64,/* replayWindow */
-    NWAL_SA_AALG_GMAC,
+    NWAL_SA_AALG_AES_XCBC,
     NWAL_SA_EALG_NULL,
     0,0  //na
 }
@@ -610,8 +609,8 @@ NETAPI_SEC_SA_INFO_T tx_sa[7]= {
     nwal_IPV4, //v4
     { 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },  /* Src IP (us) -> set below */
     { 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },  /* dst IP (them) -> set below*/
-    0, /* NA replayWindow */
-    NWAL_SA_AALG_NULL,
+    64, /* NA replayWindow */
+    NWAL_SA_AALG_HMAC_SHA2_256,
     NWAL_SA_EALG_3DES_CBC,
     0,0  //seq no
 },
@@ -662,12 +661,13 @@ NETAPI_SEC_SA_INFO_T tx_sa[7]= {
     { 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },  /* Src IP (them) -> set below */
     { 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },  /* dst IP (us)-> set below*/
     64,/* replayWindow */
-    NWAL_SA_AALG_GMAC,
+    NWAL_SA_AALG_AES_XCBC,
     NWAL_SA_EALG_NULL,
     0,0  //na
 }
 };
 
+
 static nwalSecKeyParams_t ourTXKeyParams[7] ={
 {
     32, /* encKeySize: CTR 16 bytes Encryption Key and 4 bytes Salt : 24 bytes:NWAL_SA_EALG_3DES_CBC and 0 bytes Salt*/
@@ -683,7 +683,7 @@ static nwalSecKeyParams_t ourTXKeyParams[7] ={
 },
 {
     24, /* encKeySize: DES-CBC: 24 bytes:NWAL_SA_EALG_3DES_CBC and 0 bytes Salt*/
-    0, /* macKeySize: 16 bytes NWAL_SA_AALG_HMAC_SHA2_256 */
+    32, /* macKeySize: 16 bytes NWAL_SA_AALG_HMAC_SHA2_256 */
     NULL, //set below
     NULL, //set below
 },
@@ -707,7 +707,7 @@ static nwalSecKeyParams_t ourTXKeyParams[7] ={
 },
 {
     0, /* encKeySize: CTR 16 bytes Encryption Key and 3 bytes Salt : 24 bytes:NWAL_SA_EALG_AES_CTR and 0 bytes Salt*/
-    24, /* macKeySize 0*/
+    16, /* macKeySize 0*/
     NULL, //set below
     NULL, //set below
 }
@@ -729,7 +729,7 @@ static nwalSecKeyParams_t ourRXKeyParams[7] ={
 },
 {
     24, /* encKeySize: DES-CBC: 24 bytes:NWAL_SA_EALG_3DES_CBC and 0 bytes Salt*/
-    0, /* macKeySize: 16 bytes NWAL_SA_AALG_HMAC_SHA2_256 */
+    32, /* macKeySize: 16 bytes NWAL_SA_AALG_HMAC_SHA2_256 */
     NULL, //set below
     NULL, //set below
 },
@@ -753,7 +753,7 @@ static nwalSecKeyParams_t ourRXKeyParams[7] ={
 },
 {
     0, /* encKeySize: CTR 16 bytes Encryption Key and 3 bytes Salt : 24 bytes:NWAL_SA_EALG_AES_CTR and 0 bytes Salt*/
-    24, /* macKeySize 0*/
+    16, /* macKeySize 0*/
     NULL, //set below
     NULL, //set below
 }
@@ -1287,7 +1287,7 @@ void flip_and_send_pkt(Ti_Pkt *tip,  unsigned char * p_pkt, int len, int flag)
        }
 else
  {
-  //inflow tx
+  //INFLOW TX *******************
   //send pkt directly, asking for IP and UDP checksum offloads AND IPSEC to be applied
            PKTIO_METADATA_T meta = {PKTIO_META_TX,{0},0};
            int err;
@@ -1320,14 +1320,11 @@ if (len <1500)
            //meta_tx.txFlag1 = (NWAL_TX_FLAG1_DO_IPV4_CHKSUM|NWAL_TX_FLAG1_DO_UDP_CHKSUM| NWAL_TX_FLAG1_DO_IPSEC_ESP_CRYPTO| NWAL_TX_FLAG1_META_DATA_VALID );
            meta_tx.txFlag1 = p_sa_info->tx_pkt_info.txFlag1;
            meta_tx.enetPort=0;
-           //meta_tx.saOffBytes=14+20;  
+
            meta_tx.saOffBytes=  p_sa_info->tx_pkt_info.saOffBytes;
            meta_tx.saPayloadLen=len-14-20;   //don't include tag, mac and outer header
-           //meta_tx.startOffset = 0;
            meta_tx.startOffset = p_sa_info->tx_pkt_info.startOffset;
-           //meta_tx.ipOffBytes = 14+20+8+16;   //to inner header
            meta_tx.ipOffBytes =p_sa_info->tx_payload_info.encOffset; 
-           //meta_tx.l4OffBytes = 14+20+8+16+20; //to L4
            meta_tx.l4OffBytes = p_sa_info->tx_pkt_info.l4OffBytes;
            meta_tx.l4HdrLen = p_sa_info->tx_pkt_info.l4HdrLen;
            meta_tx.ploadLen = (unsigned) ((p_pkt[meta_tx.l4OffBytes+4]<<8)|p_pkt[meta_tx.l4OffBytes+4+1]) -8 ;
@@ -1722,9 +1719,11 @@ int coreid=0;
 #endif
             continue;
         }
-        else 
+        else
+        {
             //inflow mode.  flip and send
             flip_and_send_pkt(tip,p_pkt,len,1);
+        }
     }
     else if ((p_head->ip[2]&0x0000ff00)!=0x00001100)
     {
@@ -2294,13 +2293,11 @@ void  build_sa_db(int i)
 
         tmp_spi = htonl((long)(tx_sa[i].spi));
          trie_insert(p_trie_sa,(char *)&tmp_spi,4, (void *) &sa_info[i]); //asociate with tx sa SPI
-         printf("*********** build_sa_db(): spi %d,0x%x\n", tx_sa[i].spi,tx_sa[i].spi);;
          
          
     }
     else if ((tx_sa[i].authMode == NWAL_SA_AALG_HMAC_SHA2_256) && (tx_sa[i].cipherMode == NWAL_SA_EALG_AES_CTR))
     {
-        printf("inside build_sa_db, index %d\n", i);
         /* static configuration, will not change */
         sa_info[i].tx_payload_info.aadSize = 0;
         sa_info[i].tx_payload_info.pAad = NULL;
@@ -2344,11 +2341,10 @@ void  build_sa_db(int i)
         sa_info[i].tx_pkt_info.pseudoHdrChecksum =0;
        
         sa_info[i].tx_pkt_info.txFlag1 = NWAL_TX_FLAG1_DO_IPSEC_ESP_CRYPTO| NWAL_TX_FLAG1_DO_UDP_CHKSUM| NWAL_TX_FLAG1_META_DATA_VALID ;
-
         tmp_spi = htonl((long)(tx_sa[i].spi));
          trie_insert(p_trie_sa,(char *)&tmp_spi,4, (void *) &sa_info[i]); //asociate with tx sa SPI
     }
-    else if ((tx_sa[i].authMode == NWAL_SA_AALG_NULL) && (tx_sa[i].cipherMode == NWAL_SA_EALG_3DES_CBC))
+    else if ((tx_sa[i].authMode == NWAL_SA_AALG_HMAC_SHA2_256) && (tx_sa[i].cipherMode == NWAL_SA_EALG_3DES_CBC))
     {
         /* static configuration, will not change */
         sa_info[i].tx_payload_info.aadSize = 0;
@@ -2368,7 +2364,7 @@ void  build_sa_db(int i)
 
         sa_info[i].cipherMode = NWAL_SA_EALG_3DES_CBC;
         sa_info[i].inner_ip_offset = sa_info[i].tx_payload_info.encOffset;
-        sa_info[i].auth_tag_size = 0;  /* icv or mac size,. always 12 except for AES_CCM/AES_GCM */
+        sa_info[i].auth_tag_size = netTest_ICV_LEN;  /* icv or mac size,. always 12 except for AES_CCM/AES_GCM */
 #ifdef EXPERIMENTAL
         sa_info[i].iv_len=8;
         sa_info[i].bl=8;
@@ -2539,11 +2535,11 @@ void  build_sa_db(int i)
         sa_info[i].tx_pkt_info.pseudoHdrChecksum =0;
        
         sa_info[i].tx_pkt_info.txFlag1 = NWAL_TX_FLAG1_DO_IPSEC_ESP_CRYPTO| NWAL_TX_FLAG1_DO_UDP_CHKSUM| NWAL_TX_FLAG1_META_DATA_VALID ;
-
+        
         tmp_spi = htonl((long)(tx_sa[i].spi));
          trie_insert(p_trie_sa,(char *)&tmp_spi,4, (void *) &sa_info[i]); //asociate with tx sa SPI
     }
-    else if ((tx_sa[i].authMode == NWAL_SA_AALG_GMAC) && (rx_sa[i].cipherMode == NWAL_SA_EALG_NULL))
+    else if ((tx_sa[i].authMode == NWAL_SA_AALG_AES_XCBC) && (rx_sa[i].cipherMode == NWAL_SA_EALG_NULL))
     {
         /* static configuration, will not change */
         sa_info[i].tx_payload_info.aadSize = 0;
@@ -2555,7 +2551,7 @@ void  build_sa_db(int i)
         sa_info[i].tx_payload_info.encOffset =         netTest_MAC_HEADER_LEN +
                                                                      netTest_IP_HEADER_LEN +
                                                                     netTest_ESP_HEADER_LEN +
-                                                                    netTest_AES_GMAC_IV_LEN;
+                                                                    netTest_NULL_IV_LEN;
 #ifdef EXPERIMENTAL
         sa_info[i].iv_len=0;
         sa_info[i].bl=4;
@@ -2573,9 +2569,9 @@ void  build_sa_db(int i)
         sa_info[i].tx_payload_info.pPkt = 0;
 
         sa_info[i].cipherMode = NWAL_SA_EALG_NULL;
-        sa_info[i].authMode = NWAL_SA_AALG_GMAC;
+        sa_info[i].authMode = NWAL_SA_AALG_AES_XCBC;
         sa_info[i].inner_ip_offset = sa_info[i].tx_payload_info.encOffset;
-        sa_info[i].auth_tag_size = netTest_AES_GMAC_ICV_LEN;  /* icv or mac size,. always 12 except for AES_CCM/AES_GCM , GMAC*/
+        sa_info[i].auth_tag_size = netTest_ICV_LEN;  /* icv or mac size,. always 12 except for AES_CCM/AES_GCM , GMAC*/
 
         sa_info[i].tx_pkt_info.enetPort = 0;
         sa_info[i].tx_pkt_info.ipOffBytes = sa_info[i].tx_payload_info.encOffset;
@@ -2590,7 +2586,7 @@ void  build_sa_db(int i)
         sa_info[i].tx_pkt_info.pseudoHdrChecksum =0;
        
         sa_info[i].tx_pkt_info.txFlag1 = NWAL_TX_FLAG1_DO_IPSEC_ESP_CRYPTO| NWAL_TX_FLAG1_DO_UDP_CHKSUM| NWAL_TX_FLAG1_META_DATA_VALID ;
-
+        
         tmp_spi = htonl((long)(tx_sa[i].spi));
          trie_insert(p_trie_sa,(char *)&tmp_spi,4, (void *) &sa_info[i]); //asociate with tx sa SPI
     }
@@ -2840,44 +2836,65 @@ NETAPI_T worker_nh[TUNE_NETAPI_NUM_CORES];
 void slow_path_thread(int coreid)
 {
     int err;
+
     printf("slow_path_thread, mypid: %d\n", gettid());
+
+    CPU_ZERO( &cpu_set);
+#ifdef CORTEX_15
+    CPU_SET( coreid, &cpu_set);
     hplib_Util_SetupCore(coreid, &cpu_set);
+#else
+      CPU_SET( 0, &cpu_set);
+    hplib_Util_SetupCore(0, &cpu_set);
+#endif
     worker_nh[coreid]=netapi_init(NETAPI_NO_MASTER,NULL);
     netapi_setCookie(worker_nh[coreid],coreid);
     our_core=coreid;
     scheduler[coreid] =netapi_schedOpen(worker_nh[coreid],&our_sched_cfg, &err);
-    if (!scheduler[coreid]) {printf("sched create failed for core%d\n",coreid); exit(1);}
-
-
-
-/*********************************************/
-/**************Entry point into scheduler ****/
-/*********************************************/
-netapi_schedWaitForEvents(scheduler[coreid], &err);
-printf(">net_test: core %d worker thread done\n",coreid);
-netapi_shutdown(worker_nh[coreid]);
-
+    if (!scheduler[coreid]) 
+    {
+        printf("sched create failed for core%d\n",coreid); 
+        exit(1);
+    }
+            /*********************************************/
+    /**************Entry point into scheduler ****/
+    /*********************************************/
+    netapi_schedWaitForEvents(scheduler[coreid], &err);
+    printf(">net_test: core %d worker thread done\n",coreid);
+    netapi_shutdown(worker_nh[coreid]);
 }
+
 void fast_path_thread(int coreid)
 {
     int err;
+
+    #ifdef CORTEX_15
+    CPU_SET( coreid, &cpu_set);
+        hplib_Util_SetupCore(coreid, &cpu_set);
+#else
+      CPU_SET( 0, &cpu_set);
+    hplib_Util_SetupCore(0, &cpu_set);
+#endif
     printf("fast_path_thread, mypid: %d\n", gettid());
     hplib_Util_SetupCore(coreid, &cpu_set);
     worker_nh[coreid]=netapi_init(NETAPI_NO_MASTER,NULL);
-    netapi_setCookie(worker_nh[coreid],(void *)coreid);
+    netapi_setCookie(worker_nh[coreid],coreid);
     our_core=coreid;
     scheduler[coreid] =netapi_schedOpen(worker_nh[coreid],&our_sched_cfg, &err);
-    if (!scheduler[coreid]) {printf("sched create failed for core%d\n",coreid); exit(1);}
-
-;
+    if (!scheduler[coreid]) 
+        {
+        printf("sched create failed for core%d\n",coreid); 
+        exit(1);
+    }
 
-/*********************************************/
-/**************Entry point into scheduler ****/
-/*********************************************/
-netapi_schedWaitForEvents(scheduler[coreid], &err);
-printf(">net_test: core %d worker thread done\n",coreid);
-netapi_shutdown(worker_nh[coreid]);
+    /*********************************************/
+    /**************Entry point into scheduler ****/
+    /*********************************************/
+    netapi_schedWaitForEvents(scheduler[coreid], &err);
+    printf(">net_test: core %d worker thread done\n",coreid);
+    netapi_shutdown(worker_nh[coreid]);
 }
+
 #endif
 static  netTestConfigFile_t config_file;
 /***************************************
@@ -2886,16 +2903,15 @@ static  netTestConfigFile_t config_file;
 int main(int argc, char **argv)
 {
     int err,i;
+    Pktlib_HeapCfg      heapCfg;
     rlim_t oss,ss = 1024*1024;
     struct rlimit rl;
-
-    Pktlib_HeapCfg      heapCfg;
     int32_t             errCode;
     Pktlib_HeapIfTable*  pPktifTable;
 
     FILE * fpr = NULL;
 
-
+    
     err= getrlimit(RLIMIT_STACK,&rl);
     if (!err) printf(" stack limit = %d\n",rl.rlim_cur); else printf("getrlimit failed\n");
 
@@ -2908,33 +2924,18 @@ int main(int argc, char **argv)
 
      /* install signal handler for ^c */
     signal(SIGINT,mysig);
-#if 1
 
-#if 0
-    if (argc >= 2
+    fpr = fopen(input_file_name, "r");
+    if (fpr == NULL
     {
-        fpr = fopen(argv[2], "r");
-        if (fpr == NULL) 
-        {
-            printf("Error in opening %s input file\n", argv[2]);
-        }
-    } 
+        printf("Error in opening %s input file\n", input_file_name);
+        exit(1);
+    }
     else
-#endif
     {
-        fpr = fopen(input_file_name, "r");
-        if (fpr == NULL) 
-        {
-            printf("Error in opening %s input file\n", input_file_name);
-        }
-        else
-        {
-            parse_config_file(fpr,&config_file);
-        }
+        parse_config_file(fpr,&config_file);
     }
 
-#endif
-
     memset(&sa_info, 0, sizeof(sa_info));
 
 
@@ -2945,19 +2946,10 @@ int main(int argc, char **argv)
         memcpy(&testPkt[26],&real_ip_addr[0],8);//overrite test pkt ip addresses
     }
 
-
     /* assign main net_test thread to run on core 0 */
+    CPU_ZERO( &cpu_set);
     CPU_SET( 0, &cpu_set);
-
-    if (sched_setaffinity( gettid(), sizeof( cpu_set_t ), &cpu_set ))
-    {
-        perror( "sched_setaffinity" );
-        printf("main() , sched_setaffinity error\n");
-        exit(1);
-    }
-
-    hplib_Util_Init_NetapiProc();
-
+    hplib_Util_SetupCore(0, &cpu_set);
 
     /* create netapi */
     netapi_handle = netapi_init(NETAPI_SYS_MASTER, &our_netapi_default_cfg);
@@ -3013,13 +3005,21 @@ exit(1);
 
     /* open netcp default tx, rx queues */
     netcp_tx_chan= pktio_open(netapi_handle, NETCP_TX, NULL, &netcp_tx_cfg,  &err);
-    if (!netcp_tx_chan) {printf("pktio open TX failed err=%d\n",err); exit(1);}
+    if (!netcp_tx_chan)
+    {
+        printf("pktio open TX failed err=%d\n",err);
+        exit(1);
+    }
 #ifdef EXPERIMENTAL
     netcp_rx_chan= pktio_open(netapi_handle, NETCP_RX, (PKTIO_CB) recv_cb_router, &netcp_rx_cfg,  &err);
 #else
     netcp_rx_chan= pktio_open(netapi_handle, NETCP_RX, (PKTIO_CB) recv_cb, &netcp_rx_cfg,  &err);
 #endif
-    if (!netcp_rx_chan) {printf("pktio open RX failed err=%d\n",err); exit(1);}
+    if (!netcp_rx_chan)
+    {
+        printf("pktio open RX failed err=%d\n",err);
+        exit(1);
+    }
 
 #ifndef EXPERIMENTAL
     /* create a pktio channel for specially classified pkts */
@@ -3028,9 +3028,17 @@ exit(1);
 
     /* open netcp default tx, rx queues for sideband crypto */
     netcp_sb_tx_chan= pktio_open(netapi_handle, NETCP_SB_TX, NULL, &netcp_sb_tx_cfg,  &err);
-    if (!netcp_sb_tx_chan) {printf("pktio open SB TX failed err=%d\n",err); exit(1);}
+    if (!netcp_sb_tx_chan)
+    {
+        printf("pktio open SB TX failed err=%d\n",err);
+        exit(1);
+    }
     netcp_sb_rx_chan= pktio_open(netapi_handle, NETCP_SB_RX, (PKTIO_CB) recv_sb_cb, &netcp_sb_rx_cfg,  &err);
-    if (!netcp_sb_rx_chan) {printf("pktio open SB RX failed err=%d\n",err); exit(1);}
+    if (!netcp_sb_rx_chan)
+    {
+        printf("pktio open SB RX failed err=%d\n",err);
+        exit(1);
+    }
 #endif
 
     printf("net_test> %d bytes left in our CMA area\n", netapi_getBufMemRemainder());
@@ -3252,6 +3260,7 @@ if (err) {printf("addclass2 failed %d\n",err); exit(1);}
 if (err) {printf("addTxSa failed %d\n",err); exit(1);}
 
 #ifdef NET_TEST_ENABLE_SIDE_BAND_LOW_LEVEL_API
+
     /* Remember the NetCP Command Label so save cycles per Crypto 
      * operation
      * 
index 731af229e7975966cdf63304b8d57dc9d01fba57..f2517c137dcb4571af05fee3b3382e78aa56b850 100755 (executable)
@@ -41,7 +41,7 @@
 /* ============================================================= */
 
 
-#define MAX_SEC_INDEX                   6
+#define MAX_SEC_INDEX                   7
 
 
 //IPSEC MODE(only choose one rx and one tx)