summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cf0ee29)
raw | patch | inline | side by side (parent: cf0ee29)
author | Eric Ruei <e-ruei1@ti.com> | |
Fri, 30 Aug 2013 14:45:57 +0000 (10:45 -0400) | ||
committer | Eric Ruei <e-ruei1@ti.com> | |
Fri, 30 Aug 2013 14:45:57 +0000 (10:45 -0400) |
139 files changed:
diff --git a/example/emacExample/PA_emacExample_K2L_exampleProject.txt b/example/emacExample/k2e/c66/bios/PA_emacExample_K2E_exampleProject.txt
similarity index 100%
rename from example/emacExample/PA_emacExample_K2L_exampleProject.txt
rename to example/emacExample/k2e/c66/bios/PA_emacExample_K2E_exampleProject.txt
rename from example/emacExample/PA_emacExample_K2L_exampleProject.txt
rename to example/emacExample/k2e/c66/bios/PA_emacExample_K2E_exampleProject.txt
diff --git a/example/emacExample/cpsw_example_k2l.cfg b/example/emacExample/k2e/c66/bios/cpsw_example_k2e.cfg
similarity index 100%
rename from example/emacExample/cpsw_example_k2l.cfg
rename to example/emacExample/k2e/c66/bios/cpsw_example_k2e.cfg
rename from example/emacExample/cpsw_example_k2l.cfg
rename to example/emacExample/k2e/c66/bios/cpsw_example_k2e.cfg
similarity index 100%
rename from example/emacExample/cpsw_linker.cmd
rename to example/emacExample/k2e/c66/bios/cpsw_linker.cmd
rename from example/emacExample/cpsw_linker.cmd
rename to example/emacExample/k2e/c66/bios/cpsw_linker.cmd
diff --git a/example/emacExample/singlecore_osal.c b/example/emacExample/k2e/c66/bios/singlecore_osal.c
similarity index 100%
rename from example/emacExample/singlecore_osal.c
rename to example/emacExample/k2e/c66/bios/singlecore_osal.c
rename from example/emacExample/singlecore_osal.c
rename to example/emacExample/k2e/c66/bios/singlecore_osal.c
diff --git a/example/emacExample/PA_emacExample_exampleProject.txt b/example/emacExample/k2l/c66/bios/PA_emacExample_K2L_exampleProject.txt
similarity index 92%
rename from example/emacExample/PA_emacExample_exampleProject.txt
rename to example/emacExample/k2l/c66/bios/PA_emacExample_K2L_exampleProject.txt
index f76164bff750372b1e1118d788317990d794635f..cf6d96196c98361ec4e64facc721023c9835bb3c 100644 (file)
rename from example/emacExample/PA_emacExample_exampleProject.txt
rename to example/emacExample/k2l/c66/bios/PA_emacExample_K2L_exampleProject.txt
index f76164bff750372b1e1118d788317990d794635f..cf6d96196c98361ec4e64facc721023c9835bb3c 100644 (file)
-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg0_pdsp1_bin.c"
-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg0_pdsp2_bin.c"
-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg1_pdsp0_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg1_pdsp0_bin.c"
+-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg2_pdsp0_bin.c"
-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/cppi/device/k2l/src/cppi_device.c"
-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/qmss/device/k2l/src/qmss_device.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/example/emacExample/cpsw_example.cfg"
--ccs.setCompilerOptions "-D -mv64+ -g -dDEVICE_K2L --diag_warning=225 -I${PASS_INSTALL_PATH} -I${PASS_INSTALL_PATH}/ti/drv/pa/example/emacExample -I${PDK_INSTALL_PATH}/ti/drv/cppi -I${PDK_INSTALL_PATH}/ti/drv/qmss" -rtsc.enableRtsc
+-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/example/emacExample/cpsw_example_k2l.cfg"
+-ccs.setCompilerOptions "-D -mv64+ -g -DDEVICE_K2L --diag_warning=225 -I${PASS_INSTALL_PATH} -I${PASS_INSTALL_PATH}/ti/drv/pa/example/emacExample -I${PDK_INSTALL_PATH}/ti/drv/cppi -I${PDK_INSTALL_PATH}/ti/drv/qmss" -rtsc.enableRtsc
diff --git a/example/emacExample/cpsw_example.cfg b/example/emacExample/k2l/c66/bios/cpsw_example_k2l.cfg
similarity index 95%
rename from example/emacExample/cpsw_example.cfg
rename to example/emacExample/k2l/c66/bios/cpsw_example_k2l.cfg
index 932e30c815d2fb3fd65590e68bd094d646abce42..b925ee2592d6bd13e7e1102e04523d47eb428063 100644 (file)
rename from example/emacExample/cpsw_example.cfg
rename to example/emacExample/k2l/c66/bios/cpsw_example_k2l.cfg
index 932e30c815d2fb3fd65590e68bd094d646abce42..b925ee2592d6bd13e7e1102e04523d47eb428063 100644 (file)
var ECM = xdc.useModule('ti.sysbios.family.c64p.EventCombiner');
/* Load the CSL package */
-var Csl = xdc.loadPackage('ti.csl');
+var devType = "k2l"
+var Csl = xdc.useModule('ti.csl.Settings');
+Csl.deviceType = devType;
/* Load the CPPI package */
var Cppi = xdc.loadPackage('ti.drv.cppi');
diff --git a/example/multicoreExample/multicore_linker.cmd b/example/emacExample/k2l/c66/bios/cpsw_linker.cmd
similarity index 100%
rename from example/multicoreExample/multicore_linker.cmd
rename to example/emacExample/k2l/c66/bios/cpsw_linker.cmd
rename from example/multicoreExample/multicore_linker.cmd
rename to example/emacExample/k2l/c66/bios/cpsw_linker.cmd
diff --git a/example/emacExample/k2l/c66/bios/singlecore_osal.c b/example/emacExample/k2l/c66/bios/singlecore_osal.c
--- /dev/null
@@ -0,0 +1,744 @@
+/**
+ * @file singlecore_osal.c
+ *
+ * @brief
+ * This is a sample OS Abstraction Layer (AL) file implemented
+ * using XDC/BIOS APIs.
+ *
+ * System integrator is advised to review these implementations and
+ * modify them to suit it to application requirements.
+ *
+ * This OSAL implementation uses the <b> Approach 1 </b> documented.
+ *
+ * \par
+ * ============================================================================
+ * @n (C) Copyright 2009, Texas Instruments, Inc.
+ *
+ * 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.
+ *
+*/
+/* Standard C-native includes */
+#include <stdlib.h>
+#include <string.h>
+
+/* XDC/BIOS includes */
+#include <xdc/std.h>
+#include <xdc/runtime/IHeap.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/hal/Hwi.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/heaps/HeapBuf.h>
+#include <ti/sysbios/heaps/HeapMem.h>
+
+#include <xdc/cfg/global.h>
+
+/* CSL CHIP, SEM Functional layer includes */
+#include <ti/csl/csl_chip.h>
+#include <ti/csl/csl_semAux.h>
+
+/* CSL Cache module includes */
+#include <ti/csl/csl_cacheAux.h>
+/* CSL XMC module includes */
+#include <ti/csl/csl_xmcAux.h>
+
+/**********************************************************************
+ ****************************** Defines *******************************
+ **********************************************************************/
+
+#define MAX_NUM_CORES 8
+
+/* Hardware Semaphore to synchronize access from
+ * multiple applications (PA applications and non-PASS applications)
+ * across different cores to the QMSS library.
+ */
+#define QMSS_HW_SEM 3
+
+/* Hardware Semaphore to synchronize access from
+ * multiple applications (PASS applications and non-PASS applications)
+ * across different cores to the CPPI library.
+ */
+#define CPPI_HW_SEM 4
+
+/* Hardware Semaphore to synchronize access from
+ * multiple applications (PASS applications and non-PASS applications)
+ * across different cores to the PA library.
+ */
+#define PA_HW_SEM 5
+
+#undef L2_CACHE
+#ifdef L2_CACHE
+ /* Invalidate L2 cache. This should invalidate L1D as well.
+ * Wait until operation is complete. */
+#define SYS_CACHE_INV(addr, size, code) CACHE_invL2 (addr, size, code)
+
+ /* Writeback L2 cache. This should Writeback L1D as well.
+ * Wait until operation is complete. */
+#define SYS_CACHE_WB(addr, size, code) CACHE_wbL2 (addr, size, code)
+
+#else
+ /* Invalidate L1D cache and wait until operation is complete.
+ * Use this approach if L2 cache is not enabled */
+#define SYS_CACHE_INV(addr, size, code) CACHE_invL1d (addr, size, code)
+ /* Writeback L1D cache and wait until operation is complete.
+ * Use this approach if L2 cache is not enabled */
+#define SYS_CACHE_WB(addr, size, code) CACHE_wbL1d (addr, size, code)
+
+#endif
+
+
+/**********************************************************************
+ ************************** Global Variables **************************
+ **********************************************************************/
+UInt32 cpswCppiMallocCounter = 0;
+UInt32 cpswCppiFreeCounter = 0;
+UInt32 cpswQmssMallocCounter = 0;
+UInt32 cpswQmssFreeCounter = 0;
+
+UInt32 coreKey [MAX_NUM_CORES];
+
+/**********************************************************************
+ *********************** CPPI OSAL Functions **************************
+ **********************************************************************/
+
+/**
+ * ============================================================================
+ * @n@b Osal_cppiCsEnter
+ *
+ * @b brief
+ * @n This API ensures multi-core and multi-threaded
+ * synchronization to the caller.
+ *
+ * This is a BLOCKING API.
+ *
+ * This API ensures multi-core synchronization between
+ * multiple processes trying to access CPPI shared
+ * library at the same time.
+ *
+ * @param[in]
+ * @n None
+ *
+ * @return
+ * @n Handle used to lock critical section
+ * =============================================================================
+ */
+Ptr Osal_cppiCsEnter (Void)
+{
+ /* Get the hardware semaphore.
+ *
+ * Acquire Multi core CPPI synchronization lock
+ */
+ while ((CSL_semAcquireDirect (CPPI_HW_SEM)) == 0);
+
+ /* Disable all interrupts and OS scheduler.
+ *
+ * Acquire Multi threaded / process synchronization lock.
+ */
+ coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)] = Hwi_disable();
+
+ return NULL;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_cppiCsExit
+ *
+ * @b brief
+ * @n This API needs to be called to exit a previously
+ * acquired critical section lock using @a Osal_cppiCsEnter ()
+ * API. It resets the multi-core and multi-threaded lock,
+ * enabling another process/core to grab CPPI access.
+ *
+ * @param[in] CsHandle
+ * Handle for unlocking critical section.
+ *
+ * @return None
+ * =============================================================================
+ */
+Void Osal_cppiCsExit (Ptr CsHandle)
+{
+ /* Enable all interrupts and enables the OS scheduler back on.
+ *
+ * Release multi-threaded / multi-process lock on this core.
+ */
+ Hwi_restore(coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)]);
+
+ /* Release the hardware semaphore
+ *
+ * Release multi-core lock.
+ */
+ CSL_semReleaseSemaphore (CPPI_HW_SEM);
+
+ return;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_cppiMalloc
+ *
+ * @b brief
+ * @n This API allocates a memory block of a given
+ * size specified by input parameter 'num_bytes'.
+ *
+ * This API should allocate memory from shared memory if the test applications
+ * are to be run on multiple cores.
+ *
+ * @param[in] num_bytes
+ * Number of bytes to be allocated.
+ *
+ * @return
+ * Allocated block address
+ * =============================================================================
+ */
+Ptr Osal_cppiMalloc (UInt32 num_bytes)
+{
+ Error_Block errorBlock;
+
+ /* Increment the allocation counter. */
+ cpswCppiMallocCounter++;
+
+ /* Allocate memory. */
+ return Memory_alloc(NULL, num_bytes, 0, &errorBlock);
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_cppiFree
+ *
+ * @b brief
+ * @n This API frees and restores a given memory location
+ * pointer 'dataPtr' of size 'num_bytes' to its
+ * original heap location. Frees up memory allocated using
+ * @a Osal_cppiMalloc ()
+ *
+ * @param[in] dataPtr
+ * Pointer to the memory block to be cleaned up.
+ *
+ * @param[in] num_bytes
+ * Size of the memory block to be cleaned up.
+ *
+ * @return
+ * Not Applicable
+ * =============================================================================
+ */
+Void Osal_cppiFree (Ptr dataPtr, UInt32 num_bytes)
+{
+ /* Increment the free counter. */
+ cpswCppiFreeCounter++;
+
+ /* Free up the memory */
+ if (dataPtr)
+ {
+ /* Convert the global address to local address since
+ * thats what the heap understands.
+ */
+ Memory_free(NULL, dataPtr, num_bytes);
+ }
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to indicate that a block of memory is
+ * about to be accessed. If the memory block is cached then this
+ * indicates that the application would need to ensure that the
+ * cache is updated with the data from the actual memory.
+ *
+ * @param[in] blockPtr
+ * Address of the block which is to be invalidated
+ *
+ * @param[in] size
+ * Size of the block to be invalidated
+
+ * @retval
+ * Not Applicable
+ */
+void Osal_cppiBeginMemAccess (void *blockPtr, uint32_t size)
+{
+
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ /* Cleanup the prefetch buffer also. */
+ CSL_XMC_invalidatePrefetchBuffer();
+
+ SYS_CACHE_INV (blockPtr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+
+ return;
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to indicate that the block of memory has
+ * finished being accessed. If the memory block is cached then the
+ * application would need to ensure that the contents of the cache
+ * are updated immediately to the actual memory.
+ *
+ * @param[in] blockPtr
+ * Address of the block which is to be written back
+ *
+ * @param[in] size
+ * Size of the block to be written back
+
+ * @retval
+ * Not Applicable
+ */
+void Osal_cppiEndMemAccess (void *blockPtr, uint32_t size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ SYS_CACHE_WB (blockPtr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+ return;
+}
+
+/**********************************************************************
+ *********************** QMSS OSAL Functions **************************
+ **********************************************************************/
+
+/**
+ * ============================================================================
+ * @n@b Osal_qmssCsEnter
+ *
+ * @b brief
+ * @n This API ensures multi-core and multi-threaded
+ * synchronization to the caller.
+ *
+ * This is a BLOCKING API.
+ *
+ * This API ensures multi-core synchronization between
+ * multiple processes trying to access QMSS shared
+ * library at the same time.
+ *
+ * @param[in] None
+ *
+ * @return
+ * Handle used to lock critical section
+ * =============================================================================
+ */
+Ptr Osal_qmssCsEnter (Void)
+{
+ /* Get the hardware semaphore.
+ *
+ * Acquire Multi core QMSS synchronization lock
+ */
+ while ((CSL_semAcquireDirect (QMSS_HW_SEM)) == 0);
+
+ /* Disable all interrupts and OS scheduler.
+ *
+ * Acquire Multi threaded / process synchronization lock.
+ */
+ coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)] = Hwi_disable();
+
+ return NULL;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_qmssCsExit
+ *
+ * @b brief
+ * @n This API needs to be called to exit a previously
+ * acquired critical section lock using @a Osal_cpswQmssCsEnter ()
+ * API. It resets the multi-core and multi-threaded lock,
+ * enabling another process/core to grab QMSS access.
+ *
+ * @param[in] CsHandle
+ * Handle for unlocking critical section.
+ *
+ * @return None
+ * =============================================================================
+ */
+Void Osal_qmssCsExit (Ptr CsHandle)
+{
+ /* Enable all interrupts and enables the OS scheduler back on.
+ *
+ * Release multi-threaded / multi-process lock on this core.
+ */
+ Hwi_restore(coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)]);
+
+ /* Release the hardware semaphore
+ *
+ * Release multi-core lock.
+ */
+ CSL_semReleaseSemaphore (QMSS_HW_SEM);
+
+ return;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_qmssMtCsEnter
+ *
+ * @b brief
+ * @n This API ensures ONLY multi-threaded
+ * synchronization to the QMSS user.
+ *
+ * This is a BLOCKING API.
+ *
+ * @param[in] None
+ *
+ * @return
+ * Handle used to lock critical section
+ * =============================================================================
+ */
+Ptr Osal_qmssMtCsEnter (Void)
+{
+ /* Disable all interrupts and OS scheduler.
+ *
+ * Acquire Multi threaded / process synchronization lock.
+ */
+ //coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)] = Hwi_disable();
+
+ return NULL;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_qmssMtCsExit
+ *
+ * @b brief
+ * @n This API needs to be called to exit a previously
+ * acquired critical section lock using @a Osal_cpswQmssMtCsEnter ()
+ * API. It resets the multi-threaded lock, enabling another process
+ * on the current core to grab it.
+ *
+ * @param[in] CsHandle
+ * Handle for unlocking critical section.
+ *
+ * @return None
+ * =============================================================================
+ */
+Void Osal_qmssMtCsExit (Ptr CsHandle)
+{
+ /* Enable all interrupts and enables the OS scheduler back on.
+ *
+ * Release multi-threaded / multi-process lock on this core.
+ */
+ //Hwi_restore(key);
+
+ return;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_qmssMalloc
+ *
+ * @b brief
+ * @n This API allocates a memory block of a given
+ * size specified by input parameter 'num_bytes'.
+ *
+ * @param[in] num_bytes
+ * Number of bytes to be allocated.
+ *
+ * @return
+ * Allocated block address
+ * =============================================================================
+ */
+Ptr Osal_qmssMalloc (UInt32 num_bytes)
+{
+ Error_Block errorBlock;
+
+ /* Increment the allocation counter. */
+ cpswQmssMallocCounter++;
+
+ /* Allocate memory. */
+ return Memory_alloc(NULL, num_bytes, 0, &errorBlock);
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_qmssFree
+ *
+ * @b brief
+ * @n This API frees and restores a given memory location
+ * pointer 'dataPtr' of size 'num_bytes' to its
+ * original heap location. Frees up memory allocated using
+ * @a Osal_qmssMalloc ()
+ *
+ * @param[in] dataPtr
+ * Pointer to the memory block to be cleaned up.
+ *
+ * @param[in] num_bytes
+ * Size of the memory block to be cleaned up.
+ *
+ * @return
+ * Not Applicable
+ * =============================================================================
+ */
+Void Osal_qmssFree (Ptr dataPtr, UInt32 num_bytes)
+{
+ /* Increment the free counter. */
+ cpswQmssFreeCounter++;
+
+ /* Free up the memory */
+ if (dataPtr)
+ {
+ /* Convert the global address to local address since
+ * thats what the heap understands.
+ */
+ Memory_free(NULL, dataPtr, num_bytes);
+ }
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to indicate that a block of memory is
+ * about to be accessed. If the memory block is cached then this
+ * indicates that the application would need to ensure that the
+ * cache is updated with the data from the actual memory.
+ *
+ * @param[in] blockPtr
+ * Address of the block which is to be invalidated
+ *
+ * @param[in] size
+ * Size of the block to be invalidated
+
+ * @retval
+ * Not Applicable
+ */
+void Osal_qmssBeginMemAccess (void *blockPtr, uint32_t size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ /* Cleanup the prefetch buffer also. */
+ CSL_XMC_invalidatePrefetchBuffer();
+
+ SYS_CACHE_INV (blockPtr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+
+ return;
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to indicate that the block of memory has
+ * finished being accessed. If the memory block is cached then the
+ * application would need to ensure that the contents of the cache
+ * are updated immediately to the actual memory.
+ *
+ * @param[in] blockPtr
+ * Address of the block which is to be written back
+ *
+ * @param[in] size
+ * Size of the block to be written back
+
+ * @retval
+ * Not Applicable
+ */
+void Osal_qmssEndMemAccess (void *blockPtr, uint32_t size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ SYS_CACHE_WB (blockPtr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+ return;
+}
+
+/**********************************************************************
+ *********************** PASS OSAL Functions **************************
+ **********************************************************************/
+
+/**
+ * @brief This macro is used to alert the application that the PA is
+ * going to access table memory. The application must ensure
+ * cache coherency
+ *
+ *
+ * <b> Prototype: </b>
+ * The following is the C prototype for the expected OSAL API.
+ *
+ * @verbatim
+ void Osal_paBeginMemAccess (void* addr, uint32_t sizeWords)
+ @endverbatim
+ *
+ * <b> Parameters </b>
+ * @n The address of the table to be accessed
+ * @n The number of bytes in the table
+ *
+ * @note PA will make nested calls to this function for memory access
+ * protection of different memory tables.
+ */
+
+void Osal_paBeginMemAccess (Ptr addr, UInt32 size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ /* Cleanup the prefetch buffer also. */
+ CSL_XMC_invalidatePrefetchBuffer();
+
+ SYS_CACHE_INV (addr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+
+}
+
+/**
+ * @brief This macro is used to alert the application that the PA
+ * has completed access to table memory. This call will always
+ * be made following a call to Osal_paBeginMemAccess and have
+ * the same parameters
+ *
+ * <b> Prototype: </b>
+ * The following is the C prototype for the expected OSAL API.
+ *
+ * @verbatim
+ void Osal_paEndMemAccess (void* addr, uint32_t sizeWords)
+ @endverbatim
+ *
+ * <b> Parameters </b>
+ * @n The address of the table to be accessed
+ * @n The number of bytes in the table
+ *
+ * @note PA will make nested calls to this function for memory access
+ * protection of different memory tables.
+ */
+
+void Osal_paEndMemAccess (Ptr addr, UInt32 size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ SYS_CACHE_WB (addr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+
+}
+
+
+/**
+ * @b Description
+ * @n
+ * The function is used to enter a critical section.
+ * Function protects against
+ *
+ * access from multiple threads on single core
+ * and
+ * access from multiple cores
+ *
+ * @param[in] key
+ * Key used to lock the critical section.
+ *
+ * @retval
+ * Not Applicable
+ */
+Void Osal_paMtCsEnter (uint32_t *key)
+{
+
+ /* Get the hardware semaphore.
+ *
+ * Acquire Multi core PA synchronization lock
+ */
+ while ((CSL_semAcquireDirect (PA_HW_SEM)) == 0);
+ *key = 0;
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to exit a critical section
+ * protected using Osal_salldCsEnter() API.
+ *
+ * @param[in] key
+ * Key used to unlock the critical section.
+ *
+ * @retval
+ * Not Applicable
+ */
+Void Osal_paMtCsExit (uint32_t key)
+{
+ /* Release the hardware semaphore */
+ CSL_semReleaseSemaphore (PA_HW_SEM);
+}
+
+
similarity index 100%
rename from example/emacExample/cpsw_mgmt.c
rename to example/emacExample/src/c66x/bios/cpsw_mgmt.c
rename from example/emacExample/cpsw_mgmt.c
rename to example/emacExample/src/c66x/bios/cpsw_mgmt.c
similarity index 100%
rename from example/emacExample/cppi_qmss_mgmt.c
rename to example/emacExample/src/cppi_qmss_mgmt.c
rename from example/emacExample/cppi_qmss_mgmt.c
rename to example/emacExample/src/cppi_qmss_mgmt.c
similarity index 100%
rename from example/emacExample/cppi_types.h
rename to example/emacExample/src/cppi_types.h
rename from example/emacExample/cppi_types.h
rename to example/emacExample/src/cppi_types.h
similarity index 100%
rename from example/emacExample/cpsw_singlecore.c
rename to example/emacExample/src/cpsw_singlecore.c
rename from example/emacExample/cpsw_singlecore.c
rename to example/emacExample/src/cpsw_singlecore.c
similarity index 100%
rename from example/emacExample/cpsw_singlecore.h
rename to example/emacExample/src/cpsw_singlecore.h
rename from example/emacExample/cpsw_singlecore.h
rename to example/emacExample/src/cpsw_singlecore.h
similarity index 100%
rename from example/emacExample/pa_mgmt.c
rename to example/emacExample/src/pa_mgmt.c
rename from example/emacExample/pa_mgmt.c
rename to example/emacExample/src/pa_mgmt.c
similarity index 100%
rename from example/emacExample/qmss_types.h
rename to example/emacExample/src/qmss_types.h
rename from example/emacExample/qmss_types.h
rename to example/emacExample/src/qmss_types.h
similarity index 100%
rename from example/emacExample/view_ale_table.c
rename to example/emacExample/src/view_ale_table.c
rename from example/emacExample/view_ale_table.c
rename to example/emacExample/src/view_ale_table.c
diff --git a/example/multicoreExample/PA_multicoreExample_K2L_exampleProject.txt b/example/multicoreExample/k2e/c66/bios/PA_multicoreExample_K2E_exampleProject.txt
similarity index 100%
rename from example/multicoreExample/PA_multicoreExample_K2L_exampleProject.txt
rename to example/multicoreExample/k2e/c66/bios/PA_multicoreExample_K2E_exampleProject.txt
rename from example/multicoreExample/PA_multicoreExample_K2L_exampleProject.txt
rename to example/multicoreExample/k2e/c66/bios/PA_multicoreExample_K2E_exampleProject.txt
diff --git a/example/multicoreExample/multicore_example_k2l.cfg b/example/multicoreExample/k2e/c66/bios/multicore_example_k2e.cfg
similarity index 100%
rename from example/multicoreExample/multicore_example_k2l.cfg
rename to example/multicoreExample/k2e/c66/bios/multicore_example_k2e.cfg
rename from example/multicoreExample/multicore_example_k2l.cfg
rename to example/multicoreExample/k2e/c66/bios/multicore_example_k2e.cfg
diff --git a/example/simpleExample/paExample/lnk.cmd b/example/multicoreExample/k2e/c66/bios/multicore_linker.cmd
similarity index 100%
rename from example/simpleExample/paExample/lnk.cmd
rename to example/multicoreExample/k2e/c66/bios/multicore_linker.cmd
rename from example/simpleExample/paExample/lnk.cmd
rename to example/multicoreExample/k2e/c66/bios/multicore_linker.cmd
diff --git a/example/multicoreExample/multicore_osal.c b/example/multicoreExample/k2e/c66/bios/multicore_osal.c
similarity index 100%
rename from example/multicoreExample/multicore_osal.c
rename to example/multicoreExample/k2e/c66/bios/multicore_osal.c
rename from example/multicoreExample/multicore_osal.c
rename to example/multicoreExample/k2e/c66/bios/multicore_osal.c
diff --git a/example/multicoreExample/PA_multicoreExample_exampleProject.txt b/example/multicoreExample/k2l/c66/bios/PA_multicoreExample_K2L_exampleProject.txt
similarity index 91%
rename from example/multicoreExample/PA_multicoreExample_exampleProject.txt
rename to example/multicoreExample/k2l/c66/bios/PA_multicoreExample_K2L_exampleProject.txt
index 3fbd12d72a48865445f061f73af14483f749a8a3..0a6c0089b3632924b3b24c24d0ca3a0ae40f4eec 100644 (file)
rename from example/multicoreExample/PA_multicoreExample_exampleProject.txt
rename to example/multicoreExample/k2l/c66/bios/PA_multicoreExample_K2L_exampleProject.txt
index 3fbd12d72a48865445f061f73af14483f749a8a3..0a6c0089b3632924b3b24c24d0ca3a0ae40f4eec 100644 (file)
-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg0_pdsp1_bin.c"
-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg0_pdsp2_bin.c"
-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg1_pdsp0_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg1_pdsp0_bin.c"
+-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg2_pdsp0_bin.c"
-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/cppi/device/k2l/src/cppi_device.c"
-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/qmss/device/k2l/src/qmss_device.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/example/multicoreExample/multicore_example.cfg"
--ccs.setCompilerOptions "-D -mv64+ -g -dDEVICE_K2L--diag_warning=225 --mem_model:data=far -I${PASS_INSTALL_PATH} -I${PASS_INSTALL_PATH}/ti/drv/pa/example/multicoreExample -I${PDK_INSTALL_PATH}/ti/drv/cppi -I${PDK_INSTALL_PATH}/ti/drv/qmss" -rtsc.enableRtsc
+-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/example/multicoreExample/multicore_example_k2l.cfg"
+-ccs.setCompilerOptions "-D -mv64+ -g -DDEVICE_K2L--diag_warning=225 --mem_model:data=far -I${PASS_INSTALL_PATH} -I${PASS_INSTALL_PATH}/ti/drv/pa/example/multicoreExample -I${PDK_INSTALL_PATH}/ti/drv/cppi -I${PDK_INSTALL_PATH}/ti/drv/qmss" -rtsc.enableRtsc
diff --git a/example/multicoreExample/multicore_example.cfg b/example/multicoreExample/k2l/c66/bios/multicore_example_k2l.cfg
similarity index 95%
rename from example/multicoreExample/multicore_example.cfg
rename to example/multicoreExample/k2l/c66/bios/multicore_example_k2l.cfg
index dc4c4f830cd2ce0c31268ec2dabe5010971dbacf..6d5b3834be87af0bb09fb1835e69dadeb8a91fbe 100644 (file)
rename from example/multicoreExample/multicore_example.cfg
rename to example/multicoreExample/k2l/c66/bios/multicore_example_k2l.cfg
index dc4c4f830cd2ce0c31268ec2dabe5010971dbacf..6d5b3834be87af0bb09fb1835e69dadeb8a91fbe 100644 (file)
var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
/* Load the CSL package */
-var Csl = xdc.loadPackage('ti.csl');
+var devType = "k2l"
+var Csl = xdc.useModule('ti.csl.Settings');
+Csl.deviceType = devType;
/* Load the CPPI package */
var Cppi = xdc.loadPackage('ti.drv.cppi');
diff --git a/example/multicoreExample/k2l/c66/bios/multicore_linker.cmd b/example/multicoreExample/k2l/c66/bios/multicore_linker.cmd
--- /dev/null
@@ -0,0 +1,4 @@
+SECTIONS
+{
+ .init_array > L2SRAM
+}
diff --git a/example/multicoreExample/k2l/c66/bios/multicore_osal.c b/example/multicoreExample/k2l/c66/bios/multicore_osal.c
--- /dev/null
@@ -0,0 +1,675 @@
+/**
+ * @file multicore_osal.c
+ *
+ * @brief
+ * This is a sample OS Abstraction Layer (AL) file implemented
+ * using XDC/BIOS APIs.
+ *
+ * System integrator is advised to review these implementations and
+ * modify them to suit it to application requirements.
+ *
+ * This OSAL implementation uses the <b> Approach 1 </b> documented.
+ *
+ * \par
+ * ============================================================================
+ * @n (C) Copyright 2009, Texas Instruments, Inc.
+ *
+ * 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 <multicore_example.h>
+
+/**********************************************************************
+ ****************************** Defines *******************************
+ **********************************************************************/
+#define MAX_NUM_CORES 8
+
+/**********************************************************************
+ ************************** Global Variables **************************
+ **********************************************************************/
+UInt32 cpswCppiMallocCounter = 0;
+UInt32 cpswCppiFreeCounter = 0;
+UInt32 cpswQmssMallocCounter = 0;
+UInt32 cpswQmssFreeCounter = 0;
+
+UInt32 coreKey [MAX_NUM_CORES];
+
+/**********************************************************************
+ *********************** CPPI OSAL Functions **************************
+ **********************************************************************/
+
+/**
+ * ============================================================================
+ * @n@b Osal_cppiCsEnter
+ *
+ * @b brief
+ * @n This API ensures multi-core and multi-threaded
+ * synchronization to the caller.
+ *
+ * This is a BLOCKING API.
+ *
+ * This API ensures multi-core synchronization between
+ * multiple processes trying to access CPPI shared
+ * library at the same time.
+ *
+ * @param[in]
+ * @n None
+ *
+ * @return
+ * @n Handle used to lock critical section
+ * =============================================================================
+ */
+Ptr Osal_cppiCsEnter (Void)
+{
+ /* Get the hardware semaphore.
+ *
+ * Acquire Multi core CPPI synchronization lock
+ */
+ while ((CSL_semAcquireDirect (CPPI_HW_SEM)) == 0);
+
+ /* Disable all interrupts and OS scheduler.
+ *
+ * Acquire Multi threaded / process synchronization lock.
+ */
+ coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)] = Hwi_disable();
+
+ return NULL;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_cppiCsExit
+ *
+ * @b brief
+ * @n This API needs to be called to exit a previously
+ * acquired critical section lock using @a Osal_cppiCsEnter ()
+ * API. It resets the multi-core and multi-threaded lock,
+ * enabling another process/core to grab CPPI access.
+ *
+ * @param[in] CsHandle
+ * Handle for unlocking critical section.
+ *
+ * @return None
+ * =============================================================================
+ */
+Void Osal_cppiCsExit (Ptr CsHandle)
+{
+ /* Enable all interrupts and enables the OS scheduler back on.
+ *
+ * Release multi-threaded / multi-process lock on this core.
+ */
+ Hwi_restore(coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)]);
+
+ /* Release the hardware semaphore
+ *
+ * Release multi-core lock.
+ */
+ CSL_semReleaseSemaphore (CPPI_HW_SEM);
+
+ return;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_cppiMalloc
+ *
+ * @b brief
+ * @n This API allocates a memory block of a given
+ * size specified by input parameter 'num_bytes'.
+ *
+ * This API should allocate memory from shared memory if the test applications
+ * are to be run on multiple cores.
+ *
+ * @param[in] num_bytes
+ * Number of bytes to be allocated.
+ *
+ * @return
+ * Allocated block address
+ * =============================================================================
+ */
+Ptr Osal_cppiMalloc (UInt32 num_bytes)
+{
+ Error_Block errorBlock;
+
+ /* Increment the allocation counter. */
+ cpswCppiMallocCounter++;
+
+ /* Allocate memory. */
+ return Memory_alloc(NULL, num_bytes, 0, &errorBlock);
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_cppiFree
+ *
+ * @b brief
+ * @n This API frees and restores a given memory location
+ * pointer 'dataPtr' of size 'num_bytes' to its
+ * original heap location. Frees up memory allocated using
+ * @a Osal_cppiMalloc ()
+ *
+ * @param[in] dataPtr
+ * Pointer to the memory block to be cleaned up.
+ *
+ * @param[in] num_bytes
+ * Size of the memory block to be cleaned up.
+ *
+ * @return
+ * Not Applicable
+ * =============================================================================
+ */
+Void Osal_cppiFree (Ptr dataPtr, UInt32 num_bytes)
+{
+ /* Increment the free counter. */
+ cpswCppiFreeCounter++;
+
+ /* Free up the memory */
+ if (dataPtr)
+ {
+ /* Convert the global address to local address since
+ * thats what the heap understands.
+ */
+ Memory_free(NULL, dataPtr, num_bytes);
+ }
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to indicate that a block of memory is
+ * about to be accessed. If the memory block is cached then this
+ * indicates that the application would need to ensure that the
+ * cache is updated with the data from the actual memory.
+ *
+ * @param[in] blockPtr
+ * Address of the block which is to be invalidated
+ *
+ * @param[in] size
+ * Size of the block to be invalidated
+
+ * @retval
+ * Not Applicable
+ */
+void Osal_cppiBeginMemAccess (void *blockPtr, uint32_t size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ /* Cleanup the prefetch buffer also. */
+ CSL_XMC_invalidatePrefetchBuffer();
+
+ SYS_CACHE_INV (blockPtr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+
+ return;
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to indicate that the block of memory has
+ * finished being accessed. If the memory block is cached then the
+ * application would need to ensure that the contents of the cache
+ * are updated immediately to the actual memory.
+ *
+ * @param[in] blockPtr
+ * Address of the block which is to be written back
+ *
+ * @param[in] size
+ * Size of the block to be written back
+
+ * @retval
+ * Not Applicable
+ */
+void Osal_cppiEndMemAccess (void *blockPtr, uint32_t size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ SYS_CACHE_WB (blockPtr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+ return;
+}
+
+/**********************************************************************
+ *********************** QMSS OSAL Functions **************************
+ **********************************************************************/
+
+/**
+ * ============================================================================
+ * @n@b Osal_qmssCsEnter
+ *
+ * @b brief
+ * @n This API ensures multi-core and multi-threaded
+ * synchronization to the caller.
+ *
+ * This is a BLOCKING API.
+ *
+ * This API ensures multi-core synchronization between
+ * multiple processes trying to access QMSS shared
+ * library at the same time.
+ *
+ * @param[in] None
+ *
+ * @return
+ * Handle used to lock critical section
+ * =============================================================================
+ */
+Ptr Osal_qmssCsEnter (Void)
+{
+ /* Get the hardware semaphore.
+ *
+ * Acquire Multi core QMSS synchronization lock
+ */
+ while ((CSL_semAcquireDirect (QMSS_HW_SEM)) == 0);
+
+ /* Disable all interrupts and OS scheduler.
+ *
+ * Acquire Multi threaded / process synchronization lock.
+ */
+ coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)] = Hwi_disable();
+
+ return NULL;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_qmssCsExit
+ *
+ * @b brief
+ * @n This API needs to be called to exit a previously
+ * acquired critical section lock using @a Osal_cpswQmssCsEnter ()
+ * API. It resets the multi-core and multi-threaded lock,
+ * enabling another process/core to grab QMSS access.
+ *
+ * @param[in] CsHandle
+ * Handle for unlocking critical section.
+ *
+ * @return None
+ * =============================================================================
+ */
+Void Osal_qmssCsExit (Ptr CsHandle)
+{
+ /* Enable all interrupts and enables the OS scheduler back on.
+ *
+ * Release multi-threaded / multi-process lock on this core.
+ */
+ Hwi_restore(coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)]);
+
+ /* Release the hardware semaphore
+ *
+ * Release multi-core lock.
+ */
+ CSL_semReleaseSemaphore (QMSS_HW_SEM);
+
+ return;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_qmssMtCsEnter
+ *
+ * @b brief
+ * @n This API ensures ONLY multi-threaded
+ * synchronization to the QMSS user.
+ *
+ * This is a BLOCKING API.
+ *
+ * @param[in] None
+ *
+ * @return
+ * Handle used to lock critical section
+ * =============================================================================
+ */
+Ptr Osal_qmssMtCsEnter (Void)
+{
+ /* Disable all interrupts and OS scheduler.
+ *
+ * Acquire Multi threaded / process synchronization lock.
+ */
+ //coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)] = Hwi_disable();
+
+ return NULL;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_qmssMtCsExit
+ *
+ * @b brief
+ * @n This API needs to be called to exit a previously
+ * acquired critical section lock using @a Osal_cpswQmssMtCsEnter ()
+ * API. It resets the multi-threaded lock, enabling another process
+ * on the current core to grab it.
+ *
+ * @param[in] CsHandle
+ * Handle for unlocking critical section.
+ *
+ * @return None
+ * =============================================================================
+ */
+Void Osal_qmssMtCsExit (Ptr CsHandle)
+{
+ /* Enable all interrupts and enables the OS scheduler back on.
+ *
+ * Release multi-threaded / multi-process lock on this core.
+ */
+ //Hwi_restore(key);
+
+ return;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_qmssMalloc
+ *
+ * @b brief
+ * @n This API allocates a memory block of a given
+ * size specified by input parameter 'num_bytes'.
+ *
+ * @param[in] num_bytes
+ * Number of bytes to be allocated.
+ *
+ * @return
+ * Allocated block address
+ * =============================================================================
+ */
+Ptr Osal_qmssMalloc (UInt32 num_bytes)
+{
+ Error_Block errorBlock;
+
+ /* Increment the allocation counter. */
+ cpswQmssMallocCounter++;
+
+ /* Allocate memory. */
+ return Memory_alloc(NULL, num_bytes, 0, &errorBlock);
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_qmssFree
+ *
+ * @b brief
+ * @n This API frees and restores a given memory location
+ * pointer 'dataPtr' of size 'num_bytes' to its
+ * original heap location. Frees up memory allocated using
+ * @a Osal_qmssMalloc ()
+ *
+ * @param[in] dataPtr
+ * Pointer to the memory block to be cleaned up.
+ *
+ * @param[in] num_bytes
+ * Size of the memory block to be cleaned up.
+ *
+ * @return
+ * Not Applicable
+ * =============================================================================
+ */
+Void Osal_qmssFree (Ptr dataPtr, UInt32 num_bytes)
+{
+ /* Increment the free counter. */
+ cpswQmssFreeCounter++;
+
+ /* Free up the memory */
+ if (dataPtr)
+ {
+ /* Convert the global address to local address since
+ * thats what the heap understands.
+ */
+ Memory_free(NULL, dataPtr, num_bytes);
+ }
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to indicate that a block of memory is
+ * about to be accessed. If the memory block is cached then this
+ * indicates that the application would need to ensure that the
+ * cache is updated with the data from the actual memory.
+ *
+ * @param[in] blockPtr
+ * Address of the block which is to be invalidated
+ *
+ * @param[in] size
+ * Size of the block to be invalidated
+
+ * @retval
+ * Not Applicable
+ */
+void Osal_qmssBeginMemAccess (void *blockPtr, uint32_t size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ /* Cleanup the prefetch buffer also. */
+ CSL_XMC_invalidatePrefetchBuffer();
+
+ SYS_CACHE_INV (blockPtr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+
+ return;
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to indicate that the block of memory has
+ * finished being accessed. If the memory block is cached then the
+ * application would need to ensure that the contents of the cache
+ * are updated immediately to the actual memory.
+ *
+ * @param[in] blockPtr
+ * Address of the block which is to be written back
+ *
+ * @param[in] size
+ * Size of the block to be written back
+
+ * @retval
+ * Not Applicable
+ */
+void Osal_qmssEndMemAccess (void *blockPtr, uint32_t size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ SYS_CACHE_WB (blockPtr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+ return;
+}
+
+/**********************************************************************
+ *********************** PASS OSAL Functions **************************
+ **********************************************************************/
+
+/**
+ * @brief This macro is used to alert the application that the PA is
+ * going to access table memory. The application must ensure
+ * cache coherency
+ *
+ *
+ * <b> Prototype: </b>
+ * The following is the C prototype for the expected OSAL API.
+ *
+ * @verbatim
+ void Osal_paBeginMemAccess (void* addr, uint32_t sizeWords)
+ @endverbatim
+ *
+ * <b> Parameters </b>
+ * @n The address of the table to be accessed
+ * @n The number of bytes in the table
+ *
+ * @note PA will make nested calls to this function for memory access
+ * protection of different memory tables.
+ */
+
+void Osal_paBeginMemAccess (Ptr addr, UInt32 size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ /* Cleanup the prefetch buffer also. */
+ CSL_XMC_invalidatePrefetchBuffer();
+
+ SYS_CACHE_INV (addr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+
+}
+
+/**
+ * @brief This macro is used to alert the application that the PA
+ * has completed access to table memory. This call will always
+ * be made following a call to Osal_paBeginMemAccess and have
+ * the same parameters
+ *
+ * <b> Prototype: </b>
+ * The following is the C prototype for the expected OSAL API.
+ *
+ * @verbatim
+ void Osal_paEndMemAccess (void* addr, uint32_t sizeWords)
+ @endverbatim
+ *
+ * <b> Parameters </b>
+ * @n The address of the table to be accessed
+ * @n The number of bytes in the table
+ *
+ * @note PA will make nested calls to this function for memory access
+ * protection of different memory tables.
+ */
+
+void Osal_paEndMemAccess (Ptr addr, UInt32 size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ SYS_CACHE_WB (addr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+
+}
+
+
+/**
+ * @b Description
+ * @n
+ * The function is used to enter a critical section.
+ * Function protects against
+ *
+ * access from multiple threads on single core
+ * and
+ * access from multiple cores
+ *
+ * @param[in] key
+ * Key used to lock the critical section.
+ *
+ * @retval
+ * Not Applicable
+ */
+Void Osal_paMtCsEnter (uint32_t *key)
+{
+
+ /* Get the hardware semaphore.
+ *
+ * Acquire Multi core PA synchronization lock
+ */
+ while ((CSL_semAcquireDirect (PA_HW_SEM)) == 0);
+ *key = 0;
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to exit a critical section
+ * protected using Osal_salldCsEnter() API.
+ *
+ * @param[in] key
+ * Key used to unlock the critical section.
+ *
+ * @retval
+ * Not Applicable
+ */
+Void Osal_paMtCsExit (uint32_t key)
+{
+ /* Release the hardware semaphore */
+ CSL_semReleaseSemaphore (PA_HW_SEM);
+}
+
diff --git a/example/multicoreExample/cppi_qmss_mgmt.c b/example/multicoreExample/src/cppi_qmss_mgmt.c
similarity index 100%
rename from example/multicoreExample/cppi_qmss_mgmt.c
rename to example/multicoreExample/src/cppi_qmss_mgmt.c
rename from example/multicoreExample/cppi_qmss_mgmt.c
rename to example/multicoreExample/src/cppi_qmss_mgmt.c
similarity index 100%
rename from example/multicoreExample/cppi_types.h
rename to example/multicoreExample/src/cppi_types.h
rename from example/multicoreExample/cppi_types.h
rename to example/multicoreExample/src/cppi_types.h
similarity index 100%
rename from example/multicoreExample/cpsw_mgmt.c
rename to example/multicoreExample/src/cpsw_mgmt.c
rename from example/multicoreExample/cpsw_mgmt.c
rename to example/multicoreExample/src/cpsw_mgmt.c
diff --git a/example/multicoreExample/cpsw_mgmt_multi.c b/example/multicoreExample/src/cpsw_mgmt_multi.c
similarity index 100%
rename from example/multicoreExample/cpsw_mgmt_multi.c
rename to example/multicoreExample/src/cpsw_mgmt_multi.c
rename from example/multicoreExample/cpsw_mgmt_multi.c
rename to example/multicoreExample/src/cpsw_mgmt_multi.c
diff --git a/example/multicoreExample/multicore_example.c b/example/multicoreExample/src/multicore_example.c
similarity index 100%
rename from example/multicoreExample/multicore_example.c
rename to example/multicoreExample/src/multicore_example.c
rename from example/multicoreExample/multicore_example.c
rename to example/multicoreExample/src/multicore_example.c
diff --git a/example/multicoreExample/multicore_example.h b/example/multicoreExample/src/multicore_example.h
similarity index 100%
rename from example/multicoreExample/multicore_example.h
rename to example/multicoreExample/src/multicore_example.h
rename from example/multicoreExample/multicore_example.h
rename to example/multicoreExample/src/multicore_example.h
similarity index 100%
rename from example/multicoreExample/pa_mgmt.c
rename to example/multicoreExample/src/pa_mgmt.c
rename from example/multicoreExample/pa_mgmt.c
rename to example/multicoreExample/src/pa_mgmt.c
similarity index 100%
rename from example/multicoreExample/qmss_types.h
rename to example/multicoreExample/src/qmss_types.h
rename from example/multicoreExample/qmss_types.h
rename to example/multicoreExample/src/qmss_types.h
diff --git a/example/reassemLib/codeReview.txt b/example/reassemLib/codeReview.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-PaEx_reassemLibProc
-paEx_reassemLibInit
-paEx_reassemLibTimerTick ([uint32_t clock])
-paEx_reassemLibDelete
-
-ti\drv\pa\example\reassemLib\reassemIpv4.c
-
-OSCL function for cache protection
-
-
-Complete code change, profileing
-
-Optimize next week with John after all other stuffs are done.
-
-
-c:\util\cloc-1.55.exe --by-file --exclude-ext=html palld --out=palld_LineCount.txt
-
-c:\util\cloc-1.55.exe aes --by-file --exclude-ext=txt,mk,xdt,bld,xdc.xs --exclude-dir=test,docs,example,c66,c66e,ce66,ce66e --out=aes_LineCount.txt
-
-
-
-
-
-
diff --git a/example/simpleExample/PA_simpleExample_K2L_exampleProject.txt b/example/simpleExample/paExample/k2e/c66/bios/PA_simpleExample_K2E_exampleProject.txt
similarity index 100%
rename from example/simpleExample/PA_simpleExample_K2L_exampleProject.txt
rename to example/simpleExample/paExample/k2e/c66/bios/PA_simpleExample_K2E_exampleProject.txt
rename from example/simpleExample/PA_simpleExample_K2L_exampleProject.txt
rename to example/simpleExample/paExample/k2e/c66/bios/PA_simpleExample_K2E_exampleProject.txt
diff --git a/example/simpleExample/paExample/k2e/c66/bios/lnk.cmd b/example/simpleExample/paExample/k2e/c66/bios/lnk.cmd
--- /dev/null
@@ -0,0 +1,4 @@
+SECTIONS
+{
+ .init_array > L2SRAM
+}
diff --git a/example/simpleExample/paExample/osal.c b/example/simpleExample/paExample/k2e/c66/bios/osal.c
similarity index 100%
rename from example/simpleExample/paExample/osal.c
rename to example/simpleExample/paExample/k2e/c66/bios/osal.c
rename from example/simpleExample/paExample/osal.c
rename to example/simpleExample/paExample/k2e/c66/bios/osal.c
diff --git a/example/simpleExample/paExample/paExample_k2l.cfg b/example/simpleExample/paExample/k2e/c66/bios/paExample_k2e.cfg
similarity index 100%
rename from example/simpleExample/paExample/paExample_k2l.cfg
rename to example/simpleExample/paExample/k2e/c66/bios/paExample_k2e.cfg
rename from example/simpleExample/paExample/paExample_k2l.cfg
rename to example/simpleExample/paExample/k2e/c66/bios/paExample_k2e.cfg
diff --git a/example/simpleExample/PA_simpleExample_exampleProject.txt b/example/simpleExample/paExample/k2l/c66/bios/PA_simpleExample_K2L_exampleProject.txt
similarity index 92%
rename from example/simpleExample/PA_simpleExample_exampleProject.txt
rename to example/simpleExample/paExample/k2l/c66/bios/PA_simpleExample_K2L_exampleProject.txt
index 6b642775e1e21fb0ab82660efbfcb07f8bf13fa4..274e0d4640c794638dbecaeedbcb942747b1f859 100644 (file)
rename from example/simpleExample/PA_simpleExample_exampleProject.txt
rename to example/simpleExample/paExample/k2l/c66/bios/PA_simpleExample_K2L_exampleProject.txt
index 6b642775e1e21fb0ab82660efbfcb07f8bf13fa4..274e0d4640c794638dbecaeedbcb942747b1f859 100644 (file)
-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg0_pdsp1_bin.c"
-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg0_pdsp2_bin.c"
-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg1_pdsp0_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg1_pdsp0_bin.c"
+-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg2_pdsp0_bin.c"
-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/cppi/device/k2l/src/cppi_device.c"
-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/qmss/device/k2l/src/qmss_device.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/example/simpleExample/paExample/paExample.cfg"
--ccs.setCompilerOptions "-D -mv64+ -g -dDEVICE_K2L --diag_warning=225 -I${PASS_INSTALL_PATH} -I${PASS_INSTALL_PATH}/ti/drv/pa/example/simpleExample/paExample -I${PDK_INSTALL_PATH}/ti/drv/cppi -I${PDK_INSTALL_PATH}/ti/drv/qmss" -rtsc.enableRtsc
+-ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/example/simpleExample/paExample/paExample_k2l.cfg"
+-ccs.setCompilerOptions "-D -mv64+ -g -DDEVICE_K2L --diag_warning=225 -I${PASS_INSTALL_PATH} -I${PASS_INSTALL_PATH}/ti/drv/pa/example/simpleExample/paExample -I${PDK_INSTALL_PATH}/ti/drv/cppi -I${PDK_INSTALL_PATH}/ti/drv/qmss" -rtsc.enableRtsc
diff --git a/example/simpleExample/paExample/k2l/c66/bios/lnk.cmd b/example/simpleExample/paExample/k2l/c66/bios/lnk.cmd
--- /dev/null
@@ -0,0 +1,4 @@
+SECTIONS
+{
+ .init_array > L2SRAM
+}
diff --git a/example/simpleExample/paExample/k2l/c66/bios/osal.c b/example/simpleExample/paExample/k2l/c66/bios/osal.c
--- /dev/null
@@ -0,0 +1,723 @@
+/**
+ * @file osal.c
+ *
+ * @brief
+ * This is the OS abstraction layer and is used by the the QMSS/CPPI LLD.
+ *
+ * \par
+ * ============================================================================
+ * @n (C) Copyright 2009, Texas Instruments, Inc.
+ *
+ * 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 <xdc/std.h>
+#include <xdc/runtime/IHeap.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Error.h>
+
+#include <ti/sysbios/hal/Hwi.h>
+
+/* CSL CHIP, SEM Functional layer includes */
+#include <ti/csl/csl_chip.h>
+#include <ti/csl/csl_semAux.h>
+
+/* CSL Cache module includes */
+#include <ti/csl/csl_cacheAux.h>
+
+/* CSL XMC module includes */
+#include <ti/csl/csl_xmcAux.h>
+
+
+/**********************************************************************
+ ****************************** Defines *******************************
+ **********************************************************************/
+#define MAX_NUM_CORES 8
+
+/* Hardware Semaphore to synchronize access from
+ * multiple applications (PA applications and non-PASS applications)
+ * across different cores to the QMSS library.
+ */
+#define QMSS_HW_SEM 3
+
+/* Hardware Semaphore to synchronize access from
+ * multiple applications (PASS applications and non-PASS applications)
+ * across different cores to the CPPI library.
+ */
+#define CPPI_HW_SEM 4
+
+/* Hardware Semaphore to synchronize access from
+ * multiple applications (PASS applications and non-PASS applications)
+ * across different cores to the PA library.
+ */
+#define PA_HW_SEM 5
+
+#undef L2_CACHE
+#ifdef L2_CACHE
+ /* Invalidate L2 cache. This should invalidate L1D as well.
+ * Wait until operation is complete. */
+#define SYS_CACHE_INV(addr, size, code) CACHE_invL2 (addr, size, code)
+
+ /* Writeback L2 cache. This should Writeback L1D as well.
+ * Wait until operation is complete. */
+#define SYS_CACHE_WB(addr, size, code) CACHE_wbL2 (addr, size, code)
+
+#else
+ /* Invalidate L1D cache and wait until operation is complete.
+ * Use this approach if L2 cache is not enabled */
+#define SYS_CACHE_INV(addr, size, code) CACHE_invL1d (addr, size, code)
+ /* Writeback L1D cache and wait until operation is complete.
+ * Use this approach if L2 cache is not enabled */
+#define SYS_CACHE_WB(addr, size, code) CACHE_wbL1d (addr, size, code)
+
+#endif
+
+
+/**********************************************************************
+ ************************** Global Variables **************************
+ **********************************************************************/
+UInt32 qmssMallocCounter = 0;
+UInt32 qmssFreeCounter = 0;
+UInt32 cppiMallocCounter = 0;
+UInt32 cppiFreeCounter = 0;
+UInt32 paMemProtNestedLevel= 0;
+
+UInt32 coreKey [MAX_NUM_CORES];
+
+
+/**********************************************************************
+ ************************** Extern Variables **************************
+ **********************************************************************/
+
+
+/**********************************************************************
+ *************************** OSAL Functions **************************
+ **********************************************************************/
+
+/**
+ * @b Description
+ * @n
+ * The function is used to allocate a memory block of the specified size.
+ *
+ * @param[in] num_bytes
+ * Number of bytes to be allocated.
+ *
+ * @retval
+ * Allocated block address
+ */
+Ptr Osal_qmssMalloc (UInt32 num_bytes)
+{
+ Error_Block errorBlock;
+ Ptr dataPtr;
+
+ /* Increment the allocation counter. */
+ qmssMallocCounter++;
+
+ /* Allocate memory. */
+ dataPtr = Memory_alloc(NULL, num_bytes, 0, &errorBlock);
+ return (dataPtr);
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to free a memory block of the specified size.
+ *
+ * @param[in] ptr
+ * Pointer to the memory block to be cleaned up.
+ *
+ * @param[in] size
+ * Size of the memory block to be cleaned up.
+ *
+ * @retval
+ * Not Applicable
+ */
+Void Osal_qmssFree (Ptr ptr, UInt32 size)
+{
+ /* Increment the free counter. */
+ qmssFreeCounter++;
+ Memory_free(NULL, ptr, size);
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to enter a critical section.
+ * Function protects against
+ *
+ * access from multiple cores
+ * and
+ * access from multiple threads on single core
+ *
+ * @param[in] key
+ * Key used to lock the critical section.
+ *
+ * @retval
+ * Not Applicable
+ */
+Ptr Osal_qmssCsEnter (void)
+{
+ /* Get the hardware semaphore.
+ *
+ * Acquire Multi core QMSS synchronization lock
+ */
+ //while ((CSL_semAcquireDirect (QMSS_HW_SEM)) == 0);
+
+ /* Disable all interrupts and OS scheduler.
+ *
+ * Acquire Multi threaded / process synchronization lock.
+ */
+ coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)] = Hwi_disable();
+
+ return NULL;
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to exit a critical section
+ * protected using Osal_qmssCsEnter() API.
+ *
+ * @param[in] key
+ * Key used to unlock the critical section.
+ *
+ * @retval
+ * Not Applicable
+ */
+Void Osal_qmssCsExit (Ptr CsHandle)
+{
+ /* Enable all interrupts and enables the OS scheduler back on.
+ *
+ * Release multi-threaded / multi-process lock on this core.
+ */
+ Hwi_restore(coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)]);
+
+ /* Release the hardware semaphore
+ *
+ * Release multi-core lock.
+ */
+ //CSL_semReleaseSemaphore (QMSS_HW_SEM);
+
+ return;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_qmssMtCsEnter
+ *
+ * @b brief
+ * @n This API ensures ONLY multi-threaded
+ * synchronization to the QMSS user.
+ *
+ * This is a BLOCKING API.
+ *
+ * @param[in] None
+ *
+ * @return
+ * Handle used to lock critical section
+ * =============================================================================
+ */
+Ptr Osal_qmssMtCsEnter (Void)
+{
+ /* Disable all interrupts and OS scheduler.
+ *
+ * Acquire Multi threaded / process synchronization lock.
+ */
+ //coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)] = Hwi_disable();
+
+ return NULL;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_qmssMtCsExit
+ *
+ * @b brief
+ * @n This API needs to be called to exit a previously
+ * acquired critical section lock using @a Osal_cpswQmssMtCsEnter ()
+ * API. It resets the multi-threaded lock, enabling another process
+ * on the current core to grab it.
+ *
+ * @param[in] CsHandle
+ * Handle for unlocking critical section.
+ *
+ * @return None
+ * =============================================================================
+ */
+Void Osal_qmssMtCsExit (Ptr CsHandle)
+{
+ /* Enable all interrupts and enables the OS scheduler back on.
+ *
+ * Release multi-threaded / multi-process lock on this core.
+ */
+ //Hwi_restore(key);
+
+ return;
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is the QMSS OSAL Logging API which logs
+ * the messages on the console.
+ *
+ * @param[in] fmt
+ * Formatted String.
+ *
+ * @retval
+ * Not Applicable
+ */
+Void Osal_qmssLog ( String fmt, ... )
+{
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to indicate that a block of memory is
+ * about to be accessed. If the memory block is cached then this
+ * indicates that the application would need to ensure that the
+ * cache is updated with the data from the actual memory.
+ *
+ * @param[in] blockPtr
+ * Address of the block which is to be invalidated
+ *
+ * @param[in] size
+ * Size of the block to be invalidated
+
+ * @retval
+ * Not Applicable
+ */
+void Osal_qmssBeginMemAccess (void *blockPtr, uint32_t size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ /* Cleanup the prefetch buffer also. */
+ CSL_XMC_invalidatePrefetchBuffer();
+
+ SYS_CACHE_INV (blockPtr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+
+ return;
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to indicate that the block of memory has
+ * finished being accessed. If the memory block is cached then the
+ * application would need to ensure that the contents of the cache
+ * are updated immediately to the actual memory.
+ *
+ * @param[in] blockPtr
+ * Address of the block which is to be written back
+ *
+ * @param[in] size
+ * Size of the block to be written back
+
+ * @retval
+ * Not Applicable
+ */
+void Osal_qmssEndMemAccess (void *blockPtr, uint32_t size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ SYS_CACHE_WB (blockPtr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+ return;
+}
+
+
+/**
+ * @b Description
+ * @n
+ * The function is used to allocate a memory block of the specified size.
+ *
+ * Note: If the LLD is used by applications on multiple core, the "cppiHeap"
+ * should be in shared memory
+ *
+ * @param[in] num_bytes
+ * Number of bytes to be allocated.
+ *
+ * @retval
+ * Allocated block address
+ */
+Ptr Osal_cppiMalloc (UInt32 num_bytes)
+{
+ Error_Block errorBlock;
+ Ptr dataPtr;
+
+ /* Increment the allocation counter. */
+ cppiMallocCounter++;
+
+ /* Allocate memory. */
+ dataPtr = Memory_alloc(NULL, num_bytes, 0, &errorBlock);
+ return (dataPtr);
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to free a memory block of the specified size allocated
+ * using Osal_cppiMalloc() API.
+ *
+ * @param[in] ptr
+ * Pointer to the memory block to be cleaned up.
+ *
+ * @param[in] size
+ * Size of the memory block to be cleaned up.
+ *
+ * @retval
+ * Not Applicable
+ */
+Void Osal_cppiFree (Ptr ptr, UInt32 size)
+{
+ /* Increment the free counter. */
+ cppiFreeCounter++;
+ Memory_free (NULL, ptr, size);
+ SYS_CACHE_WB (ptr, size, CACHE_WAIT);
+
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_cppiCsEnter
+ *
+ * @b brief
+ * @n This API ensures multi-core and multi-threaded
+ * synchronization to the caller.
+ *
+ * This is a BLOCKING API.
+ *
+ * This API ensures multi-core synchronization between
+ * multiple processes trying to access CPPI shared
+ * library at the same time.
+ *
+ * @param[in]
+ * @n None
+ *
+ * @return
+ * @n Handle used to lock critical section
+ * =============================================================================
+ */
+Ptr Osal_cppiCsEnter (Void)
+{
+ /* Get the hardware semaphore.
+ *
+ * Acquire Multi core CPPI synchronization lock
+ */
+ //while ((CSL_semAcquireDirect (CPPI_HW_SEM)) == 0);
+
+ /* Disable all interrupts and OS scheduler.
+ *
+ * Acquire Multi threaded / process synchronization lock.
+ */
+ coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)] = Hwi_disable();
+
+ return NULL;
+}
+
+/**
+ * ============================================================================
+ * @n@b Osal_cppiCsExit
+ *
+ * @b brief
+ * @n This API needs to be called to exit a previously
+ * acquired critical section lock using @a Osal_cppiCsEnter ()
+ * API. It resets the multi-core and multi-threaded lock,
+ * enabling another process/core to grab CPPI access.
+ *
+ * @param[in] CsHandle
+ * Handle for unlocking critical section.
+ *
+ * @return None
+ * =============================================================================
+ */
+Void Osal_cppiCsExit (Ptr CsHandle)
+{
+ /* Enable all interrupts and enables the OS scheduler back on.
+ *
+ * Release multi-threaded / multi-process lock on this core.
+ */
+ Hwi_restore(coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)]);
+
+ /* Release the hardware semaphore
+ *
+ * Release multi-core lock.
+ */
+ //CSL_semReleaseSemaphore (CPPI_HW_SEM);
+
+ return;
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is the CPPI OSAL Logging API which logs
+ * the messages on the console.
+ *
+ * @param[in] fmt
+ * Formatted String.
+ *
+ * @retval
+ * Not Applicable
+ */
+Void Osal_cppiLog ( String fmt, ... )
+{
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to indicate that a block of memory is
+ * about to be accessed. If the memory block is cached then this
+ * indicates that the application would need to ensure that the
+ * cache is updated with the data from the actual memory.
+ *
+ * @param[in] blockPtr
+ * Address of the block which is to be invalidated
+ *
+ * @param[in] size
+ * Size of the block to be invalidated
+
+ * @retval
+ * Not Applicable
+ */
+void Osal_cppiBeginMemAccess (void *blockPtr, uint32_t size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ /* Cleanup the prefetch buffer also. */
+ CSL_XMC_invalidatePrefetchBuffer();
+
+ SYS_CACHE_INV (blockPtr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+
+ return;
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to indicate that the block of memory has
+ * finished being accessed. If the memory block is cached then the
+ * application would need to ensure that the contents of the cache
+ * are updated immediately to the actual memory.
+ *
+ * @param[in] blockPtr
+ * Address of the block which is to be written back
+ *
+ * @param[in] size
+ * Size of the block to be written back
+
+ * @retval
+ * Not Applicable
+ */
+void Osal_cppiEndMemAccess (void *blockPtr, uint32_t size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ SYS_CACHE_WB (blockPtr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+ return;
+}
+
+
+/**
+ * @brief This macro is used to alert the application that the PA is
+ * going to access table memory. The application must ensure
+ * cache coherency
+ *
+ *
+ * <b> Prototype: </b>
+ * The following is the C prototype for the expected OSAL API.
+ *
+ * @verbatim
+ void Osal_paBeginMemAccess (void* addr, uint32_t sizeWords)
+ @endverbatim
+ *
+ * <b> Parameters </b>
+ * @n The address of the table to be accessed
+ * @n The number of bytes in the table
+ *
+ * @note PA will make nested calls to this function for memory access
+ * protection of different memory tables.
+ */
+
+void Osal_paBeginMemAccess (Ptr addr, UInt32 size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ /* Cleanup the prefetch buffer also. */
+ CSL_XMC_invalidatePrefetchBuffer();
+
+ SYS_CACHE_INV (addr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+
+}
+
+/**
+ * @brief This macro is used to alert the application that the PA
+ * has completed access to table memory. This call will always
+ * be made following a call to Osal_paBeginMemAccess and have
+ * the same parameters
+ *
+ * <b> Prototype: </b>
+ * The following is the C prototype for the expected OSAL API.
+ *
+ * @verbatim
+ void Osal_paEndMemAccess (void* addr, uint32_t sizeWords)
+ @endverbatim
+ *
+ * <b> Parameters </b>
+ * @n The address of the table to be accessed
+ * @n The number of bytes in the table
+ *
+ * @note PA will make nested calls to this function for memory access
+ * protection of different memory tables.
+ */
+
+void Osal_paEndMemAccess (Ptr addr, UInt32 size)
+{
+ uint32_t key;
+
+ /* Disable Interrupts */
+ key = Hwi_disable();
+
+ SYS_CACHE_WB (addr, size, CACHE_FENCE_WAIT);
+
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+ asm (" nop 4");
+
+ /* Reenable Interrupts. */
+ Hwi_restore(key);
+
+}
+
+
+/**
+ * @b Description
+ * @n
+ * The function is used to enter a critical section.
+ * Function protects against
+ *
+ * access from multiple threads on single core
+ * and
+ * access from multiple cores
+ *
+ * @param[in] key
+ * Key used to lock the critical section.
+ *
+ * @retval
+ * Not Applicable
+ */
+Void Osal_paMtCsEnter (uint32_t *key)
+{
+
+ /* Get the hardware semaphore.
+ *
+ * Acquire Multi core PA synchronization lock
+ */
+ //while ((CSL_semAcquireDirect (PA_HW_SEM)) == 0);
+ *key = 0;
+}
+
+/**
+ * @b Description
+ * @n
+ * The function is used to exit a critical section
+ * protected using Osal_salldCsEnter() API.
+ *
+ * @param[in] key
+ * Key used to unlock the critical section.
+ *
+ * @retval
+ * Not Applicable
+ */
+Void Osal_paMtCsExit (uint32_t key)
+{
+ /* Release the hardware semaphore */
+ //CSL_semReleaseSemaphore (PA_HW_SEM);
+}
+
+
+
diff --git a/example/simpleExample/paExample/paExample.cfg b/example/simpleExample/paExample/k2l/c66/bios/paExample_k2l.cfg
similarity index 92%
rename from example/simpleExample/paExample/paExample.cfg
rename to example/simpleExample/paExample/k2l/c66/bios/paExample_k2l.cfg
index 026f0318f371d52f19b9537bc92aee6e5631b426..01f8db261fdff5da1f309dc6ed270ea00e2b3a79 100644 (file)
rename from example/simpleExample/paExample/paExample.cfg
rename to example/simpleExample/paExample/k2l/c66/bios/paExample_k2l.cfg
index 026f0318f371d52f19b9537bc92aee6e5631b426..01f8db261fdff5da1f309dc6ed270ea00e2b3a79 100644 (file)
var System = xdc.useModule('xdc.runtime.System');
var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
-var Csl = xdc.loadPackage('ti.csl');
+var devType = "k2l"
+var Csl = xdc.useModule('ti.csl.Settings');
+Csl.deviceType = devType;
var Pa = xdc.loadPackage('ti.drv.pa');
var Qm = xdc.loadPackage('ti.drv.qmss');
var Cppi = xdc.loadPackage('ti.drv.cppi');
diff --git a/example/simpleExample/paExample/config.h b/example/simpleExample/paExample/src/config.h
similarity index 100%
rename from example/simpleExample/paExample/config.h
rename to example/simpleExample/paExample/src/config.h
rename from example/simpleExample/paExample/config.h
rename to example/simpleExample/paExample/src/config.h
diff --git a/example/simpleExample/paExample/cpsw_mgmt.c b/example/simpleExample/paExample/src/cpsw_mgmt.c
similarity index 100%
rename from example/simpleExample/paExample/cpsw_mgmt.c
rename to example/simpleExample/paExample/src/cpsw_mgmt.c
rename from example/simpleExample/paExample/cpsw_mgmt.c
rename to example/simpleExample/paExample/src/cpsw_mgmt.c
diff --git a/example/simpleExample/paExample/ex1util.c b/example/simpleExample/paExample/src/ex1util.c
similarity index 100%
rename from example/simpleExample/paExample/ex1util.c
rename to example/simpleExample/paExample/src/ex1util.c
rename from example/simpleExample/paExample/ex1util.c
rename to example/simpleExample/paExample/src/ex1util.c
similarity index 100%
rename from example/simpleExample/paExample/expa.c
rename to example/simpleExample/paExample/src/expa.c
rename from example/simpleExample/paExample/expa.c
rename to example/simpleExample/paExample/src/expa.c
diff --git a/example/simpleExample/paExample/memory.c b/example/simpleExample/paExample/src/memory.c
similarity index 100%
rename from example/simpleExample/paExample/memory.c
rename to example/simpleExample/paExample/src/memory.c
rename from example/simpleExample/paExample/memory.c
rename to example/simpleExample/paExample/src/memory.c
diff --git a/example/simpleExample/paExample/memory.h b/example/simpleExample/paExample/src/memory.h
similarity index 100%
rename from example/simpleExample/paExample/memory.h
rename to example/simpleExample/paExample/src/memory.h
rename from example/simpleExample/paExample/memory.h
rename to example/simpleExample/paExample/src/memory.h
similarity index 100%
rename from example/simpleExample/paExample/pa1.h
rename to example/simpleExample/paExample/src/pa1.h
rename from example/simpleExample/paExample/pa1.h
rename to example/simpleExample/paExample/src/pa1.h
diff --git a/example/simpleExample/paExample/paExample.c b/example/simpleExample/paExample/src/paExample.c
similarity index 100%
rename from example/simpleExample/paExample/paExample.c
rename to example/simpleExample/paExample/src/paExample.c
rename from example/simpleExample/paExample/paExample.c
rename to example/simpleExample/paExample/src/paExample.c
diff --git a/example/simpleExample/paExample/pkttxrx.c b/example/simpleExample/paExample/src/pkttxrx.c
similarity index 100%
rename from example/simpleExample/paExample/pkttxrx.c
rename to example/simpleExample/paExample/src/pkttxrx.c
rename from example/simpleExample/paExample/pkttxrx.c
rename to example/simpleExample/paExample/src/pkttxrx.c
diff --git a/example/simpleExample/paExample/setupqm.c b/example/simpleExample/paExample/src/setupqm.c
similarity index 100%
rename from example/simpleExample/paExample/setupqm.c
rename to example/simpleExample/paExample/src/setupqm.c
rename from example/simpleExample/paExample/setupqm.c
rename to example/simpleExample/paExample/src/setupqm.c
diff --git a/example/simpleExample2/armv7/Readme.txt b/example/simpleExample2/armv7/Readme.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-*************************************************************************
-* simpleExample2: PA ARM User Mode Example
-* -----------------------------------------
-*
-* (C) Copyright 2012, Texas Instruments, Inc.
-
-*************************************************************************
-
-The PA ARM User Mode example demonstrates the use of PA/CPPI/QMSS configuration from Linux
-user mode for platforms ARM with NetCP support.
-
-The example demonstrates configuration of PA for MAC/IP/UDP and
-send/receive data through the ethernet switch using CPPI Host descriptors .
-At the end of the execution example outputs the PA statistics.
-
-By Default Example runs in loop back mode at PA controlled through variable: passLpbkMode.
-passLpbkMode = PASS_LOOPBACK_INTERNAL [Default for internal loopback at PA]
-Modfify
-passLpbkMode = PASS_LOOPBACK_NONE in case if packets needs to be sent out of the switch to
-external network.
-
-Pre-requisites:
-==============
-Example assumes following actions are already done from kernel
- - NetCP /EMAC Switch Initialization
- - Download of firmwares: PA/QMSS
-
-Building examples: Refer to LLD user guide for setting environments related to PDK. Change to
-ti\drv\pa\example\simpleExample2\armv7\build directory and run make
-
-Key Code Reference Pointers and File level details
-==================================================
-fw_main.c:
- - Framework file containing main and test routine
- - Memory mapping of device hardware address to get the virtual address
- - Memory allocation for all data
- - Routine for executing test in a thread context
-
-fw_mem_allocator.c:
- - Memory Allocator/Memory Map Helper routines
-
-fw_osal.c:
- - OSAL routines for LLDs
-
-cppi_qmss_mgmt.c:
- - Contains routines for QMSS/CPPI initialization and setting up queues and flows
- - Refer to the routines for passing the Virtual address as seen at ARM for the LLDs
-
-pa_mgmt.c:
- - PA configuration routines for adding MAC/IP/UDP
-
-cppi_types.h/qmss_types.h: Header file for standard header files
diff --git a/example/simpleExample2/armv7/build/makefile b/example/simpleExample2/armv7/build/makefile
+++ /dev/null
@@ -1,85 +0,0 @@
-#
-# Macro definitions referenced below
-#
-
-empty =
-space =$(empty) $(empty)
-
-ARMV7OBJDIR ?= ./obj
-ARMV7BINDIR ?= ./bin
-ARMV7LIBDIR ?= ./lib
-
-ARMV7OBJDIR := $(ARMV7OBJDIR)/pa/example/simpleExample2
-ARMV7BINDIR := $(ARMV7BINDIR)/pa/example
-
-#Cross tools
-CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc -c
-AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
-AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar -r
-LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
-
-# INCLUDE Directories
-QMSS_INC_DIR = $(PDK_INSTALL_PATH)/ti/drv/qmss
-CPPI_INC_DIR = $(PDK_INSTALL_PATH)/ti/drv/cppi
-PA_TEST_INC_DIR = $(PDK_INSTALL_PATH)/ti/drv/pa/example/simpleExample2/armv7
-
-INCDIR := $(PDK_INSTALL_PATH);$(PA_TEST_INC_DIR);$(CPPI_INC_DIR)
-
-EXAMPLE_DIR = $(PDK_INSTALL_PATH)/ti/drv/pa/example/simpleExample2/armv7
-
-# Libraries
-QMSS_LIB = -lqmss
-CPPI_LIB = -lcppi
-PA_LIB = -lpa
-
-# Compiler options
-INTERNALDEFS = $(DEBUG_FLAG) -D__ARMv7 -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DMAKEFILE_BUILD
-
-# Linker options
-INTERNALLINKDEFS = --start-group -L $(ARMV7LIBDIR) $(QMSS_LIB) $(PA_LIB) $(CPPI_LIB) -lrt --end-group
-
-EXE=paSimpleExample.out
-OBJEXT = o
-SRCDIR = ../
-SRCDIR = $(EXAMPLE_DIR)
-
-INCS = -I. -I$(strip $(subst ;, -I,$(INCDIR)))
-
-VPATH=$(SRCDIR)
-
-#List the COMMONSRC Files
-COMMONSRCC = \
- fw_main.c \
- fw_osal.c \
- cppi_qmss_mgmt.c \
- pa_mgmt.c \
- fw_mem_allocator.c
-
-# FLAGS for the COMMONSRC Files
-COMMONSRCCFLAGS = -I.
-
-# Make Rule for the COMMONSRC Files
-COMMONSRCCOBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(COMMONSRCC))
-
-all:$(ARMV7BINDIR)/$(EXE)
-
-$(ARMV7BINDIR)/$(EXE): $(COMMONSRCCOBJS) $(ARMV7BINDIR)/.created
- @echo linking $(COMMONSRCCOBJS) into $@ ...
- $(LD) $(COMMONSRCCOBJS) $(INTERNALLINKDEFS) -o $@
-
-$(ARMV7OBJDIR)/%.$(OBJEXT): %.c $(ARMV7OBJDIR)/.created
- @echo compiling $< ...
- $(CC) -c $(COMMONSRCCFLAGS) $(INTERNALDEFS) $(INCS) $< -o $@
-
-$(ARMV7OBJDIR)/.created:
- @mkdir -p $(ARMV7OBJDIR)
- @touch $(ARMV7OBJDIR)/.created
-
-$(ARMV7BINDIR)/.created:
- @mkdir -p $(ARMV7BINDIR)
- @touch $(ARMV7BINDIR)/.created
-
-clean:
- @rm -fr $(ARMV7OBJDIR)
- @rm -fr $(ARMV7BINDIR)
-
diff --git a/example/simpleExample2/armv7/cppi_qmss_mgmt.c b/example/simpleExample2/armv7/cppi_qmss_mgmt.c
+++ /dev/null
@@ -1,944 +0,0 @@
-/**
- * @file cppi_qmss_mgmt.c
- *
- * @brief
- * This file holds all required routines to configure CPPI/QMSS LLDs and
- * to send/receive data using PA/QM.
- *
- * \par
- * ============================================================================
- * @n (C) Copyright 2012, Texas Instruments, Inc.
- *
- * 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 "fw_test.h"
-#include <ti/drv/qmss/qmss_qm.h>
-#include <ti/drv/qmss/device/qmss_device.c>
-#include <ti/drv/cppi/device/cppi_device.c>
-
-
-/* QMSS device specific configuration */
-extern Qmss_GlobalConfigParams qmssGblCfgParams[];
-
-/* CPPI device specific configuration */
-extern Cppi_GlobalConfigParams cppiGblCfgParams[];
-
-
-
-
-/* Host Descriptor Region - [Size of descriptor * Number of descriptors]
- * MUST be 16 byte aligned.
- */
-uint8_t *pHostDesc = 0;
-
-/* Buffers to be used for TX */
-uint8_t *pCppiMemTX = 0;
-
-
-/* QMSS queue handles */
-
-/* Queue with free descriptors */
-Qmss_QueueHnd gGlobalFreeQHnd;
-
-/* TX queues used to send data to PA PDSP/CPSW.*/
-Qmss_QueueHnd gPaTxQHnd [NUM_PA_TX_QUEUES];
-
-/* TX queue with free decriptors attached to data buffers for transmission.*/
-Qmss_QueueHnd gTxFreeQHnd;
-
-/* RX queue with free decriptors attached to data buffers to be used
- * by the PASS CPDMA to hold the received data.
- */
-Qmss_QueueHnd gRxFreeQHnd;
-
-/* RX queue used by the application to receive packets from PASS/CPSW.
- * Each core has an independent RX queue.
- */
-Qmss_QueueHnd gRxQHnd;
-
-
-/* CPPI Handles used by the application */
-Cppi_Handle gCpdmaHnd;
-
-Cppi_ChHnd gCpdmaTxChanHnd [NUM_PA_TX_QUEUES];
-
-Cppi_ChHnd gCpdmaRxChanHnd [NUM_PA_RX_CHANNELS];
-
-Cppi_FlowHnd gRxFlowHnd;
-
-/* Static data packet being used for TX and RX verification
- */
-#define PACKET_UDP_DEST_PORT_SHIFT 36
-#define PACKET_PAYLOAD_SHIFT 42
-#pragma DATA_ALIGN(pktMatch, CACHE_LINESZ)
-uint8_t pktMatch[] = {
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, /* Dest MAC */
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, /* Src MAC */
- 0x08, 0x00, /* Ethertype = IPv4 */
- 0x45, 0x00, 0x00, 0x6c, /* IP version, services, total length */
- 0x00, 0x00, 0x00, 0x00, /* IP ID, flags, fragment offset */
- 0x05, 0x11, 0x32, 0x26, /* IP ttl, protocol (UDP), header checksum */
- 0xc0, 0xa8, 0x01, 0x01, /* Source IP address */
- 0xc0, 0xa8, 0x01, 0x0a, /* Destination IP address */
- 0x12, 0x34, 0x56, 0x78, /* UDP source port, dest port */
- 0x00, 0x58, 0x1d, 0x18, /* UDP len, UDP checksum */
- 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 80 bytes of payload data */
- 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41,
- 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
- 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
- 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
- 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61,
- 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81 };
-
-/* Tx/Rx packet counters */
-volatile uint32_t gTxCounter = 0, gRxCounter = 0;
-/******************************************************************************
-* Macro to convert to IP Register Virtual Address from a mapped base Virtual Address
-* Input: virtBaseAddr: Virtual base address mapped using mmap for IP
-* phyBaseAddr: Physical base address for the IP
-* phyRegAddr: Physical register address
-******************************************************************************/
-static inline void* FW_GET_REG_VADDR (void * virtBaseAddr, uint32_t phyBaseAddr, uint32_t phyRegAddr)
-{
- return((void *)((uint8_t *)virtBaseAddr + (phyRegAddr - phyBaseAddr)));
-}
-
-/** ============================================================================
- * @n@b Init_Qmss
- *
- * @b Description
- * @n This API initializes the QMSS LLD on core 0 only.
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-int32_t Init_Qmss (void)
-{
- int32_t result;
- Qmss_MemRegInfo memCfg;
- Qmss_InitCfg qmssInitConfig;
- Cppi_DescCfg cppiDescCfg;
- uint32_t numAllocated;
- Qmss_GlobalConfigParams fw_qmssGblCfgParams;
-
- /* Initialize QMSS */
- memset (&qmssInitConfig, 0, sizeof (Qmss_InitCfg));
-
- /* Set up QMSS configuration */
-
- /* Use internal linking RAM */
- qmssInitConfig.linkingRAM0Base = 0;
- qmssInitConfig.linkingRAM0Size = 0;
- qmssInitConfig.linkingRAM1Base = 0x0;
- qmssInitConfig.maxDescNum = NUM_HOST_DESC;
-
- /* Bypass hardware initialization as it is done within Kernel */
- qmssInitConfig.qmssHwStatus = QMSS_HW_INIT_COMPLETE;
-
- fw_qmssGblCfgParams = qmssGblCfgParams[0];
-
- /* Convert address to Virtual address */
- fw_qmssGblCfgParams.qmConfigReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_CONFIG_STARVATION_COUNTER_REGS);
-
- fw_qmssGblCfgParams.qmDescReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_DESCRIPTION_REGS);
-
- fw_qmssGblCfgParams.qmQueMgmtReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_QM_QUEUE_DEQUEUE_REGS);
-
- fw_qmssGblCfgParams.qmQueMgmtProxyReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_PROXY_QUEUE_DEQUEUE_REGS);
-
- fw_qmssGblCfgParams.qmQueStatReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_QUE_PEEK_REGS);
-
- fw_qmssGblCfgParams.qmQueIntdReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_INTD_REGS);
-
- fw_qmssGblCfgParams.qmPdspCmdReg[0] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_SCRACH_RAM1_REGS);
-
- fw_qmssGblCfgParams.qmPdspCmdReg[1] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_SCRACH_RAM2_REGS);
-
- fw_qmssGblCfgParams.qmPdspCtrlReg[0] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_ADSP1_REGS);
-
- fw_qmssGblCfgParams.qmPdspCtrlReg[1] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_ADSP2_REGS);
-
- fw_qmssGblCfgParams.qmPdspIRamReg[0] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_APDSP1_RAM_REGS);
-
- fw_qmssGblCfgParams.qmPdspIRamReg[1] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_APDSP2_RAM_REGS);
-
- fw_qmssGblCfgParams.qmStatusRAM =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_QM_STATUS_RAM_REGS);
-
- fw_qmssGblCfgParams.qmLinkingRAMReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_LINKING_RAM_REGS);
-
- fw_qmssGblCfgParams.qmMcDMAReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_MCDMA_REGS);
-
- fw_qmssGblCfgParams.qmTimer16Reg[0] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_TIMER1_REGS);
-
- fw_qmssGblCfgParams.qmTimer16Reg[1] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_TIMER2_REGS);
-
- fw_qmssGblCfgParams.qmQueMgmtDataReg = (void *)((uint32_t)fw_qmssDataVaddr);
-
- fw_qmssGblCfgParams.qmQueMgmtProxyDataReg =
- FW_GET_REG_VADDR(fw_qmssDataVaddr,QMSS_DATA_BASE_ADDR,QMSS_DATA_BASE_QUEUE_PROXY_ADDR);
-
- /* Initialize the Queue Manager */
- result = Qmss_init (&qmssInitConfig, &fw_qmssGblCfgParams);
- if (result != QMSS_SOK)
- {
- System_printf ("Error initializing Queue Manager SubSystem, Error code : %d\n", result);
- return -1;
- }
-
- /* Start Queue manager on this core */
- Qmss_start ();
-
- /* Setup the descriptor memory regions.
- *
- * The Descriptor base addresses MUST be global addresses and
- * all memory regions MUST be setup in ascending order of the
- * descriptor base addresses.
- */
- pHostDesc = (uint8_t*)fw_memAlloc((NUM_HOST_DESC *
- SIZE_HOST_DESC),
- CACHE_LINESZ);
-
- /* Initialize and setup CPSW Host Descriptors required for example */
- memset (pHostDesc, 0, SIZE_HOST_DESC * NUM_HOST_DESC);
- memCfg.descBase = (uint32_t *) pHostDesc;
- memCfg.descSize = SIZE_HOST_DESC;
- memCfg.descNum = NUM_HOST_DESC;
- memCfg.manageDescFlag = Qmss_ManageDesc_MANAGE_DESCRIPTOR;
- memCfg.memRegion = Qmss_MemRegion_MEMORY_REGION0;
- memCfg.startIndex = 0;
-
- /* Insert Host Descriptor memory region */
- result = Qmss_insertMemoryRegion(&memCfg);
- if (result == QMSS_MEMREGION_ALREADY_INITIALIZED)
- {
- System_printf ("Memory Region %d already Initialized \n", memCfg.memRegion);
- }
- else if (result < QMSS_SOK)
- {
- System_printf ("Error: Inserting memory region %d, Error code : %d\n", memCfg.memRegion, result);
- return -1;
- }
-
- /* Initialize all the descriptors we just allocated on the
- * memory region above. Setup the descriptors with some well
- * known values before we use them for data transfers.
- */
- memset (&cppiDescCfg, 0, sizeof (cppiDescCfg));
- cppiDescCfg.memRegion = Qmss_MemRegion_MEMORY_REGION0;
- cppiDescCfg.descNum = NUM_HOST_DESC;
- cppiDescCfg.destQueueNum = QMSS_PARAM_NOT_SPECIFIED;
- cppiDescCfg.queueType = Qmss_QueueType_GENERAL_PURPOSE_QUEUE;
- cppiDescCfg.initDesc = Cppi_InitDesc_INIT_DESCRIPTOR;
- cppiDescCfg.descType = Cppi_DescType_HOST;
-
- /* By default:
- * (1) Return descriptors to tail of queue
- * (2) Always return entire packet to this free queue
- * (3) Set that PS Data is always present in start of SOP buffer
- * (4) Configure free q num < 4K, hence qMgr = 0
- * (5) Recycle back to the same Free queue by default.
- */
- cppiDescCfg.returnPushPolicy = Qmss_Location_TAIL;
- cppiDescCfg.cfg.host.returnPolicy = Cppi_ReturnPolicy_RETURN_ENTIRE_PACKET;
- cppiDescCfg.cfg.host.psLocation = Cppi_PSLoc_PS_IN_DESC;
- cppiDescCfg.returnQueue.qMgr = 0;
- cppiDescCfg.returnQueue.qNum = QMSS_PARAM_NOT_SPECIFIED;
- cppiDescCfg.epibPresent = Cppi_EPIB_EPIB_PRESENT;
-
- /* Initialize the descriptors, create a free queue and push descriptors to a global free queue */
- if ((gGlobalFreeQHnd = Cppi_initDescriptor (&cppiDescCfg, &numAllocated)) <= 0)
- {
- System_printf ("Error Initializing Free Descriptors, Error: %d \n", gGlobalFreeQHnd);
- return -1;
- }
- else
- {
- System_printf ("Initializing Free Descriptors. \n");
- }
-
- /* Queue Manager Initialization Done */
- return 0;
-}
-
-
-/** ============================================================================
- * @n@b Init_Qmss_Local
- *
- * @b Description
- * @n This API initializes the QMSS LLD in cores other than core 0.
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-int32_t Init_Qmss_Local (void)
-{
- int32_t result;
-
- while(1)
- {
- /* Block until Qmss_init() has completed by core 0 */
- result = Qmss_start();
- if(result == QMSS_NOT_INITIALIZED)
- {
- System_printf ("QMSS Not yet Initialized\n");
- continue;
- }
- else if (result != QMSS_SOK) {
- System_printf ("Qmss_start failed with error code %d\n", result);
- return (-1);
- }
-
- if (result == QMSS_SOK)
- {
- break;
- }
- }
- return 0;
-}
-
-
-/** ============================================================================
- * @n@b Init_Cppi
- *
- * @b Description
- * @n This API initializes the CPPI LLD, opens the PASS CPDMA and opens up
- * the Tx, Rx channels required for data transfers.
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-int32_t Init_Cppi (void)
-{
- int32_t result, i;
- Cppi_CpDmaInitCfg cpdmaCfg;
- uint8_t isAllocated;
- Cppi_TxChInitCfg txChCfg;
- Cppi_RxChInitCfg rxChInitCfg;
- Cppi_GlobalConfigParams fw_cppiGblCfgParams[CPPI_MAX_CPDMA];
-
- for (i=0; i<CPPI_MAX_CPDMA; i++)
- fw_cppiGblCfgParams[i] = cppiGblCfgParams[i];
-
-
- /* Convert Physical address to Virtual address for LLD access */
- /* SRIO CPDMA regs */
- fw_cppiGblCfgParams[Cppi_CpDma_SRIO_CPDMA].gblCfgRegs =
- FW_GET_REG_VADDR(fw_srioCfgVaddr,CSL_SRIO_CONFIG_REGS,CSL_SRIO_CONFIG_CPPI_DMA_GLOBAL_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_SRIO_CPDMA].txChRegs =
- FW_GET_REG_VADDR(fw_srioCfgVaddr,CSL_SRIO_CONFIG_REGS,CSL_SRIO_CONFIG_CPPI_DMA_TX_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_SRIO_CPDMA].rxChRegs =
- FW_GET_REG_VADDR(fw_srioCfgVaddr,CSL_SRIO_CONFIG_REGS,CSL_SRIO_CONFIG_CPPI_DMA_RX_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_SRIO_CPDMA].txSchedRegs =
- FW_GET_REG_VADDR(fw_srioCfgVaddr,CSL_SRIO_CONFIG_REGS,CSL_SRIO_CONFIG_CPPI_DMA_TX_SCHEDULER_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_SRIO_CPDMA].rxFlowRegs =
- FW_GET_REG_VADDR(fw_srioCfgVaddr,CSL_SRIO_CONFIG_REGS,CSL_SRIO_CONFIG_CPPI_DMA_RX_FLOW_CFG_REGS);
-
- /* PASS CPDMA regs */
- fw_cppiGblCfgParams[Cppi_CpDma_PASS_CPDMA].gblCfgRegs =
- FW_GET_REG_VADDR(fw_passCfgVaddr,CSL_PA_SS_CFG_REGS,CSL_PA_SS_CFG_CPPI_DMA_GLOBAL_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_PASS_CPDMA].txChRegs =
- FW_GET_REG_VADDR(fw_passCfgVaddr,CSL_PA_SS_CFG_REGS,CSL_PA_SS_CFG_CPPI_DMA_TX_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_PASS_CPDMA].rxChRegs =
- FW_GET_REG_VADDR(fw_passCfgVaddr,CSL_PA_SS_CFG_REGS,CSL_PA_SS_CFG_CPPI_DMA_RX_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_PASS_CPDMA].txSchedRegs =
- FW_GET_REG_VADDR(fw_passCfgVaddr,CSL_PA_SS_CFG_REGS,CSL_PA_SS_CFG_CPPI_DMA_TX_SCHEDULER_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_PASS_CPDMA].rxFlowRegs =
- FW_GET_REG_VADDR(fw_passCfgVaddr,CSL_PA_SS_CFG_REGS,CSL_PA_SS_CFG_CPPI_DMA_RX_FLOW_CFG_REGS);
-
- /* QMSS CPDMA regs */
- fw_cppiGblCfgParams[Cppi_CpDma_QMSS_CPDMA].gblCfgRegs =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_CPPI_DMA_GLOBAL_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_QMSS_CPDMA].txChRegs =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_CPPI_DMA_TX_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_QMSS_CPDMA].rxChRegs =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_CPPI_DMA_RX_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_QMSS_CPDMA].txSchedRegs =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_CPPI_DMA_TX_SCHEDULER_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_QMSS_CPDMA].rxFlowRegs =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_CPPI_DMA_RX_FLOW_CFG_REGS);
-
-
- /* Initialize CPPI LLD */
- result = Cppi_init (fw_cppiGblCfgParams);
- if (result != CPPI_SOK)
- {
- System_printf ("Error initializing CPPI LLD, Error code : %d\n", result);
- return -1;
- }
-
- /* Initialize PASS CPDMA */
- memset (&cpdmaCfg, 0, sizeof (Cppi_CpDmaInitCfg));
- cpdmaCfg.dmaNum = Cppi_CpDma_PASS_CPDMA;
- if ((gCpdmaHnd = Cppi_open (&cpdmaCfg)) == NULL)
- {
- System_printf ("Error initializing CPPI for PASS CPDMA %d \n", cpdmaCfg.dmaNum);
- return -1;
- }
-
- /* Open all CPPI Tx Channels. These will be used to send data to PASS/CPSW */
- for (i = 0; i < NUM_PA_TX_QUEUES; i ++)
- {
- txChCfg.channelNum = i; /* CPPI channels are mapped one-one to the PA Tx queues */
- txChCfg.txEnable = Cppi_ChState_CHANNEL_DISABLE; /* Disable the channel for now. */
- txChCfg.filterEPIB = 0;
- txChCfg.filterPS = 0;
- txChCfg.aifMonoMode = 0;
- txChCfg.priority = 2;
- if ((gCpdmaTxChanHnd[i] = Cppi_txChannelOpen (gCpdmaHnd, &txChCfg, &isAllocated)) == NULL)
- {
- System_printf ("Error opening Tx channel %d\n", txChCfg.channelNum);
- return -1;
- }
- Cppi_channelEnable (gCpdmaTxChanHnd[i]);
- }
-
- /* Open all CPPI Rx channels. These will be used by PA to stream data out. */
- for (i = 0; i < NUM_PA_RX_CHANNELS; i++)
- {
- /* Open a CPPI Rx channel that will be used by PA to stream data out. */
- rxChInitCfg.channelNum = i;
- rxChInitCfg.rxEnable = Cppi_ChState_CHANNEL_DISABLE;
- if ((gCpdmaRxChanHnd[i] = Cppi_rxChannelOpen (gCpdmaHnd, &rxChInitCfg, &isAllocated)) == NULL)
- {
- System_printf ("Error opening Rx channel: %d \n", rxChInitCfg.channelNum);
- return -1;
- }
-
- /* Also enable Rx Channel */
- Cppi_channelEnable (gCpdmaRxChanHnd[i]);
- }
-
- /* Clear CPPI Loobpack bit in PASS CDMA Global Emulation Control Register */
- Cppi_setCpdmaLoopback(gCpdmaHnd, 0);
-
- /* CPPI Init Done. Return success */
- return 0;
-}
-
-/** ============================================================================
- * @n@b Setup_Tx
- *
- * @b Description
- * @n This API sets up all relevant data structures and configuration required
- * for sending data to PASS/Ethernet. It sets up a Tx free descriptor queue,
- * PASS Tx queues required for send.
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-int32_t Setup_Tx (void)
-{
- uint8_t isAllocated, i;
- Qmss_Queue qInfo;
- void* pCppiDesc;
-
- /* Open all Transmit (Tx) queues.
- *
- * These queues are used to send data to PA PDSP/CPSW.
- */
- for (i = 0; i < NUM_PA_TX_QUEUES; i ++)
- {
- if ((gPaTxQHnd[i] = Qmss_queueOpen (Qmss_QueueType_PASS_QUEUE, QMSS_PARAM_NOT_SPECIFIED, &isAllocated)) < 0)
- {
- System_printf ("Error opening PA Tx queue \n");
- return -1;
- }
- }
-
- /* Open a Tx Free Descriptor Queue (Tx FDQ).
- *
- * This queue will be used to hold Tx free decriptors that can be filled
- * later with data buffers for transmission onto wire.
- */
- if ((gTxFreeQHnd = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, QMSS_PARAM_NOT_SPECIFIED, &isAllocated)) < 0)
- {
- System_printf ("Error opening Tx Free descriptor queue \n");
- return -1;
- }
-
-
- qInfo = Qmss_getQueueNumber (gTxFreeQHnd);
-
- /* Attach some free descriptors to the Tx free queue we just opened. */
- for (i = 0; i < NUM_TX_DESC; i++)
- {
- /* Get a free descriptor from the global free queue we setup
- * during initialization.
- */
- if ((pCppiDesc = Qmss_queuePop (gGlobalFreeQHnd)) == NULL)
- {
- break;
- }
-
- /* The descriptor address returned from the hardware has the
- * descriptor size appended to the address in the last 4 bits.
- *
- * To get the true descriptor size, always mask off the last
- * 4 bits of the address.
- */
- pCppiDesc = (void*) ((uint32_t) pCppiDesc & 0xFFFFFFF0);
-
- pCppiMemTX = (void *)fw_memAlloc(TX_BUF_SIZE,CACHE_LINESZ);
- if(pCppiMemTX == NULL)
- break;
-
- /* Populate the Tx free descriptor with the buffer. */
- Cppi_setData (Cppi_DescType_HOST, pCppiDesc, pCppiMemTX, TX_BUF_SIZE);
-
- /* Save original buffer information */
- Cppi_setOriginalBufInfo (Cppi_DescType_HOST, pCppiDesc, pCppiMemTX, TX_BUF_SIZE);
-
- /* Setup the Completion queue:
- *
- * Setup the return policy for this desc to return to the free q we just
- * setup instead of the global free queue.
- */
- Cppi_setReturnQueue ((Cppi_DescType) Cppi_DescType_HOST, pCppiDesc, qInfo);
- Cppi_setPacketLen (Cppi_DescType_HOST, pCppiDesc, TX_BUF_SIZE);
-
- SYS_CACHE_WB (pCppiDesc, SIZE_HOST_DESC, 0);
-
- /* Push descriptor to Tx free queue */
- Qmss_queuePushDescSize (gTxFreeQHnd, pCppiDesc, SIZE_HOST_DESC);
- }
- if (i != NUM_TX_DESC)
- {
- System_printf ("Error allocating Tx free descriptors \n");
- return -1;
- }
-
- /* All done with Rx configuration. Return success. */
- return 0;
-}
-
-/** ============================================================================
- * @n@b Setup_Rx
- *
- * @b Description
- * @n This API sets up all relevant data structures and configuration required
- * for receiving data from PASS/Ethernet. It sets up a Rx free descriptor queue
- * with some empty pre-allocated buffers to receive data, and an Rx queue
- * to which the Rxed data is streamed for the example application.
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-int32_t Setup_Rx (void)
-{
- uint8_t isAllocated, i;
- Qmss_Queue rxFreeQInfo, rxQInfo;
- void* pCppiDesc;
- Cppi_RxFlowCfg rxFlowCfg;
- void* pDataBuffer;
- uint32_t mySWInfo[] = {0x11112222, 0x33334444};
-
-
- /* Open a Receive (Rx) queue.
- *
- * This queue will be used to hold all the packets received by PASS/CPSW
- *
- */
- if ((gRxQHnd = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, QMSS_PARAM_NOT_SPECIFIED, &isAllocated)) < 0)
- {
- System_printf ("Error opening gRxQHnd queue \n");
- return -1;
- }
- rxQInfo = Qmss_getQueueNumber (gRxQHnd);
-
-
- /* Open a Rx Free Descriptor Queue (Rx FDQ).
- *
- * This queue will hold all the Rx free decriptors. These descriptors will be
- * used by the PASS CPDMA to hold data received via CPSW.
- */
- if ((gRxFreeQHnd = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, QMSS_PARAM_NOT_SPECIFIED, &isAllocated)) < 0)
- {
- System_printf ("Error opening Rx Free descriptor queue \n");
- return -1;
- }
-
- rxFreeQInfo = Qmss_getQueueNumber (gRxFreeQHnd);
-
- /* Attach some free descriptors to the Rx free queue we just opened. */
- for (i = 0; i < NUM_RX_DESC; i++)
- {
- /* Get a free descriptor from the global free queue we setup
- * during initialization.
- */
- if ((pCppiDesc = Qmss_queuePop (gGlobalFreeQHnd)) == NULL)
- {
- System_printf ("Error poping descriptor.\n");
- break;
- }
-
- /* The descriptor address returned from the hardware has the
- * descriptor size appended to the address in the last 4 bits.
- *
- * To get the true descriptor size, always mask off the last
- * 4 bits of the address.
- */
- pCppiDesc = (void*) ((uint32_t) pCppiDesc & 0xFFFFFFF0);
- pDataBuffer = (uint8_t *)fw_memAlloc(RX_BUF_SIZE,CACHE_LINESZ);
-
- /* Populate the Rx free descriptor with the buffer we just allocated. */
- Cppi_setData (Cppi_DescType_HOST, pCppiDesc, (uint8_t *)pDataBuffer, RX_BUF_SIZE);
-
- /* Save original buffer information */
- Cppi_setOriginalBufInfo (Cppi_DescType_HOST, pCppiDesc, (uint8_t *)pDataBuffer, RX_BUF_SIZE);
-
- /* Setup the Completion queue:
- * Setup the return policy for this desc to return to the free q we just
- * setup instead of the global free queue.
- */
- Cppi_setReturnQueue (Cppi_DescType_HOST, pCppiDesc, rxFreeQInfo);
- Cppi_setSoftwareInfo (Cppi_DescType_HOST, pCppiDesc, (uint8_t *) mySWInfo);
- Cppi_setPacketLen (Cppi_DescType_HOST, pCppiDesc, RX_BUF_SIZE);
-
- SYS_CACHE_WB (pCppiDesc, SIZE_HOST_DESC, 0);
-
- /* Push descriptor to Tx free queue */
- Qmss_queuePushDescSize (gRxFreeQHnd, pCppiDesc, SIZE_HOST_DESC);
- }
- if (i != NUM_RX_DESC)
- {
- System_printf ("Error allocating Rx free descriptors \n");
- return -1;
- }
-
-
- /* Setup a Rx Flow.
- * A Rx flow encapsulates all relevant data properties that CPDMA would
- * have to know in order to succefully receive data.
- */
- /* Initialize the flow configuration */
- memset (&rxFlowCfg, 0, sizeof(Cppi_RxFlowCfg));
- rxFreeQInfo = Qmss_getQueueNumber (gRxFreeQHnd);
-
- /* Let CPPI pick the next available flow */
-#if FLOW_WORKAROUND
- rxFlowCfg.flowIdNum = 1;
-#else
- rxFlowCfg.flowIdNum = CPPI_PARAM_NOT_SPECIFIED;
-#endif
-
- rxFlowCfg.rx_dest_qmgr = rxQInfo.qMgr;
- rxFlowCfg.rx_dest_qnum = rxQInfo.qNum;
- rxFlowCfg.rx_desc_type = Cppi_DescType_HOST;
-
- rxFlowCfg.rx_ps_location = Cppi_PSLoc_PS_IN_DESC;
- rxFlowCfg.rx_psinfo_present = 1; /* Enable PS info */
-
- rxFlowCfg.rx_error_handling = 0; /* Drop the packet, do not retry on starvation by default */
- rxFlowCfg.rx_einfo_present = 1; /* EPIB info present */
-
- rxFlowCfg.rx_dest_tag_lo_sel = 0; /* Disable tagging */
- rxFlowCfg.rx_dest_tag_hi_sel = 0;
- rxFlowCfg.rx_src_tag_lo_sel = 0;
- rxFlowCfg.rx_src_tag_hi_sel = 0;
-
- rxFlowCfg.rx_size_thresh0_en = 0; /* By default, we disable Rx Thresholds */
- rxFlowCfg.rx_size_thresh1_en = 0; /* By default, we disable Rx Thresholds */
- rxFlowCfg.rx_size_thresh2_en = 0; /* By default, we disable Rx Thresholds */
- rxFlowCfg.rx_size_thresh0 = 0x0;
- rxFlowCfg.rx_size_thresh1 = 0x0;
- rxFlowCfg.rx_size_thresh2 = 0x0;
-
- rxFlowCfg.rx_fdq0_sz0_qmgr = rxFreeQInfo.qMgr; /* Setup the Receive free queue for the flow */
- rxFlowCfg.rx_fdq0_sz0_qnum = rxFreeQInfo.qNum;
- rxFlowCfg.rx_fdq0_sz1_qnum = 0x0;
- rxFlowCfg.rx_fdq0_sz1_qmgr = 0x0;
- rxFlowCfg.rx_fdq0_sz2_qnum = 0x0;
- rxFlowCfg.rx_fdq0_sz2_qmgr = 0x0;
- rxFlowCfg.rx_fdq0_sz3_qnum = 0x0;
- rxFlowCfg.rx_fdq0_sz3_qmgr = 0x0;
-
- rxFlowCfg.rx_fdq1_qnum = rxFreeQInfo.qNum; /* Use the Rx Queue to pick descriptors */
- rxFlowCfg.rx_fdq1_qmgr = rxFreeQInfo.qMgr;
- rxFlowCfg.rx_fdq2_qnum = rxFreeQInfo.qNum; /* Use the Rx Queue to pick descriptors */
- rxFlowCfg.rx_fdq2_qmgr = rxFreeQInfo.qMgr;
- rxFlowCfg.rx_fdq3_qnum = rxFreeQInfo.qNum; /* Use the Rx Queue to pick descriptors */
- rxFlowCfg.rx_fdq3_qmgr = rxFreeQInfo.qMgr;
-
- /* Configure the Rx flow */
- if ((gRxFlowHnd = Cppi_configureRxFlow (gCpdmaHnd, &rxFlowCfg, &isAllocated)) == NULL)
- {
- System_printf ("Error configuring Rx flow \n");
- return -1;
- }
-
- /* All done with Rx configuration. Return success. */
- return 0;
-}
-
-/** ============================================================================
- * @n@b SendPacket
- *
- * @b Description
- * @n This API is called to actually send out data onto wire using ethernet.
- * On success, this API increments a global Tx counter to indicate the same.
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-int32_t SendPacket (void)
-{
- Cppi_HostDesc* pCppiDesc;
- uint32_t dataBufferSize;
- uint32_t key;
- uint8_t* pDataBuf;
- uint32_t dataLen;
-
-
- /* Get a free descriptor from the global free queue we setup
- * during initialization.
- */
- if ((pCppiDesc = Qmss_queuePop (gTxFreeQHnd)) == NULL)
- {
- System_printf ("No Tx free descriptor. Cant run send/rcv test \n");
- return -1;
- }
-
- /* The descriptor address returned from the hardware has the
- * descriptor size appended to the address in the last 4 bits.
- *
- * To get the true descriptor size, always mask off the last
- * 4 bits of the address.
- */
- pCppiDesc = (void*) ((uint32_t) pCppiDesc & 0xFFFFFFF0);
-
- dataBufferSize = sizeof (pktMatch);
-
- SYS_CACHE_INV (pCppiDesc, SIZE_HOST_DESC, 0);
-
- Cppi_getData (Cppi_DescType_HOST, (Cppi_Desc*)pCppiDesc, &pDataBuf, &dataLen);
- if(dataLen < dataBufferSize)
- {
- System_printf ("Unexpected Error. Buffer Length in descriptor shorter than expected \n");
- while(1);
- }
- memcpy(pDataBuf,pktMatch,dataBufferSize);
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)pCppiDesc, dataBufferSize);
-
- /* Clear PS Data */
- Cppi_setPSLen (Cppi_DescType_HOST, (Cppi_Desc *)pCppiDesc, 0);
-
- SYS_CACHE_WB (pCppiDesc, SIZE_HOST_DESC, 0);
-
- if (passLpbkMode != PASS_LOOPBACK_INTERNAL)
- {
- /* Send the packet out the mac. It will loop back to PA if the mac/switch
- * have been configured properly
- */
- Qmss_queuePushDescSize (gPaTxQHnd[8], pCppiDesc, SIZE_HOST_DESC);
- }
- else
- {
- /* Send the packet to be looped back at PA.
- */
- Qmss_queuePushDescSize (gPaTxQHnd[0], pCppiDesc, SIZE_HOST_DESC);
- }
- /* Increment the application transmit counter */
- gTxCounter ++;
-
- /* Give some time for the PA to process the packet */
- CycleDelay (10000);
-
- return 0;
-}
-
-/** ============================================================================
- * @n@b ReceivePacket
- *
- * @b Description
- * @n This API is called to Receive packets.
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-int32_t ReceivePacket (void)
-{
- Cppi_Desc *hd;
- int32_t j;
- int32_t status=0;
-
- /* Wait for a data packet from PA */
- for (j = 0; j < 100; j++)
- {
- CycleDelay (1000);
- if (Qmss_getQueueEntryCount (gRxQHnd) > 0)
- {
- hd = (Cppi_Desc *)(((uint32_t)Qmss_queuePop (gRxQHnd)) & ~0xf);
- if(VerifyPacket(hd) != 0)
- status=-1;
- }
- }
-
- return (status);
-}
-
-/** ============================================================================
- * @n@b VerifyPacket
- *
- * @b Description
- * @n This API verifies a packet received against the expected data and
- * returns 0 to inidcate success and -1 to indicate a mismatch.
- *
- * @param[in]
- * @n pCppiDesc Packet descriptor received.
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-int32_t VerifyPacket (Cppi_Desc* pCppiDesc)
-{
- Cppi_HostDesc *pHostDesc;
- uint8_t *pDataBuffer;
- int32_t i;
-
- pHostDesc = (Cppi_HostDesc *)pCppiDesc;
-
- SYS_CACHE_INV (pHostDesc, SIZE_HOST_DESC, 0);
- SYS_CACHE_INV ((void*)(pHostDesc->buffPtr), pHostDesc->buffLen, 0);
-
- /* Verify the application software info we received is same
- * as what we had sent earlier.
- */
- if (pHostDesc->softwareInfo0 != 0xaaaaaaaa)
- {
- System_printf ("VerifyPacket: Found an entry in receive queue with swinfo0 = 0x%08x, expected 0x%08x\n",
- pHostDesc->softwareInfo0, 0xaaaaaaaa);
-
- pHostDesc->buffLen = pHostDesc->origBufferLen;
- SYS_CACHE_WB (pHostDesc, SIZE_HOST_DESC, 0);
- Qmss_queuePush (gRxFreeQHnd, (void*)pHostDesc, pHostDesc->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);
-
- return -1;
- }
-
- /* Verify the packet matches what we had sent */
- pDataBuffer = (uint8_t *) pHostDesc->buffPtr;
- for (i = 0; i < sizeof (pktMatch); i++)
- {
- if (pktMatch[i] != pDataBuffer[i])
- {
- System_printf ("VerifyPacket: Byte %d expected 0x%02x, found 0x%02x\n", i, pktMatch[i], pDataBuffer[i]);
-
- /* Free the packet back to the Rx FDQ */
- pHostDesc->buffLen = pHostDesc->origBufferLen;
- SYS_CACHE_WB (pHostDesc, SIZE_HOST_DESC, 0);
- Qmss_queuePush (gRxFreeQHnd, (void*)pHostDesc, pHostDesc->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);
- return -1;
- }
- }
-
- /* Increment Rx counter to indicate the number of successfully
- * received packets by the example app.
- */
- gRxCounter ++;
-
- /* Reset the buffer lenght and put the descriptor back on the free queue */
- pHostDesc->buffLen = pHostDesc->origBufferLen;
- SYS_CACHE_WB (pHostDesc, SIZE_HOST_DESC, 0);
- Qmss_queuePush (gRxFreeQHnd, (void*)pHostDesc, pHostDesc->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);
-
- /* Verify packet done. Return success. */
- return 0;
-}
-
-
diff --git a/example/simpleExample2/armv7/cppi_types.h b/example/simpleExample2/armv7/cppi_types.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * @file cppi_types.h
- *
- * @brief
- * This is a wrapper header file which includes the standard types
- * used by the CPPI Low Level Driver.
- *
- * \par
- * NOTE:
- * (C) Copyright 2009 Texas Instruments, Inc.
- *
- * 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.
- *
-*/
-#ifndef __CPPI_TYPES_H__
-#define __CPPI_TYPES_H__
-
-/* Use default C99 types */
-/* C Standard library Include */
-#include <stdio.h>
-/* System level header files */
-#include <stdint.h>
-#include <stdlib.h>
-
-#endif /* __CPPI_TYPES_H__ */
-
-
-
diff --git a/example/simpleExample2/armv7/fw_main.c b/example/simpleExample2/armv7/fw_main.c
+++ /dev/null
@@ -1,496 +0,0 @@
-/******************************************************************************
- * FILE PURPOSE: Main function routine for Example
- ******************************************************************************
- * FILE NAME: fw_main.c
- *
- * @brief
- * Example to illustrate the usage of PA/QMSS/CPPI from User Land Linux environment
- * on ARM
- *
- * This example application does the following:
- * (1) Initializes:
- * (a) Queue Manager (QM) Subsystem
- * (b) Packet Accelerator (PA) CPPI DMA
- *
- * (2) Sets up the CPPI descriptors and Queues required for sending and
- * receiving data using Ethernet.
- * (a) Uses Host descriptors
- * (b) Uses QMSS poll mode
- *
- * (3) Sets up the example application's configuration (MAC address
- * it uses to send/recv data; IP address and port number it's listening
- * on) in PA Subsystem so as to enable the PASS to forward all packets
- * matching this configuration onto the application for processing.
- * (a) Switch MAC address configured = 0x10:0x11:0x12:0x13:0x14:0x15
- * (b) Example's IP address = 192.168.1.10
- * (c) Example App's listening port = 0x5678
- *
- * (4) Sends packets onto wire
- * (constructed manually in code here with following settings):
- * (a) Source MAC = 0x00:0x01:0x02:0x03:0x04:0x05
- * Destination MAC = 0x10:0x11:0x12:0x13:0x14:0x15
- * (b) Source IP = 192.168.1.1
- * Destination IP = 192.168.1.10
- * (c) Source Port = 0x1234
- * Destination Port= 0x5678
- * (d) Payload Data (80 bytes)
- *
- * The packets sent by the application are looped back at PA by default.The packets
- * are received and passed back up to the example application for processing.
- *
- * (5) Application receives all packets using QM poll mode
- * Validates received packet against data sent.
- *
- * Example Test Setup:
- *
- * EVM for an SOC example running Linux environment on ARM processor.
- * If packets are routed to network. You could put another PC on the Hub to observe packets
- * being sent onto wire.
- *
- * \par
- * ============================================================================
- * @n (C) Copyright 2012, Texas Instruments, Inc.
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <time.h>
-#include <pthread.h>
-#include <string.h>
-#include "fw_mem_allocator.h"
-
-void *topLevelTest (void *args);
-
-
-/* The exit code is a global. This is used so
- * the clock function can terminate the program with
- * the proper exit code
- */
-int exitCode;
-
-/**************************************************************
-************************** DEFINITIONS ************************
-***************************************************************/
-/* Number of packets to be used for testing the example. */
-#define MAX_NUM_PACKETS 10
-
-/* Counters to track number of packets sent/received by this application */
-extern volatile uint32_t gRxCounter, gTxCounter;
-
-/*
- * Default test configuration for the silicon
- *
- * Packets being looped back at PASS
- * passLpbkMode = PASS_LOOPBACK_INTERNAL
- * passLpbkMode = PASS_LOOPBACK_NONE : To disable the Loopback
- */
-int32_t passLpbkMode = PASS_LOOPBACK_INTERNAL;
-
-#define MAX_RETRIES 5
-
-/**************************************************************
-**************** EXAMPLE APP FUNCTIONS ************************
-***************************************************************/
-
-
-
-
-/** ============================================================================
- * @n@b fw_test
- *
- * @b Description
- * @n Example application that sets up the application, sends, receives
- * data.
- *
- * @param[in]
- * @n None
- *
- * @return
- * @n None
- *
- * =============================================================================
- */
-void* fw_test (void *args)
-{
- int32_t i;
-
- System_printf ("**************************************************\n");
- System_printf ("******* Ethernet Single Core Example Start *******\n");
- System_printf ("**************************************************\n");
-
- /* Initialize the components required to run the example:
- * (1) QMSS
- * (2) CPPI
- * (3) Ethernet switch subsystem + MDIO + SGMII
- */
- /* Initialize QMSS */
- if (Init_Qmss () != 0)
- {
- System_printf ("QMSS init failed \n");
- return;
- }
- else
- {
- System_printf ("QMSS successfully initialized \n");
- }
-
- /* Initialize CPPI */
- if (Init_Cppi () != 0)
- {
- System_printf ("CPPI init failed \n");
- return;
- }
- else
- {
- System_printf ("CPPI successfully initialized \n");
- }
-
- /* Init PA LLD */
- if (Init_PASS () != 0)
- {
- System_printf ("PASS init failed \n");
- return;
- }
- else
- {
- System_printf ("PASS successfully initialized \n");
- }
-
- System_printf ("Ethernet subsystem initializion bypassed \n");
-
- /* Setup Tx */
- if (Setup_Tx () != 0)
- {
- System_printf ("Tx setup failed \n");
- return;
- }
- else
- {
- System_printf ("Tx setup successfully done \n");
- }
-
- /* Setup Rx */
- if (Setup_Rx () != 0)
- {
- System_printf ("Rx setup failed \n");
- return;
- }
- else
- {
- System_printf ("Rx setup successfully done \n");
- }
-
- /* Setup PA */
- if (Setup_PASS () != 0)
- {
- System_printf ("PASS setup failed \n");
- return;
- }
- else
- {
- System_printf ("PASS setup successfully done \n");
- }
-
- System_printf ("PA Stats before Packet Transmission BEGIN ********* ... \n");
- if (getPaStats ()) {
- System_printf ("Function getPaStats failed\n");
- return;
- }
-
- System_printf ("PA Stats before Packet Transmission END ********* ... \n");
-
- /* Run some data through and verify transfer worked */
- //mdebugHaltPdsp(0);
- System_printf ("Packet Transmission Start ... \n");
- for (i = 0; i < MAX_NUM_PACKETS; i ++)
- {
- if (SendPacket () != 0)
- {
- System_printf ("Packet %d send failed \n", i);
- return;
- }
- }
-
- /* Wait until all packet reception is done */
- System_printf ("Packet Transmission Done.\nWait for all packets to be Received ... \n");
-
- i =0;
- while ((gRxCounter != gTxCounter) && (i < MAX_RETRIES)) {
- if(ReceivePacket() == -1)
- {
- System_printf("Verififcation Failed for Received %d packets so far...\n", gRxCounter);
- }
- CycleDelay (10000);
- i++;
- }
-
- System_printf("Received %d packets so far...\n", gRxCounter);
-
- System_printf ("PA Stats After Packet Transmission BEGIN ********* ... \n");
- if (getPaStats ()) {
- System_printf ("Function getPaStats failed\n");
- return;
- }
-
- System_printf ("PA Stats After Packet Transmission END ********* ... \n");
-
- System_printf ("Packets Sent\t\t=\t%d \nPackets Received\t=\t%d \nExample Done! \n", gTxCounter, gRxCounter);
-
- System_printf ("**************************************************\n");
- System_printf ("******** Ethernet Single Core Example End ********\n");
- System_printf ("**************************************************\n");
-
-}
-
-
-typedef pthread_t task_handle;
-
-#define DEFAULT_STACK_SIZE 0x8000
-/** ============================================================================
- * @n@b task_create
- *
- * @b Description
- * @n Create thread to run the test program
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-static int task_create ( void *(start_routine)(void*), void* args, void* handle)
-{
- int max_priority, err;
- pthread_t thread;
- pthread_attr_t attr;
- struct sched_param param;
-
- max_priority = sched_get_priority_max(SCHED_FIFO);
- err = pthread_attr_init(&attr);
- if (err) {
- printf("pthread_attr_init failed: (%s)\n", strerror(err));
- return err;
- }
- err = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
- if (err) {
- printf("pthread_attr_setdetachstate failed: (%s)\n", strerror(err));
- return err;
- }
- err = pthread_attr_setstacksize(&attr, DEFAULT_STACK_SIZE);
- if (err) {
- printf("pthread_attr_setstacksize failed: (%s)\n", strerror(err));
- return err;
- }
- err = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
- if (err) {
- printf("pthread_attr_setinheritsched failed: (%s)\n", strerror(err));
- return err;
- }
- err = pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
- if (err) {
- printf("pthread_attr_setschedpolicy failed: (%s)\n", strerror(err));
- return err;
- }
- memset(¶m, 0, sizeof(param));
- param.sched_priority = max_priority;
- err = pthread_attr_setschedparam(&attr, ¶m);
- if (err) {
- printf("pthread_attr_setschedparam failed: (%s)\n", strerror(err));
- return err;
- }
- if (err) return err;
- err = pthread_create(&thread, &attr, start_routine, args);
- if (err) {
- printf("pthread_create failed: (%s)\n", strerror(err));
- return err;
- }
- if (err) return err;
- *(pthread_t*)handle = thread;
- return 0;
-}
-
-/** ============================================================================
- * @n@b task_wait
- *
- * @b Description
- * @n Wait for Task completion
- *
- * @return void
- * =============================================================================
- */
-static void task_wait (void *handle)
-{
- pthread_join(*((pthread_t*)handle), NULL);
- return;
-}
-/** ============================================================================
- * @n@b task_sleep
- *
- * @b Description
- * @n Sleep the thread for msec duration
- *
- * @return void
- * =============================================================================
- */
-
-static void task_sleep(int time_in_msec)
-{
- pthread_mutex_t fake_mutex = PTHREAD_MUTEX_INITIALIZER;
- pthread_cond_t fake_cond = PTHREAD_COND_INITIALIZER;
- struct timespec ts;
- int rt;
- unsigned int sec, nsec;
-
- sec = time_in_msec/1000;
- nsec = (time_in_msec - (sec*1000)) * 1000000;
-
- /* Use the wall-clock time */
- clock_gettime(CLOCK_REALTIME, &ts);
-
- ts.tv_sec += sec;
- ts.tv_nsec += nsec;
-
- pthread_mutex_lock(&fake_mutex);
- rt = pthread_cond_timedwait(&fake_cond, &fake_mutex, &ts);
- pthread_mutex_unlock(&fake_mutex);
-}
-/** ============================================================================
- * @n@b main
- *
- * @b Description
- * @n test application main
- *
- * @return int
- * =============================================================================
- */
-int main() {
- task_handle test_th;
- int status;
-
- fw_osalInit();
-
- if (fw_memAllocInit((uint8_t*)MSMC_SRAM_BASE_ADDR,
- MSMC_TEST_PERM_MEM_SZ) == fw_FALSE) {
- printf("ERROR: \"Top Level Test\" fw_memAllocInit failed\n");
- return (-1);
- }
-
-
- /* Create virtual memory maps */
- /* QMSS CFG Regs */
- fw_qmssCfgVaddr = fw_memMap((void*)QMSS_CFG_BASE_ADDR,
- QMSS_CFG_BLK_SZ);
- if (!fw_qmssCfgVaddr)
- {
- printf("ERROR: Failed to map QMSS CFG registers\n");
- return (-1);
- }
-#ifdef EXT_DEBUG
- printf("main:QMSS_CFG_BASE_ADDR:0x%x Memory mapped at address %p.\n",(void*)QMSS_CFG_BASE_ADDR, fw_qmssCfgVaddr);
-#endif
-
- /* QMSS DATA Regs */
- fw_qmssDataVaddr = fw_memMap((void*)QMSS_DATA_BASE_ADDR,
- QMSS_DATA_BLK_SZ);
- if (!fw_qmssDataVaddr)
- {
- printf("ERROR: Failed to map QMSS DATA registers\n");
- return (-1);
- }
-#ifdef EXT_DEBUG
- printf("main:QMSS_DATA_BASE_ADDR:0x%x Memory mapped at address %p.\n",(void*)QMSS_DATA_BASE_ADDR, fw_qmssDataVaddr);
-#endif
-
- /* SRIO CFG Regs */
- fw_srioCfgVaddr = fw_memMap((void*)SRIO_CFG_BASE_ADDR,
- SRIO_CFG_BLK_SZ);
- if (!fw_srioCfgVaddr)
- {
- printf("ERROR: Failed to map SRIO CFG registers\n");
- return (-1);
- }
-#ifdef EXT_DEBUG
- printf("main:SRIO_CFG_BASE_ADDR:0x%x Memory mapped at address %p.\n",(void*)SRIO_CFG_BASE_ADDR, fw_srioCfgVaddr);
-#endif
-
- /* PASS CFG Regs */
- fw_passCfgVaddr = fw_memMap((void*)PASS_CFG_BASE_ADDR,
- PASS_CFG_BLK_SZ);
- if (!fw_passCfgVaddr)
- {
- printf("ERROR: Failed to map PASS CFG registers\n");
- return (-1);
- }
-#ifdef EXT_DEBUG
- printf("main:PASS_CFG_BASE_ADDR:0x%x Memory mapped at address %p.\n",(void*)PASS_CFG_BASE_ADDR, fw_passCfgVaddr);
-#endif
-
-
- if (status = task_create(topLevelTest, NULL, &test_th)) {
- printf("ERROR: \"Top Level Test\" task-create failed (%d)\n", status);
- return (-1);
- }
-
- task_wait(&test_th);
- fw_osalshutdown();
- return 0;
-}
-
-/** ============================================================================
- * @n@b topLevelTest
- *
- * @b Description
- * @n Routine running as a separate thread
- *
- * @return int
- * =============================================================================
- */
-void *topLevelTest (void *args)
-{
- task_handle fw_test_th;
- int status;
-
- fw_osalInit();
-
- if (status = task_create(fw_test, NULL, &fw_test_th)) {
- printf("ERROR: \"fwTest\" task-create failed (%d)\n", status);
- return;
- }
-
- task_wait(&fw_test_th);
- pthread_exit((void*) 0);
- return;
-}
-
-
diff --git a/example/simpleExample2/armv7/fw_mem_allocator.c b/example/simpleExample2/armv7/fw_mem_allocator.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/******************************************************************************
- * FILE PURPOSE: Memory allocator for running Example
- ******************************************************************************
- * FILE NAME: fw_mem_allocator.c
- *
- * DESCRIPTION: Memory allocator for running test.
- * 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 "fw_mem_allocator.h"
-
-/* Macro to align x to y */
-#define align(x,y) ((x + y) & (~y))
-
-uint8_t *fw_mem_start_phy = (uint8_t*)0;
-uint8_t *fw_mem_start = (uint8_t*)0;
-
-static uint8_t *fw_mem_end = (uint8_t*)0;
-static uint8_t *fw_mem_alloc_ptr = (uint8_t*)0;
-static uint32_t fw_mem_size = 0;
-
-/* File descriptor for /dev/mem */
-static int dev_mem_fd;
-
-/***************************************************************************************
- * FUNCTION PURPOSE: Initialize memory allocation
- ***************************************************************************************
- * DESCRIPTION: Initialize memory allocation
- ***************************************************************************************/
-fw_Bool_t fw_memAllocInit
-(
- uint8_t *addr, /* Physical address */
- uint32_t size /* Size of block */
-)
-{
- void *map_base;
-
- if((dev_mem_fd = open("/dev/mem", (O_RDWR | O_SYNC))) == -1)
- {
- printf("fw_memAllocInit: Failed to open \"dev/mem\" err=%s\n",
- strerror(errno));
- return fw_FALSE;
- }
-
- map_base = fw_memMap ((void *)addr, size);
-
- if (!map_base)
- {
- printf("fw_memAllocInit: Failed to mmap addr (0x%x)", addr);
- return fw_FALSE;
- }
-
-#ifdef EXT_DEBUG
- printf("fw_memAllocInit: Memory mapped at address %p.\n", map_base);
-#endif
-
- fw_mem_alloc_ptr = fw_mem_start = map_base;
- fw_mem_size = size;
- fw_mem_end = fw_mem_start + fw_mem_size;
- fw_mem_start_phy = addr;
- return fw_TRUE;
-}
-/***************************************************************************************
- * FUNCTION PURPOSE:
- ***************************************************************************************
- * DESCRIPTION:
- ***************************************************************************************/
-void* fw_memAlloc
-(
- uint32_t size,
- uint32_t align
-)
-{
- uint32_t key;
- uint8_t *alloc_ptr;
- void *p_block =NULL;
-
- Osal_fwCsEnter(&key);
- alloc_ptr = (uint8_t*)align((uint32_t)fw_mem_alloc_ptr, align);
- if ((alloc_ptr + size) < fw_mem_end)
- {
- p_block =(void *)alloc_ptr;
- fw_mem_alloc_ptr = alloc_ptr + size;
- Osal_fwCsExit(key);
- memset (p_block, 0, size);
- }
- else
- {
- Osal_fwCsExit(key);
- }
- return p_block;
-}
-/***************************************************************************************
- * FUNCTION PURPOSE: Function to map physical address to virtual memory space
- ***************************************************************************************
- * DESCRIPTION: Function to map physical address to virtual memory space
- ***************************************************************************************/
-void *fw_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("fw_memMap: Failed to get page size err=%s\n",
- strerror(errno));
- return (void *)0;
- }
-
- page_sz = (uint32_t)retval;
-
- if (size%page_sz)
- {
- printf("fw_memMap: error: block size not aligned to page size\n");
- return (void *)0;
- }
-
- if ((uint32_t)addr%page_sz)
- {
- printf("fw_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("fw_memMap: Failed to mmap \"dev/mem\" err=%s\n",
- strerror(errno));
- return (void *)0;
- }
- virt_addr = map_base + ((off_t)addr & mask);
- return(virt_addr);
-}
-
diff --git a/example/simpleExample2/armv7/fw_mem_allocator.h b/example/simpleExample2/armv7/fw_mem_allocator.h
+++ /dev/null
@@ -1,80 +0,0 @@
-
-/******************************************************************************
- * FILE PURPOSE: Memory allocator for running Example
- ******************************************************************************
- * FILE NAME: fw_mem_allocator.h
- *
- * DESCRIPTION: Memory allocator for running Example
- *
- * 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.
- *
- */
-
-#ifndef __FW_MEM_ALLOCATOR_H__
-#define __FW_MEM_ALLOCATOR_H__
-
-/* C Standard library Include */
-#include <stdio.h>
-/* System level header files */
-#include <stdint.h>
-#include <stdlib.h>
-#include "fw_test.h"
-
-/* Physical address of the memory pool */
-extern uint8_t *fw_mem_start_phy;
-/* virtual address of the memory pool */
-extern uint8_t *fw_mem_start;
-
-/* Function to initialize memory allocator */
-fw_Bool_t fw_memAllocInit
-(
- uint8_t *addr, /* Physical address */
- uint32_t size /* Size of block */
-);
-
-/* Function to allocate memory */
-void* fw_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 *fw_memMap
-(
- void *addr, /* Physical address */
- uint32_t size /* Size of block */
-);
-
-#endif
-
diff --git a/example/simpleExample2/armv7/fw_osal.c b/example/simpleExample2/armv7/fw_osal.c
+++ /dev/null
@@ -1,428 +0,0 @@
-/******************************************************************************
- * FILE PURPOSE: Functions to OSAL related routines for running Example
- ******************************************************************************
- * FILE NAME: fw_osal.c
- *
- * DESCRIPTION: Functions to initialize framework resources for running Example
- *
- * 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 "fw_test.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include "fw_mem_allocator.h"
-
-#define System_printf printf
-
-uint32_t Osal_qmss_MallocCounter = 0;
-uint32_t Osal_qmss_FreeCounter = 0;
-uint32_t Osal_cppi_MallocCounter = 0;
-uint32_t Osal_cppi_FreeCounter = 0;
-uint32_t cpswPaMemProtNestedLevel = 0;
-uint32_t globalCritkey;
-
-
-
-/* Lock to be used for critical section */
-pthread_mutex_t mutex_lock;
-
-void fw_osalInit()
-{
- pthread_mutex_init(&mutex_lock, NULL);
- return;
-}
-
-void fw_osalshutdown()
-{
- pthread_mutex_destroy(&mutex_lock);
- return;
-}
-
-static inline void fw_osalEnterCS()
-{
-#if 0
- pthread_mutex_lock(&mutex_lock);
-#endif
- return;
-}
-
-static inline void fw_osalLeaveCS()
-{
-
-#if 0
- pthread_mutex_unlock(&mutex_lock);
-#endif
- return;
-}
-
-/*****************************************************************************
- * FUNCTION PURPOSE: Cache Invalidation Routine
- *****************************************************************************
- * DESCRIPTION: Cache Invalidation Routine
- *****************************************************************************/
-void Osal_invalidateCache (void *blockPtr, uint32_t size)
-{
- /* Stub Function. TBD: Would need to handle when cache is enabled for ARM */
- return;
-}
-
-/*****************************************************************************
- * FUNCTION PURPOSE: Cache Writeback Routine
- *****************************************************************************
- * DESCRIPTION: Cache Invalidation Routine
- *****************************************************************************/
-void Osal_writeBackCache (void *blockPtr, uint32_t size)
-{
- /* Stub Function. TBD: Would need to handle when cache is enabled for ARM */
- return;
-}
-
-
-void * Osal_qmssMtCsEnter()
-{
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
- return NULL;
-}
-
-
-void Osal_qmssMtCsExit(void *key)
-{
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
- return;
-}
-
-
-void Osal_qmssLog ( String fmt, ... )
-{
-}
-
-void* Osal_qmssCsEnter ()
-{
-
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled once infrastructure is available from Kernel
- */
- return(NULL);
-}
-
-void Osal_qmssCsExit (void * key)
-{
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
- return;
-}
-
-Ptr Osal_qmssMalloc (uint32_t num_bytes)
-{
- Ptr ret;
-
- Osal_qmss_MallocCounter++;
- ret = malloc (num_bytes);
- if(ret==NULL)
- {
- System_printf("\nERROR! QMSS Malloc failed!\n");
- }
-
- return ret;
-}
-
-void Osal_qmssFree (Ptr ptr, uint32_t size)
-{
- /* Increment the free counter. */
- Osal_qmss_FreeCounter++;
- free(ptr);
-}
-
-
-void Osal_qmssBeginMemAccess (void *blockPtr, uint32_t size)
-{
- Osal_invalidateCache(blockPtr,size);
- return;
-}
-
-void Osal_qmssEndMemAccess (void *blockPtr, uint32_t size)
-{
- Osal_writeBackCache(blockPtr,size);
- return;
-}
-void* Osal_qmssVirtToPhy (void *ptr)
-{
- if(ptr == NULL)
- {
- return NULL;
- }
- return (void *)(fw_mem_start_phy + ((uint8_t*)ptr - fw_mem_start));
-}
-
-void* Osal_qmssPhyToVirt (void *ptr)
-{
- if(ptr == NULL)
- {
- return NULL;
- }
- return (void *)(fw_mem_start + ((uint8_t*)ptr - fw_mem_start_phy));
-}
-
-/******************************************************************************
-* Function to traverse a CPPI descriptor and convert all address references
-* from virtual to physical.
-******************************************************************************/
-void* Osal_qmssConvertDescVirtToPhy(void *descAddr)
-{
- if (!descAddr) return (void *)0;
-
- if (Cppi_getDescType((Cppi_Desc *)QMSS_DESC_PTR(descAddr)) == Cppi_DescType_HOST)
- {
- Cppi_HostDesc *nextBDPtr = (Cppi_HostDesc *)QMSS_DESC_PTR(descAddr);
- Cppi_HostDesc *prevBDPtr = 0;
- while (nextBDPtr)
- {
- void *buffPtr;
- if (nextBDPtr->buffPtr)
- {
- buffPtr = (void *)nextBDPtr->buffPtr;
- nextBDPtr->buffPtr = (uint32_t)Osal_qmssVirtToPhy((void *)(nextBDPtr->buffPtr));
- if (!(nextBDPtr->buffPtr)) return (void *)0;
- }
-
- if (nextBDPtr->origBuffPtr)
- {
- nextBDPtr->origBuffPtr = (uint32_t)Osal_qmssVirtToPhy((void *)(nextBDPtr->origBuffPtr));
- if (!(nextBDPtr->origBuffPtr)) return (void *)0;
- }
-
- prevBDPtr = nextBDPtr;
- nextBDPtr = (Cppi_HostDesc *)QMSS_DESC_PTR((nextBDPtr->nextBDPtr));
- if (prevBDPtr->nextBDPtr)
- {
- prevBDPtr->nextBDPtr = (uint32_t)Osal_qmssVirtToPhy((void *)(prevBDPtr->nextBDPtr));
- if (!(prevBDPtr->nextBDPtr)) return (void *)0;
- }
-
- Qmss_osalEndMemAccess(buffPtr, prevBDPtr->buffLen);
- Qmss_osalEndMemAccess(prevBDPtr, sizeof(Cppi_HostDesc));
- }
-
- descAddr = Osal_qmssVirtToPhy(descAddr);
- if (!descAddr) return (void *)0;
- }
- else if (Cppi_getDescType((Cppi_Desc *)QMSS_DESC_PTR(descAddr)) == Cppi_DescType_MONOLITHIC)
- {
- descAddr = Osal_qmssVirtToPhy(descAddr);
- if (!descAddr) return (void *)0;
- }
- return descAddr;
-}
-
-/******************************************************************************
-* Function to traverse a CPPI descriptor and convert all address references
-* from physical to virtual.
-******************************************************************************/
-void* Osal_qmssConvertDescPhyToVirt(void *descAddr)
-{
- if (!descAddr) return (void *)0;
- descAddr = Osal_qmssPhyToVirt(descAddr);
-
- if (Cppi_getDescType((Cppi_Desc *)QMSS_DESC_PTR(descAddr)) == Cppi_DescType_HOST)
- {
- Cppi_HostDesc *nextBDPtr = (Cppi_HostDesc *)QMSS_DESC_PTR(descAddr);
- while (nextBDPtr)
- {
- Qmss_osalBeginMemAccess(nextBDPtr, sizeof(Cppi_HostDesc));
- if (nextBDPtr->buffPtr)
- {
- nextBDPtr->buffPtr = (uint32_t)Osal_qmssPhyToVirt((void *)(nextBDPtr->buffPtr));
- if (!(nextBDPtr->buffPtr)) return (void *)0;
- }
-
- if (nextBDPtr->origBuffPtr)
- {
- nextBDPtr->origBuffPtr = (uint32_t)Osal_qmssPhyToVirt((void *)(nextBDPtr->origBuffPtr));
- if (!(nextBDPtr->origBuffPtr)) return (void *)0;
- }
-
- if (nextBDPtr->nextBDPtr)
- {
- nextBDPtr->nextBDPtr = (uint32_t)Osal_qmssPhyToVirt((void *)(nextBDPtr->nextBDPtr));
- if (!(nextBDPtr->nextBDPtr)) return (void *)0;
- }
-
- Qmss_osalBeginMemAccess((void *)(nextBDPtr->buffPtr), nextBDPtr->buffLen);
- nextBDPtr = (void *)QMSS_DESC_PTR((nextBDPtr->nextBDPtr));
- }
- }
- else if (Cppi_getDescType((Cppi_Desc *)QMSS_DESC_PTR(descAddr)) == Cppi_DescType_MONOLITHIC)
- {
- descAddr = Osal_qmssPhyToVirt(descAddr);
- if (!descAddr) return (void *)0;
- }
- return descAddr;
-}
-
-void Osal_cppiCsEnter (uint32_t *key)
-{
-
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
- return;
-}
-
-void Osal_cppiCsExit (uint32_t key)
-{
-
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
- return;
-}
-
-void Osal_cppiLog ( String fmt, ... )
-{
-}
-
-Ptr Osal_cppiMalloc (uint32_t num_bytes)
-{
- Ptr ret;
- Osal_cppi_MallocCounter++;
- num_bytes += (CACHE_LINESZ-1);
- ret = malloc (num_bytes);
- if(ret==NULL)
- {
- System_printf("\nERROR! CPPI Malloc failed!\n");
- }
- return ret;
-}
-
-void Osal_cppiFree (Ptr ptr, uint32_t size)
-{
- /* Increment the free counter. */
- Osal_cppi_FreeCounter++;
- free(ptr);
-}
-
-void Osal_cppiBeginMemAccess (void *blockPtr, uint32_t size)
-{
- Osal_invalidateCache(blockPtr,size);
- return;
-}
-
-void Osal_cppiEndMemAccess (void *blockPtr, uint32_t size)
-{
- Osal_writeBackCache(blockPtr,size);
- return;
-}
-
-void Osal_fwCsEnter (uint32_t *key)
-{
-
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
- return;
-}
-
-void Osal_fwCsExit (uint32_t key)
-{
-
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
- return;
-}
-
-void Osal_paBeginMemAccess (Ptr addr, uint32_t size)
-{
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
-
-}
-
-void Osal_paEndMemAccess (Ptr addr, uint32_t size)
-{
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
-}
-
-
-/**
- * @b Description
- * @n
- * The function is used to enter a critical section.
- * Function protects against
- *
- * access from multiple threads on single core
- * and
- * access from multiple cores
- *
- * @param[in] key
- * Key used to lock the critical section.
- *
- * @retval
- * Not Applicable
- */
-void Osal_paMtCsEnter (uint32_t *key)
-{
-
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
-}
-
-/**
- * @b Description
- * @n
- * The function is used to exit a critical section
- * protected using Osal_salldCsEnter() API.
- *
- * @param[in] key
- * Key used to unlock the critical section.
- *
- * @retval
- * Not Applicable
- */
-void Osal_paMtCsExit (uint32_t key)
-{
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
-}
-
diff --git a/example/simpleExample2/armv7/fw_test.h b/example/simpleExample2/armv7/fw_test.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- * @file fw_test.h
- *
- * @brief
- * Holds all the constants and API definitions required by the example
- * application to run.
- *
- * \par
- * ============================================================================
- * @n (C) Copyright 2012, Texas Instruments, Inc.
- *
- * 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.
- *
-*/
-#ifndef _FW_TEST_H_
-#define _FW_TEST_H_
-
-/* C Standard library Include */
-#include <stdio.h>
-/* System level header files */
-#include <stdint.h>
-#include <stdlib.h>
-
-#include <sys/types.h>
-#include <string.h>
-#include <ti/drv/pa/pa.h>
-
-
-/* CPPI LLD include */
-#include <ti/drv/cppi/cppi_drv.h>
-#include <ti/drv/cppi/cppi_desc.h>
-
-/* QMSS LLD include */
-#include <ti/drv/qmss/qmss_drv.h>
-
-
-#define System_printf printf
-
-#define CACHE_LINESZ 64
-
-/* Workaround not to use flow ID 0 as it is currently used by Kernel */
-#define FLOW_WORKAROUND 1
-
-typedef uint16_t fw_Bool_t;
-#define fw_TRUE 1
-#define fw_FALSE 0
-
-/* Total Permanent memory required in Example
- * for Packet buffers & descriptor buffers
- * Allocating entire MSMC
- */
-#define MSMC_TEST_PERM_MEM_SZ (2*1024*1024)
-
-/* Physical address map & size for various subsystems */
-#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_BASE_QUEUE_PROXY_ADDR 0x44040000
-#define QMSS_DATA_BLK_SZ (0x60000)
-#define SRIO_CFG_BASE_ADDR CSL_SRIO_CONFIG_REGS
-#define SRIO_CFG_BLK_SZ (132*1024)
-#define PASS_CFG_BASE_ADDR CSL_PA_SS_CFG_REGS
-#define PASS_CFG_BLK_SZ (1*1024*1024)
-#define MSMC_SRAM_BASE_ADDR CSL_MSMC_SRAM_REGS
-
-/* Global variables to hold virtual address of various subsystems */
-void *fw_qmssCfgVaddr;
-void *fw_qmssDataVaddr;
-void *fw_srioCfgVaddr;
-void *fw_passCfgVaddr;
-
-
-/** Enable Extended Debug with printfs */
-/*
-#define EXT_DEBUG 1
-*/
-
-/** Number of ports in the ethernet subsystem */
-#define NUM_PORTS 3u
-
-/** Number of MAC/GMII ports in the ethernet switch */
-#define NUM_MAC_PORTS 2u
-
-/** Number of host descriptors used by the CPSW example program */
-#define NUM_HOST_DESC 32
-
-/** Host descriptor size.
- *
- * Big enough to hold the mandatory fields of the
- * host descriptor and PA Control Data
- *
- * = 32 bytes for Host desc + PA Control data
- */
-#define SIZE_HOST_DESC 80
-
-/** Number of PA Tx queues available */
-#define NUM_PA_TX_QUEUES 9
-
-/** Number of PA Rx channels available */
-#define NUM_PA_RX_CHANNELS 24
-
-/* Number of Tx Free descriptors to allocate */
-#define NUM_TX_DESC NUM_HOST_DESC/2
-
-/* Number of Rx Free descriptors to allocate */
-#define NUM_RX_DESC NUM_HOST_DESC/2
-
-/* Buffer sizes configured for
- * - maximum command size to PA
- * - Maximum size of the control messages
- * from DSP
- * - Maximum size of the packets being transmitted
- */
-#define TX_BUF_SIZE (((300+15)/16)*16)
-#define RX_BUF_SIZE TX_BUF_SIZE
-
-
-/* Define LoopBack modes */
-#define PASS_LOOPBACK_INTERNAL 1
-#define PASS_LOOPBACK_EXTERNAL 2
-
-/* Invalidate cache. This should invalidate Cache
- * Wait until operation is complete. Currently stub function
- */
-#define SYS_CACHE_INV(addr, size, code) Osal_invalidateCache(addr,size)
-
-/* Writeback L2 cache. This should Writeback L1D as well.
- * Wait until operation is complete. Currently stub function
- */
-#define SYS_CACHE_WB(addr, size, code) Osal_writeBackCache(addr,size)
-#define ALIGN(x) __attribute__((aligned (x)))
-
-extern int32_t passLpbkMode;
-extern Cppi_FlowHnd gRxFlowHnd;
-
-
-extern int32_t Init_Qmss (void);
-extern int32_t Init_Cppi (void);
-extern int32_t Init_PASS (void);
-extern int32_t Setup_Tx (void);
-extern int32_t Setup_Rx (void);
-extern int32_t Setup_PASS (void);
-extern int32_t SendPacket (void);
-extern int32_t getPaStats (void);
-extern void CycleDelay (int32_t count);
-extern int32_t ReceivePacket (void);
-extern int32_t VerifyPacket (Cppi_Desc* pCppiDesc);
-extern void Osal_invalidateCache (void *blockPtr, uint32_t size);
-extern void Osal_writeBackCache (void *blockPtr, uint32_t size);
-#endif
diff --git a/example/simpleExample2/armv7/pa_mgmt.c b/example/simpleExample2/armv7/pa_mgmt.c
+++ /dev/null
@@ -1,942 +0,0 @@
-/**
- * @file pa_mgmt.c
- *
- * @brief
- * Packet accelerator subsystem management functions.
- *
- * \par
- * ============================================================================
- * @n (C) Copyright 2009, Texas Instruments, Inc.
- *
- * 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.
- *
-*/
-
-/* PA LLD include */
-#include <ti/drv/pa/pa.h>
-
-/* PASS RL file */
-#include <ti/csl/cslr_device.h>
-#include <ti/csl/cslr_pa_ss.h>
-
-/* Firmware images */
-#include <ti/drv/pa/fw/pafw.h>
-#include "fw_test.h"
-
-/* PA command response queue handle */
-Qmss_QueueHnd gPaCfgCmdRespQHnd;
-
-/* Number of PA internal buffers to allocate */
-#define PA_NUM_BUFFERS 3
-
-/* PA definitions */
-#define MAX_NUM_L2_HANDLES 10
-#define MAX_NUM_L3_HANDLES 20
-#define MAX_NUM_L4_HANDLES 40
-
-#define BUFSIZE_PA_INST 256
-#define BUFSIZE_L2_TABLE 1000
-#define BUFSIZE_L3_TABLE 4000
-
-/* PA instance */
-#pragma DATA_ALIGN(paBuf0, CACHE_LINESZ)
-uint8_t gPAInst[BUFSIZE_PA_INST]ALIGN(CACHE_LINESZ);
-
-/* PA Driver Handle */
-Pa_Handle gPAInstHnd;
-
-/* Memory used for PA handles */
-#pragma DATA_ALIGN(gMemL2Ram, CACHE_LINESZ)
-uint8_t gMemL2Ram[BUFSIZE_L2_TABLE]ALIGN(CACHE_LINESZ);
-
-#pragma DATA_ALIGN(gMemL3Ram, CACHE_LINESZ)
-uint8_t gMemL3Ram[BUFSIZE_L3_TABLE]ALIGN(CACHE_LINESZ);
-
-paHandleL2L3_t gPaL2Handles[MAX_NUM_L2_HANDLES]ALIGN(CACHE_LINESZ);
-paHandleL2L3_t gPaL3Handles[MAX_NUM_L3_HANDLES]ALIGN(CACHE_LINESZ);
-paHandleL4_t gPaL4Handles[MAX_NUM_L4_HANDLES]ALIGN(CACHE_LINESZ);
-
-extern Qmss_QueueHnd gPaTxQHnd [NUM_PA_TX_QUEUES], gTxFreeQHnd, gRxFreeQHnd, gRxQHnd;
-
-/** ============================================================================
- * @n@b CycleDelay
- *
- * @b Description
- * @n This API implements a clock delay logic using the Time Stamp Counter (TSC)
- * of the DSP.
- *
- * @param[in]
- * @n count Number of delay cycles to wait.
- *
- * @return
- * @n None
- * =============================================================================
- */
-void CycleDelay (int32_t count)
-{
- uint32_t sat;
-
- for (sat=0; sat<count; sat++);
-}
-
-
-
-/** ============================================================================
- * @n@b Add_MACAddress
- *
- * @b Description
- * @n This API adds the switch MAC address to the PA PDSP Lookup table. This
- * ensures that all packets destined for this MAC address get processed
- * for forwarding to the host.
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-
-static uint8_t srcMac[6] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
-
-int32_t Add_MACAddress (void)
-{
- int32_t j;
- uint16_t cmdSize;
- Qmss_Queue cmdReplyQInfo;
- paEthInfo_t ethInfo = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Src mac = dont care */
- { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15 }, /* Dest mac */
- 0, /* vlan = dont care */
- 0x0800, /* ether type = IPv4 */
- 0, /* MPLS tag = don't care */
- pa_EMAC_PORT_NOT_SPECIFIED /* Input EMAC port */
- };
-
-
-
- paRouteInfo_t routeInfo = { pa_DEST_CONTINUE_PARSE_LUT1, /* Continue parsing */
- 0, /* Flow Id = dont care */
- 0, /* queue = dont care */
- 0, /* multi route = dont care */
- 0, /* swinfo0 = dont care */
- 0, /* SwInfo 1 is dont care */
- 0, /* customType = pa_CUSTOM_TYPE_NONE */ \
- 0, /* customIndex: not used */ \
- 0, /* pkyType: for SRIO only */ \
- NULL /* No commands */
- };
- paRouteInfo_t nFailInfo = { pa_DEST_DISCARD, /* Toss the packet */
- 0, /* Flow Id = dont care */
- 0, /* queue = dont care */
- 0, /* mutli route = dont care */
- 0, /* swinfo0 = dont care */
- 0, /* SwInfo 1 is dont care */
- 0, /* customType = pa_CUSTOM_TYPE_NONE */ \
- 0, /* customIndex: not used */ \
- 0, /* pkyType: for SRIO only */ \
- NULL /* No commands */
- };
- paCmdReply_t cmdReplyInfo = { pa_DEST_HOST, /* Replies go to the host */
- 0, /* User chosen ID to go to swinfo0 */
- 0, /* Destination queue */
- 0 /* Flow ID */
- };
- paReturn_t retVal;
- paEntryHandle_t retHandle;
- int32_t handleType, cmdDest;
- uint32_t psCmd = ((uint32_t)(4 << 5) << 24);
- uint32_t myswinfo[] = {0x11112222, 0x33334444};
- Cppi_HostDesc* pHostDesc;
-
- /* Get a Tx free descriptor to send a command to the PA PDSP */
- if ((pHostDesc = Qmss_queuePop (gTxFreeQHnd)) == NULL)
- {
- System_printf ("Error obtaining a Tx free descriptor \n");
- return -1;
- }
-
- /* The descriptor address returned from the hardware has the
- * descriptor size appended to the address in the last 4 bits.
- *
- * To get the true descriptor pointer, always mask off the last
- * 4 bits of the address.
- */
- pHostDesc = (Ptr) ((uint32_t) pHostDesc & 0xFFFFFFF0);
- pHostDesc->buffLen = pHostDesc->origBufferLen;
-
- cmdSize = pHostDesc->buffLen;
- cmdReplyInfo.replyId = 0x11111111; /* unique for each add mac command */
- cmdReplyInfo.flowId = (uint8_t)Cppi_getFlowId(gRxFlowHnd);
-
- /* Get the PA response queue number and populate the destination queue number
- * in the PA response configuration.
- */
- cmdReplyQInfo = Qmss_getQueueNumber (gPaCfgCmdRespQHnd);
- cmdReplyInfo.queue = cmdReplyQInfo.qNum;
-
- /* Use Source MAC as destination MAC for loopback */
- if(passLpbkMode != PASS_LOOPBACK_INTERNAL)
- {
- memcpy(ethInfo.dst, srcMac, sizeof(srcMac));
- }
-
- retVal = Pa_addMac (gPAInstHnd,
- pa_LUT1_INDEX_NOT_SPECIFIED,
- ðInfo,
- &routeInfo,
- &nFailInfo,
- &gPaL2Handles[0],
- (paCmd_t) pHostDesc->buffPtr,
- &cmdSize,
- &cmdReplyInfo,
- &cmdDest);
- if (retVal != pa_OK)
- {
- System_printf ("Pa_addMac returned error %d\n", retVal);
- return -1;
- }
-
- /* This sets the extended info for descriptors, and this is required so PS info
- * goes to the right spot
- */
- Cppi_setSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)pHostDesc, (uint8_t *)myswinfo);
-
- /* Set the buffer length to the size used. It must be restored when the descriptor
- * is returned
- */
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)pHostDesc, cmdSize);
- pHostDesc->buffLen = cmdSize;
-
- /* Mark the packet as a configuration packet */
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)pHostDesc, (uint8_t *)&psCmd, 4);
-
- /* Send the command to the PA and wait for the return */
- Qmss_queuePush (gPaTxQHnd[cmdDest - pa_CMD_TX_DEST_0],
- pHostDesc,
- pHostDesc->buffLen,
- SIZE_HOST_DESC,
- Qmss_Location_TAIL
- );
-
- /* Poll on the PA response queue to see if response from PA has come */
- for (j = 0; j < 100; j++)
- {
- CycleDelay (1000);
-
- if (Qmss_getQueueEntryCount (gPaCfgCmdRespQHnd) > 0)
- {
- /* We have a response from PA PDSP for the command we submitted earlier for
- * MAC address addition.
- */
- pHostDesc = Qmss_queuePop (gPaCfgCmdRespQHnd);
-
- /* Clear the size bytes */
- pHostDesc = (Ptr) ((uint32_t) pHostDesc & 0xFFFFFFF0);
-
- if (pHostDesc->softwareInfo0 != cmdReplyInfo.replyId)
- {
- System_printf ("Found an entry in PA response queue with swinfo0 = 0x%08x, expected 0x%08x\n",
- pHostDesc->softwareInfo0, cmdReplyInfo.replyId);
- pHostDesc->buffLen = pHostDesc->origBufferLen;
- Qmss_queuePush (gRxFreeQHnd, pHostDesc, pHostDesc->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);
-
- return -1;
- }
-
- retVal = Pa_forwardResult (gPAInstHnd, (Ptr)pHostDesc->buffPtr, &retHandle, &handleType, &cmdDest);
- if (retVal != pa_OK)
- {
- System_printf ("PA sub-system rejected Pa_addMac command\n");
- return -1;
- }
-
- /* Reset the buffer lenght and put the descriptor back on the Rx free queue */
- pHostDesc->buffLen = pHostDesc->origBufferLen;
- Qmss_queuePush (gRxFreeQHnd, pHostDesc, pHostDesc->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);
-
- break;
- }
- }
-
- if (j == 100)
- {
- System_printf ("Timeout waiting for reply from PA to Pa_addMac command\n");
- return -1;
- }
-
- return 0;
-}
-
-/** ============================================================================
- * @n@b Add_IPAddress
- *
- * @b Description
- * @n This API adds the IP Address the application's using to the PA PDSP
- * Lookup table. This ensures that all packets destined for this
- * IP address get forwarded up to the host.
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-int32_t Add_IPAddress (void)
-{
- int32_t j;
- uint16_t cmdSize;
- Qmss_Queue cmdReplyQInfo;
- paIpInfo_t ipInfo = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP source = dont care */
- { 0xc0, 0xa8, 0x01, 0xa, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP dest */
- 0, /* SPI = dont care */
- 0, /* flow = dont care */
- pa_IPV4, /* IP type */
- 0, /* GRE protocol */
- 0, /* Ip protocol = dont care (TCP or UDP or anything else) */
- 0, /* TOS */
- FALSE, /* TOS = dont care (seperate field since TOS=0 is valid */
- 0 /* SCTP destination port = dont care */
- };
- int32_t macLink = {0}; /* Link this with the first MAC address created */
- paRouteInfo_t routeInfo = { pa_DEST_CONTINUE_PARSE_LUT2, /* Continue parsing */
- 0, /* Flow Id = dont care */
- 0, /* queue = dont care */
- 0, /* multi route = dont care */
- 0, /* swinfo0 = dont care */
- 0, /* SwInfo 1 is dont care */
- 0, /* customType = pa_CUSTOM_TYPE_NONE */ \
- 0, /* customIndex: not used */ \
- 0, /* pkyType: for SRIO only */ \
- NULL /* No commands */
- };
- paRouteInfo_t nFailInfo = { pa_DEST_DISCARD, /* Toss the packet */
- 0, /* Flow Id = dont care */
- 0, /* queue = dont care */
- 0, /* mutli route = dont care */
- 0, /* swinfo0 = dont care */
- 0, /* SwInfo 1 is dont care */
- 0, /* customType = pa_CUSTOM_TYPE_NONE */ \
- 0, /* customIndex: not used */ \
- 0, /* pkyType: for SRIO only */ \
- NULL /* No commands */
- };
- paCmdReply_t cmdReplyInfo = { pa_DEST_HOST, /* Replies go to the host */
- 0, /* User chosen ID to go to swinfo0 */
- 0, /* Destination queue */
- 0 /* Flow ID */
- };
- paReturn_t retVal;
- paEntryHandle_t retHandle;
- int32_t handleType, cmdDest;
- uint32_t psCmd = ((uint32_t)(4 << 5) << 24);
- uint32_t myswinfo[] = {0x11112222, 0x33334444};
- Cppi_HostDesc* pHostDesc;
-
- /* Get a Tx free descriptor to send a command to the PA PDSP */
- if ((pHostDesc = Qmss_queuePop (gTxFreeQHnd)) == NULL)
- {
- System_printf ("Error obtaining a Tx free descriptor \n");
- return -1;
- }
-
- /* The descriptor address returned from the hardware has the
- * descriptor size appended to the address in the last 4 bits.
- *
- * To get the true descriptor pointer, always mask off the last
- * 4 bits of the address.
- */
- pHostDesc = (Ptr) ((uint32_t) pHostDesc & 0xFFFFFFF0);
- pHostDesc->buffLen = pHostDesc->origBufferLen;
-
- cmdSize = pHostDesc->buffLen;
- cmdReplyInfo.replyId = 0x11111111; /* unique for each add mac command */
- cmdReplyInfo.flowId = (uint8_t)Cppi_getFlowId(gRxFlowHnd);
-
- /* Get the PA response queue number and populate the destination queue number
- * in the PA response configuration.
- */
- cmdReplyQInfo = Qmss_getQueueNumber (gPaCfgCmdRespQHnd);
- cmdReplyInfo.queue = cmdReplyQInfo.qNum;
-
- retVal = Pa_addIp (gPAInstHnd,
- pa_LUT_INST_NOT_SPECIFIED,
- pa_LUT1_INDEX_NOT_SPECIFIED,
- &ipInfo,
- gPaL2Handles [macLink],
- &routeInfo,
- &nFailInfo,
- &gPaL3Handles[0],
- (paCmd_t) pHostDesc->buffPtr,
- &cmdSize,
- &cmdReplyInfo,
- &cmdDest);
- if (retVal != pa_OK)
- {
- System_printf ("Pa_addIp returned error %d\n", retVal);
- return -1;
- }
-
- /* This sets the extended info for descriptors, and this is required so PS info
- * goes to the right spot
- */
- Cppi_setSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)pHostDesc, (uint8_t *)myswinfo);
-
- /* Set the buffer length to the size used. It must be restored when the descriptor
- * is returned
- */
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)pHostDesc, cmdSize);
- pHostDesc->buffLen = cmdSize;
-
- /* Mark the packet as a configuration packet */
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)pHostDesc, (uint8_t *)&psCmd, 4);
-
- /* Send the command to the PA and wait for the return */
- Qmss_queuePush (gPaTxQHnd[cmdDest - pa_CMD_TX_DEST_0],
- pHostDesc,
- pHostDesc->buffLen,
- SIZE_HOST_DESC,
- Qmss_Location_TAIL
- );
-
- /* Poll on the PA response queue to see if response from PA has come */
- for (j = 0; j < 100; j++)
- {
- CycleDelay (1000);
-
- if (Qmss_getQueueEntryCount (gPaCfgCmdRespQHnd) > 0)
- {
- /* We have a response from PA PDSP for the command we submitted earlier for
- * MAC address addition.
- */
- pHostDesc = Qmss_queuePop (gPaCfgCmdRespQHnd);
-
- /* Clear the size bytes */
- pHostDesc = (Ptr) ((uint32_t) pHostDesc & 0xFFFFFFF0);
-
- if (pHostDesc->softwareInfo0 != cmdReplyInfo.replyId)
- {
- System_printf ("Found an entry in PA response queue with swinfo0 = 0x%08x, expected 0x%08x\n",
- pHostDesc->softwareInfo0, cmdReplyInfo.replyId);
- pHostDesc->buffLen = pHostDesc->origBufferLen;
- Qmss_queuePush (gRxFreeQHnd, pHostDesc, pHostDesc->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);
-
- return -1;
- }
-
- retVal = Pa_forwardResult (gPAInstHnd, (Ptr)pHostDesc->buffPtr, &retHandle, &handleType, &cmdDest);
- if (retVal != pa_OK)
- {
- System_printf ("PA sub-system rejected Pa_addIp command\n");
- return -1;
- }
-
- /* Reset the buffer lenght and put the descriptor back on the Rx free queue */
- pHostDesc->buffLen = pHostDesc->origBufferLen;
- Qmss_queuePush (gRxFreeQHnd, pHostDesc, pHostDesc->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);
-
- break;
- }
- }
-
- if (j == 100)
- {
- System_printf ("Timeout waiting for reply from PA to Pa_addMac command\n");
- return -1;
- }
-
- return 0;
-}
-
-/** ============================================================================
- * @n@b Add_Port
- *
- * @b Description
- * @n This API adds the UDP port the application's using to the PA PDSP
- * Lookup table. This ensures that all packets destined for this
- * UDP port get forwarded up to the host.
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-int32_t Add_Port (void)
-{
- int32_t j;
- uint16_t cmdSize;
- Qmss_Queue cmdReplyQInfo;
- Qmss_Queue rxQInfo;
- uint16_t ports = {0x5678};
-
- int32_t ipLink = {0}; /* Link this with the first IP address created */
- paRouteInfo_t routeInfo = { pa_DEST_HOST, /* Route a match to the host */
- 0, /* Flow ID 0 */
- 0, /* Destination queue */
- -1, /* Multi route disabled */
- 0xaaaaaaaa, /* SwInfo 0 */
- 0, /* SwInfo 1 is dont care */
- 0, /* customType = pa_CUSTOM_TYPE_NONE */ \
- 0, /* customIndex: not used */ \
- 0, /* pkyType: for SRIO only */ \
- NULL /* No commands */
- };
- paCmdReply_t cmdReplyInfo = { pa_DEST_HOST, /* Replies go to the host */
- 0, /* User chosen ID to go to swinfo0 */
- 0, /* Destination queue */
- 0 /* Flow ID */
- };
- paReturn_t retVal;
- paEntryHandle_t retHandle;
- int32_t handleType, cmdDest;
- uint32_t psCmd = ((uint32_t)(4 << 5) << 24);
- uint32_t myswinfo[] = {0x11112222, 0x33334444};
- Cppi_HostDesc* pHostDesc;
-
- routeInfo.flowId = (uint8_t)Cppi_getFlowId(gRxFlowHnd);
-
- /* Get a Tx free descriptor to send a command to the PA PDSP */
- if ((pHostDesc = Qmss_queuePop (gTxFreeQHnd)) == NULL)
- {
- System_printf ("Error obtaining a Tx free descriptor \n");
- return -1;
- }
-
- /* The descriptor address returned from the hardware has the
- * descriptor size appended to the address in the last 4 bits.
- *
- * To get the true descriptor pointer, always mask off the last
- * 4 bits of the address.
- */
- pHostDesc = (Ptr) ((uint32_t) pHostDesc & 0xFFFFFFF0);
- pHostDesc->buffLen = pHostDesc->origBufferLen;
-
- cmdSize = pHostDesc->buffLen;
- cmdReplyInfo.replyId = 0x11111111; /* unique for each add mac command */
-
- /* Get the PA response queue number and populate the destination queue number
- * in the PA response configuration.
- */
- cmdReplyQInfo = Qmss_getQueueNumber (gPaCfgCmdRespQHnd);
- cmdReplyInfo.queue = cmdReplyQInfo.qNum;
- cmdReplyInfo.flowId = (uint8_t)Cppi_getFlowId(gRxFlowHnd);
-
- /* Setup the Rx queue as destination for the packets */
- rxQInfo = Qmss_getQueueNumber (gRxQHnd);
- routeInfo.queue = rxQInfo.qNum;
-
- retVal = Pa_addPort (gPAInstHnd,
- pa_LUT2_PORT_SIZE_16,
- ports,
- gPaL3Handles [ipLink],
- FALSE, /* New Entry required */
- pa_PARAMS_NOT_SPECIFIED,
- &routeInfo,
- gPaL4Handles[0],
- (paCmd_t) pHostDesc->buffPtr,
- &cmdSize,
- &cmdReplyInfo,
- &cmdDest);
- if (retVal != pa_OK)
- {
- System_printf ("Pa_addPort returned error %d\n", retVal);
- return -1;
- }
-
- /* This sets the extended info for descriptors, and this is required so PS info
- * goes to the right spot
- */
- Cppi_setSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)pHostDesc, (uint8_t *)myswinfo);
-
- /* Set the buffer length to the size used. It must be restored when the descriptor
- * is returned
- */
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)pHostDesc, cmdSize);
- pHostDesc->buffLen = cmdSize;
-
- /* Mark the packet as a configuration packet */
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)pHostDesc, (uint8_t *)&psCmd, 4);
-
- /* Send the command to the PA and wait for the return */
- Qmss_queuePush (gPaTxQHnd[cmdDest - pa_CMD_TX_DEST_0],
- pHostDesc,
- pHostDesc->buffLen,
- SIZE_HOST_DESC,
- Qmss_Location_TAIL
- );
-
- /* Poll on the PA response queue to see if response from PA has come */
- for (j = 0; j < 100; j++)
- {
- CycleDelay (1000);
-
- if (Qmss_getQueueEntryCount (gPaCfgCmdRespQHnd) > 0)
- {
- /* We have a response from PA PDSP for the command we submitted earlier for
- * MAC address addition.
- */
- pHostDesc = Qmss_queuePop (gPaCfgCmdRespQHnd);
-
- /* Clear the size bytes */
- pHostDesc = (Ptr) ((uint32_t) pHostDesc & 0xFFFFFFF0);
-
- if (pHostDesc->softwareInfo0 != cmdReplyInfo.replyId)
- {
- System_printf ("Found an entry in PA response queue with swinfo0 = 0x%08x, expected 0x%08x\n",
- pHostDesc->softwareInfo0, cmdReplyInfo.replyId);
- pHostDesc->buffLen = pHostDesc->origBufferLen;
- Qmss_queuePush (gRxFreeQHnd, pHostDesc, pHostDesc->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);
-
- return -1;
- }
-
- retVal = Pa_forwardResult (gPAInstHnd, (Ptr)pHostDesc->buffPtr, &retHandle, &handleType, &cmdDest);
- if (retVal != pa_OK)
- {
- System_printf ("PA sub-system rejected Pa_addPort command\n");
- return -1;
- }
-
- /* Reset the buffer lenght and put the descriptor back on the Rx free queue */
- pHostDesc->buffLen = pHostDesc->origBufferLen;
- Qmss_queuePush (gRxFreeQHnd, pHostDesc, pHostDesc->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);
-
- break;
- }
- }
-
- if (j == 100)
- {
- System_printf ("Timeout waiting for reply from PA to Pa_addMac command\n");
- return -1;
- }
-
- return 0;
-}
-
-/** ============================================================================
- * @n@b Init_PASS
- *
- * @b Description
- * @n This API initializes the PASS/PDSP and opens a queue that the application
- * can use to receive command responses from the PASS.
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-int32_t Init_PASS (void)
-{
- uint8_t isAllocated;
- paSizeInfo_t paSize;
- paConfig_t paCfg;
- int32_t retVal;
- int32_t sizes[pa_N_BUFS];
- int32_t aligns[pa_N_BUFS];
- void* bases[pa_N_BUFS];
-
- memset(&paSize, 0, sizeof(paSizeInfo_t));
- memset(&paCfg, 0, sizeof(paConfig_t));
-
- /* Allocate space for the PA LLD buffers. The buffers we need to
- * allocate space are:
- * (1) PA LLD Instance Info Handle
- * (2) PA LLD L2 Handle database
- * (3) PA LLD L3 Handle database
- */
- paSize.nMaxL2 = MAX_NUM_L2_HANDLES;
- paSize.nMaxL3 = MAX_NUM_L3_HANDLES;
- paSize.nUsrStats = 0;
- if ((retVal = Pa_getBufferReq(&paSize, sizes, aligns)) != pa_OK)
- {
- System_printf ("Pa_getBufferReq returned error %d\n", retVal);
- return -1;
- }
-
- /* Validate the buffer allocations */
- /* The first buffer is always the instance buffer */
- if ((uint32_t)gPAInst & (aligns[0] - 1))
- {
- System_printf ("Pa_getBufferReq requires %d alignment for instance buffer, but address is 0x%08x\n", aligns[0], (uint32_t)gPAInst);
- return -1;
- }
-
- if (sizeof(gPAInst) < sizes[0])
- {
- System_printf ("Pa_getBufferReq requires %d bytes for instance buffer, have only %d\n", sizes[0], sizeof(gPAInst));
- return -1;
- }
-
- bases[0] = (void *)gPAInst;
-
- /* The second buffer is the L2 table */
- if ((uint32_t)gMemL2Ram & (aligns[1] - 1))
- {
- System_printf ("Pa_getBufferReq requires %d alignment for buffer 1, but address is 0x%08x\n", aligns[1], (uint32_t)gMemL2Ram);
- return (-1);
- }
-
- if (sizeof(gMemL2Ram) < sizes[1])
- {
- System_printf ("Pa_getBufferReq requires %d bytes for buffer 1, have only %d\n", sizes[1], sizeof(gMemL2Ram));
- return -1;
- }
-
- bases[1] = (void *)gMemL2Ram;
-
- /* The third buffer is the L3 table */
- if ((uint32_t)gMemL3Ram & (aligns[2] - 1))
- {
- System_printf ("Pa_alloc requires %d alignment for buffer 1, but address is 0x%08x\n", aligns[2], (uint32_t)gMemL3Ram);
- return (-1);
- }
-
- if (sizeof(gMemL3Ram) < sizes[2])
- {
- System_printf ("Pa_alloc requires %d bytes for buffer 1, have only %d\n", sizes[2], sizeof(gMemL3Ram));
- return (-1);
- }
-
- bases[2] = (void *)gMemL3Ram;
-
- bases[3] = 0;
-
- /* Finally initialize the PA LLD */
- paCfg.initTable = TRUE;
- paCfg.initDefaultRoute = TRUE;
- paCfg.baseAddr = (uint32_t)fw_passCfgVaddr;
- paCfg.sizeCfg = &paSize;
- if ((retVal = Pa_create (&paCfg, bases, &gPAInstHnd)) != pa_OK)
- {
- System_printf ("Pa_create returned with error code %d\n", retVal);
- return -1;
- }
-
- /* Download of PASS PDSP firmware being skipped as this is already taken care by Kernel*/
-
- /* Open a PA Command Response Queue.
- *
- * This queue will be used to hold responses from the PA PDSP for all the
- * commands issued by the example application.
- *
- * This queue is used only at configuration time to setup the PA PDSP.
- */
- if ((gPaCfgCmdRespQHnd = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, QMSS_PARAM_NOT_SPECIFIED, &isAllocated)) < 0)
- {
- System_printf ("Error opening a PA Command Response queue \n");
- return -1;
- }
-
- /* Init done. Return success. */
- return 0;
-}
-
-/** ============================================================================
- * @n@b Setup_PASS
- *
- * @b Description
- * @n This API sets up the PA LLD/PDSP with MAC/IP/UDP configuration used by
- * the example application.
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-int32_t Setup_PASS (void)
-{
- /* Setup the PA PDSP to forward packets matching our switch MAC
- * address up to the host onto the example application.
- */
- if (Add_MACAddress () != 0)
- {
- return -1;
- }
-
- /* Add the IP address the example uses */
- if (Add_IPAddress () != 0)
- {
- return -1;
- }
-
- /* Add the port number on which our application is going to listen on */
- if (Add_Port () != 0)
- {
- return -1;
- }
-
- /* Return success */
- return 0;
-}
-
-int32_t getPaStats (void)
-{
- Cppi_HostDesc * hd;
- Qmss_Queue q;
- uint16_t csize;
- paReturn_t paret;
- paCmdReply_t cmdReplyInfo = { pa_DEST_HOST, /* Replies go to the host */
- 0, /* User chosen ID to go to swinfo0 */
- 0, /* Destination queue */
- 0 /* Flow ID */
- };
- int32_t cmdDest;
-
- paSysStats_t * stats;
-
- int32_t j;
- uint32_t myswinfo[] = { 0x11112222, 0x33334444 };
- uint32_t psCmd = ((uint32_t)(4 << 5) << 24); /* Command word - will be moved to common pa/sa file */
- Qmss_Queue cmdReplyQInfo;
-
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (gTxFreeQHnd)) & ~0xf);
- q = Qmss_getQueueNumber (gTxFreeQHnd);
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- csize = hd->buffLen;
- cmdReplyInfo.replyId = 0x11111111;
- cmdReplyInfo.flowId = (uint8_t)Cppi_getFlowId(gRxFlowHnd);
- /* Get the PA response queue number and populate the destination queue number
- * in the PA response configuration.
- */
- cmdReplyQInfo = Qmss_getQueueNumber (gPaCfgCmdRespQHnd);
- cmdReplyInfo.queue = cmdReplyQInfo.qNum;
-
- paret = Pa_requestStats (gPAInstHnd,
- FALSE,
- (paCmd_t) hd->buffPtr,
- &csize,
- &cmdReplyInfo,
- &cmdDest);
-
-
- if (paret != pa_OK) {
- System_printf ("function getPaStats: call to Pa_requestStats returned error code %d\n", paret);
- return (-1);
- }
-
- /* This sets the extended info for descriptors, and this is required so PS info
- * goes to the right spot */
- Cppi_setSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)myswinfo);
-
- /* Set the buffer length to the size used. It will be restored when the descriptor
- * is returned */
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, csize);
- hd->buffLen = csize;
-
- /* Mark the packet as a configuration packet */
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
-
-
- /* Send the request to the PA */
- Qmss_queuePush (gPaTxQHnd[cmdDest - pa_CMD_TX_DEST_0], (uint32_t *)hd, csize, SIZE_HOST_DESC, Qmss_Location_TAIL);
-
- CycleDelay (100000);
-
- /* Wait for the PA to return a response */
- for (j = 0; j < 100; j++) {
- CycleDelay (1000);
-
- if (Qmss_getQueueEntryCount (gPaCfgCmdRespQHnd) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (gPaCfgCmdRespQHnd)) & ~0xf);
-
- if (hd->softwareInfo0 != cmdReplyInfo.replyId) {
- System_printf ("function getPaStats: Found an entry in PA reply queue with swinfo0 = 0x%08x, expected 0x%08x\n",
- hd->softwareInfo0, cmdReplyInfo.replyId);
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (gTxFreeQHnd, hd, hd->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);
-
- return (-1);
- }
-
-
- stats = (paSysStats_t *)Pa_formatStatsReply (gPAInstHnd, (paCmd_t)hd->buffPtr);
- if (stats == NULL) {
- System_printf ("function getPaStats: Pa_formatStats returned invalid stats\n");
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (gTxFreeQHnd, hd, hd->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);
- return (-1);
- }
-
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (gTxFreeQHnd, hd, hd->buffLen, SIZE_HOST_DESC, Qmss_Location_TAIL);
-
-
- System_printf ("--- PA STATS --- \n");
- System_printf ("C1 number of packets: %d\n", stats->classify1.nPackets);
- System_printf ("C1 number IPv4 packets: %d\n", stats->classify1.nIpv4Packets);
- System_printf ("C1 number IPv6 packets: %d\n", stats->classify1.nIpv6Packets);
- System_printf ("C1 number custom packets: %d\n", stats->classify1.nCustomPackets);
- System_printf ("C1 number SRIO packets: %d\n", stats->classify1.nSrioPackets);
- System_printf ("C1 number llc/snap fail: %d\n", stats->classify1.nLlcSnapFail);
- System_printf ("C1 number table matched: %d\n", stats->classify1.nTableMatch);
- System_printf ("C1 number failed table matched: %d\n", stats->classify1.nNoTableMatch);
- System_printf ("C1 number Ingress IP frags: %d\n", stats->classify1.nIpFrag);
- System_printf ("C1 number IP depth overflow: %d\n", stats->classify1.nIpDepthOverflow);
- System_printf ("C1 number vlan depth overflow: %d\n", stats->classify1.nVlanDepthOverflow);
- System_printf ("C1 number gre depth overflow: %d\n", stats->classify1.nGreDepthOverflow);
- System_printf ("C1 number mpls packets: %d\n", stats->classify1.nMplsPackets);
- System_printf ("C1 number of parse fail: %d\n", stats->classify1.nParseFail);
- System_printf ("C1 number invalid IPv6 opts: %d\n", stats->classify1.nInvalidIPv6Opt);
- System_printf ("C1 number of Egress IP frags: %d\n", stats->classify1.nTxIpFrag);
- System_printf ("C1 number of silent discard: %d\n", stats->classify1.nSilentDiscard);
- System_printf ("C1 number of invalid control: %d\n", stats->classify1.nInvalidControl);
- System_printf ("C1 number of invalid states: %d\n", stats->classify1.nInvalidState);
- System_printf ("C1 number of system fails: %d\n\n", stats->classify1.nSystemFail);
-
-
- System_printf ("C2 number of packets: %d\n", stats->classify2.nPackets);
- System_printf ("C2 number of UDP packets: %d\n", stats->classify2.nUdp);
- System_printf ("C2 number of TCP packets: %d\n", stats->classify2.nTcp);
- System_printf ("C2 number of custom packets: %d\n", stats->classify2.nCustom);
- System_printf ("C2 number of silent discard: %d\n", stats->classify2.nSilentDiscard);
- System_printf ("C2 number of invalid control: %d\n\n", stats->classify2.nInvalidControl);
-
- System_printf ("Modify number of command file: %d\n\n", stats->modify.nCommandFail);
-
- break;
- }
- }
-
- return (0);
-}
\ No newline at end of file
diff --git a/example/simpleExample2/armv7/qmss_types.h b/example/simpleExample2/armv7/qmss_types.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * @file qmss_types.h
- *
- * @brief
- * This is a wrapper header file which includes the standard types
- * used by the QMSS Low Level Driver.
- *
- * \par
- * NOTE:
- * (C) Copyright 2009 Texas Instruments, Inc.
- *
- * 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.
- *
-*/
-#ifndef __QMSS_TYPES_H__
-#define __QMSS_TYPES_H__
-
-/* Use default C99 types */
-/* C Standard library Include */
-#include <stdio.h>
-/* System level header files */
-#include <stdint.h>
-#include <stdlib.h>
-
-#endif /* __QMSS_TYPES_H__ */
-
-
-
diff --git a/test/PAUnitTest/PA_UnitTest_testProject.txt b/test/PAUnitTest/PA_UnitTest_testProject.txt
+++ /dev/null
@@ -1,36 +0,0 @@
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/testutil.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/testmem.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/testMain.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/framework.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/common/common.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/tests/test1.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/tests/test2.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/tests/test3.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/tests/test4.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/tests/test5.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/tests/test6.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/tests/test7.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/tests/test8.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/tests/test9.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/tests/test10.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/example/reassemLib/reassemLib.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_in0_pdsp0_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_in0_pdsp1_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_in1_pdsp0_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_in1_pdsp1_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_in2_pdsp0_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_in3_pdsp0_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_in4_pdsp0_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_in4_pdsp1_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_post_pdsp0_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_post_pdsp1_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg0_pdsp0_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg0_pdsp1_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg0_pdsp2_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg1_pdsp0_bin.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/fw/pa15_eg1_pdsp0_bin.c"
--ccs.linkFile "PDK_INSTALL_PATH/ti/drv/cppi/device/k2l/src/cppi_device.c"
--ccs.linkFile "PDK_INSTALL_PATH/ti/drv/qmss/device/k2l/src/qmss_device.c"
--ccs.linkFile "PASS_INSTALL_PATH/ti/drv/pa/test/PAUnitTest/pa_utest.cfg"
--ccs.setCompilerOptions "-D -mv64+ -g -dDEVICE_K2L --diag_warning=225 -I${PASS_INSTALL_PATH} -I${PASS_INSTALL_PATH}/ti/drv/pa/test/PAUnitTest -I${PASS_INSTALL_PATH}/ti/drv/pa/test/PAUnitTest/tests -I${PASS_INSTALL_PATH}/ti/drv/pa/example/reassemLib -I${PDK_INSTALL_PATH}/ti/drv/cppi -I${PDK_INSTALL_PATH}/ti/drv/qmss" -rtsc.enableRtsc
-
diff --git a/test/PAUnitTest/PA_UnitTest_K2E_testProject.txt b/test/PAUnitTest/k2e/c66/bios/PA_UnitTest_K2E_testProject.txt
similarity index 100%
rename from test/PAUnitTest/PA_UnitTest_K2E_testProject.txt
rename to test/PAUnitTest/k2e/c66/bios/PA_UnitTest_K2E_testProject.txt
rename from test/PAUnitTest/PA_UnitTest_K2E_testProject.txt
rename to test/PAUnitTest/k2e/c66/bios/PA_UnitTest_K2E_testProject.txt
similarity index 100%
rename from test/PAUnitTest/link.cmd
rename to test/PAUnitTest/k2e/c66/bios/link.cmd
rename from test/PAUnitTest/link.cmd
rename to test/PAUnitTest/k2e/c66/bios/link.cmd
similarity index 100%
rename from test/PAUnitTest/pa_utest_k2e.cfg
rename to test/PAUnitTest/k2e/c66/bios/pa_utest_k2e.cfg
rename from test/PAUnitTest/pa_utest_k2e.cfg
rename to test/PAUnitTest/k2e/c66/bios/pa_utest_k2e.cfg
diff --git a/test/PAUnitTest/PA_UnitTest_K2L_testProject.txt b/test/PAUnitTest/k2l/c66/bios/PA_UnitTest_K2L_testProject.txt
similarity index 100%
rename from test/PAUnitTest/PA_UnitTest_K2L_testProject.txt
rename to test/PAUnitTest/k2l/c66/bios/PA_UnitTest_K2L_testProject.txt
rename from test/PAUnitTest/PA_UnitTest_K2L_testProject.txt
rename to test/PAUnitTest/k2l/c66/bios/PA_UnitTest_K2L_testProject.txt
diff --git a/test/PAUnitTest/k2l/c66/bios/link.cmd b/test/PAUnitTest/k2l/c66/bios/link.cmd
--- /dev/null
@@ -0,0 +1,5 @@
+
+SECTIONS
+{
+ .init_array > L2SRAM
+}
\ No newline at end of file
similarity index 100%
rename from test/PAUnitTest/pa_utest_k2l.cfg
rename to test/PAUnitTest/k2l/c66/bios/pa_utest_k2l.cfg
rename from test/PAUnitTest/pa_utest_k2l.cfg
rename to test/PAUnitTest/k2l/c66/bios/pa_utest_k2l.cfg
diff --git a/test/PAUnitTest/pa_test.txt b/test/PAUnitTest/pa_test.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-
-1. Command packet one should be forwarded to queue 640
-
- psInfo[0] = 0x80000000;
-
- // 120-byte command packet
- cmd1[] = {
-
- 0x00, 0x00, 0x00, 0x00, 0x01, 0xce, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x03, 0x86, 0x06, 0x00, /* command reponse queue = 0x386, flow id = 0 */
- 0x40, 0x00, 0x00, 0x00, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01, 0x20, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- }
-
- The command response packet will be delivered to queue 0x386, with CPPI flow 0.
- If you want the command response to be dropped by the PASS, change 0x06 to 0x0A
-
-
-2. Command packet two should be forwarded to queue 641
-
- psInfo[0] = 0x80000000;
-
- // 120 byte command packet
- cmd2[] = {
-
- 0x00, 0x00, 0x00, 0x00, 0x01, 0xce, 0x80, 0x00, 0x11, 0x11, 0x11, 0x11, 0x03, 0x86, 0x06, 0x00,
- 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x08, 0x20, 0x2c, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
- };
-
- The command response packet will be delivered to queue 0x386, with CPPI flow 0.
- If you want the command response to be dropped by the PASS, change 0x06 to 0x0A
-
-
-3. Command packet three should be forwarded to queue 643
-
- psInfo[0] = 0x80000000;
-
- // 44-byte command packet
- cmd3[] = {
- 0x00, 0x00, 0x00, 0x00, 0x03, 0xce, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x03, 0x86, 0x06, 0x00,
- 0x00, 0x00, 0x80, 0x00, 0x00, 0x05, 0x55, 0x7f, 0x00, 0x00, 0x03, 0x88, 0xaa, 0xaa, 0xaa, 0xaa,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- The command response packet will be delivered to queue 0x386, with CPPI flow 0.
- If you want the command response to be dropped by the PASS, change 0x06 to 0x0A
-
-
-Wait for a while then send the following data packet multiple times, we should receive the packet at queue 0x388 (904)
-
-4. Send the following packet to queue 640 multiple times
-
-No PS Info:
-
- // 122-byte packet
- pkt[] = {
-
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11, 0xa5, 0x97, 0x9e, 0xda, 0x6d, 0x0a, 0x01, 0x02,
- 0x03, 0x04, 0x12, 0x34, 0x05, 0x55, 0x00, 0x58, 0xe1, 0x98, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
- 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81
- };
-
-
-
-We also need to setup CPPI flow 0 to provide link buffer for output packets.
-
-
\ No newline at end of file
diff --git a/test/PAUnitTest/pa_utest.cfg b/test/PAUnitTest/pa_utest.cfg
+++ /dev/null
@@ -1,38 +0,0 @@
-
-var System = xdc.useModule('xdc.runtime.System');
-var Memory = xdc.useModule('xdc.runtime.Memory');
-var BIOS = xdc.useModule('ti.sysbios.BIOS');
-var Idle = xdc.useModule('ti.sysbios.knl.Idle');
-var Swi = xdc.useModule('ti.sysbios.knl.Swi');
-var Clock = xdc.useModule('ti.sysbios.knl.Clock');
-var Task = xdc.useModule('ti.sysbios.knl.Task');
-var Event = xdc.useModule('ti.sysbios.knl.Event');
-var Mailbox = xdc.useModule('ti.sysbios.knl.Mailbox');
-var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
-var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
-var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
-
-var devType = "k2l"
-var Csl = xdc.useModule('ti.csl.Settings');
-Csl.deviceType = devType;
-var Pa = xdc.loadPackage('ti.drv.pa');
-var Qm = xdc.loadPackage('ti.drv.qmss');
-var Cppi = xdc.loadPackage('ti.drv.cppi');
-
-/* Create default heap and hook it into Memory */
-var heapMemParams = new HeapMem.Params;
-heapMemParams.size = 16384;
-var heap0 = HeapMem.create(heapMemParams);
-
-Memory.defaultHeapInstance = heap0;
-
-
-Clock.timerId = -1;
-Task.defaultStackSize = 4096;
-
-/* Memory map */
-Program.sectMap[".text"] = "L2SRAM";
-Program.sectMap[".const"] = "L2SRAM";
-Program.sectMap[".qmss"] = "L2SRAM";
-Program.sectMap[".cppi"] = "L2SRAM";
-Program.sectMap[".testPkts"] = "MSMCSRAM";
similarity index 100%
rename from test/PAUnitTest/framework.c
rename to test/PAUnitTest/src/c66x/bios/framework.c
rename from test/PAUnitTest/framework.c
rename to test/PAUnitTest/src/c66x/bios/framework.c
similarity index 100%
rename from test/PAUnitTest/testMain.c
rename to test/PAUnitTest/src/c66x/bios/testMain.c
rename from test/PAUnitTest/testMain.c
rename to test/PAUnitTest/src/c66x/bios/testMain.c
similarity index 100%
rename from test/PAUnitTest/testmem.c
rename to test/PAUnitTest/src/c66x/bios/testmem.c
rename from test/PAUnitTest/testmem.c
rename to test/PAUnitTest/src/c66x/bios/testmem.c
similarity index 100%
rename from test/PAUnitTest/common/common.c
rename to test/PAUnitTest/src/common/common.c
rename from test/PAUnitTest/common/common.c
rename to test/PAUnitTest/src/common/common.c
similarity index 100%
rename from test/PAUnitTest/testutil.c
rename to test/PAUnitTest/src/common/testutil.c
rename from test/PAUnitTest/testutil.c
rename to test/PAUnitTest/src/common/testutil.c
similarity index 100%
rename from test/PAUnitTest/tests/test1.c
rename to test/PAUnitTest/src/tests/test1.c
rename from test/PAUnitTest/tests/test1.c
rename to test/PAUnitTest/src/tests/test1.c
similarity index 100%
rename from test/PAUnitTest/tests/test10.c
rename to test/PAUnitTest/src/tests/test10.c
rename from test/PAUnitTest/tests/test10.c
rename to test/PAUnitTest/src/tests/test10.c
similarity index 100%
rename from test/PAUnitTest/tests/test10pkts.h
rename to test/PAUnitTest/src/tests/test10pkts.h
rename from test/PAUnitTest/tests/test10pkts.h
rename to test/PAUnitTest/src/tests/test10pkts.h
similarity index 100%
rename from test/PAUnitTest/tests/test11.c
rename to test/PAUnitTest/src/tests/test11.c
rename from test/PAUnitTest/tests/test11.c
rename to test/PAUnitTest/src/tests/test11.c
similarity index 100%
rename from test/PAUnitTest/tests/test11pkts.h
rename to test/PAUnitTest/src/tests/test11pkts.h
rename from test/PAUnitTest/tests/test11pkts.h
rename to test/PAUnitTest/src/tests/test11pkts.h
similarity index 100%
rename from test/PAUnitTest/tests/test12.c
rename to test/PAUnitTest/src/tests/test12.c
rename from test/PAUnitTest/tests/test12.c
rename to test/PAUnitTest/src/tests/test12.c
similarity index 100%
rename from test/PAUnitTest/tests/test12pkts.h
rename to test/PAUnitTest/src/tests/test12pkts.h
rename from test/PAUnitTest/tests/test12pkts.h
rename to test/PAUnitTest/src/tests/test12pkts.h
similarity index 100%
rename from test/PAUnitTest/tests/test13.c
rename to test/PAUnitTest/src/tests/test13.c
rename from test/PAUnitTest/tests/test13.c
rename to test/PAUnitTest/src/tests/test13.c
similarity index 100%
rename from test/PAUnitTest/tests/test13pkts.h
rename to test/PAUnitTest/src/tests/test13pkts.h
rename from test/PAUnitTest/tests/test13pkts.h
rename to test/PAUnitTest/src/tests/test13pkts.h
similarity index 100%
rename from test/PAUnitTest/tests/test2.c
rename to test/PAUnitTest/src/tests/test2.c
rename from test/PAUnitTest/tests/test2.c
rename to test/PAUnitTest/src/tests/test2.c
similarity index 100%
rename from test/PAUnitTest/tests/test2pkts.h
rename to test/PAUnitTest/src/tests/test2pkts.h
rename from test/PAUnitTest/tests/test2pkts.h
rename to test/PAUnitTest/src/tests/test2pkts.h
similarity index 100%
rename from test/PAUnitTest/tests/test3.c
rename to test/PAUnitTest/src/tests/test3.c
rename from test/PAUnitTest/tests/test3.c
rename to test/PAUnitTest/src/tests/test3.c
similarity index 100%
rename from test/PAUnitTest/tests/test3pkts.h
rename to test/PAUnitTest/src/tests/test3pkts.h
rename from test/PAUnitTest/tests/test3pkts.h
rename to test/PAUnitTest/src/tests/test3pkts.h
similarity index 100%
rename from test/PAUnitTest/tests/test4.c
rename to test/PAUnitTest/src/tests/test4.c
rename from test/PAUnitTest/tests/test4.c
rename to test/PAUnitTest/src/tests/test4.c
similarity index 100%
rename from test/PAUnitTest/tests/test4pkts.h
rename to test/PAUnitTest/src/tests/test4pkts.h
rename from test/PAUnitTest/tests/test4pkts.h
rename to test/PAUnitTest/src/tests/test4pkts.h
similarity index 100%
rename from test/PAUnitTest/tests/test5.c
rename to test/PAUnitTest/src/tests/test5.c
rename from test/PAUnitTest/tests/test5.c
rename to test/PAUnitTest/src/tests/test5.c
similarity index 100%
rename from test/PAUnitTest/tests/test5pkts.h
rename to test/PAUnitTest/src/tests/test5pkts.h
rename from test/PAUnitTest/tests/test5pkts.h
rename to test/PAUnitTest/src/tests/test5pkts.h
similarity index 100%
rename from test/PAUnitTest/tests/test6.c
rename to test/PAUnitTest/src/tests/test6.c
rename from test/PAUnitTest/tests/test6.c
rename to test/PAUnitTest/src/tests/test6.c
similarity index 100%
rename from test/PAUnitTest/tests/test6pkts.h
rename to test/PAUnitTest/src/tests/test6pkts.h
rename from test/PAUnitTest/tests/test6pkts.h
rename to test/PAUnitTest/src/tests/test6pkts.h
similarity index 100%
rename from test/PAUnitTest/tests/test7.c
rename to test/PAUnitTest/src/tests/test7.c
rename from test/PAUnitTest/tests/test7.c
rename to test/PAUnitTest/src/tests/test7.c
similarity index 100%
rename from test/PAUnitTest/tests/test7pkts.h
rename to test/PAUnitTest/src/tests/test7pkts.h
rename from test/PAUnitTest/tests/test7pkts.h
rename to test/PAUnitTest/src/tests/test7pkts.h
similarity index 100%
rename from test/PAUnitTest/tests/test8.c
rename to test/PAUnitTest/src/tests/test8.c
rename from test/PAUnitTest/tests/test8.c
rename to test/PAUnitTest/src/tests/test8.c
similarity index 100%
rename from test/PAUnitTest/tests/test8pkts.h
rename to test/PAUnitTest/src/tests/test8pkts.h
rename from test/PAUnitTest/tests/test8pkts.h
rename to test/PAUnitTest/src/tests/test8pkts.h
similarity index 100%
rename from test/PAUnitTest/tests/test9.c
rename to test/PAUnitTest/src/tests/test9.c
rename from test/PAUnitTest/tests/test9.c
rename to test/PAUnitTest/src/tests/test9.c
similarity index 100%
rename from test/PAUnitTest/tests/test9pkts.h
rename to test/PAUnitTest/src/tests/test9pkts.h
rename from test/PAUnitTest/tests/test9pkts.h
rename to test/PAUnitTest/src/tests/test9pkts.h
diff --git a/test/PAUnitTest2/Readme.txt b/test/PAUnitTest2/Readme.txt
+++ /dev/null
@@ -1,7 +0,0 @@
- ******************************************************************************
- * FILE NAME: Readme.txt
- * Copyright (C) 2012, Texas Instruments, Inc.
- *****************************************************************************
-
-This directory contains PA LLD unit tests for Linux User space.
-
diff --git a/test/PAUnitTest2/armv7/linux/build/makefile b/test/PAUnitTest2/armv7/linux/build/makefile
+++ /dev/null
@@ -1,101 +0,0 @@
-#
-# Macro definitions referenced below
-#
-
-empty =
-space =$(empty) $(empty)
-
-ARMV7OBJDIR ?= ./obj
-ARMV7BINDIR ?= ./bin
-ARMV7LIBDIR ?= ./lib
-
-ARMV7OBJDIR := $(ARMV7OBJDIR)/pa/test
-ARMV7BINDIR := $(ARMV7BINDIR)/pa/test
-
-#Cross tools
-CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc -c
-AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
-AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar -r
-LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
-
-# INCLUDE Directories
-QMSS_INC_DIR = $(PDK_INSTALL_PATH)/ti/drv/qmss
-CPPI_INC_DIR = $(PDK_INSTALL_PATH)/ti/drv/cppi
-
-PA_TEST_DIR = $(PDK_INSTALL_PATH)/ti/drv/pa/test/PAUnitTest2
-PA_TEST_COM_DIR = $(PA_TEST_DIR)/common
-PA_TEST_UT_DIR = $(PA_TEST_DIR)/tests
-PA_TEST_ARM_LIN_DIR = $(PA_TEST_DIR)/armv7/linux
-
-PA_TEST_REASSEMBLY_LIB_DIR = $(PDK_INSTALL_PATH)/ti/drv/pa/example/reassemLib
-
-INCDIR := $(PDK_INSTALL_PATH);$(CPPI_INC_DIR);$(QMSS_INC_DIR);$(PA_TEST_DIR);$(PA_TEST_COM_DIR);$(PA_TEST_UT_DIR);$(PA_TEST_ARM_LIN_DIR);$(PA_TEST_REASSEMBLY_LIB_DIR)
-
-# Libraries
-QMSS_LIB = -lqmss
-CPPI_LIB = -lcppi
-PA_LIB = -lpa
-
-# Compiler options
-INTERNALDEFS = $(DEBUG_FLAG) -D__ARMv7 -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DMAKEFILE_BUILD
-
-# Linker options
-INTERNALLINKDEFS = --start-group -L $(ARMV7LIBDIR) $(QMSS_LIB) $(PA_LIB) $(CPPI_LIB) -lrt --end-group
-
-EXE=paUnitTest2.out
-OBJEXT = o
-
-SRCDIR = $(PA_TEST_DIR):$(PA_TEST_COM_DIR):$(PA_TEST_UT_DIR):$(PA_TEST_ARM_LIN_DIR):$(PA_TEST_REASSEMBLY_LIB_DIR)
-
-INCS = -I. -I$(strip $(subst ;, -I,$(INCDIR)))
-
-VPATH=$(SRCDIR)
-
-#List the COMMONSRC Files
-COMMONSRCC = \
- fw_main.c \
- fw_init.c \
- fw_osal.c \
- fw_mem_allocator.c \
- common.c \
- testutil.c \
- test1.c \
- test2.c \
- test3.c \
- test4.c \
- test5.c \
- test6.c \
- test7.c \
- test8.c \
- test9.c \
- test10.c \
- reassemLib.c
-
-# FLAGS for the COMMONSRC Files
-COMMONSRCCFLAGS = -I.
-
-# Make Rule for the COMMONSRC Files
-COMMONSRCCOBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(COMMONSRCC))
-
-all:$(ARMV7BINDIR)/$(EXE)
-
-$(ARMV7BINDIR)/$(EXE): $(COMMONSRCCOBJS) $(ARMV7BINDIR)/.created
- @echo linking $(COMMONSRCCOBJS) into $@ ...
- @$(LD) $(COMMONSRCCOBJS) $(INTERNALLINKDEFS) -o $@
-
-$(ARMV7OBJDIR)/%.$(OBJEXT): %.c $(ARMV7OBJDIR)/.created
- @echo compiling $< ...
- @$(CC) -c $(COMMONSRCCFLAGS) $(INTERNALDEFS) $(INCS) $< -o $@
-
-$(ARMV7OBJDIR)/.created:
- @mkdir -p $(ARMV7OBJDIR)
- @touch $(ARMV7OBJDIR)/.created
-
-$(ARMV7BINDIR)/.created:
- @mkdir -p $(ARMV7BINDIR)
- @touch $(ARMV7BINDIR)/.created
-
-clean:
- @rm -fr $(ARMV7OBJDIR)
- @rm -fr $(ARMV7BINDIR)
-
diff --git a/test/PAUnitTest2/armv7/linux/fw_init.c b/test/PAUnitTest2/armv7/linux/fw_init.c
+++ /dev/null
@@ -1,843 +0,0 @@
-/**
- * (C) Copyright 2012, Texas Instruments, Inc.
- *
- * 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 "fw_test.h"
-#include "fw_mem_allocator.h"
-#include "pautest.h"
-
-#include <ti/drv/qmss/qmss_qm.h>
-#include <ti/drv/qmss/device/qmss_device.c>
-#include <ti/drv/cppi/device/cppi_device.c>
-
-/* QMSS device specific configuration */
-extern Qmss_GlobalConfigParams qmssGblCfgParams[];
-
-/* CPPI device specific configuration */
-extern Cppi_GlobalConfigParams cppiGblCfgParams[];
-
-/* test framework instance */
-tFramework_t tFramework;
-
-/* Host Descriptor Region - [Size of descriptor * Number of descriptors]
- * MUST be 16 byte aligned.
- */
-uint8_t *pHostDesc = 0;
-
-/* Static memory allocation for test framework */
-uint8_t memPaInst[TF_PA_INST_SIZE]ALIGN(CACHE_LINESZ);
-uint8_t memL2Ram[TF_L2_TABLE_SIZE]ALIGN(CACHE_LINESZ);
-uint8_t memL3Ram[TF_L3_TABLE_SIZE]ALIGN(CACHE_LINESZ);
-uint8_t memUsrStatsLnkTbl[TF_USR_STATS_LNK_TABLE_SIZE]ALIGN(CACHE_LINESZ);
-
-
-/******************************************************************************
-* Macro to convert to IP Register Virtual Address from a mapped base Virtual Address
-* Input: virtBaseAddr: Virtual base address mapped using mmap for IP
-* phyBaseAddr: Physical base address for the IP
-* phyRegAddr: Physical register address
-******************************************************************************/
-static inline void* FW_GET_REG_VADDR (void * virtBaseAddr, uint32_t phyBaseAddr, uint32_t phyRegAddr)
-{
- return((void *)((uint8_t *)virtBaseAddr + (phyRegAddr - phyBaseAddr)));
-}
-
-/** ============================================================================
- * @n@b initQmss
- *
- * @b Description
- * @n This API initializes the QMSS LLD on core 0 only.
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-int32_t initQmss (void)
-{
- int32_t result;
- Qmss_MemRegInfo memCfg;
- Qmss_InitCfg qmssInitConfig;
- Cppi_DescCfg cppiDescCfg;
- uint32_t numAllocated;
- Qmss_GlobalConfigParams fw_qmssGblCfgParams;
-
- /* Initialize QMSS */
- memset (&qmssInitConfig, 0, sizeof (Qmss_InitCfg));
-
- /* Set up QMSS configuration */
-
- /* Use internal linking RAM */
- qmssInitConfig.linkingRAM0Base = 0;
- qmssInitConfig.linkingRAM0Size = 0;
- qmssInitConfig.linkingRAM1Base = 0x0;
- qmssInitConfig.maxDescNum = TF_NUM_DESC;
-
- /* Bypass hardware initialization as it is done within Kernel */
- qmssInitConfig.qmssHwStatus = QMSS_HW_INIT_COMPLETE;
-
- fw_qmssGblCfgParams = qmssGblCfgParams[0];
-
- /* Convert address to Virtual address */
- fw_qmssGblCfgParams.qmConfigReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_CONFIG_STARVATION_COUNTER_REGS);
-
- fw_qmssGblCfgParams.qmDescReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_DESCRIPTION_REGS);
-
- fw_qmssGblCfgParams.qmQueMgmtReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_QM_QUEUE_DEQUEUE_REGS);
-
- fw_qmssGblCfgParams.qmQueMgmtProxyReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_PROXY_QUEUE_DEQUEUE_REGS);
-
- fw_qmssGblCfgParams.qmQueStatReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_QUE_PEEK_REGS);
-
- fw_qmssGblCfgParams.qmQueIntdReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_INTD_REGS);
-
- fw_qmssGblCfgParams.qmPdspCmdReg[0] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_SCRACH_RAM1_REGS);
-
- fw_qmssGblCfgParams.qmPdspCmdReg[1] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_SCRACH_RAM2_REGS);
-
- fw_qmssGblCfgParams.qmPdspCtrlReg[0] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_ADSP1_REGS);
-
- fw_qmssGblCfgParams.qmPdspCtrlReg[1] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_ADSP2_REGS);
-
- fw_qmssGblCfgParams.qmPdspIRamReg[0] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_APDSP1_RAM_REGS);
-
- fw_qmssGblCfgParams.qmPdspIRamReg[1] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_APDSP2_RAM_REGS);
-
- fw_qmssGblCfgParams.qmStatusRAM =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_QM_STATUS_RAM_REGS);
-
- fw_qmssGblCfgParams.qmLinkingRAMReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_LINKING_RAM_REGS);
-
- fw_qmssGblCfgParams.qmMcDMAReg =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_MCDMA_REGS);
-
- fw_qmssGblCfgParams.qmTimer16Reg[0] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_TIMER1_REGS);
-
- fw_qmssGblCfgParams.qmTimer16Reg[1] =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_TIMER2_REGS);
-
- fw_qmssGblCfgParams.qmQueMgmtDataReg = (void *)((uint32_t)fw_qmssDataVaddr);
-
- fw_qmssGblCfgParams.qmQueMgmtProxyDataReg =
- FW_GET_REG_VADDR(fw_qmssDataVaddr,QMSS_DATA_BASE_ADDR,QMSS_DATA_BASE_QUEUE_PROXY_ADDR);
-
- /* Initialize the Queue Manager */
- result = Qmss_init (&qmssInitConfig, &fw_qmssGblCfgParams);
- if (result != QMSS_SOK)
- {
- printf ("initQmss: Error initializing Queue Manager SubSystem, Error code : %d\n", result);
- return -1;
- }
-
- /* Start Queue manager on this core */
- Qmss_start ();
-
- /* Setup the descriptor memory regions.
- *
- * The Descriptor base addresses MUST be global addresses and
- * all memory regions MUST be setup in ascending order of the
- * descriptor base addresses.
- */
- pHostDesc = (uint8_t*)fw_memAlloc((TF_NUM_DESC * TF_SIZE_DESC), CACHE_LINESZ);
-
- /* Initialize and setup CPSW Host Descriptors required for example */
- memset (pHostDesc, 0, TF_SIZE_DESC * TF_NUM_DESC);
- memCfg.descBase = (uint32_t *) pHostDesc;
- memCfg.descSize = TF_SIZE_DESC;
- memCfg.descNum = TF_NUM_DESC;
- memCfg.manageDescFlag = Qmss_ManageDesc_MANAGE_DESCRIPTOR;
- memCfg.memRegion = Qmss_MemRegion_MEMORY_REGION0;
- memCfg.startIndex = 0;
-
- /* Insert Host Descriptor memory region */
- result = Qmss_insertMemoryRegion(&memCfg);
- if (result == QMSS_MEMREGION_ALREADY_INITIALIZED)
- {
- printf ("initQmss: Memory Region %d already Initialized \n", memCfg.memRegion);
- }
- else if (result < QMSS_SOK)
- {
- printf ("initQmss: Error Inserting memory region %d, Error code : %d\n", memCfg.memRegion, result);
- return -1;
- }
-
- /* Initialize all the descriptors we just allocated on the
- * memory region above. Setup the descriptors with some well
- * known values before we use them for data transfers.
- */
- memset (&cppiDescCfg, 0, sizeof (cppiDescCfg));
- cppiDescCfg.memRegion = Qmss_MemRegion_MEMORY_REGION0;
- cppiDescCfg.descNum = TF_NUM_DESC;
- cppiDescCfg.destQueueNum = TF_Q_FREE_DESC;
- cppiDescCfg.queueType = Qmss_QueueType_GENERAL_PURPOSE_QUEUE;
- cppiDescCfg.initDesc = Cppi_InitDesc_INIT_DESCRIPTOR;
- cppiDescCfg.descType = Cppi_DescType_HOST;
-
- /* By default:
- * (1) Return descriptors to tail of queue
- * (2) Always return entire packet to this free queue
- * (3) Set that PS Data is always present in start of SOP buffer
- * (4) Configure free q num < 4K, hence qMgr = 0
- * (5) Recycle back to the same Free queue by default.
- */
- cppiDescCfg.returnPushPolicy = Qmss_Location_TAIL;
- cppiDescCfg.cfg.host.returnPolicy = Cppi_ReturnPolicy_RETURN_ENTIRE_PACKET;
- cppiDescCfg.cfg.host.psLocation = Cppi_PSLoc_PS_IN_DESC;
- cppiDescCfg.returnQueue.qMgr = 0;
- cppiDescCfg.returnQueue.qNum = QMSS_PARAM_NOT_SPECIFIED;
- cppiDescCfg.epibPresent = Cppi_EPIB_EPIB_PRESENT;
-
- /* Initialize the descriptors, create a free queue and push descriptors to a global free queue */
- if ((tFramework.QfreeDesc = Cppi_initDescriptor (&cppiDescCfg, &numAllocated)) <= 0)
- {
- printf ("initQmss: Error Initializing Free Descriptors, Error: %d \n", tFramework.QfreeDesc);
- return -1;
- }
- else
- {
- printf ("initQmss: Initialized Free Descriptors. \n");
- }
-
- /* Queue Manager Initialization Done */
- return 0;
-}
-
-/** ============================================================================
- * @n@b initCppi
- *
- * @b Description
- * @n This API initializes the CPPI LLD, opens the PASS CPDMA and opens up
- * the Tx, Rx channels required for data transfers.
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-int32_t initCppi (void)
-{
- int32_t result, i;
- Cppi_CpDmaInitCfg cpdmaCfg;
- uint8_t isAllocated;
- Cppi_TxChInitCfg txChCfg;
- Cppi_RxChInitCfg rxChInitCfg;
- Cppi_GlobalConfigParams fw_cppiGblCfgParams[CPPI_MAX_CPDMA];
-
- for (i=0; i<CPPI_MAX_CPDMA; i++)
- fw_cppiGblCfgParams[i] = cppiGblCfgParams[i];
-
-
- /* Convert Physical address to Virtual address for LLD access */
- /* SRIO CPDMA regs */
- fw_cppiGblCfgParams[Cppi_CpDma_SRIO_CPDMA].gblCfgRegs =
- FW_GET_REG_VADDR(fw_srioCfgVaddr,CSL_SRIO_CONFIG_REGS,CSL_SRIO_CONFIG_CPPI_DMA_GLOBAL_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_SRIO_CPDMA].txChRegs =
- FW_GET_REG_VADDR(fw_srioCfgVaddr,CSL_SRIO_CONFIG_REGS,CSL_SRIO_CONFIG_CPPI_DMA_TX_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_SRIO_CPDMA].rxChRegs =
- FW_GET_REG_VADDR(fw_srioCfgVaddr,CSL_SRIO_CONFIG_REGS,CSL_SRIO_CONFIG_CPPI_DMA_RX_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_SRIO_CPDMA].txSchedRegs =
- FW_GET_REG_VADDR(fw_srioCfgVaddr,CSL_SRIO_CONFIG_REGS,CSL_SRIO_CONFIG_CPPI_DMA_TX_SCHEDULER_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_SRIO_CPDMA].rxFlowRegs =
- FW_GET_REG_VADDR(fw_srioCfgVaddr,CSL_SRIO_CONFIG_REGS,CSL_SRIO_CONFIG_CPPI_DMA_RX_FLOW_CFG_REGS);
-
- /* PASS CPDMA regs */
- fw_cppiGblCfgParams[Cppi_CpDma_PASS_CPDMA].gblCfgRegs =
- FW_GET_REG_VADDR(fw_passCfgVaddr,CSL_PA_SS_CFG_REGS,CSL_PA_SS_CFG_CPPI_DMA_GLOBAL_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_PASS_CPDMA].txChRegs =
- FW_GET_REG_VADDR(fw_passCfgVaddr,CSL_PA_SS_CFG_REGS,CSL_PA_SS_CFG_CPPI_DMA_TX_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_PASS_CPDMA].rxChRegs =
- FW_GET_REG_VADDR(fw_passCfgVaddr,CSL_PA_SS_CFG_REGS,CSL_PA_SS_CFG_CPPI_DMA_RX_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_PASS_CPDMA].txSchedRegs =
- FW_GET_REG_VADDR(fw_passCfgVaddr,CSL_PA_SS_CFG_REGS,CSL_PA_SS_CFG_CPPI_DMA_TX_SCHEDULER_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_PASS_CPDMA].rxFlowRegs =
- FW_GET_REG_VADDR(fw_passCfgVaddr,CSL_PA_SS_CFG_REGS,CSL_PA_SS_CFG_CPPI_DMA_RX_FLOW_CFG_REGS);
-
- /* QMSS CPDMA regs */
- fw_cppiGblCfgParams[Cppi_CpDma_QMSS_CPDMA].gblCfgRegs =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_CPPI_DMA_GLOBAL_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_QMSS_CPDMA].txChRegs =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_CPPI_DMA_TX_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_QMSS_CPDMA].rxChRegs =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_CPPI_DMA_RX_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_QMSS_CPDMA].txSchedRegs =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_CPPI_DMA_TX_SCHEDULER_CFG_REGS);
-
- fw_cppiGblCfgParams[Cppi_CpDma_QMSS_CPDMA].rxFlowRegs =
- FW_GET_REG_VADDR(fw_qmssCfgVaddr,CSL_QM_SS_CFG_QUE_PEEK_REGS,CSL_QM_SS_CFG_CPPI_DMA_RX_FLOW_CFG_REGS);
-
-
- /* Initialize CPPI LLD */
- result = Cppi_init (fw_cppiGblCfgParams);
- if (result != CPPI_SOK)
- {
- printf ("initCppi: Error initializing CPPI LLD, Error code : %d\n", result);
- return -1;
- }
-
- /* Initialize PASS CPDMA */
- memset (&cpdmaCfg, 0, sizeof (Cppi_CpDmaInitCfg));
- cpdmaCfg.dmaNum = Cppi_CpDma_PASS_CPDMA;
- if ((tFramework.tfPaCppiHandle = Cppi_open (&cpdmaCfg)) == NULL)
- {
- printf ("initCppi: Error initializing CPPI for PASS CPDMA %d \n", cpdmaCfg.dmaNum);
- return -1;
- }
-
- /* Open all CPPI Tx Channels. These will be used to send data to PASS/CPSW */
- for (i = 0; i < TF_PA_NUM_TX_CPDMA_CHANNELS; i ++)
- {
- txChCfg.channelNum = i; /* CPPI channels are mapped one-one to the PA Tx queues */
- txChCfg.txEnable = Cppi_ChState_CHANNEL_DISABLE; /* Disable the channel for now. */
- txChCfg.filterEPIB = 0;
- txChCfg.filterPS = 0;
- txChCfg.aifMonoMode = 0;
- txChCfg.priority = 2;
- if ((tFramework.tfPaTxChHnd[i] = Cppi_txChannelOpen (tFramework.tfPaCppiHandle, &txChCfg, &isAllocated)) == NULL)
- {
- printf ("initCppi: Error opening Tx channel %d\n", txChCfg.channelNum);
- return -1;
- }
- Cppi_channelEnable (tFramework.tfPaTxChHnd[i]);
- }
-
- /* Open all CPPI Rx channels. These will be used by PA to stream data out. */
- for (i = 0; i < TF_PA_NUM_RX_CPDMA_CHANNELS; i++)
- {
- /* Open a CPPI Rx channel that will be used by PA to stream data out. */
- rxChInitCfg.channelNum = i;
- rxChInitCfg.rxEnable = Cppi_ChState_CHANNEL_DISABLE;
- if ((tFramework.tfPaRxChHnd[i] = Cppi_rxChannelOpen (tFramework.tfPaCppiHandle, &rxChInitCfg, &isAllocated)) == NULL)
- {
- printf ("initCppi: Error opening Rx channel: %d \n", rxChInitCfg.channelNum);
- return -1;
- }
-
- /* Also enable Rx Channel */
- Cppi_channelEnable (tFramework.tfPaRxChHnd[i]);
- }
-
- /* Clear CPPI Loobpack bit in PASS CDMA Global Emulation Control Register */
- Cppi_setCpdmaLoopback(tFramework.tfPaCppiHandle, 0);
-
- /* CPPI Init Done. Return success */
- return 0;
-}
-
-/* Setup all the queues used in the example */
-int32_t setupQueues (void)
-{
- uint8_t isAlloc;
- Qmss_Queue q;
- Cppi_HostDesc *hd;
- uint8_t *bPtr;
- int i;
-
- /* The 10 PA transmit queues (corresponding to the 10 tx cdma channels */
- for (i = 0; i < TF_PA_NUM_TX_CPDMA_CHANNELS; i ++)
- {
- if ((tFramework.QPaTx[i] = Qmss_queueOpen (Qmss_QueueType_PASS_QUEUE, QMSS_PARAM_NOT_SPECIFIED, &isAlloc)) < 0)
- {
- printf ("setupQueues: Qmss_queueOpen failed for PA transmit queue number %d\n", 640+i);
- return -1;
- }
- Qmss_setQueueThreshold (tFramework.QPaTx[i], 1, 1);
- }
-
- /* The queues with attached buffers */
- tFramework.QLinkedBuf1 = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, TF_LINKED_BUF_Q1, &isAlloc);
- if (tFramework.QLinkedBuf1 < 0) {
- printf ("setupQueues: Qmss_queueOpen failed for queue %d\n", TF_LINKED_BUF_Q1);
- return (-1);
- }
-
- tFramework.QLinkedBuf2 = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, TF_LINKED_BUF_Q2, &isAlloc);
- if (tFramework.QLinkedBuf2 < 0) {
- printf ("SetupQueues: Qmss_queueOpen failed for queue %d\n", TF_LINKED_BUF_Q2);
- return (-1);
- }
-
- tFramework.QLinkedBuf3 = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, TF_LINKED_BUF_Q3, &isAlloc);
- if (tFramework.QLinkedBuf3 < 0) {
- printf ("SetupQueues: Qmss_queueOpen failed for queue %d\n", TF_LINKED_BUF_Q3);
- return (-1);
- }
-
- /* Attach buffers to the queues and push them onto the queue */
- q.qMgr = 0;
- q.qNum = TF_DEF_RET_Q;
-
- /* Allocate memory for the Packet buffers */
- bPtr = (uint8_t *) fw_memAlloc((TF_LINKED_BUF_Q1_NBUFS * TF_LINKED_BUF_Q1_BUF_SIZE), CACHE_LINESZ);
- if(bPtr == NULL) {
- printf ("SetupQueues: memAlloc failed for memQ1\n");
- return (-1);
- }
-
- for (i = 0; i < TF_LINKED_BUF_Q1_NBUFS; i++) {
-
- hd = (Cppi_HostDesc *)((uint32_t)Qmss_queuePop (tFramework.QfreeDesc));
-
- /* The descriptor address returned from the hardware has the
- * descriptor size appended to the address in the last 4 bits.
- *
- * To get the true descriptor size, always mask off the last
- * 4 bits of the address.
- */
- hd = (Cppi_HostDesc *)((uint32_t)hd & 0xFFFFFFF0);
-
- if (hd == NULL) {
- printf ("setupQueues: Qmss_queuePop returned NULL on pop from queue number %d\n", tFramework.QfreeDesc);
- return (-1);
- }
-
- /* Populate the free descriptor with the buffer. */
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, bPtr,
- TF_LINKED_BUF_Q1_BUF_SIZE);
- /* Save original buffer information */
- Cppi_setOriginalBufInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, bPtr,
- TF_LINKED_BUF_Q1_BUF_SIZE);
-
- hd->nextBDPtr = (uint32_t)NULL;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
- Qmss_queuePushDesc (tFramework.QLinkedBuf1, (Ptr)hd);
- bPtr += TF_LINKED_BUF_Q1_BUF_SIZE;
- }
-
- bPtr = (uint8_t *) fw_memAlloc((TF_LINKED_BUF_Q2_NBUFS * TF_LINKED_BUF_Q2_BUF_SIZE), CACHE_LINESZ);
- if(bPtr == NULL) {
- printf ("SetupQueues: memAlloc failed for memQ2\n");
- return (-1);
- }
-
- for (i = 0; i < TF_LINKED_BUF_Q2_NBUFS; i++) {
-
- hd = (Cppi_HostDesc *)((uint32_t)Qmss_queuePop (tFramework.QfreeDesc));
-
- /* The descriptor address returned from the hardware has the
- * descriptor size appended to the address in the last 4 bits.
- *
- * To get the true descriptor size, always mask off the last
- * 4 bits of the address.
- */
- hd = (Cppi_HostDesc *)((uint32_t)hd & 0xFFFFFFF0);
-
- if (hd == NULL) {
- printf ("setupQueues: Qmss_queuePop returned NULL on pop from queue number %d\n", tFramework.QfreeDesc);
- return (-1);
- }
-
- /* Populate the free descriptor with the buffer. */
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, bPtr,
- TF_LINKED_BUF_Q2_BUF_SIZE);
- /* Save original buffer information */
- Cppi_setOriginalBufInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, bPtr,
- TF_LINKED_BUF_Q2_BUF_SIZE);
-
- hd->nextBDPtr = (uint32_t)NULL;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
- Qmss_queuePushDesc (tFramework.QLinkedBuf2, (Ptr)hd);
- bPtr += TF_LINKED_BUF_Q2_BUF_SIZE;
- }
-
- bPtr = (uint8_t *) fw_memAlloc((TF_LINKED_BUF_Q3_NBUFS * TF_LINKED_BUF_Q3_BUF_SIZE), CACHE_LINESZ);
- if(bPtr == NULL) {
- printf ("SetupQueues: memAlloc failed for memQ3\n");
- return (-1);
- }
-
- for (i = 0; i < TF_LINKED_BUF_Q3_NBUFS; i++) {
-
- hd = (Cppi_HostDesc *)((uint32_t)Qmss_queuePop (tFramework.QfreeDesc));
-
- /* The descriptor address returned from the hardware has the
- * descriptor size appended to the address in the last 4 bits.
- *
- * To get the true descriptor size, always mask off the last
- * 4 bits of the address.
- */
- hd = (Cppi_HostDesc *)((uint32_t)hd & 0xFFFFFFF0);
-
- if (hd == NULL) {
- printf ("setupQueues: Qmss_queuePop returned NULL on pop from queue number %d\n", tFramework.QfreeDesc);
- return (-1);
- }
-
- /* Populate the free descriptor with the buffer. */
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, bPtr,
- TF_LINKED_BUF_Q3_BUF_SIZE);
- /* Save original buffer information */
- Cppi_setOriginalBufInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, bPtr,
- TF_LINKED_BUF_Q3_BUF_SIZE);
-
- hd->nextBDPtr = (uint32_t)NULL;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
- Qmss_queuePushDesc (tFramework.QLinkedBuf3, (Ptr)hd);
- bPtr += TF_LINKED_BUF_Q3_BUF_SIZE;
- }
-
- /* The default return queue for descriptors with linked buffers */
- tFramework.QDefRet = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, TF_DEF_RET_Q, &isAlloc);
- if (tFramework.QDefRet < 0) {
- printf ("SetupQueues: Qmss_queueOpen failed for queue %d\n", TF_DEF_RET_Q);
- return (-1);
- }
-
- tFramework.QCommonCmdRep = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, TF_COMMON_CMD_REPL_Q, &isAlloc);
- if (tFramework.QCommonCmdRep < 0) {
- printf ("SetupQueues: Qmss_queueOpen failed for queue %d\n", TF_COMMON_CMD_REPL_Q);
- return (-1);
- }
-
- /* General purpose queues */
- for (i = 0; i < TF_NUM_GEN_QUEUES; i++) {
-
- tFramework.QGen[i] = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, TF_FIRST_GEN_QUEUE + i, &isAlloc);
-
- if (tFramework.QGen[i] < 0) {
- printf ("SetupQueues: Qmss_queueOpen failed for queue %d\n", TF_FIRST_GEN_QUEUE + i);
- return (-1);
- }
- }
-
- /* All done return success. */
- return 0;
-}
-
-/* Configure flows */
-int setupFlows (void)
-{
- Cppi_RxFlowCfg rxFlowCfg;
- uint8_t isAlloc;
- int i;
-
- /* Configure Rx flow */
- rxFlowCfg.flowIdNum = tFramework.tfFlowNum = 0;
- rxFlowCfg.rx_dest_qnum = TF_FIRST_GEN_QUEUE + TF_NUM_GEN_QUEUES -1; /* Override in PA */
- rxFlowCfg.rx_dest_qmgr = 0;
- rxFlowCfg.rx_sop_offset = 0;
- rxFlowCfg.rx_ps_location = Cppi_PSLoc_PS_IN_DESC;
- rxFlowCfg.rx_desc_type = Cppi_DescType_HOST;
- rxFlowCfg.rx_error_handling = 1;
- rxFlowCfg.rx_psinfo_present = 1;
- rxFlowCfg.rx_einfo_present = 1;
-
- rxFlowCfg.rx_dest_tag_lo = 0;
- rxFlowCfg.rx_dest_tag_hi = 0;
- rxFlowCfg.rx_src_tag_lo = 0;
- rxFlowCfg.rx_src_tag_hi = 0;
-
- rxFlowCfg.rx_size_thresh0_en = 1;
- rxFlowCfg.rx_size_thresh1_en = 1;
- rxFlowCfg.rx_size_thresh2_en = 0;
- rxFlowCfg.rx_dest_tag_lo_sel = 0;
- rxFlowCfg.rx_dest_tag_hi_sel = 0;
- rxFlowCfg.rx_src_tag_lo_sel = 0;
- rxFlowCfg.rx_src_tag_hi_sel = 0;
-
- rxFlowCfg.rx_fdq1_qnum = tFramework.QLinkedBuf2;
- rxFlowCfg.rx_fdq1_qmgr = 0;
- rxFlowCfg.rx_fdq0_sz0_qnum = tFramework.QLinkedBuf1;
- rxFlowCfg.rx_fdq0_sz0_qmgr = 0;
-
- rxFlowCfg.rx_fdq3_qnum = tFramework.QLinkedBuf2;
- rxFlowCfg.rx_fdq3_qmgr = 0;
- rxFlowCfg.rx_fdq2_qnum = tFramework.QLinkedBuf2;
- rxFlowCfg.rx_fdq2_qmgr = 0;
-
- rxFlowCfg.rx_size_thresh1 = TF_LINKED_BUF_Q2_BUF_SIZE;
- rxFlowCfg.rx_size_thresh0 = TF_LINKED_BUF_Q1_BUF_SIZE;
-
- rxFlowCfg.rx_fdq0_sz1_qnum = tFramework.QLinkedBuf2;
- rxFlowCfg.rx_fdq0_sz1_qmgr = 0;
- rxFlowCfg.rx_size_thresh2 = 0;
-
- rxFlowCfg.rx_fdq0_sz3_qnum = tFramework.QLinkedBuf3;
- rxFlowCfg.rx_fdq0_sz3_qmgr = 0;
- rxFlowCfg.rx_fdq0_sz2_qnum = tFramework.QLinkedBuf3;
- rxFlowCfg.rx_fdq0_sz2_qmgr = 0;
-
- tFramework.tfPaFlowHnd0 = Cppi_configureRxFlow (tFramework.tfPaCppiHandle, &rxFlowCfg, &isAlloc);
- if (tFramework.tfPaFlowHnd0 == NULL) {
- printf ("setupFlows: cppi_ConfigureRxFlow returned NULL on flow 0\n");
- return (-1);
- }
-
- return (0);
-}
-
-/* The QM/CPDMA are setup */
-int initQm (void)
-{
- if (initQmss()) {
- printf ("initQm: initQmss failed\n");
- return (-1);
- }
-
- if (initCppi ()) {
- printf ("initQm: initCppi failed\n");
- return (-1);
- }
-
- if (setupQueues ()) {
- printf ("initQm: setupQueues failed\n");
- return (-1);
- }
-
- if (setupFlows ()) {
- printf ("initQm: setupFlows failed\n");
- return (-1);
- }
-
- return (0);
-}
-
-/* The PA LLD instance is created, the PA firmware is
- * downloaded and started by the Linux Kernel*/
-int initPa (void)
-{
- paSizeInfo_t paSize;
- paConfig_t paCfg;
- paTimestampConfig_t tsCfg;
- int ret;
- int sizes[pa_N_BUFS];
- int aligns[pa_N_BUFS];
- void* bases[pa_N_BUFS];
-
-
- memset(&paSize, 0, sizeof(paSizeInfo_t));
- memset(&paCfg, 0, sizeof(paConfig_t));
-
- /* The maximum number of handles that can exists are 32 for L2, and 64 for L3. */
- paSize.nMaxL2 = TF_MAX_NUM_L2_HANDLES;
- paSize.nMaxL3 = TF_MAX_NUM_L3_HANDLES;
- paSize.nUsrStats = pa_USR_STATS_MAX_COUNTERS;
-
- ret = Pa_getBufferReq(&paSize, sizes, aligns);
-
- if (ret != pa_OK) {
- printf ("initPa: Pa_getBufferReq() return with error code %d\n", ret);
- return (-1);
- }
-
- /* The first buffer is used as the instance buffer */
- if ((uint32_t)memPaInst & (aligns[0] - 1)) {
- printf ("initPa: Pa_getBufferReq requires %d alignment for instance buffer, but address is 0x%08x\n", aligns[0], (uint32_t)memPaInst);
- return (-1);
- }
-
- if (sizeof(memPaInst) < sizes[0]) {
- printf ("initPa: Pa_getBufferReq requires size %d for instance buffer, have only %d\n", sizes[0], sizeof(memPaInst));
- return (-1);
- }
-
- bases[0] = (void *)memPaInst;
-
-
- /* The second buffer is the L2 table */
- if ((uint32_t)memL2Ram & (aligns[1] - 1)) {
- printf ("initPa: Pa_getBufferReq requires %d alignment for buffer 1, but address is 0x%08x\n", aligns[1], (uint32_t)memL2Ram);
- return (-1);
- }
-
- if (sizeof(memL2Ram) < sizes[1]) {
- printf ("initPa: Pa_getBufferReq requires %d bytes for buffer 1, have only %d\n", sizes[1], sizeof(memL2Ram));
- return (-1);
- }
-
- bases[1] = (void *)memL2Ram;
-
- /* The third buffer is the L3 table */
- if ((uint32_t)memL3Ram & (aligns[2] - 1)) {
- printf ("initPa: Pa_getBufferReq requires %d alignment for buffer 2, but address is 0x%08x\n", aligns[2], (uint32_t)memL3Ram);
- return (-1);
- }
-
- if (sizeof(memL3Ram) < sizes[2]) {
- printf ("initPa: Pa_getBufferReq requires %d bytes for buffer 2, have only %d\n", sizes[2], sizeof(memL3Ram));
- return (-1);
- }
-
- bases[2] = (void *)memL3Ram;
-
- /* The fourth buffer is the User Statistics Link table */
- if ((uint32_t)memUsrStatsLnkTbl & (aligns[3] - 1)) {
- printf ("initPa: Pa_getBufferReq requires %d alignment for buffer 3, but address is 0x%08x\n", aligns[3], (uint32_t)memUsrStatsLnkTbl);
- return (-1);
- }
-
- if (sizeof(memUsrStatsLnkTbl) < sizes[3]) {
- printf ("initPa: Pa_getBufferReq requires %d bytes for buffer 3, have only %d\n", sizes[2], sizeof(memUsrStatsLnkTbl));
- return (-1);
- }
-
- bases[3] = (void *)memUsrStatsLnkTbl;
-
- paCfg.initTable = TRUE;
- paCfg.initDefaultRoute = TRUE;
- paCfg.baseAddr = (uint32_t)fw_passCfgVaddr;
- paCfg.sizeCfg = &paSize;
-
- ret = Pa_create (&paCfg, bases, &tFramework.passHandle);
- if (ret != pa_OK) {
- printf ("initPa: Pa_create returned with error code %d\n", ret);
- return (-1);
- }
-
- /* Enable Timer for timestamp */
- memset(&tsCfg, 0, sizeof(paTimestampConfig_t));
- tsCfg.enable = TRUE;
- tsCfg.factor = pa_TIMESTAMP_SCALER_FACTOR_2;
-
- if(Pa_configTimestamp(tFramework.passHandle, &tsCfg) != pa_OK)
- return (-1);
-
- return (0);
-}
-
-
-/* Initialize the test framework */
-int setupTestFramework (void)
-{
-
- /* Create the PA driver instance */
- if (initPa()) {
- printf ("setupTestFramework: initPa returned error, exiting\n");
- return (-1);
- }
-
- /* Setup the QM with associated buffers and descriptors */
- if (initQm()) {
- printf ("setupTestFramework: initQm returned error, exiting\n");
- return (-1);
- }
-
- return (0);
-}
-
-/* Check that all the queues are setup correctly */
-int verifyTestFramework (void)
-{
- int i, j;
- int count;
- int returnVal = 0;
- Cppi_HostDesc *hd;
- uint8_t *bufp;
- uint32_t bufLen;
- Qmss_Queue q;
-
- int32_t linkedQ[3];
- int32_t nbufs[] = { TF_LINKED_BUF_Q1_NBUFS, TF_LINKED_BUF_Q2_NBUFS, TF_LINKED_BUF_Q3_NBUFS };
- int32_t bSize[] = { TF_LINKED_BUF_Q1_BUF_SIZE, TF_LINKED_BUF_Q2_BUF_SIZE, TF_LINKED_BUF_Q3_BUF_SIZE };
-
- linkedQ[0] = tFramework.QLinkedBuf1;
- linkedQ[1] = tFramework.QLinkedBuf2;
- linkedQ[2] = tFramework.QLinkedBuf3;
-
- /* Verify that all of the general purpose queues are empty */
- for (i = 0; i < TF_NUM_GEN_QUEUES; i++) {
- if ((count = Qmss_getQueueEntryCount (tFramework.QGen[i])) != 0) {
- printf ("verifyTestFramework: Expected 0 entry count for queue %d, found %d entries\n", tFramework.QGen[i], count);
- returnVal = -1;
- }
- }
-
- /* Verify that the number of descriptors in the free descriptor queue is correct */
- count = Qmss_getQueueEntryCount (tFramework.QfreeDesc);
- if (count != (TF_NUM_DESC - TF_LINKED_BUF_Q1_NBUFS - TF_LINKED_BUF_Q2_NBUFS - TF_LINKED_BUF_Q3_NBUFS)) {
- printf ("verifyTestFramework: Expected %d entry count in the free descriptor queue (%d), found %d\n",
- TF_NUM_DESC - TF_LINKED_BUF_Q1_NBUFS - TF_LINKED_BUF_Q2_NBUFS - TF_LINKED_BUF_Q3_NBUFS,
- tFramework.QfreeDesc, count);
- returnVal = -1;
- }
-
- q.qMgr = 0;
- q.qNum = TF_DEF_RET_Q;
-
- /* Verify the number and sizing of descriptors with linked buffers in the three queues */
- for (j = 0; j < 3; j++) {
-
- count = Qmss_getQueueEntryCount (linkedQ[j]);
- if (count != nbufs[j]) {
- printf ("verifyTestFramework: Expected %d entry count in linked buffer queue 1 (%d), found %d\n",
- nbufs[j], linkedQ[j], count);
- returnVal = -1;
- }
-
- for (i = 0; i < count; i++) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (linkedQ[j])) & ~15);
- Cppi_getOriginalBufInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, &bufp, &bufLen);
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
- Qmss_queuePush (linkedQ[j], (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- if (bufLen != bSize[j]) {
- printf ("verifyTestFramework: Linked buffer queue %d (%d) expected orignal length of %d, found %d\n",
- j, linkedQ[j], bSize[j], bufLen);
- returnVal = -1;
- break;
- }
- }
- }
-
- return (returnVal);
-}
-
-
diff --git a/test/PAUnitTest2/armv7/linux/fw_main.c b/test/PAUnitTest2/armv7/linux/fw_main.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/* (C) Copyright 2012, Texas Instruments, Inc.
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <time.h>
-#include <pthread.h>
-#include <string.h>
-#include "fw_mem_allocator.h"
-#include "pautest.h"
-
-void *topLevelTest (void *args);
-
-typedef pthread_t task_handle;
-
-#define DEFAULT_STACK_SIZE 0x8000
-/** ============================================================================
- * @n@b task_create
- *
- * @b Description
- * @n Create thread to run the test program
- *
- * @param[in]
- * @n None
- *
- * @return int32_t
- * -1 - Error
- * 0 - Success
- * =============================================================================
- */
-static int task_create ( void *(start_routine)(void*), void* args, void* handle)
-{
- int max_priority, err;
- pthread_t thread;
- pthread_attr_t attr;
- struct sched_param param;
-
- max_priority = sched_get_priority_max(SCHED_FIFO);
- err = pthread_attr_init(&attr);
- if (err) {
- printf("pthread_attr_init failed: (%s)\n", strerror(err));
- return err;
- }
- err = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
- if (err) {
- printf("pthread_attr_setdetachstate failed: (%s)\n", strerror(err));
- return err;
- }
- err = pthread_attr_setstacksize(&attr, DEFAULT_STACK_SIZE);
- if (err) {
- printf("pthread_attr_setstacksize failed: (%s)\n", strerror(err));
- return err;
- }
- err = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
- if (err) {
- printf("pthread_attr_setinheritsched failed: (%s)\n", strerror(err));
- return err;
- }
- err = pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
- if (err) {
- printf("pthread_attr_setschedpolicy failed: (%s)\n", strerror(err));
- return err;
- }
- memset(¶m, 0, sizeof(param));
- param.sched_priority = max_priority;
- err = pthread_attr_setschedparam(&attr, ¶m);
- if (err) {
- printf("pthread_attr_setschedparam failed: (%s)\n", strerror(err));
- return err;
- }
- if (err) return err;
- err = pthread_create(&thread, &attr, start_routine, args);
- if (err) {
- printf("pthread_create failed: (%s)\n", strerror(err));
- return err;
- }
- if (err) return err;
- *(pthread_t*)handle = thread;
- return 0;
-}
-
-/** ============================================================================
- * @n@b task_wait
- *
- * @b Description
- * @n Wait for Task completion
- *
- * @return void
- * =============================================================================
- */
-static void task_wait (void *handle)
-{
- pthread_join(*((pthread_t*)handle), NULL);
- return;
-}
-/** ============================================================================
- * @n@b task_sleep
- *
- * @b Description
- * @n Sleep the thread for msec duration
- *
- * @return void
- * =============================================================================
- */
-
-static void task_sleep(int time_in_msec)
-{
- pthread_mutex_t fake_mutex = PTHREAD_MUTEX_INITIALIZER;
- pthread_cond_t fake_cond = PTHREAD_COND_INITIALIZER;
- struct timespec ts;
- int rt;
- unsigned int sec, nsec;
-
- sec = time_in_msec/1000;
- nsec = (time_in_msec - (sec*1000)) * 1000000;
-
- /* Use the wall-clock time */
- clock_gettime(CLOCK_REALTIME, &ts);
-
- ts.tv_sec += sec;
- ts.tv_nsec += nsec;
-
- pthread_mutex_lock(&fake_mutex);
- rt = pthread_cond_timedwait(&fake_cond, &fake_mutex, &ts);
- pthread_mutex_unlock(&fake_mutex);
-}
-/** ============================================================================
- * @n@b main
- *
- * @b Description
- * @n test application main
- *
- * @return int
- * =============================================================================
- */
-int main() {
- task_handle test_th;
- int status;
-
- fw_osalInit();
-
- if (fw_memAllocInit((uint8_t*)MSMC_SRAM_BASE_ADDR,
- MSMC_TEST_PERM_MEM_SZ) == fw_FALSE) {
- printf("ERROR: \"Top Level Test\" fw_memAllocInit failed\n");
- return (-1);
- }
-
-
- /* Create virtual memory maps */
- /* QMSS CFG Regs */
- fw_qmssCfgVaddr = fw_memMap((void*)QMSS_CFG_BASE_ADDR,
- QMSS_CFG_BLK_SZ);
- if (!fw_qmssCfgVaddr)
- {
- printf("ERROR: Failed to map QMSS CFG registers\n");
- return (-1);
- }
-#ifdef EXT_DEBUG
- printf("main:QMSS_CFG_BASE_ADDR:0x%x Memory mapped at address %p.\n",(void*)QMSS_CFG_BASE_ADDR, fw_qmssCfgVaddr);
-#endif
-
- /* QMSS DATA Regs */
- fw_qmssDataVaddr = fw_memMap((void*)QMSS_DATA_BASE_ADDR,
- QMSS_DATA_BLK_SZ);
- if (!fw_qmssDataVaddr)
- {
- printf("ERROR: Failed to map QMSS DATA registers\n");
- return (-1);
- }
-#ifdef EXT_DEBUG
- printf("main:QMSS_DATA_BASE_ADDR:0x%x Memory mapped at address %p.\n",(void*)QMSS_DATA_BASE_ADDR, fw_qmssDataVaddr);
-#endif
-
- /* SRIO CFG Regs */
- fw_srioCfgVaddr = fw_memMap((void*)SRIO_CFG_BASE_ADDR,
- SRIO_CFG_BLK_SZ);
- if (!fw_srioCfgVaddr)
- {
- printf("ERROR: Failed to map SRIO CFG registers\n");
- return (-1);
- }
-#ifdef EXT_DEBUG
- printf("main:SRIO_CFG_BASE_ADDR:0x%x Memory mapped at address %p.\n",(void*)SRIO_CFG_BASE_ADDR, fw_srioCfgVaddr);
-#endif
-
- /* PASS CFG Regs */
- fw_passCfgVaddr = fw_memMap((void*)PASS_CFG_BASE_ADDR,
- PASS_CFG_BLK_SZ);
- if (!fw_passCfgVaddr)
- {
- printf("ERROR: Failed to map PASS CFG registers\n");
- return (-1);
- }
-#ifdef EXT_DEBUG
- printf("main:PASS_CFG_BASE_ADDR:0x%x Memory mapped at address %p.\n",(void*)PASS_CFG_BASE_ADDR, fw_passCfgVaddr);
-#endif
-
-
- if (status = task_create(topLevelTest, NULL, &test_th)) {
- printf("ERROR: \"Top Level Test\" task-create failed (%d)\n", status);
- return (-1);
- }
-
- task_wait(&test_th);
- fw_osalshutdown();
- return 0;
-}
-
-/** ============================================================================
- * @n@b topLevelTest
- *
- * @b Description
- * @n Routine running as a separate thread
- *
- * @return int
- * =============================================================================
- */
-void *topLevelTest (void *args)
-{
- task_handle fw_test_th;
- int status;
- paTestArgs_t testArgs;
- Int passCount;
- Int failCount;
- Int notRunCount;
- int i;
-
- testArgs.tf = &tFramework;
-
- printf ("\n\n ------- PA Unit Test Starting ---------\n");
-
- /* Initialize the PA, PA cpdma, QM and CPPI. Each test will use
- * the same framework */
- if (setupTestFramework ()) {
- printf ("topLevelTest (%s:%d): setupTestFramework returned error, exiting\n", __FILE__, __LINE__);
- return;
- }
-
- /* Make sure the setup matches what is expected */
- if (verifyTestFramework()) {
- printf ("topLevelTest (%s:%d): verifyTestFramework returned error after initial framework setup, exiting\n", __FILE__, __LINE__);
- return;
- }
-
- /* Run the tests */
- for (i = 0; paTestList[i].testFunction != NULL; i++ ) {
-
- testArgs.pat = &paTestList[i];
-
- if (status = task_create(paTestList[i].testFunction, (void *)&testArgs, &fw_test_th)) {
- printf("ERROR: \"fwTest\" task-create failed (%d)\n", status);
- return;
- }
-
- /* The test task will terminate upon completion. */
- task_wait(&fw_test_th);
-
- if (paTestList[i].testStatus == PA_TEST_PASSED)
- printf ("%s: PASSED\n", paTestList[i].name);
- else
- printf ("%s: FAILED\n", paTestList[i].name);
-
- /* Do a quick check of the test framework */
- if (verifyTestFramework ()) {
- printf ("topLevelTest (%s:%d): verifyTestFramework returned error after test %s. Exiting.\n", __FILE__, __LINE__, paTestList[i].name);
- return;
- }
- }
-
- /* Summarize the test results */
- for (i = passCount = failCount = notRunCount = 0; paTestList[i].testFunction != NULL; i++) {
- if (paTestList[i].testStatus == PA_TEST_PASSED)
- passCount += 1;
- else if (paTestList[i].testStatus == PA_TEST_FAILED)
- failCount += 1;
- else
- notRunCount += 1;
- }
-
- printf ("\n\nTest summary:\n\tTests Passed: %d\n\tTests Failed: %d\n\tTests not run: %d\n\n",
- passCount, failCount, notRunCount);
-
- printf ("\n\n ------- PA Unit Test Complete ---------\n");
-
- pthread_exit((void*) 0);
- return;
-}
-
-
diff --git a/test/PAUnitTest2/armv7/linux/fw_mem_allocator.c b/test/PAUnitTest2/armv7/linux/fw_mem_allocator.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/******************************************************************************
- * FILE PURPOSE: Memory allocator for running Example
- ******************************************************************************
- * FILE NAME: fw_mem_allocator.c
- *
- * DESCRIPTION: Memory allocator for running test.
- * 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 "fw_mem_allocator.h"
-
-/* Macro to align x to y */
-#define align(x,y) ((x + y) & (~y))
-
-uint8_t *fw_mem_start_phy = (uint8_t*)0;
-uint8_t *fw_mem_start = (uint8_t*)0;
-
-static uint8_t *fw_mem_end = (uint8_t*)0;
-static uint8_t *fw_mem_alloc_ptr = (uint8_t*)0;
-static uint32_t fw_mem_size = 0;
-
-/* File descriptor for /dev/mem */
-static int dev_mem_fd;
-
-/***************************************************************************************
- * FUNCTION PURPOSE: Initialize memory allocation
- ***************************************************************************************
- * DESCRIPTION: Initialize memory allocation
- ***************************************************************************************/
-fw_Bool_t fw_memAllocInit
-(
- uint8_t *addr, /* Physical address */
- uint32_t size /* Size of block */
-)
-{
- void *map_base;
-
- if((dev_mem_fd = open("/dev/mem", (O_RDWR | O_SYNC))) == -1)
- {
- printf("fw_memAllocInit: Failed to open \"dev/mem\" err=%s\n",
- strerror(errno));
- return fw_FALSE;
- }
-
- map_base = fw_memMap ((void *)addr, size);
-
- if (!map_base)
- {
- printf("fw_memAllocInit: Failed to mmap addr (0x%x)", addr);
- return fw_FALSE;
- }
-
-#ifdef EXT_DEBUG
- printf("fw_memAllocInit: Memory mapped at address %p.\n", map_base);
-#endif
-
- fw_mem_alloc_ptr = fw_mem_start = map_base;
- fw_mem_size = size;
- fw_mem_end = fw_mem_start + fw_mem_size;
- fw_mem_start_phy = addr;
- return fw_TRUE;
-}
-/***************************************************************************************
- * FUNCTION PURPOSE:
- ***************************************************************************************
- * DESCRIPTION:
- ***************************************************************************************/
-void* fw_memAlloc
-(
- uint32_t size,
- uint32_t alignment
-)
-{
- uint32_t key;
- uint8_t *alloc_ptr;
- void *p_block =NULL;
-
- Osal_fwCsEnter(&key);
- alloc_ptr = (uint8_t*)align((uint32_t)fw_mem_alloc_ptr, alignment);
- if ((alloc_ptr + size) < fw_mem_end)
- {
- p_block =(void *)alloc_ptr;
- fw_mem_alloc_ptr = alloc_ptr + size;
- Osal_fwCsExit(key);
- memset (p_block, 0, size);
- }
- else
- {
- Osal_fwCsExit(key);
- }
-
-#ifdef EXT_DEBUG
- printf("fw_memAlloc: Allocated address %p size %d.\n", p_block, size);
-#endif
-
- return p_block;
-}
-/***************************************************************************************
- * FUNCTION PURPOSE: Function to map physical address to virtual memory space
- ***************************************************************************************
- * DESCRIPTION: Function to map physical address to virtual memory space
- ***************************************************************************************/
-void *fw_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("fw_memMap: Failed to get page size err=%s\n",
- strerror(errno));
- return (void *)0;
- }
-
- page_sz = (uint32_t)retval;
-
- if (size%page_sz)
- {
- printf("fw_memMap: error: block size not aligned to page size\n");
- return (void *)0;
- }
-
- if ((uint32_t)addr%page_sz)
- {
- printf("fw_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("fw_memMap: Failed to mmap \"dev/mem\" err=%s\n",
- strerror(errno));
- return (void *)0;
- }
- virt_addr = map_base + ((off_t)addr & mask);
- return(virt_addr);
-}
-
diff --git a/test/PAUnitTest2/armv7/linux/fw_mem_allocator.h b/test/PAUnitTest2/armv7/linux/fw_mem_allocator.h
+++ /dev/null
@@ -1,80 +0,0 @@
-
-/******************************************************************************
- * FILE PURPOSE: Memory allocator for running Example
- ******************************************************************************
- * FILE NAME: fw_mem_allocator.h
- *
- * DESCRIPTION: Memory allocator for running Example
- *
- * 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.
- *
- */
-
-#ifndef __FW_MEM_ALLOCATOR_H__
-#define __FW_MEM_ALLOCATOR_H__
-
-/* C Standard library Include */
-#include <stdio.h>
-/* System level header files */
-#include <stdint.h>
-#include <stdlib.h>
-#include "fw_test.h"
-
-/* Physical address of the memory pool */
-extern uint8_t *fw_mem_start_phy;
-/* virtual address of the memory pool */
-extern uint8_t *fw_mem_start;
-
-/* Function to initialize memory allocator */
-fw_Bool_t fw_memAllocInit
-(
- uint8_t *addr, /* Physical address */
- uint32_t size /* Size of block */
-);
-
-/* Function to allocate memory */
-void* fw_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 *fw_memMap
-(
- void *addr, /* Physical address */
- uint32_t size /* Size of block */
-);
-
-#endif
-
diff --git a/test/PAUnitTest2/armv7/linux/fw_osal.c b/test/PAUnitTest2/armv7/linux/fw_osal.c
+++ /dev/null
@@ -1,436 +0,0 @@
-/******************************************************************************
- * FILE PURPOSE: Functions to OSAL related routines for running Example
- ******************************************************************************
- * FILE NAME: fw_osal.c
- *
- * DESCRIPTION: Functions to initialize framework resources for running Example
- *
- * 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 "fw_test.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include "fw_mem_allocator.h"
-
-#define System_printf printf
-
-uint32_t Osal_qmss_MallocCounter = 0;
-uint32_t Osal_qmss_FreeCounter = 0;
-uint32_t Osal_cppi_MallocCounter = 0;
-uint32_t Osal_cppi_FreeCounter = 0;
-uint32_t cpswPaMemProtNestedLevel = 0;
-uint32_t globalCritkey;
-
-
-
-/* Lock to be used for critical section */
-pthread_mutex_t mutex_lock;
-
-void fw_osalInit()
-{
- pthread_mutex_init(&mutex_lock, NULL);
- return;
-}
-
-void fw_osalshutdown()
-{
- pthread_mutex_destroy(&mutex_lock);
- return;
-}
-
-static inline void fw_osalEnterCS()
-{
-#if 0
- pthread_mutex_lock(&mutex_lock);
-#endif
- return;
-}
-
-static inline void fw_osalLeaveCS()
-{
-
-#if 0
- pthread_mutex_unlock(&mutex_lock);
-#endif
- return;
-}
-
-/*****************************************************************************
- * FUNCTION PURPOSE: Cache Invalidation Routine
- *****************************************************************************
- * DESCRIPTION: Cache Invalidation Routine
- *****************************************************************************/
-void Osal_invalidateCache (void *blockPtr, uint32_t size)
-{
- /* Stub Function. TBD: Would need to handle when cache is enabled for ARM */
- return;
-}
-
-/*****************************************************************************
- * FUNCTION PURPOSE: Cache Writeback Routine
- *****************************************************************************
- * DESCRIPTION: Cache Invalidation Routine
- *****************************************************************************/
-void Osal_writeBackCache (void *blockPtr, uint32_t size)
-{
- /* Stub Function. TBD: Would need to handle when cache is enabled for ARM */
- return;
-}
-
-
-void * Osal_qmssMtCsEnter()
-{
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
- return NULL;
-}
-
-
-void Osal_qmssMtCsExit(void *key)
-{
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
- return;
-}
-
-
-void Osal_qmssLog ( String fmt, ... )
-{
-}
-
-void* Osal_qmssCsEnter ()
-{
-
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled once infrastructure is available from Kernel
- */
- return(NULL);
-}
-
-void Osal_qmssCsExit (void * key)
-{
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
- return;
-}
-
-Ptr Osal_qmssMalloc (uint32_t num_bytes)
-{
- Ptr ret;
-
- Osal_qmss_MallocCounter++;
- ret = malloc (num_bytes);
- if(ret==NULL)
- {
- System_printf("\nERROR! QMSS Malloc failed!\n");
- }
-
- return ret;
-}
-
-void Osal_qmssFree (Ptr ptr, uint32_t size)
-{
- /* Increment the free counter. */
- Osal_qmss_FreeCounter++;
- free(ptr);
-}
-
-
-void Osal_qmssBeginMemAccess (void *blockPtr, uint32_t size)
-{
- Osal_invalidateCache(blockPtr,size);
- return;
-}
-
-void Osal_qmssEndMemAccess (void *blockPtr, uint32_t size)
-{
- Osal_writeBackCache(blockPtr,size);
- return;
-}
-void* Osal_qmssVirtToPhy (void *ptr)
-{
- if(ptr == NULL)
- {
- return NULL;
- }
- return (void *)(fw_mem_start_phy + ((uint8_t*)ptr - fw_mem_start));
-}
-
-void* Osal_qmssPhyToVirt (void *ptr)
-{
- if(ptr == NULL)
- {
- return NULL;
- }
- return (void *)(fw_mem_start + ((uint8_t*)ptr - fw_mem_start_phy));
-}
-
-/******************************************************************************
-* Function to traverse a CPPI descriptor and convert all address references
-* from virtual to physical.
-******************************************************************************/
-void* Osal_qmssConvertDescVirtToPhy(void *descAddr)
-{
- if (!descAddr) return (void *)0;
-
- if (Cppi_getDescType((Cppi_Desc *)QMSS_DESC_PTR(descAddr)) == Cppi_DescType_HOST)
- {
- Cppi_HostDesc *nextBDPtr = (Cppi_HostDesc *)QMSS_DESC_PTR(descAddr);
- Cppi_HostDesc *prevBDPtr = 0;
- while (nextBDPtr)
- {
- void *buffPtr;
- if (nextBDPtr->buffPtr)
- {
- buffPtr = (void *)nextBDPtr->buffPtr;
- nextBDPtr->buffPtr = (uint32_t)Osal_qmssVirtToPhy((void *)(nextBDPtr->buffPtr));
- if (!(nextBDPtr->buffPtr)) return (void *)0;
- }
-
- if (nextBDPtr->origBuffPtr)
- {
- nextBDPtr->origBuffPtr = (uint32_t)Osal_qmssVirtToPhy((void *)(nextBDPtr->origBuffPtr));
- if (!(nextBDPtr->origBuffPtr)) return (void *)0;
- }
-
- prevBDPtr = nextBDPtr;
- nextBDPtr = (Cppi_HostDesc *)QMSS_DESC_PTR((nextBDPtr->nextBDPtr));
- if (prevBDPtr->nextBDPtr)
- {
- prevBDPtr->nextBDPtr = (uint32_t)Osal_qmssVirtToPhy((void *)(prevBDPtr->nextBDPtr));
- if (!(prevBDPtr->nextBDPtr)) return (void *)0;
- }
-
- Qmss_osalEndMemAccess(buffPtr, prevBDPtr->buffLen);
- Qmss_osalEndMemAccess(prevBDPtr, sizeof(Cppi_HostDesc));
- }
-
- descAddr = Osal_qmssVirtToPhy(descAddr);
- if (!descAddr) return (void *)0;
- }
- else if (Cppi_getDescType((Cppi_Desc *)QMSS_DESC_PTR(descAddr)) == Cppi_DescType_MONOLITHIC)
- {
- descAddr = Osal_qmssVirtToPhy(descAddr);
- if (!descAddr) return (void *)0;
- }
- return descAddr;
-}
-
-/******************************************************************************
-* Function to traverse a CPPI descriptor and convert all address references
-* from physical to virtual.
-******************************************************************************/
-void* Osal_qmssConvertDescPhyToVirt(void *descAddr)
-{
- if (!descAddr) return (void *)0;
- descAddr = Osal_qmssPhyToVirt(descAddr);
- if (!descAddr) return (void *)0;
-
- if (Cppi_getDescType((Cppi_Desc *)QMSS_DESC_PTR(descAddr)) == Cppi_DescType_HOST)
- {
- Cppi_HostDesc *nextBDPtr = (Cppi_HostDesc *)QMSS_DESC_PTR(descAddr);
- while (nextBDPtr)
- {
- Qmss_osalBeginMemAccess(nextBDPtr, sizeof(Cppi_HostDesc));
- if (nextBDPtr->buffPtr)
- {
- nextBDPtr->buffPtr = (uint32_t)Osal_qmssPhyToVirt((void *)(nextBDPtr->buffPtr));
- if (!(nextBDPtr->buffPtr)) return (void *)0;
- }
-
- if (nextBDPtr->origBuffPtr)
- {
- nextBDPtr->origBuffPtr = (uint32_t)Osal_qmssPhyToVirt((void *)(nextBDPtr->origBuffPtr));
- if (!(nextBDPtr->origBuffPtr)) return (void *)0;
- }
-
- if (nextBDPtr->nextBDPtr)
- {
- nextBDPtr->nextBDPtr = (uint32_t)Osal_qmssPhyToVirt((void *)(nextBDPtr->nextBDPtr));
- if (!(nextBDPtr->nextBDPtr)) return (void *)0;
- }
-
- Qmss_osalBeginMemAccess((void *)(nextBDPtr->buffPtr), nextBDPtr->buffLen);
- nextBDPtr = (void *)QMSS_DESC_PTR((nextBDPtr->nextBDPtr));
- }
- }
- return descAddr;
-}
-
-void Osal_cppiCsEnter (uint32_t *key)
-{
-
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
- return;
-}
-
-void Osal_cppiCsExit (uint32_t key)
-{
-
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
- return;
-}
-
-void Osal_cppiLog ( String fmt, ... )
-{
-}
-
-Ptr Osal_cppiMalloc (uint32_t num_bytes)
-{
- Ptr ret;
- Osal_cppi_MallocCounter++;
- num_bytes += (CACHE_LINESZ-1);
- ret = malloc (num_bytes);
- if(ret==NULL)
- {
- System_printf("\nERROR! CPPI Malloc failed!\n");
- }
- return ret;
-}
-
-void Osal_cppiFree (Ptr ptr, uint32_t size)
-{
- /* Increment the free counter. */
- Osal_cppi_FreeCounter++;
- free(ptr);
-}
-
-void Osal_cppiBeginMemAccess (void *blockPtr, uint32_t size)
-{
- Osal_invalidateCache(blockPtr,size);
- return;
-}
-
-void Osal_cppiEndMemAccess (void *blockPtr, uint32_t size)
-{
- Osal_writeBackCache(blockPtr,size);
- return;
-}
-
-void Osal_fwCsEnter (uint32_t *key)
-{
-
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
- return;
-}
-
-void Osal_fwCsExit (uint32_t key)
-{
-
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
- return;
-}
-
-void Osal_paBeginMemAccess (Ptr addr, uint32_t size)
-{
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
-
-}
-
-void Osal_paEndMemAccess (Ptr addr, uint32_t size)
-{
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
-}
-
-
-/**
- * @b Description
- * @n
- * The function is used to enter a critical section.
- * Function protects against
- *
- * access from multiple threads on single core
- * and
- * access from multiple cores
- *
- * @param[in] key
- * Key used to lock the critical section.
- *
- * @retval
- * Not Applicable
- */
-void Osal_paMtCsEnter (uint32_t *key)
-{
-
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
-}
-
-/**
- * @b Description
- * @n
- * The function is used to exit a critical section
- * protected using Osal_salldCsEnter() API.
- *
- * @param[in] key
- * Key used to unlock the critical section.
- *
- * @retval
- * Not Applicable
- */
-void Osal_paMtCsExit (uint32_t key)
-{
- /* Stub Function. TBD: Would need to handle when for multi proc access
- * To be handled using infrastructure available from Kernel
- */
-}
-
-
-
-System_flush()
-{
- fflush(stdout);
-}
-
-Task_exit()
-{
- return;
-}
-
diff --git a/test/PAUnitTest2/armv7/linux/fw_test.h b/test/PAUnitTest2/armv7/linux/fw_test.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * @file fw_test.h
- *
- * @brief
- * Holds all the constants and API definitions required by the example
- * application to run.
- *
- * \par
- * ============================================================================
- * @n (C) Copyright 2012, Texas Instruments, Inc.
- *
- * 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.
- *
-*/
-#ifndef _FW_TEST_H_
-#define _FW_TEST_H_
-
-/* C Standard library Include */
-#include <stdio.h>
-/* System level header files */
-#include <stdint.h>
-#include <stdlib.h>
-
-#include <ti/drv/pa/pa.h>
-
-/* CPPI LLD include */
-#include <ti/drv/cppi/cppi_drv.h>
-#include <ti/drv/cppi/cppi_desc.h>
-
-/* QMSS LLD include */
-#include <ti/drv/qmss/qmss_drv.h>
-
-
-#define System_printf printf
-
-#define CACHE_LINESZ 64
-
-typedef uint16_t fw_Bool_t;
-#define fw_TRUE 1
-#define fw_FALSE 0
-
-/* Total Permanent memory required in Example
- * for Packet buffers & descriptor buffers
- * Allocating entire MSMC
- */
-#define MSMC_TEST_PERM_MEM_SZ (2*1024*1024)
-
-/* Physical address map & size for various subsystems */
-#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_BASE_QUEUE_PROXY_ADDR 0x44040000
-#define QMSS_DATA_BLK_SZ (0x60000)
-#define SRIO_CFG_BASE_ADDR CSL_SRIO_CONFIG_REGS
-#define SRIO_CFG_BLK_SZ (132*1024)
-#define PASS_CFG_BASE_ADDR CSL_PA_SS_CFG_REGS
-#define PASS_CFG_BLK_SZ (1*1024*1024)
-#define MSMC_SRAM_BASE_ADDR CSL_MSMC_SRAM_REGS
-
-/* Global variables to hold virtual address of various subsystems */
-void *fw_qmssCfgVaddr;
-void *fw_qmssDataVaddr;
-void *fw_srioCfgVaddr;
-void *fw_passCfgVaddr;
-
-
-/** Enable Extended Debug with printfs */
-//#define EXT_DEBUG 1
-
-/* Invalidate cache. This should invalidate Cache
- * Wait until operation is complete. Currently stub function
- */
-#define SYS_CACHE_INV(addr, size, code) Osal_invalidateCache(addr,size)
-
-/* Writeback L2 cache. This should Writeback L1D as well.
- * Wait until operation is complete. Currently stub function
- */
-#define SYS_CACHE_WB(addr, size, code) Osal_writeBackCache(addr,size)
-
-/* GCC align attribute */
-#define ALIGN(x) __attribute__((aligned (x)))
-
-/**********************************/
-/* Resources used by Linux Kernel */
-/**********************************/
-
-/* Memory region used by the Kernel */
-#define KERNEL_QMSS_MEM_REGION 5
-#define KERNEL_QMSS_MEM_REG_START_IDX 0x2000
-
-/* CPPI FLow used by the Kernel */
-#define KERNEL_CPPI_RX_FLOW 31
-
-/* General Purpose Queues used by the Kernel */
-#define KERNEL_QMSS_GP_QUEUE_START 4000
-#define KERNEL_QMSS_GP_QUEUE_NUM 2
-
-/* High priority Accumulator Queues used by the Kernel */
-#define KERNEL_QMSS_ACC_QUEUE_START 732
-#define KERNEL_QMSS_ACC_QUEUE_NUM 2
-
-#endif
-
diff --git a/test/PAUnitTest2/c66x/bios/framework.c b/test/PAUnitTest2/c66x/bios/framework.c
+++ /dev/null
@@ -1,1380 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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.
- *
-*/
-
-
-
-/* Generate and verify the system test framework
- *
- * The test framework consists of the pa driver instance, a cppi/cdma/qm configuration,
- * memory for packet transmission and reception, and semaphores that are used
- * for every test in the PA unit test.
- *
- */
-
-#include "pautest.h"
-
-#include <ti/drv/pa/pa_osal.h>
-#include <ti/csl/cslr_device.h>
-#include <ti/csl/csl_psc.h>
-#include <ti/csl/csl_pscAux.h>
-
-#include <ti/csl/cslr_cp_ace.h>
-
-/* CSL CHIP, SEM Functional layer includes */
-#include <ti/csl/csl_chip.h>
-#include <ti/csl/csl_semAux.h>
-
-/* Firmware images */
-#include <ti/drv/pa/fw/pafw.h>
-#include <ti/drv/qmss/qmss_firmware.h>
-
-/**********************************************************************
- ****************************** Defines *******************************
- **********************************************************************/
-#define MAX_NUM_CORES 8
-
-/* Hardware Semaphore to synchronize access from
- * multiple applications (PA applications and non-PASS applications)
- * across different cores to the QMSS library.
- */
-#define QMSS_HW_SEM 3
-
-/* Hardware Semaphore to synchronize access from
- * multiple applications (PASS applications and non-PASS applications)
- * across different cores to the CPPI library.
- */
-#define CPPI_HW_SEM 4
-
-/* Hardware Semaphore to synchronize access from
- * multiple applications (PASS applications and non-PASS applications)
- * across different cores to the PA library.
- */
-#define PA_HW_SEM 5
-
-#undef L2_CACHE
-#ifdef L2_CACHE
- /* Invalidate L2 cache. This should invalidate L1D as well.
- * Wait until operation is complete. */
-#define SYS_CACHE_INV(addr, size, code) CACHE_invL2 (addr, size, code)
-
- /* Writeback L2 cache. This should Writeback L1D as well.
- * Wait until operation is complete. */
-#define SYS_CACHE_WB(addr, size, code) CACHE_wbL2 (addr, size, code)
-
-#else
- /* Invalidate L1D cache and wait until operation is complete.
- * Use this approach if L2 cache is not enabled */
-#define SYS_CACHE_INV(addr, size, code) CACHE_invL1d (addr, size, code)
- /* Writeback L1D cache and wait until operation is complete.
- * Use this approach if L2 cache is not enabled */
-#define SYS_CACHE_WB(addr, size, code) CACHE_wbL1d (addr, size, code)
-
-#endif
-
-
-/**********************************************************************
- ************************** Global Variables **************************
- **********************************************************************/
-UInt32 qmssMallocCounter = 0;
-UInt32 qmssFreeCounter = 0;
-UInt32 cppiMallocCounter = 0;
-UInt32 cppiFreeCounter = 0;
-
-UInt32 coreKey [MAX_NUM_CORES];
-
-/* QMSS device specific configuration */
-extern Qmss_GlobalConfigParams qmssGblCfgParams;
-
-/* CPPI device specific configuration */
-extern Cppi_GlobalConfigParams cppiGblCfgParams;
-
-#undef DBG_MULTI_CORE
-
-/* Simulator debug level regs */
-paLog_t *paLogLevel = (paLog_t *)PA_LOG_IF;
-
-/**********************************************************************
- *************************** OSAL Functions **************************
- **********************************************************************/
-
-/**
- * @b Description
- * @n
- * The function is used to allocate a memory block of the specified size.
- *
- * @param[in] num_bytes
- * Number of bytes to be allocated.
- *
- * @retval
- * Allocated block address
- */
-Ptr Osal_qmssMalloc (UInt32 num_bytes)
-{
- Error_Block errorBlock;
- Ptr dataPtr;
-
- /* Increment the allocation counter. */
- qmssMallocCounter++;
-
- /* Allocate memory. */
- dataPtr = Memory_alloc(NULL, num_bytes, 0, &errorBlock);
- return (dataPtr);
-}
-
-/**
- * @b Description
- * @n
- * The function is used to free a memory block of the specified size.
- *
- * @param[in] ptr
- * Pointer to the memory block to be cleaned up.
- *
- * @param[in] size
- * Size of the memory block to be cleaned up.
- *
- * @retval
- * Not Applicable
- */
-Void Osal_qmssFree (Ptr ptr, UInt32 size)
-{
- /* Increment the free counter. */
- qmssFreeCounter++;
- Memory_free(NULL, ptr, size);
-}
-
-/**
- * @b Description
- * @n
- * The function is used to enter a critical section.
- * Function protects against
- *
- * access from multiple cores
- * and
- * access from multiple threads on single core
- *
- * @param[in] key
- * Key used to lock the critical section.
- *
- * @retval
- * Not Applicable
- */
-Ptr Osal_qmssCsEnter (void)
-{
- /* Get the hardware semaphore.
- *
- * Acquire Multi core QMSS synchronization lock
- */
- while ((CSL_semAcquireDirect (QMSS_HW_SEM)) == 0);
-
- /* Disable all interrupts and OS scheduler.
- *
- * Acquire Multi threaded / process synchronization lock.
- */
- coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)] = Hwi_disable();
-
- return NULL;
-}
-
-/**
- * @b Description
- * @n
- * The function is used to exit a critical section
- * protected using Osal_qmssCsEnter() API.
- *
- * @param[in] key
- * Key used to unlock the critical section.
- *
- * @retval
- * Not Applicable
- */
-Void Osal_qmssCsExit (Ptr CsHandle)
-{
- /* Enable all interrupts and enables the OS scheduler back on.
- *
- * Release multi-threaded / multi-process lock on this core.
- */
- Hwi_restore(coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)]);
-
- /* Release the hardware semaphore
- *
- * Release multi-core lock.
- */
- CSL_semReleaseSemaphore (QMSS_HW_SEM);
-
- return;
-}
-
-/**
- * ============================================================================
- * @n@b Osal_qmssMtCsEnter
- *
- * @b brief
- * @n This API ensures ONLY multi-threaded
- * synchronization to the QMSS user.
- *
- * This is a BLOCKING API.
- *
- * @param[in] None
- *
- * @return
- * Handle used to lock critical section
- * =============================================================================
- */
-Ptr Osal_qmssMtCsEnter (Void)
-{
- /* Disable all interrupts and OS scheduler.
- *
- * Acquire Multi threaded / process synchronization lock.
- */
- //coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)] = Hwi_disable();
-
- return NULL;
-}
-
-/**
- * ============================================================================
- * @n@b Osal_qmssMtCsExit
- *
- * @b brief
- * @n This API needs to be called to exit a previously
- * acquired critical section lock using @a Osal_cpswQmssMtCsEnter ()
- * API. It resets the multi-threaded lock, enabling another process
- * on the current core to grab it.
- *
- * @param[in] CsHandle
- * Handle for unlocking critical section.
- *
- * @return None
- * =============================================================================
- */
-Void Osal_qmssMtCsExit (Ptr CsHandle)
-{
- /* Enable all interrupts and enables the OS scheduler back on.
- *
- * Release multi-threaded / multi-process lock on this core.
- */
- //Hwi_restore(key);
-
- return;
-}
-
-/**
- * @b Description
- * @n
- * The function is the QMSS OSAL Logging API which logs
- * the messages on the console.
- *
- * @param[in] fmt
- * Formatted String.
- *
- * @retval
- * Not Applicable
- */
-Void Osal_qmssLog ( String fmt, ... )
-{
-}
-
-/**
- * @b Description
- * @n
- * The function is used to indicate that a block of memory is
- * about to be accessed. If the memory block is cached then this
- * indicates that the application would need to ensure that the
- * cache is updated with the data from the actual memory.
- *
- * @param[in] blockPtr
- * Address of the block which is to be invalidated
- *
- * @param[in] size
- * Size of the block to be invalidated
-
- * @retval
- * Not Applicable
- */
-void Osal_qmssBeginMemAccess (void *blockPtr, uint32_t size)
-{
- uint32_t key;
-
- /* Disable Interrupts */
- key = Hwi_disable();
-
- /* Cleanup the prefetch buffer also. */
- CSL_XMC_invalidatePrefetchBuffer();
-
- SYS_CACHE_INV (blockPtr, size, CACHE_FENCE_WAIT);
-
- /* Reenable Interrupts. */
- Hwi_restore(key);
-
- return;
-}
-
-/**
- * @b Description
- * @n
- * The function is used to indicate that the block of memory has
- * finished being accessed. If the memory block is cached then the
- * application would need to ensure that the contents of the cache
- * are updated immediately to the actual memory.
- *
- * @param[in] blockPtr
- * Address of the block which is to be written back
- *
- * @param[in] size
- * Size of the block to be written back
-
- * @retval
- * Not Applicable
- */
-void Osal_qmssEndMemAccess (void *blockPtr, uint32_t size)
-{
- uint32_t key;
-
- /* Disable Interrupts */
- key = Hwi_disable();
-
- SYS_CACHE_WB (blockPtr, size, CACHE_FENCE_WAIT);
-
- /* Reenable Interrupts. */
- Hwi_restore(key);
- return;
-}
-
-
-/**
- * @b Description
- * @n
- * The function is used to allocate a memory block of the specified size.
- *
- * Note: If the LLD is used by applications on multiple core, the "cppiHeap"
- * should be in shared memory
- *
- * @param[in] num_bytes
- * Number of bytes to be allocated.
- *
- * @retval
- * Allocated block address
- */
-Ptr Osal_cppiMalloc (UInt32 num_bytes)
-{
- Error_Block errorBlock;
- Ptr dataPtr;
-
- /* Increment the allocation counter. */
- cppiMallocCounter++;
-
- /* Allocate memory. */
- dataPtr = Memory_alloc(NULL, num_bytes, 0, &errorBlock);
- return (dataPtr);
-}
-
-/**
- * @b Description
- * @n
- * The function is used to free a memory block of the specified size allocated
- * using Osal_cppiMalloc() API.
- *
- * @param[in] ptr
- * Pointer to the memory block to be cleaned up.
- *
- * @param[in] size
- * Size of the memory block to be cleaned up.
- *
- * @retval
- * Not Applicable
- */
-Void Osal_cppiFree (Ptr ptr, UInt32 size)
-{
- /* Increment the free counter. */
- cppiFreeCounter++;
- Memory_free (NULL, ptr, size);
-}
-
-/**
- * ============================================================================
- * @n@b Osal_cppiCsEnter
- *
- * @b brief
- * @n This API ensures multi-core and multi-threaded
- * synchronization to the caller.
- *
- * This is a BLOCKING API.
- *
- * This API ensures multi-core synchronization between
- * multiple processes trying to access CPPI shared
- * library at the same time.
- *
- * @param[in]
- * @n None
- *
- * @return
- * @n Handle used to lock critical section
- * =============================================================================
- */
-Ptr Osal_cppiCsEnter (Void)
-{
- /* Get the hardware semaphore.
- *
- * Acquire Multi core CPPI synchronization lock
- */
- while ((CSL_semAcquireDirect (CPPI_HW_SEM)) == 0);
-
- /* Disable all interrupts and OS scheduler.
- *
- * Acquire Multi threaded / process synchronization lock.
- */
- coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)] = Hwi_disable();
-
- return NULL;
-}
-
-/**
- * ============================================================================
- * @n@b Osal_cppiCsExit
- *
- * @b brief
- * @n This API needs to be called to exit a previously
- * acquired critical section lock using @a Osal_cppiCsEnter ()
- * API. It resets the multi-core and multi-threaded lock,
- * enabling another process/core to grab CPPI access.
- *
- * @param[in] CsHandle
- * Handle for unlocking critical section.
- *
- * @return None
- * =============================================================================
- */
-Void Osal_cppiCsExit (Ptr CsHandle)
-{
- /* Enable all interrupts and enables the OS scheduler back on.
- *
- * Release multi-threaded / multi-process lock on this core.
- */
- Hwi_restore(coreKey [CSL_chipReadReg (CSL_CHIP_DNUM)]);
-
- /* Release the hardware semaphore
- *
- * Release multi-core lock.
- */
- CSL_semReleaseSemaphore (CPPI_HW_SEM);
-
- return;
-}
-
-/**
- * @b Description
- * @n
- * The function is the CPPI OSAL Logging API which logs
- * the messages on the console.
- *
- * @param[in] fmt
- * Formatted String.
- *
- * @retval
- * Not Applicable
- */
-Void Osal_cppiLog ( String fmt, ... )
-{
-}
-
-/**
- * @b Description
- * @n
- * The function is used to indicate that a block of memory is
- * about to be accessed. If the memory block is cached then this
- * indicates that the application would need to ensure that the
- * cache is updated with the data from the actual memory.
- *
- * @param[in] blockPtr
- * Address of the block which is to be invalidated
- *
- * @param[in] size
- * Size of the block to be invalidated
-
- * @retval
- * Not Applicable
- */
-void Osal_cppiBeginMemAccess (void *blockPtr, uint32_t size)
-{
- uint32_t key;
-
- /* Disable Interrupts */
- key = Hwi_disable();
-
- /* Cleanup the prefetch buffer also. */
- CSL_XMC_invalidatePrefetchBuffer();
-
- SYS_CACHE_INV (blockPtr, size, CACHE_FENCE_WAIT);
-
- /* Reenable Interrupts. */
- Hwi_restore(key);
-
- return;
-}
-
-/**
- * @b Description
- * @n
- * The function is used to indicate that the block of memory has
- * finished being accessed. If the memory block is cached then the
- * application would need to ensure that the contents of the cache
- * are updated immediately to the actual memory.
- *
- * @param[in] blockPtr
- * Address of the block which is to be written back
- *
- * @param[in] size
- * Size of the block to be written back
-
- * @retval
- * Not Applicable
- */
-void Osal_cppiEndMemAccess (void *blockPtr, uint32_t size)
-{
- uint32_t key;
-
- /* Disable Interrupts */
- key = Hwi_disable();
-
- SYS_CACHE_WB (blockPtr, size, CACHE_FENCE_WAIT);
-
- /* Reenable Interrupts. */
- Hwi_restore(key);
- return;
-}
-
-
-/**
- * @brief This macro is used to alert the application that the PA is
- * going to access table memory. The application must ensure
- * cache coherency and semaphores for multi-core applications
- *
- *
- * <b> Prototype: </b>
- * The following is the C prototype for the expected OSAL API.
- *
- * @verbatim
- void Osal_paBeginMemAccess (void* addr, uint32_t sizeWords)
- @endverbatim
- *
- * <b> Parameters </b>
- * @n The address of the table to be accessed
- * @n The number of bytes in the table
- *
- * @note PA will make nested calls to this function for memory access
- * protection of different memory tables.
- */
-
-
-void Osal_paBeginMemAccess (Ptr addr, UInt32 size)
-{
- uint32_t key;
-
- /* Disable Interrupts */
- key = Hwi_disable();
-
- /* Cleanup the prefetch buffer also. */
- CSL_XMC_invalidatePrefetchBuffer();
-
- SYS_CACHE_INV (addr, size, CACHE_FENCE_WAIT);
-
- /* Reenable Interrupts. */
- Hwi_restore(key);
-
-}
-
-/**
- * @brief This macro is used to alert the application that the PA
- * has completed access to table memory. This call will always
- * be made following a call to Osal_paBeginMemAccess and have
- * the same parameters
- *
- * <b> Prototype: </b>
- * The following is the C prototype for the expected OSAL API.
- *
- * @verbatim
- void Osal_paEndMemAccess (void* addr, uint32_t sizeWords)
- @endverbatim
- *
- * <b> Parameters </b>
- * @n The address of the table to be accessed
- * @n The number of bytes in the table
- *
- * @note PA will make nested calls to this function for memory access
- * protection of different memory tables.
- */
-
-void Osal_paEndMemAccess (Ptr addr, UInt32 size)
-{
- uint32_t key;
-
- /* Disable Interrupts */
- key = Hwi_disable();
-
- SYS_CACHE_WB (addr, size, CACHE_FENCE_WAIT);
-
- /* Reenable Interrupts. */
- Hwi_restore(key);
-
-}
-
-/**
- * @b Description
- * @n
- * The function is used to enter a critical section.
- * Function protects against
- *
- * access from multiple threads on single core
- * and
- * access from multiple cores
- *
- * @param[in] key
- * Key used to lock the critical section.
- *
- * @retval
- * Not Applicable
- */
-Void Osal_paMtCsEnter (uint32_t *key)
-{
-
- /* Get the hardware semaphore.
- *
- * Acquire Multi core PA synchronization lock
- */
- while ((CSL_semAcquireDirect (PA_HW_SEM)) == 0);
- *key = 0;
-}
-
-/**
- * @b Description
- * @n
- * The function is used to exit a critical section
- * protected using Osal_salldCsEnter() API.
- *
- * @param[in] key
- * Key used to unlock the critical section.
- *
- * @retval
- * Not Applicable
- */
-Void Osal_paMtCsExit (uint32_t key)
-{
- /* Release the hardware semaphore */
- CSL_semReleaseSemaphore (PA_HW_SEM);
-}
-
-
-Int downloadPaFirmware (void)
-{
- Int i;
-
- int ret = pa_OK;
-
- Pa_resetControl (tFramework.passHandle, pa_STATE_RESET);
-
- /* PDPSs 0-2 use image c1 */
- for (i = 0; i < 3; i++)
- Pa_downloadImage (tFramework.passHandle, i, (Ptr)c1, c1Size);
-
- /* PDSP 3 uses image c2 */
- Pa_downloadImage (tFramework.passHandle, 3, (Ptr)c2, c2Size);
-
- /* PDSPs 4-5 use image m */
- for (i = 4; i < 6; i++)
- Pa_downloadImage (tFramework.passHandle, i, (Ptr)m, mSize);
-
- ret = Pa_resetControl (tFramework.passHandle, pa_STATE_ENABLE);
-
- if (ret != pa_STATE_ENABLE)
- {
- System_printf ("downloadPaFirmware: Pa_resetControl return with error code %d\n", ret);
- System_flush();
- return (-1);
- }
-
- return (0);
-
-}
-
-
-
-/* The PA LLD instance is created, the PA firmware is
- * downloaded and started */
-Int initPa (Void)
-{
- paSizeInfo_t paSize;
- paConfig_t paCfg;
- paTimestampConfig_t tsCfg;
- int ret;
- int sizes[pa_N_BUFS];
- int aligns[pa_N_BUFS];
- void* bases[pa_N_BUFS];
-
-
- memset(&paSize, 0, sizeof(paSizeInfo_t));
- memset(&paCfg, 0, sizeof(paConfig_t));
-
- /* The maximum number of handles that can exists are 32 for L2, and 64 for L3. */
- paSize.nMaxL2 = TF_MAX_NUM_L2_HANDLES;
- paSize.nMaxL3 = TF_MAX_NUM_L3_HANDLES;
- paSize.nUsrStats = pa_USR_STATS_MAX_COUNTERS;
-
- ret = Pa_getBufferReq(&paSize, sizes, aligns);
-
- if (ret != pa_OK) {
- System_printf ("initPa: Pa_getBufferReq() return with error code %d\n", ret);
- return (-1);
- }
-
- /* The first buffer is used as the instance buffer */
- if ((Uint32)memPaInst & (aligns[0] - 1)) {
- System_printf ("initPa: Pa_getBufferReq requires %d alignment for instance buffer, but address is 0x%08x\n", aligns[0], (Uint32)memPaInst);
- return (-1);
- }
-
- if (sizeof(memPaInst) < sizes[0]) {
- System_printf ("initPa: Pa_getBufferReq requires size %d for instance buffer, have only %d\n", sizes[0], sizeof(memPaInst));
- return (-1);
- }
-
- bases[0] = (Void *)memPaInst;
-
-
- /* The second buffer is the L2 table */
- if ((Uint32)memL2Ram & (aligns[1] - 1)) {
- System_printf ("initPa: Pa_getBufferReq requires %d alignment for buffer 1, but address is 0x%08x\n", aligns[1], (Uint32)memL2Ram);
- return (-1);
- }
-
- if (sizeof(memL2Ram) < sizes[1]) {
- System_printf ("initPa: Pa_getBufferReq requires %d bytes for buffer 1, have only %d\n", sizes[1], sizeof(memL2Ram));
- return (-1);
- }
-
- bases[1] = (Void *)memL2Ram;
-
- /* The third buffer is the L3 table */
- if ((Uint32)memL3Ram & (aligns[2] - 1)) {
- System_printf ("initPa: Pa_getBufferReq requires %d alignment for buffer 2, but address is 0x%08x\n", aligns[2], (Uint32)memL3Ram);
- return (-1);
- }
-
- if (sizeof(memL3Ram) < sizes[2]) {
- System_printf ("initPa: Pa_getBufferReq requires %d bytes for buffer 2, have only %d\n", sizes[2], sizeof(memL3Ram));
- return (-1);
- }
-
- bases[2] = (Void *)memL3Ram;
-
- /* The fourth buffer is the User Statistics Link table */
- if ((Uint32)memUsrStatsLnkTbl & (aligns[3] - 1)) {
- System_printf ("initPa: Pa_getBufferReq requires %d alignment for buffer 3, but address is 0x%08x\n", aligns[3], (Uint32)memUsrStatsLnkTbl);
- return (-1);
- }
-
- if (sizeof(memUsrStatsLnkTbl) < sizes[3]) {
- System_printf ("initPa: Pa_getBufferReq requires %d bytes for buffer 3, have only %d\n", sizes[2], sizeof(memUsrStatsLnkTbl));
- return (-1);
- }
-
- bases[3] = (Void *)memUsrStatsLnkTbl;
-
-
- paCfg.initTable = TRUE;
- paCfg.initDefaultRoute = TRUE;
- paCfg.baseAddr = CSL_PA_SS_CFG_REGS;
- paCfg.sizeCfg = &paSize;
-
- ret = Pa_create (&paCfg, bases, &tFramework.passHandle);
- if (ret != pa_OK) {
- System_printf ("initPa: Pa_create returned with error code %d\n", ret);
- return (-1);
- }
-
- /* Download the firmware */
- if (downloadPaFirmware ())
- return (-1);
-
- /* Enable Timer for timestamp */
- memset(&tsCfg, 0, sizeof(paTimestampConfig_t));
- tsCfg.enable = TRUE;
- tsCfg.factor = pa_TIMESTAMP_SCALER_FACTOR_2;
-
- if(Pa_configTimestamp(tFramework.passHandle, &tsCfg) != pa_OK)
- return (-1);
-
- return (0);
-
-}
-
-Int setupQmMem (void)
-{
- Qmss_InitCfg qmssInitConfig;
- Qmss_MemRegInfo memInfo;
- Cppi_DescCfg descCfg;
- Int32 result;
- Int n;
-
- memset (&qmssInitConfig, 0, sizeof (Qmss_InitCfg));
- memset (memDescRam, 0, sizeof (memDescRam));
-
- qmssInitConfig.linkingRAM0Base = utilgAddr((UInt32)memLinkRam);
- qmssInitConfig.linkingRAM0Size = TF_NUM_DESC;
- qmssInitConfig.linkingRAM1Base = 0;
- qmssInitConfig.maxDescNum = TF_NUM_DESC;
-
- qmssInitConfig.pdspFirmware[0].pdspId = Qmss_PdspId_PDSP1;
-#ifdef _LITTLE_ENDIAN
- qmssInitConfig.pdspFirmware[0].firmware = (void *) &acc48_le;
- qmssInitConfig.pdspFirmware[0].size = sizeof (acc48_le);
-#else
- qmssInitConfig.pdspFirmware[0].firmware = (void *) &acc48_be;
- qmssInitConfig.pdspFirmware[0].size = sizeof (acc48_be);
-#endif
-
- result = Qmss_init (&qmssInitConfig, &qmssGblCfgParams);
- if (result != QMSS_SOK) {
- System_printf ("setupQmMem: Qmss_Init failed with error code %d\n", result);
- return (-1);
- }
-
- result = Qmss_start();
- if (result != QMSS_SOK) {
- System_printf ("setupQmMem: Qmss_start failed with error code %d\n", result);
- return (-1);
- }
-
- /* Setup a single memory region for descriptors */
- memset (memDescRam, 0, sizeof(memDescRam));
- memInfo.descBase = (UInt32 *)utilgAddr((UInt32)memDescRam);
- memInfo.descSize = TF_SIZE_DESC;
- memInfo.descNum = TF_NUM_DESC;
- memInfo.manageDescFlag = Qmss_ManageDesc_MANAGE_DESCRIPTOR;
- memInfo.memRegion = Qmss_MemRegion_MEMORY_REGION0;
- memInfo.startIndex = 0;
-
- result = Qmss_insertMemoryRegion (&memInfo);
- if (result < QMSS_SOK) {
- System_printf ("setupQmMem: Qmss_insertMemoryRegion returned error code %d\n", result);
- return (-1);
- }
-
-
- /* Initialize the descriptors. This function opens a general
- * purpose queue and intializes the memory from region 0, placing
- * the initialized descriptors onto that queue */
- descCfg.memRegion = Qmss_MemRegion_MEMORY_REGION0;
- descCfg.descNum = TF_NUM_DESC;
- descCfg.destQueueNum = TF_Q_FREE_DESC;
- descCfg.queueType = Qmss_QueueType_GENERAL_PURPOSE_QUEUE;
- descCfg.initDesc = Cppi_InitDesc_INIT_DESCRIPTOR;
- descCfg.descType = Cppi_DescType_HOST;
- descCfg.returnQueue.qNum = QMSS_PARAM_NOT_SPECIFIED;
- descCfg.returnQueue.qMgr = 0;
- descCfg.epibPresent = Cppi_EPIB_EPIB_PRESENT;
-
- descCfg.cfg.host.returnPolicy = Cppi_ReturnPolicy_RETURN_ENTIRE_PACKET;
- //descCfg.cfg.host.returnPolicy = Cppi_ReturnPolicy_RETURN_BUFFER;
- descCfg.cfg.host.psLocation = Cppi_PSLoc_PS_IN_DESC;
-
- tFramework.QfreeDesc = Cppi_initDescriptor (&descCfg, (Uint32 *)&n);
-
- if (n != descCfg.descNum) {
- System_printf ("setupQmMem: expected %d descriptors to be initialized, only %d are initialized\n", descCfg.descNum, n);
- return (-1);
- }
-
- return (0);
-
-}
-
-
-Int setupCpdma (void)
-{
- Cppi_CpDmaInitCfg cpdmaCfg;
- Cppi_RxChInitCfg rxChCfg;
- Cppi_TxChInitCfg txChCfg;
-
- Int32 result;
- Int i;
- Uint8 isAlloc;
-
- result = Cppi_init (&cppiGblCfgParams);
- if (result != CPPI_SOK) {
- System_printf ("setupCpdma: cpp_Init returned error %d\n", result);
- return (-1);
- }
-
- memset(&cpdmaCfg, 0, sizeof(Cppi_CpDmaInitCfg));
- cpdmaCfg.dmaNum = Cppi_CpDma_PASS_CPDMA;
-
- tFramework.tfPaCppiHandle = Cppi_open (&cpdmaCfg);
- if (tFramework.tfPaCppiHandle == NULL) {
- System_printf ("setupCpdma: cppi_Open returned NULL cppi handle\n");
- return (-1);
- }
-
-
- /* Open all 24 rx channels */
- rxChCfg.rxEnable = Cppi_ChState_CHANNEL_DISABLE;
-
- for (i = 0; i < TF_PA_NUM_RX_CPDMA_CHANNELS; i++) {
- rxChCfg.channelNum = i;
- tFramework.tfPaRxChHnd[i] = Cppi_rxChannelOpen (tFramework.tfPaCppiHandle, &rxChCfg, &isAlloc);
-
- if (tFramework.tfPaRxChHnd[i] == NULL) {
- System_printf ("setupCpdma: cppi_RxChannelOpen returned NULL handle for channel number %d\n", i);
- return (-1);
- }
-
- Cppi_channelEnable (tFramework.tfPaRxChHnd[i]);
- }
-
- /* Open all 10 tx channels. */
- txChCfg.priority = 2;
- txChCfg.txEnable = Cppi_ChState_CHANNEL_DISABLE;
- txChCfg.filterEPIB = FALSE;
- txChCfg.filterPS = FALSE;
- txChCfg.aifMonoMode = FALSE;
-
-
- for (i = 0; i < TF_PA_NUM_TX_CPDMA_CHANNELS; i++) {
- txChCfg.channelNum = i;
- tFramework.tfPaTxChHnd[i] = Cppi_txChannelOpen (tFramework.tfPaCppiHandle, &txChCfg, &isAlloc);
-
- if (tFramework.tfPaTxChHnd[i] == NULL) {
- System_printf ("setupCpdma: cppi_TxChannelOpen returned NULL handle for channel number %d\n", i);
- return (-1);
- }
-
- Cppi_channelEnable (tFramework.tfPaTxChHnd[i]);
- }
-
- /* Clear CPPI Loobpack bit in PASS CDMA Global Emulation Control Register */
- Cppi_setCpdmaLoopback(tFramework.tfPaCppiHandle, 0);
-
- return (0);
-
-}
-
-
-/* Setup all the queues used in the example */
-Int setupQueues (void)
-{
- Int i;
- Uint8 isAlloc;
-
- Qmss_Queue q;
-
- Cppi_HostDesc *hd;
-
-
- /* The 10 PA transmit queues (corresponding to the 10 tx cdma channels */
- for (i = 0; i < TF_PA_NUM_TX_CPDMA_CHANNELS; i++) {
-
- tFramework.QPaTx[i] = Qmss_queueOpen (Qmss_QueueType_PASS_QUEUE, QMSS_PARAM_NOT_SPECIFIED, &isAlloc);
-
- if (tFramework.QPaTx[i] < 0) {
- System_printf ("setupQueues: Qmss_queueOpen failed for PA transmit queue number %d\n", 640+i);
- return (-1);
- }
-
- Qmss_setQueueThreshold (tFramework.QPaTx[i], 1, 1);
-
-
- }
-
-
- /* The default return queue for descriptors with linked buffers */
- tFramework.QDefRet = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, TF_DEF_RET_Q, &isAlloc);
- if (tFramework.QDefRet < 0) {
- System_printf ("setupQueues: Qmss_queueOpen failed for queue %d\n", TF_DEF_RET_Q);
- return (-1);
- }
-
- /* The queues with attached buffers */
- tFramework.QLinkedBuf1 = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, TF_LINKED_BUF_Q1, &isAlloc);
-
- if (tFramework.QLinkedBuf1 < 0) {
- System_printf ("setupQueues: Qmss_queueOpen failed for queue %d\n", TF_LINKED_BUF_Q1);
- return (-1);
- }
-
- tFramework.QLinkedBuf2 = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, TF_LINKED_BUF_Q2, &isAlloc);
-
- if (tFramework.QLinkedBuf2 < 0) {
- System_printf ("SetupQueues: Qmss_queueOpen failed for queue %d\n", TF_LINKED_BUF_Q2);
- return (-1);
- }
-
- tFramework.QLinkedBuf3 = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, TF_LINKED_BUF_Q3, &isAlloc);
-
- if (tFramework.QLinkedBuf3 < 0) {
- System_printf ("SetupQueues: Qmss_queueOpen failed for queue %d\n", TF_LINKED_BUF_Q3);
- return (-1);
- }
-
- /* Attach buffers to the queues and push them onto the queue */
- q.qMgr = 0;
- q.qNum = TF_DEF_RET_Q;
-
- for (i = 0; i < TF_LINKED_BUF_Q1_NBUFS; i++) {
-
- hd = (Cppi_HostDesc *)(((UInt32)Qmss_queuePop (tFramework.QfreeDesc)) & ~15);
- if (hd == NULL) {
- System_printf ("setupQueues: Qmss_queuePop returned NULL on pop from queue number %d\n", tFramework.QfreeDesc);
- return (-1);
- }
-
- Cppi_setOriginalBufInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (Uint8 *)utilgAddr((UInt32)(memQ1[i])), sizeof(memQ1[i]));
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (Uint8 *)utilgAddr((UInt32)(memQ1[i])), sizeof(memQ1[i]));
- Cppi_setOriginalBufInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (Uint8 *)utilgAddr((UInt32)(memQ1[i])), sizeof(memQ1[i]));
- hd->nextBDPtr = NULL;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
- Qmss_queuePushDesc (tFramework.QLinkedBuf1, (Ptr)hd);
-
- }
-
- for (i = 0; i < TF_LINKED_BUF_Q2_NBUFS; i++) {
-
- hd = (Cppi_HostDesc *)(((UInt32)Qmss_queuePop (tFramework.QfreeDesc)) & ~15);
- if (hd == NULL) {
- System_printf ("setupQueues: Qmss_queuePop returned NULL on pop from queue number %d\n", tFramework.QfreeDesc);
- return (-1);
- }
-
- Cppi_setOriginalBufInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (Uint8 *)utilgAddr((UInt32)(memQ2[i])), sizeof(memQ2[i]));
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (Uint8 *)utilgAddr((UInt32)(memQ2[i])), sizeof(memQ2[i]));
- Cppi_setOriginalBufInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (Uint8 *)utilgAddr((UInt32)(memQ2[i])), sizeof(memQ2[i]));
- hd->nextBDPtr = NULL;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
- Qmss_queuePushDesc (tFramework.QLinkedBuf2, (Ptr)hd);
-
- }
-
- for (i = 0; i < TF_LINKED_BUF_Q3_NBUFS; i++) {
-
- hd = (Cppi_HostDesc *)(((UInt32)Qmss_queuePop (tFramework.QfreeDesc)) & ~15);
- if (hd == NULL) {
- System_printf ("setupQueues: Qmss_queuePop returned NULL on pop from queue number %d\n", tFramework.QfreeDesc);
- return (-1);
- }
-
- Cppi_setOriginalBufInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (Uint8 *)utilgAddr((UInt32)(memQ3[i])), sizeof(memQ3[i]));
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (Uint8 *)utilgAddr((UInt32)(memQ3[i])), sizeof(memQ3[i]));
- Cppi_setOriginalBufInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (Uint8 *)utilgAddr((UInt32)(memQ3[i])), sizeof(memQ3[i]));
- hd->nextBDPtr = NULL;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
- Qmss_queuePushDesc (tFramework.QLinkedBuf3, (Ptr)hd);
-
- }
-
- tFramework.QDefRet = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, TF_DEF_RET_Q, &isAlloc);
- if (tFramework.QDefRet < 0) {
- System_printf ("SetupQueues: Qmss_queueOpen failed for queue %d\n", TF_DEF_RET_Q);
- return (-1);
- }
-
- tFramework.QCommonCmdRep = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, TF_COMMON_CMD_REPL_Q, &isAlloc);
- if (tFramework.QCommonCmdRep < 0) {
- System_printf ("SetupQueues: Qmss_queueOpen failed for queue %d\n", TF_COMMON_CMD_REPL_Q);
- return (-1);
- }
-
-
-
- /* General purpose queues */
- for (i = 0; i < TF_NUM_GEN_QUEUES; i++) {
-
- tFramework.QGen[i] = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, TF_FIRST_GEN_QUEUE + i, &isAlloc);
-
- if (tFramework.QGen[i] < 0) {
- System_printf ("SetupQueues: Qmss_queueOpen failed for queue %d\n", TF_FIRST_GEN_QUEUE + i);
- return (-1);
- }
- }
-
-
- return (0);
-
-}
-
-
-UInt32 flowregs[8];
-/* Configure flows */
-int setupFlows (void)
-{
- Cppi_RxFlowCfg rxFlowCfg;
- Uint8 isAlloc;
- Int i;
-
- /* Configure Rx flow */
- rxFlowCfg.flowIdNum = tFramework.tfFlowNum = 0;
- rxFlowCfg.rx_dest_qnum = TF_FIRST_GEN_QUEUE + TF_NUM_GEN_QUEUES -1; /* Override in PA */
- rxFlowCfg.rx_dest_qmgr = 0;
- rxFlowCfg.rx_sop_offset = 0;
- rxFlowCfg.rx_ps_location = Cppi_PSLoc_PS_IN_DESC;
- rxFlowCfg.rx_desc_type = Cppi_DescType_HOST;
- rxFlowCfg.rx_error_handling = 1;
- rxFlowCfg.rx_psinfo_present = 1;
- rxFlowCfg.rx_einfo_present = 1;
-
- rxFlowCfg.rx_dest_tag_lo = 0;
- rxFlowCfg.rx_dest_tag_hi = 0;
- rxFlowCfg.rx_src_tag_lo = 0;
- rxFlowCfg.rx_src_tag_hi = 0;
-
- rxFlowCfg.rx_size_thresh0_en = 1;
- rxFlowCfg.rx_size_thresh1_en = 1;
- rxFlowCfg.rx_size_thresh2_en = 0;
- rxFlowCfg.rx_dest_tag_lo_sel = 0;
- rxFlowCfg.rx_dest_tag_hi_sel = 0;
- rxFlowCfg.rx_src_tag_lo_sel = 0;
- rxFlowCfg.rx_src_tag_hi_sel = 0;
-
- rxFlowCfg.rx_fdq1_qnum = tFramework.QLinkedBuf2;
- rxFlowCfg.rx_fdq1_qmgr = 0;
- rxFlowCfg.rx_fdq0_sz0_qnum = tFramework.QLinkedBuf1;
- rxFlowCfg.rx_fdq0_sz0_qmgr = 0;
-
- rxFlowCfg.rx_fdq3_qnum = tFramework.QLinkedBuf2;
- rxFlowCfg.rx_fdq3_qmgr = 0;
- rxFlowCfg.rx_fdq2_qnum = tFramework.QLinkedBuf2;
- rxFlowCfg.rx_fdq2_qmgr = 0;
-
- rxFlowCfg.rx_size_thresh1 = TF_LINKED_BUF_Q2_BUF_SIZE;
- rxFlowCfg.rx_size_thresh0 = TF_LINKED_BUF_Q1_BUF_SIZE;
-
- rxFlowCfg.rx_fdq0_sz1_qnum = tFramework.QLinkedBuf2;
- rxFlowCfg.rx_fdq0_sz1_qmgr = 0;
- rxFlowCfg.rx_size_thresh2 = 0;
-
- rxFlowCfg.rx_fdq0_sz3_qnum = tFramework.QLinkedBuf3;
- rxFlowCfg.rx_fdq0_sz3_qmgr = 0;
- rxFlowCfg.rx_fdq0_sz2_qnum = tFramework.QLinkedBuf3;
- rxFlowCfg.rx_fdq0_sz2_qmgr = 0;
-
- tFramework.tfPaFlowHnd0 = Cppi_configureRxFlow (tFramework.tfPaCppiHandle, &rxFlowCfg, &isAlloc);
- if (tFramework.tfPaFlowHnd0 == NULL) {
- System_printf ("setupFlows: cppi_ConfigureRxFlow returned NULL on flow 0\n");
- return (-1);
- }
-
-
- for (i = 0; i < 8; i++)
- flowregs[i] = *((UInt32 *)(0x2004e00 + (i*4)));
-
- return (0);
-
-}
-
-
-
-
-/* The QM/CPDMA are setup */
-Int initQm (Void)
-{
- if (setupQmMem()) {
- System_printf ("initQm: setupQmMem failed\n");
- return (-1);
- }
-
- if (setupCpdma ()) {
- System_printf ("initQm: setupCpdma failed\n");
- return (-1);
- }
-
- if (setupQueues ()) {
- System_printf ("initQm: setupQueues failed\n");
- return (-1);
- }
-
- if (setupFlows ()) {
- System_printf ("initQm: setupFlows failed\n");
- return (-1);
- }
-
- return (0);
-
-}
-
-
-/* Two semaphores are used to gate access to the PA handle tables */
-Int initSems (Void)
-{
- Semaphore_Params params;
- Error_Block eb;
-
- Semaphore_Params_init (¶ms);
- params.mode = Semaphore_Mode_BINARY;
-
- tFramework.tfPaTableL2Sem = Semaphore_create (1, ¶ms, &eb );
- tFramework.tfPaTableL3Sem = Semaphore_create (1, ¶ms, &eb );
- tFramework.tfQmSem = Semaphore_create (1, ¶ms, &eb);
-
- return (0);
-}
-
-/***************************************************************************************
- * FUNCTION PURPOSE: Power up PA subsystem
- ***************************************************************************************
- * DESCRIPTION: this function powers up the PA subsystem domains
- ***************************************************************************************/
-void passPowerUp (void)
-{
-
- /* PASS power domain is turned OFF by default. It needs to be turned on before doing any
- * PASS device register access. This not required for the simulator. */
-
- /* Set PASS Power domain to ON */
- CSL_PSC_enablePowerDomain (CSL_PSC_PD_PASS);
-
- /* Enable the clocks for PASS modules */
- CSL_PSC_setModuleNextState (CSL_PSC_LPSC_PKTPROC, PSC_MODSTATE_ENABLE);
- CSL_PSC_setModuleNextState (CSL_PSC_LPSC_CPGMAC, PSC_MODSTATE_ENABLE);
- CSL_PSC_setModuleNextState (CSL_PSC_LPSC_Crypto, PSC_MODSTATE_ENABLE);
-
- /* Start the state transition */
- CSL_PSC_startStateTransition (CSL_PSC_PD_PASS);
-
- /* Wait until the state transition process is completed. */
- utilCycleDelay (1000);
- //while (!CSL_PSC_isStateTransitionDone (CSL_PSC_PD_PASS));
-}
-
-/* Initialize the test framework */
-Int setupTestFramework (Void)
-{
- GateHwi_Params prms;
-
- /* Create the HW disable gate. It is used by QM call backs */
- GateHwi_Params_init(&prms);
- tFramework.gateHwi = GateHwi_create(&prms, NULL);
-
- /* Power up PA sub-systems */
- passPowerUp();
-
- /* Setup the semaphores used for access to the PA tables.
- * This has to be done before the PA is initialized */
- if (initSems()) {
- System_printf ("setupTestFramework: initQm returned error, exiting\n");
- return (-1);
- }
-
- /* Create the PA driver instance */
- if (initPa()) {
- System_printf ("setupTestFramework: initPa returned error, exiting\n");
- return (-1);
- }
-
- /* Setup the QM with associated buffers and descriptors */
- if (initQm()) {
- System_printf ("setupTestFramework: initQm returned error, exiting\n");
- return (-1);
- }
-
- return (0);
-
-}
-
-/* Check that all the queues are setup correctly */
-Int verifyTestFramework (Void)
-{
- Int i, j;
- Int count;
- Int returnVal = 0;
- Cppi_HostDesc *hd;
- UInt8 *bufp;
- UInt32 bufLen;
- Qmss_Queue q;
-
- Int32 linkedQ[3];
- Int32 nbufs[] = { TF_LINKED_BUF_Q1_NBUFS, TF_LINKED_BUF_Q2_NBUFS, TF_LINKED_BUF_Q3_NBUFS };
- Int32 bSize[] = { TF_LINKED_BUF_Q1_BUF_SIZE, TF_LINKED_BUF_Q2_BUF_SIZE, TF_LINKED_BUF_Q3_BUF_SIZE };
-
- linkedQ[0] = tFramework.QLinkedBuf1;
- linkedQ[1] = tFramework.QLinkedBuf2;
- linkedQ[2] = tFramework.QLinkedBuf3;
-
- /* Verify that all of the general purpose queues are empty */
- for (i = 0; i < TF_NUM_GEN_QUEUES; i++) {
- if ((count = Qmss_getQueueEntryCount (tFramework.QGen[i])) != 0) {
- System_printf ("verifyTestFramework: Expected 0 entry count for queue %d, found %d entries\n", tFramework.QGen[i], count);
- returnVal = -1;
- }
- }
-
- /* Verify that the number of descriptors in the free descriptor queue is correct */
- count = Qmss_getQueueEntryCount (tFramework.QfreeDesc);
- if (count != (TF_NUM_DESC - TF_LINKED_BUF_Q1_NBUFS - TF_LINKED_BUF_Q2_NBUFS - TF_LINKED_BUF_Q3_NBUFS)) {
- System_printf ("verifyTestFramework: Expected %d entry count in the free descriptor queue (%d), found %d\n",
- TF_NUM_DESC - TF_LINKED_BUF_Q1_NBUFS - TF_LINKED_BUF_Q2_NBUFS - TF_LINKED_BUF_Q3_NBUFS,
- tFramework.QfreeDesc, count);
- returnVal = -1;
- }
-
- q.qMgr = 0;
- q.qNum = TF_DEF_RET_Q;
-
- /* Verify the number and sizing of descriptors with linked buffers in the three queues */
- for (j = 0; j < 3; j++) {
-
- count = Qmss_getQueueEntryCount (linkedQ[j]);
- if (count != nbufs[j]) {
- System_printf ("verifyTestFramework: Expected %d entry count in linked buffer queue 1 (%d), found %d\n",
- nbufs[j], linkedQ[j], count);
- returnVal = -1;
- }
-
- for (i = 0; i < count; i++) {
- hd = (Cppi_HostDesc *)(((UInt32)Qmss_queuePop (linkedQ[j])) & ~15);
- Cppi_getOriginalBufInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, &bufp, &bufLen);
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
- Qmss_queuePush (linkedQ[j], (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- if (bufLen != bSize[j]) {
- System_printf ("verifyTestFramework: Linked buffer queue %d (%d) expected orignal length of %d, found %d\n",
- j, linkedQ[j], bSize[j], bufLen);
- returnVal = -1;
- break;
- }
- }
- }
-
-
- return (returnVal);
-}
-
-
diff --git a/test/PAUnitTest2/c66x/bios/link.cmd b/test/PAUnitTest2/c66x/bios/link.cmd
+++ /dev/null
@@ -1,8 +0,0 @@
-
-SECTIONS
-{
- .init_array > L2SRAM
- .qmss > L2SRAM
- .cppi > L2SRAM
- .testPkts > MSMCSRAM
-}
\ No newline at end of file
diff --git a/test/PAUnitTest2/c66x/bios/pa_utest.cfg b/test/PAUnitTest2/c66x/bios/pa_utest.cfg
+++ /dev/null
@@ -1,29 +0,0 @@
-
-var System = xdc.useModule('xdc.runtime.System');
-var Memory = xdc.useModule('xdc.runtime.Memory');
-var BIOS = xdc.useModule('ti.sysbios.BIOS');
-var Idle = xdc.useModule('ti.sysbios.knl.Idle');
-var Swi = xdc.useModule('ti.sysbios.knl.Swi');
-var Clock = xdc.useModule('ti.sysbios.knl.Clock');
-var Task = xdc.useModule('ti.sysbios.knl.Task');
-var Event = xdc.useModule('ti.sysbios.knl.Event');
-var Mailbox = xdc.useModule('ti.sysbios.knl.Mailbox');
-var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
-var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
-var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
-
-var Csl = xdc.loadPackage('ti.csl');
-var Pa = xdc.loadPackage('ti.drv.pa');
-var Qm = xdc.loadPackage('ti.drv.qmss');
-var Cppi = xdc.loadPackage('ti.drv.cppi');
-
-/* Create default heap and hook it into Memory */
-var heapMemParams = new HeapMem.Params;
-heapMemParams.size = 16384;
-var heap0 = HeapMem.create(heapMemParams);
-
-Memory.defaultHeapInstance = heap0;
-
-
-Clock.timerId = 0;
-Task.defaultStackSize = 4096;
diff --git a/test/PAUnitTest2/c66x/bios/testMain.c b/test/PAUnitTest2/c66x/bios/testMain.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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 "pautest.h"
-
-Void topLevelTest (UArg a0, UArg a1);
-
-/* NULL terminated The list of tests */
-extern paTest_t paTestList[];
-
-/* The exit code is a global. This is used so
- * the clock function can terminate the program with
- * the proper exit code */
-Int exitCode;
-
-
-/* Creates a single task - the top level task. This is a low priority task that
- * spawns the individual tests */
-extern cregister volatile unsigned int TSCL;
-Void main ()
-{
- Task_Params tparams;
-
- /* The only initial task is the top level test */
- Task_Params_init (&tparams);
- tparams.instance->name = "Top Level Test";
- tparams.priority = 1;
-
- Task_create (topLevelTest, &tparams, NULL);
-
- /* Start the cycle counter */
- TSCL = 1;
-
- BIOS_start ();
-}
-
-
-Void clk1Fxn (UArg a0)
-{
- BIOS_exit (exitCode);
-}
-
-/* Initialize the test framework and launch the individual tests */
-Void topLevelTest (UArg a0, UArg a1)
-{
- Task_Params tparams;
- Task_Handle thandle;
- Task_Stat tstat;
-
- Clock_Handle clkh;
- Clock_Params clkParams;
-
- Int i;
-
- Int passCount;
- Int failCount;
- Int notRunCount;
-
- /* For some reason some printfs are lost unless there is a delay between System_flush
- * and System_exit, so delay is forced */
- Clock_Params_init(&clkParams);
- clkParams.period = 0;
- clkParams.startFlag = FALSE;
- clkh = Clock_create(clk1Fxn, 1, &clkParams, NULL);
-
- System_printf ("\n\n ------- PA Unit Test Starting ---------\n");
-
- /* Initialize the PA, PA cpdma, QM and CPPI. Each test will use
- * the same framework */
- if (setupTestFramework ()) {
- System_printf ("topLevelTest (%s:%d): setupTestFramework returned error, exiting\n", __FILE__, __LINE__);
- System_flush ();
- exitCode = -1;
- Clock_start(clkh);
- Task_exit ();
- }
-
- /* Make sure the setup matches what is expected */
- if (verifyTestFramework()) {
- System_printf ("topLevelTest (%s:%d): verifyTestFramework returned error after initial framework setup, exiting\n", __FILE__, __LINE__);
- System_flush();
- exitCode = -1;
- Clock_start(clkh);
- Task_exit ();
- }
-
- /* Configure task parameters common to all test tasks */
- Task_Params_init (&tparams);
- tparams.priority = 2;
- tparams.arg0 = (UArg) &tFramework;
-
- /* Run the tests */
- for (i = 0; paTestList[i].testFunction != NULL; i++ ) {
-
- tparams.arg1 = (UArg)&paTestList[i];
- tparams.instance->name = paTestList[i].name;
-
- thandle = Task_create (paTestList[i].testFunction, &tparams, NULL);
-
- /* The test task will terminate upon completion. Verify that the
- * task has completed in case the task itself uses multiple tasks
- * that all wind up idle for a while. */
- do {
- Task_stat (thandle, &tstat);
- } while (tstat.mode != Task_Mode_TERMINATED);
-
- Task_delete (&thandle);
-
- if (paTestList[i].testStatus == PA_TEST_PASSED)
- System_printf ("%s: PASSED\n", paTestList[i].name);
- else
- System_printf ("%s: FAILED\n", paTestList[i].name);
-
- System_flush();
-
- /* Do a quick check of the test framework */
- if (verifyTestFramework ()) {
- System_printf ("topLevelTest (%s:%d): verifyTestFramework returned error after test %s. Exiting.\n", __FILE__, __LINE__, paTestList[i].name);
- exitCode = -1;
- System_flush ();
- Clock_start(clkh);
- }
- }
-
-
- /* Summarize the test results */
- for (i = passCount = failCount = notRunCount = 0; paTestList[i].testFunction != NULL; i++) {
- if (paTestList[i].testStatus == PA_TEST_PASSED)
- passCount += 1;
- else if (paTestList[i].testStatus == PA_TEST_FAILED)
- failCount += 1;
- else
- notRunCount += 1;
- }
-
- System_printf ("\n\nTest summary:\n\tTests Passed: %d\n\tTests Failed: %d\n\tTests not run: %d\n\n",
- passCount, failCount, notRunCount);
-
-
-
- System_printf ("\n\n ------- PA Unit Test Complete ---------\n");
- System_flush();
- Clock_start(clkh);
-
- Task_exit();
-}
-
-
-
-
diff --git a/test/PAUnitTest2/c66x/bios/testmem.c b/test/PAUnitTest2/c66x/bios/testmem.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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.
- *
-*/
-
-
-
-/* Static memory allocation for test framework */
-
-#include "pautest.h"
-
-tFramework_t tFramework;
-
-/* HW interrupt disable handle */
-GateHwi_Handle gateHwi;
-
-#pragma DATA_ALIGN(memPaInst, 8)
-UInt8 memPaInst[TF_PA_INST_SIZE];
-
-#pragma DATA_ALIGN(memL2Ram, 8)
-UInt8 memL2Ram[TF_L2_TABLE_SIZE];
-
-#pragma DATA_ALIGN(memL3Ram, 8);
-UInt8 memL3Ram[TF_L3_TABLE_SIZE];
-
-#pragma DATA_ALIGN(memUsrStatsLnkTbl, 8);
-UInt8 memUsrStatsLnkTbl[TF_USR_STATS_LNK_TABLE_SIZE];
-
-/* Memory used for the linking RAM and descriptor RAM */
-#pragma DATA_ALIGN(memLinkRam, 16)
-UInt64 memLinkRam[TF_NUM_DESC];
-
-#pragma DATA_ALIGN(memDescRam, 16)
-UInt8 memDescRam[TF_NUM_DESC * TF_SIZE_DESC];
-
-/* Queue handles */
-Int32 QPaTx[TF_PA_NUM_TX_CPDMA_CHANNELS];
-Int32 QfreeDesc; /* Unassociated descriptor queue handle */
-Int32 QtDown; /* Teardown queue handle */
-Int32 QLinkedBuf1; /* Queue of descriptors with linked buffers */
-Int32 QLinkedBuf2; /* Queue of descriptors with linked buffers */
-Int32 QLinkedBuf3; /* Queue of descriptors with linked buffers */
-Int32 QGen[TF_NUM_GEN_QUEUES]; /* General Use queues */
-
-
-/* PA CPDMA instance and channel handles */
-Cppi_Handle tfPaCppiHandle;
-Cppi_ChHnd tfPaTxChHnd[TF_PA_NUM_TX_CPDMA_CHANNELS];
-Cppi_ChHnd tfPaRxChHnd[TF_PA_NUM_RX_CPDMA_CHANNELS];
-
-
-/* Packet buffers attached to descriptors */
-#pragma DATA_ALIGN(memQ1, 16)
-#pragma DATA_ALIGN(memQ2, 16)
-#pragma DATA_ALIGN(memQ3, 16)
-UChar memQ1[TF_LINKED_BUF_Q1_NBUFS][TF_LINKED_BUF_Q1_BUF_SIZE];
-UChar memQ2[TF_LINKED_BUF_Q2_NBUFS][TF_LINKED_BUF_Q2_BUF_SIZE];
-UChar memQ3[TF_LINKED_BUF_Q3_NBUFS][TF_LINKED_BUF_Q3_BUF_SIZE];
-
-/* Semaphore handles for PA tables */
-Semaphore_Handle tfPaTableL2;
-Semaphore_Handle tfPaTableL3;
-
-
-/* Flow handles */
-Cppi_FlowHnd tfPaFlowHnd;
-
-
diff --git a/test/PAUnitTest2/common/common.c b/test/PAUnitTest2/common/common.c
+++ /dev/null
@@ -1,2384 +0,0 @@
-/*
- *
- * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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.
- *
-*/
-
-
-
-/* Common test utilities */
-#include "../pautest.h"
-
-#define TEST_COMMON_STATS_REQ_ID 0x12123487
-
-/* NULL terminated list of tests */
-paTest_t paTestList[] = {
- { paTestUnconfigured, "Packet reception while unconfigured", PA_TEST_NOT_RUN },
- { paTestSrioRouting, "Pa_addSrio and SRIO routing", PA_TEST_NOT_RUN },
- { paTestL2Routing, "Pa_addMac and L2 routing", PA_TEST_NOT_RUN },
-#ifndef __LINUX_USER_SPACE
- { paTestL3Routing, "Pa_addIp and L3 Routing", PA_TEST_NOT_RUN },
- { paTestL4Routing, "Pa_addPort and L4 Routing", PA_TEST_NOT_RUN },
-#endif
- { paTestPatchRoute, "Blind patch and route", PA_TEST_NOT_RUN },
- { paTestTxFmtRt, "Tx checksum and routing", PA_TEST_NOT_RUN },
- { paTestCustom, "Custom routing", PA_TEST_NOT_RUN },
-#ifndef __LINUX_USER_SPACE
- { paTestIPv4FragReassem,"IPv4 Fragmentation and Reassembly", PA_TEST_NOT_RUN },
-#endif
- { paTestUnconfigured, "Packet reception while unconfigured", PA_TEST_NOT_RUN },
-#ifndef __LINUX_USER_SPACE
- { paTestMultiRouting, "Multi-routing", PA_TEST_NOT_RUN },
-#endif
- { NULL, NULL, PA_TEST_NOT_RUN }
-};
-
-/* Request stats from the PA */
-int32_t testCommonRequestPaStats (char *fname, tFramework_t *tf, Bool reset, int32_t QSource, int32_t QRecycle, paCmdReply_t *reply)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- paReturn_t paret;
- uint16_t cmdSize;
- int32_t cmdDest;
- uint32_t pktcmd = PASAHO_PACFG_CMD;
- volatile int32_t mdebugWait = 0;
-
- /* Pop a descriptor with an associated buffer to use for the command request */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QSource)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop descriptor from queue %d\n", fname, __FILE__, __LINE__, QSource);
- return (-1);
- }
-
- /* Make sure there is a buffer attached and get the size */
- if (hd->buffPtr == (uint32_t)NULL) {
- System_printf ("%s (%s:%d): Descriptor from queue %d had no associated buffer\n", fname, __FILE__, __LINE__, QSource);
- return (-1);
- }
- cmdSize = hd->origBufferLen;
-
- paret = Pa_requestStats (tf->passHandle, reset, (paCmd_t)hd->buffPtr, &cmdSize, reply, &cmdDest);
-
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): Pa_requestStats returned error code %d\n", fname, __FILE__, __LINE__, paret);
- Qmss_queuePushDesc (QSource, (Ptr)hd);
- return (-1);
- }
-
-
- /* Set the packet length and the buffer length. The buffer length MUST NOT
- * exceed the packet length */
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, cmdSize);
- hd->buffLen = cmdSize;
-
- /* Mark the packet as a configuration packet and setup for the descriptor return */
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&pktcmd, 4);
-
- q.qMgr = 0;
- q.qNum = QRecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
-/* mdebugHaltPdsp (4); */
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- while (mdebugWait);
- return (0);
-
-}
-
-/* Compare stats and report any differences */
-int32_t testCommonCompareStats (char *fname, paSysStats_t *expected, paSysStats_t *actual)
-{
- int32_t retval = 0;
-
- if (expected->classify1.nPackets != actual->classify1.nPackets) {
- System_printf ("%s: Stat classify1.nPackets expected %d, found %d\n", fname, expected->classify1.nPackets, actual->classify1.nPackets);
- retval = 1;
- }
- if (expected->classify1.nIpv4Packets != actual->classify1.nIpv4Packets) {
- System_printf ("%s: Stat classify1.nIpv4Packets expected %d, found %d\n", fname, expected->classify1.nIpv4Packets, actual->classify1.nIpv4Packets);
- retval = 1;
- }
-
- if (expected->classify1.nIpv6Packets != actual->classify1.nIpv6Packets) {
- System_printf ("%s: Stat classify1.nIpv6Packets expected %d, found %d\n", fname, expected->classify1.nIpv6Packets, actual->classify1.nIpv6Packets);
- retval = 1;
- }
-
- if (expected->classify1.nCustomPackets != actual->classify1.nCustomPackets) {
- System_printf ("%s: Stat classify1.nCustomPackets expected %d, found %d\n", fname, expected->classify1.nCustomPackets, actual->classify1.nCustomPackets);
- retval = 1;
- }
-
- if (expected->classify1.nSrioPackets != actual->classify1.nSrioPackets) {
- System_printf ("%s: Stat classify1.nSrioPackets expected %d, found %d\n", fname, expected->classify1.nSrioPackets, actual->classify1.nSrioPackets);
- retval = 1;
- }
-
- if (expected->classify1.nLlcSnapFail != actual->classify1.nLlcSnapFail) {
- System_printf ("%s: Stat classify1.nLlcSnapFail expected %d, found %d\n", fname, expected->classify1.nLlcSnapFail, actual->classify1.nLlcSnapFail);
- retval = 1;
- }
-
- if (expected->classify1.nTableMatch != actual->classify1.nTableMatch) {
- System_printf ("%s: Stat classify1.nTableMatch expected %d, found %d\n", fname, expected->classify1.nTableMatch, actual->classify1.nTableMatch);
- retval = 1;
- }
-
- if (expected->classify1.nNoTableMatch != actual->classify1.nNoTableMatch) {
- System_printf ("%s: Stat classify1.nNoTableMatch expected %d, found %d\n", fname, expected->classify1.nNoTableMatch, actual->classify1.nNoTableMatch);
- retval = 1;
- }
-
- if (expected->classify1.nIpFrag != actual->classify1.nIpFrag) {
- System_printf ("%s: Stat classify1.nIpFrag expected %d, found %d\n", fname, expected->classify1.nIpFrag, actual->classify1.nIpFrag);
- retval = 1;
- }
-
- if (expected->classify1.nIpDepthOverflow != actual->classify1.nIpDepthOverflow) {
- System_printf ("%s: Stat classify1.nIpDepthOverflow expected %d, found %d\n", fname, expected->classify1.nIpDepthOverflow, actual->classify1.nIpDepthOverflow);
- retval = 1;
- }
-
- if (expected->classify1.nVlanDepthOverflow != actual->classify1.nVlanDepthOverflow) {
- System_printf ("%s: Stat classify1.nVlanDepthOverflow expected %d, found %d\n", fname, expected->classify1.nVlanDepthOverflow, actual->classify1.nVlanDepthOverflow);
- retval = 1;
- }
-
- if (expected->classify1.nGreDepthOverflow != actual->classify1.nGreDepthOverflow) {
- System_printf ("%s: Stat classify1.nGreDepthOverflow expected %d, found %d\n", fname, expected->classify1.nGreDepthOverflow, actual->classify1.nGreDepthOverflow);
- retval = 1;
- }
-
- if (expected->classify1.nMplsPackets != actual->classify1.nMplsPackets) {
- System_printf ("%s: Stat classify1.nMplsPackets expected %d, found %d\n", fname, expected->classify1.nMplsPackets, actual->classify1.nMplsPackets);
- retval = 1;
- }
-
- if (expected->classify1.nParseFail != actual->classify1.nParseFail) {
- System_printf ("%s: Stat classify1.nParseFail expected %d, found %d\n", fname, expected->classify1.nParseFail, actual->classify1.nParseFail);
- retval = 1;
- }
-
- if (expected->classify1.nInvalidIPv6Opt != actual->classify1.nInvalidIPv6Opt) {
- System_printf ("%s: Stat classify1.nInvalidIPv6Opt expected %d, found %d\n", fname, expected->classify1.nInvalidIPv6Opt, actual->classify1.nInvalidIPv6Opt);
- retval = 1;
- }
-
- if (expected->classify1.nTxIpFrag != actual->classify1.nTxIpFrag) {
- System_printf ("%s: Stat classify1.nTxIpFrag expected %d, found %d\n", fname, expected->classify1.nTxIpFrag, actual->classify1.nTxIpFrag);
- retval = 1;
- }
-
- if (expected->classify1.nSilentDiscard != actual->classify1.nSilentDiscard) {
- System_printf ("%s: Stat classify1.nSilentDiscard expected %d, found %d\n", fname, expected->classify1.nSilentDiscard, actual->classify1.nSilentDiscard);
- retval = 1;
- }
-
- if (expected->classify1.nInvalidControl != actual->classify1.nInvalidControl) {
- System_printf ("%s: Stat classify1.nInvalidControl expected %d, found %d\n", fname, expected->classify1.nInvalidControl, actual->classify1.nInvalidControl);
- retval = 1;
- }
-
- if (expected->classify1.nInvalidState != actual->classify1.nInvalidState) {
- System_printf ("%s: Stat classify1.nInvalidState expected %d, found %d\n", fname, expected->classify1.nInvalidState, actual->classify1.nInvalidState);
- retval = 1;
- }
-
- if (expected->classify1.nSystemFail != actual->classify1.nSystemFail) {
- System_printf ("%s: Stat classify1.nSystemFail expected %d, found %d\n", fname, expected->classify1.nSystemFail, actual->classify1.nSystemFail);
- retval = 1;
- }
-
- System_flush ();
-
-
-
- if (expected->classify2.nPackets != actual->classify2.nPackets) {
- System_printf ("%s: Stat classify2.nPackets expected %d, found %d\n", fname, expected->classify2.nPackets, actual->classify2.nPackets);
- retval = 1;
- }
-
- if (expected->classify2.nUdp != actual->classify2.nUdp) {
- System_printf ("%s: Stat classify2.nUdp expected %d, found %d\n", fname, expected->classify2.nUdp, actual->classify2.nUdp);
- retval = 1;
- }
-
- if (expected->classify2.nTcp != actual->classify2.nTcp) {
- System_printf ("%s: Stat classify2.nTcp expected %d, found %d\n", fname, expected->classify2.nTcp, actual->classify2.nTcp);
- retval = 1;
- }
-
- if (expected->classify2.nCustom != actual->classify2.nCustom) {
- System_printf ("%s: Stat classify2.nCustom expected %d, found %d\n", fname, expected->classify2.nCustom, actual->classify2.nCustom);
- retval = 1;
- }
-
- if (expected->classify2.nSilentDiscard != actual->classify2.nSilentDiscard) {
- System_printf ("%s: Stat classify2.nSilentDiscard expected %d, found %d\n", fname, expected->classify2.nSilentDiscard, actual->classify2.nSilentDiscard);
- retval = 1;
- }
-
- if (expected->classify2.nInvalidControl != actual->classify2.nInvalidControl) {
- System_printf ("%s: Stat classify2.nInvalidControl expected %d, found %d\n", fname, expected->classify2.nInvalidControl, actual->classify2.nInvalidControl);
- retval = 1;
- }
-
- if (expected->modify.nCommandFail != actual->modify.nCommandFail) {
- System_printf ("%s: Stat modify.nCommandFail expected %d, found %d\n", fname, expected->modify.nCommandFail, actual->modify.nCommandFail);
- retval = 1;
- }
-
- System_flush ();
- return (retval);
-}
-
-/* Request User stats from the PA */
-int32_t testCommonRequestUsrStats (char *fname, tFramework_t *tf, Bool reset, int32_t QSource, int32_t QRecycle, paCmdReply_t *reply, paUsrStats_t *usrStats)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- paReturn_t paret;
- uint16_t cmdSize;
- int32_t cmdDest;
- uint32_t pktcmd = PASAHO_PACFG_CMD;
- volatile int32_t mdebugWait = 0;
-
- /* Pop a descriptor with an associated buffer to use for the command request */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QSource)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop descriptor from queue %d\n", fname, __FILE__, __LINE__, QSource);
- return (-1);
- }
-
- /* Make sure there is a buffer attached and get the size */
- if (hd->buffPtr == (uint32_t)NULL) {
- System_printf ("%s (%s:%d): Descriptor from queue %d had no associated buffer\n", fname, __FILE__, __LINE__, QSource);
- return (-1);
- }
- cmdSize = hd->origBufferLen;
-
- paret = Pa_requestUsrStats (tf->passHandle, reset, (paCmd_t)hd->buffPtr, &cmdSize, reply, &cmdDest, usrStats);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): Pa_requestUsrStats returned error code %d\n", fname, __FILE__, __LINE__, paret);
- Qmss_queuePushDesc (QSource, (Ptr)hd);
- return (-1);
- }
-
- if (cmdSize)
- {
- /* Set the packet length and the buffer length. The buffer length MUST NOT
- * exceed the packet length */
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, cmdSize);
- hd->buffLen = cmdSize;
-
- /* Mark the packet as a configuration packet and setup for the descriptor return */
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&pktcmd, 4);
-
- q.qMgr = 0;
- q.qNum = QRecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- }
- else
- {
-
- /* Recycle the descriptor and associated buffer back to queue from which it came */
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats response\n", fname, __FILE__, __LINE__);
- return (-1);
- }
-
- }
- return (0);
-
-}
-
-/* Compare stats and report any differences */
-int32_t testCommonCompareUsrStats (char *fname, paUsrStats_t *expected, paUsrStats_t *actual)
-{
- int32_t retval = 0;
- int32_t i;
-
- for (i = 0; i < pa_USR_STATS_MAX_64B_COUNTERS; i++)
- {
- if (expected->count64[i] != actual->count64[i]) {
- System_printf ("%s: Usr Stat count64[%d] expected %d, found %d\n", fname, i, expected->count64[i], actual->count64[i]);
- retval = 1;
- }
- }
-
- for (i = 0; i < pa_USR_STATS_MAX_32B_COUNTERS; i++)
- {
- if (expected->count32[i] != actual->count32[i]) {
- System_printf ("%s: Usr Stat count32[%d] expected %d, found %d\n", fname, i, expected->count32[i], actual->count32[i]);
- retval = 1;
- }
- }
-
- System_flush ();
- return (retval);
-}
-
-
-/* Compare long packet information */
-int32_t testCommonComparePktInfo (Char *tfName, pasahoLongInfo_t *expected, pasahoLongInfo_t *actual)
-{
- int32_t retval = 0;
- Bool fCustom = PASAHO_LINFO_READ_HDR_BITMASK(expected) & PASAHO_HDR_BITMASK_CUSTOM;
-
- if (PASAHO_LINFO_READ_START_OFFSET(expected) != PASAHO_LINFO_READ_START_OFFSET(actual)) {
- System_printf ("%s (%s:%d): expected start offset = %d, found %d\n", tfName, __FILE__, __LINE__, PASAHO_LINFO_READ_START_OFFSET(expected), PASAHO_LINFO_READ_START_OFFSET(actual));
- retval = 1;
- }
-
- if ((PASAHO_LINFO_READ_END_OFFSET(expected)) &&
- (PASAHO_LINFO_READ_END_OFFSET(expected) != PASAHO_LINFO_READ_END_OFFSET(actual))) {
- System_printf ("%s (%s:%d): expected end offset = %d, found %d\n", tfName, __FILE__, __LINE__, PASAHO_LINFO_READ_END_OFFSET(expected), PASAHO_LINFO_READ_END_OFFSET(actual));
- retval = 1;
- }
-
- if (!fCustom && (PASAHO_LINFO_READ_EIDX(expected) != PASAHO_LINFO_READ_EIDX(actual))) {
- System_printf ("%s (%s:%d): expected error index = %d, found %d\n", tfName, __FILE__, __LINE__, PASAHO_LINFO_READ_EIDX(expected), PASAHO_LINFO_READ_EIDX(actual));
- retval = 1;
- }
-
- if (PASAHO_LINFO_READ_PMATCH(expected) != PASAHO_LINFO_READ_PMATCH(actual)) {
- System_printf ("%s (%s:%d): expected pmatch = %d, found %d\n", tfName, __FILE__, __LINE__, PASAHO_LINFO_READ_PMATCH(expected), PASAHO_LINFO_READ_PMATCH(actual));
- retval = 1;
- }
-
- if (PASAHO_LINFO_READ_HDR_BITMASK(expected) != PASAHO_LINFO_READ_HDR_BITMASK(actual)) {
- System_printf ("%s (%s:%d): expected header bitmask = 0x%04x, found 0x%04x\n", tfName, __FILE__, __LINE__, PASAHO_LINFO_READ_HDR_BITMASK(expected), PASAHO_LINFO_READ_HDR_BITMASK(actual));
- retval = 1;
- }
-
- if ((PASAHO_LINFO_READ_HDR_BITMASK2(expected)) &&
- (PASAHO_LINFO_READ_HDR_BITMASK2(expected) != PASAHO_LINFO_READ_HDR_BITMASK2(actual))) {
- System_printf ("%s (%s:%d): expected header bitmask = 0x%012x, found 0x%012x\n", tfName, __FILE__, __LINE__, PASAHO_LINFO_READ_HDR_BITMASK(expected), PASAHO_LINFO_READ_HDR_BITMASK(actual));
- retval = 1;
- }
-
- if (PASAHO_LINFO_READ_VLAN_COUNT(expected) != PASAHO_LINFO_READ_VLAN_COUNT(actual)) {
- System_printf ("%s (%s:%d): expected vlan count = %d, found %d\n", tfName, __FILE__, __LINE__, PASAHO_LINFO_READ_VLAN_COUNT(expected), PASAHO_LINFO_READ_VLAN_COUNT(actual));
- retval = 1;
- }
-
- if (PASAHO_LINFO_READ_IP_COUNT(expected) != PASAHO_LINFO_READ_IP_COUNT(actual)) {
- System_printf ("%s (%s:%d): expected IP count = %d, found %d\n", tfName, __FILE__, __LINE__, PASAHO_LINFO_READ_IP_COUNT(expected), PASAHO_LINFO_READ_IP_COUNT(actual));
- retval = 1;
- }
-
- if (PASAHO_LINFO_READ_GRE_COUNT(expected) != PASAHO_LINFO_READ_GRE_COUNT(actual)) {
- System_printf ("%s (%s:%d): expected GRE count = %d, found %d\n", tfName, __FILE__, __LINE__, PASAHO_LINFO_READ_GRE_COUNT(expected), PASAHO_LINFO_READ_GRE_COUNT(actual));
- retval = 1;
- }
-
- System_flush ();
-
- return (retval);
-}
-
-/* Increment expected stats based on an input bit map */
-void testCommonIncStats (paStatsBmap_t *map, paSysStats_t *stats)
-{
- int32_t i;
-
- /* There are always three maps in the map list because stats can be incremented up to 3 times */
- for (i = 0; i < 3; i++) {
-
- if (map[i] & (1 << TF_STATS_BM_C1_NUM_PACKETS))
- stats->classify1.nPackets += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C1_TABLE_MATCH))
- stats->classify1.nTableMatch += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C1_NO_TABLE_MATCH))
- stats->classify1.nNoTableMatch += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C1_IP_FRAG))
- stats->classify1.nIpFrag += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C1_TX_IP_FRAG))
- stats->classify1.nTxIpFrag += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C1_VLAN_OVERFLOW))
- stats->classify1.nVlanDepthOverflow += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C1_NUM_MPLS))
- stats->classify1.nMplsPackets += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C1_PARSE_FAIL))
- stats->classify1.nParseFail += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C1_SILENT_DISCARD))
- stats->classify1.nSilentDiscard += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C1_NUM_IPV4))
- stats->classify1.nIpv4Packets += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C1_NUM_IPV6))
- stats->classify1.nIpv6Packets += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C1_NUM_CUSTOM))
- stats->classify1.nCustomPackets += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C1_NUM_SRIO))
- stats->classify1.nSrioPackets += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C2_NUM_PACKETS))
- stats->classify2.nPackets += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C2_NUM_UDP))
- stats->classify2.nUdp += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C2_NUM_TCP))
- stats->classify2.nTcp += 1;
-
- if (map[i] & (1 << TF_STATS_BM_C2_NUM_CUSTOM))
- stats->classify2.nCustom += 1;
-
- }
-
-}
-
-
-/* Reset a buffer descriptor with linked buffer and place on the correct free buffer with
- * descriptor queue */
-int32_t testCommonRecycleLBDesc (tFramework_t *tf, Cppi_HostDesc *hd)
-{
- Qmss_Queue q;
-
- hd->buffLen = hd->origBufferLen;
- hd->buffPtr = hd->origBuffPtr;
- hd->nextBDPtr = 0;
-
- q.qMgr = 0;
- q.qNum = tf->QDefRet;
-
- if (hd->buffLen == TF_LINKED_BUF_Q1_BUF_SIZE) {
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
- Qmss_queuePush (tf->QLinkedBuf1, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- } else if (hd->buffLen == TF_LINKED_BUF_Q2_BUF_SIZE) {
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
- Qmss_queuePush (tf->QLinkedBuf2, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- } else if (hd->buffLen == TF_LINKED_BUF_Q3_BUF_SIZE) {
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
- Qmss_queuePush (tf->QLinkedBuf3, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- } else
- return (-1);
-
- return (0);
-}
-
-/* Provide an add srio configuration to the PA sub-system */
-Cppi_HostDesc *testCommonAddSrio (tFramework_t *tf, int index, paSrioInfo_t *srioInfo, uint16_t nextHdr, uint16_t nextHdrOffset,
- paRouteInfo_t *matchRoute, paRouteInfo_t *nfailRoute, paHandleL2L3_t *l2handle, int32_t Qrecycle, int32_t QCmdMem,
- paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_addSrio (tf->passHandle,
- index,
- srioInfo,
- nextHdr,
- nextHdrOffset,
- matchRoute,
- nfailRoute,
- l2handle,
- (paCmd_t) hd->buffPtr,
- cmdSize,
- repInfo,
- cmdDest);
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-
-/* Provide an add mac configuration to the PA sub-system */
-Cppi_HostDesc *testCommonAddMac (tFramework_t *tf, int index, paEthInfo_t *ethInfo, paRouteInfo_t *matchRoute, paRouteInfo_t *nfailRoute,
- paHandleL2L3_t *l2handle, int32_t Qrecycle, int32_t QCmdMem,
- paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_addMac (tf->passHandle,
- index,
- ethInfo,
- matchRoute,
- nfailRoute,
- l2handle,
- (paCmd_t) hd->buffPtr,
- cmdSize,
- repInfo,
- cmdDest);
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-Cppi_HostDesc *testCommonAddIp (tFramework_t *tf, int32_t index, paIpInfo_t *ipInfo, paRouteInfo_t *matchRoute, paRouteInfo_t *nfailRoute,
- paHandleL2L3_t *l3handle, paHandleL2L3_t linkedL2Handle, int32_t Qrecycle, int32_t QCmdMem,
- paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_addIp (tf->passHandle,
- pa_LUT_INST_NOT_SPECIFIED,
- index,
- ipInfo,
- linkedL2Handle,
- matchRoute,
- nfailRoute,
- l3handle,
- (paCmd_t) hd->buffPtr,
- cmdSize,
- repInfo,
- cmdDest);
-
- /* Restore the descriptor and return it on PA failure */
- if ((*paret != pa_OK) && (*paret != pa_DUP_ENTRY)) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-Cppi_HostDesc *testCommonAddPort (tFramework_t *tf, int portSize, uint32_t destPort, paRouteInfo_t *matchRoute, paHandleL4_t *l4handle, paHandleL2L3_t *l3handle,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_addPort ( tf->passHandle, (uint16_t)portSize, destPort, *l3handle, FALSE, pa_PARAMS_NOT_SPECIFIED, matchRoute, *l4handle, (paCmd_t) hd->buffPtr, cmdSize, repInfo, cmdDest);
-
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-Cppi_HostDesc *testCommonAddPort2 (tFramework_t *tf, int portSize, uint32_t destPort, Uint16 fReplace, uint16_t divertQ, paRouteInfo_t *matchRoute, paHandleL4_t *l4handle, paHandleL2L3_t *l3handle,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_addPort ( tf->passHandle, (uint16_t)portSize, destPort, *l3handle, fReplace, divertQ, matchRoute, *l4handle, (paCmd_t) hd->buffPtr, cmdSize, repInfo, cmdDest);
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-
-Cppi_HostDesc *testCommonAddCustomL3 (tFramework_t *tf, uint16_t customIndex, uint8_t match[], paRouteInfo_t *matchRoute, paRouteInfo_t *nfailRoute,
- paHandleL2L3_t *l3handle, paHandleL2L3_t linkedL2Handle,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_addCustomLUT1 (tf->passHandle, customIndex, pa_LUT_INST_NOT_SPECIFIED, pa_LUT1_INDEX_NOT_SPECIFIED, match, linkedL2Handle, matchRoute, nfailRoute,
- l3handle, (paCmd_t) hd->buffPtr, cmdSize, repInfo, cmdDest);
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-Cppi_HostDesc *testCommonAddCl3Config (tFramework_t *tf, uint16_t customIndex, uint16_t offset, uint16_t nextHdr, uint16_t nextHdrOffset, uint8_t masks[],
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_setCustomLUT1 (tf->passHandle, customIndex, offset, nextHdr, nextHdrOffset, masks, (paCmd_t) hd->buffPtr, cmdSize, repInfo, cmdDest);
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-
-Cppi_HostDesc *testCommonAddCustomL4 (tFramework_t *tf, uint16_t customIndex, uint8_t match[], paRouteInfo_t *matchRoute, paHandleL4_t l4handle, paHandleL2L3_t l3handle,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_addCustomLUT2 (tf->passHandle, customIndex, match, l3handle, FALSE, pa_PARAMS_NOT_SPECIFIED, matchRoute, l4handle, (paCmd_t) hd->buffPtr, cmdSize, repInfo, cmdDest);
-
-
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-Cppi_HostDesc *testCommonAddCl4Config (tFramework_t *tf, Bool handleLink, uint16_t customIndex, uint16_t offsets[], uint8_t masks[],
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_setCustomLUT2 (tf->passHandle, customIndex, handleLink, offsets, masks, 0, (paCmd_t) hd->buffPtr, cmdSize, repInfo, cmdDest);
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-/* Provide an Multi-route configuration to the PA sub-system */
-Cppi_HostDesc *testCommonConfigMultiRoute (tFramework_t *tf, paMultiRouteModes_e mode, uint16_t index, uint16_t nRoute, paMultiRouteEntry_t *routeEntry,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_configMultiRoute (tf->passHandle,
- mode,
- index,
- nRoute,
- routeEntry,
- (paCmd_t) hd->buffPtr,
- cmdSize,
- repInfo,
- cmdDest);
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-/* Provide an Exception Route configuration to the PA sub-system */
-Cppi_HostDesc *testCommonConfigExceptionRoute (tFramework_t *tf, int nRoute, int *routeTypes, paRouteInfo_t *eRoutes,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_configExceptionRoute (tf->passHandle,
- nRoute,
- routeTypes,
- eRoutes,
- (paCmd_t) hd->buffPtr,
- cmdSize,
- repInfo,
- cmdDest);
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-/* Provide a Cmd Set configuration to the PA sub-system */
-Cppi_HostDesc *testCommonConfigCmdSet (tFramework_t *tf, uint16_t index, int nCmd, paCmdInfo_t *cmdInfo,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_configCmdSet (tf->passHandle,
- index,
- nCmd,
- cmdInfo,
- (paCmd_t) hd->buffPtr,
- cmdSize,
- repInfo,
- cmdDest);
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-/* Provide a Usr Stats configuration to the PA subsystem */
-Cppi_HostDesc *testCommonConfigUsrStats (tFramework_t *tf, paUsrStatsConfigInfo_t *cfgInfo,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- *paret = pa_OK;
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- {
- return (NULL);
- }
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_configUsrStats (tf->passHandle,
- cfgInfo,
- (paCmd_t) hd->buffPtr,
- cmdSize,
- repInfo,
- cmdDest);
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-
-
-
-/* Provide a CRC Engine configuration to the PA sub-system */
-Cppi_HostDesc *testCommonConfigCrcEngine (tFramework_t *tf, uint16_t index, paCrcConfig_t *cfgInfo,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_configCrcEngine (tf->passHandle,
- index,
- cfgInfo,
- (paCmd_t) hd->buffPtr,
- cmdSize,
- repInfo,
- cmdDest);
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-/* Provide a Global configuration to the PA sub-system */
-Cppi_HostDesc *testCommonGlobalConfig (tFramework_t *tf, paCtrlInfo_t *cfgInfo,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_control (tf->passHandle,
- cfgInfo,
- (paCmd_t) hd->buffPtr,
- cmdSize,
- repInfo,
- cmdDest);
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-
-Cppi_HostDesc *testCommonDelHandle (tFramework_t *tf, paHandleL2L3_t *paHdl, int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *cmdReply,
- int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_delHandle (tf->passHandle, paHdl, (paCmd_t)hd->buffPtr, cmdSize, cmdReply, cmdDest);
-
- /* Restore the descriptor and return it on PA failure */
- if (*paret != pa_OK) {
- hd->buffLen = hd->origBufferLen;
- Qmss_queuePush (QCmdMem, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- return (NULL);
- }
-
-#ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-Cppi_HostDesc *testCommonDelL4Handles (tFramework_t *tf, paHandleL4_t l4Handle, int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *reply,
- int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- uint32_t psCmd;
-
- /* Pop a descriptor with a linked buffer to create the command */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (QCmdMem)) & ~15);
- if (hd == NULL)
- return (NULL);
-
- *cmdSize = hd->origBufferLen;
-
- *paret = Pa_delL4Handle (tf->passHandle, l4Handle, (paCmd_t)hd->buffPtr, cmdSize, reply, cmdDest);
-
- #ifdef PA_SIM_BUG_4BYTES
- *cmdSize = (*cmdSize+3)& ~3;
-#endif
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = Qrecycle;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Mark the packet as a configuration packet */
- psCmd = PASAHO_PACFG_CMD;
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)&psCmd, 4);
-
- hd->buffLen = *cmdSize;
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, *cmdSize);
-
- return (hd);
-}
-
-
-uint16_t testCommonOnesCompAdd (uint16_t v1, uint16_t v2)
-{
- uint32_t v3;
- v3 = v1 + v2;
- v3 = (v3 & 0xffff) + (v3 >> 16);
- v3 = (v3 & 0xffff) + (v3 >> 16);
- return ((uint16_t)v3);
-}
-
-
-
-int32_t testCommonWaitCmdReply (tFramework_t *tf, paTest_t *pat, char *tname, int32_t Qcmd, uint32_t swinfo0, int32_t line)
-{
- Cppi_HostDesc *hd;
- uint32_t *swinfo;
- paEntryHandle_t reth;
- paReturn_t paret;
- int32_t htype;
- int32_t cmdDest;
- int32_t i;
-
- for (i = 0; i < 100; i++) {
- if (Qmss_getQueueEntryCount(Qcmd) > 0) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (Qcmd)) & ~15);
-
- Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **)&swinfo);
-
- if (swinfo[0] != swinfo0) {
- System_printf ("%s (%s:%d): found packet in command reply queue with swifo[0] = 0x%08x (expected 0x%08x)\n", tname, __FILE__, line, swinfo[0], swinfo0);
- testCommonRecycleLBDesc (tf, hd);
- continue;
- }
-
- paret = Pa_forwardResult (tf->passHandle, (void *)hd->buffPtr, &reth, &htype, &cmdDest);
- if (paret != pa_OK)
- System_printf ("%s (%s:%d): Pa_forwardResult returned error %d\n", tname, __FILE__, line, paret);
-
- testCommonRecycleLBDesc (tf, hd);
-
- return (0);
-
- } else {
-
- utilCycleDelay (500);
-
- }
- }
-
- return (-1);
-
-}
-
-static paUsrStats_t pauUsrStats;
-
-/* Request the stats, compare to expected value */
-paTestStatus_t testCommonCheckUsrStats (tFramework_t *tf, paTest_t *pat, char *tName, paUsrStats_t *expected, int32_t qSource, int32_t qCmdRecycle, int32_t qReply, Bool clear)
-{
- Cppi_HostDesc *hd;
- paUsrStats_t *usrStats = &pauUsrStats;
- Int i;
- paTestStatus_t status;
-
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
- cmdReply.queue = (uint16_t) qReply;
-
- memset(usrStats, 0, sizeof(paUsrStats_t));
-
- /* Check the PA stats to make sure they are set as expected */
- cmdReply.replyId = TEST_COMMON_STATS_REQ_ID;
- if (testCommonRequestUsrStats (tName, tf, clear, qSource, qCmdRecycle, &cmdReply, usrStats)) {
- System_printf ("%s (%s:%d): testCommonRequestPaStats failed\n", tName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- if (clear)
- {
- /* Wait for the stats reply */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (1000);
- if (Qmss_getQueueEntryCount (qReply) > 0)
- break;
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Did not find response from PA to stats request command\n", tName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- /* Recycle the descriptor/buffer returned from the stats request */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (qCmdRecycle)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find returned descriptor/buffer from stats request\n", tName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats request\n", tName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- /* Format the stats response and compare to the expected results */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (qReply)) & ~15);
-
- /* Recycle the descriptor and associated buffer back to queue from which it came */
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats response\n", tName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
- }
-
- if (testCommonCompareUsrStats (tName, expected, usrStats))
- status = PA_TEST_FAILED;
- else
- status = PA_TEST_PASSED;
-
- if (clear)
- memset (expected, 0, sizeof(paUsrStats_t));
-
- return (status);
-}
-
-
-
-/* Request the stats, compare to expected value */
-paTestStatus_t testCommonCheckStats (tFramework_t *tf, paTest_t *pat, char *tName, paSysStats_t *expected, int32_t qSource, int32_t qCmdRecycle, int32_t qReply, Bool clear)
-{
- Cppi_HostDesc *hd;
- uint8_t *bp;
- paSysStats_t *paStats;
- uint32_t blen;
- int32_t i;
- paTestStatus_t status;
-
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
- cmdReply.queue = (uint16_t) qReply;
-
-
- /* Check the PA stats to make sure they are set as expected */
- cmdReply.replyId = TEST_COMMON_STATS_REQ_ID;
- if (testCommonRequestPaStats (tName, tf, clear, qSource, qCmdRecycle, &cmdReply)) {
- System_printf ("%s (%s:%d): testCommonRequestPaStats failed\n", tName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- /* Wait for the stats reply */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (1000);
- if (Qmss_getQueueEntryCount (qReply) > 0)
- break;
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Did not find response from PA to stats request command\n", tName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- /* Recycle the descriptor/buffer returned from the stats request */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (qCmdRecycle)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find returned descriptor/buffer from stats request\n", tName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats request\n", tName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
-
- /* Format the stats response and compare to the expected results */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (qReply)) & ~15);
- Cppi_getData (Cppi_DescType_HOST, (Cppi_Desc *)hd, &bp, &blen);
- paStats = Pa_formatStatsReply (tf->passHandle, (paCmd_t)bp);
-
- if (testCommonCompareStats (tName, expected, paStats))
- status = PA_TEST_FAILED;
- else
- status = PA_TEST_PASSED;
-
- if (clear)
- memset (expected, 0, sizeof(paSysStats_t));
-
- /* Recycle the descriptor and associated buffer back to queue from which it came */
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats response\n", tName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- return (status);
-}
-
-int32_t commonFifoPushElement (pauFifo_t *fifo, uint32_t elem)
-{
- int32_t nextIn;
-
- nextIn = fifo->inIdx + 1;
- if (nextIn >= fifo->size)
- nextIn = 0;
-
- /* Check if the fifo is full */
- if (nextIn == fifo->outIdx)
- return (-1);
-
- /* Add the element */
- fifo->data[fifo->inIdx] = elem;
- fifo->inIdx = nextIn;
-
- return (0);
-}
-
-int32_t commonFifoGetCount (pauFifo_t *fifo)
-{
- if (fifo->inIdx >= fifo->outIdx)
- return (fifo->inIdx - fifo->outIdx);
- else
- return (fifo->size + fifo->inIdx - fifo->outIdx);
-}
-
-uint32_t commonFifoPopElement (pauFifo_t *fifo, int32_t *numInQBeforePop)
-{
- uint32_t v;
-
- *numInQBeforePop = commonFifoGetCount (fifo);
- if (*numInQBeforePop == 0)
- return (0);
-
- v = fifo->data[fifo->outIdx];
- fifo->outIdx = fifo->outIdx + 1;
- if (fifo->outIdx >= fifo->size)
- fifo->outIdx = 0;
-
- return (v);
-}
-
-
-int32_t testCommonVerifyCmdResult (tFramework_t *tf, paSysStats_t *stats, char *tfName, char *fname, int32_t fline, char *tid, Cppi_HostDesc *hd,
- paReturn_t exp, paReturn_t act, pauTestSetupStatus_t *status, int32_t cmdDest, int32_t cmdSize)
-{
-
- if (act != exp) {
- System_printf ("%s (%s:%d - from %s:%d): %s returned %d, expected %d\n", tfName, __FILE__, __LINE__, fname, fline, tid,
- act, exp);
-
- if (hd != NULL) {
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d - from %s:%d): Failed to find original free buffer Q for stats request\n", tfName,
- __FILE__, __LINE__, fname, fline);
- }
- }
-
- /* Don't change the status of the entry */
- return (-1);
-
- } else {
-
- if (act == pa_OK) {
- if (hd == NULL) {
- System_printf ("%s (%s:%d - from %s:%d): %s returned OK but no buffer descriptor found\n",
- tfName, __FILE__, __LINE__, fname, fline), tid;
- return (-1);
- }
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- *status = PAU_TEST_SETUP_STATUS_CMD_SENT;
- if ((cmdDest == pa_CMD_TX_DEST_0) || (cmdDest == pa_CMD_TX_DEST_1) || (cmdDest == pa_CMD_TX_DEST_2))
- stats->classify1.nPackets += 1;
- if ((cmdDest == pa_CMD_TX_DEST_3))
- stats->classify2.nPackets += 1;
- return (0);
-
- } else {
-
- /* The descriptor was already returned if the pa result code was not OK */
- *status = PAU_TEST_SETUP_STATUS_CMD_NO_CMD; /* Command is complete */
-
- return (0);
- }
- }
-
-}
-
-
-
-int32_t testCommonMacSetup (tFramework_t *tf, paSysStats_t *stats, pauTestMacSetup_t *maci, paCmdReply_t *rep, char *tfName, char *fname, int32_t fline, int32_t idx)
-{
- Cppi_HostDesc *hd;
- int32_t cmdDest;
- uint16_t cmdSize;
- paReturn_t paret;
-
- /* Set the reply ID to indicate the type and index of the setup */
- rep->replyId = TF_COMMON_CMD_ID_ADD_MAC + idx;
-
- hd = testCommonAddMac (tf, pa_LUT1_INDEX_NOT_SPECIFIED, &maci->ethInfo, &maci->matchRoute, &maci->nFail, &maci->handle,
- maci->bufferQ, maci->bufferQ, rep, &cmdDest, &cmdSize, &paret);
-
- return (testCommonVerifyCmdResult (tf, stats, tfName, fname, fline, "Pa_addMac", hd, maci->paret, paret, &maci->status, cmdDest, cmdSize));
-}
-
-
-
-int32_t testCommonIpSetup (tFramework_t *tf, paSysStats_t *stats, pauTestIpSetup_t *ipi, paCmdReply_t *rep, char *tfName, char *fname, int32_t fline, int32_t idx)
-{
- Cppi_HostDesc *hd;
- int32_t cmdDest;
- uint16_t cmdSize;
- paReturn_t paret;
- paHandleL2L3_t linkHandle = NULL;
-
- /* Set the reply ID to indicate the type and index of the reply */
- rep->replyId = TF_COMMON_CMD_ID_ADD_IP + idx;
-
-
- /* Verify a valid previous link */
- if ((ipi->l2Link != NULL) && (ipi->l3Link == NULL)) {
- if (ipi->l2Link->status != PAU_TEST_SETUP_STATUS_CMD_REPLIED) {
- System_printf ("%s: (%s:%d - from %s:%d): IP linked to L2 handle that is not in CMD_REPLIED state\n",
- tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
- linkHandle = ipi->l2Link->handle;
-
- } else if ((ipi->l2Link == NULL) && (ipi->l3Link != NULL)) {
- if (ipi->l3Link->status != PAU_TEST_SETUP_STATUS_CMD_REPLIED) {
- System_printf ("%s: (%s:%d - from %s:%d): IP linked to L3 handle that is not in CMD_REPLIED state\n",
- tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
- linkHandle = ipi->l3Link->handle;
-
- } else if ((ipi->l2Link != NULL) && (ipi->l3Link != NULL)) {
- System_printf ("%s: (%s:%d - from %s:%d): Invalid IP configuration - both L2 and L3 links specified\n",
- tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
-
- hd = testCommonAddIp (tf, pa_LUT1_INDEX_NOT_SPECIFIED, &ipi->ipInfo, &ipi->matchRoute, &ipi->nFail, &ipi->handle, linkHandle, ipi->bufferQ,
- ipi->bufferQ, rep, &cmdDest, &cmdSize, &paret);
-
- return (testCommonVerifyCmdResult (tf, stats, tfName, fname, fline, "Pa_addIp", hd, ipi->paret, paret, &ipi->status, cmdDest, cmdSize));
-
-}
-
-
-int32_t testCommonL4Setup (tFramework_t *tf, paSysStats_t *stats, pauTestL4Setup_t *l4i, paCmdReply_t *rep, char *tfName, char *fname, int32_t fline, int32_t idx)
-{
- Cppi_HostDesc *hd;
- int32_t cmdDest;
- uint16_t cmdSize;
- paReturn_t paret;
- paHandleL2L3_t linkHandle = NULL;
-
- /* Set the reply ID to indicate the type and index of the reply */
- rep->replyId = TF_COMMON_CMD_ID_ADD_PORT + idx;
-
- /* Verify that the linked handle is valid */
- if (l4i->l3Link != NULL) {
- if (l4i->l3Link->status != PAU_TEST_SETUP_STATUS_CMD_REPLIED) {
- System_printf ("%s: (%s:%d - from %s:%d): IP linked to UDP handle that is not in CMD_REPLIED state\n",
- tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
- linkHandle = l4i->l3Link->handle;
- }
-
- hd = testCommonAddPort (tf, pa_LUT2_PORT_SIZE_16, (uint32_t)l4i->destPort, &l4i->matchRoute, &l4i->handle, &linkHandle, l4i->bufferQ, l4i->bufferQ,
- rep, &cmdDest, &cmdSize, &paret);
-
- return (testCommonVerifyCmdResult (tf, stats, tfName, fname, fline, "Pa_addPort", hd, l4i->paret, paret, &l4i->status, cmdDest, cmdSize));
-
-
-}
-
-int32_t testCommonCl3Config (tFramework_t *tf, paSysStats_t *stats, pauTestCl3Config_t *l3cfg, paCmdReply_t *rep, char *tfName, char *fname, int32_t fline, int32_t idx)
-{
- Cppi_HostDesc *hd;
- int32_t cmdDest;
- uint16_t cmdSize;
- paReturn_t paret;
-
- rep->replyId = TF_COMMON_CMD_ID_CFG_CL3 + idx;
-
-
- hd = testCommonAddCl3Config (tf, l3cfg->custIndex, l3cfg->offset, l3cfg->nextHdr, l3cfg->nextHdrOffset, l3cfg->byteMasks, l3cfg->bufferQ,
- l3cfg->bufferQ, rep, &cmdDest, &cmdSize, &paret);
-
- return (testCommonVerifyCmdResult (tf, stats, tfName, fname, fline, "Pa_setCustomLUT1", hd, l3cfg->paret, paret, &l3cfg->status, cmdDest, cmdSize));
-
-}
-
-int32_t testCommonCl3Setup (tFramework_t *tf, paSysStats_t *stats, pauTestCl3Setup_t *l3s, paCmdReply_t *rep, char *tfName, char *fname, int32_t fline, int32_t idx)
-{
- Cppi_HostDesc *hd;
- int32_t cmdDest;
- uint16_t cmdSize;
- paReturn_t paret;
- paHandleL2L3_t linkHandle = NULL;
-
- rep->replyId = TF_COMMON_CMD_ID_ADD_CL3 + idx;
-
- /* Verify that the linked handle is valid */
- /* Verify a valid previous link */
- if ((l3s->l2Link != NULL) && (l3s->l3Link == NULL)) {
- if (l3s->l2Link->status != PAU_TEST_SETUP_STATUS_CMD_REPLIED) {
- System_printf ("%s: (%s:%d - from %s:%d): IP linked to L2 handle that is not in CMD_REPLIED state\n",
- tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
- linkHandle = l3s->l2Link->handle;
-
- } else if ((l3s->l2Link == NULL) && (l3s->l3Link != NULL)) {
- if (l3s->l3Link->status != PAU_TEST_SETUP_STATUS_CMD_REPLIED) {
- System_printf ("%s: (%s:%d - from %s:%d): IP linked to L3 handle that is not in CMD_REPLIED state\n",
- tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
- linkHandle = l3s->l3Link->handle;
-
- } else if ((l3s->l2Link != NULL) && (l3s->l3Link != NULL)) {
- System_printf ("%s: (%s:%d - from %s:%d): Invalid IP configuration - both L2 and L3 links specified\n",
- tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
- hd = testCommonAddCustomL3 (tf, l3s->custIndex, l3s->match, &l3s->matchRoute, &l3s->nFail, &l3s->handle, linkHandle, l3s->bufferQ, l3s->bufferQ, rep,
- &cmdDest, &cmdSize, &paret);
-
- return (testCommonVerifyCmdResult (tf, stats, tfName, fname, fline, "Pa_addCustomLUT1", hd, l3s->paret, paret, &l3s->status, cmdDest, cmdSize));
-
-}
-
-
-
-
-int32_t testCommonCl4Config (tFramework_t *tf, paSysStats_t *stats, pauTestCl4Config_t *l4cfg, paCmdReply_t *rep, char *tfName, char *fname, int32_t fline, int32_t idx)
-{
- Cppi_HostDesc *hd;
- int32_t cmdDest;
- uint16_t cmdSize;
- paReturn_t paret;
-
- rep->replyId = TF_COMMON_CMD_ID_CFG_CL4 + idx;
-
-
- hd = testCommonAddCl4Config (tf, l4cfg->handleLink, l4cfg->custIndex, l4cfg->byteOffsets, l4cfg->byteMasks, l4cfg->bufferQ,
- l4cfg->bufferQ, rep, &cmdDest, &cmdSize, &paret);
-
- return (testCommonVerifyCmdResult (tf, stats, tfName, fname, fline, "Pa_setCustomLUT2", hd, l4cfg->paret, paret, &l4cfg->status, cmdDest, cmdSize));
-
-}
-
-int32_t testCommonCl4Setup (tFramework_t *tf, paSysStats_t *stats, pauTestCl4Setup_t *l4s, paCmdReply_t *rep, char *tfName, char *fname, int32_t fline, int32_t idx)
-{
- Cppi_HostDesc *hd;
- int32_t cmdDest;
- uint16_t cmdSize;
- paReturn_t paret;
- paHandleL2L3_t linkHandle = NULL;
-
- rep->replyId = TF_COMMON_CMD_ID_ADD_CL4 + idx;
-
- /* Verify that the linked handle is valid */
- if (l4s->l3Link != NULL) {
- if (l4s->l3Link->status != PAU_TEST_SETUP_STATUS_CMD_REPLIED) {
- System_printf ("%s: (%s:%d - from %s:%d): IP linked to Custom L4 handle that is not in CMD_REPLIED state\n",
- tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
- linkHandle = l4s->l3Link->handle;
-
- }
-
- hd = testCommonAddCustomL4 (tf, l4s->custIndex, l4s->match, &l4s->matchRoute, l4s->handle, linkHandle, l4s->bufferQ, l4s->bufferQ, rep,
- &cmdDest, &cmdSize, &paret);
-
- return (testCommonVerifyCmdResult (tf, stats, tfName, fname, fline, "Pa_addCustomLUT2", hd, l4s->paret, paret, &l4s->status, cmdDest, cmdSize));
-
-}
-
-
-int32_t testCommonCmdSetSetup (tFramework_t *tf, paSysStats_t *stats, pauTestCmdSetSetup_t *cmdSet, paCmdReply_t *rep, char *tfName, char *fname, int32_t fline, int32_t idx)
-{
- Cppi_HostDesc *hd;
- int32_t cmdDest;
- uint16_t cmdSize;
- paReturn_t paret;
-
- rep->replyId = TF_COMMON_CMD_ID_ADD_CMDSET + idx;
-
- hd = testCommonConfigCmdSet(tf, cmdSet->index, cmdSet->nCmds, cmdSet->cmdInfo, cmdSet->bufferQ, cmdSet->bufferQ, rep,
- &cmdDest, &cmdSize, &paret);
-
- return (testCommonVerifyCmdResult (tf, stats, tfName, fname, fline, "Pa_configCmdSet", hd, cmdSet->paret, paret, &cmdSet->status, cmdDest, cmdSize));
-
-}
-
-int32_t testCommonCloseL4 (tFramework_t *tf, paSysStats_t *stats, paHandleL4_t handle, pauTestSetupStatus_t *status, paCmdReply_t *rep, int32_t Q, char *tfName, char *fname, int32_t fline)
-{
- Cppi_HostDesc *hd;
- int32_t cmdDest;
- uint16_t cmdSize;
- paReturn_t paret;
-
- hd = testCommonDelL4Handles (tf, handle, Q, Q, rep, &cmdDest, &cmdSize, &paret);
-
- if ((hd == NULL) || paret != pa_OK) {
- System_printf ("%s (%s:%d from %s:%d): close L4 handle failed, paret = %d\n", tfName, __FILE__, __LINE__, fname, fline, paret);
- return (-1);
- }
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- stats->classify2.nPackets += 1;
-
- return (0);
-}
-
-
-int32_t testCommonCloseL2L3 (tFramework_t *tf, paSysStats_t *stats, paHandleL2L3_t *handle, pauTestSetupStatus_t *status, paCmdReply_t *rep, int32_t Q, char *tfName, char *fname, int32_t fline)
-{
- Cppi_HostDesc *hd;
- int32_t cmdDest;
- uint16_t cmdSize;
- paReturn_t paret;
-
- hd = testCommonDelHandle (tf, handle, Q, Q, rep, &cmdDest, &cmdSize, &paret);
-
- if ((hd == NULL) || paret != pa_OK) {
- System_printf ("%s (%s:%d from %s:%d): close L2/L3 handle failed, paret = %d\n", tfName, __FILE__, __LINE__, fname, fline, paret);
- return (-1);
- }
-
- stats->classify1.nPackets += 1;
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- return (0);
-}
-
-
-
-
-
-/* Examine the reply queue and change command state */
-void testCommonCheckComplete (tFramework_t *tf, pauTestSetup_t *setup, char *tfName, char *fname, int32_t fline)
-{
- Cppi_HostDesc *hd;
- uint32_t *swinfo;
- uint32_t swinfoType;
- uint32_t swinfoChan;
- paReturn_t paret;
- paEntryHandle_t reth;
- int32_t htype;
- int32_t cmdDest;
-
- pauTestSetupStatus_t *status;
- int32_t maxChan;
- char *tid;
-
- while ((hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QCommonCmdRep)) & ~15)) != NULL) {
-
- Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **)&swinfo);
- swinfoType = swinfo[0] & 0xffff0000;
- swinfoChan = swinfo[0] & 0x0000ffff;
-
- switch (swinfoType) {
- case TF_COMMON_CMD_ID_ADD_MAC: status = &setup->macs[swinfoChan].status; maxChan = setup->nMac; tid = "Add Mac"; break;
- case TF_COMMON_CMD_ID_ADD_IP: status = &setup->ips[swinfoChan].status; maxChan = setup->nIps; tid = "Add Ip"; break;
- case TF_COMMON_CMD_ID_ADD_PORT: status = &setup->l4s[swinfoChan].status; maxChan = setup->nL4s; tid = "Add L4"; break;
- case TF_COMMON_CMD_ID_CFG_CL3: status = &setup->cl3cfgs[swinfoChan].status; maxChan = setup->nCl3Cfgs; tid = "CL3 config"; break;
- case TF_COMMON_CMD_ID_ADD_CL3: status = &setup->cl3s[swinfoChan].status; maxChan = setup->nCl3s; tid = "Add Cl3"; break;
- case TF_COMMON_CMD_ID_DEL_CL3: status = &setup->cl3s[swinfoChan].status; maxChan = setup->nCl3s; tid = "Del Cl3"; break;
- case TF_COMMON_CMD_ID_CFG_CL4: status = &setup->cl4cfgs[swinfoChan].status; maxChan = setup->nCl4Cfgs; tid = "CL4 config"; break;
- case TF_COMMON_CMD_ID_ADD_CL4: status = &setup->cl4s[swinfoChan].status; maxChan = setup->nCl4s; tid = "Add Cl4"; break;
- case TF_COMMON_CMD_ID_DEL_CL4: status = &setup->cl4s[swinfoChan].status; maxChan = setup->nCl4s; tid = "Del Cl4"; break;
- case TF_COMMON_CMD_ID_DEL_PORT: status = &setup->l4s[swinfoChan].status; maxChan = setup->nL4s; tid = "Del L4"; break;
- case TF_COMMON_CMD_ID_DEL_IP: status = &setup->ips[swinfoChan].status; maxChan = setup->nIps; tid = "Del Ip"; break;
- case TF_COMMON_CMD_ID_DEL_MAC: status = &setup->macs[swinfoChan].status; maxChan = setup->nMac; tid = "Del Mac"; break;
- case TF_COMMON_CMD_ID_ADD_CMDSET: status = &setup->cmdSet[swinfoChan].status; maxChan = setup->nCmdSets; tid = "AddCmd Set"; break;
-
- default:
- System_printf ("%s: (%s:%d - from %s:%d): Found descriptor in common command rep queue with unknown swinfo0 = 0x%08x\n",
- tfName, __FILE__, __LINE__, fname, fline, swinfo[0]);
- testCommonRecycleLBDesc (tf, hd);
- continue;
- }
-
- if (swinfoChan >= maxChan) {
- System_printf ("%s: (%s:%d - from %s:%d): Found channel %d in %s setup, but max value is %d\n",
- tfName, __FILE__, __LINE__, fname, fline, swinfoChan, tid, maxChan);
- testCommonRecycleLBDesc (tf, hd);
- continue;
- }
-
- *status = PAU_TEST_SETUP_STATUS_CMD_REPLIED;
-
- if (swinfoType != TF_COMMON_CMD_ID_CFG_CL4) {
- paret = Pa_forwardResult (tf->passHandle, (void *)hd->buffPtr, &reth, &htype, &cmdDest);
-
- if (paret != pa_OK) {
- System_printf ("%s: (%s:%d - from %s:%d): Pa_forwardResult returned error code %d\n",
- tfName, __FILE__, __LINE__, fname, fline, paret);
- *status = PAU_TEST_SETUP_STATUS_CMD_REP_ERR;
-
- }
- }
-
- testCommonRecycleLBDesc (tf, hd);
- }
-
-}
-
-
-
-/* Returns TRUE if all entries are complete */
-Bool testCommonWaitComplete (tFramework_t *tf, pauTestSetup_t *setup, char *tfName, char *fname, int32_t fline)
-{
- int i, j;
- Bool done;
-
- for (i = 0, done = FALSE; (i < 100) && (done == FALSE); i++) {
- done = TRUE;
-
- for (j = 0; (j < setup->nMac) && (done == TRUE); j++)
- if (setup->macs[j].status == PAU_TEST_SETUP_STATUS_CMD_SENT)
- done = FALSE;
-
- for (j = 0; (j < setup->nIps) && (done == TRUE); j++)
- if (setup->ips[j].status == PAU_TEST_SETUP_STATUS_CMD_SENT)
- done = FALSE;
-
- for (j = 0; (j < setup->nL4s) && (done == TRUE); j++)
- if (setup->l4s[j].status == PAU_TEST_SETUP_STATUS_CMD_SENT)
- done = FALSE;
-
- for (j = 0; (j < setup->nCl3Cfgs) && (done == TRUE); j++)
- if (setup->cl3cfgs[j].status == PAU_TEST_SETUP_STATUS_CMD_SENT)
- done = FALSE;
-
- for (j = 0; (j < setup->nCl3s) && (done == TRUE); j++)
- if (setup->cl3s[j].status == PAU_TEST_SETUP_STATUS_CMD_SENT)
- done = FALSE;
-
- for (j = 0; (j < setup->nCl4Cfgs) && (done == TRUE); j++)
- if (setup->cl4cfgs[j].status == PAU_TEST_SETUP_STATUS_CMD_SENT)
- done = FALSE;
-
- for (j = 0; (j < setup->nCl4s) && (done == TRUE); j++)
- if (setup->cl4s[j].status == PAU_TEST_SETUP_STATUS_CMD_SENT)
- done = FALSE;
-
- if (done == FALSE)
- utilCycleDelay (100);
- else
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
- }
-
- return (done);
-}
-
-
-/* Wait for a specific command to complete */
-int32_t testCommonCheckWait (tFramework_t *tf, pauTestSetup_t *setup, char *tfName, char *fname, int32_t fline, pauTestSetupStatus_t *status)
-{
- int32_t i;
-
- for (i = 0; i < 100; i++) {
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
- if (*status != PAU_TEST_SETUP_STATUS_CMD_SENT)
- break;
- else
- utilCycleDelay (100);
- }
-
- if (i == 100)
- return (-1);
-
- return (0);
-
-}
-
-
-
-
-
-/* Setup PA for a test */
-int32_t testCommonSetupTest (tFramework_t *tf, paSysStats_t *stats, pauTestSetup_t *setup, char *tfName, char *fname, int32_t fline)
-{
- int32_t i;
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue, set by common setup */
- 0 }; /* Flow ID */
-
- cmdReply.queue = tf->QCommonCmdRep;
-
- /* Initialize the test state */
- for (i = 0; i < setup->nMac; i++)
- setup->macs[i].status = PAU_TEST_SETUP_STATUS_CMD_NOT_SENT;
-
- for (i = 0; i < setup->nIps; i++)
- setup->ips[i].status = PAU_TEST_SETUP_STATUS_CMD_NOT_SENT;
-
- for (i = 0; i < setup->nL4s; i++)
- setup->l4s[i].status = PAU_TEST_SETUP_STATUS_CMD_NOT_SENT;
-
- for (i = 0; i < setup->nCl3Cfgs; i++)
- setup->cl3cfgs[i].status = PAU_TEST_SETUP_STATUS_CMD_NOT_SENT;
-
- for (i = 0; i < setup->nCl3s; i++)
- setup->cl3s[i].status = PAU_TEST_SETUP_STATUS_CMD_NOT_SENT;
-
- for (i = 0; i < setup->nCl4Cfgs; i++)
- setup->cl4cfgs[i].status = PAU_TEST_SETUP_STATUS_CMD_NOT_SENT;
-
- for (i = 0; i < setup->nCl4s; i++)
- setup->cl4s[i].status = PAU_TEST_SETUP_STATUS_CMD_NOT_SENT;
-
- /* MAC setup */
- for (i = 0; i < setup->nMac; i++) {
- if (testCommonMacSetup (tf, stats, &(setup->macs[i]), &cmdReply, tfName, fname, fline, i)) {
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responses (MAC) not complete\n", tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
- if (setup->macs[i].waitDone == TRUE) {
- if (testCommonCheckWait (tf, setup, tfName, fname, fline, &setup->macs[i].status) == -1)
- System_printf ("%s: (%s:%d - called from %s:%d): MAC setup failed waiting for item %d to complete\n",
- tfName, __FILE__, __LINE__, fname, fline, i);
- } else
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
- }
-
-
-
- /* IP Setup */
- for (i = 0; i < setup->nIps; i++) {
- if (testCommonIpSetup (tf, stats, &(setup->ips[i]), &cmdReply, tfName, fname, fline, i)) {
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responses (IP) not complete\n", tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
- if (setup->ips[i].waitDone == TRUE) {
- if (testCommonCheckWait (tf, setup, tfName, fname, fline, &setup->ips[i].status) == -1)
- System_printf ("%s: (%s:%d - called from %s:%d): IP setup failed waiting for item %d to complete\n",
- tfName, __FILE__, __LINE__, fname, fline, i);
- } else
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
- }
-
- /* Custom L3 config */
- for (i = 0; i < setup->nCl3Cfgs; i++) {
- if (testCommonCl3Config (tf, stats, &(setup->cl3cfgs[i]), &cmdReply, tfName, fname, fline, i)) {
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responces (L3 Custom Config) not complete\n", tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
- if (setup->cl3cfgs[i].waitDone == TRUE) {
- if (testCommonCheckWait (tf, setup, tfName, fname, fline, &setup->cl3cfgs[i].status) == -1)
- System_printf ("%s: (%s:%d - called from %s:%d): Custom L3 config failed waiting for item %d to complete\n",
- tfName, __FILE__, __LINE__, fname, fline, i);
- } else
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
-
- }
-
- /* Custom L3 setup */
- for (i = 0; i < setup->nCl3s; i++) {
- if (testCommonCl3Setup (tf, stats, &setup->cl3s[i], &cmdReply, tfName, fname, fline, i)) {
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responses (L3 Custom Setup) not complete\n", tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
- if (setup->cl3s[i].waitDone == TRUE) {
- if (testCommonCheckWait (tf, setup, tfName, fname, fline, &setup->cl3s[i].status) == -1)
- System_printf ("%s: (%s:%d - called from %s:%d): Custom L3 setup failed waiting for item %d to complete\n",
- tfName, __FILE__, __LINE__, fname, fline, i);
- } else
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
- }
-
- /* L4 Setup */
- for (i = 0; i < setup->nL4s; i++) {
- if (testCommonL4Setup (tf, stats, &(setup->l4s[i]), &cmdReply, tfName, fname, fline, i)) {
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responses (L4) not complete\n", tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
- if (setup->l4s[i].waitDone == TRUE) {
- if (testCommonCheckWait (tf, setup, tfName, fname, fline, &setup->l4s[i].status) == -1)
- System_printf ("%s: (%s:%d - called from %s:%d): L4 setup failed waiting for item %d to complete\n",
- tfName, __FILE__, __LINE__, fname, fline, i);
- } else
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
-
- /* Wait a while for the next L4 entry */
- utilCycleDelay (1000);
- }
-
- /* Custom L4 config */
- for (i = 0; i < setup->nCl4Cfgs; i++) {
- if (testCommonCl4Config (tf, stats, &(setup->cl4cfgs[i]), &cmdReply, tfName, fname, fline, i)) {
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responces (Custom L4 Config) not complete\n", tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
- if (setup->cl4cfgs[i].waitDone == TRUE) {
- if (testCommonCheckWait (tf, setup, tfName, fname, fline, &setup->cl4cfgs[i].status) == -1)
- System_printf ("%s: (%s:%d - called from %s:%d): Custom L4 config failed waiting for item %d to complete\n",
- tfName, __FILE__, __LINE__, fname, fline, i);
- } else
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
-
- }
-
- /* Custom L4 setup */
- for (i = 0; i < setup->nCl4s; i++) {
- if (testCommonCl4Setup (tf, stats, &setup->cl4s[i], &cmdReply, tfName, fname, fline, i)) {
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responses (Custom L4) not complete\n", tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
- if (setup->cl4s[i].waitDone == TRUE) {
- if (testCommonCheckWait (tf, setup, tfName, fname, fline, &setup->cl4s[i].status) == -1)
- System_printf ("%s: (%s:%d - called from %s:%d): Custom L4 setup failed waiting for item %d to complete\n",
- tfName, __FILE__, __LINE__, fname, fline, i);
- } else
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
-
- /* Wait a while for the next L4 entry */
- utilCycleDelay (1000);
-
- }
-
- /* Command Set setup */
- for (i = 0; i < setup->nCmdSets; i++) {
- if (testCommonCmdSetSetup (tf, stats, &setup->cmdSet[i], &cmdReply, tfName, fname, fline, i)) {
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responses (Command Set Configuration) not complete\n", tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
- if (setup->cmdSet[i].waitDone == TRUE) {
- if (testCommonCheckWait (tf, setup, tfName, fname, fline, &setup->cmdSet[i].status) == -1)
- System_printf ("%s: (%s:%d - called from %s:%d): Command Set setup failed waiting for item %d to complete\n",
- tfName, __FILE__, __LINE__, fname, fline, i);
- } else
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
-
- /* Wait a while for the next L4 entry */
- utilCycleDelay (1000);
-
- }
-
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responses not complete\n", tfName, __FILE__, __LINE__, fname, fline);
-
-
- return (0);
-}
-
-/* Teardown a test which was setup using testCommonSetupTest */
-int32_t testCommonTeardownTest (tFramework_t *tf, paSysStats_t *stats, pauTestSetup_t *setup, char *tfName, char *fname, int32_t fline)
-{
- int32_t i;
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue, set by common setup */
- 0 }; /* Flow ID */
-
- cmdReply.queue = tf->QCommonCmdRep;
-
- /* Only teardown channels that were active */
- for (i = 0; i < setup->nMac; i++)
- if (setup->macs[i].status == PAU_TEST_SETUP_STATUS_CMD_REPLIED)
- setup->macs[i].status = PAU_TEST_SETUP_STATUS_CMD_NOT_SENT;
-
- for (i = 0; i < setup->nIps; i++)
- if (setup->ips[i].status == PAU_TEST_SETUP_STATUS_CMD_REPLIED)
- setup->ips[i].status = PAU_TEST_SETUP_STATUS_CMD_NOT_SENT;
-
- for (i = 0; i < setup->nCl3s; i++)
- if (setup->cl3s[i].status == PAU_TEST_SETUP_STATUS_CMD_REPLIED)
- setup->cl3s[i].status = PAU_TEST_SETUP_STATUS_CMD_NOT_SENT;
-
- for (i = 0; i < setup->nL4s; i++)
- if (setup->l4s[i].status == PAU_TEST_SETUP_STATUS_CMD_REPLIED)
- setup->l4s[i].status = PAU_TEST_SETUP_STATUS_CMD_NOT_SENT;
-
- /* There is no teardown for custom L4 config */
-
- for (i = 0; i < setup->nCl4s; i++)
- if (setup->cl4s[i].status == PAU_TEST_SETUP_STATUS_CMD_REPLIED)
- setup->cl4s[i].status = PAU_TEST_SETUP_STATUS_CMD_NOT_SENT;
-
- /* Custom L4 teardown */
- for (i = 0; i < setup->nCl4s; i++) {
- cmdReply.replyId = TF_COMMON_CMD_ID_DEL_CL4 + i;
- if (testCommonCloseL4 (tf, stats, setup->cl4s[i].handle, &setup->cl4s[i].status, &cmdReply, setup->cl4s[i].bufferQ, tfName, fname, fline)) {
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responses not complete\n", tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
- if (setup->cl4s[i].waitDone == TRUE) {
- if (testCommonCheckWait (tf, setup, tfName, fname, fline, &setup->cl4s[i].status) == -1)
- System_printf ("%s: (%s:%d - called from %s:%d): Custom L4 setup failed waiting for item %d to complete\n",
- tfName, __FILE__, __LINE__, fname, fline, i);
- } else
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
- }
-
- /* L4 Teardown */
- for (i = 0; i < setup->nL4s; i++) {
- cmdReply.replyId = TF_COMMON_CMD_ID_DEL_PORT + i;
- if (testCommonCloseL4 (tf, stats, setup->l4s[i].handle, &setup->l4s[i].status, &cmdReply, setup->l4s[i].bufferQ, tfName, fname, fline)) {
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responses not complete\n", tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
- if (setup->l4s[i].waitDone == TRUE) {
- if (testCommonCheckWait (tf, setup, tfName, fname, fline, &setup->l4s[i].status) == -1)
- System_printf ("%s: (%s:%d - called from %s:%d): L4 setup failed waiting for item %d to complete\n",
- tfName, __FILE__, __LINE__, fname, fline, i);
- } else
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
- }
-
- /* IP Teardown */
- for (i = 0; i < setup->nIps; i++) {
- cmdReply.replyId = TF_COMMON_CMD_ID_DEL_IP + i;
- if (testCommonCloseL2L3 (tf, stats, &setup->ips[i].handle, &setup->ips[i].status, &cmdReply, setup->ips[i].bufferQ, tfName, fname, fline)) {
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responses not complete\n", tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
- if (setup->ips[i].waitDone == TRUE) {
- if (testCommonCheckWait (tf, setup, tfName, fname, fline, &setup->ips[i].status) == -1)
- System_printf ("%s: (%s:%d - called from %s:%d): IP setup failed waiting for item %d to complete\n",
- tfName, __FILE__, __LINE__, fname, fline, i);
- } else
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
- }
-
-
- /* Custom L3 teardown */
- for (i = 0; i < setup->nCl3s; i++) {
- cmdReply.replyId = TF_COMMON_CMD_ID_DEL_CL3 + i;
- if (testCommonCloseL2L3 (tf, stats, &setup->cl3s[i].handle, &setup->cl3s[i].status, &cmdReply, setup->cl3s[i].bufferQ, tfName, fname, fline)) {
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responses not complete\n", tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
- if (setup->cl3s[i].waitDone == TRUE) {
- if (testCommonCheckWait (tf, setup, tfName, fname, fline, &setup->cl3s[i].status) == -1)
- System_printf ("%s: (%s:%d - called from %s:%d): Custom L3 teardown failed waiting for item %d to complete\n",
- tfName, __FILE__, __LINE__, fname, fline, i);
- } else
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
- }
-
-
- /* MAC teardown */
- for (i = 0; i < setup->nMac; i++) {
- if(setup->macs[i].paret != pa_OK)continue;
- cmdReply.replyId = TF_COMMON_CMD_ID_DEL_MAC + i;
- if (testCommonCloseL2L3 (tf, stats, &setup->macs[i].handle, &setup->macs[i].status, &cmdReply, setup->macs[i].bufferQ, tfName, fname, fline)) {
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responses not complete\n", tfName, __FILE__, __LINE__, fname, fline);
- return (-1);
- }
-
- if (setup->macs[i].waitDone == TRUE) {
- if (testCommonCheckWait (tf, setup, tfName, fname, fline, &setup->macs[i].status) == -1)
- System_printf ("%s: (%s:%d - called from %s:%d): MAC setup failed waiting for item %d to complete\n",
- tfName, __FILE__, __LINE__, fname, fline, i);
- } else
- testCommonCheckComplete (tf, setup, tfName, fname, fline);
- }
-
- if (testCommonWaitComplete (tf, setup, tfName, fname, fline) == FALSE)
- System_printf ("%s: (%s:%d - called from %s:%d): PA responses not complete\n", tfName, __FILE__, __LINE__, fname, fline);
-
-
- return (0);
-
-}
-
-
-
-/* Packets are taken off of the free descriptor Q and automatically returned after the transfer */
-int32_t testCommonSendPackets (tFramework_t *tf, char *tfName, paSysStats_t *stats, pktTestInfo_t *pktInfo, int32_t nPackets, int32_t dest)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- int32_t i;
-
-
- for (i = 0; i < nPackets; i++) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QfreeDesc)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a descriptor off free descriptor queue %d\n",
- tfName, __FILE__, __LINE__, tf->QfreeDesc);
- return (-1);
- }
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = tf->QfreeDesc;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Make sure there is no control info. */
- Cppi_setPSLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, 0);
-
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, pktInfo[i].pkt, (uint32_t)pktInfo[i].pktLen);
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint32_t)pktInfo[i].pktLen);
-
- Qmss_queuePush (tf->QPaTx[dest], (Ptr)hd, pktInfo[i].pktLen, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- testCommonIncStats (pktInfo[i].statsMap, stats);
- }
-
-
- return (0);
-}
-
-
-
-
-/* Function used for debugging firmware */
-#include <ti/csl/cslr_device.h>
-#include <ti/csl/cslr_pa_ss.h>
-
-void mdebugHaltPdsp (int32_t pdspNum)
-{
- CSL_Pa_ssRegs *passRegs = (CSL_Pa_ssRegs *)CSL_PA_SS_CFG_REGS;
- passRegs->PDSP_CTLSTAT[pdspNum].PDSP_CONTROL &= ~(CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK);
-
-}
-
-void mdebugRunPdsp (int32_t pdspNum)
-{
- CSL_Pa_ssRegs *passRegs = (CSL_Pa_ssRegs *)CSL_PA_SS_CFG_REGS;
- passRegs->PDSP_CTLSTAT[pdspNum].PDSP_CONTROL |= (CSL_PA_SS_PDSP_CONTROL_PDSP_ENABLE_MASK);
-
-}
-
-
-
-
-
-
-
diff --git a/test/PAUnitTest2/common/testutil.c b/test/PAUnitTest2/common/testutil.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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 "pautest.h"
-
-#ifndef __LINUX_USER_SPACE
-extern cregister volatile unsigned int DNUM;
-extern cregister volatile unsigned int TSCL;
-#endif
-
-#ifndef __LINUX_USER_SPACE
-void utilCycleDelay (int32_t count)
-{
- uint32_t sat;
-
- if (count <= 0)
- return;
-
- sat = TSCL + (uint32_t)count;
-
- while (TSCL < sat);
-
-}
-#else
-void utilCycleDelay (int32_t count)
-{
- uint32_t sat;
- for (sat=0; sat<count; sat++);
-}
-#endif
-
-#ifndef __LINUX_USER_SPACE
-uint32_t utilgAddr(uint32_t x)
-{
- if ((x >= 0x800000) && (x < 0x900000))
- x = (1 << 28) | (DNUM << 24) | x;
-
- return (x);
-}
-#else
-uint32_t utilgAddr(uint32_t x)
-{
- return x;
-}
-#endif
-
-uint16_t utilOnesComplementAdd (uint16_t v1, uint16_t v2)
-{
- uint32_t result;
-
- result = (uint32_t)v1 + (uint32_t)v2;
- result = (result >> 16) + (result & 0xffff);
- result = (result >> 16) + (result & 0xffff);
-
- return ((uint16_t)result);
-
-}
-
-uint16_t utilOnesCompChkSum (uint8_t *p, uint32_t nwords)
-{
- uint16_t chksum = 0;
- uint16_t v;
- uint32_t i;
- uint32_t j;
-
- for (i = j = 0; i < nwords; i++, j+=2) {
- v = (p[j] << 8) | p[j+1];
- chksum = utilOnesComplementAdd (chksum, v);
- }
-
- return (chksum);
-
-} /* onesCompChkSum */
-
-/**************************************************************************************
- * FUNCTION PURPOSE: Compute ipv4 psudo checksum
- **************************************************************************************
- * DESCRIPTION: Compute ipv4 psudo checksum
- **************************************************************************************/
-uint16_t utilGetIpv4PsudoChkSum (uint8_t *data, uint16_t payloadLen)
-{
- uint16_t psudo_chksum;
-
- psudo_chksum = utilOnesCompChkSum (&data[12], 4);
- psudo_chksum = utilOnesComplementAdd(psudo_chksum, (uint16_t) data[9]);
- psudo_chksum = utilOnesComplementAdd(psudo_chksum, payloadLen);
-
- return (psudo_chksum);
-
-} /* utilGetIpv4PsudoChkSum */
-
-/**************************************************************************************
- * FUNCTION PURPOSE: Compute ipv6 psudo checksum
- **************************************************************************************
- * DESCRIPTION: Compute ipv6 psudo checksum
- **************************************************************************************/
-uint16_t utilGetIpv6PsudoChkSum (uint8_t *data, uint16_t payloadLen)
-{
- uint16_t psudo_chksum;
-
- psudo_chksum = utilOnesCompChkSum (&data[8], 16);
- psudo_chksum = utilOnesComplementAdd(psudo_chksum, (uint16_t) data[6]);
- psudo_chksum = utilOnesComplementAdd(psudo_chksum, payloadLen);
-
- return (psudo_chksum);
-
-} /* utilGetIpv6PsudoChkSum */
-
-/**************************************************************************************
- * FUNCTION PURPOSE: Compute ip psudo checksum
- **************************************************************************************
- * DESCRIPTION: Compute ip psudo checksum
- **************************************************************************************/
-uint16_t utilGetIpPsudoChkSum (uint8_t *ip, uint16_t payloadLen)
-{
- uint16_t psudo_chksum;
-
- if ((ip[0] & 0xF0) == 0x40)
- {
- psudo_chksum = utilGetIpv4PsudoChkSum(ip, payloadLen);
- }
- else
- {
- psudo_chksum = utilGetIpv6PsudoChkSum(ip, payloadLen);
- }
-
- return (psudo_chksum);
-
-} /* utilGetIpPsudoChkSum */
-
-/* Compute UDP checksums */
-uint16_t utilCompUdpChksums (pktTestInfo_t *pktinfo, Bool insert)
-{
- uint8_t *udp;
- uint8_t *ip;
- uint16_t udpOffset;
- uint16_t ipOffset;
- uint16_t pseudo;
- uint16_t sum;
- int32_t pktLen;
-
- udpOffset = TF_GET_UDP_OFFSET(pktinfo->info);
- ipOffset = TF_GET_IP_OFFSET(pktinfo->info);
-
- udp = &(pktinfo->pkt[udpOffset]);
- ip = &(pktinfo->pkt[ipOffset]);
-
- pktLen = ((((int32_t)udp[4] << 8) | (int32_t)udp[5]) + 1) & ~1;
-
- if ((ip[0] & 0xF0) == 0x40)
- {
- pseudo = utilGetIpv4PsudoChkSum(ip, pktLen);
- }
- else
- {
- pseudo = utilGetIpv6PsudoChkSum(ip, pktLen);
- }
-
- if (insert == TRUE) {
- /* replace the checksum with the pseudo header checksum */
- udp[6] = pseudo >> 8;
- udp[7] = pseudo & 0xff;
- }
-
- sum = utilOnesCompChkSum (udp, pktLen>>1);
-
- if (pktLen & 1)
- {
- sum = utilOnesComplementAdd(sum, udp[pktLen-1] << 8);
- }
-
- sum = ~sum;
-
- if(sum == 0)
- sum = 0xFFFF;
-
- if (insert == TRUE) {
- udp[6] = sum >> 8;
- udp[7] = sum & 0x00ff;
- }
-
- return (sum);
-}
-
-/* Compute and Insert IP checksums */
-uint16_t utilCompIpChksums (pktTestInfo_t *pktinfo, Bool insert)
-{
- uint8_t *ip;
- uint16_t offset;
- uint16_t sum;
-
- offset = TF_GET_IP_OFFSET(pktinfo->info);
-
- ip = &(pktinfo->pkt[offset]);
-
- /* reset the checksum field to zero */
- if (insert == TRUE) {
- ip[10] = 0;
- ip[11] = 0;
- }
- sum = ~utilOnesCompChkSum (ip, 10);
-
- if (insert == TRUE) {
- ip[10] = sum >> 8;
- ip[11] = sum & 0x00ff;
- }
-
- return (sum);
-}
-
-uint16_t utilUpdateIpChksums (uint8_t *ip)
-{
- uint16_t sum;
-
- /* reset the checksum field to zero */
- ip[10] = 0;
- ip[11] = 0;
-
- sum = ~utilOnesCompChkSum (ip, 10);
-
- ip[10] = sum >> 8;
- ip[11] = sum & 0x00ff;
-
- return (sum);
-}
-
-
-/*******************************************************************************
- * Function: Generate payload
- *******************************************************************************
- * DESCRIPTION: Fill the data buffer with the specified payload data
- *
- * Note: It is up to the caller to allocate buffer
- ******************************************************************************/
-void testGenPayload(pauPayloadType_e type, uint8_t initValue, uint16_t len, uint8_t* buf)
-{
- uint8_t data = initValue;
- int i;
-
- switch (type)
- {
- case PAU_PAYLOAD_CONST:
- memset(buf, data, len);
- break;
-
- case PAU_PAYLOAD_INC8:
- for(i = 0; i < len; i++) buf[i] = data++;
- break;
-
- case PAU_PAYLOAD_DEC8:
- for(i = 0; i < len; i++) buf[i] = data--;
- break;
-
- case PAU_PAYLOAD_RANDOM:
- for(i = 0; i < len; i++) buf[i] = rand() & 0xFF;
- break;
-
- default:
- System_printf("testGenPayload: invalid paylaod type (%d)\n", type);
- System_flush();
- break;
- }
-}
-
-
-
-
-
-
-
-
diff --git a/test/PAUnitTest2/pa_log.h b/test/PAUnitTest2/pa_log.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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.
- *
-*/
-
-
-
-#ifndef _PA_LOG_H
-#define _PA_LOG_H
-
-
-typedef struct paLog_s
-{
- /* PA trace levels */
- uint32_t paLut1TraceLevel;
- uint32_t paLut2TraceLevel;
- uint32_t paCdeTraceLevel;
- uint32_t rsvd1[5];
-
- /* System trace levels */
- uint32_t sysStreamTraceLevel;
- uint32_t sysMemIfTraceLevel;
- uint32_t rsvd2[6];
-
- /* SA trace levels */
- uint32_t rsvd3[8];
-
- /* Unused */
- uint32_t rsvd4[40];
-
-} paLog_t;
-
-#define PA_LOG_IF 0x02000100
-#define PA_LOG_LEVEL_DISABLE 256
-
-
-
-
-
-#endif
-
diff --git a/test/PAUnitTest2/pautest.h b/test/PAUnitTest2/pautest.h
+++ /dev/null
@@ -1,570 +0,0 @@
-/*
- *
- * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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.
- *
-*/
-
-
-
-
-#ifndef _PAUTEST_H
-#define _PAUTEST_H
-
-#ifndef __LINUX_USER_SPACE
-#include <xdc/std.h>
-#include <xdc/runtime/System.h>
-#include <xdc/runtime/Memory.h>
-#include <xdc/runtime/Error.h>
-#include <ti/sysbios/BIOS.h>
-#include <ti/sysbios/hal/Hwi.h>
-#include <ti/sysbios/knl/task.h>
-#include <ti/sysbios/knl/Semaphore.h>
-#include <ti/sysbios/knl/Clock.h>
-#include <ti/sysbios/gates/GateHwi.h>
-#else
-#include <stdint.h>
-#include <stdio.h>
-#endif
-
-#include "pa_log.h"
-
-#include <ti/drv/pa/pa.h>
-#include <ti/drv/pa/pasahost.h>
-#include <ti/drv/qmss/qmss_drv.h>
-#include <ti/drv/qmss/qmss_osal.h>
-#include <ti/drv/cppi/cppi_drv.h>
-#include <ti/drv/cppi/cppi_desc.h>
-#include <ti/drv/cppi/cppi_osal.h>
-#include <ti/csl/csl_cacheAux.h>
-#include <ti/csl/csl_xmcAux.h>
-
-#include <string.h>
-
-#ifdef __LINUX_USER_SPACE
-#define System_printf printf
-#endif
-
-/* Due to a bug in the simulator all packet lengths must be rounded up to 4 byte multiples */
-#define PA_SIM_BUG_4BYTES
-
-typedef enum {
- PA_TEST_FAILED = -1,
- PA_TEST_NOT_RUN,
- PA_TEST_PASSED
-} paTestStatus_t;
-
-
-/* Define the test interface */
-typedef struct paTest_s
-{
-#ifdef __LINUX_USER_SPACE
- void* (*testFunction)(void *arg); /* The code that runs the test */
-#else
- void (*testFunction)(UArg, UArg); /* The code that runs the test */
-#endif
- char *name; /* The test name */
- paTestStatus_t testStatus; /* Test status */
-
-} paTest_t;
-
-extern paTest_t paTestList[];
-
-/* Number of cpdma channels is fixed by device */
-#define TF_PA_NUM_RX_CPDMA_CHANNELS 24
-#define TF_PA_NUM_TX_CPDMA_CHANNELS 9
-#define TF_Q_FREE_DESC 900 /* Unassociated descriptor queue number */
-#define TF_TEARDOWN_QUE_MGR 901 /* Teardown queue number */
-#define TF_TEARDOWN_QUE_NUM 0
-
-#define TF_LINKED_BUF_Q1 902 /* First queue with attached buffers */
-#define TF_LINKED_BUF_Q1_BUF_SIZE 128
-#define TF_LINKED_BUF_Q1_NBUFS 28
-extern unsigned char memQ1[TF_LINKED_BUF_Q1_NBUFS][TF_LINKED_BUF_Q1_BUF_SIZE];
-
-#define TF_LINKED_BUF_Q2 903 /* Second queue with attached buffers */
-#define TF_LINKED_BUF_Q2_BUF_SIZE 512
-#define TF_LINKED_BUF_Q2_NBUFS 32
-extern unsigned char memQ2[TF_LINKED_BUF_Q2_NBUFS][TF_LINKED_BUF_Q2_BUF_SIZE];
-
-#define TF_LINKED_BUF_Q3 904
-#define TF_LINKED_BUF_Q3_BUF_SIZE 1600
-#define TF_LINKED_BUF_Q3_NBUFS 8
-extern unsigned char memQ3[TF_LINKED_BUF_Q3_NBUFS][TF_LINKED_BUF_Q3_BUF_SIZE];
-
-#define TF_DEF_RET_Q 905 /* Default return of queues with linked descriptors */
-
-#define TF_COMMON_CMD_REPL_Q 906 /* Common code PA command reply queue */
-
-
-#define TF_FIRST_GEN_QUEUE 907 /* Queues available for general use */
-#define TF_NUM_GEN_QUEUES 100
-
-/* The following software info 0 command IDs are reserved by the common setup */
-#define TF_COMMON_CMD_ID_ADD_MAC 0xff000000
-#define TF_COMMON_CMD_ID_ADD_IP 0xff010000
-#define TF_COMMON_CMD_ID_ADD_PORT 0xff020000
-#define TF_COMMON_CMD_ID_CFG_CL4 0xff030000
-#define TF_COMMON_CMD_ID_ADD_CL4 0xff040000
-#define TF_COMMON_CMD_ID_DEL_CL4 0xff050000
-#define TF_COMMON_CMD_ID_DEL_PORT 0xff060000
-#define TF_COMMON_CMD_ID_DEL_IP 0xff070000
-#define TF_COMMON_CMD_ID_DEL_MAC 0xff080000
-#define TF_COMMON_CMD_ID_CFG_CL3 0xff090000
-#define TF_COMMON_CMD_ID_ADD_CL3 0xff0A0000
-#define TF_COMMON_CMD_ID_DEL_CL3 0xff0B0000
-#define TF_COMMON_CMD_ID_ADD_CMDSET 0xff0C0000
-
-/* Define the test framework */
-typedef struct tFramework_s {
-
- Pa_Handle passHandle; /* PA instance handle */
-
-#ifndef __LINUX_USER_SPACE
- GateHwi_Handle gateHwi; /* HW interrupt disable handle */
-#endif
-
- Cppi_Handle tfPaCppiHandle; /* PA CDMA handle */
-
- Cppi_ChHnd tfPaTxChHnd[TF_PA_NUM_TX_CPDMA_CHANNELS];
- Cppi_ChHnd tfPaRxChHnd[TF_PA_NUM_RX_CPDMA_CHANNELS];
-
- /* Queues */
- int32_t QPaTx[TF_PA_NUM_TX_CPDMA_CHANNELS];
- int32_t QfreeDesc; /* Unassociated descriptor queue handle */
- int32_t QtDown; /* Tear down queue handle */
- int32_t QDefRet; /* Default return queue for descriptors with linked buffers */
- int32_t QLinkedBuf1; /* First Queue with descriptors and attached linked buffers */
- int32_t QLinkedBuf2; /* Second Queue with descriptors and attached linked buffers */
- int32_t QLinkedBuf3; /* Third Queue with descriptors and attached linked buffers */
- int32_t QCommonCmdRep; /* Queue for command reply used by common code */
- int32_t QGen[TF_NUM_GEN_QUEUES]; /* General purpose queues */
-
- Cppi_FlowHnd tfPaFlowHnd0; /* Flow handle for flow 0 */
- int32_t tfFlowNum; /* Physical flow number */
-
-#ifndef __LINUX_USER_SPACE
- Semaphore_Handle tfPaTableL2Sem; /* Semaphore for PA internal table for L2 */
- Semaphore_Handle tfPaTableL3Sem; /* Semaphore for PA internal table for L3 */
-
- Semaphore_Handle tfQmSem; /* Semaphore for queue manager */
-#endif
-
-} tFramework_t;
-
-extern tFramework_t tFramework;
-
-
-/* Define the arguments to unit test functions */
-typedef struct paTestArgs_s
-{
- tFramework_t *tf;
- paTest_t *pat;
-} paTestArgs_t;
-
-/* PA memory */
-#define TF_PA_INST_SIZE 128 /* Required size = 84 */
-extern uint8_t memPaInst[TF_PA_INST_SIZE];
-
-#define TF_MAX_NUM_L2_HANDLES 64
-#define TF_L2_TABLE_SIZE (TF_MAX_NUM_L2_HANDLES * 32) /* Requires 32 bytes per entry */
-extern uint8_t memL2Ram[TF_L2_TABLE_SIZE];
-
-#define TF_MAX_NUM_L3_HANDLES 128
-#define TF_L3_TABLE_SIZE (TF_MAX_NUM_L3_HANDLES * 68) /* Requires 68 bytes per entry */
-extern uint8_t memL3Ram[TF_L3_TABLE_SIZE];
-
-#define TF_USR_STATS_LNK_TABLE_SIZE (pa_USR_STATS_MAX_COUNTERS * 4) /* Require 4 bytes per satistics */
-extern uint8_t memUsrStatsLnkTbl[TF_USR_STATS_LNK_TABLE_SIZE];
-
-/* QM memory */
-#define TF_NUM_DESC 128 /* 128 host descriptors managed by the QM */
-#define TF_SIZE_DESC 128 /* Must be multiple of 16 */
-
-/* Memory used for the linking RAM and descriptor RAM */
-extern uint64_t memLinkRam[TF_NUM_DESC];
-extern uint8_t memDescRam[TF_NUM_DESC * TF_SIZE_DESC];
-
-
-typedef uint32_t paStatsBmap_t;
-
-/* Stats numbers. Util functions are used to add these to the bit maps.
- * The values match the actual stats numbers */
-#define TF_STATS_BM_C1_NUM_PACKETS 0
-#define TF_STATS_BM_C1_NUM_IPV4 1
-#define TF_STATS_BM_C1_NUM_IPV6 2
-#define TF_STATS_BM_C1_NUM_CUSTOM 3
-#define TF_STATS_BM_C1_NUM_SRIO 4
-#define TF_STATS_BM_C1_TABLE_MATCH 6
-#define TF_STATS_BM_C1_NO_TABLE_MATCH 7
-#define TF_STATS_BM_C1_IP_FRAG 8
-#define TF_STATS_BM_C1_VLAN_OVERFLOW 10
-#define TF_STATS_BM_C1_NUM_MPLS 12
-#define TF_STATS_BM_C1_PARSE_FAIL 13
-#define TF_STATS_BM_C1_TX_IP_FRAG 15
-#define TF_STATS_BM_C1_SILENT_DISCARD 17
-
-#define TF_STATS_BM_C2_NUM_PACKETS 21
-#define TF_STATS_BM_C2_NUM_UDP 23
-#define TF_STATS_BM_C2_NUM_TCP 24
-#define TF_STATS_BM_C2_NUM_CUSTOM 25
-
-#define TF_STATS_BM_M_CMD_FAIL 30
-
-
-/* Define additional PA Error Codes */
-#define pa_NO_BUF 1 /* Descriptor for PA command packet is not available */
-
-
-/* Packet and associated structures */
-typedef struct pktTestInfo_s {
- uint8_t *pkt;
- pasahoLongInfo_t *info;
- int32_t pktLen;
- paStatsBmap_t statsMap[3]; /* Bit map of which stats to increment. Some stats must be incremented 3 times */
- int32_t idx; /* Used to increment the test tracking - tells the test to look for
- * a packet with this index */
-
-} pktTestInfo_t;
-
-
-/* Macros to form the packet info structure */
-#define TF_FORM_PKT_INFO_WORD0(cmdId,recordLen,startOffset) ((cmdId << 29) | (recordLen << 24) | startOffset)
-#define TF_FORM_PKT_INFO_WORD1(endOffset,errIdx,pmatch,c2c,l1PdspId,l1Idx) ((endOffset << 16) | (errIdx << 11) | (pmatch << 10) | \
- (c2c << 9) | (l1PdspId << 6) | (l1Idx))
-#define TF_FORM_PKT_INFO_WORD2(l3Offset,l4Offset,l5Offset,ahEspOffset) ((l3Offset << 24) | (l4Offset << 16) | (l5Offset << 8) | ahEspOffset)
-#define TF_FORM_PKT_INFO_WORD3(hdrBitmask,nextHdr,vCount,ipCount,greCount,frag,route,ipmrt) \
- ((hdrBitmask << 21) | (nextHdr << 16) | (vCount << 12) | (ipCount << 8) | (greCount << 4) | \
- (frag << 3) | (route << 2) | (ipmrt << 1))
-#define TF_FORM_PKT_INFO_WORD4(pseudo) (pseudo << 16)
-
-#define TF_GET_UDP_OFFSET(x) ((((x)->word2) >> 16) & 0x00ff)
-#define TF_GET_UDP_PSEUDO(x) (((x)->word4) >> 16)
-#define TF_GET_IP_OFFSET(x) ((((x)->word2) >> 24) & 0x00ff)
-
-
-/* Macros to form the PS Info words for the SRIO packet */
-#define TF_FORM_SRIO_PSINFO_WORD0(srcId, destId) (srcId << 16) | (destId)
-#define TF_FORM_SRIO_PSINFO_WORD1_TYPE11(pri, cc, tt, letter, mbox) ((cc) << 15) | ((pri) << 11) | ((tt) << 9) | ((letter) << 6) | (mbox)
-#define TF_FORM_SRIO_PSINFO_WORD1_TYPE9(pri, cc, tt, streamId, cos) ((cc) << 8) | ((pri) << 11) | ((tt) << 10) | ( (streamId) << 16) | (cos)
-
-#define PA_PKT_TYPE_SRIO_TYPE_9 30
-#define PA_PKT_TYPE_SRIO_TYPE_11 31
-
-/* A simple fifo */
-typedef struct pauFifo_s {
- int32_t inIdx;
- int32_t outIdx;
- int32_t size;
- uint32_t *data;
-} pauFifo_t;
-
-
-extern paLog_t *paLogLevel;
-
-
-/* Generic test setup
- * Test setup involves configuring PA to receive MAC, IP, TCP/UDP, custom.
- */
-
-typedef enum {
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT, /* Command not yet sent to the PA */
- PAU_TEST_SETUP_STATUS_CMD_SENT, /* Command sent, no reply received */
- PAU_TEST_SETUP_STATUS_CMD_REPLIED, /* Received reply from PA, no errors */
- PAU_TEST_SETUP_STATUS_CMD_REP_ERR, /* Received reply from PA with errors */
- PAU_TEST_SETUP_STATUS_CMD_NO_CMD /* Command was intentionally invalid to test PA */
-} pauTestSetupStatus_t;
-
-
-
-/* MAC test setup */
-typedef struct pauTestMacSetup_s {
-
- paEthInfo_t ethInfo; /* PA LLD Ethernet configuration */
- paRouteInfo_t matchRoute; /* Routing information for a match */
- paRouteInfo_t nFail; /* Routing information on subsequent failure */
- paReturn_t paret; /* The expected PA return value */
- paHandleL2L3_t handle; /* The returned PA handle */
- Bool waitDone; /* If True wait for the reply before proceeding */
-
- int32_t bufferQ; /* The queue to use to get the buffer for the command */
- pauTestSetupStatus_t status; /* The command status. Used internally by the setup program */
-
-} pauTestMacSetup_t;
-
-/* IP test setup. It is an error if both l2Link and L3Link are non-null */
-typedef struct pauTestIpSetup_s {
-
- paIpInfo_t ipInfo; /* PA LLD IP configuration */
- paRouteInfo_t matchRoute; /* Routing information for a match */
- paRouteInfo_t nFail; /* Routing information on subsequent failure */
- pauTestMacSetup_t *l2Link; /* Link to L2 handle, NULL if no L2 link */
- struct pauTestIpSetup_s *l3Link; /* Link to L3 handle, NULL if no L3 Link. */
- paReturn_t paret; /* The expected PA return value */
- paHandleL2L3_t handle; /* The returned PA handle */
- Bool waitDone; /* If True wait for the reply before proceeding */
-
- int32_t bufferQ; /* The queue to use to get the buffer for the command */
- pauTestSetupStatus_t status; /* The command status. Used internally by the setup program */
-
-} pauTestIpSetup_t;
-
-/* TCP/UDP test setup */
-typedef struct pauTestL4Setup_s {
-
- uint16_t destPort; /* PA LLD destination port */
- paRouteInfo_t matchRoute; /* Routing information for a match */
- pauTestIpSetup_t *l3Link; /* Link to L3 handle, NULL if no L3 Link */
- paReturn_t paret; /* The expected PA return value */
- paHandleL4_t handle; /* The returned PA handle */
- Bool waitDone; /* If True wait for the reply before proceeding */
-
- int32_t bufferQ; /* The queue to use to get the buffer for the command */
- pauTestSetupStatus_t status; /* The command status. Used internally by the setup program */
-
-} pauTestL4Setup_t;
-
-
-/* Custom L3 (LUT1) test setup */
-typedef struct pauTestCl3Config_s {
-
- uint16_t custIndex; /* The custom Index */
- uint16_t offset; /* offset to where the PA begins custom match */
- uint16_t nextHdr; /* The next header to be parsed */
- uint16_t nextHdrOffset; /* offset to where the PA begins after the custom match */
- uint8_t byteMasks[pa_NUM_BYTES_CUSTOM_LUT1]; /* The byte bit field masks */
- paReturn_t paret; /* The expected PA return value */
- Bool waitDone; /* If True wait for the reply before proceeding */
-
- int32_t bufferQ; /* The queue to use to get the buffer for the command */
- pauTestSetupStatus_t status; /* The command status. Used internally by the setup program */
-
-} pauTestCl3Config_t;
-
-/* Custom L3 table entries */
-typedef struct pauTestCl3Setup_s {
-
- uint16_t custIndex; /* Custom Index */
- uint8_t match[pa_NUM_BYTES_CUSTOM_LUT1]; /* The table match values */
- paRouteInfo_t matchRoute; /* Routing information for a match */
- paRouteInfo_t nFail; /* Routing information on subsequent failure */
- pauTestMacSetup_t *l2Link; /* Link to L2 handle, NULL if no L2 link */
- struct pauTestIpSetup_s *l3Link; /* Link to L3 handle, NULL if no L3 Link. */
- paReturn_t paret; /* The expected PA return value */
- paHandleL2L3_t handle; /* The returned PA handle */
- Bool waitDone; /* If True wait for the reply before proceeding */
-
- int32_t bufferQ; /* The queue to use to get the buffer for the command */
- pauTestSetupStatus_t status; /* The command status. Used internally by the setup program */
-
-} pauTestCl3Setup_t;
-
-/* Custom L4 test setup */
-typedef struct pauTestCl4Config_s {
-
- Bool handleLink; /* Set to True if the previous link is included in the look up pattern */
- uint16_t custIndex; /* The custom Index */
- uint16_t byteOffsets[pa_NUM_BYTES_CUSTOM_LUT2]; /* The byte offsets */
- uint8_t byteMasks[pa_NUM_BYTES_CUSTOM_LUT2]; /* The byte bit field masks */
- paReturn_t paret; /* The expected PA return value */
- Bool waitDone; /* If True wait for the reply before proceeding */
-
- int32_t bufferQ; /* The queue to use to get the buffer for the command */
- pauTestSetupStatus_t status; /* The command status. Used internally by the setup program */
-
-} pauTestCl4Config_t;
-
-/* Custom L4 table entries */
-typedef struct pauTestCl4Setup_s {
-
- uint16_t custIndex; /* Custom Index */
- uint8_t match[pa_NUM_BYTES_CUSTOM_LUT2]; /* The table match values */
- paRouteInfo_t matchRoute; /* Routing information for a match */
- pauTestIpSetup_t *l3Link; /* Link to IP handle */
- paReturn_t paret; /* The expected PA return value */
- paHandleL4_t handle; /* The returned PA handle */
- Bool waitDone; /* If True wait for the reply before proceeding */
-
- int32_t bufferQ; /* The queue to use to get the buffer for the command */
- pauTestSetupStatus_t status; /* The command status. Used internally by the setup program */
-
-} pauTestCl4Setup_t;
-
-/* Command set entries */
-typedef struct pauTestCmdSetSetup_s {
-
- uint16_t index; /* command set index */
- int nCmds; /* number of commands */
- paCmdInfo_t *cmdInfo; /* pointer to the command array */
- paReturn_t paret; /* The expected PA return value */
- Bool waitDone; /* If True wait for the reply before proceeding */
-
- int32_t bufferQ; /* The queue to use to get the buffer for the command */
- pauTestSetupStatus_t status; /* The command status. Used internally by the setup program */
-
-} pauTestCmdSetSetup_t;
-
-
-/* A complete test setup */
-typedef struct pauTestSetup_s {
-
- int32_t nMac; /* Number of MAC setups */
- pauTestMacSetup_t *macs; /* Array of MAC setups */
-
- int32_t nIps; /* Number of IP setups */
- pauTestIpSetup_t *ips; /* Array of IP setups */
-
- int32_t nL4s; /* Number of L4 setups */
- pauTestL4Setup_t *l4s; /* Array of L4 setups */
-
- int32_t nCl3Cfgs; /* Number of custom L3 configurations */
- pauTestCl3Config_t *cl3cfgs; /* Array of L3 configs */
-
- int32_t nCl3s; /* Number of custom L3 setups */
- pauTestCl3Setup_t *cl3s; /* Array of custom L3 setups */
-
- int32_t nCl4Cfgs; /* Number of custom L4 configurations */
- pauTestCl4Config_t *cl4cfgs; /* Array of L4 configs */
-
- int32_t nCl4s; /* Number of custom L4 setups */
- pauTestCl4Setup_t *cl4s; /* Array of custom L4 setups */
-
- int32_t nCmdSets; /* Number of command sets */
- pauTestCmdSetSetup_t *cmdSet; /* Array of command sets */
-
-} pauTestSetup_t;
-
-/******************************************************************************
- * DATA DEFINITION: PA Unit Test Payload Type
- ******************************************************************************
- * DESCRIPTION: Defines the payload types
- ******************************************************************************/
-typedef enum pauPayloadType_s
-{
- PAU_PAYLOAD_CONST,
- PAU_PAYLOAD_INC8,
- PAU_PAYLOAD_DEC8,
- PAU_PAYLOAD_RANDOM
-} pauPayloadType_e;
-
-/* Prototypes */
-int32_t setupTestFramework (void);
-int32_t verifyTestFramework (void);
-void utilCycleDelay (int32_t count);
-uint32_t utilgAddr(uint32_t x);
-uint16_t utilCompUdpChksums (pktTestInfo_t *pktinfo, Bool insert);
-uint16_t utilCompIpChksums (pktTestInfo_t *pktinfo, Bool insert);
-uint16_t utilGetIpPsudoChkSum (uint8_t *ip, uint16_t payloadLen);
-uint16_t utilUpdateIpChksums (uint8_t *ip);
-
-
-void testGenPayload(pauPayloadType_e type, uint8_t initValue, uint16_t len, uint8_t* buf);
-
-int32_t testCommonRequestPaStats (char *fname, tFramework_t *tf, Bool reset, int32_t QSource, int32_t QRecycle, paCmdReply_t *reply);
-int32_t testCommonRequestUsrStats (char *fname, tFramework_t *tf, Bool reset, int32_t QSource, int32_t QRecycle, paCmdReply_t *reply, paUsrStats_t *usrStats);
-int32_t testCommonCompareStats (char *fname, paSysStats_t *expected, paSysStats_t *actual);
-int32_t testCommonCompareUsrStats (char *fname, paUsrStats_t *expected, paUsrStats_t *actual);
-int32_t testCommonRecycleLBDesc (tFramework_t *tf, Cppi_HostDesc *hd);
-int32_t testCommonComparePktInfo (Char *tfName, pasahoLongInfo_t *expected, pasahoLongInfo_t *actual);
-void testCommonIncStats (paStatsBmap_t *map, paSysStats_t *stats);
-int32_t testCommonSendPackets (tFramework_t *tf, char *tfName, paSysStats_t *stats, pktTestInfo_t *pktInfo, int32_t nPackets, int32_t dest);
-Cppi_HostDesc *testCommonAddSrio (tFramework_t *tf, int index, paSrioInfo_t *srioInfo, uint16_t nextHdr, uint16_t nextHdrOffset,
- paRouteInfo_t *matchRoute, paRouteInfo_t *nfailRoute, paHandleL2L3_t *l2handle, int32_t Qrecycle, int32_t QCmdMem,
- paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret);
-Cppi_HostDesc *testCommonAddMac (tFramework_t *tf, int32_t index, paEthInfo_t *ethInfo, paRouteInfo_t *matchRoute, paRouteInfo_t *nfailRoute,
- paHandleL2L3_t *l2handle, int32_t Qrecycle, int32_t QCmdMem,
- paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret);
-Cppi_HostDesc *testCommonDelHandle (tFramework_t *tf, paHandleL2L3_t *paHdl, int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *cmdReply,
- int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret);
-Cppi_HostDesc *testCommonDelL4Handles (tFramework_t *tf, paHandleL4_t l4Handle, int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *reply,
- int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret);
-Cppi_HostDesc *testCommonAddIp (tFramework_t *tf, int32_t index, paIpInfo_t *ipInfo, paRouteInfo_t *matchRoute, paRouteInfo_t *nfailRoute,
- paHandleL2L3_t *l3handle, paHandleL2L3_t linkedL2Handle, int32_t Qrecycle, int32_t QCmdMem,
- paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret);
-Cppi_HostDesc *testCommonAddPort (tFramework_t *tf, int portSize, uint32_t destPort, paRouteInfo_t *matchRoute, paHandleL4_t *l4handle, paHandleL2L3_t *l3handle,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret);
-Cppi_HostDesc *testCommonAddPort2 (tFramework_t *tf, int portSize, uint32_t destPort, Uint16 fReplace, uint16_t divertQ, paRouteInfo_t *matchRoute, paHandleL4_t *l4handle, paHandleL2L3_t *l3handle,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret);
-Cppi_HostDesc *testCommonConfigMultiRoute (tFramework_t *tf, paMultiRouteModes_e mode, uint16_t index, uint16_t nRoute, paMultiRouteEntry_t *routeEntry,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret);
-Cppi_HostDesc *testCommonConfigExceptionRoute (tFramework_t *tf, int nRoute, int *routeTypes, paRouteInfo_t *eRoutes,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret);
-Cppi_HostDesc *testCommonConfigCmdSet (tFramework_t *tf, uint16_t index, int nCmd, paCmdInfo_t *cmdInfo,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret);
-Cppi_HostDesc *testCommonConfigCrcEngine (tFramework_t *tf, uint16_t index, paCrcConfig_t *cfgInfo,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret);
-Cppi_HostDesc *testCommonGlobalConfig (tFramework_t *tf, paCtrlInfo_t *cfgInfo,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret);
-Cppi_HostDesc *testCommonConfigUsrStats (tFramework_t *tf, paUsrStatsConfigInfo_t *cfgInfo,
- int32_t Qrecycle, int32_t QCmdMem, paCmdReply_t *repInfo, int32_t *cmdDest, uint16_t *cmdSize, paReturn_t *paret);
-
-uint16_t testCommonOnesCompAdd (uint16_t v1, uint16_t v2);
-int32_t testCommonWaitCmdReply (tFramework_t *tf, paTest_t *pat, char *tname, int32_t Qcmd, uint32_t swinfo0, int32_t line);
-int32_t testCommonSetupTest (tFramework_t *tf, paSysStats_t *stats, pauTestSetup_t *setup, char *tfName, char *fname, int32_t fline);
-int32_t testCommonTeardownTest (tFramework_t *tf, paSysStats_t *stats, pauTestSetup_t *setup, char *tfName, char *fname, int32_t fline);
-paTestStatus_t testCommonCheckStats (tFramework_t *tf, paTest_t *pat, char *tName, paSysStats_t *expected, int32_t qSource, int32_t qCmdRecycle, int32_t qReply, Bool clear);
-paTestStatus_t testCommonCheckUsrStats (tFramework_t *tf, paTest_t *pat, char *tName, paUsrStats_t *expected, int32_t qSource, int32_t qCmdRecycle, int32_t qReply, Bool clear);
-
-int32_t commonFifoPushElement (pauFifo_t *fifo, uint32_t elem);
-int32_t commonFifoGetCount (pauFifo_t *fifo);
-uint32_t commonFifoPopElement (pauFifo_t *fifo, int32_t *numInQBeforePop);
-
-void mdebugHaltPdsp (int32_t pdspNum);
-void mdebugRunPdsp (int32_t pdspNum);
-
-/* Tests */
-#ifdef __LINUX_USER_SPACE
-void* paTestUnconfigured (void *args);
-void* paTestL2Routing (void *args);
-void* paTestSrioRouting (void *args);
-void* saSimple (void *args);
-void* paTestTxFmtRt (void *args);
-void* paTestL3Routing (void *args);
-void* paTestL4Routing (void *args);
-void* paTestPatchRoute (void *args);
-void* paTestCustom (void *args);
-void* paTestMultiRouting (void *args);
-void* paTestIPv4FragReassem (void *args);
-#else
-void paTestUnconfigured (UArg a0, UArg a1);
-void paTestL2Routing (UArg a0, UArg a1);
-void paTestSrioRouting (UArg a0, UArg a1);
-void saSimple (UArg a0, UArg a1);
-void paTestTxFmtRt (UArg a0, UArg a1);
-void paTestL3Routing (UArg a0, UArg a1);
-void paTestL4Routing (UArg a0, UArg a1);
-void paTestPatchRoute (UArg a0, UArg a1);
-void paTestCustom (UArg a0, UArg a1);
-void paTestMultiRouting (UArg a0, UArg a1);
-void paTestIPv4FragReassem (UArg a0, UArg a1);
-#endif
-
-#endif /* _PAUTEST_H */
diff --git a/test/PAUnitTest2/tests/test1.c b/test/PAUnitTest2/tests/test1.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- *
- * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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 "../pautest.h"
-
-#ifdef __LINUX_USER_SPACE
-#include "fw_test.h"
-#include "fw_mem_allocator.h"
-#endif
-
-/* Unconfigured PA test.
- * This test sends a valid data packet to each of the PDSPs before any configuration
- * has been provided. The PA should simply silently discard the packets
- *
- * a0 is a pointer to the test framework structure
- * a1 is a pointer to the paTest_t structure for this test, as initialized in testMain.
- *
- * General purpose Queue assignment
- * 0 - Recycle queue for the data packets
- * 1 - Recycle queue for the request stats request
- * 2 - Destination queue for the request stats reply
- *
- */
-
- static char *tfName = "paTestUnconfigured";
-
- #define Q_DATA_RECYCLE 0
- #define Q_REQ_STATS_RECYCLE 1
- #define Q_STATS_REPLY 2
-
-#pragma DATA_ALIGN(paTucPktData, 16)
-const unsigned char paTucPktData[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, /* Dest MAC */
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x04, /* Src MAC */
- 0x08, 0x00, /* Ethertype = IPv4 */
- 0x45, 0x00, 0x00, 0x6c, /* IP version, services, total length */
- 0x00, 0x00, 0x00, 0x00, /* IP ID, flags, fragment offset */
- 0x05, 0x11, 0xa5, 0x97, /* IP ttl, protocol (UDP), header checksum */
- 0x9e, 0xda, 0x6d, 0x0a, /* Source IP address */
- 0x01, 0x02, 0x03, 0x04, /* Destination IP address */
- 0x12, 0x34, 0x05, 0x55, /* UDP source port, dest port */
- 0x00, 0x58, 0xe1, 0x98, /* UDP len, UDP checksum */
- 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, /* 80 bytes of payload data */
- 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41,
- 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
- 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
- 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
- 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61,
- 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81 };
-
-unsigned char* paTucPkt;
-
-const paSysStats_t paTucExpectedStats = {
-
- // 1, /* Clear flag */
-
- { 3, /* Classify 1 nPackets */
- 0, /* Classify 1 nIpv4Packets */
- 0, /* Classify 1 nIpv6Packets */
- 0, /* Classify 1 nCustomPackets */
- 0, /* Classify 1 nSrioPackets */
- 0, /* Classify 1 nLlcSnapFail */
- 0, /* Classify 1 nTableMatch */
- 3, /* Classify 1 nNoTableMatch */
- 0, /* Classify 1 nIpFrag */
- 0, /* Classify 1 nIpDepthOverflow */
- 0, /* Classify 1 nVlanDepthOverflow */
- 0, /* Classify 1 nGreDepthOverflow */
- 0, /* Classify 1 nMplsPackets */
- 0, /* Classify 1 nParseFail */
- 0, /* Classify 1 nInvalidIPv6Opt */
- 0, /* Classify 1 nTxIpFrag */
- 0, /* Classify 1 nInvalidComReplyDest */
- 3, /* Classify 1 nSilentDiscard */
- 0, /* Classify 1 nInvalidControl */
- 0, /* Classify 1 nInvalidState */
- 0 }, /* Classify 1 nSystemFail */
-
- { 1, /* Classify 2 nPackets */
- 0, /* Classify 2 nInvldHdr */
- 0, /* Classify 2 nUdp */
- 0, /* Classify 2 nTcp */
- 0, /* Classify 2 nCustom */
- 0, /* Classify 2 nCommandFail */
- 0, /* Classify 2 nInvalidComReplyDest */
- 1, /* Classify 2 nSilentDiscard */
- 1 }, /* Classify 2 nInvalidControl */
-
- { 2 }, /* Modify nCommandFail */
-
- { 0 } /* Common nIdAllocationFail */
-
- };
-
-void paTestUcRecoverAndExit (tFramework_t *tf, paTest_t *pat, paTestStatus_t testResult)
-{
- Cppi_HostDesc *hd;
-
- /* Set the result code */
- pat->testStatus = testResult;
-
- /* Restore the packet recycle queues */
- while (Qmss_getQueueEntryCount ((tf->QGen)[Q_DATA_RECYCLE])) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_DATA_RECYCLE])) & ~15);
-
- hd->buffPtr = hd->origBuffPtr;
- hd->buffLen = hd->origBufferLen;
-
- Qmss_queuePushDesc (tf->QfreeDesc, (Ptr)hd);
- }
-
-
-
- /* Return */
- Task_exit();
-}
-
-#ifdef __LINUX_USER_SPACE
-void* paTestUnconfigured (void *args)
-{
- tFramework_t *tf = ((paTestArgs_t *)args)->tf;
- paTest_t *pat = ((paTestArgs_t *)args)->pat;
-#else
- void paTestUnconfigured (UArg a0, UArg a1)
- {
- tFramework_t *tf = (tFramework_t *)a0;
- paTest_t *pat = (paTest_t *)a1;
-#endif
- Cppi_HostDesc *hd;
- uint8_t *bp;
- paSysStats_t *paStats;
- uint32_t blen;
- paCmdReply_t reply;
- Qmss_Queue q;
- paTestStatus_t result;
- int32_t i;
- uint32_t len;
-
- volatile int32_t mdebugWait = 1;
-
-#ifdef __LINUX_USER_SPACE
- /* Allocate memory for the Packet buffers */
- paTucPkt = (uint8_t *)fw_memAlloc(sizeof(paTucPktData), CACHE_LINESZ);
- if(paTucPkt == NULL) {
- printf ("%s: memAlloc failed for pkt %d\n", tfName, i);
- pat->testStatus = PA_TEST_FAILED;
- return (void *)0;
- }
- memcpy(paTucPkt, paTucPktData, sizeof(paTucPktData));
-#else
- paTucPkt = paTucPktData;
-#endif
-
- /* Send the data packets to the PA */
- for (i = 0; i < 6; i++) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QfreeDesc)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Queue pop failed for free descriptor queue (%d)\n", tfName, __FILE__, __LINE__, tf->QfreeDesc);
- paTestUcRecoverAndExit (tf, pat, PA_TEST_FAILED);
- }
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = tf->QGen[Q_DATA_RECYCLE];
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Attach the data and set the length */
-#ifdef PA_SIM_BUG_4BYTES
- len = (sizeof(paTucPktData)+3)& ~3;
-#else
- len = sizeof(paTucPktData);
-#endif
- Cppi_setOriginalBufInfo(Cppi_DescType_HOST, (Cppi_Desc *)hd, (Ptr)utilgAddr((uint32_t)paTucPkt), len);
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (Ptr)utilgAddr((uint32_t)paTucPkt), len);
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, len);
- /* Make sure there is no control info. */
- Cppi_setPSLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, 0);
-
- Qmss_queuePush (tf->QPaTx[i], (Ptr)utilgAddr((uint32_t)hd), len, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- }
-
- /* Wait for 6 descriptors to pop up in the recycle queue */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (1000);
- if (Qmss_getQueueEntryCount (tf->QGen[Q_DATA_RECYCLE]) >= 6)
- break;
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Did not find expected recycled descriptors in queue %d\n", tfName, __FILE__, __LINE__, tf->QGen[Q_DATA_RECYCLE]);
- paTestUcRecoverAndExit (tf, pat, PA_TEST_FAILED);
- }
-
- /* Request stats from the PA */
- reply.dest = pa_DEST_HOST;
- reply.replyId = 0;
- reply.queue = tf->QGen[Q_STATS_REPLY];
- reply.flowId = tf->tfFlowNum;
-
- if (testCommonRequestPaStats (tfName, tf, TRUE, tf->QLinkedBuf1, tf->QGen[Q_REQ_STATS_RECYCLE], &reply)) {
- System_printf ("%s (%s:%d): testCommonRequestPaStats failed\n", tfName, __FILE__, __LINE__);
- paTestUcRecoverAndExit (tf, pat, PA_TEST_FAILED);
- }
-
-
- /* Wait for the stats reply */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (1000);
- if (Qmss_getQueueEntryCount (tf->QGen[Q_STATS_REPLY]) > 0)
- break;
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Did not find response from PA to stats request command\n", tfName, __FILE__, __LINE__);
- paTestUcRecoverAndExit (tf, pat, PA_TEST_FAILED);
- }
-
- /* Recycle the descriptor/buffer returned from the stats request */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_REQ_STATS_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find returned descriptor/buffer from stats request\n", tfName, __FILE__, __LINE__);
- paTestUcRecoverAndExit (tf, pat, PA_TEST_FAILED);
- }
-
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats request\n", tfName, __FILE__, __LINE__);
- paTestUcRecoverAndExit (tf, pat, PA_TEST_FAILED);
- }
-
-
- /* Format the stats response and compare to the expected results */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_STATS_REPLY])) & ~15);
- Cppi_getData (Cppi_DescType_HOST, (Cppi_Desc *)hd, &bp, &blen);
- paStats = Pa_formatStatsReply (tf->passHandle, (paCmd_t)bp);
-
-#ifndef __LINUX_USER_SPACE
- if (testCommonCompareStats (tfName, (paSysStats_t *)&paTucExpectedStats, paStats))
- result = PA_TEST_FAILED;
- else
- result = PA_TEST_PASSED;
-#else
- result = PA_TEST_PASSED;
-#endif
-
- /* Recycle the descriptor and associated buffer back to queue from which it came */
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats response\n", tfName, __FILE__, __LINE__);
- result = PA_TEST_FAILED;
- }
-
- paTestUcRecoverAndExit (tf, pat, result);
-#ifdef __LINUX_USER_SPACE
- return (void *)0;
-#endif
-
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/PAUnitTest2/tests/test10.c b/test/PAUnitTest2/tests/test10.c
+++ /dev/null
@@ -1,1422 +0,0 @@
-/*
- *
- * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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 "../pautest.h"
-
-#ifdef __LINUX_USER_SPACE
-#include "fw_test.h"
-#include "fw_mem_allocator.h"
-#endif
-
-/* IPv4 Fragmentation and PASS-assisted IP Reassembly test
- * This test tests the LLD and firmware the ability to perform IPv4 fragmentation
- * on egress packets per IP fragmentation command and detect and forward the IP fragments
- * and packets of any active traffic flow to host. An IP reassembly sample code is used to
- * perform IP reassembly and forward the reassembled packets back to PASS for further
- * classification.
- *
- * This test invokes the following LLD APIs:
- * - Pa_addMac
- * - Pa_addIp
- * - Pa_addPort
- * - Pa_delL4Handle
- * - Pa_delHandle
- * - Pa_control
- * - Pa_forwardResult
- * - Pa_requestStats
- * - Pa_formatStatsReply
- * - Pa_formatTxCmd
- *
- * The test procedure is described below:
- * - Call Pa_control to enable the PASS-assisted IP Reassembly support
- * - Call Pa_addMac, Pa_addIp and Pa_addPort to setup the receiving paths
- * - Send variable-length packets to PDSP5 for UDP checksum calculation
- * and IP fragmentation if the payload size is larger than the desired MTU size.
- * - Both fragmented and non-fragmented packets will be delivered to PDSP0 for
- * classification
- * - The IP fragments and the non-fragmented packet within an active traffic flow are
- * detected and delivered to the specified host queue for reassembly
- * - Both reassembled and pass-through packets are sent back to the corresponding PDSP for
- * continuous parsing and classification
- * - Packets are delivered to the matching queue upon the final UDP lookup
- *
- * This test has the following sub-tests
- * Tx Command (IP Fragmentation, CRC calculation and Routing):
- * - Test the ability to format a set of tx commands
- * - Test the firmware ability to calculate and verify CRC checksum
- * - Test the firmware ability to perform IPv4 fragmentation
- * - Test the firmware ability to route the fragments and packets to their destination queues
- * PASS-assisted IPv4 Reassembly
- * - Test the ability to configure PASS-assisted IP Reassembly
- * - Test the firmware for the ability to detect IP fragments
- * - Test the firmware for the ability to allocate and free traffic flows
- * - Test the firmware for the ability to identify active traffic flow per packet and forward the packet
- * to the configured host queue
- * - Test the firmware for the ability to process the reassembled and pass-through packets
- */
- #include "reassemLib.h"
-
- static char *tfName = "paTestIPv4FragReassem";
-
- #define T10_NUM_PACKET_GROUPS 10 /* Number of packet groups where each group contains packets with specified payload size */
-
- /* General purpose queue usage */
- #define Q_CMD_RECYCLE 0 /* Command descriptors/buffers recycled here after sent to PA */
- #define Q_CMD_REPLY 1 /* Replies from PA routed here */
- #define Q_MATCH 2 /* Packets from PA which match a lookup criteria */
- #define Q_NFAIL 3 /* Packets from PA which matches a mac lookup, but failed an L3 lookup */
- #define Q_PARSE_ERR 4 /* Packets which resulted in a parse error */
- #define Q_DPKT_RECYCLE 5 /* Data packet recycle queue */
- #define Q_IP_REASSM1 6 /* IP Reassembly Input Queue 1 (Outer IP) */
- #define Q_IP_REASSM2 7 /* IP Reassembly Input Queue 2 (Inner IP) */
-
- #define Q_IP_FRAG 13 /* IP Fragmentation */
-
-#include "test10pkts.h"
-
-/* The number of PA L2 and L3 handles maintained by this test */
-#define T10_NUM_LOCAL_L2_HANDLES (sizeof(t10EthSetup)/sizeof(t10EthSetup_t))
-#define T10_NUM_LOCAL_L3_HANDLES (sizeof(t10IpSetup)/sizeof(t10IpSetup_t))
-#define T10_NUM_LOCAL_L4_HANDLES (sizeof(t10UdpSetup)/sizeof(t10UdpSetup_t))
-#define T10_NUM_GEN_CONFIGS 10 /* Maxmium number of general configuration commands */
-
- /* L3 handles are managed. This structure is used to track the handle and
- * the activation state state of the handle */
-enum {
- T10_HANDLE_UNCONFIGURED = 0,
- T10_HANDLE_PENDING_ACK,
- T10_HANDLE_ACTIVE,
- T10_HANDLE_DISABLED
-};
-
-#define T10_CMD_SWINFO0_TYPE_MASK 0xffff0000
-#define T10_CMD_SWINFO0_ID_MASK 0x0000ffff
-
-/* SWInfo values on command replies */
-#define T10_CMD_SWINFO0_ADD_MAC_ID 0xa1110000
-#define T10_CMD_SWINFO0_ADD_IP_ID 0xa1120000
-#define T10_CMD_SWINFO0_ADD_PORT_ID 0xa1130000
-#define T10_CMD_SWINFO0_GLOBAL_CFG_ID 0xa1140000
-#define T10_CMD_SWINFO0_DEL_MAC_ID 0xa0010000
-#define T10_CMD_SWINFO0_DEL_IP_ID 0xa0020000
-#define T10_CMD_SWINFO0_DEL_PORT_ID 0xa0030000
-
- typedef struct t10Handles_s {
-
- paHandleL2L3_t paHandle; /* The L3 handle returned by the PA LLD */
-
- uint32_t state; /* T4_HANDLE_UNCONFIGURED = handle not configured
- * T4_HANDLE_PENDING_ACK = handle configured and sent to pa
- * T4_HANDLE_ACTIVE = handle creation acknowledged by pa
- * T4_HANDLE_DISABLED = handle was created then released */
- uint32_t linkCnt;
-
- } t10Handles_t;
-
- typedef struct t10HandlesL4_s {
-
- paHandleL4_t paHandle;
-
- uint32_t state;
-
- } t10HandlesL4_t;
-
- /* A grouping of run time created grouped together to make cleanup easier on
- * error exit */
-
- typedef struct t10TestEncap_s {
- tFramework_t *tf;
- paTest_t *pat;
-
- /* There is one base packet for each L3 table entry */
- Cppi_HostDesc *hd[T10_NUM_LOCAL_L3_HANDLES];
-
- /* The command to the modify PDSP to add the TCP/UDP checksum and route to PA receive */
- uint32_t cmdStack[T10_NUM_LOCAL_L4_HANDLES][(2 * sizeof(pasahoNextRoute_t) + sizeof(pasahoComChkCrc_t) + sizeof(pasahoIpFrag_t) + sizeof(pasahoComBlindPatch_t)) / sizeof (uint32_t)];
-
- /* The +1 is a place holder handle used to pass known invalid configuration into the PA LLD */
- t10Handles_t l2Handles[T10_NUM_LOCAL_L2_HANDLES]; /* MAC handles */
- t10Handles_t l3Handles[T10_NUM_LOCAL_L3_HANDLES]; /* IP handles */
- t10HandlesL4_t l4Handles[T10_NUM_LOCAL_L4_HANDLES+1]; /* UDP/TCP handles */
- uint32_t genCmdAck[T10_NUM_GEN_CONFIGS]; /* General configurations */
-
-
- } t10TestEncap_t;
-
-static paSysStats_t paTestL4ExpectedStats; /* Expected stats results */
-
-/* Global configurations */
-static paIpReassmConfig_t t10OutIpReassmCfg =
- {
- 2, /* Number of traffic Flow */
- 0, /* CPPI Flow */
- TF_FIRST_GEN_QUEUE + Q_IP_REASSM1 /* destination queue */
- };
-
-static paIpReassmConfig_t t10InIpReassmCfg =
- {
- 2, /* Number of traffic Flow */
- 0, /* CPPI Flow */
- TF_FIRST_GEN_QUEUE + Q_IP_REASSM2 /* destination queue */
- };
-
-
-static paSysConfig_t t10GlobalCfg =
- {
- NULL, /* pProtoLimit */
- &t10OutIpReassmCfg, /* pOutIpReassmConfig */
- &t10InIpReassmCfg, /* pInIpReassmConfig */
- NULL, /* pCmdSetConfig */
- NULL, /* pUsrStatsConfig */
- NULL, /* pQueueDivertConfig */
- NULL /* pPktVerify */
- };
-
-static paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
-static paRouteInfo_t matchRoute[3] = { { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}, /* No commands */
-
- { pa_DEST_CONTINUE_PARSE_LUT1,/* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : pa_CUSTOM_TYPE_NONE */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}, /* No commands */
-
- { pa_DEST_CONTINUE_PARSE_LUT2,/* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : pa_CUSTOM_TYPE_NONE */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL} /* No commands */
- };
-static paRouteInfo_t nfailRoute = { pa_DEST_DISCARD, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}; /* No commands */
-
-
-#pragma DATA_SECTION(t10Encap, ".testPkts")
-static t10TestEncap_t t10Encap;
-
-static void t10Cleanup (t10TestEncap_t *tencap, paTestStatus_t status)
-{
- int32_t i;
- int32_t cmdDest;
- uint16_t cmdSize;
- paReturn_t paret;
- paTestStatus_t newStatus;
- Cppi_HostDesc *hd;
-
- /* Wait a bit for any packets in PA to complete */
- utilCycleDelay (5000);
-
- /* Return the descriptors which are pointing to packets */
- for (i = 0; i < T10_NUM_LOCAL_L4_HANDLES; i++) {
- if (tencap->hd[i] != NULL)
- Qmss_queuePushDesc (tencap->tf->QfreeDesc, (Ptr) tencap->hd[i]);
- }
-
- /* Delete active L4 handles */
- for (i = 0; i < T10_NUM_LOCAL_L4_HANDLES; i++) {
-
- cmdReply.replyId = T10_CMD_SWINFO0_DEL_PORT_ID + i;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- if ((tencap->l4Handles[i].state == T10_HANDLE_PENDING_ACK) || (tencap->l4Handles[i].state == T10_HANDLE_ACTIVE)) {
- hd = testCommonDelL4Handles (tencap->tf, tencap->l4Handles[i].paHandle, tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- status = PA_TEST_FAILED;
- continue;
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- /* Wait for the response */
- if (testCommonWaitCmdReply (tencap->tf, tencap->pat, tfName, cmdReply.queue, cmdReply.replyId, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonWaitCmdReply failed\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- }
-
- /* Recycle the command packet as well */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- continue;
- }
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
- }
-
- /* Delete active L3 Handles */
- for (i = 0; i < T10_NUM_LOCAL_L3_HANDLES; i++) {
- cmdReply.replyId = T10_CMD_SWINFO0_DEL_IP_ID + i;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- if ((tencap->l3Handles[i].state == T10_HANDLE_PENDING_ACK) || (tencap->l3Handles[i].state == T10_HANDLE_ACTIVE)) {
- hd = testCommonDelHandle (tencap->tf, &tencap->l3Handles[i].paHandle, tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- status = PA_TEST_FAILED;
- continue;
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestL4ExpectedStats.classify1.nPackets += 1;
-
- /* Wait for the response */
- if (testCommonWaitCmdReply (tencap->tf, tencap->pat, tfName, cmdReply.queue, cmdReply.replyId, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonWaitCmdReply failed\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- }
- /* Recycle the command packet as well */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- continue;
- }
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
- }
-
- /* Delete active L2 Handles */
- for (i = 0; i < T10_NUM_LOCAL_L2_HANDLES; i++) {
- cmdReply.replyId = T10_CMD_SWINFO0_DEL_MAC_ID + i; /* T2_CMD_SWINFO0_ADD_ID identifies command, 16 LS bits identify the local handle number */
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- if ((tencap->l2Handles[i].state == T10_HANDLE_PENDING_ACK) || (tencap->l2Handles[i].state == T10_HANDLE_ACTIVE)) {
- hd = testCommonDelHandle (tencap->tf, &tencap->l2Handles[i].paHandle, tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- status = PA_TEST_FAILED;
- testCommonRecycleLBDesc (tencap->tf, hd);
- continue;
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestL4ExpectedStats.classify1.nPackets += 1;
-
- /* Wait for the response */
- if (testCommonWaitCmdReply (tencap->tf, tencap->pat, tfName, cmdReply.queue, cmdReply.replyId, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonWaitCmdReply failed\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- }
-
- /* Recycle the command packet as well */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- continue;
- }
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
- }
-
- /* Pop any descriptors off of the return queues and restore them to the linked buffer queues or the free Q */
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_CMD_RECYCLE])> 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_CMD_REPLY]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_REPLY])) & ~15);
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_MATCH]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_MATCH])) & ~15);
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_NFAIL]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_NFAIL])) & ~15);
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_PARSE_ERR]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_PARSE_ERR])) & ~15);
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_IP_REASSM1]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_IP_REASSM1])) & ~15);
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_IP_REASSM2]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_IP_REASSM2])) & ~15);
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_DPKT_RECYCLE]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_DPKT_RECYCLE])) & ~15);
- Qmss_queuePush (tencap->tf->QfreeDesc, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- }
-
- newStatus = testCommonCheckStats (tencap->tf, tencap->pat, tfName, &paTestL4ExpectedStats, tencap->tf->QLinkedBuf1,
- tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QGen[Q_CMD_REPLY], TRUE);
-
- if (newStatus == PA_TEST_FAILED)
- status = PA_TEST_FAILED;
-
- /* Return result */
- tencap->pat->testStatus = status;
-
- /* Return */
- Task_exit();
-}
-
-static void t10CmdRep (t10TestEncap_t *tencap)
-{
- Cppi_HostDesc *hd;
- uint32_t *swinfo;
- paReturn_t paret;
- uint32_t swinfoType;
- uint32_t swinfoIdx;
- paEntryHandle_t reth;
- int32_t htype;
- int32_t cmdDest;
- char *s;
- uint32_t *stateP;
- uint32_t stateV;
- int32_t max;
-
- while (Qmss_getQueueEntryCount(tencap->tf->QGen[Q_CMD_REPLY]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_REPLY])) & ~15);
-
- Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **)&swinfo);
-
- swinfoType = swinfo[0] & T10_CMD_SWINFO0_TYPE_MASK;
- swinfoIdx = swinfo[0] & T10_CMD_SWINFO0_ID_MASK;
-
- paret = Pa_forwardResult (tencap->tf->passHandle, (void *)hd->buffPtr, &reth, &htype, &cmdDest);
-
-
- switch (swinfoType) {
-
- case T10_CMD_SWINFO0_ADD_MAC_ID:
- stateP = &tencap->l2Handles[swinfoIdx].state;
- stateV = T10_HANDLE_ACTIVE;
- max = T10_NUM_LOCAL_L2_HANDLES;
- s = "pa_addMac";
- break;
-
- case T10_CMD_SWINFO0_ADD_IP_ID:
- stateP = &tencap->l3Handles[swinfoIdx].state;
- stateV = T10_HANDLE_ACTIVE;
- max = T10_NUM_LOCAL_L3_HANDLES;
- s = "pa_addIp";
- break;
-
- case T10_CMD_SWINFO0_ADD_PORT_ID:
- stateP = &tencap->l4Handles[swinfoIdx].state;
- stateV = T10_HANDLE_ACTIVE;
- max = T10_NUM_LOCAL_L4_HANDLES;
- s = "pa_addPort";
- break;
-
- case T10_CMD_SWINFO0_DEL_MAC_ID:
- stateP = &tencap->l2Handles[swinfoIdx].state;
- stateV = T10_HANDLE_DISABLED;
- max = T10_NUM_LOCAL_L2_HANDLES;
- s = "pa_delMac";
- break;
-
- case T10_CMD_SWINFO0_DEL_IP_ID:
- stateP = &tencap->l3Handles[swinfoIdx].state;
- stateV = T10_HANDLE_DISABLED;
- max = T10_NUM_LOCAL_L3_HANDLES;
- s = "pa_delIp";
- break;
-
- case T10_CMD_SWINFO0_DEL_PORT_ID:
- stateP = &tencap->l4Handles[swinfoIdx].state;
- stateV = T10_HANDLE_DISABLED;
- max = T10_NUM_LOCAL_L4_HANDLES;
- s = "pa_delPort";
- break;
-
- case T10_CMD_SWINFO0_GLOBAL_CFG_ID:
- stateP = &tencap->genCmdAck[swinfoIdx];
- stateV = TRUE;
- max = T10_NUM_GEN_CONFIGS;
- s = "Pa_control";
- break;
-
- default:
- System_printf ("%s (%s:%d): Unknown command ID found in swinfo0 (0x%08x)\n", tfName, __FILE__, __LINE__, swinfo[0]);
- t10Cleanup (tencap, PA_TEST_FAILED);
- break;
-
- }
-
- /* In this test only valid responses are exected from PA */
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA command %s returned error code %d, Index = %d\n", tfName, __FILE__, __LINE__, s, paret, swinfoIdx);
- t10Cleanup (tencap, PA_TEST_FAILED);
- }
-
-
- if (swinfoIdx >= max) {
- System_printf ("%s (%s:%d): Received command ack (%s) for out of range handle (%d, max = %d)\n",
- tfName, __FILE__, __LINE__, s, swinfoIdx, max);
- t10Cleanup (tencap, PA_TEST_FAILED);
- }
-
- /* Response looks valid. Change the internal handle state */
- *stateP = stateV;
-
- /* Return the descriptor used to received the reply from PA */
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- /* Recycle the command packet */
- while (Qmss_getQueueEntryCount(tencap->tf->QGen[Q_CMD_RECYCLE]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- continue;
- }
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
-}
-
-static paTestStatus_t t10GlobalConfiguration (t10TestEncap_t *tencap)
-{
- int32_t i;
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
- paCtrlInfo_t ctrlInfo;
-
- /* Issue the command set command */
- ctrlInfo.code = pa_CONTROL_SYS_CONFIG;
- ctrlInfo.params.sysCfg = t10GlobalCfg;
- cmdReply.replyId = T10_CMD_SWINFO0_GLOBAL_CFG_ID;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
- hd = testCommonGlobalConfig (tencap->tf, &ctrlInfo,
- tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf3,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (hd == NULL) {
-
- System_printf ("%s: (%s:%d): Failure in GlobalConfig command\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- /* Send command */
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- tencap->genCmdAck[0] = FALSE;
-
- /* All the packets should have been acked */
- for (i = 0; i < 100; i++) {
- t10CmdRep (tencap);
-
- if (tencap->genCmdAck[0])
- break;
- else
- utilCycleDelay (500);
- }
-
- if (i == 100) {
- System_printf ("%s: (%s:%d): Pa_control commands was not acked\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
- return (PA_TEST_PASSED);
-}
-
-static paTestStatus_t t10OpenL2 (t10TestEncap_t *tencap, t10EthSetup_t *ethSetup, int32_t nL2Handles)
-{
- int32_t i, j, m;
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
-
- for (i = 0; i < nL2Handles; i++) {
- cmdReply.replyId = T10_CMD_SWINFO0_ADD_MAC_ID + i;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- hd = testCommonAddMac (tencap->tf, pa_LUT1_INDEX_NOT_SPECIFIED, (paEthInfo_t *)&t10EthSetup[i].ethInfo, &matchRoute[1], &nfailRoute,
- &tencap->l2Handles[i].paHandle, tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (hd == NULL) {
-
- System_printf ("%s: (%s:%d): Failure in common addMac command, entry number %d\n", tfName, __FILE__, __LINE__, i);
- t10Cleanup (tencap, PA_TEST_FAILED);
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- tencap->l2Handles[i].state = T10_HANDLE_PENDING_ACK;
- paTestL4ExpectedStats.classify1.nPackets += 1;
-
- t10CmdRep (tencap);
- }
-
- /* All the packets should have been acked */
- for (i = 0; i < 100; i++) {
- t10CmdRep (tencap);
-
- for (j = m = 0; j < nL2Handles; j++) {
- if (tencap->l2Handles[j].state == T10_HANDLE_ACTIVE)
- m += 1;
- }
-
- if (m == nL2Handles)
- break;
- else
- utilCycleDelay (1000);
- }
-
- if (i == 100) {
- System_printf ("%s: (%s:%d): %d (out of %d) pa_addMac commands were acked\n", tfName, __FILE__, __LINE__, m, nL2Handles);
- return (PA_TEST_FAILED);
- }
- return (PA_TEST_PASSED);
-}
-
-static paTestStatus_t t10OpenL3 (t10TestEncap_t *tencap, t10IpSetup_t *ipSetup, int32_t nL3Handles)
-{
- int32_t i, j;
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
-
- for (i = 0; i < nL3Handles; i++) {
- cmdReply.replyId = T10_CMD_SWINFO0_ADD_IP_ID + i;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- hd = testCommonAddIp (tencap->tf, pa_LUT1_INDEX_NOT_SPECIFIED, &t10IpSetup[i].ipInfo,
- t10IpSetup[i].nextLut1?&matchRoute[1]:&matchRoute[2],
- &nfailRoute,
- &tencap->l3Handles[i].paHandle,
- t10IpSetup[i].innerIp?tencap->l3Handles[t10IpSetup[i].lHandleIdx].paHandle:
- tencap->l2Handles[t10IpSetup[i].lHandleIdx].paHandle,
- tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
-
- if (hd == NULL) {
-
- System_printf ("%s: (%s:%d): Failure in common addIp command, entry number %d\n", tfName, __FILE__, __LINE__, i);
- t10Cleanup (tencap, PA_TEST_FAILED);
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- tencap->l3Handles[i].state = T10_HANDLE_PENDING_ACK;
- paTestL4ExpectedStats.classify1.nPackets += 1;
-
- for (j = 0; j < 100; j++) {
- utilCycleDelay (1000);
- t10CmdRep (tencap);
- if (tencap->l3Handles[i].state == T10_HANDLE_ACTIVE)
- {
- t10IpSetup[i].acked = TRUE;
- break;
- }
- }
-
- if (j == 100) {
- System_printf ("%s: (%s:%d): pa_addIp command (%d) were not acked\n", tfName, __FILE__, __LINE__, i);
- return (PA_TEST_FAILED);
- }
- }
-
- return (PA_TEST_PASSED);
-}
-
-
-static paTestStatus_t t10OpenL4 (t10TestEncap_t *tencap, t10UdpSetup_t *udpSetup, int32_t nL4Handles)
-{
- int32_t i, j, m;
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
-
- for (i = 0; i < nL4Handles; i++) {
-
- cmdReply.replyId = T10_CMD_SWINFO0_ADD_PORT_ID + i;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
- matchRoute[0].swInfo0 = T10_SWINFO0_PKT_ID + i;
-
- hd = testCommonAddPort (tencap->tf, pa_LUT2_PORT_SIZE_16, udpSetup[i].port, &matchRoute[0], &tencap->l4Handles[i].paHandle,
- &tencap->l3Handles[udpSetup[i].lHandleIdx].paHandle,
- tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1, &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (hd == NULL) {
-
- System_printf ("%s: (%s:%d): Failure in common addPort command, entry number %d\n", tfName, __FILE__, __LINE__, i);
- t10Cleanup (tencap, PA_TEST_FAILED);
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestL4ExpectedStats.classify2.nPackets += 1;
- tencap->l4Handles[i].state = T10_HANDLE_PENDING_ACK;
- utilCycleDelay (600);
-
- t10CmdRep (tencap);
- }
-
- /* All the packets should have been acked */
- for (i = 0; i < 100; i++) {
- t10CmdRep (tencap);
-
- for (j = m = 0; j < nL4Handles; j++) {
- if (tencap->l4Handles[j].state == T10_HANDLE_ACTIVE)
- m += 1;
- }
-
- if (m == nL4Handles)
- break;
- else
- utilCycleDelay (1000);
- }
-
- if (i == 100) {
- System_printf ("%s: (%s:%d): %d (out of %d) pa_addPort commands were acked\n", tfName, __FILE__, __LINE__, m, nL4Handles);
- return (PA_TEST_FAILED);
- }
-
- return (PA_TEST_PASSED);
-}
-
-
-static void t10UpdatesStats(paSysStats_t *stats, int32_t pktIndex, uint16_t pktLen, uint16_t mtuSize, uint16_t ipOffset, int32_t innerIp, int32_t first)
-{
-
- int32_t numFrags;
- uint16_t fragSize, lastFragSize;
- uint16_t payloadSize;
- static int32_t fFrags[T10_NUM_LOCAL_L4_HANDLES] = {FALSE, FALSE, FALSE, FALSE};
-
-
- /* Reset the fragement flag when the first packet in this packet straem is generated */
- if(first)fFrags[pktIndex] = FALSE;
-
- payloadSize = (pktLen - ipOffset) - 20;
- lastFragSize = mtuSize - 20;
- fragSize = lastFragSize & 0xFFF8;
-
- numFrags = 1;
- while (payloadSize > lastFragSize)
- {
- numFrags += 1;
- payloadSize -= fragSize;
- }
-
- if (numFrags > 1)
- {
- fFrags[pktIndex] = TRUE;
- stats->classify1.nTxIpFrag += numFrags;
- stats->classify1.nIpFrag += numFrags;
- }
-
- /* MAC update due to fragments */
- stats->classify1.nPackets += (numFrags - 1);
- stats->classify1.nTableMatch += (numFrags - 1);
-
- /* Outer IP updates due to fragments */
- if (innerIp)
- {
- stats->classify1.nPackets += (numFrags - 1);
- stats->classify1.nTableMatch += (numFrags - 1);
- stats->classify1.nIpv4Packets += (numFrags - 1);
- }
-
- /* IP Reassembly updates */
- if (fFrags[pktIndex])
- {
- stats->classify1.nPackets += numFrags;
- }
-
-}
-
-static void t10IpRreassemTimeoutUpdatesStats(paSysStats_t *stats, uint32_t count)
-{
- stats->classify1.nIpv4Packets -= count;
- stats->classify1.nTableMatch -= count;
- stats->classify2.nUdp -= count;
- stats->classify2.nPackets -= count;
-}
-
-static paTxChksum_t t10pktChksum = { /* The UDP checksum command */
-
- 0, /* Start offset of UDP header */
- 0, /* Checksum length (UDP header + payload */
- 6, /* Offset to checksum location RELATIVE TO THE START OF THE TCP/UDP HEADER */
- 0, /* Initial value is IPv4 pseudo header checksum value */
- 1 /* computed value of 0 written as -0 */
-
- };
-
-static paCmdNextRoute_t t10pktRoute1 = { pa_NEXT_ROUTE_PARAM_PRESENT, /* ctrlBitfield */
- pa_DEST_HOST, /* Dest */
- 0, /* pkyType: for SRIO only */
- 0, /* Flow ID */
- 645, /* queue */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0}; /* Multi route */
-
-#if 1
-static paCmdNextRoute_t t10pktRoute2 = { pa_NEXT_ROUTE_PARAM_PRESENT | /* ctrlBitfield */
- pa_NEXT_ROUTE_PROC_NEXT_CMD,
- pa_DEST_HOST, /* Dest */
- 0, /* pkyType: for SRIO only */
- 0, /* Flow ID */
- 640, /* queue */
- 0x12345678, /* sw Info 0 */
- 0x87654321, /* sw Info 1 */
- 0}; /* Multi route */
-#else
-static paCmdNextRoute_t t10pktRoute2 = { pa_NEXT_ROUTE_PARAM_PRESENT, /* ctrlBitfield */
- pa_DEST_HOST, /* Dest */
- 0, /* pkyType: for SRIO only */
- 0, /* Flow ID */
- 640, /* queue */
- 0x12345678, /* sw Info 0 */
- 0x87654321, /* sw Info 1 */
- 0}; /* Multi route */
-#endif
-
-static paCmdIpFrag_t t10pktIpFrag = {
- 0, /* ipOffset */
- 256 /* mtuSize */
- };
-
-static paPatchInfo_t t10pktPatch = { /* The Blind patch command */
-
- 0, /* ctrlBitfield (Overwrite) */
- 8, /* The number of bytes to be patched */
- 8, /* The number of patch bytes in the patch command */
- 0, /* offset */
- 0 /* Pointer to the patch data */
-
- };
-
-
-static uint16_t t10MtuSize[T10_NUM_LOCAL_L4_HANDLES] = {68, 200, 300, 512};
-
-static uint16_t t10pktPayloadSize[T10_NUM_LOCAL_L4_HANDLES][10] =
-{
- {100, 20, 60, 80, 100, 120, 200, 60, 40, 20}, /* MTU size = 68 */
- {60, 300, 500, 120, 400, 250, 100, 500, 80, 300}, /* MTU size = 200 */
- {300, 60, 500, 600, 400, 100, 100, 700, 350, 100}, /* MTU size = 300 */
- {100, 500, 550, 60, 900, 600, 400, 850, 1500, 1000}, /* MTU size = 512 */
-};
-
-#ifndef __LINUX_USER_SPACE
-static uint8_t t10pktBuf[T10_NUM_LOCAL_L4_HANDLES][1500];
-#else
-static uint8_t* t10pktBuf[T10_NUM_LOCAL_L4_HANDLES];
-#endif
-
-static void t10SendDataPkts (t10TestEncap_t *tencap, int32_t nL4Handles, int32_t group, int32_t fFirst)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- int32_t i;
- uint16_t cmdStackSize;
- paReturn_t paret;
- uint8_t *buf;
- uint16_t payloadLen;
- paCmdInfo_t cmdInfo[5];
- paTxChksum_t *pTxChksum = &cmdInfo[0].params.chksum;
- paPatchInfo_t *pTxPatch = &cmdInfo[4].params.patch;
- int32_t ipOffset, ipOffset2, udpOffset;
- volatile int32_t mdebugWait = 1;
-
- /* Group 1: UDP checksum */
- cmdInfo[0].cmd = pa_CMD_TX_CHECKSUM;
- cmdInfo[0].params.chksum = t10pktChksum;
- cmdInfo[1].cmd = pa_CMD_NEXT_ROUTE;
- cmdInfo[1].params.route = t10pktRoute1;
- /* Group 2: IP fragmentation plus Blind Patch (Simulating AH haeder patch) */
- cmdInfo[2].cmd = pa_CMD_IP_FRAGMENT;
- cmdInfo[2].params.ipFrag= t10pktIpFrag;
- cmdInfo[3].cmd = pa_CMD_NEXT_ROUTE;
- cmdInfo[3].params.route = t10pktRoute2;
- cmdInfo[4].cmd = pa_CMD_PATCH_DATA;
- cmdInfo[4].params.patch = t10pktPatch;
-
-
- /* Attach one free descriptor to each of the packets */
- for (i = 0; i < nL4Handles; i++) {
- tencap->hd[i] = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QfreeDesc)) & ~15);
-
- if (tencap->hd[i] == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a descriptor from the free queue (%d)\n", tfName, __FILE__, __LINE__, tencap->tf->QfreeDesc);
- t10Cleanup (tencap, PA_TEST_FAILED);
- }
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = tencap->tf->QGen[Q_DPKT_RECYCLE];
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)(tencap->hd[i]), q);
-
- buf = t10pktBuf[i];
- payloadLen = t10pktPayloadSize[i][group];
-
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)(tencap->hd[i]), (uint8_t *)utilgAddr((uint32_t)buf), (uint32_t)(t10PktInfo[i].pktLen + payloadLen));
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)(tencap->hd[i]), (uint32_t)t10PktInfo[i].pktLen + payloadLen);
-
- memcpy(buf, t10PktInfo[i].pkt, t10PktInfo[i].pktLen);
- testGenPayload(PAU_PAYLOAD_INC8, 0, payloadLen, &buf[t10PktInfo[i].pktLen]);
-
- /* Update the packet header and command based on the payload size */
- udpOffset = PASAHO_LINFO_READ_L4_OFFSET(t10PktInfo[i].info);
- ipOffset = PASAHO_LINFO_READ_L3_OFFSET(t10PktInfo[i].info);
- ipOffset2 = udpOffset - 20;
-
- if (ipOffset != ipOffset2)
- {
- /* It is IP over IP packet */
- buf[ipOffset + 2] = (payloadLen + 48) >> 8;
- buf[ipOffset + 3] = (payloadLen + 48) & 0xFF;
-
- buf[ipOffset + 5] = (uint8_t)group;
-
- // Update IP checksum
- utilUpdateIpChksums(&buf[ipOffset]);
- }
-
- buf[ipOffset2 + 2] = (payloadLen + 28) >> 8;
- buf[ipOffset2 + 3] = (payloadLen + 28) & 0xFF;
- buf[ipOffset2 + 5] = (uint8_t)group;
- buf[udpOffset + 4] = (payloadLen + 8) >> 8;
- buf[udpOffset + 5] = (payloadLen + 8) & 0xFF;
-
- // Update IP checksum
- utilUpdateIpChksums(&buf[ipOffset2]);
-
- pTxChksum->startOffset = udpOffset;
- pTxChksum->lengthBytes = payloadLen + 8;
- pTxChksum->initialSum = utilGetIpPsudoChkSum(&buf[ipOffset2], payloadLen + 8);
- cmdInfo[2].params.ipFrag.ipOffset = ipOffset2;
- cmdInfo[2].params.ipFrag.mtuSize = t10MtuSize[i];
- pTxPatch->offset = udpOffset + 8;
- pTxPatch->patchData = &buf[udpOffset + 8]; /* patch with the same data */
-
- cmdStackSize = sizeof(tencap->cmdStack[i]);
-
- paret = Pa_formatTxCmd ( 5,
- cmdInfo,
- 0,
- (Ptr)&tencap->cmdStack[i], /* Command buffer */
- &cmdStackSize); /* Command size */
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): Pa_formatTxCmd returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- t10Cleanup (tencap, PA_TEST_FAILED);
- }
-
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)(tencap->hd[i]), (uint8_t *)&tencap->cmdStack[i], cmdStackSize);
-
- /*
- * Write back the entire cache to make sure that the test packets are updated.
- * Note: It may be more efficient to call CACHE_wbL1d(blockPtr, byteCnt, wait) only for
- * the portion of packet which is updated.
- *
- */
-#ifndef __LINUX_USER_SPACE
- CACHE_wbAllL1d(CACHE_WAIT);
- //CACHE_wbAllL2(CACHE_WAIT);
-#endif
-
- /* Send the data to the modify PDSP */
- //mdebugHaltPdsp(1);
- Qmss_queuePush (tencap->tf->QPaTx[5], (Ptr)tencap->hd[i], (uint32_t)t10PktInfo[i].pktLen + payloadLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- //while (mdebugWait);
-
- testCommonIncStats (t10PktInfo[i].statsMap, &paTestL4ExpectedStats);
- t10UpdatesStats(&paTestL4ExpectedStats, i, t10PktInfo[i].pktLen + payloadLen, t10MtuSize[i], ipOffset2, ipOffset != ipOffset2, fFirst);
-
- }
-
- /* Wait for descriptors to return. It is assumed that they are returning in order. */
- for (i = 0; i < 100; i++) {
-
- if ((Qmss_getQueueEntryCount (tencap->tf->QGen[Q_DPKT_RECYCLE])) >= nL4Handles)
- break;
-
- utilCycleDelay (500);
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Timeout waiting for descriptors to modify PDSP to be recycled\n", tfName, __FILE__, __LINE__);
- t10Cleanup (tencap, PA_TEST_FAILED);
- }
-
- /* Recycle the descriptors */
- for (i = 0; i < nL4Handles; i++) {
- tencap->hd[i] = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_DPKT_RECYCLE])) & ~15);
- if (tencap->hd[i] == NULL) {
- System_printf ("%s (%s:%d): Failed to pop recycled data packet descriptor\n", tfName, __FILE__, __LINE__);
- t10Cleanup (tencap, PA_TEST_FAILED);
- }
-
- Qmss_queuePushDesc (tencap->tf->QfreeDesc, (Ptr) tencap->hd[i]);
- tencap->hd[i] = NULL;
-
- }
-
- /* Since the packets went to the modify PDSP and then back to the QM, a descriptor
- * and linked buffer was required while the packet was in the QM. This will
- * be recycled to the default recycle queue */
- while (Qmss_getQueueEntryCount(tencap->tf->QDefRet) > 0) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QDefRet)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Could not pop descriptor from default recycle queue\n", tfName, __FILE__, __LINE__);
- t10Cleanup (tencap, PA_TEST_FAILED);
- }
-
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
-}
-
-#define MAX_RX_FRAGS_PER_CALL 20
-
-static int32_t t10RxFrags(t10TestEncap_t *tencap, Qmss_QueueHnd inQ, Qmss_QueueHnd outQ, int* pExpCnt)
-{
- Cppi_HostDesc* hd[MAX_RX_FRAGS_PER_CALL];
- int fragCnt = 0;
- int i, j, mid;
-
- /* Process the received fragments */
- while ((Qmss_getQueueEntryCount(inQ) > 0) && (fragCnt < MAX_RX_FRAGS_PER_CALL)) {
-
- hd[fragCnt] = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (inQ)) & ~15);
- if (hd[fragCnt] == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a received packet from queue %d\n", tfName, __FILE__, __LINE__, inQ);
- return (-1);
- }
-
- fragCnt++;
-
- }
-
- /*
- * Send fragments to the reassembly function in alternative order to verify the the IP reassembly route support
- * multiple reassembly context simultaneouely.
- */
-
- mid = (fragCnt + 1)/2;
-
- for ( i = 0, j = mid; i < mid; i++, j++)
- {
- if (paEx_reassemLibProc(hd[i], outQ))
- {
- System_printf ("%s (%s:%d): sample_procPkts(%d) return error!\n", tfName, i, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tencap->tf, hd[i]);
- return (-1);
- }
-
- #ifndef SIMULATOR_SUPPORT
- /* There is a pending simulator timing prroblem. To be enabled after the simulator bug is fixed */
- if ((j == (fragCnt - 1)) && (i == (mid -1)))
- {
- uint32_t timeoutCnt;
- /*
- * Test IP Reassembly timeout:
- * This fragment (packet) should be the last one within its group
- * If it is an IP fragments, the paEx_reassemLibTimerTick() will flush out the remaining fragments
- * If it is the case, update the corresponding statistics and *pExpCnt
- */
- paIPReassemblyStats_t stats;
-
- paEx_reassemLibQueryStats(&stats, FALSE);
- timeoutCnt = stats.reassemblyTimeout;
-
- /* Verify the Reassembly timeout operation */
- paEx_reassemLibTimerTick(5001);
-
- /* adjust the expected statistics */
- paEx_reassemLibQueryStats(&stats, FALSE);
- timeoutCnt = stats.reassemblyTimeout - timeoutCnt;
-
- if (timeoutCnt)
- {
- t10IpRreassemTimeoutUpdatesStats(&paTestL4ExpectedStats, timeoutCnt);
- *pExpCnt -= timeoutCnt;
- }
-
- if (paEx_reassemLibProc(hd[j], outQ))
- {
- System_printf ("%s (%s:%d): sample_procPkts(%d) return error!\n", tfName, j, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tencap->tf, hd[j]);
- return (-1);
- }
-
- if (timeoutCnt)
- {
- paEx_reassemLibTimerTick(5001); /* kick out the last fragments */
- paTestL4ExpectedStats.classify1.nPackets++; /* There is an extra nullp acket entering PDSP1/PDSP2 */
- }
-
- }
- else
- #endif
- if (j < fragCnt)
- {
- if (paEx_reassemLibProc(hd[j], outQ))
- {
- System_printf ("%s (%s:%d): sample_procPkts(%d) return error!\n", tfName, j, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tencap->tf, hd[j]);
- return (-1);
- }
- }
- }
-
- /* Since the packets went to the modify PDSP and then back to the QM, a descriptor
- * and linked buffer was required while the packet was in the QM. This will
- * be recycled to the default recycle queue */
- while (Qmss_getQueueEntryCount(tencap->tf->QDefRet) > 0) {
- Cppi_HostDesc *hdNext;
- hd[0] = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QDefRet)) & ~15);
- if (hd[0] == NULL) {
- System_printf ("%s (%s:%d): Could not pop descriptor from default recycle queue\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- do
- {
- /* Goto the next descriptor. */
- hdNext = (Cppi_HostDesc*)Cppi_getNextBD(Cppi_DescType_HOST, (Cppi_Desc*)hd[0]);
- testCommonRecycleLBDesc (tencap->tf, hd[0]);
- } while((hd[0] = hdNext) != NULL);
-
- }
-
- return (0);
-}
-
-
-/* Search the receive data packet queue for received data packets. Remain in
- * this function until all buffers are restored to their respective queues */
-static int32_t t10ReceiveDataPkts (t10TestEncap_t *tencap, int expCount)
-{
- Cppi_HostDesc *hd;
- uint32_t *swInfo;
- pasahoLongInfo_t *pinfo;
- uint32_t infoLen;
- int32_t i;
- int32_t pktId = 0;
- uint32_t flags;
- uint32_t eflags;
- int32_t count = 0;
-
-
- for (i = 0; i < 100; i++) {
-
- utilCycleDelay (500);
-
- /* Process OutIp fragments */
- if (t10RxFrags(tencap, tencap->tf->QGen[Q_IP_REASSM1], tencap->tf->QPaTx[1], &expCount))
- {
- return (-1);
-
- }
-
- /* Process Inner fragments */
- if (t10RxFrags(tencap, tencap->tf->QGen[Q_IP_REASSM2], tencap->tf->QPaTx[2], &expCount))
- {
- return (-1);
- }
-
- /* Look for packets in the rx packet queue, verify that the UDP port found matches the next value in
- * the fifo, then verify the receive packet information */
- while (Qmss_getQueueEntryCount(tencap->tf->QGen[Q_MATCH]) > 0) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_MATCH])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a received packet\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- /* Verify swInfo0 for packet match and packet ID number */
- Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **)&swInfo);
-
- if ((*swInfo & T10_CMD_SWINFO0_TYPE_MASK) != T10_SWINFO0_PKT_ID) {
- System_printf ("%s (%s:%d): Found a packet in the receive packet queue but with incorrect swinfo0 Id: 0x%08x\n",
- tfName, __FILE__, __LINE__, *swInfo);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- pktId = *swInfo & T10_CMD_SWINFO0_ID_MASK;
-
- if (pktId >= T10_NUM_LOCAL_L4_HANDLES) {
- System_printf ("%s (%s:%d): Found a packet with unexpected packet id %d (max = %d)\n",
- tfName, __FILE__, __LINE__, pktId, T10_NUM_LOCAL_L4_HANDLES - 1);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- /* Verify the parse information is correct */
- if (Cppi_getPSData (Cppi_DescType_HOST, Cppi_PSLoc_PS_IN_DESC, (Cppi_Desc *)hd, (uint8_t **)&pinfo, &infoLen) != CPPI_SOK) {
- System_printf ("%s (%s:%d): Error getting control info from received data packet\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- flags = PASAHO_LINFO_READ_HDR_BITMASK(pinfo);
-
- if ((flags & (PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_TCP)) == 0) {
- System_printf ("%s (%s:%d): Found a packet without any L4 info\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
-
- if (testCommonComparePktInfo (tfName, t10PktInfo[pktId].info, pinfo)) {
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- eflags = Cppi_getDescError (Cppi_DescType_HOST, (Cppi_Desc *)hd) & 0xf;
-
-
- if (eflags != 0) {
- System_printf ("%s (%s:%d): Packet with index %d returned with error flags = 0x%02x\n", tfName, __FILE__, __LINE__, pktId, eflags);
- }
-
-
- /* Return the descriptor/buffer */
- testCommonRecycleLBDesc (tencap->tf, hd);
-
- count++;
-
- }
-
- if(count >= expCount)
- break;
-
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Error - unable to recover all packets (%d/%d)\n", tfName, __FILE__, __LINE__, count, expCount);
- System_flush();
- return (-1);
- }
-
- /* Since the packets went to the modify PDSP and then back to the QM, a descriptor
- * and linked buffer was required while the packet was in the QM. This will
- * be recycled to the default recycle queue */
- while (Qmss_getQueueEntryCount(tencap->tf->QDefRet) > 0) {
- Cppi_HostDesc *hdNext;
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QDefRet)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Could not pop descriptor from default recycle queue\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- do
- {
- /* Goto the next descriptor. */
- hdNext = (Cppi_HostDesc*)Cppi_getNextBD(Cppi_DescType_HOST, (Cppi_Desc*)hd);
- testCommonRecycleLBDesc (tencap->tf, hd);
- } while((hd = hdNext) != NULL);
- }
-
- return (0);
-
-}
-
-int32_t paT10NumTestPkts = T10_NUM_LOCAL_L4_HANDLES;
-
-#ifdef __LINUX_USER_SPACE
-void* paTestIPv4FragReassem (void *args)
-{
- void *a0 = (void *)((paTestArgs_t *)args)->tf;
- void *a1 = (void *)((paTestArgs_t *)args)->pat;
-#else
-void paTestIPv4FragReassem (UArg a0, UArg a1)
-{
-#endif
- int32_t i,k;
- paTestStatus_t newStatus;
- volatile int32_t mdebugWait = 1;
- paIPReassemblyConfig_t ipReassemCfg;
-
- /* Initialize the test state */
- memset (&t10Encap, 0, sizeof(t10Encap));
- t10Encap.tf = (tFramework_t *)a0;
- t10Encap.pat = (paTest_t *)a1;
- for (i = 0; i < T10_NUM_LOCAL_L4_HANDLES; i++)
- t10Encap.l4Handles[i].state = T10_HANDLE_UNCONFIGURED;
- for (i = 0; i < T10_NUM_LOCAL_L3_HANDLES; i++)
- t10Encap.l3Handles[i].state = T10_HANDLE_UNCONFIGURED;
- for (i = 0; i < T10_NUM_LOCAL_L2_HANDLES; i++)
- t10Encap.l2Handles[i].state = T10_HANDLE_UNCONFIGURED;
- for (i = 0; i < T10_NUM_LOCAL_L4_HANDLES; i++)
- t10Encap.hd[i] = NULL;
-
-#ifdef __LINUX_USER_SPACE
- for (i = 0; i < T10_NUM_LOCAL_L4_HANDLES; i++) {
- /* Allocate memory for the Packet buffers */
- t10pktBuf[i] = (uint8_t *)fw_memAlloc(1500, CACHE_LINESZ);
- if(t10pktBuf[i] == NULL) {
- printf ("%s: memAlloc failed for pkt %d\n", tfName, i);
- t10Encap.pat->testStatus = PA_TEST_FAILED;
- return (void *)0;
- }
- }
-#endif
-
- /* Runtime initial values */
- matchRoute[0].queue = (uint16_t) t10Encap.tf->QGen[Q_MATCH];
- nfailRoute.queue = (uint16_t) t10Encap.tf->QGen[Q_NFAIL];
- cmdReply.queue = (uint16_t) t10Encap.tf->QGen[Q_CMD_REPLY];
-
- /* Zero out the expected stats. The stats will be updated as packets are sent into PA */
- memset (&paTestL4ExpectedStats, 0, sizeof(paTestL4ExpectedStats));
-
- /* Initialize the reassembly control blocks */
- memset(&ipReassemCfg, 0, sizeof(paIPReassemblyConfig_t));
- ipReassemCfg.timeout = 5000;
- ipReassemCfg.descSize = TF_SIZE_DESC;
- ipReassemCfg.numReassemblyContexts = 10;
-
- if (paEx_reassemLibInit(&ipReassemCfg))
- {
- System_printf ("%s (%s:%d): sample_initIPReassembly fail\n", tfName, __FILE__, __LINE__);
- t10Cleanup (&t10Encap, PA_TEST_FAILED);
- }
-
- /* Global Configuration */
- newStatus = t10GlobalConfiguration (&t10Encap);
- if (newStatus == PA_TEST_FAILED)
- t10Cleanup (&t10Encap, newStatus); /* No return */
-
- /* Burst in the L2 configuraton */
- newStatus = t10OpenL2 (&t10Encap, t10EthSetup, T10_NUM_LOCAL_L2_HANDLES);
- if (newStatus == PA_TEST_FAILED)
- t10Cleanup (&t10Encap, newStatus); /* No return */
-
- /* Burst in the L3 configuration */
- newStatus = t10OpenL3 (&t10Encap, t10IpSetup, T10_NUM_LOCAL_L3_HANDLES);
- if (newStatus == PA_TEST_FAILED)
- t10Cleanup (&t10Encap, newStatus);
-
- /* Burst in the L3 configuration */
- newStatus = t10OpenL4 (&t10Encap, t10UdpSetup, T10_NUM_LOCAL_L4_HANDLES);
- if (newStatus == PA_TEST_FAILED)
- t10Cleanup (&t10Encap, newStatus);
-
- /* Send the packets. Use the modify PDSP to generate the TCP/UDP checksums.
- * Use the modify PDSP to genertae IP fragments if necessary */
-
- for (k = 0; k < T10_NUM_PACKET_GROUPS; k+=2) {
-
- /*
- * There are 4 streams of variable-size packets
- * Send multiple test groups at a time to verify the followings:
- * - PASS can maintain multiple traffic flows
- * - PASS will forward both fragments and non-fragmented packets to the host
- * when the traffic flow is active
- */
- for (i = 0; i < 2; i++)
- {
- t10SendDataPkts (&t10Encap, paT10NumTestPkts, k + i, i == 0);
- }
-
- if (t10ReceiveDataPkts (&t10Encap, paT10NumTestPkts * i))
- {
- System_printf ("%s (%s:%d): Receive packets fail\n", tfName, __FILE__, __LINE__);
- t10Cleanup (&t10Encap, PA_TEST_FAILED);
- }
- }
-
- /* Verify and clear the stats */
- newStatus = testCommonCheckStats (t10Encap.tf, t10Encap.pat, tfName, &paTestL4ExpectedStats, t10Encap.tf->QLinkedBuf1,
- t10Encap.tf->QGen[Q_CMD_RECYCLE], t10Encap.tf->QGen[Q_CMD_REPLY], TRUE);
- if (newStatus == PA_TEST_FAILED)
- {
- System_printf ("%s (%s:%d): testCommonCheckStats Failed\n", tfName, __FILE__, __LINE__);
- //t10Cleanup (&t10Encap, newStatus);
- }
- /* No return from cleanup */
- t10Cleanup (&t10Encap, PA_TEST_PASSED);
-
-#ifdef __LINUX_USER_SPACE
- return (void *)0;
-#endif
-}
-
-
-
diff --git a/test/PAUnitTest2/tests/test10pkts.h b/test/PAUnitTest2/tests/test10pkts.h
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- *
- * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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.
- *
-*/
-
-
-
-#ifndef TEST10PKTS_H_
-#define TEST10PKTS_H_
-
-
-/* Valid rx MAC addresses used during the test */
-typedef struct t10EthSetup {
- paEthInfo_t ethInfo; /* PA Ethernet configuration structure */
- Bool acked; /* Set to TRUE when the reply to the command is received */
-} t10EthSetup_t;
-
-
-#pragma DATA_SECTION (t10EthSetup, ".testPkts")
-static t10EthSetup_t t10EthSetup[] = {
-
- {
- { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Source mac is dont care */
- { 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa }, /* Dest mac */
- 0, /* Vlan */
- 0, /* ethertype */
- 0, /* mpls tag */
- 0 /* input EMAC port */
- },
- FALSE }
-};
-
-typedef struct t10IpSetup_s {
- Bool innerIp; /* Inner IP link to MAC */
- Bool nextLut1; /* Next route is LUT1 */
- int32_t lHandleIdx; /* Linked handle (to previous L2 or L3 layer) */
- paIpInfo_t ipInfo; /* PA IP configuration structure */
- Bool acked; /* Set to TRUE when the reply to the command is received */
-
-} t10IpSetup_t;
-
-#pragma DATA_SECTION(t10IpSetup, ".testPkts")
-static t10IpSetup_t t10IpSetup[] = {
- /* IP Entry 0 */
- {
- FALSE, /* Outer IP */
- FALSE, /* Next Route LUT2 */
- 0, /* Linked to dest mac index 0 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- },
-
- /* IP Entry 1 */
- {
- 0, /* Outer IP */
- TRUE, /* Next Route LUT1 */
- 0, /* Linked to dest mac index 0 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- },
-
- /* IP Entry 2 */
- {
- TRUE, /* Inner IP */
- FALSE, /* Next Route LUT2 */
- 1, /* Linked to outer IP index 1 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- }
-};
-
-typedef struct t10UdpSetup_s {
- int32_t lHandleIdx; /* Linked handle (to previous L3 layer) */
- uint16_t port; /* destination port number */
- Bool acked; /* Set to TRUE when the reply to the command is received */
-} t10UdpSetup_t;
-
-#pragma DATA_SECTION(t10UdpSetup, ".testPkts")
-static t10UdpSetup_t t10UdpSetup[] = {
- /* UDP Entry 0 */
- {
- 0, /* Linked to dest ip index 0 */
- 0x8000, /* destination port number */
- FALSE
- },
-
- /* UDP Entry 1 */
- {
- 0, /* Linked to dest ip index 0 */
- 0x8002, /* destination port number */
- FALSE
- },
-
- /* UDP Entry 2 */
- {
- 2, /* Linked to dest ip index 2 */
- 0x9000, /* destination port number */
- FALSE
- },
-
- /* UDP Entry 3 */
- {
- 2, /* Linked to dest ip index 2 */
- 0x9002, /* destination port number */
- FALSE
- }
-
-};
-
-/* packet 0
- * mac dest = 00:01:02:03:04:aa
- * ip src = 158.218.109.11
- * ip dest = 200.201.202.100
- * Designed to match IP configuration 0 */
-#pragma DATA_SECTION (pkt0, ".testPkts")
-static uint8_t pkt0[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x78, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x64, 0xaa, 0xbb, 0x80, 0x00, 0x00, 0x00,
- 0x00, 0x00
- };
-
-#pragma DATA_SECTION (pkt0Info, ".testPkts")
-static pasahoLongInfo_t pkt0Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,42), /* cmd len = 24, start offset = 42 (Payload) */
- TF_FORM_PKT_INFO_WORD1(0,0,1,0,0,0), /* end offset = various(NA), pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* packet 1
- * mac dest = 00:01:02:03:04:aa
- * ip src = 158.218.109.12
- * ip dest = 200.201.202.100
- * Designed to match IP configuration 0 */
-#pragma DATA_SECTION (pkt1, ".testPkts")
-static uint8_t pkt1[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x78, 0x9e, 0xda, 0x6d, 0x0c, 0xc8, 0xc9,
- 0xca, 0x64, 0xaa, 0xbb, 0x80, 0x02, 0x00, 0x00,
- 0x00, 0x00
- };
-
-#pragma DATA_SECTION (pkt1Info, ".testPkts")
-static pasahoLongInfo_t pkt1Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,42), /* cmd len = 24, start offset = 42 (Payload) */
- TF_FORM_PKT_INFO_WORD1(0,0,1,0,0,0), /* end offset = various (NA), pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* packet 2
- * mac dest = 00:01:02:03:04:aa
- * Outer ip src = 158.218.109.32
- * Outer ip dest = 200.201.202.101
- * Inner ip src = 158.218.109.33
- * Inner ip dest = 200.201.202.102
- * Designed to match IP configuration 0 */
-#pragma DATA_SECTION (pkt2, ".testPkts")
-static uint8_t pkt2[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x05, 0x04,
- 0x16, 0x78, 0x9e, 0xda, 0x6d, 0x20, 0xc8, 0xc9,
- 0xca, 0x65, 0x45, 0x00, 0x00, 0x62, 0x00, 0x00,
- 0x00, 0x00, 0x05, 0x11, 0x16, 0x78, 0x9e, 0xda,
- 0x6d, 0x21, 0xc8, 0xc9, 0xca, 0x66, 0xaa, 0xbb,
- 0x90, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
-#pragma DATA_SECTION (pkt2Info, ".testPkts")
-static pasahoLongInfo_t pkt2Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,62), /* cmd len = 24, start offset = 62 (Payload) */
- TF_FORM_PKT_INFO_WORD1(0,0,1,0,0,0), /* end offset = various (NA), pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,54,62,0), /* L3 offset = 14, l4Offset = 54, l5Offset = 62, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,2,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* packet 3
- * mac dest = 00:01:02:03:04:aa
- * Outer ip src = 158.218.109.48
- * Outer ip dest = 200.201.202.101
- * Inner ip src = 158.218.109.49
- * Inner ip dest = 200.201.202.102
- * Designed to match IP configuration 0 */
-#pragma DATA_SECTION (pkt3, ".testPkts")
-static uint8_t pkt3[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x05, 0x04,
- 0x16, 0x78, 0x9e, 0xda, 0x6d, 0x30, 0xc8, 0xc9,
- 0xca, 0x65, 0x45, 0x00, 0x00, 0x62, 0x00, 0x00,
- 0x00, 0x00, 0x05, 0x11, 0x16, 0x78, 0x9e, 0xda,
- 0x6d, 0x31, 0xc8, 0xc9, 0xca, 0x66, 0xaa, 0xbb,
- 0x90, 0x02, 0x00, 0x00, 0x00, 0x00
- };
-
-#pragma DATA_SECTION (pkt3Info, ".testPkts")
-static pasahoLongInfo_t pkt3Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,62), /* cmd len = 24, start offset = 62 (Payload) */
- TF_FORM_PKT_INFO_WORD1(0,0,1,0,0,0), /* end offset = various(NA), pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,54,62,0), /* L3 offset = 14, l4Offset = 54, l5Offset = 62, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,2,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-#define T10_SWINFO0_PKT_ID 0xAAAA0000
-
-
-#pragma DATA_SECTION (t10PktInfo, ".testPkts")
-static pktTestInfo_t t10PktInfo[] = {
-
- /* Packet 0 */
- {
- (uint8_t *)pkt0,
- (pasahoLongInfo_t *)&pkt0Info,
- sizeof(pkt0),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T10_SWINFO0_PKT_ID | 0 /* Packet will be matched by packet index 0 */
- },
-
- /* Packet 1 */
- {
- (uint8_t *)pkt1,
- (pasahoLongInfo_t *)&pkt1Info,
- sizeof(pkt1),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T10_SWINFO0_PKT_ID | 1 /* Packet will be matched by packet index 1 */
- },
-
- /* Packet 2 */
- {
- (uint8_t *)pkt2,
- (pasahoLongInfo_t *)&pkt2Info,
- sizeof(pkt2),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) | (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4)}, /* IP/UDP match */ /* UDP match */
- T10_SWINFO0_PKT_ID | 2 /* Packet will be matched by packet index 2 */
- },
-
- /* Packet 3 */
- {
- (uint8_t *)pkt3,
- (pasahoLongInfo_t *)&pkt3Info,
- sizeof(pkt3),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) | (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4)}, /* IP/UDP match */ /* UDP match */
- T10_SWINFO0_PKT_ID | 3 /* Packet will be matched by packet index 3 */
- }
-
-};
-
-#endif /*TEST10PKTS_H_*/
diff --git a/test/PAUnitTest2/tests/test2.c b/test/PAUnitTest2/tests/test2.c
+++ /dev/null
@@ -1,1220 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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 "../pautest.h"
-#include "test2pkts.h"
-
-#ifdef __LINUX_USER_SPACE
-#include "fw_test.h"
-#include "fw_mem_allocator.h"
-#endif
-
-/* Add/Delete MAC and PDSP routing test
- * This test tests the LLD Pa_addMac and Pa_delHandle functions, as well as the
- * PDSP firmware for routing mac packets with or without VLAN and MPLS.
- * This test also verifies the MAC router scenario in which the MAC header of
- * ingress packet is replaced with pre-defined MAC header.
- * This test has the following sub-tests
- * - Test the LLD for the ability to determine if a new entry invalidates a previous entry
- * - Test the LLD to enter increasingly strict match requirements (dst, src, vlan, ethertype, mpls)
- * - Test the LLD when entering more entries than configured for
- * - Test the LLD and firmware for the ability to configure command set
- * - Test the firmware for the ability to take a burst of Pa_addMac commands
- * - Test the firmware for the routing of matches and next step fail routes
- * - Test the firmware for the ability to detect LLC/SNAP errors
- * - Test the firmware for the ability to handle inner and outer VLAN tags
- * - Test the firmware for the ability to break out of too many nested VLAN tags
- * - Test the firmware for the ability to handle MPLS packets with a single tag
- * - Test the firmware for the ability to handle MPLS packets with multiple tags
- * - Test the firmware for the ability to parse unsupported protocol such as ARP
- * - Test the firmware for the ability to take a burst of data packets
- * - Test the firmware for correct header offset calculation
- * - Test the LLD/firmware for the ability to delete entries
- * - Test the firmware for the ability to execute command set with blind patch command
- */
-
- #define TEST_ARP
-
- static char *tfName = "paTestL2Routing";
-
- /* General purpose queue usage */
- #define Q_CMD_RECYCLE 0 /* Command descriptors/buffers recycled here after sent to PA */
- #define Q_CMD_REPLY 1 /* Replies from PA routed here */
- #define Q_MATCH 2 /* Packets from PA which match a lookup criteria */
- #define Q_NFAIL 3 /* Packets from PA which matches a mac lookup, but failed an L3 lookup */
- #define Q_PARSE_ERR 4 /* Packets which resulted in a parse error */
- #define Q_MULTI_0 5 /* Multi route queue 0 */
- #define Q_MULTI_1 6 /* Multi route queue 1 */
- #define Q_MULTI_2 7 /* Multi route queue 2 */
- #define Q_MULTI_3 8 /* Multi route queue 3 */
- #define Q_MULTI_4 9 /* Multi route queue 4 */
- #define Q_MULTI_5 10 /* Multi route queue 5 */
- #define Q_MULTI_6 11 /* Multi route queue 6 */
- #define Q_MULTI_7 12 /* Multi route queue 7 */
-
-/* The number of PA handles maintained by this test */
-#ifdef __LINUX_USER_SPACE
-#define T2_NUM_LOCAL_HANDLES 63
-#else
-#define T2_NUM_LOCAL_HANDLES 64
-#endif
-
-/* The total number of buffers with linked descriptors */
-#define TOTAL_BUFS (TF_LINKED_BUF_Q1_NBUFS + TF_LINKED_BUF_Q2_NBUFS + TF_LINKED_BUF_Q3_NBUFS)
-
- /* Commands to the PA are verified through the value in swinfo0.
- * The 16 ms bits are used as verification, the 16 lbs are for local handle id */
-#define T2_CMD_SWINFO0_ADD_ID 0x11110000 /* Identifies add mac command */
-#define T2_CMD_SWINFO0_DEL_ID 0x22220000 /* Identifies del mac command */
-#define T2_CMD_SWINFO0_STATS_REQ_ID 0x33330000 /* Identifies the req stats command */
-#define T2_CMD_SWINFO0_CMDSET_CFG_ID 0x44440000 /* Identifies the cmd set command */
-#define T2_CMD_SWINFO0_PKT_ID 0x55550000 /* Identifies the packet as a data packet */
-
-/* Cycle delay count for PA reply */
-#define T2_PA_CMD_REPLY_DELAY 10000
-
-paSysStats_t paTestL2ExpectedStats; /* Expected stats results */
-
- /* 32 L2 handles are managed. This structure is used to track the handle and
- * the activation state state of the handle */
-enum {
- T2_L2_HANDLE_UNCONFIGURED = 0,
- T2_L2_HANDLE_PENDING_ACK,
- T2_L2_HANDLE_ACTIVE,
- T2_L2_HANDLE_DISABLED
-};
-
- typedef struct t2Handles_s {
-
- paHandleL2L3_t paHandle; /* The handle returned by the PA LLD */
-
- uint32_t state; /* T2_L2_HANDLE_UNCONFIGURED = handle not configured
- * T2_L2_HANDLE_PENDING_ACK = handle configured and sent to pa
- * T2_L2_HANDLE_ACTIVE = handle creation acknowledged by pa */
-
- } t2Handles_t;
-
-
- /* Static test configuration - routing of matching packets to the same queue and
- * distinguished by swinfo0 */
- typedef struct t2EthAndRoute_s {
-
- paEthInfo_t eth;
- uint32_t swinfo0;
-
- } t2EthAndRoute_t;
-
-const t2EthAndRoute_t t2EthAndSwinfo[] = {
-
- { { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Entry 0: Route on dest mac only */
- { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }, /* PA entry 0 */
- 0, 0, 0, 0}, T2_CMD_SWINFO0_PKT_ID },
-
- { { { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, /* Entry1: Route on dest/src mac */
- { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }, /* PA entry 1 */
- 0, 0, 0, 0}, T2_CMD_SWINFO0_PKT_ID+1 },
-
- { { { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, /* Entry 2: route on dest/src mac, vlan */
- { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }, /* PA entry 2 */
- 0x888, 0, 0, 0}, T2_CMD_SWINFO0_PKT_ID+2 },
-
- { { { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, /* Entry 3: route on dest/src mac, vlan */
- { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }, /* and ethertype = MPLS unicast */
- 0x888, 0x8847, 0, 0}, T2_CMD_SWINFO0_PKT_ID+3 }, /* PA entry 3 */
-
- { { { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, /* Entry 4: route on dest/src mac, vlan */
- { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }, /* and ethertype = MPLS multicast */
- 0x888, 0x8848, 0, 0}, T2_CMD_SWINFO0_PKT_ID+4 }, /* PA entry 4 */
-
- { { { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, /* Entry 5: route on dest/src mac, vlan */
- { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }, /* ethertype = MPLS unicast, and MPLS tag */
- 0x888, 0x8847, 0x012345, 0}, T2_CMD_SWINFO0_PKT_ID+5 }, /* PA entry 5 */
-
- { { { 0x44, 0x44, 0x44, 0x44, 0x44, 0x44 }, /* Entry 6: more specific entry then 7 */
- { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33 }, /* PA entry 6 */
- 0, 0, 0, 0}, T2_CMD_SWINFO0_PKT_ID+6 },
-
- { { { 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 }, /* Entry 7 route on source mac only */
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* PA entry 7 */
- 0, 0, 0, 0}, T2_CMD_SWINFO0_PKT_ID+7 },
-
- { { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Entry 8 route on vlan only */
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* PA entry 8 */
- 0x999, 0, 0, 0}, T2_CMD_SWINFO0_PKT_ID+8 },
-
- { { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Entry 9 route on ethertype only */
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* PA entry 9 */
- 0, 0x999, 0, 0}, T2_CMD_SWINFO0_PKT_ID+9 },
-
-
-#ifndef TEST_ARP
- { { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Entry 10 route on mpls tag only */
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* PA entry 10 */
- 0, 0, 0x11111, 0}, T2_CMD_SWINFO0_PKT_ID+10 },
-#else
- { { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Entry 10 route on ARP only */
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* PA entry 10 */
- 0x0, 0x806, 0, 0}, T2_CMD_SWINFO0_PKT_ID+10 },
-#endif
- };
-
-/*
- * Use both pre-determined and system-allocated LUT1 entry index
- * Note: The pre-determined LUT1 entry index should be consistent with the system-allocated one.
- * It is not recommended to mix those two modes in the application.
- */
-
-const int t2EthIndex[] = {
- pa_LUT1_INDEX_NOT_SPECIFIED, /* entry 0 */
- 62, /* entry 1 */
- pa_LUT1_INDEX_NOT_SPECIFIED, /* entry 2 */
- 60, /* entry 3 */
- 59, /* entry 4 */
- pa_LUT1_INDEX_NOT_SPECIFIED, /* entry 5 */
- pa_LUT1_INDEX_NOT_SPECIFIED, /* entry 6 */
- 56, /* entry 7 */
- pa_LUT1_INDEX_NOT_SPECIFIED, /* entry 8 */
- 54, /* entry 9 */
- 40 /* entry 10 */
-};
-
-const t2EthAndRoute_t t2EthAndSwinfoFail = {
- { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* This would steal matches from entry 6 if allowed */
- { 0x33, 0x33, 0x33, 0x33, 0x33, 0x33 }, /* This entry is not passed to PA */
- 0, 0, 0, 0}, 0xDEADDEAD }; /* !!! No PA Entry !!!! */
-
-
-/* A single non-const entry is used to test handling entering too many table elements
- * as well as delete and add */
-t2EthAndRoute_t t2VarEthAndRoute = { { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x45, 0x45, 0x45, 0x45, 0x45, 0x00 },
- 0, 0, 0, 0}, 0 };
-/*
- * Command Set to test MAC router
- *
- */
-#define T2_CMDSET_INDEX 20
-#define T2_CMDSET_NUM_CMDS 1
-
-static uint8_t t2MacRouteHdr[] =
-{
- 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
- 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
- 0x08, 0x00
-};
-
-static paPatchInfo_t t2PatchCmd =
- {
- pa_PATCH_OP_MAC_HDR, /* ctrlBitfield */
- sizeof(t2MacRouteHdr), /* nPatchBytes */
- sizeof(t2MacRouteHdr), /* totalPatchSize */
- 0, /* offset */
- t2MacRouteHdr /* Pointer to the patch data */
- };
-
-static paCmdInfo_t t2CmdSet20[] =
-{
-
- /* Command 0: Insert Bytes */
- {
- pa_CMD_PATCH_DATA,
- {
- {
- 0, /* ctrlBitfield */
- 0, /* nPatchBytes */
- 0, /* totalPatchSize */
- 0, /* offset */
- 0 /* Pointer to the patch data */
- }
- }
- }
-
-};
-
-static paCmdInfo_t t2CmdSetCmd =
- {
- pa_CMD_CMDSET,
- {
-
- {
- T2_CMDSET_INDEX /* Command set index */
- }
- }
- };
-
-
-
-/* Prototype required due to circular function calling */
-paTestStatus_t t2CheckStats (tFramework_t *tf, paTest_t *pat, Bool clear, t2Handles_t *l2Handles);
-
-
-Cppi_HostDesc *formDataPacket (tFramework_t *tf, paTest_t *pat, int32_t pktIdx, uint8_t *expectedPktCount)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
-
- /* Pop a descriptor off of the free queue list, format the return queue, and attach the packet */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QfreeDesc)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a descriptor off the free descriptor Q (%d)\n", tfName, __FILE__, __LINE__, tf->QfreeDesc);
- return (NULL);
- }
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = tf->QfreeDesc;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Make sure there is no control info. */
- Cppi_setPSLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, 0);
-
- /* Attach the data and set the length */
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)utilgAddr((uint32_t)(t2PktTestInfo[pktIdx].pkt)), t2PktTestInfo[pktIdx].pktLen);
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, t2PktTestInfo[pktIdx].pktLen);
-
- return (hd);
-}
-
-
-/* Recycle delete commands and command recycles */
-int32_t t2StateDel (tFramework_t *tf, paTest_t *pat, t2Handles_t *l2Handles)
-{
- Cppi_HostDesc *hd;
- paEntryHandle_t reth;
- paReturn_t paret;
- int32_t htype;
- int32_t cmdDest;
- int32_t i;
-
- /* Don't send the command until half of the rx buffers are available. The command replies will always be
- * sourced from QLinkedBuf1 and arrive in Q_CMD_REPLY. Delay the command until there are enough buffers available
- * to send and leave a 50% overhead.*/
- for (i = 0; (i < 100) && (Qmss_getQueueEntryCount (tf->QLinkedBuf1) < (TF_LINKED_BUF_Q1_NBUFS >> 1)); i++) {
- if ((Qmss_getQueueEntryCount (tf->QGen[Q_CMD_REPLY]) + Qmss_getQueueEntryCount(tf->QLinkedBuf1)) >= TF_LINKED_BUF_Q1_NBUFS)
- break;
- }
-
- while (Qmss_getQueueEntryCount (tf->QGen[Q_CMD_REPLY]) > 0) {
-
- /* Recycle the command descriptor/buffer */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_REPLY])) & ~15);
- if ((hd->softwareInfo0 & 0xffff0000u) != T2_CMD_SWINFO0_DEL_ID) {
- System_printf ("%s (%s:%d): Found packet in PA command reply queue without delete ID (found 0x%08x)", tfName, __FILE__, __LINE__, hd->softwareInfo0);
- return (-1);
- }
-
- /* Send the reply back to PA to let the driver know the command has been accepted */
- paret = Pa_forwardResult (tf->passHandle, (void *)hd->buffPtr, &reth, &htype, &cmdDest);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): paForwardResult returned error %d in response to pa_DelHandle reply from PA for handle #%d\n", tfName, __FILE__, __LINE__, hd->softwareInfo0 & 0xffff);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- return (-1);
- }
-
- l2Handles[hd->softwareInfo0 & 0xffff].state = T2_L2_HANDLE_DISABLED;
-
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s: (%s:%d): testCommonRecycleLBDesc failed to return a buffer/descriptor\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- }
-
- utilCycleDelay (100);
-
-
-
- /* The command recycle descriptor/buffer */
- while (Qmss_getQueueEntryCount (tf->QGen[Q_CMD_RECYCLE]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s: (%s:%d): testCommonRecycleLBDesc failed to return a buffer/descriptor\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
- }
-
-
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Timeout waiting for free descriptor/buffer queue to fill to halfway point\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- return (0);
-
-}
-
-
-static void paTestL2RecoverAndExit (tFramework_t *tf, paTest_t *pat, t2Handles_t *l2Handles, paTestStatus_t status, Bool doStats)
-{
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
- int32_t i, j, m;
- volatile int32_t mdebugWait = 0;
-
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
- cmdReply.queue = (uint16_t) tf->QGen[Q_CMD_REPLY];
-
-
- /* Delete all the handles */
- for (i = 0; i < T2_NUM_LOCAL_HANDLES; i++) {
-
- cmdReply.replyId = T2_CMD_SWINFO0_DEL_ID + i;
- hd = testCommonDelHandle (tf, &l2Handles[i].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2, &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD returned error code %d on handle deletion\n", tfName, __FILE__, __LINE__, paret);
- status = PA_TEST_FAILED;
- break;
- }
-
- if (hd == NULL) {
- System_printf ("%s (%s:%d): No descriptor available for del handle command\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- break;
- }
-
- /* Wait to send the command until half of the rx buffers are available */
- if (t2StateDel (tf, pat, l2Handles)) {
- status = PA_TEST_FAILED;
- break;
- }
-
- /* mdebugHaltPdsp (0); */
- /* Send the command to the PA */
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestL2ExpectedStats.classify1.nPackets += 1;
-
- while (mdebugWait);
- }
-
- /* Give some time for remaining commands to complete */
- for (i = 0; i < 100; i++) {
-
- for (j = m = 0; j < T2_NUM_LOCAL_HANDLES; j++)
- if (l2Handles[j].state != T2_L2_HANDLE_DISABLED)
- m += 1;
-
- if (m) {
- if (t2StateDel (tf, pat, l2Handles)) {
- status = PA_TEST_FAILED;
- break;
- }
- utilCycleDelay (100);
- } else
- break;
-
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Unable to delete all L2 handles. %d remain undeleted\n", tfName, __FILE__, __LINE__, m);
- status = PA_TEST_FAILED;
- }
-
-#ifndef __LINUX_USER_SPACE
- /* Verify the stats are as expected */
- if (t2CheckStats (tf, pat, TRUE, l2Handles) == PA_TEST_FAILED)
- status = PA_TEST_FAILED;
-#endif
-
- /* Test result */
- pat->testStatus = status;
-
- /* Return */
- Task_exit();
-}
-
-/* Look for command replies from PA */
-void t2L2CmdRep (tFramework_t *tf, paTest_t *pat, t2Handles_t *localHandles, int *cmdReply)
-{
- Cppi_HostDesc *hd;
- uint32_t *swInfo0;
- uint32_t swInfoCmd;
- uint32_t lid;
- paReturn_t paret;
- paEntryHandle_t reth;
- int32_t htype;
- int32_t cmdDest;
-
- while (Qmss_getQueueEntryCount ((tf->QGen)[Q_CMD_REPLY]) > 0) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop ((tf->QGen[Q_CMD_REPLY]))) & ~15);
- if (Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **) &swInfo0) == CPPI_EPIB_NOT_PRESENT) {
- System_printf ("%s (%s:%d): Found descriptor in PA command reply queue without EIPB present, failing\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
- swInfoCmd = (*swInfo0 & 0xffff0000u);
-
- /* Add General Command Processing */
- /* Command Set Command */
- if( swInfoCmd == T2_CMD_SWINFO0_CMDSET_CFG_ID)
- {
-
- /* Recycle the descriptor and buffer */
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s: (%s:%d): testCommonRecycleLBDesc failed to return a buffer/descriptor\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
- *cmdReply = TRUE;
- break;
- }
-
- /* Verify expected value in swinfo0 16 msbs */
- if ( (swInfoCmd != T2_CMD_SWINFO0_ADD_ID) && (swInfoCmd != T2_CMD_SWINFO0_DEL_ID) ) {
- System_printf ("%s (%s:%d): Found descriptor in PA command reply queue without command reply swinfo0\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- /* Extract the local instance value */
- lid = *swInfo0 & 0xffffu;
- if (lid >= T2_NUM_LOCAL_HANDLES) {
- System_printf ("%s (%s:%d): Received PA command reply for out of range local handle %d (max %d)\n", tfName, __FILE__, __LINE__, lid, T2_NUM_LOCAL_HANDLES);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- /* Send the reply back to PA to let the driver know the command has been accepted */
- paret = Pa_forwardResult (tf->passHandle, (void *)hd->buffPtr, &reth, &htype, &cmdDest);
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): paForwardResult returned error %d in response to paAddMac reply from PA\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- /* Make sure the handle returned by PA matches the local copy */
- if (localHandles[lid].paHandle != reth.l2l3Handle) {
- System_printf ("%s (%s:%d): paForwardResult returned handle (0x%08x) that did match internal table value (0x%08x)\n", tfName, __FILE__, __LINE__, (uint32_t)(localHandles[lid].paHandle), (uint32_t) reth.l2l3Handle);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- /* Recycle the descriptor and buffer */
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s: (%s:%d): testCommonRecycleLBDesc failed to return a buffer/descriptor\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- if (swInfoCmd == T2_CMD_SWINFO0_ADD_ID)
- localHandles[lid].state = T2_L2_HANDLE_ACTIVE;
- else
- localHandles[lid].state = T2_L2_HANDLE_UNCONFIGURED;
- }
-
- while (Qmss_getQueueEntryCount ((tf->QGen)[Q_CMD_RECYCLE]) > 0) {
-
- /* Recycle the command descriptor/buffer */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop ((tf->QGen[Q_CMD_RECYCLE]))) & ~15);
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s: (%s:%d): testCommonRecycleLBDesc failed to return a buffer/descriptor\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- }
-
-
-}
-
-
-
-
-void paL2HandleError (tFramework_t *tf, paTest_t *pat, t2Handles_t *l2Handles, paReturn_t paret, Cppi_HostDesc *hd)
-{
- /* Check paret before the descriptor. If paret indicates failure the descriptor will be NULL */
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): testCommonAddMac failed, PA LLD error code = %d\n", tfName, __FILE__, __LINE__, paret);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* No return */
- }
-
- if (hd == NULL) {
- System_printf ("%s (%s:%d): testCommonAddMac failed due to unavailable free linked buffer descriptor\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* No return */
- }
-}
-
-
-/* Check the stats */
-
-paTestStatus_t t2CheckStats (tFramework_t *tf, paTest_t *pat, Bool clear, t2Handles_t *l2Handles)
-{
- Cppi_HostDesc *hd;
- uint8_t *bp;
- paSysStats_t *paStats;
- uint32_t blen;
- int32_t i;
- paTestStatus_t status;
-
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
- cmdReply.queue = (uint16_t) tf->QGen[Q_CMD_REPLY];
-
-
- /* Check the PA stats to make sure they are set as expected */
- cmdReply.replyId = T2_CMD_SWINFO0_STATS_REQ_ID;
- if (testCommonRequestPaStats (tfName, tf, clear, tf->QLinkedBuf1, tf->QGen[Q_CMD_RECYCLE], &cmdReply)) {
- System_printf ("%s (%s:%d): testCommonRequestPaStats failed\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, FALSE); /* No Return */
- }
-
- /* Wait for the stats reply */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (T2_PA_CMD_REPLY_DELAY);
- if (Qmss_getQueueEntryCount (tf->QGen[Q_CMD_REPLY]) > 0)
- break;
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Did not find response from PA to stats request command\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, FALSE); /* No Return */
- }
-
- /* Recycle the descriptor/buffer returned from the stats request */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find returned descriptor/buffer from stats request\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, FALSE); /* No Return */
- }
-
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats request\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, FALSE); /* No Return */
- }
-
- /* Format the stats response and compare to the expected results */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_REPLY])) & ~15);
- Cppi_getData (Cppi_DescType_HOST, (Cppi_Desc *)hd, &bp, &blen);
- paStats = (paSysStats_t *)Pa_formatStatsReply (tf->passHandle, (paCmd_t)bp);
-
- if (testCommonCompareStats (tfName, (paSysStats_t *)&paTestL2ExpectedStats, paStats))
- status = PA_TEST_FAILED;
- else
- status = PA_TEST_PASSED;
-
- /* Recycle the descriptor and associated buffer back to queue from which it came */
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats response\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- }
-
- return (status);
-}
-
-
-/* Search the receive data packet queue for received data packets. Remain in
- * this function until all buffers are restored to their respective queues */
-int32_t t2ReceiveDataPkts (tFramework_t *tf, paTest_t *pat, uint8_t *actualPktCount)
-{
- Cppi_HostDesc *hd;
- uint32_t *swInfo;
- pktTestInfo_t *tinfo;
- pasahoLongInfo_t *pinfo;
- uint32_t infoLen;
- int32_t i, j;
- uint32_t chan;
-
- for (i = 0; i < 100; i++) {
-
- utilCycleDelay (T2_PA_CMD_REPLY_DELAY);
- while (Qmss_getQueueEntryCount (tf->QGen[Q_MATCH]) > 0) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_MATCH])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Popped a NULL descriptor off of match queue\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- /* Verify swInfo0 for packet match and packet ID number */
- Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **)&swInfo);
-
- if ((*swInfo & 0xffff0000) != T2_CMD_SWINFO0_PKT_ID) {
- System_printf ("%s (%s:%d): Found a packet in the receive packet queue but with incorrect swinfo0 Id: 0x%08x\n",
- tfName, __FILE__, __LINE__, *swInfo);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- chan = *swInfo & 0xffff;
- if (chan < T2_NUM_LOCAL_HANDLES)
- actualPktCount[chan] += 1;
-
- /* locate the associated test information based on the channel value */
- for (j = 0, tinfo = NULL; j < sizeof(t2PktTestInfo) / sizeof(pktTestInfo_t); j++) {
- if (t2PktTestInfo[j].idx == chan) {
- tinfo = &t2PktTestInfo[j];
- break;
- }
- }
-
- if (tinfo == NULL) {
- System_printf ("%s (%s:%d): Found a packet in the receive packet queue for channel %d, but found no matching packet info\n",
- tfName, __FILE__, __LINE__, chan);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
-
- /* Verify the parse information is correct */
- if (Cppi_getPSData (Cppi_DescType_HOST, Cppi_PSLoc_PS_IN_DESC, (Cppi_Desc *)hd, (uint8_t **)&pinfo, &infoLen) != CPPI_SOK) {
- System_printf ("%s (%s:%d): Error getting control info from received data packet\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- if (testCommonComparePktInfo (tfName, tinfo->info, pinfo)) {
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- /* Verify the replaced MAC header */
- if(memcmp((void*)hd->buffPtr, t2MacRouteHdr, sizeof(t2MacRouteHdr)))
- {
- System_printf ("%s (%s:%d): MAC header does not match!\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- /* Return the descriptor/buffer */
- testCommonRecycleLBDesc (tf, hd);
-
- }
-
- if ( (Qmss_getQueueEntryCount(TF_LINKED_BUF_Q1) == TF_LINKED_BUF_Q1_NBUFS) &&
- (Qmss_getQueueEntryCount(TF_LINKED_BUF_Q2) == TF_LINKED_BUF_Q2_NBUFS) &&
- (Qmss_getQueueEntryCount(TF_LINKED_BUF_Q3) == TF_LINKED_BUF_Q3_NBUFS) )
- break;
-
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Error - unable to recover all descriptors with associated buffers\n", tfName, __FILE__, __LINE__);
- System_flush();
- return (-1);
- }
-
- return (0);
-
-}
-
-
-
-
-
-
-#ifdef __LINUX_USER_SPACE
-void* paTestL2Routing (void *args)
-{
- tFramework_t *tf = ((paTestArgs_t *)args)->tf;
- paTest_t *pat = ((paTestArgs_t *)args)->pat;
-#else
-void paTestL2Routing (UArg a0, UArg a1)
-{
- tFramework_t *tf = (tFramework_t *)a0;
- paTest_t *pat = (paTest_t *)a1;
-#endif
- Cppi_HostDesc *hd[8];
- paReturn_t paret;
- t2Handles_t l2Handles[T2_NUM_LOCAL_HANDLES];
- paHandleL2L3_t fHandle;
- int32_t i, j, k, l;
- int32_t state;
- int32_t count;
- int32_t cmdDest;
- Bool halt;
- uint16_t cmdSize;
- paTestStatus_t testStatus = PA_TEST_PASSED;
- uint8_t expectedPktCount[T2_NUM_LOCAL_HANDLES];
- uint8_t actualPktCount[T2_NUM_LOCAL_HANDLES];
- int32_t fCmdReply;
-
-
- volatile int32_t mdebugWait = 1;
-
- paRouteInfo_t matchRoute = { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- &t2CmdSetCmd}; /* command set command */
-
- paRouteInfo_t nfailRoute = { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}; /* No commands */
-
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
-
-#ifdef __LINUX_USER_SPACE
- for (i = 0; (i < (sizeof(t2PktTestInfo) / sizeof(pktTestInfo_t))); i++) {
- int pktSz;
- uint8_t *pkt;
-
- switch (i) {
- case 0:
- pktSz = sizeof(pkt2);
- pkt = (uint8_t *)pkt2;
- break;
-
- case 1:
- pktSz = sizeof(pkt5);
- pkt = (uint8_t *)pkt5;
- break;
-
- case 2:
- pktSz = sizeof(pkt10);
- pkt = (uint8_t *)pkt10;
- break;
- }
-
- /* Allocate memory for the Packet buffers */
- t2PktTestInfo[i].pkt = (uint8_t *)fw_memAlloc(pktSz, CACHE_LINESZ);
- if(t2PktTestInfo[i].pkt == NULL) {
- printf ("%s: memAlloc failed for pkt %d\n", tfName, i);
- pat->testStatus = PA_TEST_FAILED;
- return (void *)0;
- }
- memcpy(t2PktTestInfo[i].pkt, pkt, pktSz);
- }
-#endif
-
- /* Runtime initial values */
- matchRoute.queue = (uint16_t) tf->QGen[Q_MATCH];
- nfailRoute.queue = (uint16_t) tf->QGen[Q_NFAIL];
- cmdReply.queue = (uint16_t) tf->QGen[Q_CMD_REPLY];
- cmdReply.flowId = tf->tfFlowNum;
-
- t2CmdSet20[0].params.patch = t2PatchCmd;
- t2CmdSetCmd.params.cmdSet.index = T2_CMDSET_INDEX;
-
- /* Zero out the l2Handle array and packet counts */
- memset (l2Handles, 0, sizeof(l2Handles));
- memset (expectedPktCount, 0, sizeof(expectedPktCount));
- memset (actualPktCount, 0, sizeof(actualPktCount));
-
- /* Zero out the expected stats. The stats will be updated as packets are sent into PA */
- memset (&paTestL2ExpectedStats, 0, sizeof(paTestL2ExpectedStats));
-
- /* Issue the command set command */
- cmdReply.replyId = T2_CMD_SWINFO0_CMDSET_CFG_ID;
- hd[0] = testCommonConfigCmdSet (tf, T2_CMDSET_INDEX, T2_CMDSET_NUM_CMDS, t2CmdSet20,
- tf->QGen[Q_CMD_RECYCLE],tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- /* Check paret before the descriptor. If paret indicates failure the descriptor will be NULL */
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): testCommonConfigCmdSet failed, PA LLD error code = %d\n", tfName, __FILE__, __LINE__, paret);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* No return */
- }
-
- if (hd[0] == NULL) {
- System_printf ("%s (%s:%d): testCommonConfigCmdSet failed due to unavailable free linked buffer descriptor\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* No return */
- }
-
- /* Send command */
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[0], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- /* Wait for a PA reply */
- fCmdReply = FALSE;
- for (i = 0; i < 100; i++) {
- utilCycleDelay (T2_PA_CMD_REPLY_DELAY);
- t2L2CmdRep (tf, pat, l2Handles, &fCmdReply);
- if (fCmdReply)
- break;
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Reply to Pa_configCmdSet not found\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* no return */
- }
-
- /* Initialize the first entry in the table */
- cmdReply.replyId = T2_CMD_SWINFO0_ADD_ID + 0; /* T2_CMD_SWINFO0_ADD_ID identifies command, 16 LS bits identify the local handle number */
- cmdReply.queue = tf->QGen[Q_CMD_REPLY];
- matchRoute.swInfo0 = nfailRoute.swInfo0 = t2EthAndSwinfo[0].swinfo0;
- hd[0] = testCommonAddMac (tf, t2EthIndex[0], (paEthInfo_t *)&t2EthAndSwinfo[0].eth, &matchRoute, &nfailRoute,
- &l2Handles[0].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
-
- paL2HandleError (tf, pat, l2Handles, paret, hd[0]); /* Will not return on error */
-
-
- /* Send the command to PA. This will result in 1 packet in classify1 */
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[0], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- l2Handles[0].state = T2_L2_HANDLE_PENDING_ACK;
- paTestL2ExpectedStats.classify1.nPackets += 1;
-
- /* Wait for a PA reply */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (T2_PA_CMD_REPLY_DELAY);
- t2L2CmdRep (tf, pat, l2Handles, NULL);
- if (l2Handles[0].state == T2_L2_HANDLE_ACTIVE)
- break;
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Reply to paAddMac not found\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* no return */
- }
-
-
- /* Add the next 6 entries in a burst. Take the memory from linked buffer descriptor area two
- * since the responses will come from area one. These are entries 1-6 in the local handle table */
- for (i = 0; i < 6; i++) {
- cmdReply.replyId = T2_CMD_SWINFO0_ADD_ID + i + 1;
- matchRoute.swInfo0 = nfailRoute.swInfo0 = t2EthAndSwinfo[i+1].swinfo0;
- hd[i] = testCommonAddMac (tf, t2EthIndex[i+1], (paEthInfo_t *)&t2EthAndSwinfo[i+1].eth, &matchRoute, &nfailRoute,
- &l2Handles[i+1].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
- paL2HandleError (tf, pat, l2Handles, paret, hd[i]); /* Will not return on error */
- }
-
-
- /* Send all the commands at once to test the ability to handle back to back commands */
- for (i = 0; i < 6; i++) {
- /* if (mdebugWait) mdebugHaltPdsp(0); */
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[i], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- /* while (mdebugWait); */
-
-
- l2Handles[i+1].state = T2_L2_HANDLE_PENDING_ACK;
- paTestL2ExpectedStats.classify1.nPackets += 1;
-
- }
-
-
- /* Wait for the PA to generate all the responses */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (T2_PA_CMD_REPLY_DELAY);
- t2L2CmdRep (tf, pat, l2Handles, NULL);
-
- state = 1;
- for (j = 1; j < 7; j++) {
- if (l2Handles[i].state == T2_L2_HANDLE_PENDING_ACK)
- state = 0;
- }
-
- if (state == 1)
- break;
- }
-
- if ((i == 100) && (state == 0)) {
- System_printf ("%s: (%s:%d): Burst of 5 addMac commands did not result in 5 acks from PA\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE);
- }
-
-
- /* The next entry should result in the PA generating an error */
- cmdReply.replyId = T2_CMD_SWINFO0_ADD_ID + 7; /* T2_CMD_SWINFO0_ADD_ID identfies command, 16 LS bits identify the local handle number */
- matchRoute.swInfo0 = nfailRoute.swInfo0 = t2EthAndSwinfoFail.swinfo0;
- hd[0] = testCommonAddMac (tf, pa_LUT1_INDEX_NOT_SPECIFIED, (paEthInfo_t *)&t2EthAndSwinfoFail.eth, &matchRoute, &nfailRoute,
- &l2Handles[7].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- /* If the descriptor came back non-null, restore it and return it */
- if (hd[0] != NULL) {
- hd[0]->buffLen = hd[0]->origBufferLen;
- Qmss_queuePush (tf->QLinkedBuf2, (Ptr)hd[0], hd[0]->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- }
-
- /* The test won't exit on this failure since no commands have been sent to PA */
- if (paret != pa_INVALID_TABLE_MORE_SPECIFIC_ENTRY_PRESENT) {
- System_printf ("%s (%s:%d): function paAddMac did not detect an invalid entry order\n", tfName, __FILE__, __LINE__);
- testStatus = PA_TEST_FAILED;
- }
-
-
- /* Rapid fire the next 4 entries from the const table to the PA */
- /* Add the next 4 entries in a burst. Take the memory from linked buffer descriptor area two
- * since the responses will come from area one. These are entries 1-6 in the local handle table */
- for (i = 0; i < 4; i++) {
- cmdReply.replyId = T2_CMD_SWINFO0_ADD_ID + i + 7;
- matchRoute.swInfo0 = nfailRoute.swInfo0 = t2EthAndSwinfo[i+7].swinfo0;
- hd[i] = testCommonAddMac (tf, t2EthIndex[i+7], (paEthInfo_t *)&t2EthAndSwinfo[i+7].eth, &matchRoute, &nfailRoute,
- &l2Handles[i+7].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
- paL2HandleError (tf, pat, l2Handles, paret, hd[i]); /* Will not return on error */
- }
-
- /* Send all the commands at once to test the ability to handle back to back commands */
- for (i = 0; i < 4; i++) {
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[i], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- l2Handles[i+7].state = T2_L2_HANDLE_PENDING_ACK;
- paTestL2ExpectedStats.classify1.nPackets += 1;
- }
-
- /* Wait for the PA to generate all the responses */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (T2_PA_CMD_REPLY_DELAY);
- t2L2CmdRep (tf, pat, l2Handles, NULL);
-
- state = 1;
- for (j = 7; j < 11; j++) {
- if (l2Handles[i].state == T2_L2_HANDLE_PENDING_ACK)
- state = 0;
- }
-
- if (state == 1)
- break;
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Failed to find responses from PA\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
-
- /* 11 Entries into the table have been made. Make an additional 52 entries in 13 batches of 4.
- * These entries do not test any particular routing, simply table addition and overflow */
- for (i = k = 0; i < 13; i++, k += 4) {
- for (j = 0; j < 4; j++) {
- cmdReply.replyId = T2_CMD_SWINFO0_ADD_ID + 11 + k + j;
- t2VarEthAndRoute.eth.dst[5] = k + j;
- matchRoute.swInfo0 = nfailRoute.swInfo0 = 0x5555000b + k + j + 11;
- hd[j] = testCommonAddMac (tf, pa_LUT1_INDEX_NOT_SPECIFIED, &t2VarEthAndRoute.eth, &matchRoute, &nfailRoute,
- &l2Handles[k+j+11].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
- paL2HandleError (tf, pat, l2Handles, paret, hd[j]); /* Will not return on error */
- }
-
- /* Send all the commands at once to test the ability to handle back to back commands */
- for (j = 0; j < 4; j++) {
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[j], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- l2Handles[k+j+11].state = T2_L2_HANDLE_PENDING_ACK;
- paTestL2ExpectedStats.classify1.nPackets += 1;
- }
-
- /* Wait for the PA to generate all the responses */
- for (l = 0; l < 100; l++) {
- utilCycleDelay (T2_PA_CMD_REPLY_DELAY);
- t2L2CmdRep (tf, pat, l2Handles, NULL);
-
- state = 1;
- for (j = 0; j < 4; j++) {
- if (l2Handles[11 + k + j].state == T2_L2_HANDLE_PENDING_ACK)
- state = 0;
- }
-
- if (state == 1)
- break;
- }
-
- if (l == 100) {
- System_printf ("%s (%s:%d): Failed to find responses from PA\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* No Return */
- }
- }
-
-#ifndef __LINUX_USER_SPACE
- /* There is one place left in the table. Try to make two more entries. The first one should succeed
- * but the next one should be rejected by the PA lld */
- cmdReply.replyId = T2_CMD_SWINFO0_ADD_ID + 11 + k;
- t2VarEthAndRoute.eth.dst[5] = k;
- matchRoute.swInfo0 = nfailRoute.swInfo0 = T2_CMD_SWINFO0_ADD_ID + k + 11;
- hd[0] = testCommonAddMac (tf, pa_LUT1_INDEX_NOT_SPECIFIED, &t2VarEthAndRoute.eth, &matchRoute, &nfailRoute,
- &l2Handles[k+11].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
- paL2HandleError (tf, pat, l2Handles, paret, hd[j]); /* Will not return on error */
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[0], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- l2Handles[k+11].state = T2_L2_HANDLE_PENDING_ACK;
- paTestL2ExpectedStats.classify1.nPackets += 1;
-
-
- /* Wait for the PA to generate the response */
- for (l = 0; l < 100; l++) {
- utilCycleDelay (T2_PA_CMD_REPLY_DELAY);
- t2L2CmdRep (tf, pat, l2Handles, NULL);
-
- if (l2Handles[11+k].state == T2_L2_HANDLE_ACTIVE)
- break;
- }
-
- if (l == 100) {
- System_printf ("%s (%s:%d): Failed to find responses from PA\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- /* The next add mac command should fail */
- k += 1;
- t2VarEthAndRoute.eth.dst[5] = k;
- matchRoute.swInfo0 = nfailRoute.swInfo0 = T2_CMD_SWINFO0_ADD_ID + k;
- hd[0] = testCommonAddMac (tf, pa_LUT1_INDEX_NOT_SPECIFIED, &t2VarEthAndRoute.eth, &matchRoute, &nfailRoute,
- &fHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- /* If the descriptor came back non-null, restore it and return it */
- if (hd[0] != NULL) {
- hd[0]->buffLen = hd[0]->origBufferLen;
- Qmss_queuePush (tf->QLinkedBuf2, (Ptr)hd[0], hd[0]->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- }
-
- /* The test will continue on failure since the PA sub-system has not been changed */
- if (paret != pa_HANDLE_TABLE_FULL) {
- System_printf ("%s (%s:%d): function paAddMac did not detect a full handle table\n", tfName, __FILE__, __LINE__);
- testStatus = PA_TEST_FAILED;
- }
-
- /* Check and clear the stats */
- testStatus = t2CheckStats (tf, pat, TRUE, l2Handles);
- memset (&paTestL2ExpectedStats, 0, sizeof(paTestL2ExpectedStats));
-
- if (testStatus != PA_TEST_PASSED)
- paTestL2RecoverAndExit (tf, pat, l2Handles, testStatus, TRUE);
-#endif
-
-
- /* Run packets through the system. the complete set of packets is run through three times. */
- for (j = 0, halt = FALSE; (j < 3) && (halt == FALSE); j++) {
-
- for (i = 0; (i < sizeof(t2PktTestInfo) / sizeof(pktTestInfo_t)) && (halt == FALSE); ) {
-
- /* Form up to 8 data packets to send */
- for (k = 0; ((k < 8) && (i < sizeof(t2PktTestInfo) / sizeof(pktTestInfo_t))); k++) {
- hd[k] = formDataPacket (tf, pat, i, expectedPktCount);
-
- if (hd[k] == NULL) {
- halt = TRUE;
- break;
- }
-
- /* Inc the count if the packet is passed back to the host */
- if (t2PktTestInfo[i].idx >= 0)
- expectedPktCount[t2PktTestInfo[i].idx] += 1;
-
- /* Increment any expected stats */
- testCommonIncStats (t2PktTestInfo[i].statsMap, &paTestL2ExpectedStats);
-
- /* Proceed to the next packet */
- i += 1;
-
- }
-
- //mdebugWait = 1;
- //if (mdebugWait) mdebugHaltPdsp(0);
-
- for (l = 0; l < k; l++)
- Qmss_queuePush (tf->QPaTx[0], (Ptr)hd[l], hd[l]->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- //while (mdebugWait);
-
-
- }
-
- /* Wait for all descriptors associated with received packets to be recycled. The descriptors
- * had to go somewhere so wait until the total count is accounted for */
- for (l = 0, count = 0; ((l < 100) && (count != TOTAL_BUFS)); l++)
- {
- utilCycleDelay (100);
- count = Qmss_getQueueEntryCount(tf->QGen[Q_MATCH]) + Qmss_getQueueEntryCount(tf->QGen[Q_NFAIL]) +
- Qmss_getQueueEntryCount(tf->QGen[Q_PARSE_ERR]) + Qmss_getQueueEntryCount(tf->QLinkedBuf1) +
- Qmss_getQueueEntryCount(tf->QLinkedBuf2) + Qmss_getQueueEntryCount(tf->QLinkedBuf3);
- }
-
- if (l == 100) {
- System_printf ("%s (%s:%d): Timeout waiting for packets from PA\n", tfName, __FILE__, __LINE__);
- testStatus = PA_TEST_FAILED;
- break;
- }
-
- if (t2ReceiveDataPkts (tf, pat, actualPktCount))
- {
- /* Error Handling */
- System_printf ("%s (%s:%d): t2ReceiveDataPkts timeout %d\n", tfName,
- __FILE__, __LINE__);
- System_flush();
- break;
- }
- }
-
- /* Give a good delay for any more packets to come through, and examine th epackets. */
- //utilCycleDelay (2000);
- t2ReceiveDataPkts (tf, pat, actualPktCount);
-
-
- /* Verify that the expected and actual received packet counts match */
- for (i = 0; i < T2_NUM_LOCAL_HANDLES; i++) {
- if (expectedPktCount[i] != actualPktCount[i]) {
- System_printf ("%s (%s:%d): Packet count mismatch for entry %d - expected %d, found %d\n", tfName,
- __FILE__, __LINE__, i, expectedPktCount[i], actualPktCount[i]);
- System_flush();
- testStatus = PA_TEST_FAILED;
- }
- }
-
-
-
- /* Clean up and return */
- paTestL2RecoverAndExit (tf, pat, l2Handles, testStatus, TRUE);
-
-#ifdef __LINUX_USER_SPACE
- return (void *)0;
-#endif
-}
-
-
-
-
-
-
-
-
diff --git a/test/PAUnitTest2/tests/test2pkts.h b/test/PAUnitTest2/tests/test2pkts.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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.
- *
-*/
-
-
-
-
-
-#pragma DATA_SECTION(pkt2, ".testPkts")
-#pragma DATA_ALIGN(pkt2, 8)
-const uint8_t pkt2[] = {
-
- 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0xaa, 0xbb,
- 0xcc, 0xdd, 0xee, 0xff, 0x81, 0x00, 0x08, 0x88,
- 0x08, 0x00, 0x45, 0x00, 0x00, 0x5c, 0x00, 0x00,
- 0x00, 0x00, 0x05, 0x11, 0x75, 0x4e, 0x0a, 0x0b,
- 0x0c, 0x0d, 0x14, 0x15, 0x16, 0x17, 0x11, 0x11,
- 0x22, 0x22, 0x00, 0x48, 0x61, 0x89, 0x32, 0x33,
- 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
- 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43,
- 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
- 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53,
- 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b,
- 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63,
- 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
- 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71
-};
-
-const pasahoLongInfo_t pkt2Info = {
- TF_FORM_PKT_INFO_WORD0(0,24,14), /* cmd len = 24, start offset = 14 (18) */ /* MAC header is replaced by a 14-byte header */
- TF_FORM_PKT_INFO_WORD1(106,0,1,0,0,0), /* end offset = 106 (110), pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,0,0,0), /* L3 offset = 14 (18)*/
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_VLAN),0,1,0,0,0,0,0), /* vlan count = 1 */
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-
-
-#pragma DATA_SECTION(pkt5, ".testPkts")
-#pragma DATA_ALIGN(pkt5, 8)
-const uint8_t pkt5[] = {
-
- 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0xaa, 0xbb,
- 0xcc, 0xdd, 0xee, 0xff, 0x81, 0x00, 0x08, 0x88,
- 0x88, 0x47, 0x12, 0x34, 0x51, 0x64, 0x45, 0x00,
- 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x75, 0x4e, 0x0a, 0x0b, 0x0c, 0x0d, 0x14, 0x15,
- 0x16, 0x17, 0x11, 0x11, 0x22, 0x22, 0x00, 0x48,
- 0x61, 0x89, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71
-
-};
-
-const pasahoLongInfo_t pkt5Info = {
- TF_FORM_PKT_INFO_WORD0(0,24,14), /* cmd len = 24, start offset = 14(22) *//* MAC header is replaced by a 14-byte header */
- TF_FORM_PKT_INFO_WORD1(106,0,1,0,1,0), /* end offset = 106 (114), errIdx = 0, pmatch = 1, c2c(custom) = 0, l1PdspId = 1, l1Idx = don't care */
- TF_FORM_PKT_INFO_WORD2(14,0,0,0), /* L3 offset = 14 (22) */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_VLAN | PASAHO_HDR_BITMASK_MPLS),
- PASAHO_HDR_IPv4,1,0,0,0,0,0), /* bitmap, nextHdr = ipv4, vlan Count = 0,
- * ipCount = 1, gre count = 0, frag = 0,
- * ip route = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 10 is an ARP request */
-#pragma DATA_SECTION(pkt10, ".testPkts")
-#pragma DATA_ALIGN(pkt10, 8)
-const uint8_t pkt10[] = {
-
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Dest MAC */
- 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0x01, /* Src MAC */
- 0x08, 0x06, /* Ethertype = ARP */
- 0x00, 0x01, /* Hardware type = ethernet */
- 0x08, 0x00, /* Protocol type = IP */
- 0x06, 0x04, /* Hardware size = 6, protocol size = 4 */
- 0x00, 0x01, /* Opcode = request */
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, /* Sender MAC */
- 0x10, 0x11, 0x12, 0x13, /* Sender IP */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Target MAC */
- 0x14, 0x15, 0x16, 0x17, /* Target IP */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Trailer */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-};
-
-
-const pasahoLongInfo_t pkt10Info = {
- TF_FORM_PKT_INFO_WORD0(0,24,14), /* cmd len = 20, start offset = 14 */
- TF_FORM_PKT_INFO_WORD1(60,0,1,0,0,0), /* end offset = 60, errIdx = 0, pmatch = 1, c2c = 0, l1PdspId = 0, l1idx = dont care */
- TF_FORM_PKT_INFO_WORD2(14,0,0,0), /* L3 offset = 14 */
- TF_FORM_PKT_INFO_WORD3(PASAHO_HDR_BITMASK_MAC,0,0,0,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-
-
-
-
-pktTestInfo_t t2PktTestInfo[] = {
-
-
- { (uint8_t *)pkt2, (pasahoLongInfo_t *)&pkt2Info, sizeof(pkt2),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH),
- 0, 0, 2 },
-
- { (uint8_t *)pkt5, (pasahoLongInfo_t *)&pkt5Info, sizeof(pkt5),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_MPLS),
- 0, 0, 5 },
-
- { (uint8_t *)pkt10, (pasahoLongInfo_t *)&pkt10Info, sizeof(pkt10),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH),
- 0, 0, 10 }
-
-
-};
-
-
-
-
-
diff --git a/test/PAUnitTest2/tests/test3.c b/test/PAUnitTest2/tests/test3.c
+++ /dev/null
@@ -1,980 +0,0 @@
-/*
- *
- * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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 "../pautest.h"
-#include "test3pkts.h"
-
-#ifdef __LINUX_USER_SPACE
-#include "fw_test.h"
-#include "fw_mem_allocator.h"
-#endif
-
-
-/* Format tx route and checksum verification test
- * This test tests the LLD Pa_formatTxRoute and Pa_formatTxCmd APIs, as well as the
- * checksum verification for IPv4 header, UDP, UDP-lite and TCP headers on reception.
- * This test also tests the transmit timestamp report and timestamp insertion of incoming
- * packets
- *
- * This test covers the following sub-tests:
- * - Test the LLD for formatting the checksum and routing commands
- * - Test the LLD for formatting the CRC, routing and report timestamp commands
- * - Test the firmware for correct packet routing after processing the checksum command
- * - Test the PA sub-system for correct IPv4 header checksum calculation and verification
- * - Test the PA sub-system for correct TCP/UDP/UDP-lite payload checksum calculation
- * - Test the firmware for the ability to process the report timestamp command
- */
-
-static char *tfName = "paTestTxFormatRoute";
-
-#undef PA_T3_SHOW_TIMESTAMP
-
-/* General purpose queue usage */
-#define Q_CMD_RECYCLE 0 /* Command descriptors/buffers recycle */
-#define Q_CMD_REPLY 1 /* Replies from PA */
-#define Q_MATCH 2 /* Packets from PA which match a lookup */
-#define Q_NFAIL 3 /* Packet from PA which failed a lookup */
-#define Q_TIMESTAMP 4 /* Packet from PA which contains the tx timestamp */
-
-/* Handles managed by this test */
-#define TEST_NUM_L2_HANDLES 1
-#define TEST_NUM_L3_HANDLES 1 /* 2 */
-#define TEST_NUM_L4_HANDLES 1 /* 2 */
-
-
-/* Command reply SW Info identifiers */
-#define TEST_SWINFO0_CMD_ID 0x12340000
-#define TEST_SWINFO0_STATS_REQ 0x12340001
-#define TEST_SWINFO0_TIMESTAMP 0x12340002
-
-static paSysStats_t paTestTxFmtExptStats; /* Expected stats results */
-
-/* The IPv4 packet is sent four times. The first time with no
- * checksum calculation. This packet should return with the IP header
- * and udp checksum flag showing invalid checksums. This is followed
- * by a command to do the IPv4 header checksum only, then the
- * UDP checksum only, and then both checksums. */
-#define CMD_BUF_SIZE (sizeof(pasahoNextRoute_t) + (3 * sizeof(pasahoComChkCrc_t)) + sizeof(pasahoReportTimestamp_t))
-//static uint8_t paT3pkt[4][sizeof(t3pkt)];
-#ifdef __LINUX_USER_SPACE
-static uint8_t* paT3pkt[4] = {NULL, NULL, NULL, NULL};
-#else
-static uint8_t paT3pkt0[sizeof(t3pkt)];
-static uint8_t paT3pkt1[sizeof(t3pkt)];
-static uint8_t paT3pkt2[sizeof(t3pkt)];
-static uint8_t paT3pkt3[sizeof(t3pkt)];
-static uint8_t* paT3pkt[4] = {paT3pkt0, paT3pkt1 ,paT3pkt2, paT3pkt3};
-#endif
-
-static paTestStatus_t testSendIpv4 (tFramework_t *tf, paTest_t *pat)
-{
- Cppi_HostDesc *hd;
-
- uint32_t cmdStack[4][(sizeof(pasahoNextRoute_t) + (3 * sizeof(pasahoComChkCrc_t)) + sizeof(pasahoReportTimestamp_t)) / sizeof (uint32_t)];
- uint16_t cmdStackSize[4] = {CMD_BUF_SIZE, CMD_BUF_SIZE, CMD_BUF_SIZE, CMD_BUF_SIZE};
- uint32_t rxTimestamp[4], txTimestamp[4];
- paCmdInfo_t cmdInfo[5];
- uint32_t *swinfo;
- int32_t i;
- uint16_t len;
- volatile int32_t mdebugWait = 0;
- Qmss_Queue q;
- uint16_t tsQueue;
-
- /* Because the UDP checksum must be zero, it will not be checked by default
- * but only when the checksum is generated */
- uint32_t errFlagsExptd[4] = { 0xc, 0x4, 0x8, 0x0 };
- uint32_t eflags;
-
- paReturn_t paret;
-
- pasahoNextRoute_t *panr;
- pasahoReportTimestamp_t *pats;
-
-
- paRouteInfo_t route = { pa_DEST_HOST, /* Route - host */
- 0, /* flow Id */
- 0, /* Queue */
- -1, /* Multi route disabled */
- 0, /* SWInfo 0 */
- 0, /* SWInfo 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}; /* No commands */
-
- paCmdNextRoute_t routeCmd = {
- 0, /* ctrlBitfield */
- pa_DEST_HOST, /* Route - host */
- 0, /* pktType don't care */
- 0, /* flow Id */
- 0, /* Queue */
- 0, /* SWInfo 0 */
- 0, /* SWInfo 1 */
- 0 /* multiRouteIndex (not used) */
-
- };
-
-
-
- /* Create the command stack for the four packet sends */
- memset(cmdStack, 0, sizeof(cmdStack));
- memset(cmdInfo, 0, sizeof(cmdInfo));
-
- /* Route the packet to PA Tx 0 which makes it appear to have arrived over the network */
- route.queue = tf->QPaTx[0];
- routeCmd.queue = tf->QPaTx[0];
- tsQueue = tf->QGen[Q_TIMESTAMP];
-
- /* Packet 1 - send to PA, route back to QM into PA 0 as a received packet */
- /* report timestamp */
- memcpy(paT3pkt[0], t3pkt, sizeof(t3pkt));
- /* corrupt UDP checksum */
- paT3pkt[0][40] = 0xbe;
- paT3pkt[0][41] = 0xef;
- pats = (pasahoReportTimestamp_t *)&cmdStack[0][0];
- PASAHO_SET_CMDID(pats, PASAHO_PAMOD_REPORT_TIMESTAMP);
- PASAHO_SET_REPORT_FLOW(pats, 0);
- PASAHO_SET_REPORT_QUEUE(pats,tsQueue);
- pats->swInfo0 = TEST_SWINFO0_TIMESTAMP;
-
- panr = (pasahoNextRoute_t *)&cmdStack[0][sizeof(pasahoReportTimestamp_t)/sizeof(uint32_t)];
-
- paret = Pa_formatTxRoute ( NULL, /* IPv4 header checksum */
- NULL, /* No second checksum */
- &route, /* Internal routing */
- (Ptr)panr, /* Command buffer */
- &cmdStackSize[0]); /* Command size */
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): Pa_formatTxRoute returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- return (PA_TEST_FAILED);
- }
-
- cmdStackSize[0] += sizeof(pasahoReportTimestamp_t);
-
- /* Packet 2 - send to PA for IPv4 header checksum calculation, then back to
- * QM in the PA 0 out queue */
- /* insert timestamp */
- memcpy(paT3pkt[1], t3pkt, sizeof(t3pkt));
- /* corrupt UDP checksum */
- paT3pkt[1][40] = 0xba;
- paT3pkt[1][41] = 0xbe;
- pats = (pasahoReportTimestamp_t *)&cmdStack[1][0];
- PASAHO_SET_CMDID(pats, PASAHO_PAMOD_REPORT_TIMESTAMP);
- PASAHO_SET_REPORT_FLOW(pats, 0);
- PASAHO_SET_REPORT_QUEUE(pats,tsQueue);
- pats->swInfo0 = TEST_SWINFO0_TIMESTAMP;
-
- panr = (pasahoNextRoute_t *)&cmdStack[1][sizeof(pasahoReportTimestamp_t)/sizeof(uint32_t)];
-
- paret = Pa_formatTxRoute ( &t3pktIpChksum, /* IPv4 header checksum */
- NULL, /* No second checksum */
- &route, /* Internal routing */
- (Ptr)panr, /* Command buffer */
- &cmdStackSize[1]); /* Command size */
-
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): Pa_formatTxRoute returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- return (PA_TEST_FAILED);
- }
-
- cmdStackSize[1] += sizeof(pasahoReportTimestamp_t);
-
- /* Packet 3 - send to PA for UDP checksum calculation, then back to QM
- * in the PA 0 out queue */
- /* insert timestamp */
- memcpy(paT3pkt[2], t3pkt, sizeof(t3pkt));
- pats = (pasahoReportTimestamp_t *)&cmdStack[2][0];
- PASAHO_SET_CMDID(pats, PASAHO_PAMOD_REPORT_TIMESTAMP);
- PASAHO_SET_REPORT_FLOW(pats, 0);
- PASAHO_SET_REPORT_QUEUE(pats,tsQueue);
- pats->swInfo0 = TEST_SWINFO0_TIMESTAMP;
-
- panr = (pasahoNextRoute_t *)&cmdStack[2][sizeof(pasahoReportTimestamp_t)/sizeof(uint32_t)];
-
- paret = Pa_formatTxRoute ( &t3pktUdpChksum, /* IPv4 header checksum */
- NULL, /* No second checksum */
- &route, /* Internal routing */
- (Ptr)panr, /* Command buffer */
- &cmdStackSize[2]); /* Command size */
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): Pa_formatTxRoute returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- return (PA_TEST_FAILED);
- }
-
- cmdStackSize[2] += sizeof(pasahoReportTimestamp_t);
-
- /* Packet 4 - both checksums, then back to QM for output */
- /* Commad 0: insert timestamp */
- memcpy(paT3pkt[3], t3pkt, sizeof(t3pkt));
- cmdInfo[0].cmd = pa_CMD_REPORT_TX_TIMESTAMP;
- cmdInfo[0].params.txTs.destQueue = tsQueue;
- cmdInfo[0].params.txTs.flowId = 0;
- cmdInfo[0].params.txTs.swInfo0 = TEST_SWINFO0_TIMESTAMP;
-
- /* Command 1: IP checksum */
- cmdInfo[1].cmd = pa_CMD_TX_CHECKSUM;
- cmdInfo[1].params.chksum = t3pktIpChksum;
-
- /* Command 2: UDP checksum */
- //cmdInfo[2].cmd = pa_CMD_TX_CHECKSUM;
- //cmdInfo[2].params.chksum = t3pktUdpChksum;
-
- /* Command 3: CRC */
- cmdInfo[2].cmd = pa_CMD_CRC_OP;
- cmdInfo[2].params.crcOp = t3pktCrc;
-
- /* Command 3: Next route */
- cmdInfo[3].cmd = pa_CMD_NEXT_ROUTE;
- cmdInfo[3].params.route = routeCmd;
-
- paret = Pa_formatTxCmd ( 4, /* nCmd */
- cmdInfo, /* command info */
- 0, /* offset */
- (Ptr)&cmdStack[3][0], /* Command buffer */
- &cmdStackSize[3]); /* Command size */
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): Pa_formatTxCmd returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- return (PA_TEST_FAILED);
- }
-
- /* Send the packets. Each packet transmission will result in the popping of two free
- * descriptors/buffers since the packet loops back into the QM twice - once with
- * the packet and checksums (and this arrives in Q 640 for transmit into PA) and
- * once again with the resulting packet. The descriptors popped off for inter-pa
- * transmit will wind up in the default return Q */
-
- /* Recycle the free descriptors right back to the free descriptor queue */
- q.qMgr = 0;
- q.qNum = tf->QfreeDesc;
-
- for (i = 0; i < 4; i++) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QfreeDesc)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a descriptor off the free descriptor Q (%d)\n", tfName, __FILE__, __LINE__, tf->QfreeDesc);
- return (PA_TEST_FAILED);
- }
-
- /* Setup the return for the descriptor */
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Attach the data and set the length */
- //Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)utilgAddr((uint32_t)&paT3pkt[i]), sizeof(t3pkt));
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)utilgAddr((uint32_t)paT3pkt[i]), sizeof(t3pkt));
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, sizeof(t3pkt));
-
- /* Attach the command in PS data */
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)cmdStack[i], cmdStackSize[i]);
-
- /* Send the packet to PDSP 5 */
- //mdebugWait = 1;
- //if(i == 3)
- // mdebugHaltPdsp(5);
-
- Qmss_queuePush (tf->QPaTx[5], (Ptr)hd, sizeof(t3pkt), TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestTxFmtExptStats.classify1.nPackets += 2; /* Passes once through mac, once through IP */
- paTestTxFmtExptStats.classify1.nTableMatch += 2;
- paTestTxFmtExptStats.classify2.nPackets += 1;
- paTestTxFmtExptStats.classify2.nUdp += 1;
- paTestTxFmtExptStats.classify1.nIpv4Packets += 1;
-
- //if(i == 3)
- // while(mdebugWait);
-
- //utilCycleDelay (3000);
-
-
- }
-
- /* Wait for 4 packets to arrive in the match queue */
- for (i = 0; (i < 100) && (Qmss_getQueueEntryCount(tf->QGen[Q_MATCH]) < 4); i++)
- utilCycleDelay (100);
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Did not find 4 packets in the match queue\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- /* Verify the checksum fields in the CPPI descriptor. These must arrive in order */
- for (i = 0; i < 4; i++) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_MATCH])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Error - popped a NULL descriptor\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- eflags = Cppi_getDescError (Cppi_DescType_HOST, (Cppi_Desc *)hd) & 0xf;
- Cppi_getTimeStamp (Cppi_DescType_HOST, (Cppi_Desc *)hd, &rxTimestamp[i]);
-
- testCommonRecycleLBDesc (tf, hd);
-
- if (eflags != errFlagsExptd[i]) {
- System_printf ("%s (%s:%d): Expected error flags = %d, found %d\n", tfName, __FILE__, __LINE__, errFlagsExptd[i], eflags);
- return (PA_TEST_FAILED);
- }
-
- /* Also recycle the descriptor with linked buffer used in the intermediate transfer */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QDefRet)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find descriptor for transferred packet\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
- testCommonRecycleLBDesc (tf, hd);
-
- /* Also verify the tx timestamp report packet */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_TIMESTAMP])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find Tx timestamp report packet\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- /* verify the swInfo for the received packet */
- Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **)&swinfo);
-
- if (swinfo[0] != TEST_SWINFO0_TIMESTAMP) {
- System_printf ("%s (%s:%d): Expected timestamp swInfo = 0x%08x, found 0x%08x\n", tfName, __FILE__, __LINE__, TEST_SWINFO0_TIMESTAMP,swinfo[0]);
- return (PA_TEST_FAILED);
- }
-
- /* record and compare timestamp */
- Cppi_getTimeStamp (Cppi_DescType_HOST, (Cppi_Desc *)hd, &txTimestamp[i]);
-
-#ifdef PA_T3_SHOW_TIMESTAMP
- System_printf ("pkt %d: Rx timestamp 0x%08x; Tx timestamp 0x%08x\n", i, rxTimestamp[i],txTimestamp[i]);
- System_flush();
-#endif
-
- if (txTimestamp[i] > rxTimestamp[i])
- {
- System_printf ("%s (%s:%d): Rx timestamp 0x%08x is ealier than Tx timestamp 0x%08x\n", tfName, __FILE__, __LINE__, rxTimestamp[i],txTimestamp[i]);
- return (PA_TEST_FAILED);
- }
-
-
- testCommonRecycleLBDesc (tf, hd);
-
- }
-
-
- /* Test the packet adjustment macros. The packet payload is reduced by 40 bytes,
- * the IP and UDP lengths are changed, and the packet checksum commands are updated to
- * reflect the new length. */
- /* IPv4 length */
- len = ((uint16_t)(t3pkt[T3_PKT_OFFSET_IP_LEN+0]) << 8) | t3pkt[T3_PKT_OFFSET_IP_LEN+1];
- len = len - 40;
- t3pkt[T3_PKT_OFFSET_IP_LEN+0] = len >> 8;
- t3pkt[T3_PKT_OFFSET_IP_LEN+1] = len & 0xff;
-
- /* UDP length */
- len = ((uint16_t)(t3pkt[T3_PKT_OFFSET_UDP_LEN+0]) << 8) | t3pkt[T3_PKT_OFFSET_UDP_LEN+1];
- len = len - 40;
- t3pkt[T3_PKT_OFFSET_UDP_LEN+0] = len >> 8;
- t3pkt[T3_PKT_OFFSET_UDP_LEN+1] = len & 0xff;
-
- pa_SET_TX_CHKSUM_LENGTH (&cmdStack[3][sizeof(pasahoReportTimestamp_t)/sizeof(uint32_t)], 1, len); /* Update the UDP checksum length */
- pa_SET_TX_CHKSUM_INITVAL(&cmdStack[3][sizeof(pasahoReportTimestamp_t)/sizeof(uint32_t)], 1, testCommonOnesCompAdd(len, T3_PKT_PSEUDO_HDR_CHKSUM_SANS_LEN));
-
- /*
- * Write back the entire cache to make sure that the test packets are updated.
- * Note: It may be more efficient to call CACHE_wbL1d(blockPtr, byteCnt, wait) only for
- * the portion of packet which is updated.
- *
- */
-#ifndef __LINUX_USER_SPACE
- CACHE_wbAllL1d(CACHE_WAIT);
- //CACHE_wbAllL2(CACHE_WAIT);
-#endif
-
- /* Send the packet for checksum generation, loop it back and verify the checksum */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QfreeDesc)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a descriptor off the free descriptor Q (%d)\n", tfName, __FILE__, __LINE__, tf->QfreeDesc);
- return (PA_TEST_FAILED);
- }
-
- /* Setup the return for the descriptor */
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Attach the data and set the length */
-#ifdef __LINUX_USER_SPACE
- {
- memcpy (paT3pkt[3], t3pkt, sizeof(t3pkt));
- Cppi_setOriginalBufInfo(Cppi_DescType_HOST, (Cppi_Desc *)hd, paT3pkt[3], sizeof(t3pkt) - 40);
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, paT3pkt[3], sizeof(t3pkt) - 40);
- }
-#else
- Cppi_setOriginalBufInfo(Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)utilgAddr((uint32_t)t3pkt), sizeof(t3pkt) - 40);
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)utilgAddr((uint32_t)t3pkt), sizeof(t3pkt) - 40);
-#endif
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, sizeof(t3pkt) - 40);
-
- /* Attach the command in PS data */
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)cmdStack[3], cmdStackSize[3]);
-
- /* Send the packet to PDSP 5 */
- Qmss_queuePush (tf->QPaTx[5], (Ptr)hd, sizeof(t3pkt), TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestTxFmtExptStats.classify1.nPackets += 2; /* Passes once through mac, once through IP */
- paTestTxFmtExptStats.classify1.nTableMatch += 2;
- paTestTxFmtExptStats.classify2.nPackets += 1;
- paTestTxFmtExptStats.classify2.nUdp += 1;
- paTestTxFmtExptStats.classify1.nIpv4Packets += 1;
-
-
- /* Wait for the packet to arrive in the match queue */
- for (i = 0; (i < 100) && (Qmss_getQueueEntryCount(tf->QGen[Q_MATCH]) < 1); i++)
- utilCycleDelay (100);
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Did not find the length modified packet in the match queue\n");
- return (PA_TEST_FAILED);
- }
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_MATCH])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Error - popped a NULL descriptor\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- eflags = Cppi_getDescError (Cppi_DescType_HOST, (Cppi_Desc *)hd) & 0xf;
-
- testCommonRecycleLBDesc (tf, hd);
-
- if (eflags != 0) {
- System_printf ("%s (%s:%d): Expected error flags = 0, found %d\n", tfName, __FILE__, __LINE__, eflags);
- return (PA_TEST_FAILED);
- }
-
- /* Also recycle the descriptor with linked buffer used in the intermediate transfer */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QDefRet)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find descriptor for transferred packet\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
- testCommonRecycleLBDesc (tf, hd);
-
- /* Also verify the tx timestamp report packet */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_TIMESTAMP])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find Tx timestamp report packet\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- /* verify the swInfo for the received packet */
- Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **)&swinfo);
-
- if (swinfo[0] != TEST_SWINFO0_TIMESTAMP) {
- System_printf ("%s (%s:%d): Expected timestamp swInfo = 0x%08x, found 0x%08x\n", tfName, __FILE__, __LINE__, TEST_SWINFO0_TIMESTAMP, swinfo[0]);
- return (PA_TEST_FAILED);
- }
-
- testCommonRecycleLBDesc (tf, hd);
-
- return (PA_TEST_PASSED);
-
-}
-
-static int32_t testWaitCmdReply (tFramework_t *tf, paTest_t *pat, int32_t Qcmd, uint32_t swinfo0, int32_t line)
-{
- Cppi_HostDesc *hd;
- uint32_t *swinfo;
- paEntryHandle_t reth;
- paReturn_t paret;
- int32_t htype;
- int32_t cmdDest;
- int32_t i;
-
- for (i = 0; i < 100; i++) {
- if (Qmss_getQueueEntryCount(Qcmd) > 0) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (Qcmd)) & ~15);
-
- Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **)&swinfo);
-
- if (swinfo[0] != swinfo0) {
- System_printf ("%s (%s:%d): found packet in command reply queue without reply (found 0x%08x)\n", tfName, __FILE__, line, swinfo[0]);
- testCommonRecycleLBDesc (tf, hd);
- continue;
- }
-
- paret = Pa_forwardResult (tf->passHandle, (void *)hd->buffPtr, &reth, &htype, &cmdDest);
- if (paret != pa_OK)
- System_printf ("%s (%s:%d): Pa_forwardResult returned error %d\n", tfName, __FILE__, line, paret);
-
- testCommonRecycleLBDesc (tf, hd);
-
- return (0);
-
- } else {
-
- utilCycleDelay (100);
-
- }
- }
-
- return (-1);
-
-}
-
-
-/* Check the stats */
-static paTestStatus_t t3CheckStats (tFramework_t *tf, paTest_t *pat, Bool clear)
-{
- Cppi_HostDesc *hd;
- uint8_t *bp;
- paSysStats_t *paStats;
- uint32_t blen;
- int32_t i;
- paTestStatus_t status;
-
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
- cmdReply.queue = (uint16_t) tf->QGen[Q_CMD_REPLY];
-
-
- /* Check the PA stats to make sure they are set as expected */
- cmdReply.replyId = TEST_SWINFO0_STATS_REQ;
- if (testCommonRequestPaStats (tfName, tf, clear, tf->QLinkedBuf1, tf->QGen[Q_CMD_RECYCLE], &cmdReply)) {
- System_printf ("%s (%s:%d): testCommonRequestPaStats failed\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- /* Wait for the stats reply */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (1000);
- if (Qmss_getQueueEntryCount (tf->QGen[Q_CMD_REPLY]) > 0)
- break;
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Did not find response from PA to stats request command\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- /* Recycle the descriptor/buffer returned from the stats request */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find returned descriptor/buffer from stats request\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats request\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- /* Format the stats response and compare to the expected results */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_REPLY])) & ~15);
- Cppi_getData (Cppi_DescType_HOST, (Cppi_Desc *)hd, &bp, &blen);
- paStats = (paSysStats_t *)Pa_formatStatsReply (tf->passHandle, (paCmd_t)bp);
-
- if (testCommonCompareStats (tfName, (paSysStats_t *)&paTestTxFmtExptStats, paStats))
- status = PA_TEST_FAILED;
- else
- status = PA_TEST_PASSED;
-
- if (clear)
- memset (&paTestTxFmtExptStats, 0, sizeof(paTestTxFmtExptStats));
-
- /* Recycle the descriptor and associated buffer back to queue from which it came */
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats response\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- return (status);
-}
-
-static void testCleanup (tFramework_t *tf, paTest_t *pat, paHandleL2L3_t *l2Handles, paHandleL2L3_t *l3Handles, paHandleL4_t *l4Handles, paTestStatus_t testStatus)
-{
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
- int32_t cmdCount = 0;
- int32_t i;
-
-
- paCmdReply_t reply = { pa_DEST_HOST, /* Destination */
- TEST_SWINFO0_CMD_ID, /* SW Info 0 */
- 0, /* Reply queue */
- 0 }; /* Flow ID */
-
-
- reply.queue = tf->QGen[Q_CMD_REPLY];
-
- /* Close any open handles */
- for (i = 0; i < TEST_NUM_L2_HANDLES; i++) {
- if (l2Handles[i] != 0) {
- hd = testCommonDelHandle (tf, &l2Handles[i], tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2, &reply, &cmdDest, &cmdSize, &paret);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): testCommonDelHandle returned NULL pointer, paret = %d\n", tfName, __FILE__, __LINE__, paret);
- testStatus = PA_TEST_FAILED;
- continue;
- }
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): testCommonDelHandle return PA error %d\n", tfName, __FILE__, __LINE__, paret);
- testStatus = PA_TEST_FAILED;
- continue;
- }
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestTxFmtExptStats.classify1.nPackets += 1;
- cmdCount += 1;
-
- }
- }
-
- for (i = 0; i < TEST_NUM_L3_HANDLES; i++) {
- if (l3Handles[i] != 0) {
- hd = testCommonDelHandle (tf, &l3Handles[i], tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2, &reply, &cmdDest, &cmdSize, &paret);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): testCommonDelHandle returned NULL pointer, paret = %d\n", tfName, __FILE__, __LINE__, paret);
- testStatus = PA_TEST_FAILED;
- continue;
- }
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): testCommonDelHandle return PA error %d\n", tfName, __FILE__, __LINE__, paret);
- testStatus = PA_TEST_FAILED;
- continue;
- }
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestTxFmtExptStats.classify1.nPackets += 1;
- cmdCount += 1;
-
- }
- }
-
- for (i = 0; i < TEST_NUM_L4_HANDLES; i++) {
- if ((l4Handles[i][0] != 0) || (l4Handles[i][1] != 0)) {
- hd = testCommonDelL4Handles (tf, l4Handles[i], tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2, &reply, &cmdDest, &cmdSize, &paret);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): testCommonDelHandle returned NULL pointer, paret = %d\n", tfName, __FILE__, __LINE__, paret);
- testStatus = PA_TEST_FAILED;
- continue;
- }
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): testCommonDelHandle return PA error %d\n", tfName, __FILE__, __LINE__, paret);
- testStatus = PA_TEST_FAILED;
- continue;
- }
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestTxFmtExptStats.classify2.nPackets += 1;
- cmdCount += 1;
-
- }
- }
-
-
- /* Wait for responses from the PA subsystem */
- for (i = 0; i < cmdCount; i++) {
- if (testWaitCmdReply (tf, pat, tf->QGen[Q_CMD_REPLY], TEST_SWINFO0_CMD_ID, __LINE__)) {
- System_printf ("%s (%s:%d): Missing replies to PA commands (expected in queue %d)\n", tfName, __FILE__, __LINE__, tf->QGen[Q_CMD_REPLY]);
- testStatus = PA_TEST_FAILED;
- }
- }
-
-
- /* Restore any data on queues used */
- while (Qmss_getQueueEntryCount(tf->QGen[Q_CMD_RECYCLE]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_RECYCLE])) & ~15);
- testCommonRecycleLBDesc (tf, hd);
- }
-
- while (Qmss_getQueueEntryCount(tf->QGen[Q_MATCH]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_RECYCLE])) & ~15);
- testCommonRecycleLBDesc (tf, hd);
- }
-
- while (Qmss_getQueueEntryCount(tf->QGen[Q_NFAIL]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_RECYCLE])) & ~15);
- testCommonRecycleLBDesc (tf, hd);
- }
-
-#ifndef __LINUX_USER_SPACE
- if (t3CheckStats (tf, pat, TRUE) == PA_TEST_FAILED)
- testStatus = PA_TEST_FAILED;
-#endif
-
- /* Return result */
- pat->testStatus = testStatus;
-
- /* Return */
- Task_exit();
-}
-
-
-static void testHandlePaError (tFramework_t *tf, paTest_t *pat, paReturn_t paret, paHandleL2L3_t *l2Handles, paHandleL2L3_t *l3Handles, paHandleL4_t *l4Handles, Cppi_HostDesc *hd, int32_t line)
-{
- if (paret == pa_OK)
- return;
-
- System_printf ("%s (%s:%d): Error - PA LLD returned error code %d\n", tfName, __FILE__, line, paret);
- testCommonRecycleLBDesc (tf, hd);
- testCleanup (tf, pat, l2Handles, l3Handles, l4Handles, PA_TEST_FAILED); /* no return */
-}
-
-#ifdef __LINUX_USER_SPACE
-void* paTestTxFmtRt (void *args)
-{
- tFramework_t *tf = ((paTestArgs_t *)args)->tf;
- paTest_t *pat = ((paTestArgs_t *)args)->pat;
-#else
-void paTestTxFmtRt (UArg a0, UArg a1)
-{
- tFramework_t *tf = (tFramework_t *)a0;
- paTest_t *pat = (paTest_t *)a1;
-#endif
- Cppi_HostDesc *hd;
- paReturn_t paret;
-
- paTestStatus_t testStatus = PA_TEST_PASSED;
-
- int32_t i;
- int32_t cmdDest;
- uint16_t cmdSize;
-
-
- paHandleL2L3_t l2Handles[TEST_NUM_L2_HANDLES] = { 0 };
- paHandleL2L3_t l3Handles[TEST_NUM_L3_HANDLES] = { 0 /*, 0 */};
- paHandleL4_t l4Handles[TEST_NUM_L4_HANDLES] = { {0,0} /*, {0,0} */ };
-
-
- paRouteInfo_t macMatchRoute = { pa_DEST_CONTINUE_PARSE_LUT1, /* Dest - keep parsing */
- 0, /* Flow ID */
- 0, /* Queue */
- -1, /* Multi route disabled */
- 0, /* SW Info 0 */
- 0, /* SW Info 1 */
- 0, /* customType : pa_CUSTOM_TYPE_NONE */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}; /* No commands */
-
- paRouteInfo_t ipMatchRoute = { pa_DEST_CONTINUE_PARSE_LUT2, /* Dest - keep parsing */
- 0, /* Flow ID */
- 0, /* Queue */
- -1, /* Multi route disabled */
- 0, /* SW Info 0 */
- 0, /* SW Info 1 */
- 0, /* customType : pa_CUSTOM_TYPE_NONE */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}; /* No commands */
-
-
- paRouteInfo_t udpMatchRoute = { pa_DEST_HOST, /* Dest - send to host */
- 0, /* Flow ID */
- 0, /* Queue, filled in below */
- -1, /* Multi route disabled */
- 0, /* SW Info 0 */
- 0, /* SW Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}; /* No commands */
-
- paRouteInfo_t nfailRoute = { pa_DEST_HOST, /* Dest - send to host */
- 0, /* Flow ID */
- 0, /* Queue, filled in below */
- -1, /* Multi route disabled */
- 0, /* SW Info 0 */
- 0, /* SW Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}; /* No commands */
-
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest - send to host */
- 0, /* Reply ID (SWInfo 0) */
- 0, /* Queue */
- 0, }; /* Flow ID */
-
-
-#ifdef __LINUX_USER_SPACE
- for (i = 0; (i < (sizeof(paT3pkt)/sizeof(paT3pkt[0])) ); i++) {
-
- /* Allocate memory for the Packet buffers */
- paT3pkt[i] = (uint8_t *)fw_memAlloc(sizeof(t3pkt), CACHE_LINESZ);
- if(paT3pkt[i] == NULL) {
- printf ("%s: memAlloc failed for pkt %d\n", tfName, i);
- pat->testStatus = PA_TEST_FAILED;
- return (void *)0;
- }
- }
-#endif
-
-
- /* Runtime initial values */
- udpMatchRoute.queue = (uint16_t) tf->QGen[Q_MATCH];
- nfailRoute.queue = (uint16_t) tf->QGen[Q_NFAIL];
- cmdReply.queue = (uint16_t) tf->QGen[Q_CMD_REPLY];
-
-
- /* Zero the expected stats. They are updated as the test progresses */
- memset (&paTestTxFmtExptStats, 0, sizeof(paTestTxFmtExptStats));
-
-
- /* Make table entries for the MAC/IP and L4 port numbers. The packets that are
- * generated are routed back to the PA to be received. This will verify the
- * receive checksum generation as well */
-
- /* L2 (MAC) entries */
- for (i = 0; i < TEST_NUM_L2_HANDLES; i++) {
-
- cmdReply.replyId = TEST_SWINFO0_CMD_ID;
- cmdReply.queue = tf->QGen[Q_CMD_REPLY];
- hd = testCommonAddMac (tf, pa_LUT1_INDEX_NOT_SPECIFIED, &testPaEthInfo[i], &macMatchRoute, &nfailRoute,
- &l2Handles[i], tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
-
- testHandlePaError (tf, pat, paret, l2Handles, l3Handles, l4Handles, hd, __LINE__); /* no return on error */
-
-
- /* Send the command to the PA */
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestTxFmtExptStats.classify1.nPackets += 1;
-
- /* Wait for a PA reply, and recycle the command descriptor/buffer */
- if (testWaitCmdReply (tf, pat, tf->QGen[Q_CMD_REPLY], TEST_SWINFO0_CMD_ID, __LINE__))
- testCleanup (tf, pat, l2Handles, l3Handles, l4Handles, PA_TEST_FAILED); /* no return */
-
- }
-
-
- /* L3 (IP) entries. In this test all IPs link to MAC index 0 */
- cmdReply.replyId = TEST_SWINFO0_CMD_ID;
- cmdReply.queue = tf->QGen[Q_CMD_REPLY];
-
- for (i = 0; i < TEST_NUM_L3_HANDLES; i++) {
-
- hd = testCommonAddIp (tf, pa_LUT1_INDEX_NOT_SPECIFIED, &testPaIpInfo[i], &ipMatchRoute, &nfailRoute,
- &l3Handles[i], l2Handles[0], tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- testHandlePaError (tf, pat, paret, l2Handles, l3Handles, l4Handles, hd, __LINE__); /* no return on error */
-
- /* Send the command to the PA */
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestTxFmtExptStats.classify1.nPackets += 1;
-
- /* Wait for a PA reply, and recycle the command descriptor/buffer */
- if (testWaitCmdReply (tf, pat, tf->QGen[Q_CMD_REPLY], TEST_SWINFO0_CMD_ID, __LINE__))
- testCleanup (tf, pat, l2Handles, l3Handles, l4Handles, PA_TEST_FAILED);
-
- }
-
-
- /* L4 (UDP/TCP) entries. There is a one to one link between ports and linked IP addresses */
- for (i = 0; i < TEST_NUM_L4_HANDLES; i++) {
-
- hd = testCommonAddPort (tf, pa_LUT2_PORT_SIZE_16, (uint32_t)testPaPortInfo[i], &udpMatchRoute, &(l4Handles[i]), &l3Handles[i],
- tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf1, &cmdReply, &cmdDest,
- &cmdSize, &paret);
-
-
- testHandlePaError (tf, pat, paret, l2Handles, l3Handles, l4Handles, hd, __LINE__);
-
- /* Send the command to the PA */
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestTxFmtExptStats.classify2.nPackets += 1;
-
- /* Wait for a PA reply, and recycle the command descriptor/buffer */
- if (testWaitCmdReply (tf, pat, tf->QGen[Q_CMD_REPLY], TEST_SWINFO0_CMD_ID, __LINE__))
- testCleanup (tf, pat, l2Handles, l3Handles, l4Handles, PA_TEST_FAILED);
-
- }
-
- /*
- * Configure the CRC engine for SCTP CRC-32C checksum
- * The CRC-engine connected to PDSP2 should be configured since the SCTP is within the
- * inner IP paylaod which is parased and lookup at PDSP2
- */
- cmdReply.replyId = TEST_SWINFO0_CMD_ID;
- cmdReply.queue = tf->QGen[Q_CMD_REPLY];
-
- hd = testCommonConfigCrcEngine(tf, 5, &t3CrcCfg, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf3,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- testHandlePaError (tf, pat, paret, l2Handles, l3Handles, l4Handles, hd, __LINE__); /* no return on error */
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- /* Wait for a PA reply, and recycle the command descriptor/buffer */
- if (testWaitCmdReply (tf, pat, tf->QGen[Q_CMD_REPLY], TEST_SWINFO0_CMD_ID, __LINE__))
- {
- System_printf ("%s (%s:%d): testCommonConfigCrcEngine failed\n", tfName, __FILE__, __LINE__);
- testCleanup (tf, pat, l2Handles, l3Handles, l4Handles, PA_TEST_FAILED);
- }
-
- /* Pass the IPv4 packet, verify returned packets */
- testStatus = testSendIpv4 (tf, pat);
-
-#ifndef __LINUX_USER_SPACE
- if (t3CheckStats (tf, pat, TRUE) == PA_TEST_FAILED)
- testStatus = PA_TEST_FAILED;
-#endif
-
-
- /* Close all handles and exit */
- testCleanup (tf, pat, l2Handles, l3Handles, l4Handles, testStatus);
-
-#ifdef __LINUX_USER_SPACE
- return (void *)0;
-#endif
-
-}
-
-
-
-
-
-
-
diff --git a/test/PAUnitTest2/tests/test3pkts.h b/test/PAUnitTest2/tests/test3pkts.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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.
- *
-*/
-
-
-
-
-#pragma DATA_SECTION(t3pkt, ".testPkts")
-#pragma DATA_ALIGN(t3pkt, 8)
-
-static uint8_t t3pkt[] = {
-
- /* MAC header */
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa,
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x04,
- 0x08, 0x00,
-
- /* IP header */
- 0x45, 0x00,
- 0x00, 0x6c, /* Length (including this header) */
- 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x00, 0x00, /* Header checksum */
- 0x9e, 0xda, 0x6d, 0x0a, 0x01, 0x02, 0x03, 0x04,
-
- /* UDP header */
- 0x12, 0x34, 0x05, 0x55,
- 0x00, 0x58, /* Length, including this header */
- 0x00, 0x00, /* Header checksum */
-
- /* Payload */
- 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
- 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41,
- 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
- 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
- 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
- 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61,
- 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81
-
-};
-
-/* Offsets to length fields */
-#define T3_PKT_OFFSET_IP_LEN 16
-#define T3_PKT_OFFSET_UDP_LEN 38
-
-/* The pseudo header checksum of the packet except for the 16 bit length */
-#define T3_PKT_PSEUDO_HDR_CHKSUM_SANS_LEN 0x0ffc
-
-/* IP header checksum configuration */
-static paTxChksum_t t3pktIpChksum = {
-
- 14, /* Start offset of IP header */
- 20, /* Length of IP header */
- 10, /* Offset to checksum location RELATIVE TO THE START OF THE IP HEADER */
- 0, /* Initial sum */
- 1 /* computed value of 0 written as -0 */
-
-};
-
-
-/* The UDP checksum */
-static paTxChksum_t t3pktUdpChksum = {
-
- 34, /* Start offset of UDP header */
- 88, /* Checksum length (UDP payload + UDP checksum) */
- 6, /* Offset to checksum location RELATIVE TO THE START OF THE UDP HEADER */
- 0x1054, /* Initial value is IPv4 pseudo header checksum value */
- 1 /* computed value of 0 written as -0 */
-
-};
-
-/* CRC */
-static paCmdCrcOp_t t3pktCrc = {
-
- 0, /* ctrlbit */
- 42, /* startoffset */
- 86, /* len */
- 0,
- 0,
- 0,
- 82, /* crcoffset */
- 0 /* frametype */
-
-};
-
-static paCrcConfig_t t3CrcCfg = {
- 0, /* ctrlBitfield */
- pa_CRC_SIZE_16,
- 0x80050000, /* polynomial */
- 0 /* initValue */
- };
-
-
-
-
-/* All packets in this test use a single destination address ethernet
- * routing for the L2 lookup in PA */
-static paEthInfo_t testPaEthInfo[] = {
-
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Source mac is dont care */
- { 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa }, /* Dest mac */
- 0, /* Vlan */
- 0, /* ethertype */
- 0, /* mpls tag */
- 0 /* input EMAC port */
- };
-
-/* IP lookup criteria. One for each IP packet. Only one distinguishing value
- * is really required, but it doesn't hurt to put more information */
-static paIpInfo_t testPaIpInfo[] = {
-
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* Src IP */
- { 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* Dest IP */
- 0, /* SPI */
- 0, /* flow */
- pa_IPV4, /* IP type */
- 0, /* GRE proto */
- 17, /* Protocol type = UDP */
- 0, /* TOS */
- 0, /* TOS care */
- 0 /* SCTP port */
- }
-};
-
-
-/* Port matching information */
-uint16_t testPaPortInfo[] = {
-
- 0x0555
-
-};
-
-
-
diff --git a/test/PAUnitTest2/tests/test4.c b/test/PAUnitTest2/tests/test4.c
+++ /dev/null
@@ -1,875 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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 "../pautest.h"
-
-#ifdef __LINUX_USER_SPACE
-#include "fw_test.h"
-#include "fw_mem_allocator.h"
-#endif
-
-
-/* Add/Delete IP and PDSP routing test
- * This test test the LLD Pa_addIp, Pa_delHandle and Pa_configCrcEngine functions, as well as the
- * PDSP firmware for routing IP packets. This test has the following sub-tests
- * - Test the LLD for the ability to determine if a new entry invalidates a previous entry
- * - Test the LLD to enter increasingly strict match requirements (dst, src, etype, spi, flow index, tos, gre protocol, sctp port)
- * - Test the LLD when entering more entries then configured for
- * - Test the firmware for the ability to take a burst of Pa_AddIp commands
- * - Test the firmware for the routing of matches and next step fail routes
- * - Test the firmware for the ability to detect IP header errors
- * - Test the firmware for the ability to handle nested IP headers
- * - Test the firmware for the ability to break out of too many nested IP headers
- * - Test the firmware for the ability to take a burst of data packets
- * - Test the firmware for the ability to verify the SCTP CRC32-C
- * - Test the firmware for correct header offset calculation
- * - Test the LLD/firmware for the ability to delete entries
- */
-
- static char *tfName = "paTestL3Routing";
-
- #define T4_NUM_PACKET_ITERATIONS 2 /* Number of times the packet stream is passed through */
-
- #define T4_EXPTPKT_FIFO_SIZE 20 /* Must hold the number of packets in transit in PA at one time */
-
- /* General purpose queue usage */
- #define Q_CMD_RECYCLE 0 /* Command descriptors/buffers recycled here after sent to PA */
- #define Q_CMD_REPLY 1 /* Replies from PA routed here */
- #define Q_MATCH 2 /* Packets from PA which match a lookup criteria */
- #define Q_NFAIL 3 /* Packets from PA which matches a mac lookup, but failed an L3 lookup */
- #define Q_PARSE_ERR 4 /* Packets which resulted in a parse error */
-
-
-/* The number of PA L2 and L3 handles maintained by this test */
-#define T4_NUM_LOCAL_L2_HANDLES 2
-#define T4_NUM_LOCAL_L3_OUTER_IP_HANDLES 64
-#define T4_NUM_LOCAL_L3_INNER1_IP_HANDLES 60
-#define T4_NUM_LOCAL_L3_INNER2_IP_HANDLES 4 /* Tripple nested IP Headers */
-#define T4_NUM_LOCAL_L3_HANDLES (T4_NUM_LOCAL_L3_OUTER_IP_HANDLES+T4_NUM_LOCAL_L3_INNER1_IP_HANDLES+T4_NUM_LOCAL_L3_INNER2_IP_HANDLES)
-#define T4_NUM_LOCAL_L4_HANDLES 8
-
-typedef struct t4IpPaSetup_s {
- int32_t seqId; /* Sequential enumeration to identify */
- int32_t handleIdx; /* Local handle index. Specifies which local handle corresponds to this entry */
- int32_t lHandleIdx; /* Linked handle (to previous L2 or L3 layer) */
- int32_t routeIdx; /* Which match route index to use, 0 or 1 */
- paIpInfo_t ipInfo; /* PA IP configuration structure */
- paReturn_t ret; /* Expected return code from pa_addIp command */
- Bool acked; /* Set to TRUE when the reply to the command is received */
-
-} t4IpPaSetup_t;
-
-
-#include "test4pkts.h"
-
-/* The total number of buffers with linked descriptors */
-#define TOTAL_BUFS (TF_LINKED_BUF_Q1_NBUFS + TF_LINKED_BUF_Q2_NBUFS + TF_LINKED_BUF_Q3_NBUFS)
-
- /* Commands to the PA are verified through the value in swinfo0.
- * The 16 ms bits are used as verification, the 16 lbs are for local handle id */
-#define T4_CMD_SWINFO0_ADD_MAC_ID 0x11100000 /* Identifies add mac command */
-#define T4_CMD_SWINFO0_DEL_MAC_ID 0x11110000 /* Identifies del mac command */
-#define T4_CMD_SWINFO0_ADD_IP_ID 0x22200000 /* Identifies the add IP command */
-#define T4_CMD_SWINFO0_DEL_IP_ID 0x22210000 /* Identifies the del IP command */
-#define T4_CMD_SWINFO0_ADD_PORT_ID 0x22220000 /* Identifies the add port command */
-#define T4_CMD_SWINFO0_DEL_PORT_ID 0x22230000 /* Identifies the del port command */
-#define T4_CMD_SWINFO0_STATS_REQ_ID 0x33330000 /* Identifies the req stats command */
-#define T4_CMD_SWINFO0_CRC_CFG_ID 0x44440000 /* Identifies the CRC config command */
-#define T4_CMD_SWINFO0_PKT_ID 0x55550000 /* Identifies the packet as a data packet */
-
-#define T4_CMD_SWINFO0_TYPE_MASK 0xffff0000 /* Mask for the command type */
-#define T4_CMD_SWINFO0_ID_MASK 0x0000ffff /* Mask for the local ID */
-
-
- /* L3 handles are managed. This structure is used to track the handle and
- * the activation state state of the handle */
-enum {
- T4_HANDLE_UNCONFIGURED = 0,
- T4_HANDLE_PENDING_ACK,
- T4_HANDLE_ACTIVE,
- T4_HANDLE_DISABLED
-};
-
- typedef struct t4Handles_s {
-
- paHandleL2L3_t paHandle; /* The L3 handle returned by the PA LLD */
-
- uint32_t state; /* T4_HANDLE_UNCONFIGURED = handle not configured
- * T4_HANDLE_PENDING_ACK = handle configured and sent to pa
- * T4_HANDLE_ACTIVE = handle creation acknowledged by pa
- * T4_HANDLE_DISABLED = handle was created then released */
-
- } t4Handles_t;
-
- typedef struct t4HandlesL4_s {
-
- paHandleL4_t paHandle;
-
- uint32_t state;
-
- } t4HandlesL4_t;
-
- /* A grouping of run time created grouped together to make cleanup easier on
- * error exit */
- typedef struct t4TestEncap_s {
- tFramework_t *tf;
- paTest_t *pat;
-
- /* The +1 is a place holder handle used to pass known invalid configuration into the PA LLD */
- t4Handles_t l2Handles[T4_NUM_LOCAL_L2_HANDLES+1]; /* MAC handles */
- t4Handles_t l3Handles[T4_NUM_LOCAL_L3_HANDLES+1]; /* IP handles */
- t4HandlesL4_t l4Handles[T4_NUM_LOCAL_L4_HANDLES+1]; /* UDP/TCP handles */
-
- } t4TestEncap_t;
-
-static paSysStats_t paTestL4ExpectedStats; /* Expected stats results */
-
-static paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
-static paRouteInfo_t matchRoute[3] = { { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}, /* No commands */
-
- { pa_DEST_CONTINUE_PARSE_LUT2,/* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : pa_CUSTOM_TYPE_NONE */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}, /* No commands */
-
-
- { pa_DEST_CONTINUE_PARSE_LUT1,/* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : pa_CUSTOM_TYPE_NONE */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL} /* No commands */
- };
-
-static paRouteInfo_t nfailRoute = { pa_DEST_DISCARD, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}; /* No commands */
-
-
-/* CRC Configuration of CRC-32C for SCTP */
-static paCrcConfig_t t4CrcCfg = {
- pa_CRC_CONFIG_INVERSE_RESULT, /* ctrlBitfield */
- pa_CRC_SIZE_32,
- 0x1EDC6F41, /* polynomial */
- 0xFFFFFFFF /* initValue */
- };
-
-
- void t4Cleanup (t4TestEncap_t *tencap, paTestStatus_t testStatus)
-{
- int32_t i;
- int32_t cmdDest;
- uint16_t cmdSize;
- paReturn_t paret;
- Cppi_HostDesc *hd;
- paTestStatus_t newStatus;
-
- /* Delete active L4 handles */
- for (i = 0; i < T4_NUM_LOCAL_L4_HANDLES; i++) {
-
- cmdReply.replyId = T4_CMD_SWINFO0_DEL_PORT_ID + i; /* T2_CMD_SWINFO0_ADD_ID identifies command, 16 LS bits identify the local handle number */
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- if ((tencap->l4Handles[i].state == T4_HANDLE_PENDING_ACK) || (tencap->l4Handles[i].state == T4_HANDLE_ACTIVE)) {
- hd = testCommonDelL4Handles (tencap->tf, tencap->l4Handles[i].paHandle, tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- continue;
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- /* Wait for the response */
- if (testCommonWaitCmdReply (tencap->tf, tencap->pat, tfName, cmdReply.queue, cmdReply.replyId, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonWaitCmdReply failed\n", tfName, __FILE__, __LINE__);
- testStatus = PA_TEST_FAILED;
- }
-
- /* Recycle the command packet as well */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- continue;
- }
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
- }
-
- /* Delete active L3 Handles */
- for (i = 0; i < T4_NUM_LOCAL_L3_HANDLES; i++) {
- cmdReply.replyId = T4_CMD_SWINFO0_DEL_IP_ID + i; /* T2_CMD_SWINFO0_ADD_ID identifies command, 16 LS bits identify the local handle number */
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- if ((tencap->l3Handles[i].state == T4_HANDLE_PENDING_ACK) || (tencap->l3Handles[i].state == T4_HANDLE_ACTIVE)) {
- hd = testCommonDelHandle (tencap->tf, &tencap->l3Handles[i].paHandle, tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- continue;
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestL4ExpectedStats.classify1.nPackets += 1;
-
- /* Wait for the response */
- if (testCommonWaitCmdReply (tencap->tf, tencap->pat, tfName, cmdReply.queue, cmdReply.replyId, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonWaitCmdReply failed\n", tfName, __FILE__, __LINE__);
- testStatus = PA_TEST_FAILED;
- }
- /* Recycle the command packet as well */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- continue;
- }
- testCommonRecycleLBDesc (tencap->tf, hd);
-
-
- }
- }
-
-
- /* Delete active L2 Handles */
- for (i = 0; i < T4_NUM_LOCAL_L2_HANDLES; i++) {
- cmdReply.replyId = T4_CMD_SWINFO0_DEL_MAC_ID + i; /* T2_CMD_SWINFO0_ADD_ID identifies command, 16 LS bits identify the local handle number */
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- if ((tencap->l2Handles[i].state == T4_HANDLE_PENDING_ACK) || (tencap->l2Handles[i].state == T4_HANDLE_ACTIVE)) {
- hd = testCommonDelHandle (tencap->tf, &tencap->l2Handles[i].paHandle, tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- continue;
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestL4ExpectedStats.classify1.nPackets += 1;
-
- /* Wait for the response */
- if (testCommonWaitCmdReply (tencap->tf, tencap->pat, tfName, cmdReply.queue, cmdReply.replyId, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonWaitCmdReply failed\n", tfName, __FILE__, __LINE__);
- testStatus = PA_TEST_FAILED;
- }
-
- /* Recycle the command packet as well */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- continue;
- }
- testCommonRecycleLBDesc (tencap->tf, hd);
-
-
- }
- }
-
- /* Pop any descriptors off of the return queues and restore them to the linked buffer queues or the free Q */
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_CMD_RECYCLE]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_CMD_REPLY]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_REPLY])) & ~15);
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_MATCH]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_MATCH])) & ~15);
- Qmss_queuePush (tencap->tf->QfreeDesc, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_NFAIL]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_NFAIL])) & ~15);
- Qmss_queuePush (tencap->tf->QfreeDesc, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_PARSE_ERR]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_PARSE_ERR])) & ~15);
- Qmss_queuePush (tencap->tf->QfreeDesc, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- }
-
- newStatus = testCommonCheckStats (tencap->tf, tencap->pat, tfName, &paTestL4ExpectedStats, tencap->tf->QLinkedBuf1,
- tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QGen[Q_CMD_REPLY], TRUE);
- if (newStatus == PA_TEST_FAILED)
- testStatus = PA_TEST_FAILED;
-
- /* Return result */
- tencap->pat->testStatus = testStatus;
-
- /* Return */
- Task_exit();
-}
-
-
-
- /* Check for pa lld return errors. Exit the test on any error condition */
- static void t4HandleError (t4TestEncap_t *tencap, paReturn_t paret, Cppi_HostDesc *hd, int32_t line)
- {
-
-
- if (paret == pa_OK)
- return;
-
- System_printf ("%s (%s:%d): PA LLD returned error code %d\n", tfName, __FILE__, line, paret);
-
- if ((hd != NULL) && testCommonRecycleLBDesc (tencap->tf, hd))
- System_printf ("%s: (%s:%d): testCommonRecycleLBDesc failed to return a buffer/descriptor\n", tfName, __FILE__, __LINE__);
-
- t4Cleanup (tencap, PA_TEST_FAILED); /* No return */
-
- }
-
-
- /* Look for replies to add Ip commands and verify the results */
-void t4L3CmdRep (t4TestEncap_t *tencap, t4IpPaSetup_t *ipSetup)
-{
- Cppi_HostDesc *hd;
- uint32_t *swinfo;
- paReturn_t paret;
- uint32_t swinfoType;
- uint32_t swinfoIdx;
- paEntryHandle_t reth;
- int32_t htype;
- int32_t cmdDest;
-
- while (Qmss_getQueueEntryCount(tencap->tf->QGen[Q_CMD_REPLY]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_REPLY])) & ~15);
-
- Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **)&swinfo);
-
- swinfoType = swinfo[0] & T4_CMD_SWINFO0_TYPE_MASK;
- swinfoIdx = swinfo[0] & T4_CMD_SWINFO0_ID_MASK;
-
- if (swinfoType != T4_CMD_SWINFO0_ADD_IP_ID) {
- System_printf ("%s (%s:%d): found packet in command reply queue without add IP swinfo type (found 0x%08x)\n", tfName, __FILE__, __LINE__, swinfo[0]);
- testCommonRecycleLBDesc (tencap->tf, hd);
- continue;
- }
-
- if (swinfoIdx >= sizeof(t4OuterIpInfo)/sizeof(t4IpPaSetup_t)) {
- System_printf ("%s (%s:%d): found packet in command reply queue with invalid index (found 0x%08x)\n", tfName, __FILE__, __LINE__, swinfoIdx);
- testCommonRecycleLBDesc (tencap->tf, hd);
- continue;
- }
-
- ipSetup[swinfoIdx].acked = TRUE;
- paret = Pa_forwardResult (tencap->tf->passHandle, (void *)hd->buffPtr, &reth, &htype, &cmdDest);
-
- if (paret != ipSetup[swinfoIdx].ret) {
- System_printf ("%s (%s:%d): Pa_forwardResult returned %d, expected %d\n", tfName, __FILE__, __LINE__, paret, ipSetup[swinfoIdx].ret);
- testCommonRecycleLBDesc (tencap->tf, hd);
- continue;
- }
-
- testCommonRecycleLBDesc (tencap->tf, hd);
-
- tencap->l3Handles[ipSetup[swinfoIdx].handleIdx].state = T4_HANDLE_ACTIVE;
-
- }
-
- /* Recycle the command packet */
- while (Qmss_getQueueEntryCount(tencap->tf->QGen[Q_CMD_RECYCLE]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- continue;
- }
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-}
-
-/*
- * Utility function to derive the LUT1 index from the local index
- * It is used to verify the Pa_addIP() with application specific index
- * The index should be consistent with the system allocated LUT1 index
- */
-static int32_t t4GetLUT1Index(int32_t handleIndex)
-{
- if (handleIndex >= T4_NUM_LOCAL_L3_HANDLES)
- {
- return (pa_LUT1_INDEX_NOT_SPECIFIED);
- }
-
- handleIndex = handleIndex % 64;
-
- /*
- * Special case for repeated entries
- *
- */
- if((handleIndex == 7) || (handleIndex == 18))
- return (pa_LUT1_INDEX_NOT_SPECIFIED);
-
- if (handleIndex & 1)
- {
- return (pa_LUT1_INDEX_NOT_SPECIFIED);
- }
- else
- {
- return (63 - handleIndex);
- }
-}
-
-
-static paTestStatus_t t4OpenIp (t4TestEncap_t *tencap, t4IpPaSetup_t *ipSetup, int n, t4Handles_t *linkedHandles, char *id)
-{
- int32_t i, j, m;
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
-
- for (i = 0; i < n; i++) {
- cmdReply.replyId = T4_CMD_SWINFO0_ADD_IP_ID + ipSetup[i].seqId;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- hd = testCommonAddIp (tencap->tf, t4GetLUT1Index(ipSetup[i].handleIdx), &ipSetup[i].ipInfo, &matchRoute[ipSetup[i].routeIdx], &nfailRoute,
- &tencap->l3Handles[ipSetup[i].handleIdx].paHandle,
- linkedHandles[ipSetup[i].lHandleIdx].paHandle,
- tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (hd == NULL) {
-
- /* It's not a failure if the return code from pa was expected */
- if (paret == ipSetup[i].ret) {
- ipSetup[i].acked = TRUE;
- continue;
- }
-
- System_printf ("%s: (%s:%d): Failure in common addIp command, %s entry number %d\n", tfName, __FILE__, __LINE__, id, ipSetup[i].seqId);
- t4HandleError (tencap, paret, hd, __LINE__);
- }
- else if (paret == pa_DUP_ENTRY) {
- /* The ack will be handle for the first entry */
- ipSetup[i].acked = TRUE;
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- tencap->l3Handles[ipSetup[i].handleIdx].state = T4_HANDLE_PENDING_ACK;
- paTestL4ExpectedStats.classify1.nPackets += 1;
-
- t4L3CmdRep (tencap, ipSetup);
- }
-
- /* All the packets should have been acked */
- for (i = 0; i < 100; i++) {
- t4L3CmdRep (tencap, ipSetup);
-
- for (j = m = 0; j < n; j++) {
- if (ipSetup[j].acked == TRUE)
- m += 1;
- }
-
- if (m == n)
- break;
- else
- utilCycleDelay (1000);
- }
-
- if (i == 100) {
- System_printf ("%s: (%s:%d): Command %d (out of %d) addIp commands were acked (%s)\n", tfName, __FILE__, __LINE__, m, n, id);
- return (PA_TEST_FAILED);
- }
-
- return (PA_TEST_PASSED);
-
-}
-
-static Cppi_HostDesc *t4FormPktDataDescr (t4TestEncap_t *tencap, int32_t idx)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QfreeDesc)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a descriptor off the free descriptor Q (%d)\n", tfName, __FILE__, __LINE__, tencap->tf->QfreeDesc);
- return (NULL);
- }
-
- /* Recycle the free descriptors right back to the free descriptor queue */
- q.qMgr = 0;
- q.qNum = tencap->tf->QfreeDesc;
-
- /* Setup the return for the descriptor */
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Make sure there is no control info. */
- Cppi_setPSLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, 0);
-
- /* Attach the data and set the length */
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)utilgAddr((uint32_t)t4PktInfo[idx].pkt), t4PktInfo[idx].pktLen);
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, t4PktInfo[idx].pktLen);
-
- return (hd);
-}
-
-
-/* Look for packets in the receive queue, verify the match */
-int32_t t4RxPkts (t4TestEncap_t *tencap, pauFifo_t *fifo)
-{
- Cppi_HostDesc *hd;
- uint32_t idx;
- int32_t n;
- pasahoLongInfo_t *pinfo;
- uint32_t infoLen;
-
- /* Look for packets in the receive queue */
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_MATCH]) > 0) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_MATCH])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a descriptor off the receive packet queue\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- /* The packets must arrive in order */
- idx = commonFifoPopElement (fifo, &n);
- if (n == 0) {
- System_printf ("%s (%s:%d): Error - found an empty receive packet tracking index fifo\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- /* Verify the parse information is correct */
- if (Cppi_getPSData (Cppi_DescType_HOST, Cppi_PSLoc_PS_IN_DESC, (Cppi_Desc *)hd, (uint8_t **)&pinfo, &infoLen) != CPPI_SOK) {
- System_printf ("%s (%s:%d): Error getting control info from received data packet\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- if (testCommonComparePktInfo (tfName, t4PktInfo[idx].info, pinfo)) {
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- return (0);
-
-}
-
-
-#ifdef __LINUX_USER_SPACE
-void* paTestL3Routing (void *args)
-{
- void *a0 = (void *)((paTestArgs_t *)args)->tf;
- void *a1 = (void *)((paTestArgs_t *)args)->pat;
-#else
-void paTestL3Routing (UArg a0, UArg a1)
-{
-#endif
- t4TestEncap_t t4Encap;
- Cppi_HostDesc *hd[10];
- paReturn_t paret;
- int32_t i, j, n;
- int32_t cmdDest;
- uint16_t cmdSize;
- paTestStatus_t testStatus = PA_TEST_PASSED;
- paTestStatus_t newStatus;
-
- uint32_t fifoData[T4_EXPTPKT_FIFO_SIZE];
- pauFifo_t fifo = { 0, 0, T4_EXPTPKT_FIFO_SIZE, NULL };
-
-
-
- volatile int32_t mdebugWait = 1;
-
-
- /* Initialize the test state */
- fifo.data = fifoData;
- memset (&t4Encap, 0, sizeof(t4Encap));
- t4Encap.tf = (tFramework_t *)a0;
- t4Encap.pat = (paTest_t *)a1;
- for (i = 0; i < T4_NUM_LOCAL_L4_HANDLES; i++)
- t4Encap.l4Handles[i].state = T4_HANDLE_UNCONFIGURED;
- for (i = 0; i < T4_NUM_LOCAL_L3_HANDLES; i++)
- t4Encap.l3Handles[i].state = T4_HANDLE_UNCONFIGURED;
- for (i = 0; i < T4_NUM_LOCAL_L2_HANDLES; i++)
- t4Encap.l2Handles[i].state = T4_HANDLE_UNCONFIGURED;
-
-#ifdef __LINUX_USER_SPACE
- for (i = 0; (i < (sizeof(t4PktInfo) / sizeof(pktTestInfo_t))); i++) {
- int pktSz;
- uint8_t *pkt;
-
- switch (i) {
- case 0:
- pktSz = sizeof(pkt0);
- pkt = pkt0;
- break;
-
- case 1:
- pktSz = sizeof(pkt1);
- pkt = pkt1;
- break;
-
- case 2:
- pktSz = sizeof(pkt2);
- pkt = pkt2;
- break;
-
- case 3:
- pktSz = sizeof(pkt3);
- pkt = pkt3;
- break;
-
- }
-
- /* Allocate memory for the Packet buffers */
- t4PktInfo[i].pkt = (uint8_t *)fw_memAlloc(pktSz, CACHE_LINESZ);
- if(t4PktInfo[i].pkt == NULL) {
- printf ("%s: memAlloc failed for pkt %d\n", tfName, i);
- t4Encap.pat->testStatus = PA_TEST_FAILED;
- return (void *)0;
- }
- memcpy(t4PktInfo[i].pkt, pkt, pktSz);
- }
-#endif
-
-
- /* Runtime initial values */
- matchRoute[0].queue = (uint16_t) t4Encap.tf->QGen[Q_MATCH];
- nfailRoute.queue = (uint16_t) t4Encap.tf->QGen[Q_NFAIL];
- cmdReply.queue = (uint16_t) t4Encap.tf->QGen[Q_CMD_REPLY];
-
- /* Zero out the expected stats. The stats will be updated as packets are sent into PA */
- memset (&paTestL4ExpectedStats, 0, sizeof(paTestL4ExpectedStats));
-
-
- /*
- * Configure the CRC engine for SCTP CRC-32C checksum
- * The CRC-engine connected to PDSP2 should be configured since the SCTP is within the
- * inner IP paylaod which is parased and lookup at PDSP2
- */
- cmdReply.replyId = T4_CMD_SWINFO0_CRC_CFG_ID;
- cmdReply.queue = t4Encap.tf->QGen[Q_CMD_REPLY];
-
- hd[0] = testCommonConfigCrcEngine(t4Encap.tf, 2, &t4CrcCfg, t4Encap.tf->QGen[Q_CMD_RECYCLE], t4Encap.tf->QLinkedBuf3,
- &cmdReply, &cmdDest, &cmdSize, &paret);
- t4HandleError (&t4Encap, paret, hd[i], __LINE__); /* Will not return on error */
-
- Qmss_queuePush (t4Encap.tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[0], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestL4ExpectedStats.classify1.nPackets += 1;
-
- if (testCommonWaitCmdReply (t4Encap.tf, t4Encap.pat, tfName, cmdReply.queue, T4_CMD_SWINFO0_CRC_CFG_ID, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonConfigCrcEngine failed\n", tfName, __FILE__, __LINE__);
- newStatus = PA_TEST_FAILED;
- }
-
- /* Recycle the command packet as well */
- hd[0] = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (t4Encap.tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd[0] == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- newStatus = PA_TEST_FAILED;
- }
- testCommonRecycleLBDesc (t4Encap.tf, hd[0]);
-
- /* Add two mac entries into the table. All the test packets will match one of these */
- for (i = 0; i < T4_NUM_LOCAL_L2_HANDLES; i++) {
- cmdReply.replyId = T4_CMD_SWINFO0_ADD_MAC_ID + i; /* T2_CMD_SWINFO0_ADD_ID identifies command, 16 LS bits identify the local handle number */
- cmdReply.queue = t4Encap.tf->QGen[Q_CMD_REPLY];
-
- hd[i] = testCommonAddMac (t4Encap.tf, pa_LUT1_INDEX_NOT_SPECIFIED, (paEthInfo_t *)&t4EthInfo[i], &matchRoute[2], &nfailRoute,
- &t4Encap.l2Handles[i].paHandle, t4Encap.tf->QGen[Q_CMD_RECYCLE], t4Encap.tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- t4HandleError (&t4Encap, paret, hd[i], __LINE__); /* Will not return on error */
-
- }
-
-
- /* Send the commands to PA. Each will result in 1 packet in classify1 */
- for (i = 0; i < T4_NUM_LOCAL_L2_HANDLES; i++) {
- Qmss_queuePush (t4Encap.tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[i], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- t4Encap.l2Handles[i].state = T4_HANDLE_PENDING_ACK;
- paTestL4ExpectedStats.classify1.nPackets += 1;
- }
-
- /* Wait for the responses. They will be received in the order in which they were sent */
- newStatus = testStatus;
- for (i = 0; i < T4_NUM_LOCAL_L2_HANDLES; i++) {
-
- if (testCommonWaitCmdReply (t4Encap.tf, t4Encap.pat, tfName, cmdReply.queue, T4_CMD_SWINFO0_ADD_MAC_ID + i, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonWaitCmdReply failed\n", tfName, __FILE__, __LINE__);
- newStatus = PA_TEST_FAILED;
- }
-
- /* Recycle the command packet as well */
- hd[0] = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (t4Encap.tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd[0] == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- newStatus = PA_TEST_FAILED;
- }
- testCommonRecycleLBDesc (t4Encap.tf, hd[0]);
- }
-
- if (newStatus == PA_TEST_FAILED)
- t4Cleanup (&t4Encap, newStatus); /* No return */
-
-
-
-
- /* Burst in the next set of command packets. These packets are used as for the outer header in nested
- * packets. It will include several configurations that are invalid. These are detected and
- * verified by the swinfo0 ID */
- n = sizeof (t4OuterIpInfo) / sizeof (t4IpPaSetup_t);
- newStatus = t4OpenIp (&t4Encap, t4OuterIpInfo, n, t4Encap.l2Handles, "Outer IP headers");
- if (newStatus == PA_TEST_FAILED)
- t4Cleanup (&t4Encap, newStatus); /* No return */
-
- /* Repeat for Inner IP packets (which are linked to outer IP packets) */
- n = sizeof (t4InnerIpInfo) / sizeof (t4IpPaSetup_t);
- newStatus = t4OpenIp (&t4Encap, t4InnerIpInfo, n, t4Encap.l3Handles, "Inner IP headers");
- if (newStatus == PA_TEST_FAILED)
- t4Cleanup (&t4Encap, newStatus); /* No return */
-
- /* One more time for tripple layered IP headers */
- n = sizeof (t4InnerInnerIpInfo) / sizeof (t4IpPaSetup_t);
- newStatus = t4OpenIp (&t4Encap, t4InnerInnerIpInfo, n, t4Encap.l3Handles, "Inner IP headers");
- if (newStatus == PA_TEST_FAILED)
- t4Cleanup (&t4Encap, newStatus); /* No return */
-
-
- /* Verify and clear the stats */
- newStatus = testCommonCheckStats (t4Encap.tf, t4Encap.pat, tfName, &paTestL4ExpectedStats, t4Encap.tf->QLinkedBuf1,
- t4Encap.tf->QGen[Q_CMD_RECYCLE], t4Encap.tf->QGen[Q_CMD_REPLY], TRUE);
-
- if (newStatus == PA_TEST_FAILED) {
- System_printf ("%s (%s:%d): testCommonCheckStats Failed\n", tfName, __FILE__, __LINE__);
- t4Cleanup (&t4Encap, newStatus); /* No return */
- }
-
- /* Fire in each of the data packets multiple times */
- n = sizeof (t4PktInfo) / sizeof (pktTestInfo_t);
- for (j = 0; j < T4_NUM_PACKET_ITERATIONS; j++) {
- for (i = 0; i < n; i++) {
- hd[0] = t4FormPktDataDescr (&t4Encap, i);
- if (hd[0] == NULL) {
- System_printf ("%s (%s:%d): Failed to get free descriptor\n", tfName, __FILE__, __LINE__);
- t4Cleanup (&t4Encap, PA_TEST_FAILED);
- }
-
- Qmss_queuePush (t4Encap.tf->QPaTx[0], (Ptr)hd[0], t4PktInfo[i].pktLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- testCommonIncStats (t4PktInfo[i].statsMap, &paTestL4ExpectedStats);
-
- if ((t4PktInfo[i].idx & T4_PACKET_DEST_MASK) == T4_PACKET_L3_MATCH_VALID) {
- if (commonFifoPushElement (&fifo, (uint32_t)i) < 0) {
- System_printf ("%s (%s:%d): Test failed - fifo is full\n", tfName, __FILE__, __LINE__);
- t4Cleanup (&t4Encap, PA_TEST_FAILED);
- }
- }
- }
-
- /* Dealy to allow packets go through the PASS */
- utilCycleDelay (4000);
-
- if (t4RxPkts (&t4Encap, &fifo))
- t4Cleanup (&t4Encap, PA_TEST_FAILED);
- }
-
- /* Give some delay for all packets to pass through the system */
- utilCycleDelay (4000);
- if (t4RxPkts (&t4Encap, &fifo))
- t4Cleanup (&t4Encap, PA_TEST_FAILED);
-
- /* The packet index fifo must be empty */
- n = commonFifoGetCount (&fifo);
- if (n != 0) {
- System_printf ("%s (%s:%d): Packet reception complete but packet index fifo not empty\n", tfName, __FILE__, __LINE__);
- t4Cleanup (&t4Encap, PA_TEST_FAILED);
- }
-
-
- /* Verify and clear the stats */
- newStatus = testCommonCheckStats (t4Encap.tf, t4Encap.pat, tfName, &paTestL4ExpectedStats, t4Encap.tf->QLinkedBuf1,
- t4Encap.tf->QGen[Q_CMD_RECYCLE], t4Encap.tf->QGen[Q_CMD_REPLY], TRUE);
- if (newStatus == PA_TEST_FAILED)
- System_printf ("%s (%s:%d): testCommonCheckStats Failed\n", tfName, __FILE__, __LINE__);
-
-
- /* No return from cleanup */
- t4Cleanup (&t4Encap, newStatus);
-
-#ifdef __LINUX_USER_SPACE
- return (void *)0;
-#endif
-
-}
-
-
-
-
-
-
diff --git a/test/PAUnitTest2/tests/test4pkts.h b/test/PAUnitTest2/tests/test4pkts.h
+++ /dev/null
@@ -1,3410 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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.
- *
-*/
-
-
-
-#ifndef TEST4PKTS_H_
-#define TEST4PKTS_H_
-
-
-
-/* Valid rx MAC addresses used during the test */
-#pragma DATA_SECTION (t4EthInfo, ".testPkts")
-static paEthInfo_t t4EthInfo[] = {
-
- {
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Source mac is dont care */
- { 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa }, /* Dest mac */
- 0, /* Vlan */
- 0, /* ethertype */
- 0, /* mpls tag */
- 0 /* input EMAC port */
- },
-
- {
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Source mac is dont care */
- { 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09 }, /* Dest mac */
- 0, /* Vlan */
- 0, /* ethertype */
- 0, /* mpls tag */
- 0 /* input EMAC port */
- }
-
-
-};
-
-
-
-/* Outer IP configuration */
-#pragma DATA_SECTION (t4OuterIpInfo, ".testPkts")
-static t4IpPaSetup_t t4OuterIpInfo[] = {
-
- /* ------- Entry 0 ----------- */
- {
- 0, /* Sequential ID */
- 0, /* Local Handle Index */
- 1, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 203, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 1 ----------- */
- {
- 1, /* Sequential ID */
- 1, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 110, 111, 112, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 203, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 2 ----------- */
- /* Route on Dest IP only */
- {
- 2, /* Sequential ID */
- 2, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 3 ----------- */
- /* The same IP address as Entry 2, but with a different assocated mac */
- {
- 3, /* Sequential ID */
- 3, /* Local Handle Index */
- 1, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 4 ----------- */
- /* Route on source and dest IP (more specific then Entry 2) */
- {
- 4, /* Sequential ID */
- 4, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 81, 82, 83, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 5 ----------- */
- /* Route on source IP, dest IP, protocol = UDP(more specific then Entry 2, 3) */
- {
- 5, /* Sequential ID */
- 5, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 81, 82, 83, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 17, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 6 ----------- */
- /* Route on source IP, dest IP, protocol = TCP(more specific then Entry 2, 3) */
- {
- 6, /* Sequential ID */
- 6, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 81, 82, 83, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 7 ----------- */
- /* Route on source IP, dest IP, protocol = UDP, TOS (more specific than Entry 2, 3, 5) */
- {
- 7, /* Sequential ID */
- 7, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 81, 82, 83, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 17, /* Protocol */
- 0x20, /* TOS */
- 1, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 8 ----------- */
- /* Route on source IP, more general than Entry 3, 5, should be rejected */
- {
- 8, /* Sequential ID */
- T4_NUM_LOCAL_L3_HANDLES, /* Local Handle Index - essentially a discard */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 81, 82, 83, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_INVALID_TABLE_MORE_SPECIFIC_ENTRY_PRESENT, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 9 ----------- */
- /* Same as entry 7, should be replaced or rejected */
- {
- 7, /* Sequential ID */
- 7, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 81, 82, 83, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 17, /* Protocol */
- 0x20, /* TOS */
- 1, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_INVALID_DUP_ENTRY, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 10 ----------- */
- /* Route based on source IP only */
- {
- 10, /* Sequential ID */
- 8, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 81, 82, 83, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 11 ----------- */
- /* Route based on source GRE protocol only */
- {
- 11, /* Sequential ID */
- 9, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0x0800, /* GRE Protocol = IPv4 */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 12 ----------- */
- /* Route based on SPI only */
- {
- 12, /* Sequential ID */
- 10, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0x12345678, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol = IPv4 */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 13 ----------- */
- /* IPv6 route on dest only */
- {
- 13, /* Sequential ID */
- 11, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV6, /* IP Type */
- 0, /* GRE Protocol = IPv4 */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 14 ----------- */
- /* IPv6 route on dest, source only */
- {
- 14, /* Sequential ID */
- 12, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66 }, /* IP Source address */
- { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV6, /* IP Type */
- 0, /* GRE Protocol = IPv4 */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 15 ----------- */
- /* IPv6 route on dest, source, flow */
- {
- 15, /* Sequential ID */
- 13, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66 }, /* IP Source address */
- { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}, /* IP Destination address */
- 0, /* SPI */
- 0x98765, /* Flow */
- pa_IPV6, /* IP Type */
- 0, /* GRE Protocol = IPv4 */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 16 ----------- */
- /* IPv6 route on dest, source, flow, protocol */
- {
- 16, /* Sequential ID */
- 14, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66 }, /* IP Source address */
- { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}, /* IP Destination address */
- 0, /* SPI */
- 0x98765, /* Flow */
- pa_IPV6, /* IP Type */
- 0, /* GRE Protocol = IPv4 */
- 17, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 17 ----------- */
- /* IPv6 route on dest, source, flow, protocol */
- {
- 17, /* Sequential ID */
- 15, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66 }, /* IP Source address */
- { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}, /* IP Destination address */
- 0, /* SPI */
- 0x98765, /* Flow */
- pa_IPV6, /* IP Type */
- 0, /* GRE Protocol = IPv4 */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 18 ----------- */
- /* IPv6 route on dest, source, flow, protocol, gre protocol */
- {
- 18, /* Sequential ID */
- 16, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66 }, /* IP Source address */
- { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}, /* IP Destination address */
- 0, /* SPI */
- 0x98765, /* Flow */
- pa_IPV6, /* IP Type */
- 0x0800, /* GRE Protocol = IPv4 */
- 47, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 19 ----------- */
- /* IPv6 route on dest, source, flow, protocol, spi */
- {
- 19, /* Sequential ID */
- 17, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66 }, /* IP Source address */
- { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}, /* IP Destination address */
- 0x44445555, /* SPI */
- 0x98765, /* Flow */
- pa_IPV6, /* IP Type */
- 0, /* GRE Protocol */
- 50, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 20 ----------- */
- /* IPv6 route on dest, source, flow, protocol, spi */
- {
- 20, /* Sequential ID */
- 18, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66 }, /* IP Source address */
- { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}, /* IP Destination address */
- 0x44445555, /* SPI */
- 0x98765, /* Flow */
- pa_IPV6, /* IP Type */
- 0, /* GRE Protocol */
- 51, /* Protocol AH */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 21 ----------- */
- /* More general IPv6 then entry 20, should be rejected */
- {
- 21, /* Sequential ID */
- T4_NUM_LOCAL_L3_HANDLES, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66 }, /* IP Source address */
- { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}, /* IP Destination address */
- 0x44445555, /* SPI */
- 0x98765, /* Flow */
- pa_IPV6, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_INVALID_TABLE_MORE_SPECIFIC_ENTRY_PRESENT, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 22 ----------- */
- /* Identical to entry 20, should be rejected or replaced */
- {
- 20, /* Sequential ID */
- 18, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66 }, /* IP Source address */
- { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}, /* IP Destination address */
- 0x44445555, /* SPI */
- 0x98765, /* Flow */
- pa_IPV6, /* IP Type */
- 0, /* GRE Protocol */
- 51, /* Protocol AH */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_INVALID_DUP_ENTRY, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 23 ----------- */
- /* Route on Destination IP only. On match continue parse (used for nested IP) */
- {
- 23, /* Sequential ID */
- 19, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 2, /* Route Index - continue L3 parse */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 24 ----------- */
- /* Route on Destination IP only. On match continue parse (used for nested IP) */
- {
- 24, /* Sequential ID */
- 20, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 2, /* Route Index - continue L3 parse */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 25 ----------- */
- /* Route on Destination IP only */
- {
- 25, /* Sequential ID */
- 21, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 26 ----------- */
- /* Route on Destination IP only */
- {
- 26, /* Sequential ID */
- 22, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 27 ----------- */
- /* Route on Destination IP only */
- {
- 27, /* Sequential ID */
- 23, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 81, 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 28 ----------- */
- /* Route on Destination IP only */
- {
- 28, /* Sequential ID */
- 24, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 29 ----------- */
- /* Route on Destination IP only */
- {
- 29, /* Sequential ID */
- 25, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 30 ----------- */
- /* Route on Destination IP only */
- {
- 30, /* Sequential ID */
- 26, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 31 ----------- */
- /* Route on Destination IP only */
- {
- 31, /* Sequential ID */
- 27, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 32 ----------- */
- /* Route on Destination IP only */
- {
- 32, /* Sequential ID */
- 28, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 33 ----------- */
- /* Route on Destination IP only */
- {
- 33, /* Sequential ID */
- 29, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 34 ----------- */
- /* Route on Destination IP only */
- {
- 34, /* Sequential ID */
- 30, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 35 ----------- */
- /* Route on Destination IP only */
- {
- 35, /* Sequential ID */
- 31, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 36 ----------- */
- /* Route on Destination IP only */
- {
- 36, /* Sequential ID */
- 32, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 37 ----------- */
- /* Route on Destination IP only */
- {
- 37, /* Sequential ID */
- 33, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 38 ----------- */
- /* Route on Destination IP only */
- {
- 38, /* Sequential ID */
- 34, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
-
- /* ------- Entry 39 ----------- */
- /* Route on Destination IP only */
- {
- 39, /* Sequential ID */
- 35, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 40 ----------- */
- /* Route on Destination IP only */
- {
- 40, /* Sequential ID */
- 36, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 41 ----------- */
- /* Route on Destination IP only */
- {
- 41, /* Sequential ID */
- 37, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 42 ----------- */
- /* Route on Destination IP only */
- {
- 42, /* Sequential ID */
- 38, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 43 ----------- */
- /* Route on Destination IP only */
- {
- 43, /* Sequential ID */
- 39, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 44 ----------- */
- /* Route on Destination IP only */
- {
- 44, /* Sequential ID */
- 40, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 45 ----------- */
- /* Route on Destination IP only */
- {
- 45, /* Sequential ID */
- 41, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 46 ----------- */
- /* Route on Destination IP only */
- {
- 46, /* Sequential ID */
- 42, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 47 ----------- */
- /* Route on Destination IP only */
- {
- 47, /* Sequential ID */
- 43, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 48 ----------- */
- /* Route on Destination IP only */
- {
- 48, /* Sequential ID */
- 44, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 49 ----------- */
- /* Route on Destination IP only */
- {
- 49, /* Sequential ID */
- 45, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 50 ----------- */
- /* Route on Destination IP only */
- {
- 50, /* Sequential ID */
- 46, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 51 ----------- */
- /* Route on Destination IP only */
- {
- 51, /* Sequential ID */
- 47, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 52 ----------- */
- /* Route on Destination IP only */
- {
- 52, /* Sequential ID */
- 48, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 53 ----------- */
- /* Route on Destination IP only */
- {
- 53, /* Sequential ID */
- 49, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 54 ----------- */
- /* Route on Destination IP only */
- {
- 54, /* Sequential ID */
- 50, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 55 ----------- */
- /* Route on Destination IP only */
- {
- 55, /* Sequential ID */
- 51, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 56 ----------- */
- /* Route on Destination IP only */
- {
- 56, /* Sequential ID */
- 52, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 57 ----------- */
- /* Route on Destination IP only */
- {
- 57, /* Sequential ID */
- 53, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 58 ----------- */
- /* Route on Destination IP only */
- {
- 58, /* Sequential ID */
- 54, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 59 ----------- */
- /* Route on Destination IP only */
- {
- 59, /* Sequential ID */
- 55, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 60 ----------- */
- /* Route on Destination IP only */
- {
- 60, /* Sequential ID */
- 56, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 61 ----------- */
- /* Route on Destination IP only */
- {
- 61, /* Sequential ID */
- 57, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 62 ----------- */
- /* Route on Destination IP only */
- {
- 62, /* Sequential ID */
- 58, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 63 ----------- */
- /* Route on Destination IP only */
- {
- 63, /* Sequential ID */
- 59, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 64 ----------- */
- /* Route on Destination IP only */
- {
- 64, /* Sequential ID */
- 60, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 65 ----------- */
- /* Route on Destination IP only */
- {
- 65, /* Sequential ID */
- 61, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
-
- /* ------- Entry 66 ----------- */
- /* Route on Destination IP only */
- {
- 66, /* Sequential ID */
- 62, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 67 ----------- */
- /* Route on Destination IP only */
- {
- 67, /* Sequential ID */
- 63, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 114, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 68 ----------- */
- /* Route on Destination IP only - the hardware table is full */
- {
- 68, /* Sequential ID */
- T4_NUM_LOCAL_L3_HANDLES, /* Local Handle Index */
- 0, /* L2 Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 71, 72, 73, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol ESP */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_LUT_ENTRY_FAILED, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- }
-
-
-};
-
-
-/* The following configurations link to an IP header (nested inner IP) */
-#pragma DATA_SECTION (t4InnerIpInfo, ".testPkts")
-static t4IpPaSetup_t t4InnerIpInfo[] = {
-
- /* ------- Entry 0 -----------
- * match IP dest only */
- {
- 0, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 0, /* Local Handle Index */
- 19, /* L3 Outer IP Handle Index */
- /* Note: It is entry 23 */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 1 -----------
- * match IP dest and source */
- {
- 1, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 1, /* Local Handle Index */
- 19, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 2 -----------
- * match IP dest, srouce, protocol, and sctp Port */
- {
- 2, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 2, /* Local Handle Index */
- 19, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 132, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0xd75d /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 3 -----------
- * match IP dest, srouce, protocol, TOS */
- {
- 3, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 3, /* Local Handle Index */
- 19, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 17, /* Protocol */
- 0x20, /* TOS */
- 1, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 4 -----------
- * match IP dest only, outer IP index = 24 */
- {
- 4, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 4, /* Local Handle Index */
- 24, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 20, 21, 22, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 5 -----------
- * match IP dest, source , outer IP index = 24 */
- {
- 5, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 5, /* Local Handle Index */
- 24, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 120, 121, 122, 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 20, 21, 22, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 6 -----------
- * match IP dest, source, protocol , outer IP index = 24 */
- {
- 6, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 6, /* Local Handle Index */
- 24, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 120, 121, 122, 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 20, 21, 22, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 17, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 7 -----------
- * match IP dest, source, protocol , outer IP index = 24 */
- {
- 7, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 7, /* Local Handle Index */
- 24, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 120, 121, 122, 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 20, 21, 22, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 8 -----------
- * match source, more general then entry 5-7, should be rejected*/
- {
- 8, /* Sequential ID */
- T4_NUM_LOCAL_L3_HANDLES, /* Local Handle Index */
- 24, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 120, 121, 122, 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_INVALID_TABLE_MORE_SPECIFIC_ENTRY_PRESENT, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 9 -----------
- * identical to entry 7, should be rejected or replaced */
- {
- 7, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 7, /* Local Handle Index */
- 24, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 120, 121, 122, 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 20, 21, 22, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_INVALID_DUP_ENTRY, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 10 -----------
- * match IP dest outer IP index = 23 */
- {
- 10, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 8, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 11 -----------
- * match IP dest outer IP index = 23 */
- {
- 11, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 9, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 12 -----------
- * match IP dest outer IP index = 23 */
- {
- 12, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 10, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 13 -----------
- * match IP dest outer IP index = 23 */
- {
- 13, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 11, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 14 -----------
- * match IP dest outer IP index = 23 */
- {
- 14, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 12, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 15 -----------
- * match IP dest outer IP index = 23 */
- {
- 15, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 13, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 16 -----------
- * match IP dest outer IP index = 23 */
- {
- 16, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 14, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 17 -----------
- * match IP dest outer IP index = 23 */
- {
- 17, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 15, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 18 -----------
- * match IP dest outer IP index = 23 */
- {
- 18, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 16, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 19 -----------
- * match IP dest outer IP index = 23 */
- {
- 19, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 17, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 20 -----------
- * match IP dest outer IP index = 23 */
- {
- 20, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 18, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 21 -----------
- * match IP dest outer IP index = 23 */
- {
- 21, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 19, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 22 -----------
- * match IP dest outer IP index = 23 */
- {
- 22, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 20, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 23 -----------
- * match IP dest outer IP index = 23 */
- {
- 23, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 20, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 24 -----------
- * match IP dest outer IP index = 23 */
- {
- 24, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 21, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 25 -----------
- * match IP dest outer IP index = 23 */
- {
- 25, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 22, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 26 -----------
- * match IP dest outer IP index = 23 */
- {
- 26, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 23, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 27 -----------
- * match IP dest outer IP index = 23 */
- {
- 27, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 24, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 28 -----------
- * match IP dest outer IP index = 23 */
- {
- 28, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 25, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 29 -----------
- * match IP dest outer IP index = 23 */
- {
- 29, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 26, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 30 -----------
- * match IP dest outer IP index = 23 */
- {
- 30, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 27, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 31 -----------
- * match IP dest outer IP index = 23 */
- {
- 31, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 28, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 32 -----------
- * match IP dest outer IP index = 23 */
- {
- 32, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 29, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 33 -----------
- * match IP dest outer IP index = 23 */
- {
- 33, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 30, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 34 -----------
- * match IP dest outer IP index = 23 */
- {
- 34, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 31, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 35 -----------
- * match IP dest outer IP index = 23 */
- {
- 35, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 32, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 36 -----------
- * match IP dest outer IP index = 23 */
- {
- 36, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 33, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 37 -----------
- * match IP dest outer IP index = 23 */
- {
- 37, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 33, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 38 -----------
- * match IP dest outer IP index = 23 */
- {
- 38, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 34, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 39 -----------
- * match IP dest outer IP index = 23 */
- {
- 39, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 35, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 40 -----------
- * match IP dest outer IP index = 23 */
- {
- 40, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 36, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 41 -----------
- * match IP dest outer IP index = 23 */
- {
- 41, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 37, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 42 -----------
- * match IP dest outer IP index = 23 */
- {
- 42, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 38, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 43 -----------
- * match IP dest outer IP index = 23 */
- {
- 43, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 39, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 44 -----------
- * match IP dest outer IP index = 23 */
- {
- 44, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 40, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 45 -----------
- * match IP dest outer IP index = 23 */
- {
- 45, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 41, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 46 -----------
- * match IP dest outer IP index = 23 */
- {
- 46, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 42, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 47 -----------
- * match IP dest outer IP index = 23 */
- {
- 47, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 43, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 48 -----------
- * match IP dest outer IP index = 23 */
- {
- 48, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 44, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 49 -----------
- * match IP dest outer IP index = 23 */
- {
- 49, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 45, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 50 -----------
- * match IP dest outer IP index = 23 */
- {
- 50, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 46, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
-
- /* ------- Entry 51 -----------
- * match IP dest outer IP index = 23 */
- {
- 51, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 47, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 52 -----------
- * match IP dest outer IP index = 23 */
- {
- 52, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 48, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 53 -----------
- * match IP dest outer IP index = 23 */
- {
- 53, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 49, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 54 -----------
- * match IP dest outer IP index = 23 */
- {
- 54, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 50, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 55 -----------
- * match IP dest outer IP index = 23 */
- {
- 55, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 51, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 56 -----------
- * match IP dest outer IP index = 23 */
- {
- 56, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 52, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 57 -----------
- * match IP dest outer IP index = 23 */
- {
- 57, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 53, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 58 -----------
- * match IP dest outer IP index = 23 */
- {
- 58, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 54, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 59 -----------
- * match IP dest outer IP index = 23 */
- {
- 59, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 55, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 60 -----------
- * match IP dest outer IP index = 23 */
- {
- 60, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 56, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 61 -----------
- * match IP dest outer IP index = 23 */
- {
- 61, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 57, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 62 -----------
- * match IP dest outer IP index = 23 */
- {
- 62, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 58, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 63 -----------
- * match IP dest outer IP index = 23 */
- {
- 63, /* Sequential ID */
- T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 59, /* Local Handle Index */
- 23, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 25, 26, 27, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 6, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- }
-
-
-
-};
-
-
-/* The following configurations link to an IP header which is also nested (innermost of 3 IP headers) */
-#pragma DATA_SECTION (t4InnerInnerIpInfo, ".testPkts")
-static t4IpPaSetup_t t4InnerInnerIpInfo[] = {
-
- /* ------- Entry 0 ----------- */
- {
- 0, /* Sequential ID */
- T4_NUM_LOCAL_L3_INNER1_IP_HANDLES + 0, /* Local Handle Index */
- 0, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 40, 41, 42, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- },
-
- /* ------- Entry 1 ----------- */
- {
- 1, /* Sequential ID */
- T4_NUM_LOCAL_L3_INNER1_IP_HANDLES + 1, /* Local Handle Index */
- 0, /* L3 Outer IP Handle Index */
- 0, /* Route Index - route to host */
- {
- { 40, 41, 42, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 40, 41, 42, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- pa_OK, /* PA LLD return value expected */
- FALSE /* Set to true when the command is acked */
- }
-};
-
-
-/* packet 0
- * mac dest = 00:0e:a6:66:57:09 (MAC Info 1)
- * out ip dest = 200.201.202.203 (out IP info 0)
- * UDP (destination port = 0x0555)
- * Designed to match outer IP configuration 0 */
-#pragma DATA_SECTION (pkt0, ".testPkts")
-static uint8_t pkt0[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x1d, 0xe7, 0x01, 0x02, 0x03, 0x04, 0xc8, 0xc9,
- 0xca, 0xcb, 0x12, 0x34, 0x05, 0x55, 0x00, 0x58,
- 0x9a, 0xe6, 0x2d, 0xcf, 0x46, 0x29, 0x04, 0xb4,
- 0x78, 0xd8, 0x68, 0xa7, 0xff, 0x3f, 0x2b, 0xf1,
- 0xfc, 0xd9, 0x7a, 0x96, 0x09, 0x2c, 0xa5, 0x57,
- 0x74, 0x64, 0xc4, 0xaf, 0x15, 0x28, 0xa4, 0xe9,
- 0x57, 0xdb, 0x5e, 0x20, 0xfb, 0x38, 0xa8, 0x4e,
- 0xa6, 0x14, 0x93, 0x25, 0x56, 0x24, 0x44, 0xdf,
- 0x59, 0x8d, 0x43, 0x7b, 0xbe, 0x90, 0x16, 0x89,
- 0x9d, 0x7e, 0x77, 0xc6, 0x2f, 0x26, 0x98, 0x88,
- 0xf5, 0xb4, 0x30, 0xd4, 0x34, 0x9d, 0x3a, 0x0d,
- 0x0f, 0xbd, 0x2f, 0xa1, 0xf7, 0x0f, 0xd9, 0x68,
- 0xf4, 0xd9 };
-
-#pragma DATA_SECTION (pkt0Info, ".testPkts")
-static pasahoLongInfo_t pkt0Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,34), /* cmd len = 24, start offset = 34 (UDP Header) */
- TF_FORM_PKT_INFO_WORD1(122,0,1,0,0,0), /* end offset = 122 */
- TF_FORM_PKT_INFO_WORD2(14,0,0,0), /* L3 offset = 14, l4Offset = 0, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = UDP, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP),PASAHO_HDR_UDP,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* packet 1
- * mac dest = 00:01:02:03:04:aa (MAC Info 0)
- * out ip src = 110.111.112.113 (out IP info 1)
- * out ip dest = 200.201.202.203
- * UDP (destination port = 0x0555)
- * Designed to match outer IP configuration 0 */
-#pragma DATA_SECTION (pkt1, ".testPkts")
-static uint8_t pkt1[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x43, 0x0c, 0x6e, 0x6f, 0x70, 0x71, 0xc8, 0xc9,
- 0xca, 0xcb, 0x12, 0x34, 0x05, 0x55, 0x00, 0x58,
- 0xc0, 0x0b, 0x2d, 0xcf, 0x46, 0x29, 0x04, 0xb4,
- 0x78, 0xd8, 0x68, 0xa7, 0xff, 0x3f, 0x2b, 0xf1,
- 0xfc, 0xd9, 0x7a, 0x96, 0x09, 0x2c, 0xa5, 0x57,
- 0x74, 0x64, 0xc4, 0xaf, 0x15, 0x28, 0xa4, 0xe9,
- 0x57, 0xdb, 0x5e, 0x20, 0xfb, 0x38, 0xa8, 0x4e,
- 0xa6, 0x14, 0x93, 0x25, 0x56, 0x24, 0x44, 0xdf,
- 0x59, 0x8d, 0x43, 0x7b, 0xbe, 0x90, 0x16, 0x89,
- 0x9d, 0x7e, 0x77, 0xc6, 0x2f, 0x26, 0x98, 0x88,
- 0xf5, 0xb4, 0x30, 0xd4, 0x34, 0x9d, 0x3a, 0x0d,
- 0x0f, 0xbd, 0x2f, 0xa1, 0xf7, 0x0f, 0xd9, 0x68,
- 0xf4, 0xd9 };
-
-
-#pragma DATA_SECTION (pkt1Info, ".testPkts")
-static pasahoLongInfo_t pkt1Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,34), /* cmd len = 24, start offset = 34 (UDP Header) */
- TF_FORM_PKT_INFO_WORD1(122,0,1,0,0,0), /* end offset = 122 */
- TF_FORM_PKT_INFO_WORD2(14,0,0,0), /* L3 offset = 14, l4Offset = 0, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = UDP, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP),PASAHO_HDR_UDP,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* packet 2
- * mac dest = 00:01:02:03:04:aa (MAC Info 0)
- * out ip dest = 71.72.73.70 (out IP info 23)
- * inner ip dest = 10.11.12.13 (inner IP info 0)
- * UDP (destination port = 0x0555)
- * Designed to match inner IP configuration 0 */
-#pragma DATA_SECTION (pkt2, ".testPkts")
-static uint8_t pkt2[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x04,
- 0x19, 0x07, 0x9e, 0xda, 0x6d, 0x0b, 0x47, 0x48,
- 0x49, 0x46, 0x45, 0x00, 0x00, 0x6c, 0x00, 0x00,
- 0x00, 0x00, 0x05, 0x11, 0x93, 0x85, 0x9e, 0xda,
- 0x6d, 0x0a, 0x0a, 0x0b, 0x0c, 0x0d, 0xaa, 0xbb,
- 0x05, 0x55, 0x00, 0x58, 0xeb, 0xc7, 0x14, 0x15,
- 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
- 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d,
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d,
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55,
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d,
- 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63 };
-
-
-#pragma DATA_SECTION (pkt2Info, ".testPkts")
-static pasahoLongInfo_t pkt2Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,54), /* cmd len = 20, start offset = 54 (UDP Header) */
- TF_FORM_PKT_INFO_WORD1(142,0,1,0,0,0), /* end offset = 142 */
- TF_FORM_PKT_INFO_WORD2(34,0,0,0), /* L3 offset = 34, l4Offset = 0, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = UDP, vlan count = 0, ip count = 2, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP),PASAHO_HDR_UDP,0,2,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* packet 3
- * mac dest = 00:01:02:03:04:aa (MAC Info 0)
- * out ip dest = 71.72.73.70 (out IP info 23)
- * inner ip dest = 10.11.12.13 (inner IP info 2)
- * inner ip src = 10.11.12.13
- * inner ip protocol = 132 (0x84) (SCTP)
- * Designed to match inner IP configuration 2 */
-#pragma DATA_SECTION (pkt3, ".testPkts")
-static uint8_t pkt3[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x05, 0x04,
- 0x19, 0x23, 0x9e, 0xda, 0x6d, 0x0b, 0x47, 0x48,
- 0x49, 0x46, 0x45, 0x00, 0x00, 0x50, 0x00, 0x00,
- 0x00, 0x00, 0x05, 0x84, 0x88, 0xfb, 0x0a, 0x0b,
- 0x0c, 0x0d, 0x0a, 0x0b, 0x0c, 0x0d,
- 0x8e, 0x3d, 0xd7, 0x5d, 0x45, 0x23, 0x05, 0x4f, /* SCTP source port, dest port and tag */
- 0x2c, 0xca, 0x8a, 0xdd, 0x05, 0x00, 0x00, 0x30, /* CRC-32C reference 0x5f129fa6 */
- 0x00, 0x01, 0x00, 0x2c, 0x02, 0x00, 0x8e, 0x3d,
- 0xc0, 0xa8, 0x01, 0x0d, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x40, 0x43, 0x22, 0xdf, 0x56, 0x01, 0x00, 0x00,
- 0x40, 0x69, 0x57, 0x00, 0xb6, 0x51, 0xe7, 0xc2,
- 0xcc, 0x82, 0x90, 0xf9 };
-
-#pragma DATA_SECTION (pkt3Info, ".testPkts")
-static pasahoLongInfo_t pkt3Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,66), /* cmd len = 20, start offset = 66 (SCTP payload) */
- TF_FORM_PKT_INFO_WORD1(114,0,1,0,0,0), /* end offset = 114 */
- TF_FORM_PKT_INFO_WORD2(34,54,0,0), /* L3 offset = 34, l4Offset = 54, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = UDP, vlan count = 0, ip count = 2, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP),PASAHO_HDR_UNKNOWN,0,2,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-
-
-
-/* Bits 14 and 15 are used to tell where the packet is expected to wind up */
-#define T4_PACKET_L3_MATCH_VALID (0 << 14) /* Packet will match (handle index in bits 13:0) */
-#define T4_PACKET_NFAIL (1 << 14) /* Packet will arrive in the next fail queue */
-#define T4_PACKET_DISCARD (2 << 14) /* Packet is discarded by PA */
-#define T4_PACKET_DEST_MASK (3 << 14)
-#define T4_PACKET_INDEX_MASK 0x3fff
-
-
-#pragma DATA_SECTION (t4PktInfo, ".testPkts")
-static pktTestInfo_t t4PktInfo[] = {
-
- /* Packet 0 */
- {
- (uint8_t *)pkt0,
- (pasahoLongInfo_t *)&pkt0Info,
- sizeof(pkt0),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- 0 }, /* no other match */
- T4_PACKET_L3_MATCH_VALID | 0 /* Packet will be matched by handle index 0 */
- },
-
- /* Packet 1 */
- {
- (uint8_t *)pkt1,
- (pasahoLongInfo_t *)&pkt1Info,
- sizeof(pkt1),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- 0 },
- T4_PACKET_L3_MATCH_VALID | 1 /* Packet will be matched by handle index 1 */
- },
-
- /* Packet 2 */
- {
- (uint8_t *)pkt2,
- (pasahoLongInfo_t *)&pkt2Info,
- sizeof(pkt2),
- { ( 1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- ( 1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* Outer IP match */
- ( 1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4) }, /* inner IP match */
- T4_PACKET_L3_MATCH_VALID | T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 0 /* Packet will match inner IP entry 0 */
- },
-
- /* Packet 3 */
- {
- (uint8_t *)pkt3,
- (pasahoLongInfo_t *)&pkt3Info,
- sizeof(pkt2),
- { ( 1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- ( 1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* Outer IP match */
- ( 1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4) }, /* inner IP match */
- T4_PACKET_L3_MATCH_VALID | T4_NUM_LOCAL_L3_OUTER_IP_HANDLES + 2 /* Packet will match inner IP entry 0 */
- }
-
-};
-
-
-#endif /*TEST4PKTS_H_*/
diff --git a/test/PAUnitTest2/tests/test5.c b/test/PAUnitTest2/tests/test5.c
+++ /dev/null
@@ -1,2662 +0,0 @@
-/*
- *
- * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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 "../pautest.h"
-
-#ifdef __LINUX_USER_SPACE
-#include "fw_test.h"
-#include "fw_mem_allocator.h"
-#endif
-
-/* This test suite verifies the following PASS features:
- * - Add/Delete LUT2 (UDP/TCP/GTP-U) entries
- * - MAC/IP/UDP(TCP)/GTP-U) classification and routing
- * - Exception route configuration
- * - User-defined Statistics operation
- * - Command set operation for MAC header replacement
- * - LUT2 entry replacement with atomic queue diversion
- *
- * This test invokes the following LLD APIs:
- * - Pa_addMac
- * - Pa_addIp
- * - Pa_addPort
- * - Pa_delL4Handle
- * - Pa_delHandle
- * - Pa_forwardResult
- * - Pa_control
- * - Pa_configExceptionRoute
- * - Pa_configCmdSet
- * - Pa_configUsrStats
- * - Pa_formatTxRoute
- * - Pa_getHandleRefCount
- * - Pa_requestStats
- * - Pa_formatStatsReply
- * - Pa_requestUsrStats
- * - Pa_formatUsrStatsReply
- *
- * This test verifies PDSP firmware for routing L4 (TCP/UDP) and L5 (GTP-U) packets.
- * This test has the following sub-tests
- * TCP/UDP/UDP-lite:
- * - Test the ability to add 16-bit ports
- * - Test the ability to delete 16-bit ports
- * - Test the ability to verify IP header and TCP/UDP checksum
- * - Test the ability to perform LUT2 entry update with atomic queue diversion
- * - Test the LLD for the ability to maintain the reference counts
- * - Test the firmware for the ability to route the TCP/UDP/UDP-lite packets with the specified destination port number
- * - Test the firmware for the ability to replace variable-length MAC header
- * GTP-U:
- * - Test the ability to configure exception routes
- * - Test the ability to configure command sets
- * - Test the ability to add 32-bit ports
- * - Test the ability to delete 32-bit ports
- * - Test the firmware for the ability to route the GTPU traffic with the specified TEID (Tunnel ID)
- * - Test the firmware for the ability to detect and route the GTP-U packets with other message types and error conditions
- * - Test the firmware for the ability to handle the PDU number in the GTPU extension header
- * - Test the firmware for the ability to remove the parsed header and trail and insert bytes after lookup
- * User-defined Statistics:
- * - Test the ability to perform system-level configurations such as the number of command sets and the number of user-defined counters
- * - Test the ability to configure user-defined statistics (link and type)
- * - Test the ability to query and format the user-defined statistics
- * - Test the firmware for the ability to increment the specified user-defined statistics chain upon LUT1 or LUT2 match
- * Atomic Queue Diversion
- * - Test the firmware for the ability to forward the queue diversion request to the specified destination queue
- * - Test the firmware for the ability to hold until the queue diversion operation is complete
- */
-
- static char *tfName = "paTestL4Routing";
-#ifdef __LINUX_USER_SPACE
-#define SIMULATOR_SUPPORT
-#endif
-
- #define T5_NUM_PACKET_ITERATIONS 2 /* Number of times the packet stream is passed through */
- #define T5_FIRST_DEST_PORT 2100 /* First TCP/UDP destination port used */
- #define T5_FIRST_GTPU_TEID 0x1000000 /* First GTPU Tunnel ID used */
-
- /* There is a one to one mapping from destination port number to L3 Handle and L4 Handle */
- #define T5_L2HDL_IDX_FROM_PORT(x) (((x)-T5_FIRST_DEST_PORT) % T5_NUM_LOCAL_L2_HANDLES)
- #define T5_L3HDL_IDX_FROM_PORT(x) (((x)-T5_FIRST_DEST_PORT) % T5_NUM_LOCAL_L3_HANDLES)
- #define T5_L3HDL_IDX_FROM_TEID(x) (((x)-T5_FIRST_GTPU_TEID) % T5_NUM_LOCAL_L3_HANDLES)
- #define T5_L4HDL_IDX_FROM_PORT(x) ((x)-T5_FIRST_DEST_PORT)
-
- /* General purpose queue usage */
- #define Q_CMD_RECYCLE 0 /* Command descriptors/buffers recycled here after sent to PA */
- #define Q_CMD_REPLY 1 /* Replies from PA routed here */
- #define Q_MATCH 2 /* Packets from PA which match a lookup criteria */
- #define Q_NFAIL 3 /* Packets from PA which matches a mac lookup, but failed an L3 lookup */
- #define Q_PARSE_ERR 4 /* Packets which resulted in a parse error */
- #define Q_DPKT_RECYCLE 5 /* Data packet recycle queue */
-#ifdef SIMULATOR_SUPPORT
- /* Simulator does not support Queue diversion operation */
- #define Q_MATCH2 2 /* Packest from PA which match a loop criteria after queue diversion (should be 6) */
-#else
-#ifdef __LINUX_USER_SPACE
- /* Queue diversion operation not supported */
- #define Q_MATCH2 2 /* Packest from PA which match a loop criteria after queue diversion (should be 6) */
-#else
- #define Q_MATCH2 6 /* Packest from PA which match a loop criteria after queue diversion (should be 6) */
-#endif
-#endif
- #define Q_GTPU_PING_REQ 7 /* GTPU Ping Request queue (message type 1) */
- #define Q_GTPU_PING_RESP 8 /* GTPU Ping Response queue (message type 2) */
- #define Q_GTPU_ERR_IND 9 /* GTPU Error Indication queue (message type 26) */
- #define Q_GTPU_HDR_NOTIFY 10 /* GTPU Supported Header Notification queue (message type 31) */
- #define Q_GTPU_END_MARKER 11 /* GTPU End Marker queue (message type 254) */
- #define Q_GTPU_FAIL 12 /* GTPU Parsing or other errors */
- #define Q_IP_FRAG 13 /* IP Fragmentation */
- #define Q_EROUTE_FIRST Q_GTPU_PING_REQ
- #define Q_EROUTE_LAST Q_IP_FRAG
-
-#ifdef SIMULATOR_SUPPORT
- /* Simulator does not support Queue diversion operation */
- #define Q_DIVERT_MONITORING 645 /* Queue Diversion MONITORING queue */
-#else
- #define Q_DIVERT_MONITORING (TF_FIRST_GEN_QUEUE + 20) /* Queue Diversion MONITORING queue */
-#endif
-
-#define T5_GTPU_PING_REQ_PKT_INDEX 0
-#define T5_GTPU_PING_RESP_PKT_INDEX 1
-#define T5_GTPU_ERR_IND_PKT_INDEX 2
-#define T5_GTPU_HDR_NOTIFY_PKT_INDEX 3
-#define T5_GTPU_END_MARKER_PKT_INDEX 4
-#define T5_GTPU_FAIL_PKT_INDEX 5
-#define T5_IP_FRAG_PKT_INDEX 6
-#define T5_GTPU_FIRST_PKT_INDEX 10
-
-#include "test5pkts.h"
-
-/* The number of PA L2 and L3 handles maintained by this test */
-#define T5_NUM_LOCAL_L2_HANDLES (sizeof(t5EthSetup)/sizeof(t5EthSetup_t))
-#define T5_NUM_LOCAL_L3_HANDLES (sizeof(t5IpSetup)/sizeof(t5IpSetup_t))
-#define T5_NUM_LOCAL_L4_HANDLES 100
-#define T5_NUM_LOCAL_L5_HANDLES 100
-#define T5_NUM_GEN_CONFIGS 10 /* Maxmium number of general configuration commands */
-
-#define T5_MAX_GTPU_CHAN (T5_NUM_LOCAL_L5_HANDLES + T5_GTPU_FIRST_PKT_INDEX)
-
- /* L3 handles are managed. This structure is used to track the handle and
- * the activation state state of the handle */
-enum {
- T5_HANDLE_UNCONFIGURED = 0,
- T5_HANDLE_PENDING_ACK,
- T5_HANDLE_ACTIVE,
- T5_HANDLE_DISABLED
-};
-
-#define T5_CMD_SWINFO0_TYPE_MASK 0xffff0000
-#define T5_CMD_SWINFO0_ID_MASK 0x0000ffff
-
-/* SWInfo values on command replies */
-#define T5_CMD_SWINFO0_ADD_MAC_ID 0x51110000
-#define T5_CMD_SWINFO0_ADD_IP_ID 0x51120000
-#define T5_CMD_SWINFO0_ADD_PORT_ID 0x51130000
-#define T5_CMD_SWINFO0_ADD_TEID_ID 0x51140000
-#define T5_CMD_SWINFO0_EROUTE_CFG_ID 0x51150000
-#define T5_CMD_SWINFO0_CMDSET_CFG_ID 0x51160000
-#define T5_CMD_SWINFO0_GLOBAL_CFG_ID 0x51170000
-#define T5_CMD_SWINFO0_USR_STATS_CFG_ID 0x51180000
-#define T5_CMD_SWINFO0_DEL_MAC_ID 0x50010000
-#define T5_CMD_SWINFO0_DEL_IP_ID 0x50020000
-#define T5_CMD_SWINFO0_DEL_PORT_ID 0x50030000
-#define T5_CMD_SWINFO0_DEL_TEID_ID 0x50040000
-#define T5_CMD_SWINFO0_PKT_ID 0x50050000
-#define T5_CMD_SWINFO0_GLOB_PKT_ID 0x50060000
-
- typedef struct t5Handles_s {
-
- paHandleL2L3_t paHandle; /* The L3 handle returned by the PA LLD */
-
- uint32_t state; /* T4_HANDLE_UNCONFIGURED = handle not configured
- * T4_HANDLE_PENDING_ACK = handle configured and sent to pa
- * T4_HANDLE_ACTIVE = handle creation acknowledged by pa
- * T4_HANDLE_DISABLED = handle was created then released */
- uint32_t linkCnt;
-
- } t5Handles_t;
-
- typedef struct t5HandlesL4_s {
-
- paHandleL4_t paHandle;
-
- uint32_t state;
-
- } t5HandlesL4_t;
-
- /* A grouping of run time created grouped together to make cleanup easier on
- * error exit */
-
- typedef struct t5TestEncap_s {
- tFramework_t *tf;
- paTest_t *pat;
-
- /* There is one base packet for each L3 table entry */
- Cppi_HostDesc *hd[T5_NUM_LOCAL_L3_HANDLES];
-
- /* The command to the modify PDSP to add the TCP/UDP checksum and route to PA receive */
- uint32_t cmdStack[T5_NUM_LOCAL_L3_HANDLES][(sizeof(pasahoNextRoute_t) + sizeof(pasahoComChkCrc_t)) / sizeof (uint32_t)];
-
- /* The +1 is a place holder handle used to pass known invalid configuration into the PA LLD */
- t5Handles_t l2Handles[T5_NUM_LOCAL_L2_HANDLES]; /* MAC handles */
- t5Handles_t l3Handles[T5_NUM_LOCAL_L3_HANDLES]; /* IP handles */
- t5HandlesL4_t l4Handles[T5_NUM_LOCAL_L4_HANDLES+1]; /* UDP/TCP handles */
- t5HandlesL4_t l5Handles[T5_NUM_LOCAL_L5_HANDLES+1]; /* GTPU handles */
- uint32_t genCmdAck[T5_NUM_GEN_CONFIGS]; /* General configurations */
-
-
- } t5TestEncap_t;
-
-static paSysStats_t paTestL4ExpectedStats; /* Expected stats results */
-
-/* Global configurations */
-#define T5_NUM_64B_USR_STATS 64
-
-
-static paProtocolLimit_t t5ProtocolLimit =
- {
- 3, /* Number of VLANs */
- 2, /* Number of IPs */
- 3 /* Number of GREs */
- };
-
-static paCmdSetConfig_t t5CmdSetCfg =
- {
- 32 /* Number of command sets */
- };
-
-static paQueueDivertConfig_t t5QueueDivertCfg =
- {
- Q_DIVERT_MONITORING, /* Monitoring Queue */
- 0 /* flow Id */
- };
-
-static paUsrStatsConfig_t t5UsrStatsCfg =
- {
- pa_USR_STATS_MAX_COUNTERS - T5_NUM_64B_USR_STATS, /* Number of user stats (448)*/
- T5_NUM_64B_USR_STATS /* Number of 64-bit user stats */
- };
-
-
-static paSysConfig_t t5GlobalCfg =
- {
- &t5ProtocolLimit,
- NULL, /* pOutIpReassmConfig */
- NULL, /* pInIpReassmConfig */
- &t5CmdSetCfg,
- &t5UsrStatsCfg, /* pUsrStatsConfig */
- &t5QueueDivertCfg,
- NULL /* pPktVerify */
- };
-
-/* Command set related definitions */
-#define T5_CMDSET_1_INDEX 2
-#define T5_CMDSET_1_NUM_CMDS 1
-#define T5_CMDSET_2_INDEX 4
-#define T5_CMDSET_2_NUM_CMDS 3
-
-
-/*
- * Command Set to test MAC router
- *
- */
-
-static uint8_t t5MacRouteHdr[] =
-{
- 0x51, 0x52, 0x53, 0x54, 0x55, 0x56,
- 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
- 0x08, 0x00
-};
-
-static paPatchInfo_t t5PatchCmd1 =
- {
- pa_PATCH_OP_MAC_HDR, /* ctrlBitfield */
- sizeof(t5MacRouteHdr), /* nPatchBytes */
- sizeof(t5MacRouteHdr), /* totalPatchSize */
- 0, /* offset */
- t5MacRouteHdr /* Pointer to the patch data */
- };
-
-static paCmdInfo_t t5CmdSet1[] =
-{
-
- /* Command 0: Insert Bytes */
- {
- pa_CMD_PATCH_DATA,
- {
- {
- 0, /* ctrlBitfield */
- 0, /* nPatchBytes */
- 0, /* totalPatchSize */
- 0, /* offset */
- 0 /* Pointer to the patch data */
- }
- }
- }
-
-};
-
-static paCmdInfo_t t5CmdSetCmd1 =
- {
- pa_CMD_CMDSET_AND_USR_STATS,
- {
-
- {
- T5_CMDSET_1_INDEX, /* Command set index (place holder only) */
- 0
- }
- }
- };
-
-
-
-static uint8_t t5GtpuPatchData[2] = { 0, 0 };
-
-static paPatchInfo_t t5PatchCmd2 =
- {
- pa_PATCH_OP_INSERT, /* ctrlBitfield */
- 1, /* nPatchBytes */
- 1, /* totalPatchSize */
- 0, /* offset */
- t5GtpuPatchData /* Pointer to the patch data */
- };
-
-static paCmdInfo_t t5CmdSet2[] =
-{
- /* Command 0: Remove header */
- {
- pa_CMD_REMOVE_HEADER,
- {
- {
- 0, /* ctrlBitfield */
- 0, /* dest */
- 0, /* pktType */
- 0, /* flowId */
- 0, /* queue */
- 0, /* swInfo0 */
- 0, /* swInfo1 */
- 0 /* multiRouteIndex */
- }
- }
- },
-
- /* Command 1: Insert Bytes */
- {
- pa_CMD_PATCH_DATA,
- {
- {
- 0, /* ctrlBitfield */
- 0, /* dest */
- 0, /* pktType */
- 0, /* flowId */
- 0, /* queue */
- 0, /* swInfo0 */
- 0, /* swInfo1 */
- 0 /* multiRouteIndex */
- }
- }
- },
-
- /* Command 2: Remove Tail */
- {
- pa_CMD_REMOVE_TAIL,
- {
- {
- 0, /* ctrlBitfield */
- 0, /* dest */
- 0, /* pktType */
- 0, /* flowId */
- 0, /* queue */
- 0, /* swInfo0 */
- 0, /* swInfo1 */
- 0 /* multiRouteIndex */
- }
- }
- }
-
-};
-
-static paCmdInfo_t t5CmdSetCmd2 =
- {
- pa_CMD_CMDSET,
- {
-
- {
- T5_CMDSET_2_INDEX /* Command set index */
- }
- }
- };
-
-
-
-static paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
-static paRouteInfo_t matchRoute[3] = { { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}, /* No commands */
-
- { pa_DEST_CONTINUE_PARSE_LUT1,/* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : pa_CUSTOM_TYPE_NONE */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}, /* No commands */
-
- { pa_DEST_CONTINUE_PARSE_LUT2,/* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : pa_CUSTOM_TYPE_NONE */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL} /* No commands */
- };
-static paRouteInfo_t nfailRoute = { pa_DEST_DISCARD, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}; /* No commands */
-
-#pragma DATA_SECTION(t5Encap, ".testPkts")
-static t5TestEncap_t t5Encap;
-
-
- #define T5_NUM_EXCEPTION_ROUTES 7
- static int t5ErouteTypes[] = {
- pa_EROUTE_GTPU_MESSAGE_TYPE_1,
- pa_EROUTE_GTPU_MESSAGE_TYPE_2,
- pa_EROUTE_GTPU_MESSAGE_TYPE_26,
- pa_EROUTE_GTPU_MESSAGE_TYPE_31,
- pa_EROUTE_GTPU_MESSAGE_TYPE_254,
- pa_EROUTE_GTPU_FAIL,
- pa_EROUTE_IP_FRAG
- };
-
- static paRouteInfo_t t5Eroutes[] = {
-
- /* GTPU Ping Request */
- { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- Q_GTPU_PING_REQ + TF_FIRST_GEN_QUEUE, /* queue */
- -1, /* Multi route */
- T5_GTPU_PING_REQ_PKT_INDEX + T5_CMD_SWINFO0_PKT_ID, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- /* GTPU Ping Response */
- { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- Q_GTPU_PING_RESP + TF_FIRST_GEN_QUEUE, /* queue */
- -1, /* Multi route */
- T5_GTPU_PING_RESP_PKT_INDEX + T5_CMD_SWINFO0_PKT_ID, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- /* GTPU Error Indication */
- { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- Q_GTPU_ERR_IND + TF_FIRST_GEN_QUEUE, /* queue */
- -1, /* Multi route */
- T5_GTPU_ERR_IND_PKT_INDEX + T5_CMD_SWINFO0_PKT_ID, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- /* GTPU Supporeted Header Notify */
- { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- Q_GTPU_HDR_NOTIFY + TF_FIRST_GEN_QUEUE, /* queue */
- -1, /* Multi route */
- T5_GTPU_HDR_NOTIFY_PKT_INDEX + T5_CMD_SWINFO0_PKT_ID, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- /* GTPU End Marker */
- { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- Q_GTPU_END_MARKER + TF_FIRST_GEN_QUEUE, /* queue */
- -1, /* Multi route */
- T5_GTPU_END_MARKER_PKT_INDEX + T5_CMD_SWINFO0_PKT_ID, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- /* GTPU Parsing Failure */
- { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- Q_GTPU_FAIL + TF_FIRST_GEN_QUEUE, /* queue */
- -1, /* Multi route */
- T5_GTPU_FAIL_PKT_INDEX + T5_CMD_SWINFO0_PKT_ID, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- /* IP Fragmentation */
- { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- Q_IP_FRAG + TF_FIRST_GEN_QUEUE, /* queue */
- -1, /* Multi route */
- T5_IP_FRAG_PKT_INDEX + T5_CMD_SWINFO0_PKT_ID, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- }
-
- };
-
-/*
- * User-defined statistics
- */
-
-typedef struct t5UsrStatsLnkEntry_s
-{
- uint16_t lnkIndex; /* next layer counter index */
- paUsrStatsTypes_e cntType; /**< Counter type (packet counter */
-
-} t5UsrStatsLnkEntry_t;
-
-
-static t5UsrStatsLnkEntry_t t5UsrStatsLnkTbl[pa_USR_STATS_MAX_COUNTERS];
-
-static paUsrStats_t paTestExpectedUsrStats;
-
-static void t5Cleanup (t5TestEncap_t *tencap, paTestStatus_t status)
-{
- int32_t i;
- int32_t cmdDest;
- uint16_t cmdSize;
- paReturn_t paret;
- paTestStatus_t newStatus;
- Cppi_HostDesc *hd;
-
-
- /* Wait a bit for any packets in PA to complete */
- utilCycleDelay (5000);
-
- /* Return the descriptors which are pointing to packets */
- for (i = 0; i < T5_NUM_LOCAL_L3_HANDLES; i++) {
- if (tencap->hd[i] != NULL)
- Qmss_queuePushDesc (tencap->tf->QfreeDesc, (Ptr) tencap->hd[i]);
- }
-
- /* Delete active L4 handles */
- for (i = 0; i < T5_NUM_LOCAL_L4_HANDLES; i++) {
-
- cmdReply.replyId = T5_CMD_SWINFO0_DEL_PORT_ID + i;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- if ((tencap->l4Handles[i].state == T5_HANDLE_PENDING_ACK) || (tencap->l4Handles[i].state == T5_HANDLE_ACTIVE)) {
- hd = testCommonDelL4Handles (tencap->tf, tencap->l4Handles[i].paHandle, tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- status = PA_TEST_FAILED;
- continue;
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- /* Wait for the response */
- if (testCommonWaitCmdReply (tencap->tf, tencap->pat, tfName, cmdReply.queue, cmdReply.replyId, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonWaitCmdReply failed\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- }
-
- /* Recycle the command packet as well */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- continue;
- }
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
- }
-
- /* Delete active L5 handles */
- for (i = 0; i < T5_NUM_LOCAL_L5_HANDLES; i++) {
-
- cmdReply.replyId = T5_CMD_SWINFO0_DEL_TEID_ID + i;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- if ((tencap->l5Handles[i].state == T5_HANDLE_PENDING_ACK) || (tencap->l5Handles[i].state == T5_HANDLE_ACTIVE)) {
- hd = testCommonDelL4Handles (tencap->tf, tencap->l5Handles[i].paHandle, tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- status = PA_TEST_FAILED;
- continue;
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestL4ExpectedStats.classify2.nPackets += 1;
-
- /* Wait for the response */
- if (testCommonWaitCmdReply (tencap->tf, tencap->pat, tfName, cmdReply.queue, cmdReply.replyId, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonWaitCmdReply failed\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- }
-
- /* Recycle the command packet as well */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- continue;
- }
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
- }
-
-
- /* Delete active L3 Handles */
- for (i = 0; i < T5_NUM_LOCAL_L3_HANDLES; i++) {
- cmdReply.replyId = T5_CMD_SWINFO0_DEL_IP_ID + i;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- if ((tencap->l3Handles[i].state == T5_HANDLE_PENDING_ACK) || (tencap->l3Handles[i].state == T5_HANDLE_ACTIVE)) {
- hd = testCommonDelHandle (tencap->tf, &tencap->l3Handles[i].paHandle, tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- status = PA_TEST_FAILED;
- continue;
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestL4ExpectedStats.classify1.nPackets += 1;
-
- /* Wait for the response */
- if (testCommonWaitCmdReply (tencap->tf, tencap->pat, tfName, cmdReply.queue, cmdReply.replyId, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonWaitCmdReply failed\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- }
- /* Recycle the command packet as well */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- continue;
- }
- testCommonRecycleLBDesc (tencap->tf, hd);
-
-
- }
- }
-
- /* Delete active L2 Handles */
- for (i = 0; i < T5_NUM_LOCAL_L2_HANDLES; i++) {
- cmdReply.replyId = T5_CMD_SWINFO0_DEL_MAC_ID + i; /* T2_CMD_SWINFO0_ADD_ID identifies command, 16 LS bits identify the local handle number */
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- if ((tencap->l2Handles[i].state == T5_HANDLE_PENDING_ACK) || (tencap->l2Handles[i].state == T5_HANDLE_ACTIVE)) {
- hd = testCommonDelHandle (tencap->tf, &tencap->l2Handles[i].paHandle, tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- status = PA_TEST_FAILED;
- testCommonRecycleLBDesc (tencap->tf, hd);
- continue;
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestL4ExpectedStats.classify1.nPackets += 1;
-
- /* Wait for the response */
- if (testCommonWaitCmdReply (tencap->tf, tencap->pat, tfName, cmdReply.queue, cmdReply.replyId, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonWaitCmdReply failed\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- }
-
- /* Recycle the command packet as well */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- continue;
- }
- testCommonRecycleLBDesc (tencap->tf, hd);
-
-
- }
- }
-
- /* Pop any descriptors off of the return queues and restore them to the linked buffer queues or the free Q */
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_CMD_RECYCLE])> 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_CMD_REPLY]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_REPLY])) & ~15);
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_MATCH]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_MATCH])) & ~15);
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_NFAIL]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_NFAIL])) & ~15);
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_PARSE_ERR]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_PARSE_ERR])) & ~15);
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- while (Qmss_getQueueEntryCount (tencap->tf->QGen[Q_DPKT_RECYCLE]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_DPKT_RECYCLE])) & ~15);
- Qmss_queuePush (tencap->tf->QfreeDesc, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- }
-
- newStatus = testCommonCheckStats (tencap->tf, tencap->pat, tfName, &paTestL4ExpectedStats, tencap->tf->QLinkedBuf1,
- tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QGen[Q_CMD_REPLY], TRUE);
-
- if (newStatus == PA_TEST_FAILED)
- status = PA_TEST_FAILED;
-
- /* Return result */
- tencap->pat->testStatus = status;
-
- /* Return */
- Task_exit();
-}
-
-static paTestStatus_t t5DeleteL4 (t5TestEncap_t *tencap)
-{
- int32_t i;
- int32_t cmdDest;
- uint16_t cmdSize;
- paReturn_t paret;
- paTestStatus_t status = PA_TEST_PASSED;
- Cppi_HostDesc *hd;
-
- /* Delete active L4 handles */
- for (i = 0; i < T5_NUM_LOCAL_L4_HANDLES; i++) {
-
- cmdReply.replyId = T5_CMD_SWINFO0_DEL_PORT_ID + i;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- if ((tencap->l4Handles[i].state == T5_HANDLE_PENDING_ACK) || (tencap->l4Handles[i].state == T5_HANDLE_ACTIVE)) {
- hd = testCommonDelL4Handles (tencap->tf, tencap->l4Handles[i].paHandle, tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- status = PA_TEST_FAILED;
- continue;
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestL4ExpectedStats.classify2.nPackets += 1;
-
- /* Wait for the response */
- if (testCommonWaitCmdReply (tencap->tf, tencap->pat, tfName, cmdReply.queue, cmdReply.replyId, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonWaitCmdReply failed\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- }
-
- /* Recycle the command packet as well */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- continue;
- }
- testCommonRecycleLBDesc (tencap->tf, hd);
-
- tencap->l4Handles[i].state = T5_HANDLE_DISABLED;
- }
- }
-
- return (status);
-}
-
-
-static void t5CmdRep (t5TestEncap_t *tencap)
-{
- Cppi_HostDesc *hd;
- uint32_t *swinfo;
- paReturn_t paret;
- uint32_t swinfoType;
- uint32_t swinfoIdx;
- paEntryHandle_t reth;
- int32_t htype;
- int32_t cmdDest;
- char *s;
- uint32_t *stateP;
- uint32_t stateV;
- int32_t max;
-
- while (Qmss_getQueueEntryCount(tencap->tf->QGen[Q_CMD_REPLY]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_REPLY])) & ~15);
-
- Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **)&swinfo);
-
- swinfoType = swinfo[0] & T5_CMD_SWINFO0_TYPE_MASK;
- swinfoIdx = swinfo[0] & T5_CMD_SWINFO0_ID_MASK;
-
- paret = Pa_forwardResult (tencap->tf->passHandle, (void *)hd->buffPtr, &reth, &htype, &cmdDest);
-
-
- switch (swinfoType) {
-
- case T5_CMD_SWINFO0_ADD_MAC_ID:
- stateP = &tencap->l2Handles[swinfoIdx].state;
- stateV = T5_HANDLE_ACTIVE;
- max = T5_NUM_LOCAL_L2_HANDLES;
- s = "pa_addMac";
- break;
-
- case T5_CMD_SWINFO0_ADD_IP_ID:
- stateP = &tencap->l3Handles[swinfoIdx].state;
- stateV = T5_HANDLE_ACTIVE;
- max = T5_NUM_LOCAL_L3_HANDLES;
- s = "pa_addIp";
- break;
-
- case T5_CMD_SWINFO0_ADD_PORT_ID:
- stateP = &tencap->l4Handles[swinfoIdx].state;
- stateV = T5_HANDLE_ACTIVE;
- max = T5_NUM_LOCAL_L4_HANDLES;
- s = "pa_addPort";
- break;
-
- case T5_CMD_SWINFO0_ADD_TEID_ID:
- stateP = &tencap->l5Handles[swinfoIdx].state;
- stateV = T5_HANDLE_ACTIVE;
- max = T5_NUM_LOCAL_L5_HANDLES;
- s = "pa_addPort (TEID)";
- break;
-
-
- case T5_CMD_SWINFO0_DEL_MAC_ID:
- stateP = &tencap->l2Handles[swinfoIdx].state;
- stateV = T5_HANDLE_DISABLED;
- max = T5_NUM_LOCAL_L2_HANDLES;
- s = "pa_delMac";
- break;
-
- case T5_CMD_SWINFO0_DEL_IP_ID:
- stateP = &tencap->l3Handles[swinfoIdx].state;
- stateV = T5_HANDLE_DISABLED;
- max = T5_NUM_LOCAL_L3_HANDLES;
- s = "pa_delIp";
- break;
-
- case T5_CMD_SWINFO0_DEL_PORT_ID:
- stateP = &tencap->l4Handles[swinfoIdx].state;
- stateV = T5_HANDLE_DISABLED;
- max = T5_NUM_LOCAL_L4_HANDLES;
- s = "pa_delPort";
- break;
-
- case T5_CMD_SWINFO0_EROUTE_CFG_ID:
- case T5_CMD_SWINFO0_CMDSET_CFG_ID:
- case T5_CMD_SWINFO0_GLOBAL_CFG_ID:
- case T5_CMD_SWINFO0_USR_STATS_CFG_ID:
- stateP = &tencap->genCmdAck[swinfoIdx];
- stateV = TRUE;
- max = T5_NUM_GEN_CONFIGS;
- s = "Pa_configExceptionRoutes/Pa_configCmdSet/Pa_configUsrStats";
- break;
-
- default:
- System_printf ("%s (%s:%d): Unknown command ID found in swinfo0 (0x%08x)\n", tfName, __FILE__, __LINE__, swinfo[0]);
- t5Cleanup (tencap, PA_TEST_FAILED);
- break;
-
- }
-
- /* In this test only valid responses are exected from PA */
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA command %s returned error code %d, Index = %d\n", tfName, __FILE__, __LINE__, s, paret, swinfoIdx);
- t5Cleanup (tencap, PA_TEST_FAILED);
- }
-
-
- if (swinfoIdx >= max) {
- System_printf ("%s (%s:%d): Received command ack (%s) for out of range handle (%d, max = %d)\n",
- tfName, __FILE__, __LINE__, s, swinfoIdx, max);
- t5Cleanup (tencap, PA_TEST_FAILED);
- }
-
- /* Response looks valid. Change the internal handle state */
- *stateP = stateV;
-
- /* Return the descriptor used to received the reply from PA */
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- /* Recycle the command packet */
- while (Qmss_getQueueEntryCount(tencap->tf->QGen[Q_CMD_RECYCLE]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find an expected command in the recycle queue\n", tfName, __FILE__, __LINE__);
- continue;
- }
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
-}
-
-static paTestStatus_t t5ExceptionRoutes (t5TestEncap_t *tencap)
-{
- int32_t i;
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
-
- /* Issue the exception route command */
- cmdReply.replyId = T5_CMD_SWINFO0_EROUTE_CFG_ID;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
- hd = testCommonConfigExceptionRoute (tencap->tf, T5_NUM_EXCEPTION_ROUTES, t5ErouteTypes, t5Eroutes,
- tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf3,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (hd == NULL) {
-
- System_printf ("%s: (%s:%d): Failure in ConfigExceptionRoute command\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
-
- }
-
- /* Send command */
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- tencap->genCmdAck[0] = FALSE;
-
- /* All the packets should have been acked */
- for (i = 0; i < 100; i++) {
- t5CmdRep (tencap);
-
- if (tencap->genCmdAck[0])
- break;
- else
- utilCycleDelay (500);
- }
-
- if (i == 100) {
- System_printf ("%s: (%s:%d): pa_ConfigExceptionRoute commands was not acked\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
- return (PA_TEST_PASSED);
-}
-
-static paTestStatus_t t5GlobalConfiguration (t5TestEncap_t *tencap)
-{
- int32_t i;
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
- paCtrlInfo_t ctrlInfo;
-
- /* Issue the command set command */
- ctrlInfo.code = pa_CONTROL_SYS_CONFIG;
- ctrlInfo.params.sysCfg = t5GlobalCfg;
- cmdReply.replyId = T5_CMD_SWINFO0_GLOBAL_CFG_ID;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
- hd = testCommonGlobalConfig (tencap->tf, &ctrlInfo,
- tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf3,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (hd == NULL) {
-
- System_printf ("%s: (%s:%d): Failure in GlobalConfig command\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- /* Send command */
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- tencap->genCmdAck[0] = FALSE;
-
- /* All the packets should have been acked */
- for (i = 0; i < 100; i++) {
- t5CmdRep (tencap);
-
- if (tencap->genCmdAck[0])
- break;
- else
- utilCycleDelay (500);
- }
-
- if (i == 100) {
- System_printf ("%s: (%s:%d): Pa_control commands was not acked\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
- return (PA_TEST_PASSED);
-}
-
-
-static paTestStatus_t t5CmdSetConfiguration (t5TestEncap_t *tencap)
-{
- int32_t i, j;
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
- uint16_t cmdSetIndex[] = {T5_CMDSET_1_INDEX, T5_CMDSET_2_INDEX};
- int numCmds[] = {T5_CMDSET_1_NUM_CMDS, T5_CMDSET_2_NUM_CMDS};
- paCmdInfo_t* pCmdInfo[] = {t5CmdSet1, t5CmdSet2};
-
-
-
- /* Issue the command set command */
- cmdReply.replyId = T5_CMD_SWINFO0_CMDSET_CFG_ID;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- for (j = 0; j < 2; j++)
- {
- hd = testCommonConfigCmdSet (tencap->tf, cmdSetIndex[j], numCmds[j], pCmdInfo[j],
- tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf3,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (hd == NULL) {
-
- System_printf ("%s: (%s:%d): Failure in ConfigCmdSet command\n", tfName, __FILE__, __LINE__);
- return (PA_TEST_FAILED);
- }
-
- /* Send command */
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- tencap->genCmdAck[0] = FALSE;
-
- /* All the packets should have been acked */
- for (i = 0; i < 100; i++) {
- t5CmdRep (tencap);
-
- if (tencap->genCmdAck[0])
- break;
- else
- utilCycleDelay (500);
- }
-
- if (i == 100) {
- System_printf ("%s: (%s:%d): Pa_configCmdSet (%d) commands was not acked\n", tfName, __FILE__, __LINE__, j);
- return (PA_TEST_FAILED);
- }
- }
- return (PA_TEST_PASSED);
-}
-
-
-/*
- * Initialize the link table
- */
-
-static void t5InitUsrStatsLnkTbl (t5UsrStatsLnkEntry_t* pEntry)
-{
- int i;
-
- for (i = 0; i < pa_USR_STATS_MAX_COUNTERS; i++)
- {
- pEntry[i].lnkIndex = pa_USR_STATS_LNK_END;
- pEntry[i].cntType = pa_USR_STATS_TYPE_PACKET;
- }
-}
-
-static void t5UpdateUsrStatsLnkTbl (t5UsrStatsLnkEntry_t* pLnkTbl, paUsrStatsCounterConfig_t* pCntCfg)
-{
- int i;
- paUsrStatsCounterEntryConfig_t* cntInfo = pCntCfg->cntInfo;
- int numCnt = pCntCfg->numCnt;
-
- for (i = 0; i < numCnt; i++)
- {
- pLnkTbl[cntInfo[i].cntIndex].lnkIndex = cntInfo[i].cntLnk;
- pLnkTbl[cntInfo[i].cntIndex].cntType = cntInfo[i].cntType;
- }
-}
-
-
-/*
- * Update all counters in the link chain
- */
-static void t5UpdateUsrStats(paUsrStats_t* pStats, t5UsrStatsLnkEntry_t* pLnktbl, uint16_t cntIndex, uint16_t pktSize)
-{
- while (cntIndex != pa_USR_STATS_LNK_END)
- {
- if (cntIndex < T5_NUM_64B_USR_STATS)
- {
- pStats->count64[cntIndex] += (pLnktbl[cntIndex].cntType == pa_USR_STATS_TYPE_PACKET)?1:pktSize;
- }
- else
- {
- pStats->count32[cntIndex - T5_NUM_64B_USR_STATS] += (pLnktbl[cntIndex].cntType == pa_USR_STATS_TYPE_PACKET)?1:pktSize;
-
- }
-
- cntIndex = pLnktbl[cntIndex].lnkIndex;
- }
-}
-
-static paTestStatus_t t5ConfigUsrStats (t5TestEncap_t *tencap, t5UsrStatsSetup_t *usrStatsSetup)
-{
- int32_t i, j, m;
- int32_t numEntries = sizeof(t5UsrStatsSetup)/sizeof(t5UsrStatsSetup_t);
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
- paUsrStatsCounterConfig_t cntCfg;
- paUsrStatsConfigInfo_t statsCfgInfo;
-
- statsCfgInfo.pCntCfg = &cntCfg;
- for (i = 0; i < numEntries; i++) {
- cmdReply.replyId = T5_CMD_SWINFO0_USR_STATS_CFG_ID + i;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- memset(&cntCfg, 0, sizeof(cntCfg));
- cntCfg.numCnt = usrStatsSetup[i].nStats;
- cntCfg.cntInfo = usrStatsSetup[i].cntEntryTbl;
-
- hd = testCommonConfigUsrStats (tencap->tf, &statsCfgInfo, tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf3,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK)
- {
- if (paret != usrStatsSetup[i].paret)
- {
- System_printf ("%s: (%s:%d): configUsrStats command (%d): unexpected err = %d (expected err = %d)\n", tfName,
- __FILE__, __LINE__, i, paret, usrStatsSetup[i].paret);
- return (PA_TEST_FAILED);
-
- }
- tencap->genCmdAck[i] = TRUE;
- continue;
- }
- else if (hd == NULL) {
-
- System_printf ("%s: (%s:%d): Failure in common configUsrStats command, entry number %d\n", tfName, __FILE__, __LINE__, i);
- return (PA_TEST_FAILED);
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- tencap->genCmdAck[i] = FALSE;
-
- t5UpdateUsrStatsLnkTbl(t5UsrStatsLnkTbl, &cntCfg);
-
- t5CmdRep (tencap);
- }
-
- /* All the packets should have been acked */
- for (i = 0; i < 100; i++) {
- t5CmdRep (tencap);
-
- for (j = m = 0; j < numEntries; j++) {
- if (tencap->genCmdAck[j])
- m += 1;
- }
-
- if (m == numEntries)
- break;
- else
- utilCycleDelay (1000);
- }
-
- if (i == 100) {
- System_printf ("%s: (%s:%d): %d (out of %d) pa_configUsrStats commands were acked\n", tfName, __FILE__, __LINE__, m, numEntries);
- return (PA_TEST_FAILED);
- }
- return (PA_TEST_PASSED);
-}
-
-
-
-
-static paTestStatus_t t5OpenL2 (t5TestEncap_t *tencap, t5EthSetup_t *ethSetup, int32_t nL2Handles)
-{
- int32_t i, j, m;
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
- paCmdInfo_t cmdInfo;
-
- cmdInfo.cmd = pa_CMD_USR_STATS;
- matchRoute[1].pCmd = &cmdInfo;
-
-
- for (i = 0; i < nL2Handles; i++) {
- cmdReply.replyId = T5_CMD_SWINFO0_ADD_MAC_ID + i;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- /* Specify the user statistics associated with the MAC input */
- cmdInfo.params.usrStats.index = t5L2UsrStats[i];
-
- hd = testCommonAddMac (tencap->tf, pa_LUT1_INDEX_NOT_SPECIFIED, (paEthInfo_t *)&t5EthSetup[i].ethInfo, &matchRoute[1], &nfailRoute,
- &tencap->l2Handles[i].paHandle, tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (hd == NULL) {
-
- System_printf ("%s: (%s:%d): Failure in common addMac command, entry number %d\n", tfName, __FILE__, __LINE__, i);
- t5Cleanup (tencap, PA_TEST_FAILED);
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- tencap->l2Handles[i].state = T5_HANDLE_PENDING_ACK;
- paTestL4ExpectedStats.classify1.nPackets += 1;
-
- t5CmdRep (tencap);
- }
-
- /* All the packets should have been acked */
- for (i = 0; i < 100; i++) {
- t5CmdRep (tencap);
-
- for (j = m = 0; j < nL2Handles; j++) {
- if (tencap->l2Handles[j].state == T5_HANDLE_ACTIVE)
- m += 1;
- }
-
- if (m == nL2Handles)
- break;
- else
- utilCycleDelay (1000);
- }
-
- if (i == 100) {
- System_printf ("%s: (%s:%d): %d (out of %d) pa_addMac commands were acked\n", tfName, __FILE__, __LINE__, m, nL2Handles);
- return (PA_TEST_FAILED);
- }
- return (PA_TEST_PASSED);
-}
-
-static paTestStatus_t t5OpenL3 (t5TestEncap_t *tencap, t5IpSetup_t *ipSetup, int32_t nL3Handles)
-{
- int32_t i, j, m;
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
-
- for (i = 0; i < nL3Handles; i++) {
- cmdReply.replyId = T5_CMD_SWINFO0_ADD_IP_ID + i;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- hd = testCommonAddIp (tencap->tf, pa_LUT1_INDEX_NOT_SPECIFIED, &t5IpSetup[i].ipInfo, &matchRoute[2], &nfailRoute,
- &tencap->l3Handles[i].paHandle,
- tencap->l2Handles[t5IpSetup[i].lHandleIdx].paHandle,
- tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
-
- if (hd == NULL) {
-
- System_printf ("%s: (%s:%d): Failure in common addIp command, entry number %d\n", tfName, __FILE__, __LINE__, i);
- t5Cleanup (tencap, PA_TEST_FAILED);
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- tencap->l3Handles[i].state = T5_HANDLE_PENDING_ACK;
- paTestL4ExpectedStats.classify1.nPackets += 1;
- tencap->l2Handles[t5IpSetup[i].lHandleIdx].linkCnt++;
- t5CmdRep (tencap);
- }
-
- /* All the packets should have been acked */
- for (i = 0; i < 100; i++) {
- t5CmdRep (tencap);
-
- for (j = m = 0; j < nL3Handles; j++) {
- if (tencap->l3Handles[j].state == T5_HANDLE_ACTIVE)
- m += 1;
- }
-
- if (m == nL3Handles)
- break;
- else
- utilCycleDelay (1000);
- }
-
- if (i == 100) {
- System_printf ("%s: (%s:%d): %d (out of %d) pa_addIp commands were acked\n", tfName, __FILE__, __LINE__, m, nL3Handles);
- return (PA_TEST_FAILED);
- }
-
- return (PA_TEST_PASSED);
-}
-
-static paTestStatus_t t5GenericOpenL4 (t5TestEncap_t *tencap, uint32_t fDestPort, int32_t nL3Handles, int32_t nL4Handles)
-{
- int32_t i, j, m;
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
-
- matchRoute[0].pCmd = &t5CmdSetCmd1;
-
- for (i = 0; i < nL4Handles; i++) {
-
- cmdReply.replyId = T5_CMD_SWINFO0_ADD_PORT_ID + i;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
- t5CmdSetCmd1.params.cmdSetUsrStats.statsIndex = t5L3UsrStats[T5_L3HDL_IDX_FROM_PORT(T5_FIRST_DEST_PORT+i)];
-
- hd = testCommonAddPort (tencap->tf, pa_LUT2_PORT_SIZE_16, T5_FIRST_DEST_PORT+i, &matchRoute[0], &tencap->l4Handles[i].paHandle,
- &tencap->l3Handles[T5_L3HDL_IDX_FROM_PORT(T5_FIRST_DEST_PORT+i)].paHandle,
- tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1, &cmdReply, &cmdDest, &cmdSize, &paret);
-
-
-
- if (hd == NULL) {
-
- System_printf ("%s: (%s:%d): Failure in common addPort command, entry number %d\n", tfName, __FILE__, __LINE__, i);
- t5Cleanup (tencap, PA_TEST_FAILED);
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- tencap->l4Handles[i].state = T5_HANDLE_PENDING_ACK;
- tencap->l3Handles[T5_L3HDL_IDX_FROM_PORT(T5_FIRST_DEST_PORT+i)].linkCnt++;
- paTestL4ExpectedStats.classify2.nPackets += 1;
- utilCycleDelay (600);
-
- t5CmdRep (tencap);
- }
-
-
- /* All the packets should have been acked */
- for (i = 0; i < 100; i++) {
- t5CmdRep (tencap);
-
- for (j = m = 0; j < nL4Handles; j++) {
- if (tencap->l4Handles[j].state == T5_HANDLE_ACTIVE)
- m += 1;
- }
-
- if (m == nL4Handles)
- break;
- else
- utilCycleDelay (1000);
- }
-
- if (i == 100) {
- System_printf ("%s: (%s:%d): %d (out of %d) pa_addPort commands were acked\n", tfName, __FILE__, __LINE__, m, nL4Handles);
- return (PA_TEST_FAILED);
- }
-
- return (PA_TEST_PASSED);
-}
-
-static paTestStatus_t t5GenericOpenGTPU (t5TestEncap_t *tencap, uint32_t fGTPUTeid, int32_t nL3Handles, int32_t nL5Handles)
-{
- int32_t i, j, m;
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
-
- for (i = 0; i < nL5Handles; i++) {
-
- cmdReply.replyId = T5_CMD_SWINFO0_ADD_TEID_ID + i;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- matchRoute[0].swInfo0 = T5_GTPU_FIRST_PKT_INDEX + T5_CMD_SWINFO0_PKT_ID + i;
- matchRoute[0].pCmd = (i & 1)?&t5CmdSetCmd2:NULL;
- hd = testCommonAddPort (tencap->tf, pa_LUT2_PORT_SIZE_32, fGTPUTeid+i, &matchRoute[0], &tencap->l5Handles[i].paHandle,
- &tencap->l3Handles[T5_L3HDL_IDX_FROM_TEID(fGTPUTeid+i)].paHandle,
- tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1, &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (hd == NULL) {
-
- System_printf ("%s: (%s:%d): Failure in common addPort (TEID) command, entry number %d\n", tfName, __FILE__, __LINE__, i);
- t5Cleanup (tencap, PA_TEST_FAILED);
- }
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- tencap->l5Handles[i].state = T5_HANDLE_PENDING_ACK;
- paTestL4ExpectedStats.classify2.nPackets += 1;
-
- utilCycleDelay (600);
-
- t5CmdRep (tencap);
- }
-
-
- /* All the packets should have been acked */
- for (i = 0; i < 100; i++) {
- t5CmdRep (tencap);
-
- for (j = m = 0; j < nL5Handles; j++) {
- if (tencap->l5Handles[j].state == T5_HANDLE_ACTIVE)
- m += 1;
- }
-
- if (m == nL5Handles)
- break;
- else
- utilCycleDelay (1000);
- }
-
- if (i == 100) {
- System_printf ("%s: (%s:%d): %d (out of %d) pa_addPort commands were acked\n", tfName, __FILE__, __LINE__, m, nL5Handles);
- return (PA_TEST_FAILED);
- }
-
- return (PA_TEST_PASSED);
-}
-
-static void t5FormPktDataDescriptors (t5TestEncap_t *tencap, int32_t nL3Handles)
-{
- Qmss_Queue q;
- int32_t i;
- uint16_t cmdStackSize;
- pasahoNextRoute_t *panr;
- paReturn_t paret;
-
-
- paTxChksum_t t5pktChksum = { /* The UDP checksum command */
-
- 0, /* Start offset of UDP header */
- 0, /* Checksum length (UDP header + payload */
- 0, /* Offset to checksum location RELATIVE TO THE START OF THE TCP/UDP HEADER */
- 0, /* Initial value is IPv4 pseudo header checksum value */
- 1 /* computed value of 0 written as -0 */
-
- };
-
-
-
- paRouteInfo_t route = { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}; /* No commands */
-
-
-
- /* Attach one free descriptor to each of the packets */
- for (i = 0; i < nL3Handles; i++) {
- tencap->hd[i] = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QfreeDesc)) & ~15);
-
- if (tencap->hd[i] == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a descriptor from the free queue (%d)\n", tfName, __FILE__, __LINE__, tencap->tf->QfreeDesc);
- t5Cleanup (tencap, PA_TEST_FAILED);
- }
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = tencap->tf->QGen[Q_DPKT_RECYCLE];
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)(tencap->hd[i]), q);
-
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)(tencap->hd[i]), (uint8_t *)t5PktInfo[i].pkt, (uint32_t)t5PktInfo[i].pktLen);
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)(tencap->hd[i]), (uint32_t)t5PktInfo[i].pktLen);
-
- /* Create the UDP checksum and routing commands as well and attach them to the descriptor */
- panr = (pasahoNextRoute_t *)tencap->cmdStack[i]; /* Where the command will be placed */
-
- /* Route the packet to PA Tx 0 which makes it appear to have arrived over the network */
- route.queue = tencap->tf->QPaTx[0];
-
- if (t5PktInfo[i].statsMap[2] & (1 << TF_STATS_BM_C2_NUM_UDP))
- t5pktChksum.resultOffset = 6;
- else if (t5PktInfo[i].statsMap[2] & (1 << TF_STATS_BM_C2_NUM_TCP))
- t5pktChksum.resultOffset = 16;
- else {
- System_printf ("%s (%s:%d): Could not determine if packet was TCP or UDP\n", tfName, __FILE__, __LINE__);
- t5Cleanup (tencap, PA_TEST_FAILED);
- }
-
-
- t5pktChksum.initialSum = t5PseudoChksums[i];
- t5pktChksum.lengthBytes = PASAHO_LINFO_READ_END_OFFSET(t5PktInfo[i].info) - PASAHO_LINFO_READ_L4_OFFSET(t5PktInfo[i].info);
- t5pktChksum.startOffset = PASAHO_LINFO_READ_L4_OFFSET(t5PktInfo[i].info);
-
- cmdStackSize = sizeof(tencap->cmdStack[i]);
-
- paret = Pa_formatTxRoute ( &t5pktChksum, /* L4 payload checksum */
- NULL, /* No second checksum */
- &route, /* Internal routing */
- (Ptr)panr, /* Command buffer */
- &cmdStackSize); /* Command size */
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): Pa_formatTxRoute returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- t5Cleanup (tencap, PA_TEST_FAILED);
- }
-
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)(tencap->hd[i]), (uint8_t *)panr, cmdStackSize);
- }
-
-}
-
-static Cppi_HostDesc *t5FormGTPUDataPacket (tFramework_t *tf, paTest_t *pat, int32_t pktIdx, uint8_t *expectedPktCount)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
-
- /* Pop a descriptor off of the free queue list, format the return queue, and attach the packet */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QfreeDesc)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a descriptor off the free descriptor Q (%d)\n", tfName, __FILE__, __LINE__, tf->QfreeDesc);
- return (NULL);
- }
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = tf->QfreeDesc;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Make sure there is no control info. */
- Cppi_setPSLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, 0);
-
- /* Attach the data and set the length */
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)utilgAddr((uint32_t)(t5GTPUPktInfo[pktIdx].pkt)), t5GTPUPktInfo[pktIdx].pktLen);
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, t5GTPUPktInfo[pktIdx].pktLen);
-
- return (hd);
-}
-
-
-static int32_t t5RxPkts (t5TestEncap_t *tencap, pauFifo_t *fifo)
-{
- Cppi_HostDesc *hd;
- pasahoLongInfo_t *pinfo;
- uint32_t infoLen;
- uint32_t flags;
- int32_t idx;
- uint32_t l4Offset;
- uint8_t *rxPkt;
- uint32_t port;
- uint32_t eport;
- int32_t nQ;
-
- /* Look for packets in the rx packet queue, verify that the UDP port found matches the next value in
- * the fifo, then verify the receive packet information */
- while (Qmss_getQueueEntryCount(tencap->tf->QGen[Q_MATCH]) > 0) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_MATCH])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a received packet\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- /* Get the parse information, make sure there is an L4 offset */
- if (Cppi_getPSData (Cppi_DescType_HOST, Cppi_PSLoc_PS_IN_DESC, (Cppi_Desc *)hd, (uint8_t **)&pinfo, &infoLen) != CPPI_SOK) {
- System_printf ("%s (%s:%d): Error getting control info from received data packet\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- rxPkt = (uint8_t *)hd->buffPtr;
- flags = PASAHO_LINFO_READ_HDR_BITMASK(pinfo);
- l4Offset = PASAHO_LINFO_READ_L4_OFFSET(pinfo);
-
-
- if ((flags & (PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_TCP)) == 0) {
- System_printf ("%s (%s:%d): Found a packet without any L4 info\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- /* Same offset to destination port for both TCP and UDP */
- port = (rxPkt[l4Offset+2] << 8) | rxPkt[l4Offset+3];
-
- if ((port < T5_FIRST_DEST_PORT) || (port >= (T5_FIRST_DEST_PORT + T5_NUM_LOCAL_L4_HANDLES))) {
- System_printf ("%s (%s:%d): Found a packet with destination port 0x%04x, valid range is 0x%04x - 0x%04x\n",
- tfName, __FILE__, __LINE__, port, T5_FIRST_DEST_PORT, T5_FIRST_DEST_PORT + T5_NUM_LOCAL_L4_HANDLES - 1);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- /* Make sure this is the expected packet */
- eport = commonFifoPopElement (fifo, &nQ);
- if (nQ <= 0) {
- System_printf ("%s (%s:%d): Could not pop an element off of the software tracking fifo (n = %d)\n",
- tfName, __FILE__, __LINE__, nQ);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- if (eport != port) {
- System_printf ("%s (%s:%d): Received packet with destination port 0x%04x, expected 0x%04x\n",
- tfName, __FILE__, __LINE__, port, eport);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- /* Get the packet index from the destination port */
- idx = T5_L3HDL_IDX_FROM_PORT(port);
-
-
- if (testCommonComparePktInfo (tfName, t5PktInfo[idx].info, pinfo)) {
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- /* Verify the replaced MAC header */
- if(memcmp((void*)hd->buffPtr, t5MacRouteHdr, sizeof(t5MacRouteHdr)))
- {
- System_printf ("%s (%s:%d): MAC header does not match!\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- /* Since the packets went to the modify PDSP and then back to the QM, a descriptor
- * and linked buffer was required while the packet was in the QM. This will
- * be recycled to the default recycle queue */
- while (Qmss_getQueueEntryCount(tencap->tf->QDefRet) > 0) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QDefRet)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Could not pop descriptor from default recycle queue\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
-
- return (0);
-}
-
-static Cppi_HostDesc *t5GetRxPkt (tFramework_t *tf)
-{
- Cppi_HostDesc *hd = NULL;
- int index;
-
- if (Qmss_getQueueEntryCount(tf->QGen[Q_MATCH]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_MATCH])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a received packet\n", tfName, __FILE__, __LINE__);
- return (NULL);
- }
-
- return (hd);
- }
-
- if (Qmss_getQueueEntryCount(tf->QGen[Q_NFAIL]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_NFAIL])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a received packet\n", tfName, __FILE__, __LINE__);
- return (NULL);
- }
-
- return (hd);
- }
-
- for (index = Q_EROUTE_FIRST; index <= Q_EROUTE_LAST; index++)
- {
-
- if (Qmss_getQueueEntryCount(tf->QGen[index]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[index])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a received packet from General Queue(%d)\n", tfName, __FILE__, __LINE__, index);
- return (NULL);
- }
-
- return (hd);
- }
-
- }
-
- return (NULL);
-
-}
-
-
-/* Search the receive data packet queue for received data packets. Remain in
- * this function until all buffers are restored to their respective queues */
-static int32_t t5ReceiveGTPUDataPkts (tFramework_t *tf, paTest_t *pat, uint8_t *actualPktCount, int expCount)
-{
- Cppi_HostDesc *hd;
- uint32_t *swInfo;
- pktTestInfo_t *tinfo;
- pasahoLongInfo_t *pinfo;
- uint32_t infoLen;
- int32_t i, j;
- uint32_t chan;
- int32_t count = 0;
-
- for (i = 0; i < 100; i++) {
-
- utilCycleDelay (1000);
- while ((hd = t5GetRxPkt (tf)) != NULL) {
-
- /* Verify swInfo0 for packet match and packet ID number */
- Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **)&swInfo);
-
- if ((*swInfo & T5_CMD_SWINFO0_TYPE_MASK) != T5_CMD_SWINFO0_PKT_ID) {
- System_printf ("%s (%s:%d): Found a packet in the receive packet queue but with incorrect swinfo0 Id: 0x%08x\n",
- tfName, __FILE__, __LINE__, *swInfo);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- chan = *swInfo & T5_CMD_SWINFO0_ID_MASK;
- count++;
- if (chan <= T5_MAX_GTPU_CHAN)
- actualPktCount[chan] += 1;
-
- /* locate the associated test information based on the channel value */
- for (j = 0, tinfo = NULL; j < sizeof(t5GTPUPktInfo) / sizeof(pktTestInfo_t); j++) {
- if (t5GTPUPktInfo[j].idx == chan) {
- tinfo = &t5GTPUPktInfo[j];
- break;
- }
- }
-
- if (tinfo == NULL) {
- System_printf ("%s (%s:%d): Found a packet in the receive packet queue for channel %d, but found no matching packet info\n",
- tfName, __FILE__, __LINE__, chan);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- /* Verify the parse information is correct */
- if (Cppi_getPSData (Cppi_DescType_HOST, Cppi_PSLoc_PS_IN_DESC, (Cppi_Desc *)hd, (uint8_t **)&pinfo, &infoLen) != CPPI_SOK) {
- System_printf ("%s (%s:%d): Error getting control info from received data packet\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- if (testCommonComparePktInfo (tfName, tinfo->info, pinfo)) {
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- /* Return the descriptor/buffer */
- testCommonRecycleLBDesc (tf, hd);
-
- }
-
- if(count >= expCount)
- break;
-
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Error - unable to recover all descriptors with associated buffers\n", tfName, __FILE__, __LINE__);
- System_flush();
- return (-1);
- }
-
- return (0);
-
-}
-
-static paTestStatus_t t5VerifyLinkCounters (t5TestEncap_t *tencap, int32_t nL2Handles, int32_t nL3Handles)
-{
- uint16_t count;
- int32_t i;
-
- for (i = 0; i < nL2Handles; i++) {
- Pa_getHandleRefCount(t5Encap.tf->passHandle,
- t5Encap.l2Handles[i].paHandle,
- &count);
-
- if (count != (uint16_t)t5Encap.l2Handles[i].linkCnt)
- {
- System_printf ("%s: (%s:%d) L2 handle[%d]: link count (%d) mistactch. should be %d\n",
- tfName, __FILE__, __LINE__, i, count, t5Encap.l2Handles[i].linkCnt);
-
- System_flush();
- return (PA_TEST_FAILED);
- }
- }
-
-
- for (i = 0; i < nL3Handles; i++) {
- Pa_getHandleRefCount(t5Encap.tf->passHandle,
- t5Encap.l3Handles[i].paHandle,
- &count);
-
- if (count != (uint16_t)t5Encap.l3Handles[i].linkCnt)
- {
- System_printf ("%s: (%s:%d) L3 handle[%d]: link count (%d) mistactch. should be %d\n",
- tfName, __FILE__, __LINE__, i, count, t5Encap.l3Handles[i].linkCnt);
-
- System_flush();
- return (PA_TEST_FAILED);
- }
- }
-
- return (PA_TEST_PASSED);
-}
-
-/*
- * Queue Diversion test supporting functions
- */
-
-static paTestStatus_t t5UpdateL4 (t5TestEncap_t *tencap, uint16_t port)
-{
- int32_t i;
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
- int32_t l4Idx = T5_L4HDL_IDX_FROM_PORT(port);
- int32_t l3Idx = T5_L3HDL_IDX_FROM_PORT(port);
- //volatile int32_t mdebugWait = 1;
-
-
- matchRoute[0].pCmd = &t5CmdSetCmd1;
- matchRoute[0].queue = (uint16_t) t5Encap.tf->QGen[Q_MATCH2];
-
- t5CmdSetCmd1.params.cmdSetUsrStats.statsIndex = t5L3UsrStats[T5_L3HDL_IDX_FROM_PORT(port)];
-
- cmdReply.replyId = T5_CMD_SWINFO0_ADD_PORT_ID + l4Idx;
- cmdReply.queue = tencap->tf->QGen[Q_CMD_REPLY];
-
- hd = testCommonAddPort2 (tencap->tf, pa_LUT2_PORT_SIZE_16, port, TRUE, tencap->tf->QGen[Q_MATCH], &matchRoute[0], &tencap->l4Handles[l4Idx].paHandle,
- &tencap->l3Handles[l3Idx].paHandle,
- tencap->tf->QGen[Q_CMD_RECYCLE], tencap->tf->QLinkedBuf1, &cmdReply, &cmdDest, &cmdSize, &paret);
-
-
-
- if (hd == NULL) {
-
- System_printf ("%s: (%s:%d): Failure in common addPort2 command, entry number %d\n", tfName, __FILE__, __LINE__, 0);
- t5Cleanup (tencap, PA_TEST_FAILED);
- }
-
- /* restore the destination queue */
- matchRoute[0].queue = (uint16_t) tencap->tf->QGen[Q_MATCH];
-
- Qmss_queuePush (tencap->tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- tencap->l4Handles[l4Idx].state = T5_HANDLE_PENDING_ACK;
- paTestL4ExpectedStats.classify2.nPackets += 1;
-
- utilCycleDelay (600);
- t5CmdRep (tencap);
-
- /* All the packets should have been acked */
- for (i = 0; i < 100; i++) {
- if (tencap->l4Handles[l4Idx].state == T5_HANDLE_ACTIVE)
- break;
- else
- utilCycleDelay (1000);
-
- t5CmdRep (tencap);
- }
-
- if (i == 100) {
- System_printf ("%s: (%s:%d): %d (out of %d) pa_addPort commands were acked\n", tfName, __FILE__, __LINE__, 0, 1);
- return (PA_TEST_FAILED);
- }
-
- return (PA_TEST_PASSED);
-}
-
-static void t5SendDataPackets (t5TestEncap_t *tencap, uint16_t port, uint16_t numPkts, uint16_t startSeqNum)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
- int32_t i,j;
- int32_t l3Idx = T5_L3HDL_IDX_FROM_PORT(port);
- uint8_t* pData;
- uint16_t seqNum = startSeqNum;
- int32_t l4Offset = PASAHO_LINFO_READ_L4_OFFSET(t5PktInfo[l3Idx].info);
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = tencap->tf->QGen[Q_DPKT_RECYCLE];
-
- /* Prepare and send packets */
- for (i = 0; i < numPkts; i++) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QfreeDesc)) & ~15);
-
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a descriptor from the free queue (%d)\n", tfName, __FILE__, __LINE__, tencap->tf->QfreeDesc);
- t5Cleanup (tencap, PA_TEST_FAILED);
- }
-
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)(hd), q);
-
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)(hd), (uint8_t *)t5PktInfo[l3Idx].pkt, (uint32_t)t5PktInfo[l3Idx].pktLen);
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)(hd), (uint32_t)t5PktInfo[l3Idx].pktLen);
- Cppi_setPSLen (Cppi_DescType_HOST, (Cppi_Desc *)(hd), 0);
-
- /* Set the destination TCP/UDP port */
- pData = &t5PktInfo[l3Idx].pkt[l4Offset];
- pData[2] = (port >> 8) & 0xff;
- pData[3] = (port) & 0xff;
-
- /* Set the sequence Number */
- pData[8] = (seqNum >> 8) & 0xFF;
- pData[9] = seqNum & 0xFF;
- seqNum++;
-
- /*
- * Write back the entire cache to make sure that the test packets are updated.
- * Note: It may be more efficient to call CACHE_wbL1d(blockPtr, byteCnt, wait) only for
- * the portion of packet which is updated.
- *
- */
-#ifndef __LINUX_USER_SPACE
- CACHE_wbAllL1d(CACHE_WAIT);
- //CACHE_wbAllL2(CACHE_WAIT);
-#else
- Osal_writeBackCache ((void *)t5PktInfo[l3Idx].pkt, t5PktInfo[l3Idx].pktLen);
-#endif
-
- /* Send the data to PDSP0 */
- Qmss_queuePush (tencap->tf->QPaTx[0], (Ptr)hd, t5PktInfo[l3Idx].pktLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- testCommonIncStats (t5PktInfo[l3Idx].statsMap, &paTestL4ExpectedStats);
-
- t5UpdateUsrStats(&paTestExpectedUsrStats, t5UsrStatsLnkTbl,
- t5L3UsrStats[l3Idx],
- t5PktInfo[l3Idx].pktLen);
-
- t5UpdateUsrStats(&paTestExpectedUsrStats, t5UsrStatsLnkTbl,
- t5L2UsrStats[T5_L2HDL_IDX_FROM_PORT(port)],
- t5PktInfo[l3Idx].pktLen);
-
- /* Wait until the packet is received by PASS */
- /* Wait for descriptors to return. It is assumed that they are returning in order. Also poll for
- * received packets */
- for (j = 0; j < 100; j++) {
-
- utilCycleDelay (500);
- if ((Qmss_getQueueEntryCount (tencap->tf->QGen[Q_DPKT_RECYCLE])) > 0)
- break;
- }
-
- if (j == 100) {
- System_printf ("%s (%s:%d): t5SendDataPackets: Timeout waiting for descriptors to PDSP0 to be recycled\n", tfName, __FILE__, __LINE__);
- t5Cleanup (tencap, PA_TEST_FAILED);
- }
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_DPKT_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop recycled data packet descriptor\n", tfName, __FILE__, __LINE__);
- t5Cleanup (tencap, PA_TEST_FAILED);
- }
- Qmss_queuePush (tencap->tf->QfreeDesc, (Ptr)hd, hd->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- }
-}
-
-static int32_t t5ReceiveDataPacket (t5TestEncap_t *tencap, uint16_t eport, uint16_t numPkts, uint16_t startSeqNum)
-{
- Cppi_HostDesc *hd;
- pasahoLongInfo_t *pinfo;
- uint32_t infoLen;
- uint32_t flags;
- int32_t idx;
- uint32_t l4Offset;
- uint8_t *rxPkt;
- uint16_t port;
- uint16_t eSeqNum = startSeqNum;
- uint16_t seqNum;
- int32_t count = 0;
- int32_t i;
-
-
- for (i = 0; i < 100; i++) {
-
- utilCycleDelay (1000);
-
- /* Look for packets in the rx packet queue, verify that the UDP port found matches the next value in
- * the fifo, then verify the receive packet information */
- while (Qmss_getQueueEntryCount(tencap->tf->QGen[Q_MATCH2]) > 0) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QGen[Q_MATCH2])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a received packet from Q_MATCH2\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- /* Get the parse information, make sure there is an L4 offset */
- if (Cppi_getPSData (Cppi_DescType_HOST, Cppi_PSLoc_PS_IN_DESC, (Cppi_Desc *)hd, (uint8_t **)&pinfo, &infoLen) != CPPI_SOK) {
- System_printf ("%s (%s:%d): Error getting control info from received data packet\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- rxPkt = (uint8_t *)hd->buffPtr;
- flags = PASAHO_LINFO_READ_HDR_BITMASK(pinfo);
- l4Offset = PASAHO_LINFO_READ_L4_OFFSET(pinfo);
-
-
- if ((flags & (PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_TCP)) == 0) {
- System_printf ("%s (%s:%d): Found a packet without any L4 info\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- /* Same offset to destination port for both TCP and UDP */
- port = (rxPkt[l4Offset+2] << 8) | rxPkt[l4Offset+3];
-
- if ((port < T5_FIRST_DEST_PORT) || (port >= (T5_FIRST_DEST_PORT + T5_NUM_LOCAL_L4_HANDLES))) {
- System_printf ("%s (%s:%d): Found a packet with destination port 0x%04x, valid range is 0x%04x - 0x%04x\n",
- tfName, __FILE__, __LINE__, port, T5_FIRST_DEST_PORT, T5_FIRST_DEST_PORT + T5_NUM_LOCAL_L4_HANDLES - 1);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- /* Make sure this is the expected packet */
- if (eport != port) {
- System_printf ("%s (%s:%d): Received packet with destination port 0x%04x, expected 0x%04x\n",
- tfName, __FILE__, __LINE__, port, eport);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- seqNum = (rxPkt[l4Offset+8] << 8) | rxPkt[l4Offset+9];
-
- /* Make sure this is the expected packet */
- if (eSeqNum != seqNum) {
- System_printf ("%s (%s:%d): Received packet with seqNum %d, expected %d\n",
- tfName, __FILE__, __LINE__, seqNum, eSeqNum);
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- /* Get the packet index from the destination port */
- idx = T5_L3HDL_IDX_FROM_PORT(port);
-
- if (testCommonComparePktInfo (tfName, t5PktInfo[idx].info, pinfo)) {
- testCommonRecycleLBDesc (tencap->tf, hd);
- return (-1);
- }
-
- testCommonRecycleLBDesc (tencap->tf, hd);
-
- count++;
- eSeqNum++;
- }
-
- if(count >= numPkts)
- break;
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): t5ReceiveDataPacket - unable to receive all packets\n", tfName, __FILE__, __LINE__);
- System_flush();
- return (-1);
- }
-
-
- /* Since the command response pkt will sent to QMSS and then PDSP5 and then to the QM, a descriptor
- * and linked buffer was required while the command response was in the QM. This will
- * be recycled to the default recycle queue */
- while (Qmss_getQueueEntryCount(tencap->tf->QDefRet) > 0) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tencap->tf->QDefRet)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Could not pop descriptor from default recycle queue\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- testCommonRecycleLBDesc (tencap->tf, hd);
- }
-
- return (0);
-}
-
-#ifdef __LINUX_USER_SPACE
-void* paTestL4Routing (void *args)
-{
- void *a0 = (void *)((paTestArgs_t *)args)->tf;
- void *a1 = (void *)((paTestArgs_t *)args)->pat;
-#else
-void paTestL4Routing (UArg a0, UArg a1)
-{
-#endif
- int32_t i, j, k, n;
- paTestStatus_t newStatus;
- uint8_t *pdata;
- Cppi_HostDesc *hd[sizeof(t5GTPUPktInfo) / sizeof(pktTestInfo_t)];
- uint32_t fifoData[(3*T5_NUM_LOCAL_L3_HANDLES)+1];
- pauFifo_t fifo = { 0, 0, (3*T5_NUM_LOCAL_L3_HANDLES)+1, NULL };
- uint8_t expectedPktCount[T5_MAX_GTPU_CHAN];
- uint8_t actualPktCount[T5_MAX_GTPU_CHAN];
- volatile int32_t mdebugWait = 1;
- #ifndef SIMULATOR_SUPPORT
- int32_t result;
- #endif
-
- /* Initialize the test state */
- fifo.data = fifoData;
- memset (&t5Encap, 0, sizeof(t5Encap));
- t5Encap.tf = (tFramework_t *)a0;
- t5Encap.pat = (paTest_t *)a1;
- for (i = 0; i < T5_NUM_LOCAL_L4_HANDLES; i++)
- t5Encap.l4Handles[i].state = T5_HANDLE_UNCONFIGURED;
- for (i = 0; i < T5_NUM_LOCAL_L3_HANDLES; i++)
- t5Encap.l3Handles[i].state = T5_HANDLE_UNCONFIGURED;
- for (i = 0; i < T5_NUM_LOCAL_L2_HANDLES; i++)
- t5Encap.l2Handles[i].state = T5_HANDLE_UNCONFIGURED;
- for (i = 0; i < T5_NUM_LOCAL_L3_HANDLES; i++)
- t5Encap.hd[i] = NULL;
-
-#ifdef __LINUX_USER_SPACE
- for (i = 0; (i < (sizeof(t5PktInfo) / sizeof(pktTestInfo_t))); i++) {
- int pktSz;
- uint8_t *pkt;
-
- switch (i) {
- case 0:
- pktSz = sizeof(pkt0);
- pkt = pkt0;
- break;
-
- case 1:
- pktSz = sizeof(pkt1);
- pkt = pkt1;
- break;
-
- case 2:
- pktSz = sizeof(pkt2);
- pkt = pkt2;
- break;
-
- case 3:
- pktSz = sizeof(pkt3);
- pkt = pkt3;
- break;
-
- case 4:
- pktSz = sizeof(pkt4);
- pkt = pkt4;
- break;
-
- case 5:
- pktSz = sizeof(pkt5);
- pkt = pkt5;
- break;
-
- case 6:
- pktSz = sizeof(pkt6);
- pkt = pkt6;
- break;
-
- case 7:
- pktSz = sizeof(pkt7);
- pkt = pkt7;
- break;
-
- case 8:
- pktSz = sizeof(pkt8);
- pkt = pkt8;
- break;
-
- case 9:
- pktSz = sizeof(pkt9);
- pkt = pkt9;
- break;
-
- case 10:
- pktSz = sizeof(pkt10);
- pkt = pkt10;
- break;
-
- case 11:
- pktSz = sizeof(pkt11);
- pkt = pkt11;
- break;
-
- }
-
- /* Allocate memory for the Packet buffers */
- t5PktInfo[i].pkt = (uint8_t *)fw_memAlloc(pktSz, CACHE_LINESZ);
- if(t5PktInfo[i].pkt == NULL) {
- printf ("%s: memAlloc failed for pkt %d\n", tfName, i);
- t5Encap.pat->testStatus = PA_TEST_FAILED;
- return (void *)0;
- }
- memcpy(t5PktInfo[i].pkt, pkt, pktSz);
- }
-
- for (i = 0; (i < (sizeof(t5GTPUPktInfo) / sizeof(pktTestInfo_t))); i++) {
- int pktSz;
- uint8_t *pkt;
-
- switch (i) {
- case 0:
- pktSz = sizeof(gtpuPkt0);
- pkt = gtpuPkt0;
- break;
-
- case 1:
- pktSz = sizeof(gtpuPkt1);
- pkt = gtpuPkt1;
- break;
-
- case 2:
- pktSz = sizeof(gtpuPkt2);
- pkt = gtpuPkt2;
- break;
-
- case 3:
- pktSz = sizeof(gtpuPkt3);
- pkt = gtpuPkt3;
- break;
-
- case 4:
- pktSz = sizeof(gtpuPkt4);
- pkt = gtpuPkt4;
- break;
-
- case 5:
- pktSz = sizeof(gtpuPkt5);
- pkt = gtpuPkt5;
- break;
-
- case 6:
- pktSz = sizeof(gtpuPkt6);
- pkt = gtpuPkt6;
- break;
-
- case 7:
- pktSz = sizeof(gtpuPkt7);
- pkt = gtpuPkt7;
- break;
-
- case 8:
- pktSz = sizeof(gtpuPkt8);
- pkt = gtpuPkt8;
- break;
-
- case 9:
- pktSz = sizeof(gtpuPkt9);
- pkt = gtpuPkt9;
- break;
-
- case 10:
- pktSz = sizeof(gtpuPkt10);
- pkt = gtpuPkt10;
- break;
-
- case 11:
- pktSz = sizeof(gtpuPkt11);
- pkt = gtpuPkt11;
- break;
-
- case 12:
- pktSz = sizeof(gtpuPkt12);
- pkt = gtpuPkt12;
- break;
-
- case 13:
- pktSz = sizeof(gtpuPkt13);
- pkt = gtpuPkt13;
- break;
-
- case 14:
- pktSz = sizeof(gtpuPkt14);
- pkt = gtpuPkt14;
- break;
-
- case 15:
- pktSz = sizeof(gtpuPkt15);
- pkt = gtpuPkt15;
- break;
-
- case 16:
- pktSz = sizeof(gtpuPkt16);
- pkt = gtpuPkt16;
- break;
-
- case 17:
- pktSz = sizeof(gtpuPkt17);
- pkt = gtpuPkt17;
- break;
-
- case 18:
- pktSz = sizeof(gtpuPkt18);
- pkt = gtpuPkt18;
- break;
-
- case 19:
- pktSz = sizeof(gtpuPkt19);
- pkt = gtpuPkt19;
- break;
-
- case 20:
- pktSz = sizeof(gtpuPkt20);
- pkt = gtpuPkt20;
- break;
-
- }
-
- /* Allocate memory for the Packet buffers */
- t5GTPUPktInfo[i].pkt = (uint8_t *)fw_memAlloc(pktSz, CACHE_LINESZ);
- if(t5GTPUPktInfo[i].pkt == NULL) {
- printf ("%s: memAlloc failed for pkt %d\n", tfName, i);
- t5Encap.pat->testStatus = PA_TEST_FAILED;
- return (void *)0;
- }
- memcpy(t5GTPUPktInfo[i].pkt, pkt, pktSz);
- }
-#endif
-
- /* Runtime initial values */
- matchRoute[0].queue = (uint16_t) t5Encap.tf->QGen[Q_MATCH];
- nfailRoute.queue = (uint16_t) t5Encap.tf->QGen[Q_NFAIL];
- cmdReply.queue = (uint16_t) t5Encap.tf->QGen[Q_CMD_REPLY];
-
- /* Zero out the expected stats. The stats will be updated as packets are sent into PA */
- memset (&paTestL4ExpectedStats, 0, sizeof(paTestL4ExpectedStats));
- memset (&paTestExpectedUsrStats, 0, sizeof(paTestExpectedUsrStats));
- memset (expectedPktCount, 0, sizeof(expectedPktCount));
- memset (actualPktCount, 0, sizeof(actualPktCount));
-
- /* Initialize the user-defined statistics link table */
- t5InitUsrStatsLnkTbl (t5UsrStatsLnkTbl);
-
- /*
- * Local initialization
- */
- t5CmdSet1[0].params.patch = t5PatchCmd1;
- t5CmdSetCmd1.params.cmdSetUsrStats.setIndex = T5_CMDSET_1_INDEX;
- t5CmdSet2[1].params.patch = t5PatchCmd2;
- t5CmdSetCmd2.params.cmdSet.index = T5_CMDSET_2_INDEX;
-
- /* Global Configuration */
- newStatus = t5GlobalConfiguration (&t5Encap);
- if (newStatus == PA_TEST_FAILED)
- t5Cleanup (&t5Encap, newStatus); /* No return */
-
- /* Exception Route Configurations */
- newStatus = t5ExceptionRoutes (&t5Encap);
- if (newStatus == PA_TEST_FAILED)
- t5Cleanup (&t5Encap, newStatus); /* No return */
-
- /* Command Set Configuration */
- newStatus = t5CmdSetConfiguration (&t5Encap);
- if (newStatus == PA_TEST_FAILED)
- t5Cleanup (&t5Encap, newStatus); /* No return */
-
- /* Usr Stats configuration */
- newStatus = t5ConfigUsrStats (&t5Encap, t5UsrStatsSetup);
- if (newStatus == PA_TEST_FAILED)
- t5Cleanup (&t5Encap, newStatus); /* No return */
-
- /* Enable QMSS queue diversion support */
-#ifndef SIMULATOR_SUPPORT
- /* Program the accumulator */
- if ((result = Qmss_programDiversionQueue (Qmss_PdspId_PDSP1, (Qmss_QueueHnd) Q_DIVERT_MONITORING, t5Encap.tf->QPaTx[5])) != QMSS_ACC_SOK)
- {
- System_printf ("Error Programming accumulator for queue diversion operation with error code : %d\n", result);
- t5Cleanup (&t5Encap, PA_TEST_FAILED); /* No return */
- }
-#endif
- /* Burst in the L2 configuraton */
- newStatus = t5OpenL2 (&t5Encap, t5EthSetup, T5_NUM_LOCAL_L2_HANDLES);
- if (newStatus == PA_TEST_FAILED)
- t5Cleanup (&t5Encap, newStatus); /* No return */
-
- /* Burst in the L3 configuration */
- newStatus = t5OpenL3 (&t5Encap, t5IpSetup, T5_NUM_LOCAL_L3_HANDLES);
- if (newStatus == PA_TEST_FAILED)
- t5Cleanup (&t5Encap, newStatus);
-
- /* Completely fill the L4 table. There is a one to one mapping of UDP destination port
- * values to the IP entries in the lookup table. */
- newStatus = t5GenericOpenL4 (&t5Encap, T5_FIRST_DEST_PORT, T5_NUM_LOCAL_L3_HANDLES, T5_NUM_LOCAL_L4_HANDLES);
- if (newStatus == PA_TEST_FAILED)
- t5Cleanup (&t5Encap, newStatus);
-
- /* Completely fill the L4 table. There is a one to one mapping of GTPU Tunnel ID
- * values to the IP entries in the lookup table. */
- newStatus = t5GenericOpenGTPU (&t5Encap, T5_FIRST_GTPU_TEID, T5_NUM_LOCAL_L3_HANDLES, T5_NUM_LOCAL_L5_HANDLES);
- if (newStatus == PA_TEST_FAILED)
- t5Cleanup (&t5Encap, newStatus);
-
- /* Verify the reference counters */
- newStatus = t5VerifyLinkCounters(&t5Encap, T5_NUM_LOCAL_L2_HANDLES, T5_NUM_LOCAL_L3_HANDLES);
- if (newStatus == PA_TEST_FAILED)
- t5Cleanup (&t5Encap, newStatus);
-
- /* Create one descriptor for each IP table entry. The descriptor will remain
- * with the packet throughout the test */
- t5FormPktDataDescriptors (&t5Encap, T5_NUM_LOCAL_L3_HANDLES);
-
- /* Send the packets. Use the modify PDSP to generate the TCP/UDP checksums. Send
- * each packet type to each of the opened TCP/UDP ports */
-
- for (k = 0; k < T5_NUM_PACKET_ITERATIONS; k++) {
-
- for (j = 0; j < T5_NUM_LOCAL_L4_HANDLES; j += T5_NUM_LOCAL_L3_HANDLES) {
-
- for (i = n = 0; (i < T5_NUM_LOCAL_L3_HANDLES) && (i+j < T5_NUM_LOCAL_L4_HANDLES); i++) {
-
-
- /* Set the destination TCP/UDP port */
- pdata = t5PktInfo[i].pkt;
- pdata[(PASAHO_LINFO_READ_L4_OFFSET(t5PktInfo[i].info)) + 2] = ((T5_FIRST_DEST_PORT + i + j) >> 8) & 0xff;
- pdata[(PASAHO_LINFO_READ_L4_OFFSET(t5PktInfo[i].info)) + 3] = (T5_FIRST_DEST_PORT + i + j) & 0xff;
-
- /*
- * Write back the entire cache to make sure that the test packets are updated.
- * Note: It may be more efficient to call CACHE_wbL1d(blockPtr, byteCnt, wait) only for
- * the portion of packet which is updated.
- *
- */
-#ifndef __LINUX_USER_SPACE
- CACHE_wbAllL1d(CACHE_WAIT);
- //CACHE_wbAllL2(CACHE_WAIT);
-#else
- Osal_writeBackCache ((void *)t5PktInfo[i].pkt, t5PktInfo[i].pktLen);
-#endif
-
- /* Send the data to the modify PDSP */
- //if(j == 12)mdebugHaltPdsp(4);
- Qmss_queuePush (t5Encap.tf->QPaTx[5], (Ptr)t5Encap.hd[i], t5PktInfo[i].pktLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- //if(j == 12)while (mdebugWait);
-
- n += 1;
- t5Encap.hd[i] = NULL;
-
- testCommonIncStats (t5PktInfo[i].statsMap, &paTestL4ExpectedStats);
-
- if (t5PktInfo[i].idx & T5_PKTINFO_IDX_MATCH_FLAG) {
-
- if (commonFifoPushElement (&fifo, (uint32_t)(T5_FIRST_DEST_PORT + i + j)) < 0) {
- System_printf ("%s (%s:%d): Test failed - fifo is full\n", tfName, __FILE__, __LINE__);
- t5Cleanup (&t5Encap, PA_TEST_FAILED);
- }
- }
-
- t5UpdateUsrStats(&paTestExpectedUsrStats, t5UsrStatsLnkTbl,
- t5L3UsrStats[T5_L3HDL_IDX_FROM_PORT((T5_FIRST_DEST_PORT + i + j))],
- t5PktInfo[i].pktLen);
-
- t5UpdateUsrStats(&paTestExpectedUsrStats, t5UsrStatsLnkTbl,
- t5L2UsrStats[T5_L2HDL_IDX_FROM_PORT((T5_FIRST_DEST_PORT + i + j))],
- t5PktInfo[i].pktLen);
- }
-
-
- /* Wait for descriptors to return. It is assumed that they are returning in order. Also poll for
- * received packets */
- for (i = 0; i < 100; i++) {
-
- if ((Qmss_getQueueEntryCount (t5Encap.tf->QGen[Q_DPKT_RECYCLE])) >= n)
- break;
-
- if (t5RxPkts (&t5Encap, &fifo))
- t5Cleanup (&t5Encap, PA_TEST_FAILED);
-
- utilCycleDelay (500);
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Timeout waiting for descriptors to modify PDSP to be recycled\n", tfName, __FILE__, __LINE__);
- t5Cleanup (&t5Encap, PA_TEST_FAILED);
- }
-
-
- if (t5RxPkts (&t5Encap, &fifo))
- t5Cleanup (&t5Encap, PA_TEST_FAILED);
-
- /* Recycle the descriptors */
- for (i = 0; i < n; i++) {
- t5Encap.hd[i] = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (t5Encap.tf->QGen[Q_DPKT_RECYCLE])) & ~15);
- if (t5Encap.hd[i] == NULL) {
- System_printf ("%s (%s:%d): Failed to pop recycled data packet descriptor\n", tfName, __FILE__, __LINE__);
- t5Cleanup (&t5Encap, PA_TEST_FAILED);
- }
- }
- }
- }
-
- /* Give some time for all the packets to get through the system */
- utilCycleDelay (4000);
-
- /* Check for received packets */
- if (t5RxPkts (&t5Encap, &fifo))
- t5Cleanup (&t5Encap, PA_TEST_FAILED);
-
-
- /* The packet index fifo must be empty */
- n = commonFifoGetCount (&fifo);
- if (n != 0) {
- System_printf ("%s (%s:%d): Packet reception complete but packet index fifo not empty\n", tfName, __FILE__, __LINE__);
- t5Cleanup (&t5Encap, PA_TEST_FAILED);
- }
-
-
- /* Verify and clear the stats */
- newStatus = testCommonCheckUsrStats (t5Encap.tf, t5Encap.pat, tfName, &paTestExpectedUsrStats, t5Encap.tf->QLinkedBuf1,
- t5Encap.tf->QGen[Q_CMD_RECYCLE], t5Encap.tf->QGen[Q_CMD_REPLY], TRUE);
- if (newStatus == PA_TEST_FAILED)
- System_printf ("%s (%s:%d): testCommonCheckUsrStats Failed\n", tfName, __FILE__, __LINE__);
-
-
- /* LUT2 Queue Diversion Test */
- t5SendDataPackets(&t5Encap, T5_FIRST_DEST_PORT, 10, 0);
-
- newStatus = t5UpdateL4(&t5Encap, T5_FIRST_DEST_PORT);
- if (newStatus == PA_TEST_FAILED)
- t5Cleanup (&t5Encap, newStatus);
-
- t5SendDataPackets(&t5Encap, T5_FIRST_DEST_PORT, 10, 10);
-
- /* Give some time for all the packets to get through the system */
- utilCycleDelay (4000);
-
- if (t5ReceiveDataPacket(&t5Encap, T5_FIRST_DEST_PORT, 20, 0))
- {
- System_printf ("%s (%s:%d): L4 Queue Diversion test fails\n", tfName, __FILE__, __LINE__);
- t5Cleanup (&t5Encap, PA_TEST_FAILED);
- }
-
- /* Delete active L4 handles */
- if (t5DeleteL4 (&t5Encap) != PA_TEST_PASSED)
- {
- System_printf ("%s (%s:%d): L4 Packet reception complete, but L4 deletion fails\n", tfName, __FILE__, __LINE__);
- t5Cleanup (&t5Encap, PA_TEST_FAILED);
- }
-
- /* GTPU packet testing */
- /* Run packets through the system. the complete set of packets is run through three times. */
- for (j = 0; j < T5_NUM_PACKET_ITERATIONS; j++) {
- int32_t count = 0;
- for (i = 0; i < sizeof(t5GTPUPktInfo) / sizeof(pktTestInfo_t); i++ ) {
-
- hd[i] = t5FormGTPUDataPacket (t5Encap.tf, t5Encap.pat, i, expectedPktCount);
-
- if (hd[i] == NULL) {
- System_printf ("%s (%s:%d): T5 GTPU packet sent: run out of buffers\n", tfName, __FILE__, __LINE__);
- System_flush();
- t5Cleanup (&t5Encap, PA_TEST_FAILED); /* no return */
- break;
- }
-
- /* Inc the count if the packet is passed back to the host */
- if (t5GTPUPktInfo[i].idx < T5_MAX_GTPU_CHAN)
- {
- expectedPktCount[t5GTPUPktInfo[i].idx] += 1;
- count ++;
- }
- /* Increment any expected stats */
- testCommonIncStats (t5GTPUPktInfo[i].statsMap, &paTestL4ExpectedStats);
-
- }
-
- for (i = 0; i < sizeof(t5GTPUPktInfo) / sizeof(pktTestInfo_t); i++)
- {
- //mdebugHaltPdsp(4);
- Qmss_queuePush (t5Encap.tf->QPaTx[0], (Ptr)hd[i], hd[i]->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- //while (mdebugWait);
- }
-
- if (t5ReceiveGTPUDataPkts (t5Encap.tf, t5Encap.pat, actualPktCount, count))
- {
- /* Error Handling */
- System_printf ("%s (%s:%d): t5ReceiveGTPUDataPkts timeout\n", tfName, __FILE__, __LINE__);
- System_flush();
- t5Cleanup (&t5Encap, PA_TEST_FAILED); /* no return */
- break;
- }
- }
-
-
- /* Verify that the expected and actual received packet counts match */
- for (i = 0; i < T5_MAX_GTPU_CHAN; i++) {
- if (expectedPktCount[i] != actualPktCount[i]) {
- System_printf ("%s (%s:%d): Packet count mismatch for entry %d - expected %d, found %d\n", tfName,
- __FILE__, __LINE__, i, expectedPktCount[i], actualPktCount[i]);
- System_flush();
- t5Cleanup (&t5Encap, PA_TEST_FAILED); /* no return */
- }
- }
-
- /* Verify and clear the stats */
- newStatus = testCommonCheckStats (t5Encap.tf, t5Encap.pat, tfName, &paTestL4ExpectedStats, t5Encap.tf->QLinkedBuf1,
- t5Encap.tf->QGen[Q_CMD_RECYCLE], t5Encap.tf->QGen[Q_CMD_REPLY], TRUE);
- if (newStatus == PA_TEST_FAILED)
- System_printf ("%s (%s:%d): testCommonCheckStats Failed\n", tfName, __FILE__, __LINE__);
-
- /* No return from cleanup */
- t5Cleanup (&t5Encap, newStatus);
-
-#ifdef __LINUX_USER_SPACE
- return (void *)0;
-#endif
-}
-
diff --git a/test/PAUnitTest2/tests/test5pkts.h b/test/PAUnitTest2/tests/test5pkts.h
+++ /dev/null
@@ -1,2103 +0,0 @@
-/*
- *
- * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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.
- *
-*/
-
-
-
-#ifndef TEST5PKTS_H_
-#define TEST5PKTS_H_
-
-
-
-/* Valid rx MAC addresses used during the test */
-typedef struct t5EthSetup {
- paEthInfo_t ethInfo; /* PA Ethernet configuration structure */
- Bool acked; /* Set to TRUE when the reply to the command is received */
-} t5EthSetup_t;
-
-
-#pragma DATA_SECTION (t5EthSetup, ".testPkts")
-static t5EthSetup_t t5EthSetup[] = {
-
- {
- { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Source mac is dont care */
- { 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa }, /* Dest mac */
- 0, /* Vlan */
- 0, /* ethertype */
- 0, /* mpls tag */
- 0 /* input EMAC port */
- },
- FALSE },
-
- {
- { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Source mac is dont care */
- { 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09 }, /* Dest mac */
- 0, /* Vlan */
- 0, /* ethertype */
- 0, /* mpls tag */
- 0 /* input EMAC port */
- },
- FALSE }
-
-
-};
-
-typedef struct t5IpSetup_s {
- int32_t lHandleIdx; /* Linked handle (to previous L2 or L3 layer) */
- paIpInfo_t ipInfo; /* PA IP configuration structure */
- Bool acked; /* Set to TRUE when the reply to the command is received */
-
-} t5IpSetup_t;
-
-#pragma DATA_SECTION(t5IpSetup, ".testPkts")
-static t5IpSetup_t t5IpSetup[] = {
-
- {
- /* IP Entry 0 */
- 0, /* Linked to dest mac index 0 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- },
-
- /* IP Entry 1 */
- { 1, /* Linked to dest mac index 1 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- },
-
- /* IP Entry 2 */
- { 0, /* Linked to dest mac index 0 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- },
-
-
- /* IP Entry 3 */
- { 1, /* Linked to dest mac index 1 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- },
-
- /* IP Entry 4 */
- { 0, /* Linked to dest mac index 0 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- },
-
- /* IP Entry 5 */
- { 1, /* Linked to dest mac index 1 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- },
-
- /* IP Entry 6 */
- { 0, /* Linked to dest mac index 0 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- },
-
- /* IP Entry 7 */
- { 1, /* Linked to dest mac index 1 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- },
-
- /* IP Entry 8 */
- { 0, /* Linked to dest mac index 0 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- },
-
-
- /* IP Entry 9 */
- { 1, /* Linked to dest mac index 1 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- },
-
-
- /* IP Entry 10 */
- { 0, /* Linked to dest mac index 0 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- },
-
- /* IP Entry 11 */
- { 1, /* Linked to dest mac index 1 */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
- FALSE
- }
-
-};
-
-/*
- * User-definded Statitics Map
- *
- * Group 1: counter 0x00 - 0x0a, byte counter, linking to 0x40 - 0x4a respectively
- * Group 2: counter 0x40 - 0x4a, packet counter, linking to 0x80-0x84
- * Group 3: counter 0x80 - 0x85, packet counter, no link
- * Group 4: counter 0xc0, packet counter (MAC 0) no link
- * counter 0xc1, packet counter (MAC 1) no link
- * Group 5: counter 0x40, packet counter, link to 0x00
- * This group should be rejected since it forms a close loop with entry 0 at Group 1
- * Group 6: counter 0x60, packet counter, link to 0x61
- * counter 0x61, packet counter, link to 0x62
- * counter 0x62, packet counter, link to 0x60
- * This group should be rejected since it forms a close loop (0x60==>0x61==>0x62==>0x60)
- */
-static uint16_t t5L3UsrStats[12] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B};
-static uint16_t t5L2UsrStats[2] = {0xC0, 0xC1};
-
-#pragma DATA_SECTION (usrStatsGroup1, ".testPkts")
-#pragma DATA_SECTION (usrStatsGroup2, ".testPkts")
-#pragma DATA_SECTION (usrStatsGroup3, ".testPkts")
-#pragma DATA_SECTION (usrStatsGroup4, ".testPkts")
-#pragma DATA_SECTION (usrStatsGroup5, ".testPkts")
-#pragma DATA_SECTION (usrStatsGroup6, ".testPkts")
-
-static paUsrStatsCounterEntryConfig_t usrStatsGroup1[ ] =
-{
- {0x00, 0x40, pa_USR_STATS_TYPE_BYTE},
- {0x01, 0x41, pa_USR_STATS_TYPE_BYTE},
- {0x02, 0x42, pa_USR_STATS_TYPE_BYTE},
- {0x03, 0x43, pa_USR_STATS_TYPE_BYTE},
- {0x04, 0x44, pa_USR_STATS_TYPE_BYTE},
- {0x05, 0x45, pa_USR_STATS_TYPE_BYTE},
- {0x06, 0x46, pa_USR_STATS_TYPE_BYTE},
- {0x07, 0x47, pa_USR_STATS_TYPE_BYTE},
- {0x08, 0x48, pa_USR_STATS_TYPE_BYTE},
- {0x09, 0x49, pa_USR_STATS_TYPE_BYTE},
- {0x0a, 0x4a, pa_USR_STATS_TYPE_BYTE},
- {0x0b, 0x4b, pa_USR_STATS_TYPE_BYTE}
-
-};
-
-static paUsrStatsCounterEntryConfig_t usrStatsGroup2[ ] =
-{
- {0x40, 0x80, pa_USR_STATS_TYPE_PACKET},
- {0x41, 0x81, pa_USR_STATS_TYPE_PACKET},
- {0x42, 0x81, pa_USR_STATS_TYPE_PACKET},
- {0x43, 0x82, pa_USR_STATS_TYPE_PACKET},
- {0x44, 0x82, pa_USR_STATS_TYPE_PACKET},
- {0x45, 0x82, pa_USR_STATS_TYPE_PACKET},
- {0x46, 0x83, pa_USR_STATS_TYPE_PACKET},
- {0x47, 0x83, pa_USR_STATS_TYPE_PACKET},
- {0x48, 0x83, pa_USR_STATS_TYPE_PACKET},
- {0x49, 0x83, pa_USR_STATS_TYPE_PACKET},
- {0x4a, 0x84, pa_USR_STATS_TYPE_PACKET},
- {0x4b, 0x84, pa_USR_STATS_TYPE_PACKET}
-};
-
-static paUsrStatsCounterEntryConfig_t usrStatsGroup3[ ] =
-{
- {0x80, pa_USR_STATS_LNK_END, pa_USR_STATS_TYPE_PACKET},
- {0x81, pa_USR_STATS_LNK_END, pa_USR_STATS_TYPE_PACKET},
- {0x82, pa_USR_STATS_LNK_END, pa_USR_STATS_TYPE_PACKET},
- {0x83, pa_USR_STATS_LNK_END, pa_USR_STATS_TYPE_PACKET},
- {0x84, pa_USR_STATS_LNK_END, pa_USR_STATS_TYPE_PACKET}
-};
-
-static paUsrStatsCounterEntryConfig_t usrStatsGroup4[ ] =
-{
- {0xC0, pa_USR_STATS_LNK_END, pa_USR_STATS_TYPE_PACKET},
- {0xC1, pa_USR_STATS_LNK_END, pa_USR_STATS_TYPE_PACKET}
-};
-
-static paUsrStatsCounterEntryConfig_t usrStatsGroup5[ ] =
-{
- {0x40, 0x00, pa_USR_STATS_TYPE_PACKET}
-};
-
-static paUsrStatsCounterEntryConfig_t usrStatsGroup6[ ] =
-{
- {0x60, 0x61, pa_USR_STATS_TYPE_PACKET},
- {0x61, 0x62, pa_USR_STATS_TYPE_PACKET},
- {0x62, 0x60, pa_USR_STATS_TYPE_PACKET}
-};
-
-
-
-typedef struct t5UsrStatsSetup_s {
- int32_t nStats; /* number of user-defined statistics to be configured */
- paUsrStatsCounterEntryConfig_t* cntEntryTbl; /* PA IP configuration structure */
- paReturn_t paret; /* The expected PA return value */
-
-} t5UsrStatsSetup_t;
-
-#pragma DATA_SECTION(t5IpSetup, ".testPkts")
-static t5UsrStatsSetup_t t5UsrStatsSetup[] = {
- /* entry 0 */
- {
- sizeof(usrStatsGroup1)/sizeof(paUsrStatsCounterEntryConfig_t), /* number of entries */
- usrStatsGroup1, /* counter Info table */
- pa_OK /* Expected return value */
- },
-
- /* entry 1 */
- {
- sizeof(usrStatsGroup2)/sizeof(paUsrStatsCounterEntryConfig_t), /* number of entries */
- usrStatsGroup2, /* counter Info table */
- pa_OK /* Expected return value */
- },
-
-
- /* entry 2 */
- {
- sizeof(usrStatsGroup3)/sizeof(paUsrStatsCounterEntryConfig_t), /* number of entries */
- usrStatsGroup3, /* counter Info table */
- pa_OK /* Expected return value */
- },
-
-
- /* entry 3 */
- {
- sizeof(usrStatsGroup4)/sizeof(paUsrStatsCounterEntryConfig_t), /* number of entries */
- usrStatsGroup4, /* counter Info table */
- pa_OK /* Expected return value */
- },
-
- /* entry 4 */
- {
- sizeof(usrStatsGroup5)/sizeof(paUsrStatsCounterEntryConfig_t), /* number of entries */
- usrStatsGroup5, /* counter Info table */
- pa_ERR_CONFIG /* Expected return value */
- },
-
-
- /* entry 5 */
- {
- sizeof(usrStatsGroup6)/sizeof(paUsrStatsCounterEntryConfig_t), /* number of entries */
- usrStatsGroup6, /* counter Info table */
- pa_ERR_CONFIG /* Expected return value */
- }
-};
-
-/* packet 0
- * mac dest = 00:01:02:03:04:aa
- * ip dest = 200.201.202.100
- * Designed to match IP configuration 0 */
-#pragma DATA_SECTION (pkt0, ".testPkts")
-static uint8_t pkt0[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x78, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x64, 0xaa, 0xbb, 0x00, 0x00, 0x00, 0x4e,
- 0x00, 0x00, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
- 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1,
- 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9
-};
-
-
-#pragma DATA_SECTION (pkt0Info, ".testPkts")
-static pasahoLongInfo_t pkt0Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,42), /* cmd len = 24, start offset = 42 (Payload) */
- TF_FORM_PKT_INFO_WORD1(112,0,1,0,0,0), /* end offset = 112, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,0,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-
-/* packet 1
- * mac dest = 00:e0:a6:66:57:09
- * ip dest = 200.201.202.101
- * Designed to match IP configuration 1 */
-#pragma DATA_SECTION (pkt1, ".testPkts")
-static uint8_t pkt1[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x63, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x65, 0xaa, 0xbb, 0x00, 0x00, 0x00, 0x62,
- 0x00, 0x00, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
- 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1,
- 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
- 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1,
- 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
- 0xba, 0xbb, 0xbc, 0xbd
-};
-
-#pragma DATA_SECTION (pkt1Info, ".testPkts")
-static pasahoLongInfo_t pkt1Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,42), /* cmd len = 20, start offset = 42 (Payload) */
- TF_FORM_PKT_INFO_WORD1(132,0,1,0,0,0), /* end offset = 132, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,0,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 2
- * mac dest - 00:01:02:03:04:aa
- * ip dest = 200.201.202.102
- * Designed to match IP configuration 2 */
-#pragma DATA_SECTION (pkt2, ".testPkts")
-static uint8_t pkt2[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x86, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x66, 0xaa, 0xbb, 0x00, 0x00, 0x00, 0x3e,
- 0x00, 0x00, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99
-};
-
-#pragma DATA_SECTION (pkt2Info, ".testPkts")
-static pasahoLongInfo_t pkt2Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,42), /* cmd len = 20, start offset = 42 (Payload) */
- TF_FORM_PKT_INFO_WORD1(96,0,1,0,0,0), /* end offset = 96, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,0,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-
-/* Packet 3
- * mac dest = 00:e0:a6:66:57:09
- * ip dest = 200.201.202.103
- * Designed to match IP configuration 3 */
-#pragma DATA_SECTION (pkt3, ".testPkts")
-static uint8_t pkt3[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x7b, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x67, 0xaa, 0xbb, 0x00, 0x00, 0x00, 0x48,
- 0x00, 0x00, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
- 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1,
- 0xa2, 0xa3
-};
-
-#pragma DATA_SECTION (pkt3Info, ".testPkts")
-static pasahoLongInfo_t pkt3Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,42), /* cmd len = 20, start offset = 42 (Payload) */
- TF_FORM_PKT_INFO_WORD1(106,0,1,0,0,0), /* end offset = 106, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,0,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 4
- * mac dest = 00:01:02:03:04:aa
- * ip dest = 200.201.202.104
- * Designed to match IP configuration 4 */
-#pragma DATA_SECTION (pkt4, ".testPkts")
-static uint8_t pkt4[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x5e, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x68, 0xaa, 0xbb, 0x00, 0x00, 0x00, 0x64,
- 0x00, 0x00, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
- 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1,
- 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
- 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1,
- 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
- 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf
-};
-
-#pragma DATA_SECTION (pkt4Info, ".testPkts")
-static pasahoLongInfo_t pkt4Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,42), /* cmd len = 20, start offset = 42 (Payload) */
- TF_FORM_PKT_INFO_WORD1(134,0,1,0,0,0), /* end offset = 134, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,0,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 5
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.105
- * Designed to match IP configuration 5 */
-#pragma DATA_SECTION (pkt5, ".testPkts")
-static uint8_t pkt5[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x61, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x69, 0xaa, 0xbb, 0x00, 0x00, 0x00, 0x60,
- 0x00, 0x00, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
- 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1,
- 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
- 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1,
- 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
- 0xba, 0xbb
-};
-
-
-#pragma DATA_SECTION (pkt5Info, ".testPkts")
-static pasahoLongInfo_t pkt5Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,42), /* cmd len = 20, start offset = 42 (Payload) */
- TF_FORM_PKT_INFO_WORD1(130,0,1,0,0,0), /* end offset = 130, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,0,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 6
- * mac dest = 00:01:02:03:04:aa
- * IP dest = 200.201.202.106
- * Designed to match IP configuration 6 */
-#pragma DATA_SECTION (pkt6, ".testPkts")
-static uint8_t pkt6[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x64, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6a, 0xaa, 0xbb, 0x00, 0x00, 0x00, 0x5c,
- 0x00, 0x00, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
- 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1,
- 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
- 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1,
- 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7
-};
-
-#pragma DATA_SECTION (pkt6Info, ".testPkts")
-static pasahoLongInfo_t pkt6Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,42), /* cmd len = 20, start offset = 42 (Payload) */
- TF_FORM_PKT_INFO_WORD1(126,0,1,0,0,0), /* end offset = 126, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,0,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 7
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 00.201.202.107
- * Designed to match IP configuration 7 */
-#pragma DATA_SECTION (pkt7, ".testPkts")
-static uint8_t pkt7[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x5b, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6b, 0xaa, 0xbb, 0x00, 0x00, 0x00, 0x64,
- 0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
- 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
- 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
- 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21,
- 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
- 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31,
- 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
- 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41,
- 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
- 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
- 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
- 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f
-};
-
-#pragma DATA_SECTION (pkt7Info, ".testPkts")
-static pasahoLongInfo_t pkt7Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,42), /* cmd len = 20, start offset = 42 (Payload) */
- TF_FORM_PKT_INFO_WORD1(134,0,1,0,0,0), /* end offset = 134, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,0,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 8
- * mac dest = 00:01:02:03:04:aa
- * IP dest = 200.201.202.108
- * Designed to match IP configuration 8 */
-#pragma DATA_SECTION (pkt8, ".testPkts")
-static uint8_t pkt8[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x5a, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6c, 0xaa, 0xbb, 0x00, 0x00, 0x00, 0x64,
- 0x00, 0x00, 0xa6, 0xe7, 0x94, 0x3d, 0x32, 0x83,
- 0x00, 0x39, 0x7e, 0xdf, 0x2c, 0xf5, 0x8a, 0xfb,
- 0x18, 0x71, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25
-};
-
-#pragma DATA_SECTION (pkt8Info, ".testPkts")
-static pasahoLongInfo_t pkt8Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,42), /* cmd len = 20, start offset = 42 (Payload) */
- TF_FORM_PKT_INFO_WORD1(134,0,1,0,0,0), /* end offset = 134, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,0,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 9
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.109
- * Designed to match IP configuration 9 */
-#pragma DATA_SECTION (pkt9, ".testPkts")
-static Uint8 pkt9[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x53, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6d, 0xaa, 0xbb, 0x00, 0x00, 0x00, 0x6a,
- 0x00, 0x00, 0xa6, 0xe7, 0x94, 0x3d, 0x32, 0x83,
- 0x00, 0x39, 0x7e, 0xdf, 0x2c, 0xf5, 0x8a, 0xfb,
- 0x18, 0x71, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25, 0xfa, 0xab,
- 0x08, 0xa1, 0xc6, 0x87
-};
-
-#pragma DATA_SECTION (pkt9Info, ".testPkts")
-static pasahoLongInfo_t pkt9Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,42), /* cmd len = 20, start offset = 42 (Payload) */
- TF_FORM_PKT_INFO_WORD1(140,0,1,0,0,0), /* end offset = 140, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,0,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-
-/* Packet 10
- * mac dest = 00:01:02:03:04:aa
- * IP dest = 200.201.202.110
- * Designed to match IP configuration 10
- * TCP */
-
-#pragma DATA_SECTION (pkt10, ".testPkts")
-static uint8_t pkt10[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x06,
- 0x16, 0x69, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x12, 0x34,
- 0x56, 0x78, 0x11, 0x22, 0x33, 0x44, 0x61, 0x6a,
- 0x33, 0x33, 0xa9, 0x9a, 0x44, 0x44, 0x55, 0x66,
- 0x77, 0x00, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
- 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1,
- 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9 };
-
-
-#pragma DATA_SECTION (pkt10Info, ".testPkts")
-static pasahoLongInfo_t pkt10Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,58), /* cmd len = 20, start offset = 58 (Payload) */
- TF_FORM_PKT_INFO_WORD1(128,0,1,0,0,0), /* end offset = 128, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,0,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_TCP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 11
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.111
- * Designed to match IP configuration 10
- * TCP */
-#pragma DATA_SECTION (pkt11, ".testPkts")
-static uint8_t pkt11[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x05, 0x06,
- 0x16, 0x52, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x12, 0x34,
- 0x56, 0x78, 0x11, 0x22, 0x33, 0x44, 0x51, 0x6a,
- 0x33, 0x33, 0x3e, 0x96, 0x44, 0x44, 0x64, 0x65,
- 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
- 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75,
- 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d,
- 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85,
- 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d,
- 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95,
- 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d,
- 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5,
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad,
- 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5,
- 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd,
- 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3 };
-
-#pragma DATA_SECTION (pkt11Info, ".testPkts")
-static pasahoLongInfo_t pkt11Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,54), /* cmd len = 20, start offset = 54 (Payload) */
- TF_FORM_PKT_INFO_WORD1(150,0,1,0,0,0), /* end offset = 150, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,0,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_TCP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-
-#define T5_PKTINFO_IDX_MATCH_FLAG 0x40000000
-#define T5_PKTINFO_IDX_MASK 0x30000000
-
-#pragma DATA_SECTION (t5PktInfo, ".testPkts")
-static pktTestInfo_t t5PktInfo[] = {
-
- /* Packet 0 */
- {
- (uint8_t *)pkt0,
- (pasahoLongInfo_t *)&pkt0Info,
- sizeof(pkt0),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_PKTINFO_IDX_MATCH_FLAG | 0 /* Packet will be matched by handle index 0 */
- },
-
- /* Packet 1 */
- {
- (uint8_t *)pkt1,
- (pasahoLongInfo_t *)&pkt1Info,
- sizeof(pkt1),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_PKTINFO_IDX_MATCH_FLAG | 0 /* Packet will be matched by handle index 0 */
- },
-
- /* Packet 2 */
- {
- (uint8_t *)pkt2,
- (pasahoLongInfo_t *)&pkt2Info,
- sizeof(pkt2),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_PKTINFO_IDX_MATCH_FLAG | 0 /* Packet will be matched by handle index 0 */
- },
-
- /* Packet 3 */
- {
- (uint8_t *)pkt3,
- (pasahoLongInfo_t *)&pkt3Info,
- sizeof(pkt3),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_PKTINFO_IDX_MATCH_FLAG | 0 /* Packet will be matched by handle index 0 */
- },
-
- /* Packet 4 */
- {
- (uint8_t *)pkt4,
- (pasahoLongInfo_t *)&pkt4Info,
- sizeof(pkt4),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_PKTINFO_IDX_MATCH_FLAG | 0 /* Packet will be matched by handle index 0 */
- },
-
- /* Packet 5 */
- {
- (uint8_t *)pkt5,
- (pasahoLongInfo_t *)&pkt5Info,
- sizeof(pkt5),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_PKTINFO_IDX_MATCH_FLAG | 0 /* Packet will be matched by handle index 0 */
- },
-
- /* Packet 6 */
- {
- (uint8_t *)pkt6,
- (pasahoLongInfo_t *)&pkt6Info,
- sizeof(pkt6),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_PKTINFO_IDX_MATCH_FLAG | 0 /* Packet will be matched by handle index 0 */
- },
-
-
- /* Packet 7 */
- {
- (uint8_t *)pkt7,
- (pasahoLongInfo_t *)&pkt7Info,
- sizeof(pkt7),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_PKTINFO_IDX_MATCH_FLAG | 0 /* Packet will be matched by handle index 0 */
- },
-
- /* Packet 8 */
- {
- (uint8_t *)pkt8,
- (pasahoLongInfo_t *)&pkt8Info,
- sizeof(pkt8),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_PKTINFO_IDX_MATCH_FLAG | 0 /* Packet will be matched by handle index 0 */
- },
-
- /* Packet 9 */
- {
- (uint8_t *)pkt9,
- (pasahoLongInfo_t *)&pkt9Info,
- sizeof(pkt9),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_PKTINFO_IDX_MATCH_FLAG | 0 /* Packet will be matched by handle index 0 */
- },
-
- /* Packet 10 */
- {
- (uint8_t *)pkt10,
- (pasahoLongInfo_t *)&pkt10Info,
- sizeof(pkt10),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_TCP) }, /* TCP match */
- T5_PKTINFO_IDX_MATCH_FLAG | 0 /* Packet will be matched by handle index 0 */
- },
-
- /* Packet 11 */
- {
- (uint8_t *)pkt11,
- (pasahoLongInfo_t *)&pkt11Info,
- sizeof(pkt11),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_TCP) }, /* TCP match */
- T5_PKTINFO_IDX_MATCH_FLAG | 0 /* Packet will be matched by handle index 0 */
- }
-
-
-};
-
-/* The pseudo header checksums used for UDP checksum generation */
-static uint32_t t5PseudoChksums[] = {
- 0x9f73, /* Packet 0 */
- 0x9f88, /* Packet 1 */
- 0x9f65, /* Packet 2 */
- 0x9f70, /* Packet 3 */
- 0x9f8d, /* Packet 4 */
- 0x9f8a, /* Packet 5 */
- 0x9f87, /* Packet 6 */
- 0x9f90, /* Packet 7 */
- 0x9f91, /* Packet 8 */
- 0x9f98, /* Packet 9 */
- 0x9f82, /* Packet 10 */
- 0x9f99 /* Packet 11 */
-};
-
-/* packet 0
- * mac dest = 00:01:02:03:04:aa
- * ip dest = 200.201.202.100
- * Designed to match IP configuration 0
- * TEID = 0x01000000
- * Insert the PDU number (0xface) at the packet descriptor offset 20
- */
-#pragma DATA_SECTION (gtpuPkt0, ".testPkts")
-static uint8_t gtpuPkt0[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x78, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x64, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x4e,
- 0x00, 0x00, 0x34, 0xff, 0x00, 0x3e, 0x01, 0x00,
- 0x00, 0x00, 0x6c, 0x6d, 0x01, 0xc0, 0x01, 0xfa,
- 0xce, 0x00, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
- 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1,
- 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9
-};
-
-
-#pragma DATA_SECTION (gtpuPkt0Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt0Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,58), /* cmd len = 24, start offset = 58 (GTPU-Payload) */
- TF_FORM_PKT_INFO_WORD1(112,0,1,0,0,0), /* end offset = 112, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-
-/* packet 1
- * mac dest = 00:e0:a6:66:57:09
- * ip dest = 200.201.202.101
- * Designed to match IP configuration 1
- * TEID = 0x01000005
- * Commands: Remove header/Insert 0/Remove Tail
- * Insert the PDU number (0xbeef) at the packet descriptor offset 20
- */
-#pragma DATA_SECTION (gtpuPkt1, ".testPkts")
-static uint8_t gtpuPkt1[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x63, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x65, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x62,
- 0x00, 0x00, 0x34, 0xff, 0x00, 0x52, 0x01, 0x00,
- 0x00, 0x05, 0xba, 0xbe, 0x01, 0xc0, 0x01, 0xbe,
- 0xef, 0x00, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
- 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1,
- 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
- 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1,
- 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
- 0xba, 0xbb, 0xbc, 0xbd, 0x01, 0x02, 0x03, 0x04
-};
-
-#pragma DATA_SECTION (gtpuPkt1Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt1Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,0), /* cmd len = 24, start offset = 0 (Payload) */
- TF_FORM_PKT_INFO_WORD1(75,0,1,0,0,0), /* end offset = 75, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 2
- * mac dest - 00:01:02:03:04:aa
- * ip dest = 200.201.202.102
- * Designed to match IP configuration 2
- * TEID = 0x0100000A
- */
-#pragma DATA_SECTION (gtpuPkt2, ".testPkts")
-static uint8_t gtpuPkt2[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x86, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x66, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x3e,
- 0x00, 0x00, 0x30, 0xff, 0x00, 0x2e, 0x01, 0x00,
- 0x00, 0x0a, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99
-};
-
-#pragma DATA_SECTION (gtpuPkt2Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt2Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,50), /* cmd len = 24, start offset = 50 (Payload) */
- TF_FORM_PKT_INFO_WORD1(96,0,1,0,0,0), /* end offset = 96, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-
-/* Packet 3
- * mac dest = 00:e0:a6:66:57:09
- * ip dest = 200.201.202.103
- * Designed to match IP configuration 3
- * TEID = 0x01000015
- * Commands: Remove header/Insert 0/Remove Tail
- */
-#pragma DATA_SECTION (gtpuPkt3, ".testPkts")
-static uint8_t gtpuPkt3[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x7b, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x67, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x48,
- 0x00, 0x00, 0x30, 0xff, 0x00, 0x38, 0x01, 0x00,
- 0x00, 0x15, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
- 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1,
- 0xa2, 0xa3
-};
-
-#pragma DATA_SECTION (gtpuPkt3Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt3Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,0), /* cmd len = 24, start offset = 0 (Payload) */
- TF_FORM_PKT_INFO_WORD1(57,0,1,0,0,0), /* end offset = 57, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 4
- * mac dest = 00:01:02:03:04:aa
- * ip dest = 200.201.202.104
- * Designed to match IP configuration 4
- * TEID = 0x0100001A
- */
-#pragma DATA_SECTION (gtpuPkt4, ".testPkts")
-static uint8_t gtpuPkt4[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x5e, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x68, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x64,
- 0x00, 0x00, 0x30, 0xff, 0x00, 0x54, 0x01, 0x00,
- 0x00, 0x1a, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
- 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1,
- 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
- 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1,
- 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
- 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf
-};
-
-#pragma DATA_SECTION (gtpuPkt4Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt4Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,50), /* cmd len = 24, start offset = 50 (Payload) */
- TF_FORM_PKT_INFO_WORD1(134,0,1,0,0,0), /* end offset = 134, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 5
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.105
- * Designed to match IP configuration 5
- * TEID = 0x01000025
- * Commands: Remove header/Insert 0/Remove Tail
- */
-
-#pragma DATA_SECTION (gtpuPkt5, ".testPkts")
-static uint8_t gtpuPkt5[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x61, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x69, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x60,
- 0x00, 0x00, 0x30, 0xff, 0x00, 0x50, 0x01, 0x00,
- 0x00, 0x25, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
- 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1,
- 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
- 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1,
- 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
- 0xba, 0xbb
-};
-
-
-#pragma DATA_SECTION (gtpuPkt5Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt5Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,0), /* cmd len = 24, start offset = 0 (Payload) */
- TF_FORM_PKT_INFO_WORD1(81,0,1,0,0,0), /* end offset = 81, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 6
- * mac dest = 00:01:02:03:04:aa
- * IP dest = 200.201.202.106
- * Designed to match IP configuration 6
- * TEID = 0x0100002A
- */
-#pragma DATA_SECTION (gtpuPkt6, ".testPkts")
-static uint8_t gtpuPkt6[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x64, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6a, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x5c,
- 0x00, 0x00, 0x30, 0xff, 0x00, 0x4c, 0x01, 0x00,
- 0x00, 0x2a, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
- 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1,
- 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
- 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1,
- 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7
-};
-
-#pragma DATA_SECTION (gtpuPkt6Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt6Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,50), /* cmd len = 24, start offset = 50 (Payload) */
- TF_FORM_PKT_INFO_WORD1(126,0,1,0,0,0), /* end offset = 126, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 7
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 00.201.202.107
- * Designed to match IP configuration 7
- * TEID = 0x01000035
- * Commands: Remove header/Insert 0/Remove Tail
- */
-#pragma DATA_SECTION (gtpuPkt7, ".testPkts")
-static uint8_t gtpuPkt7[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x5b, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6b, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x64,
- 0x00, 0x00, 0x30, 0xff, 0x00, 0x54, 0x01, 0x00,
- 0x00, 0x35, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
- 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
- 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21,
- 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
- 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31,
- 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
- 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41,
- 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
- 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
- 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
- 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f
-};
-
-#pragma DATA_SECTION (gtpuPkt7Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt7Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,0), /* cmd len = 24, start offset = 0 (Payload) */
- TF_FORM_PKT_INFO_WORD1(85,0,1,0,0,0), /* end offset = 85, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 8
- * mac dest = 00:01:02:03:04:aa
- * IP dest = 200.201.202.108
- * Designed to match IP configuration 8
- * TEID = 0x0100003A
- */
-
-#pragma DATA_SECTION (gtpuPkt8, ".testPkts")
-static uint8_t gtpuPkt8[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x5a, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6c, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x64,
- 0x00, 0x00, 0x30, 0xff, 0x00, 0x54, 0x01, 0x00,
- 0x00, 0x3a, 0x7e, 0xdf, 0x2c, 0xf5, 0x8a, 0xfb,
- 0x18, 0x71, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25
-};
-
-#pragma DATA_SECTION (gtpuPkt8Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt8Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,50), /* cmd len = 24, start offset = 50 (Payload) */
- TF_FORM_PKT_INFO_WORD1(134,0,1,0,0,0), /* end offset = 134, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 9
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.109
- * Designed to match IP configuration 9
- * TEID = 0x01000063
- * Commands: Remove header/Insert 0/Remove Tail
- */
-
-#pragma DATA_SECTION (gtpuPkt9, ".testPkts")
-static Uint8 gtpuPkt9[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x53, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6d, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6a,
- 0x00, 0x00, 0x30, 0xff, 0x00, 0x5a, 0x01, 0x00,
- 0x00, 0x63, 0x7e, 0xdf, 0x2c, 0xf5, 0x8a, 0xfb,
- 0x18, 0x71, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25, 0xfa, 0xab,
- 0x08, 0xa1, 0xc6, 0x87
-};
-
-#pragma DATA_SECTION (gtpuPkt9Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt9Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,0), /* cmd len = 24, start offset = 0 (Payload) */
- TF_FORM_PKT_INFO_WORD1(91,0,1,0,0,0), /* end offset = 91, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 10
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.109
- * Designed to match IP configuration 9
- * GTPU message type 1
- */
-#pragma DATA_SECTION (gtpuPkt10, ".testPkts")
-static Uint8 gtpuPkt10[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x53, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6d, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6a,
- 0x00, 0x00, 0x30, 0x01, 0x00, 0x5a, 0x01, 0x00,
- 0x00, 0x63, 0x7e, 0xdf, 0x2c, 0xf5, 0x8a, 0xfb,
- 0x18, 0x71, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25, 0xfa, 0xab,
- 0x08, 0xa1, 0xc6, 0x87
-};
-
-#pragma DATA_SECTION (gtpuPkt10Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt10Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,42), /* cmd len = 24, start offset = 42 */
- TF_FORM_PKT_INFO_WORD1(140,pa_EROUTE_GTPU_MESSAGE_TYPE_1,1,0,0,0), /* end offset = 140, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 11
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.109
- * Designed to match IP configuration 9
- * GTP-U Message Type 2
- */
-#pragma DATA_SECTION (gtpuPkt11, ".testPkts")
-static Uint8 gtpuPkt11[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x53, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6d, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6a,
- 0x00, 0x00, 0x30, 0x02, 0x00, 0x5a, 0x01, 0x00,
- 0x00, 0x63, 0x7e, 0xdf, 0x2c, 0xf5, 0x8a, 0xfb,
- 0x18, 0x71, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25, 0xfa, 0xab,
- 0x08, 0xa1, 0xc6, 0x87
-};
-
-#pragma DATA_SECTION (gtpuPkt11Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt11Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,42), /* cmd len = 24, start offset = 42 */
- TF_FORM_PKT_INFO_WORD1(140,pa_EROUTE_GTPU_MESSAGE_TYPE_2,1,0,0,0), /* end offset = 140, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 12
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.109
- * Designed to match IP configuration 9
- * GTP-U Message Type 26
- */
-#pragma DATA_SECTION (gtpuPkt12, ".testPkts")
-static Uint8 gtpuPkt12[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x53, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6d, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6a,
- 0x00, 0x00, 0x30, 0x1a, 0x00, 0x5a, 0x01, 0x00,
- 0x00, 0x63, 0x7e, 0xdf, 0x2c, 0xf5, 0x8a, 0xfb,
- 0x18, 0x71, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25, 0xfa, 0xab,
- 0x08, 0xa1, 0xc6, 0x87
-};
-
-#pragma DATA_SECTION (gtpuPkt12Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt12Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,42), /* cmd len = 24, start offset = 42 */
- TF_FORM_PKT_INFO_WORD1(140,pa_EROUTE_GTPU_MESSAGE_TYPE_26,1,0,0,0), /* end offset = 140, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-/* Packet 13
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.109
- * Designed to match IP configuration 9
- * Message Type 31
- */
-#pragma DATA_SECTION (gtpuPkt13, ".testPkts")
-static Uint8 gtpuPkt13[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x53, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6d, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6a,
- 0x00, 0x00, 0x30, 0x1f, 0x00, 0x5a, 0x01, 0x00,
- 0x00, 0x63, 0x7e, 0xdf, 0x2c, 0xf5, 0x8a, 0xfb,
- 0x18, 0x71, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25, 0xfa, 0xab,
- 0x08, 0xa1, 0xc6, 0x87
-};
-
-#pragma DATA_SECTION (gtpuPkt13Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt13Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,42), /* cmd len = 24, start offset = 42 */
- TF_FORM_PKT_INFO_WORD1(140,pa_EROUTE_GTPU_MESSAGE_TYPE_31,1,0,0,0), /* end offset = 140, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-/* Packet 14
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.109
- * Designed to match IP configuration 9
- * GTP-U Message Type 254
- */
-#pragma DATA_SECTION (gtpuPkt14, ".testPkts")
-static Uint8 gtpuPkt14[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x53, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6d, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6a,
- 0x00, 0x00, 0x30, 0xfe, 0x00, 0x5a, 0x01, 0x00,
- 0x00, 0x63, 0x7e, 0xdf, 0x2c, 0xf5, 0x8a, 0xfb,
- 0x18, 0x71, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25, 0xfa, 0xab,
- 0x08, 0xa1, 0xc6, 0x87
-};
-
-#pragma DATA_SECTION (gtpuPkt14Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt14Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,42), /* cmd len = 24, start offset = 42 */
- TF_FORM_PKT_INFO_WORD1(140,pa_EROUTE_GTPU_MESSAGE_TYPE_254,1,0,0,0), /* end offset = 140, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-/* Packet 15
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.109
- * Designed to match IP configuration 9
- * Message type 0x80 ==> nusupported
- */
-#pragma DATA_SECTION (gtpuPkt15, ".testPkts")
-static Uint8 gtpuPkt15[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x53, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6d, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6a,
- 0x00, 0x00, 0x30, 0x80, 0x00, 0x5a, 0x01, 0x00,
- 0x00, 0x63, 0x7e, 0xdf, 0x2c, 0xf5, 0x8a, 0xfb,
- 0x18, 0x71, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25, 0xfa, 0xab,
- 0x08, 0xa1, 0xc6, 0x87
-};
-
-#pragma DATA_SECTION (gtpuPkt15Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt15Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,42), /* cmd len = 24, start offset = 42 */
- TF_FORM_PKT_INFO_WORD1(140,pa_EROUTE_GTPU_FAIL,1,0,0,0), /* end offset = 140, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-/* Packet 16
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.109
- * Designed to match IP configuration 9
- * Incorrect Version Number
- */
-#pragma DATA_SECTION (gtpuPkt16, ".testPkts")
-static Uint8 gtpuPkt16[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x53, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6d, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6a,
- 0x00, 0x00, 0x50, 0xff, 0x00, 0x5a, 0x01, 0x00,
- 0x00, 0x63, 0x7e, 0xdf, 0x2c, 0xf5, 0x8a, 0xfb,
- 0x18, 0x71, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25, 0xfa, 0xab,
- 0x08, 0xa1, 0xc6, 0x87
-};
-
-#pragma DATA_SECTION (gtpuPkt16Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt16Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,42), /* cmd len = 24, start offset = 42 */
- TF_FORM_PKT_INFO_WORD1(140,pa_EROUTE_GTPU_FAIL,1,0,0,0), /* end offset = 140, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-/* Packet 17
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.109
- * Designed to match IP configuration 9
- * Incorrect PT
- */
-#pragma DATA_SECTION (gtpuPkt17, ".testPkts")
-static Uint8 gtpuPkt17[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x53, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6d, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6a,
- 0x00, 0x00, 0x20, 0xff, 0x00, 0x5a, 0x01, 0x00,
- 0x00, 0x63, 0x7e, 0xdf, 0x2c, 0xf5, 0x8a, 0xfb,
- 0x18, 0x71, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25, 0xfa, 0xab,
- 0x08, 0xa1, 0xc6, 0x87
-};
-
-#pragma DATA_SECTION (gtpuPkt17Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt17Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,42), /* cmd len = 24, start offset = 42 */
- TF_FORM_PKT_INFO_WORD1(140,pa_EROUTE_GTPU_FAIL,1,0,0,0), /* end offset = 140, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-/* Packet 18
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.109
- * Designed to match IP configuration 9
- * E = 1, but bad Type
- */
-#pragma DATA_SECTION (gtpuPkt18, ".testPkts")
-static Uint8 gtpuPkt18[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x53, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6d, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6a,
- 0x00, 0x00, 0x34, 0xff, 0x00, 0x5a, 0x01, 0x00,
- 0x00, 0x63, 0x00, 0x01, 0x02, 0xaa, 0x8a, 0xfb,
- 0x18, 0x71, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25, 0xfa, 0xab,
- 0x08, 0xa1, 0xc6, 0x87
-};
-
-#pragma DATA_SECTION (gtpuPkt18Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt18Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,42), /* cmd len = 24, start offset = 42 */
- TF_FORM_PKT_INFO_WORD1(140,pa_EROUTE_GTPU_FAIL,1,0,0,0), /* end offset = 140, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-/* Packet 19
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.109
- * Designed to match IP configuration 9
- * E = 1, NextHdr = 0xc0, next Hdr = 0xc0
- */
-#pragma DATA_SECTION (gtpuPkt19, ".testPkts")
-static Uint8 gtpuPkt19[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x53, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6d, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6a,
- 0x00, 0x00, 0x34, 0xff, 0x00, 0x5a, 0x01, 0x00,
- 0x00, 0x63, 0x00, 0x01, 0x02, 0xc0, 0x01, 0x00,
- 0x00, 0xc0, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25, 0xfa, 0xab,
- 0x08, 0xa1, 0xc6, 0x87
-};
-
-#pragma DATA_SECTION (gtpuPkt19Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt19Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,42), /* cmd len = 24, start offset = 42 */
- TF_FORM_PKT_INFO_WORD1(140,pa_EROUTE_GTPU_FAIL,1,0,0,0), /* end offset = 140, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP | PASAHO_HDR_BITMASK_GTPU),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-/* Packet 20
- * mac dest = 00:e0:a6:66:57:09
- * IP dest = 200.201.202.109
- * Designed to match IP configuration 9
- * IP Fragmentation
- */
-#pragma DATA_SECTION (gtpuPkt20, ".testPkts")
-static Uint8 gtpuPkt20[] = {
- 0x00, 0xe0, 0xa6, 0x66, 0x57, 0x09, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7e, 0x00, 0x00, 0x20, 0x80, 0x05, 0x11,
- 0x16, 0x53, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x6d, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6a,
- 0x00, 0x00, 0x34, 0xff, 0x00, 0x5a, 0x01, 0x00,
- 0x00, 0x63, 0x00, 0x01, 0x02, 0xc0, 0x01, 0x00,
- 0x00, 0xc0, 0x56, 0xd7, 0xc4, 0xad, 0xe2, 0x73,
- 0x30, 0xa9, 0x2e, 0xcf, 0x5c, 0x65, 0x3a, 0xeb,
- 0x48, 0xe1, 0x06, 0xc7, 0xf4, 0x1d, 0x92, 0x63,
- 0x60, 0x19, 0xde, 0xbf, 0x8c, 0xd5, 0xea, 0xdb,
- 0x78, 0x51, 0xb6, 0xb7, 0x24, 0x8d, 0x42, 0x53,
- 0x90, 0x89, 0x8e, 0xaf, 0xbc, 0x45, 0x9a, 0xcb,
- 0xa8, 0xc1, 0x66, 0xa7, 0x54, 0xfd, 0xf2, 0x43,
- 0xc0, 0xf9, 0x3e, 0x9f, 0xec, 0xb5, 0x4a, 0xbb,
- 0xd8, 0x31, 0x16, 0x97, 0x84, 0x6d, 0xa2, 0x33,
- 0xf0, 0x69, 0xee, 0x8f, 0x1c, 0x25, 0xfa, 0xab,
- 0x08, 0xa1, 0xc6, 0x87
-};
-
-#pragma DATA_SECTION (gtpuPkt20Info, ".testPkts")
-static pasahoLongInfo_t gtpuPkt20Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,34), /* cmd len = 24, start offset = 34 */
- TF_FORM_PKT_INFO_WORD1(140,pa_EROUTE_IP_FRAG,1,0,0,0), /* end offset = 140, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,0,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-
-
-#pragma DATA_SECTION (t5GTPUPktInfo, ".testPkts")
-static pktTestInfo_t t5GTPUPktInfo[] = {
-
- /* Packet 0 */
- {
- (uint8_t *)gtpuPkt0,
- (pasahoLongInfo_t *)>puPkt0Info,
- sizeof(gtpuPkt0),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FIRST_PKT_INDEX
- },
-
- /* Packet 1 */
- {
- (uint8_t *)gtpuPkt1,
- (pasahoLongInfo_t *)>puPkt1Info,
- sizeof(gtpuPkt1),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FIRST_PKT_INDEX + 0x05
- },
-
- /* Packet 2 */
- {
- (uint8_t *)gtpuPkt2,
- (pasahoLongInfo_t *)>puPkt2Info,
- sizeof(gtpuPkt2),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FIRST_PKT_INDEX + 0x0a
- },
-
- /* Packet 3 */
- {
- (uint8_t *)gtpuPkt3,
- (pasahoLongInfo_t *)>puPkt3Info,
- sizeof(gtpuPkt3),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FIRST_PKT_INDEX + 0x15
- },
-
- /* Packet 4 */
- {
- (uint8_t *)gtpuPkt4,
- (pasahoLongInfo_t *)>puPkt4Info,
- sizeof(gtpuPkt4),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FIRST_PKT_INDEX + 0x1a
- },
-
- /* Packet 5 */
- {
- (uint8_t *)gtpuPkt5,
- (pasahoLongInfo_t *)>puPkt5Info,
- sizeof(gtpuPkt5),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FIRST_PKT_INDEX + 0x25
- },
-
- /* Packet 6 */
- {
- (uint8_t *)gtpuPkt6,
- (pasahoLongInfo_t *)>puPkt6Info,
- sizeof(gtpuPkt6),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FIRST_PKT_INDEX + 0x2a
- },
-
-
- /* Packet 7 */
- {
- (uint8_t *)gtpuPkt7,
- (pasahoLongInfo_t *)>puPkt7Info,
- sizeof(gtpuPkt7),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FIRST_PKT_INDEX + 0x35
- },
-
- /* Packet 8 */
- {
- (uint8_t *)gtpuPkt8,
- (pasahoLongInfo_t *)>puPkt8Info,
- sizeof(gtpuPkt8),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FIRST_PKT_INDEX + 0x3a
- },
-
- /* Packet 9 */
- {
- (uint8_t *)gtpuPkt9,
- (pasahoLongInfo_t *)>puPkt9Info,
- sizeof(gtpuPkt9),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FIRST_PKT_INDEX + 0x63
- },
-
- /* Packet 10 */
- {
- (uint8_t *)gtpuPkt10,
- (pasahoLongInfo_t *)>puPkt10Info,
- sizeof(gtpuPkt10),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_PING_REQ_PKT_INDEX
- },
-
- /* Packet 11 */
- {
- (uint8_t *)gtpuPkt11,
- (pasahoLongInfo_t *)>puPkt11Info,
- sizeof(gtpuPkt11),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_PING_RESP_PKT_INDEX
- },
-
- /* Packet 12 */
- {
- (uint8_t *)gtpuPkt12,
- (pasahoLongInfo_t *)>puPkt12Info,
- sizeof(gtpuPkt12),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_ERR_IND_PKT_INDEX
- },
-
- /* Packet 13 */
- {
- (uint8_t *)gtpuPkt13,
- (pasahoLongInfo_t *)>puPkt13Info,
- sizeof(gtpuPkt13),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_HDR_NOTIFY_PKT_INDEX
- },
-
- /* Packet 14 */
- {
- (uint8_t *)gtpuPkt14,
- (pasahoLongInfo_t *)>puPkt14Info,
- sizeof(gtpuPkt14),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_END_MARKER_PKT_INDEX
- },
-
- /*
- * Packet 15-19 test different types of GTP-U Parsing Error
- * The SwInfo0 will contain the same index (T5_GTPU_FAIL_PKT_INDEX)
- * Therefore, they are all received as Packet 15
- * The packetInfo of packet 15-19 should be identical
- *
- */
- /* Packet 15 */
- {
- (uint8_t *)gtpuPkt15,
- (pasahoLongInfo_t *)>puPkt15Info,
- sizeof(gtpuPkt15),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FAIL_PKT_INDEX
- },
-
- /* Packet 16 */
- {
- (uint8_t *)gtpuPkt16,
- (pasahoLongInfo_t *)>puPkt16Info,
- sizeof(gtpuPkt16),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FAIL_PKT_INDEX
- },
-
- /* Packet 17 */
- {
- (uint8_t *)gtpuPkt17,
- (pasahoLongInfo_t *)>puPkt17Info,
- sizeof(gtpuPkt17),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FAIL_PKT_INDEX
- },
-
- /* Packet 18 */
- {
- (uint8_t *)gtpuPkt18,
- (pasahoLongInfo_t *)>puPkt18Info,
- sizeof(gtpuPkt18),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FAIL_PKT_INDEX
- },
-
- /* Packet 19 */
- {
- (uint8_t *)gtpuPkt19,
- (pasahoLongInfo_t *)>puPkt19Info,
- sizeof(gtpuPkt19),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T5_GTPU_FAIL_PKT_INDEX
- },
-
- /* Packet 20 */
- {
- (uint8_t *)gtpuPkt20,
- (pasahoLongInfo_t *)>puPkt20Info,
- sizeof(gtpuPkt20),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4)| /* IP match */
- (1 << TF_STATS_BM_C1_IP_FRAG),
- 0 }, /* UDP match */
- T5_IP_FRAG_PKT_INDEX
- }
-
-
-
-
-};
-
-
-
-#endif /*TEST5PKTS_H_*/
diff --git a/test/PAUnitTest2/tests/test6.c b/test/PAUnitTest2/tests/test6.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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 "../pautest.h"
-#include "test6pkts.h"
-
-#ifdef __LINUX_USER_SPACE
-#include "fw_test.h"
-#include "fw_mem_allocator.h"
-#endif
-
-
-/* Blind patch and routing test
- * This test tests the LLD Pa_formatRoutePatch and macros for creating patch and routing
- * command sequences as well as the PDSP firmware for correct operation in executing patch
- * command and subsequent routing. This test has the following sub-tests:
- * - Test the LLD for formatting the patch and routing commands
- * - Test the firmware for correct packet routing after packet patching
- */
-
-static char *tfName = "paTestPatchRoute";
-
-/* General purpose queue usage */
-#define Q_CMD_RECYCLE 0 /* Command descriptors/buffers recycled here after sent to PA */
-#define Q_RESULT 1 /* Where patched/routed packets are sent */
-#define Q_CMD_REPLY 2 /* Used for stats reply */
-
-#define N_TEST_PKTS (sizeof (test6PktInfo) / sizeof (test6PktInfo_t))
-
-static paSysStats_t paTestPatchExpectedStats;
-
-
-#ifdef __LINUX_USER_SPACE
-void* paTestPatchRoute (void *args)
-{
- tFramework_t *tf = ((paTestArgs_t *)args)->tf;
- paTest_t *pat = ((paTestArgs_t *)args)->pat;
-#else
-void paTestPatchRoute (UArg a0, UArg a1)
-{
- tFramework_t *tf = (tFramework_t *)a0;
- paTest_t *pat = (paTest_t *)a1;
-#endif
- uint8_t *p8;
-
- int32_t i, j, k;
- int32_t nq;
- uint32_t fifoData[N_TEST_PKTS+1];
- pauFifo_t fifo = { 0, 0, N_TEST_PKTS+1, NULL };
- paReturn_t paret;
- paPatchInfo_t patch;
- uint16_t size;
- int32_t offset;
- int32_t packetRetCount = 0;
- uint32_t plen;
- uint8_t v;
- uint32_t pnum;
-
- paTestStatus_t testStatus = PA_TEST_PASSED;
-
- Cppi_HostDesc *hd;
- Qmss_Queue q;
-
- pasahoComBlindPatch_t *pcom;
- pasahoNextRoute_t *proute;
-
-
- volatile int32_t mdebugWait = 1;
-
- /* Where to send the packets after the modify if complete */
- paRouteInfo_t route = { pa_DEST_HOST, /* Route - host */
- 0, /* flow Id */
- 0, /* Queue */
- -1, /* Multi route disabled */
- 0, /* SWInfo 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}; /* No commands */
-
-#ifdef __LINUX_USER_SPACE
- for (i = 0; (i < (sizeof(test6PktInfo) / sizeof(test6PktInfo_t))); i++) {
- int pktSz;
- uint8_t *pkt;
-
- switch (i) {
- case 0:
- pktSz = sizeof(pkt0);
- pkt = pkt0;
- break;
-
- case 1:
- pktSz = sizeof(pkt1);
- pkt = pkt1;
- break;
-
- case 2:
- pktSz = sizeof(pkt2);
- pkt = pkt2;
- break;
-
- case 3:
- pktSz = sizeof(pkt3);
- pkt = pkt3;
- break;
-
- case 4:
- pktSz = sizeof(pkt4);
- pkt = pkt4;
- break;
-
- case 5:
- pktSz = sizeof(pkt5);
- pkt = pkt5;
- break;
-
- case 6:
- pktSz = sizeof(pkt6);
- pkt = pkt6;
- break;
-
- case 7:
- pktSz = sizeof(pkt7);
- pkt = pkt7;
- break;
- }
-
- /* Allocate memory for the Packet buffers */
- test6PktInfo[i].pkt = (uint8_t *)fw_memAlloc(pktSz, CACHE_LINESZ);
- if(test6PktInfo[i].pkt == NULL) {
- printf ("%s: memAlloc failed for pkt %d\n", tfName, i);
- pat->testStatus = PA_TEST_FAILED;
- return (void *)0;
- }
- memcpy(test6PktInfo[i].pkt, pkt, pktSz);
- }
-#endif
-
- fifo.data = fifoData;
- route.queue = tf->QGen[Q_RESULT];
-
- memset (&paTestPatchExpectedStats, 0, sizeof (paSysStats_t));
-
- /* Recycle the free descriptor to a queue so the code can easily tell the packet has been sent */
- q.qMgr = 0;
- q.qNum = tf->QGen[Q_CMD_RECYCLE];
-
-
- /* Form the commands and send the packets */
- for (i = 0; i < N_TEST_PKTS; i++) {
-
- memset (test6PktInfo[i].cmdBuf, 0, TEST6_CMD_SIZE);
- size = TEST6_CMD_SIZE;
-
- /* If there is only one patch command, use the PA utility function to build the command */
- if ((test6PktInfo[i].patch[1] == NULL) && (test6PktInfo[i].patch[2] == NULL)) {
-
- patch.nPatchBytes = test6PktInfo[i].patch[0]->len;
- patch.totalPatchSize = pa_MAX_PATCH_BYTES;
- patch.offset = test6PktInfo[i].patch[0]->offset;
- patch.ctrlBitfield = (test6PktInfo[i].patch[0]->overwrite)?0:pa_PATCH_OP_INSERT;
- patch.patchData = test6PktInfo[i].patch[0]->bytes;
-
- paret = Pa_formatRoutePatch (&route, &patch, test6PktInfo[i].cmdBuf, &size);
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): Pa_formatRoutePatch returned error code %d\n", tfName, __FILE__, __LINE__, paret);
- testStatus = PA_TEST_FAILED;
- continue;
- }
-
- /* Offset marks the end of the command info used */
- offset = size;
-
-
- } else {
-
- /* Manually form the command if there are more then then one patch. In this case
- * put the route information after all patches */
- p8 = test6PktInfo[i].cmdBuf;
- offset = 0;
-
- for (j = 0; j < TEST6_MAX_PATCH; j++) {
- if (test6PktInfo[i].patch[j] == NULL)
- continue;
-
- pcom = (pasahoComBlindPatch_t *)&(p8[offset]);
- PASAHO_SET_CMDID (pcom, PASAHO_PAMOD_PATCH);
- PASAHO_BPATCH_SET_PATCH_NBYTES (pcom, test6PktInfo[i].patch[j]->len);
- PASAHO_BPATCH_SET_PATCH_CMDSIZE (pcom, (sizeof (pcom->word0) + (test6PktInfo[i].patch[j]->len + 3) >> 2));
- PASAHO_BPATCH_SET_OVERWRITE (pcom,(int32_t)test6PktInfo[i].patch[j]->overwrite);
- PASAHO_BPATCH_SET_OFFSET (pcom, test6PktInfo[i].patch[j]->offset);
-
- for (k = 0; k < test6PktInfo[i].patch[j]->len; k++)
- PASAHO_BPATCH_SET_PATCH_BYTE(pcom, k, test6PktInfo[i].patch[j]->bytes[k]);
-
- offset = offset + sizeof (pcom->word0) + ((test6PktInfo[i].patch[j]->len + 3) & ~3);
- }
-
- /* Add in the final route */
- proute = (pasahoNextRoute_t *)&(p8[offset]);
- PASAHO_SET_CMDID(proute, PASAHO_PAMOD_NROUTE);
- PASAHO_SET_N (proute,0);
- PASAHO_SET_DEST (proute, route.dest);
- PASAHO_SET_FLOW (proute, route.flowId);
- PASAHO_SET_QUEUE(proute, route.queue);
- proute->swInfo0 = route.swInfo0;
- proute->swInfo1 = route.swInfo1;
-
- offset = offset + sizeof (pasahoNextRoute_t) - sizeof (uint32_t);
- }
-
- /* Use a free descriptor to send the packet to PA */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QfreeDesc)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a descriptor off the free descriptor Q (%d)\n", tfName, __FILE__, __LINE__, tf->QfreeDesc);
- testStatus = PA_TEST_FAILED;
- break;
- }
-
- /* Setup the return for the descriptor */
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Attach the data and set the length */
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)utilgAddr((uint32_t)test6PktInfo[i].pkt), test6PktInfo[i].pktSize);
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, test6PktInfo[i].pktSize);
-
- /* Attach the command in PS data */
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)test6PktInfo[i].cmdBuf, offset);
-
- //mdebugHaltPdsp (5);
- /* Send the packet to PDSP 5 */
- Qmss_queuePush (tf->QPaTx[5], (Ptr)hd, test6PktInfo[i].pktSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- //while (mdebugWait);
-
-
- /* Keep count if the packet should return. */
- if (test6PktInfo[i].success == TRUE) {
- packetRetCount += 1;
- if (commonFifoPushElement (&fifo, (uint32_t)i) < 0) {
- System_printf ("%s (%s:%d): Test failed - fifo is full\n", tfName, __FILE__, __LINE__);
- testStatus = PA_TEST_FAILED;
- break;
- }
- } else {
- paTestPatchExpectedStats.modify.nCommandFail += 1;
- }
- }
-
- /* Wait for all the packet descriptors to recycle */
- for (i = 0; i < 100; i++) {
-
- if (Qmss_getQueueEntryCount(tf->QGen[Q_CMD_RECYCLE]) == N_TEST_PKTS)
- break;
- else
- utilCycleDelay (500);
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Failed to find all command descriptors in the recycle queue\n", tfName, __FILE__, __LINE__);
- testStatus = PA_TEST_FAILED;
- }
-
- while (Qmss_getQueueEntryCount(tf->QGen[Q_CMD_RECYCLE]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop descriptor\n", tfName, __FILE__, __LINE__);
- testStatus = PA_TEST_FAILED;
- }
- Qmss_queuePushDesc (tf->QfreeDesc, (Ptr) hd);
- }
-
-
- /* Verify the patch as packets arrive */
- for (i = 0; (i < 100) && (packetRetCount > 0); i++) {
-
- if (Qmss_getQueueEntryCount(tf->QGen[Q_RESULT]) == 0) {
- utilCycleDelay (500);
- continue;
- }
-
- while (Qmss_getQueueEntryCount(tf->QGen[Q_RESULT]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_RESULT])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a received packet\n", tfName, __FILE__, __LINE__);
- testStatus = PA_TEST_FAILED;
- continue;
- }
-
- packetRetCount -= 1;
-
- /* The packets should arrive in order */
- Cppi_getData (Cppi_DescType_HOST, (Cppi_Desc *)hd, &p8, &plen);
-
- pnum = commonFifoPopElement (&fifo, &nq);
- if (nq <= 0) {
- System_printf ("%s (%s:%d): Could not pop an element off of the software tracking fifo (n = %d)\n",
- tfName, __FILE__, __LINE__, nq);
- testCommonRecycleLBDesc (tf, hd);
- testStatus = PA_TEST_FAILED;
- continue;
- }
-
- /* Check if the packet contains sequential data */
- for (j = 1, v = p8[0]; j < plen; j++) {
- v = (v + 1) & 0xff;
- if (v != p8[j]) {
- System_printf ("%s (%s:%d): packet %d, byte %d: Expected byte value 0x%08x, found 0x%08x\n",
- tfName, __FILE__, __LINE__, pnum, j, v, p8[j]);
- testStatus = PA_TEST_FAILED;
- testCommonRecycleLBDesc (tf, hd);
- break;
- }
- }
-
- /* Make sure the packet length matches the expected length */
- k = test6PktInfo[pnum].pktSize;
- for (j = 0; j < TEST6_MAX_PATCH; j++) {
- if (test6PktInfo[pnum].patch[j] != NULL) {
- if (test6PktInfo[pnum].patch[j]->overwrite == FALSE)
- k = k + test6PktInfo[pnum].patch[j]->len;
- }
- }
- if (k != plen) {
- System_printf ("%s (%s:%d): expected packet %d to have return length of %d, found %d\n",
- tfName, __FILE__, __LINE__, pnum, k, plen);
- testStatus = PA_TEST_FAILED;
- testCommonRecycleLBDesc (tf, hd);
- }
-
- testCommonRecycleLBDesc (tf, hd);
- }
- }
-
-
- if (packetRetCount > 0) {
- System_printf ("%s (%s:%d): Missing %d packets\n", tfName, __FILE__, __LINE__, packetRetCount);
- testStatus = PA_TEST_FAILED;
- }
-
-#ifndef __LINUX_USER_SPACE
- if (testCommonCheckStats (tf, pat, tfName, &paTestPatchExpectedStats, tf->QLinkedBuf1,
- tf->QGen[Q_CMD_RECYCLE], tf->QGen[Q_CMD_REPLY], TRUE) == PA_TEST_FAILED)
- testStatus = PA_TEST_FAILED;
-#endif
-
- /* Return result */
- pat->testStatus = testStatus;
-
- /* Return */
-#ifdef __LINUX_USER_SPACE
- return (void *)0;
-#else
- Task_exit();
-#endif
-
-}
-
diff --git a/test/PAUnitTest2/tests/test6pkts.h b/test/PAUnitTest2/tests/test6pkts.h
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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.
- *
-*/
-
-
-
-#ifndef TEST6PKTS_H_
-#define TEST6PKTS_H_
-
-#define TEST6_CMD_SIZE 64
-#define TEST6_MAX_PATCH 5
-
-typedef struct test6Patch_s {
- int32_t len;
- int32_t offset;
- Bool overwrite;
- uint8_t bytes[16];
-} test6Patch_t;
-
-
-typedef struct test6PktInfo_s {
- uint8_t *pkt;
- int32_t pktSize;
- uint8_t *cmdBuf;
- test6Patch_t *patch[TEST6_MAX_PATCH]; /* NULL for entries without patch info */
- Bool success; /* True if the patch should succeed */
-} test6PktInfo_t;
-
-/* After patch all packets should be an increasing sequence of bytes */
-
-
-/* Packet 0
- * Patch 4 bytes starting at byte 4
- */
-#pragma DATA_SECTION(pkt0, ".testPkts")
-static uint8_t pkt0[] = {
- 0x00, 0x01, 0x02, 0x03,
- 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x09, 0x0a, 0x0b
-};
-
-#pragma DATA_SECTION(pkt0Patch, ".testPkts")
-static test6Patch_t pkt0Patch = {
- 4,
- 4,
- TRUE,
- { 0x04, 0x05, 0x06, 0x07,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION(pkt0Cmd, ".testPkts")
-static uint8_t pkt0Cmd[TEST6_CMD_SIZE];
-
-
-/* Packet 1
- * patch 1 byte starting at byte 10 */
-#pragma DATA_SECTION(pkt1, ".testPkts")
-static uint8_t pkt1[] = {
- 0x10, 0x11, 0x12, 0x13,
- 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x00, 0x1b,
- 0x1c, 0x1d
-};
-
-#pragma DATA_SECTION(pkt1Patch, ".testPkts")
-static test6Patch_t pkt1Patch = {
- 1,
- 10,
- TRUE,
- { 0x1a, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, }
-};
-
-#pragma DATA_SECTION(pkt1Cmd, ".testPkts")
-static uint8_t pkt1Cmd[TEST6_CMD_SIZE];
-
-/* Packet 2
- * patch 16 bytes starting at byte 5 */
-#pragma DATA_SECTION(pkt2, ".testPkts")
-static uint8_t pkt2[] = {
- 0x20, 0x21, 0x22, 0x23,
- 0x24, 0x35
-};
-
-#pragma DATA_SECTION(pkt2Patch, ".testPkts")
-static test6Patch_t pkt2Patch = {
- 16,
- 5,
- FALSE,
- { 0x25, 0x26, 0x27, 0x28,
- 0x29, 0x2a, 0x2b, 0x2c,
- 0x2d, 0x2e, 0x2f, 0x30,
- 0x31, 0x32, 0x33, 0x34 }
-};
-
-
-#pragma DATA_SECTION(pkt2Cmd, ".testPkts")
-static uint8_t pkt2Cmd[TEST6_CMD_SIZE];
-
-/* Packet 3
- * patch 3 bytes starting at byte 6
- * patch 9 bytes starting at bye 15 */
-#pragma DATA_SECTION(pkt3, ".testPkts")
-static uint8_t pkt3[] = {
- 0x30, 0x31, 0x32, 0x33,
- 0x34, 0x35, 0x00, 0x00,
- 0x00, 0x39, 0x3a, 0x3b,
- 0x3c, 0x3d, 0x3e, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x48, 0x49
-};
-
-#pragma DATA_SECTION(pkt3Patcha, ".testPkts")
-static test6Patch_t pkt3Patcha = {
- 3,
- 6,
- TRUE,
- { 0x36, 0x37, 0x38, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION(pkt3Patchb, ".testPkts")
-static test6Patch_t pkt3Patchb = {
- 9,
- 15,
- TRUE,
- { 0x3f, 0x40, 0x41, 0x42,
- 0x43, 0x44, 0x45, 0x46,
- 0x47, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION(pkt3Cmd, ".testPkts")
-static uint8_t pkt3Cmd[TEST6_CMD_SIZE];
-
-/* Packet 4
- * Three patches */
-#pragma DATA_SECTION(pkt4, ".testPkts")
-static uint8_t pkt4[] = {
- 0x40, 0x41, 0x00, 0x43,
- 0x44, 0x45, 0x00, 0x47,
- 0x48, 0x49, 0x00, 0x4b
-};
-
-#pragma DATA_SECTION(pkt4Patcha, ".testPkts")
-static test6Patch_t pkt4Patcha = {
- 1,
- 2,
- TRUE,
- { 0x42, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION(pkt4Patchb, ".testPkts")
-static test6Patch_t pkt4Patchb = {
- 1,
- 6,
- TRUE,
- { 0x46, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION(pkt4Patchc, ".testPkts")
-static test6Patch_t pkt4Patchc = {
- 1,
- 10,
- TRUE,
- { 0x4a, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION(pkt4Cmd, ".testPkts")
-static uint8_t pkt4Cmd[TEST6_CMD_SIZE];
-
-
-/* Packet 5
- * Four patches mixed insert and overrwrite.
- * The first byte is patched as an insert,
- * and a tail patch is added */
-#pragma DATA_SECTION (pkt5, ".testPkts")
-static uint8_t pkt5[] = {
- 0x51, 0x52, 0x53,
- 0x54, 0x00, 0x56,
- 0x58, 0x59, 0x5a, 0x5b,
- 0x5c, 0x5d };
-
-#pragma DATA_SECTION (pkt5Patcha, ".testPkts")
-static test6Patch_t pkt5Patcha = {
- 1,
- 0,
- FALSE,
- { 0x50, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION (pkt5Patchb, ".testPkts")
-static test6Patch_t pkt5Patchb = {
- 1,
- 4,
- TRUE,
- { 0x55, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION (pkt5Patchc, ".testPkts")
-static test6Patch_t pkt5Patchc = {
- 1,
- 6,
- FALSE,
- { 0x57, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION (pkt5Patchd, ".testPkts")
-static test6Patch_t pkt5Patchd = {
- 2,
- 12,
- FALSE,
- { 0x5e, 0x5f, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-
-#pragma DATA_SECTION(pkt5Cmd, ".testPkts")
-static uint8_t pkt5Cmd[TEST6_CMD_SIZE];
-
-/* Packet 6 should be rejected in the PA because it has too
- * many patch requests */
-#pragma DATA_SECTION (pkt6, ".testPkts")
-static uint8_t pkt6[] = {
- 0x60, 0x61, 0x62, 0x00,
- 0x64, 0x65, 0x66, 0x00,
- 0x68, 0x69, 0x6a, 0x00,
- 0x6c, 0x6d, 0x6e, 0x00,
- 0x70, 0x71, 0x72, 0x00
-};
-
-#pragma DATA_SECTION(pkt6Patcha, ".testPkts")
-static test6Patch_t pkt6Patcha = {
- 1,
- 3,
- TRUE,
- { 0x63, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION(pkt6Patchb, ".testPkts")
-static test6Patch_t pkt6Patchb = {
- 1,
- 7,
- TRUE,
- { 0x67, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION(pkt6Patchc, ".testPkts")
-static test6Patch_t pkt6Patchc = {
- 1,
- 11,
- TRUE,
- { 0x6b, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION(pkt6Patchd, ".testPkts")
-static test6Patch_t pkt6Patchd = {
- 1,
- 15,
- TRUE,
- { 0x6f, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION(pkt6Patche, ".testPkts")
-static test6Patch_t pkt6Patche = {
- 1,
- 19,
- TRUE,
- { 0x73, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION(pkt6Cmd, ".testPkts")
-static uint8_t pkt6Cmd[TEST6_CMD_SIZE];
-
-/* Packet 7 should be rejected because the two patches
- * are out of order */
-#pragma DATA_SECTION(pkt7, ".testPkts")
-static uint8_t pkt7[] = {
- 0x70, 0x00, 0x00, 0x73,
- 0x74, 0x00, 0x00, 0x77
-};
-
-#pragma DATA_SECTION(pkt7Patcha, ".testPkts")
-static test6Patch_t pkt7Patcha = {
- 2,
- 5,
- TRUE,
- { 0x75, 0x76, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION(pkt7Patchb, ".testPkts")
-static test6Patch_t pkt7Patchb = {
- 2,
- 2,
- TRUE,
- { 0x71, 0x72, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00 }
-};
-
-#pragma DATA_SECTION(pkt7Cmd, ".testPkts")
-static uint8_t pkt7Cmd[TEST6_CMD_SIZE];
-
-
-
-#pragma DATA_SECTION(test6PktInfo, ".testPkts")
-static test6PktInfo_t test6PktInfo[] = {
-
- { pkt0,
- sizeof(pkt0),
- pkt0Cmd,
- { &pkt0Patch, NULL, NULL, NULL, NULL },
- TRUE },
-
- { pkt1,
- sizeof(pkt1),
- pkt1Cmd,
- { &pkt1Patch, NULL, NULL, NULL, NULL },
- TRUE },
-
- { pkt2,
- sizeof(pkt2),
- pkt2Cmd,
- { &pkt2Patch, NULL, NULL, NULL, NULL },
- TRUE },
-
- { pkt3,
- sizeof(pkt3),
- pkt3Cmd,
- { &pkt3Patcha, &pkt3Patchb, NULL, NULL, NULL },
- TRUE },
-
- { pkt4,
- sizeof(pkt4),
- pkt4Cmd,
- { &pkt4Patcha, &pkt4Patchb, &pkt4Patchc, NULL, NULL },
- TRUE },
-
- { pkt5,
- sizeof(pkt5),
- pkt5Cmd,
- { &pkt5Patcha, &pkt5Patchb, &pkt5Patchc, &pkt5Patchd, NULL },
- TRUE },
-
- { pkt6,
- sizeof(pkt6),
- pkt6Cmd,
- { &pkt6Patcha, &pkt6Patchb, &pkt6Patchc, &pkt6Patchd, &pkt6Patche },
- FALSE },
-
- { pkt7,
- sizeof(pkt7),
- pkt7Cmd,
- { &pkt7Patcha, &pkt7Patchb, NULL, NULL, NULL },
- FALSE }
-
-};
-
-
-
-
-#endif /*TEST6PKTS_H_*/
diff --git a/test/PAUnitTest2/tests/test7.c b/test/PAUnitTest2/tests/test7.c
+++ /dev/null
@@ -1,485 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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 "../pautest.h"
-
-#ifdef __LINUX_USER_SPACE
-#include "fw_test.h"
-#include "fw_mem_allocator.h"
-#endif
-
-/* Custom LUT1/LUT2 Lookup test
- * This test tests the PA LLD custom configuration functions, as well as the
- * PDSP firmware custom lookup handling.
- * This test also includes a 16-bit CRC test vector verification with varied
- * CRC payload formats.
- * This test invokes the following LLD APIs
- * - Pa_setCustomLUT1
- * - Pa_addCustomLUT1
- * - Pa_setCustomLUT2
- * - Pa_addCustomLUT2
- * - Pa_configCmdSet
- * - Pa_configCrcEngine
- * - Pa_addMac
- * - Pa_addIp
- * - Pa_addPort
- * - Pa_delHandle
- * - Pa_delL4Handle
- * - Pa_forwardResult
- * - Pa_requestStats
- * - Pa_formatStatsReply
- * This test has the following sub-tests
- * - Test the ability to configure multiple custom LUT1 sets
- * - Test the ability to add custom LUT1 entries
- * - Test the ability to configure multiple custom LUT2 sets
- * - Test the ability to add custom LUT2 entries
- * - Test the ability to configure command sets
- * - Test the LLD for the ability to detect configuration error when custom LUT1, LUT2 and command set APIs are invoked
- * - Test the firmware for the ability to route the custom LUT1 traffic in addition to the standard IP traffic
- * - Test the firmware for the ability to route the custom LUT2 traffic in addition to the standard UDP traffic
- * - Test the firmware for the ability to copy the packet data to the PS info section in the packet descriptor after lookup
- * - Test the firmware for the ability to perform CRC verification with various CRC payload formats.
- */
-
-static char *tfName = "paTestCustomLookup";
-static paSysStats_t t7stats;
-
-#define T7_NUM_PACKET_ITERATIONS 2 /* Number of times the packet stream is passed through */
-#define T7_UDP_BYTE_PKT_ID 10 /* The byte that contains the packet ID */
-
-
-/* General purpose queue usage */
-#define Q_MATCH 0 /* Packets from PA which match a lookup criteria */
-#define Q_NFAIL 1 /* Packets from PA which matches a mac lookup, but failed an L3 lookup */
-#define Q_PARSE_ERR 2 /* Packets which resulted in a parse error */
-#define Q_DPKT_RECYCLE 3 /* Data packet recycle queue */
-#define Q_UDP_MATCH 4 /* Where a UDP (not custom L4) is routed */
-
-
-#include "test7pkts.h"
-
-static paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
-/* CRC Configuration of CRC for WCDMA FP */
-static paCrcConfig_t t7CrcCfg = {
- 0, /* ctrlBitfield (left shift and no insert */
- pa_CRC_SIZE_16,
- 0x80050000, /* polynomial */
- 0x0 /* initValue */
- };
-
-/* Global configurations */
-static paCmdSetConfig_t t7CmdSetCfg =
- {
- 64 /* Number of command sets */
- };
-
-static paSysConfig_t t7GlobalCfg =
- {
- NULL, /* pProtoLimit */
- NULL, /* pOutIpReassmConfig */
- NULL, /* pInIpReassmConfig */
- &t7CmdSetCfg,
- NULL, /* pUsrStatsConfig */
- NULL, /* pQueueDivertConfig */
- NULL /* pPktVerify */
- };
-
-Cppi_HostDesc *t7GetRxPkt (tFramework_t *tf)
-{
- Cppi_HostDesc *hd = NULL;
-
- if (Qmss_getQueueEntryCount(tf->QGen[Q_MATCH]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_MATCH])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a received packet\n", tfName, __FILE__, __LINE__);
- return (NULL);
- }
-
- } else if (Qmss_getQueueEntryCount(tf->QGen[Q_UDP_MATCH]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_UDP_MATCH])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a received packet\n", tfName, __FILE__, __LINE__);
- return (NULL);
- }
-
- } else if (Qmss_getQueueEntryCount(tf->QGen[Q_NFAIL]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_NFAIL])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a received packet\n", tfName, __FILE__, __LINE__);
- return (NULL);
- }
- }
-
- return (hd);
-}
-
-
-int32_t t7RxPackets (tFramework_t *tf, int32_t counts[])
-{
- Cppi_HostDesc *hd;
- uint8_t *rxPkt;
- pasahoLongInfo_t *pinfo;
- int32_t *swinfo;
- uint32_t l4Offset;
- uint32_t infoLen;
- uint32_t flags;
- uint32_t eflags;
- int32_t idx;
- int32_t i;
-
- while ((hd = t7GetRxPkt (tf)) != NULL) {
-
- /* Get the parse information, make sure there is an L4 offset */
- if (Cppi_getPSData (Cppi_DescType_HOST, Cppi_PSLoc_PS_IN_DESC, (Cppi_Desc *)hd, (uint8_t **)&pinfo, &infoLen) != CPPI_SOK) {
- System_printf ("%s (%s:%d): Error getting control info from received data packet\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- flags = PASAHO_LINFO_READ_HDR_BITMASK(pinfo);
-
- if ((flags & PASAHO_HDR_BITMASK_UDP) == 0) {
- /* UDP offset is not valid for Custom Lookup */
- l4Offset = PASAHO_LINFO_READ_START_OFFSET(pinfo);
- }
- else
- {
- l4Offset = PASAHO_LINFO_READ_L4_OFFSET(pinfo);
- }
-
- rxPkt = (uint8_t *)hd->buffPtr;
- /* 8 bytes for UDP header */
- idx = rxPkt[8 + l4Offset + T7_UDP_BYTE_PKT_ID];
-
- if ((idx < 0) || (idx >= sizeof(t7PktInfo) / sizeof(pktTestInfo_t))) {
- System_printf ("%s (%s:%d): The packet index byte in the packet had an invalid value (%d)\n",
- tfName, __FILE__, __LINE__, idx);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- /* Verify that the returned info matches what was expectd */
- testCommonComparePktInfo (tfName, t7PktInfo[idx].info, pinfo);
-
- /* Verify that the value in swinfo0 matches the expected value */
- Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **)&swinfo);
- if (t7PktInfo[idx].idx != swinfo[0])
- System_printf ("%s (%s:%d): Packet with index %d returned swinfo0 0x%08x, expected 0x%08x\n",
- tfName, __FILE__, __LINE__, idx, swinfo[0], t7PktInfo[idx].idx);
-
-
- eflags = Cppi_getDescError (Cppi_DescType_HOST, (Cppi_Desc *)hd) & 0xf;
-
-
- if (eflags != 0) {
- System_printf ("%s (%s:%d): Packet with index %d returned with error flags = 0x%02x\n", tfName, __FILE__, __LINE__, idx, eflags);
- }
-
- testCommonRecycleLBDesc (tf, hd);
-
- /* Subtract the packet from the expected packet count */
- if (counts[idx] <= 0)
- System_printf ("%s (%s:%d): Packet index %d had an expected count of 0, but found another packet\n",
- tfName, __FILE__, __LINE__, idx);
- else
- counts[idx] -= 1;
-
- }
-
- /* Return the number of packets still expected */
- for (i = idx = 0; i < sizeof(t7PktInfo) / sizeof(pktTestInfo_t); i++)
- idx += counts[i];
-
- return (idx);
-}
-
-#ifdef __LINUX_USER_SPACE
-void* paTestCustom (void *args)
-{
- tFramework_t *tf = ((paTestArgs_t *)args)->tf;
- paTest_t *pat = ((paTestArgs_t *)args)->pat;
-#else
-void paTestCustom (UArg a0, UArg a1)
-{
- tFramework_t *tf = (tFramework_t *)a0;
- paTest_t *pat = (paTest_t *)a1;
-#endif
- Cppi_HostDesc *hd;
- paCtrlInfo_t ctrlInfo;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
-
-
-
- paTestStatus_t tstat = PA_TEST_PASSED;
-
- int32_t i;
- int32_t counts[sizeof(t7PktInfo) / sizeof(pktTestInfo_t)];
-
- volatile int32_t mdebugWait = 0;
-
-#ifdef __LINUX_USER_SPACE
- for (i = 0; (i < (sizeof(t7PktInfo) / sizeof(pktTestInfo_t))); i++) {
- int pktSz;
- uint8_t *pkt;
-
- switch (i) {
- case 0:
- pktSz = sizeof(pkt0);
- pkt = pkt0;
- break;
-
- case 1:
- pktSz = sizeof(pkt1);
- pkt = pkt1;
- break;
-
- case 2:
- pktSz = sizeof(pkt2);
- pkt = pkt2;
- break;
-
- case 3:
- pktSz = sizeof(pkt3);
- pkt = pkt3;
- break;
-
- case 4:
- pktSz = sizeof(pkt4);
- pkt = pkt4;
- break;
-
- case 5:
- pktSz = sizeof(pkt5);
- pkt = pkt5;
- break;
-
- }
-
- /* Allocate memory for the Packet buffers */
- t7PktInfo[i].pkt = (uint8_t *)fw_memAlloc(pktSz, CACHE_LINESZ);
- if(t7PktInfo[i].pkt == NULL) {
- printf ("%s: memAlloc failed for pkt %d\n", tfName, i);
- pat->testStatus = PA_TEST_FAILED;
- return (void *)0;
- }
- memcpy(t7PktInfo[i].pkt, pkt, pktSz);
- }
-#endif
-
-#ifndef __LINUX_USER_SPACE
- paLogLevel->paCdeTraceLevel = 0;
- paLogLevel->paLut1TraceLevel = 1;
- paLogLevel->paLut2TraceLevel = 0;
-#endif
-
- memset (&t7stats, 0, sizeof(paSysStats_t));
- memset (counts, 0, sizeof(counts));
-
- /* Issue the global configuration command */
- ctrlInfo.code = pa_CONTROL_SYS_CONFIG;
- ctrlInfo.params.sysCfg = t7GlobalCfg;
- cmdReply.replyId = T7_CMD_SWINFO0_GLOBAL_CFG_ID;
- cmdReply.queue = tf->QCommonCmdRep;
- hd = testCommonGlobalConfig (tf, &ctrlInfo, tf->QLinkedBuf3, tf->QLinkedBuf3,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (hd == NULL) {
-
- System_printf ("%s: (%s:%d): testCommonGlobalConfig(): no buffer \n", tfName, __FILE__, __LINE__);
- pat->testStatus = PA_TEST_FAILED;
- Task_exit();
- }
-
- /* Send command */
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- if (testCommonWaitCmdReply (tf, pat, tfName, cmdReply.queue, T7_CMD_SWINFO0_GLOBAL_CFG_ID, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonConfigCrcEngine failed\n", tfName, __FILE__, __LINE__);
- pat->testStatus = PA_TEST_FAILED;
- Task_exit();
- }
-
-
- /*
- * Command set initialization
- */
- t7CmdSet4[0].params.copy = t7CopyHdr;
- t7CmdSet4[1].params.crcOp = t7CrcOP;
- t7CmdSet4[2].params.copy = t7CopyTail;
- t7CmdSetCmd4.params.cmdSet.index = 4;
-
- t7CmdSet11[0].params.crcOp = t7CrcOP_1;
- t7CmdSetCmd11.params.cmdSet.index = 11;
-
- t7CmdSet22[0].params.crcOp = t7CrcOP_2;
- t7CmdSetCmd22.params.cmdSet.index = 22;
-
- t7CmdSet44[0].params.crcOp = t7CrcOP_4;
- t7CmdSetCmd44.params.cmdSet.index = 44;
-
- t7CmdSet55[0].params.crcOp = t7CrcOP_5;
- t7CmdSetCmd55.params.cmdSet.index = 55;
-
- if (testCommonSetupTest (tf, &t7stats, &t7ATestSetup, tfName, __FILE__, __LINE__)) {
- System_printf ("%s (%s:%d): Test setup failed\n", tfName, __FILE__, __LINE__);
- pat->testStatus = PA_TEST_FAILED;
- Task_exit();
- }
-
- /*
- * Configure the CRC engine for Custom CRC checksum
- * The CRC-engine connected to PDSP4 should be configured to perform CRC validation within the command set
- */
- cmdReply.replyId = T7_CMD_SWINFO0_CRC_CFG_ID;
- cmdReply.queue = tf->QCommonCmdRep;
-
- hd = testCommonConfigCrcEngine(tf, 4, &t7CrcCfg, tf->QLinkedBuf3, tf->QLinkedBuf3,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if ((hd == NULL) || (paret != pa_OK))
- {
- System_printf ("%s (%s:%d): testCommonConfigCrcEngine failed with error code = %d\n", tfName, __FILE__, __LINE__, paret);
- pat->testStatus = PA_TEST_FAILED;
- Task_exit();
- }
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- if (testCommonWaitCmdReply (tf, pat, tfName, cmdReply.queue, T7_CMD_SWINFO0_CRC_CFG_ID, __LINE__)) {
- System_printf ("%s (%s:%d): testCommonConfigCrcEngine failed\n", tfName, __FILE__, __LINE__);
- pat->testStatus = PA_TEST_FAILED;
- Task_exit();
- }
-
- /* Check Command Statistics */
-#ifndef __LINUX_USER_SPACE
- if (testCommonCheckStats (tf, pat, tfName, &t7stats, tf->QLinkedBuf1, tf->QLinkedBuf1, tf->QCommonCmdRep, TRUE) != PA_TEST_PASSED) {
- System_printf ("%s (%s:%d): testCommonCheckStats failed\n", tfName, __FILE__, __LINE__);
- tstat = PA_TEST_FAILED;
- }
-#endif
-
- /* Add a packet index byte into the UDP data, recompute the UDP checksum */
- for (i = 0; i < sizeof(t7PktInfo) / sizeof(pktTestInfo_t); i++) {
-
- if (t7PktInfo[i].idx != 0) {
- counts[i] = T7_NUM_PACKET_ITERATIONS;
- /* 8 bytes for UDP header size */
- t7PktInfo[i].pkt[8 + T7_UDP_BYTE_PKT_ID + TF_GET_UDP_OFFSET(t7PktInfo[i].info)] = i;
- }
-
- utilCompUdpChksums (&t7PktInfo[i], TRUE);
- utilCompIpChksums (&t7PktInfo[i], TRUE);
- }
-
- /*
- * Write back the entire cache to make sure that the test packets are updated.
- * Note: It may be more efficient to call CACHE_wbL1d(blockPtr, byteCnt, wait) only for
- * the portion of packet which is updated.
- *
- */
-#ifndef __LINUX_USER_SPACE
- CACHE_wbAllL1d(CACHE_WAIT);
- //CACHE_wbAllL2(CACHE_WAIT);
-#endif
-
- //mdebugHaltPdsp(4);
-
- /* Send the packets. The max number of packets that can be sent is limited by the number
- * of free buffers since all sends are done at one time with no buffer recycling */
- for (i = 0; i < T7_NUM_PACKET_ITERATIONS; i++)
- testCommonSendPackets (tf, tfName, &t7stats, t7PktInfo, sizeof(t7PktInfo) / sizeof(pktTestInfo_t), 0);
-
- //mdebugWait = 1;
-
- //while (mdebugWait);
- /* utilCycleDelay (5000); */
-
- /* Verify packets as they are received */
- for (i = 0; i < 100; i++) {
- if (t7RxPackets (tf, counts) == 0)
- break;
- else
- utilCycleDelay (1000);
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%n): Not all expected received packets found\n", tfName, __FILE__, __LINE__);
- tstat = PA_TEST_FAILED;
- }
-
-#ifndef __LINUX_USER_SPACE
- if (testCommonCheckStats (tf, pat, tfName, &t7stats, tf->QLinkedBuf1, tf->QLinkedBuf1, tf->QCommonCmdRep, TRUE) != PA_TEST_PASSED) {
- System_printf ("%s (%s:%d): testCommonCheckStats failed\n", tfName, __FILE__, __LINE__);
- tstat = PA_TEST_FAILED;
- }
-#endif
-
-
- if (testCommonTeardownTest (tf, &t7stats, &t7ATestSetup, tfName, __FILE__, __LINE__)) {
- System_printf ("%s (%s:%d): Test teardown failed\n", tfName, __FILE__, __LINE__);
- pat->testStatus = PA_TEST_FAILED;
- Task_exit();
- }
-
-#ifndef __LINUX_USER_SPACE
- if (testCommonCheckStats (tf, pat, tfName, &t7stats, tf->QLinkedBuf1, tf->QLinkedBuf1, tf->QCommonCmdRep, TRUE) != PA_TEST_PASSED) {
- System_printf ("%s (%s:%d): testCommonCheckStats failed\n", tfName, __FILE__, __LINE__);
- tstat = PA_TEST_FAILED;
- }
-#endif
-
-
- pat->testStatus = tstat;
-#ifdef __LINUX_USER_SPACE
- return (void *)0;
-#else
- Task_exit ();
-#endif
-
-
-}
-
-
-
-
diff --git a/test/PAUnitTest2/tests/test7pkts.h b/test/PAUnitTest2/tests/test7pkts.h
+++ /dev/null
@@ -1,1475 +0,0 @@
-/*
- *
- * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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.
- *
-*/
-
-
-
-#ifndef TEST7PKTS_H_
-#define TEST7PKTS_H_
-
-
-
-/* Subtest A - custom level 4 configuration.
- * One mac, two IPs, two UDPs, custom L4 setup with link, 3 custom L4s */
-
-
-
-/* SWINFO 0 identifiers, always in the 16 MSBs */
-#define T7_SWINFO0_MAC_NROUTE_FAIL 0x07010000
-#define T7_SWINFO0_IP_NROUTE_FAIL 0x07020000
-#define T7_SWINFO0_UDP_MATCH 0x07030000
-#define T7_SWINFO0_CUSTOM_C1_MATCH 0x07040000
-#define T7_SWINFO0_CUSTOM_C2_MATCH 0x07050000
-#define T7_SWINFO0_C1_NROUTE_FAIL 0x07060000
-#define T7_CMD_SWINFO0_CRC_CFG_ID 0x07070000
-#define T7_CMD_SWINFO0_GLOBAL_CFG_ID 0x07080000
-
-#pragma DATA_SECTION(t7CmdSetCmd4, ".testPkts")
-static paCmdInfo_t t7CmdSetCmd4 =
- {
- pa_CMD_CMDSET,
- {
-
- {
- 4 /* Command set index */
- }
- }
- };
-
-#pragma DATA_SECTION(t7CmdSetCmd11, ".testPkts")
-static paCmdInfo_t t7CmdSetCmd11 =
- {
- pa_CMD_CMDSET,
- {
-
- {
- 11 /* Command set index */
- }
- }
- };
-
-#pragma DATA_SECTION(t7CmdSetCmd22, ".testPkts")
-static paCmdInfo_t t7CmdSetCmd22 =
- {
- pa_CMD_CMDSET,
- {
-
- {
- 22 /* Command set index */
- }
- }
- };
-
-#pragma DATA_SECTION(t7CmdSetCmd44, ".testPkts")
-static paCmdInfo_t t7CmdSetCmd44 =
- {
- pa_CMD_CMDSET,
- {
-
- {
- 44 /* Command set index */
- }
- }
- };
-
-
-#pragma DATA_SECTION(t7CmdSetCmd55, ".testPkts")
-static paCmdInfo_t t7CmdSetCmd55 =
- {
- pa_CMD_CMDSET,
- {
-
- {
- 55 /* Command set index */
- }
- }
- };
-
-#pragma DATA_SECTION(t7AMacSetup, ".testPkts")
-static pauTestMacSetup_t t7AMacSetup[] = {
-
- { /* entry 0 */
- { /* paEthInfo */
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Source mac is dont care */
- { 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa }, /* Dest mac */
- 0, /* Vlan */
- 0, /* ethertype */
- 0, /* mpls tag */
- 0 /* input EMAC port */
- },
-
- { /* Match Routing */
- pa_DEST_CONTINUE_PARSE_LUT1,/* Destination */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route index */
- 0, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : pa_CUSTOM_TYPE_NONE */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- { /* Next fail routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_NFAIL, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_MAC_NROUTE_FAIL + 0, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- pa_OK, /* Expected PA return value */
- 0, /* returned PA handle */
- TRUE, /* Wait for the return value */
-
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Status */
- },
-
- { /* entry 1: */
-
- { /* paEthInfo */
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Source mac is dont care */
- { 0x00, 0x01, 0x02, 0x03, 0x04, 0x11 }, /* Dest mac */
- 0, /* Vlan */
- 0x800, /* ethertype */
- 0, /* mpls tag */
- 0 /* input EMAC port */
- },
-
- { /* Match Routing */
- pa_DEST_CONTINUE_PARSE_LUT1,/* Destination */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route index */
- 0, /* software info 0 */
- 0, /* software info 1 */
- pa_CUSTOM_TYPE_LUT1, /* customType */
- 1, /* customIndex */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- { /* Next fail routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_NFAIL, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_MAC_NROUTE_FAIL + 0, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- pa_OK, /* Expected PA return value */
- 0, /* returned PA handle */
- TRUE, /* Wait for the return value */
-
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Status */
- },
-
- { /* entry 2: */
-
- { /* paEthInfo */
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Source mac is dont care */
- { 0x00, 0x01, 0x02, 0x03, 0x04, 0x12 }, /* Dest mac */
- 0, /* Vlan */
- 0x800, /* ethertype */
- 0, /* mpls tag */
- 0 /* input EMAC port */
- },
-
- { /* Match Routing */
- pa_DEST_CONTINUE_PARSE_LUT1,/* Destination */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route index */
- 0, /* software info 0 */
- 0, /* software info 1 */
- pa_CUSTOM_TYPE_LUT1, /* customType */
- 2, /* customIndex */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- { /* Next fail routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_NFAIL, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_MAC_NROUTE_FAIL + 0, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- pa_OK, /* Expected PA return value */
- 0, /* returned PA handle */
- TRUE, /* Wait for the return value */
-
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Status */
- },
-
- { /* entry 3: */
-
- { /* paEthInfo */
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Source mac is dont care */
- { 0x00, 0x01, 0x02, 0x03, 0x04, 0x13 }, /* Dest mac */
- 0, /* Vlan */
- 0x800, /* ethertype */
- 0, /* mpls tag */
- 0 /* input EMAC port */
- },
-
- { /* Match Routing */
- pa_DEST_CONTINUE_PARSE_LUT1,/* Destination */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route index */
- 0, /* software info 0 */
- 0, /* software info 1 */
- pa_CUSTOM_TYPE_LUT1, /* customType */
- 4, /* customIndex */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- { /* Next fail routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_NFAIL, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_MAC_NROUTE_FAIL + 0, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- pa_ERR_CONFIG, /* Expected PA return value */
- 0, /* returned PA handle */
- TRUE, /* Wait for the return value */
-
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Status */
- }
-};
-
-
-
-#pragma DATA_SECTION(t7AIpSetup, ".testPkts")
-static pauTestIpSetup_t t7AIpSetup[] = {
-
- /* Entry 0 */
- {
- /* paIpInfo */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
-
- { /* Match Routing */
- pa_DEST_CONTINUE_PARSE_LUT2,/* Destination */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route index */
- 0, /* software info 0 */
- 0, /* software info 1 */
- pa_CUSTOM_TYPE_LUT2, /* customType */
- 0, /* customIndex */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- { /* Next fail routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_NFAIL, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_IP_NROUTE_FAIL + 0, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- &t7AMacSetup[0], /* Link to MAC address */
- NULL, /* Link to IP address */
- pa_OK, /* expected PA return value */
- 0, /* returned PA handle */
- FALSE, /* Don't wait for the command to complete */
-
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- /* Entry 1 */
- {
- /* paIpInfo */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
-
- { /* Match Routing */
- pa_DEST_CONTINUE_PARSE_LUT2,/* Destination */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route index */
- 0, /* software info 0 */
- 0, /* software info 1 */
- pa_CUSTOM_TYPE_LUT2, /* customType */
- 3, /* customIndex */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- { /* Next fail routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_NFAIL, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_IP_NROUTE_FAIL + 1, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
-
- &t7AMacSetup[0], /* Link to MAC address */
- NULL, /* Link to IP address */
- pa_OK, /* expected PA return value */
- 0, /* returned PA handle */
- TRUE, /* Wait for the command to complete */
-
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- /* Entry 2 - This one is not linked */
- {
- /* paIpInfo */
- { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Source address */
- { 200, 201, 202, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IP Destination address */
- 0, /* SPI */
- 0, /* Flow */
- pa_IPV4, /* IP Type */
- 0, /* GRE Protocol */
- 0, /* Protocol */
- 0, /* TOS */
- 0, /* TOS Care flag */
- 0 /* SCTP port */
- },
-
- { /* Match Routing */
- pa_DEST_CONTINUE_PARSE_LUT2,/* Destination */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route index */
- 0, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : pa_CUSTOM_TYPE_NONE */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- { /* Next fail routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_NFAIL, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_IP_NROUTE_FAIL + 1, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
-
- &t7AMacSetup[0], /* Link to MAC address */
- NULL, /* Link to IP address */
- pa_OK, /* expected PA return value */
- 0, /* returned PA handle */
- TRUE, /* Wait for the command to complete */
-
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- }
-
-};
-
-#pragma DATA_SECTION(t7AL4Setup, ".testPkts")
-static pauTestL4Setup_t t7AL4Setup[] = {
-
- { /* Entry 0 */
- 2144, /* Dest Port = not GTPU port */
-
- { /* Match Routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_UDP_MATCH, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_UDP_MATCH + 0, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- &t7AIpSetup[0], /* IP Link Link */
- pa_OK, /* Expected return value */
- { 0, 0 }, /* returned L4 handle */
- FALSE, /* Dont wait for the command to complete */
-
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- { /* Entry 1 */
- 2144, /* Dest Port = not GTPU port */
-
- { /* Match Routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_UDP_MATCH, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_UDP_MATCH + 1, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- &t7CmdSetCmd11 /* Command set */
- },
-
- &t7AIpSetup[2], /* IP Link Link */
- pa_OK, /* Expected return value */
- { 0, 0 }, /* returned L4 handle */
- TRUE, /* Wait for the command to complete */
-
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- }
-};
-
-
-#pragma DATA_SECTION (t7ACl4Config, ".testPkts")
-static pauTestCl4Config_t t7ACl4Config[] = {
-
- /* Entry 0 should fail because of invalid byte offsets */
- {
- TRUE, /* Link to previous IP */
- 0, /* Custom Index */
- { 1, 2, 4, 3}, /* Byte offsets */
- { 0xff, 0xff, 0xff, 0xff}, /* Byte masks */
- pa_ERR_CONFIG, /* Expected PA return value */
- FALSE, /* Wait for the command to complete */
-
- TF_LINKED_BUF_Q3, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- /* Entry 1 is valid */
- {
- TRUE, /* Link to previous IP */
- 0, /* Custom Index */
- { 10, 12, 14, 15}, /* Byte offsets */
- { 0x0f, 0xf0, 0x3c, 0x00}, /* Byte masks */
- pa_OK, /* Expected PA return value */
- FALSE, /* Wait for the command to complete */
-
- TF_LINKED_BUF_Q3, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- /* Entry 2 is valid */
- {
- TRUE, /* Link to previous IP */
- 3, /* Custom Index */
- { 10, 12, 14, 15}, /* Byte offsets */
- { 0x0f, 0xf0, 0x3c, 0x00}, /* Byte masks */
- pa_OK, /* Expected PA return value */
- FALSE, /* Wait for the command to complete */
-
- TF_LINKED_BUF_Q3, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- /* Entry 3 should fail because of invalid index */
- {
- TRUE, /* Link to previous IP */
- 4, /* Custom Index */
- { 1, 2, 4, 3}, /* Byte offsets */
- { 0xff, 0xff, 0xff, 0xff}, /* Byte masks */
- pa_ERR_CONFIG, /* Expected PA return value */
- FALSE, /* Wait for the command to complete */
-
- TF_LINKED_BUF_Q3, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
-};
-
-#pragma DATA_SECTION(t7CmdSet4, ".testPkts")
-
-static paCmdCopy_t t7CopyHdr =
- {
- 0, /* ctrlBitfield */
- 0, /* source offset */
- 24, /* destOffset */
- 4 /* number of bytes */
- };
-
-static paCmdCrcOp_t t7CrcOP =
- {
- pa_CRC_OP_CRC_VALIDATE | /* ctrlBitfield */
- pa_CRC_OP_PAYLOAD_LENGTH_IN_HEADER |
- pa_CRC_OP_CRC_FRAME_TYPE |
- pa_CRC_OP_CRC_RESULT_FOLLOW_PAYLOAD,
- 20, /* startOffset */
- 0, /* length */
- 8, /* lengthOffset */
- 0x0fff, /* lenMask */
- 22, /* lenAdjust */
- 0, /* crcOffset */
- pa_CRC_OP_FRAME_TYPE_IUB_FP_HS_DSCH_TYPE2 /* frameType */
- };
-
-static paCmdCopy_t t7CopyTail =
- {
- pa_COPY_OP_FROM_END, /* ctrlBitfield */
- 4, /* source offset */
- 28, /* destOffset */
- 4 /* number of bytes */
- };
-
-static paCmdInfo_t t7CmdSet4[] = /* packet 0 */
-{
- /* Command 0: Copy from header (place hold) */
- {
- pa_CMD_COPY_DATA_TO_PSINFO,
- {
- {
- 0, /* ctrlBitfield */
- 0, /* source offset */
- 24, /* destOffset */
- 4 /* number of bytes */
- }
- }
- },
-
- /* Command 1: CRC Operation (place hold) */
- {
- pa_CMD_CRC_OP,
- {
- {
- pa_CRC_OP_CRC_VALIDATE | /* ctrlBitfield */
- pa_CRC_OP_PAYLOAD_LENGTH_IN_HEADER |
- pa_CRC_OP_CRC_FRAME_TYPE |
- pa_CRC_OP_CRC_RESULT_FOLLOW_PAYLOAD,
- 20, /* startOffset */
- 0, /* length */
- 8, /* lengthOffset */
- 0x0fff, /* lenMask */
- 22, /* lenAdjust */
- 0, /* crcOffset */
- pa_CRC_OP_FRAME_TYPE_IUB_FP_HS_DSCH_TYPE2 /* frameType */
- }
- }
- },
-
-
- /* Command 2: Copy from Tail (place hold) */
- {
- pa_CMD_COPY_DATA_TO_PSINFO,
- {
- {
- pa_COPY_OP_FROM_END, /* ctrlBitfield */
- 4, /* source offset */
- 28, /* destOffset */
- 4 /* number of bytes */
- }
- }
- }
-
-};
-
-static paCmdCrcOp_t t7CrcOP_1 = /* packet 1 */
- {
- pa_CRC_OP_CRC_VALIDATE | /* ctrlBitfield */
- pa_CRC_OP_PAYLOAD_LENGTH_IN_HEADER |
- pa_CRC_OP_PAYLOAD_LENGTH_OFFSET_IS_NEGATIVE |
- pa_CRC_OP_CRC_RESULT_FOLLOW_PAYLOAD,
- 14, /* startOffset */
- 0, /* length */
- 4, /* lengthOffset */
- 0x0fff, /* lenMask */
- 25, /* lenAdjust */
- 0, /* crcOffset */
- 0 /* frameType */
- };
-
-static paCmdCrcOp_t t7CrcOP_2 = /* packet 2 */
- {
- pa_CRC_OP_CRC_VALIDATE | /* ctrlBitfield */
- pa_CRC_OP_PAYLOAD_LENGTH_IN_HEADER |
- pa_CRC_OP_CRC_RESULT_FOLLOW_PAYLOAD,
- 22, /* startOffset */
- 0, /* length */
- 4, /* lengthOffset */
- 0x0fff, /* lenMask */
- 24, /* lenAdjust */
- 0, /* crcOffset */
- 0 /* frameType */
- };
-
-static paCmdCrcOp_t t7CrcOP_4 = /* packet 4 */
- {
- pa_CRC_OP_CRC_VALIDATE | /* ctrlBitfield */
- pa_CRC_OP_CRC_RESULT_FOLLOW_PAYLOAD,
- 22, /* startOffset */
- 83, /* length */
- 0, /* lengthOffset */
- 0, /* lenMask */
- 0, /* lenAdjust */
- 0, /* crcOffset */
- 0 /* frameType */
- };
-
-static paCmdCrcOp_t t7CrcOP_5 = /* packet 5 */
- {
- pa_CRC_OP_CRC_VALIDATE, /* ctrlBitfield */
- 22, /* startOffset */
- 83, /* length */
- 0, /* lengthOffset */
- 0, /* lenMask */
- 0, /* lenAdjust */
- 105, /* crcOffset */
- 0 /* frameType */
- };
-
-#pragma DATA_SECTION(t7CmdSet11, ".testPkts")
-
-
-static paCmdInfo_t t7CmdSet11[] = /* packet 1 */
-{
-
- /* Command 0: CRC Operation (place hold) */
- {
- pa_CMD_CRC_OP,
- {
- {
- pa_CRC_OP_CRC_VALIDATE | /* ctrlBitfield */
- pa_CRC_OP_PAYLOAD_LENGTH_IN_HEADER |
- pa_CRC_OP_CRC_FRAME_TYPE |
- pa_CRC_OP_CRC_RESULT_FOLLOW_PAYLOAD,
- 20, /* startOffset */
- 0, /* length */
- 8, /* lengthOffset */
- 0x0fff, /* lenMask */
- 22, /* lenAdjust */
- 0, /* crcOffset */
- pa_CRC_OP_FRAME_TYPE_IUB_FP_HS_DSCH_TYPE2 /* frameType */
- }
- }
- }
-
-};
-
-#pragma DATA_SECTION(t7CmdSet22, ".testPkts")
-
-
-static paCmdInfo_t t7CmdSet22[] = /* packet 2 */
-{
-
- /* Command 0: CRC Operation (place hold) */
- {
- pa_CMD_CRC_OP,
- {
- {
- pa_CRC_OP_CRC_VALIDATE | /* ctrlBitfield */
- pa_CRC_OP_PAYLOAD_LENGTH_IN_HEADER |
- pa_CRC_OP_CRC_FRAME_TYPE |
- pa_CRC_OP_CRC_RESULT_FOLLOW_PAYLOAD,
- 20, /* startOffset */
- 0, /* length */
- 8, /* lengthOffset */
- 0x0fff, /* lenMask */
- 22, /* lenAdjust */
- 0, /* crcOffset */
- pa_CRC_OP_FRAME_TYPE_IUB_FP_HS_DSCH_TYPE2 /* frameType */
- }
- }
- }
-
-};
-
-#pragma DATA_SECTION(t7CmdSet44, ".testPkts")
-
-
-static paCmdInfo_t t7CmdSet44[] = /* packet 4 */
-{
-
- /* Command 0: CRC Operation (place hold) */
- {
- pa_CMD_CRC_OP,
- {
- {
- pa_CRC_OP_CRC_VALIDATE | /* ctrlBitfield */
- pa_CRC_OP_PAYLOAD_LENGTH_IN_HEADER |
- pa_CRC_OP_CRC_FRAME_TYPE |
- pa_CRC_OP_CRC_RESULT_FOLLOW_PAYLOAD,
- 20, /* startOffset */
- 0, /* length */
- 8, /* lengthOffset */
- 0x0fff, /* lenMask */
- 22, /* lenAdjust */
- 0, /* crcOffset */
- pa_CRC_OP_FRAME_TYPE_IUB_FP_HS_DSCH_TYPE2 /* frameType */
- }
- }
- }
-
-};
-
-#pragma DATA_SECTION(t7CmdSet55, ".testPkts")
-
-
-static paCmdInfo_t t7CmdSet55[] = /* packet 5 */
-{
-
- /* Command 0: CRC Operation (place hold) */
- {
- pa_CMD_CRC_OP,
- {
- {
- pa_CRC_OP_CRC_VALIDATE | /* ctrlBitfield */
- pa_CRC_OP_PAYLOAD_LENGTH_IN_HEADER |
- pa_CRC_OP_CRC_FRAME_TYPE |
- pa_CRC_OP_CRC_RESULT_FOLLOW_PAYLOAD,
- 20, /* startOffset */
- 0, /* length */
- 8, /* lengthOffset */
- 0x0fff, /* lenMask */
- 22, /* lenAdjust */
- 0, /* crcOffset */
- pa_CRC_OP_FRAME_TYPE_IUB_FP_HS_DSCH_TYPE2 /* frameType */
- }
- }
- }
-
-};
-
-#pragma DATA_SECTION(t7ACmdSetSetup, ".testPkts")
-
-static pauTestCmdSetSetup_t t7ACmdSetSetup[] = {
- { /* Entry 0 */
- 4, /* Command Set Index */
- 3, /* number of commands (no need for next route command) */
- &t7CmdSet4[0], /* command array */
- pa_OK, /* Expected PA return value */
- FALSE, /* Dont wait for the command to complete */
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- { /* Entry 1 */
- 11, /* Command Set Index */
- 1, /* number of commands (no need for next route command) */
- &t7CmdSet11[0], /* command array */
- pa_OK, /* Expected PA return value */
- FALSE, /* Dont wait for the command to complete */
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- { /* Entry 2 */
- 22, /* Command Set Index */
- 1, /* number of commands (no need for next route command) */
- &t7CmdSet22[0], /* command array */
- pa_OK, /* Expected PA return value */
- FALSE, /* Dont wait for the command to complete */
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- { /* Entry 3 */
- 44, /* Command Set Index */
- 1, /* number of commands (no need for next route command) */
- &t7CmdSet44[0], /* command array */
- pa_OK, /* Expected PA return value */
- FALSE, /* Dont wait for the command to complete */
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- { /* Entry 4 */
- 55, /* Command Set Index */
- 1, /* number of commands (no need for next route command) */
- &t7CmdSet55[0], /* command array */
- pa_OK, /* Expected PA return value */
- FALSE, /* Dont wait for the command to complete */
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- }
-};
-
-
-#pragma DATA_SECTION(t7ACl4Setup, ".testPkts")
-static pauTestCl4Setup_t t7ACl4Setup[] = {
-
- { /* Entry 0 */
- 0, /* Custom Index */
- { 0x0a, 0xa0, 0x38, 0x00 }, /* Table match values */
-
- { /* Match Routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_MATCH, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_CUSTOM_C2_MATCH + 0, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- &t7CmdSetCmd4 /* Command set */
- },
-
- &t7AIpSetup[0], /* Link to IP handle */
- pa_OK, /* Expected PA return value */
- { 0, 0}, /* Returned handle */
- FALSE, /* Dont wait for the command to complete */
-
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- { /* Entry 1 */
- 3, /* Custom Index */
- { 0x0a, 0xa0, 0x38, 0x00 }, /* Table match values */
-
- { /* Match Routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_MATCH, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_CUSTOM_C2_MATCH + 1, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- &t7CmdSetCmd22 /* Command set */
- },
-
- &t7AIpSetup[1], /* Link to IP handle */
- pa_OK, /* Expected PA return value */
- { 0, 0}, /* Returned handle */
- FALSE, /* Dont wait for the command to complete */
-
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- }
- ,
- { /* Entry 2 */
- 3, /* Custom Index */
- { 0x0f, 0xf0, 0x3c, 0x00 }, /* Table match values */
-
- { /* Match Routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_MATCH, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_CUSTOM_C2_MATCH + 2, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- &t7AIpSetup[1], /* Link to IP handle */
- pa_OK, /* Expected PA return value */
- { 0, 0}, /* Returned handle */
- TRUE, /* Dont wait for the command to complete */
-
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- }
-};
-
-#pragma DATA_SECTION (t7ACl3Config, ".testPkts")
-static pauTestCl3Config_t t7ACl3Config[] = {
-
- /* Entry 0 should fail because of invalid byte offsets */
- {
- 4, /* Custom Index */
- 0, /* Byte offset */
- pa_HDR_TYPE_UDP, /* Next header */
- 20, /* Offset to the next header */
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Byte masks */
- 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- pa_ERR_CONFIG, /* Expected PA return value */
- FALSE, /* Wait for the command to complete */
-
- TF_LINKED_BUF_Q3, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- /* Entry 1 valid */
- {
- 1, /* Custom Index */
- 0, /* Byte offset */
- pa_HDR_TYPE_UDP, /* Next header */
- 20, /* Offset to the next header */
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Byte masks */
- 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- pa_OK, /* Expected PA return value */
- FALSE, /* Wait for the command to complete */
-
- TF_LINKED_BUF_Q3, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- /* Entry 2 valid */
- {
- 2, /* Custom Index */
- 0, /* Byte offset */
- pa_HDR_TYPE_UDP, /* Next header */
- 20, /* Offset to the next header */
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Byte masks */
- 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- pa_OK, /* Expected PA return value */
- FALSE, /* Wait for the command to complete */
-
- TF_LINKED_BUF_Q3, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- }
-
-};
-
-
-#pragma DATA_SECTION(t7ACl3Setup, ".testPkts")
-static pauTestCl3Setup_t t7ACl3Setup[] = {
-
- { /* Entry 0 */
- 1, /* Custom Index */
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Byte masks */
- 200, 201, 202, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
-
- { /* Match Routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_MATCH, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_CUSTOM_C1_MATCH + 0, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- &t7CmdSetCmd44 /* Command set */
- },
-
- { /* Next fail routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_NFAIL, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_C1_NROUTE_FAIL + 0, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- &t7AMacSetup[1], /* Link to MAC address */
- NULL, /* Link to IP address */
- pa_OK, /* Expected PA return value */
- 0, /* returned PA handle */
- TRUE, /* Dont wait for the command to complete */
-
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- { /* Entry 1 */
- 2, /* Custom Index */
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Byte masks */
- 200, 201, 202, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
-
- { /* Match Routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_MATCH, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_CUSTOM_C1_MATCH + 1, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- &t7CmdSetCmd55 /* Command set */
- },
-
- { /* Next fail routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_NFAIL, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_C1_NROUTE_FAIL + 0, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
-
- &t7AMacSetup[2], /* Link to MAC address */
- NULL, /* Link to IP address */
- pa_OK, /* Expected PA return value */
- 0, /* returned PA handle */
- TRUE, /* Dont wait for the command to complete */
-
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- },
-
- { /* Entry 2 */
- 1, /* Custom Index */
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Byte masks */
- 200, 201, 202, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
-
- { /* Match Routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_MATCH, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_CUSTOM_C1_MATCH + 2, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- { /* Next fail routing */
- pa_DEST_HOST, /* Destination */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_NFAIL, /* queue */
- -1, /* Multi route index */
- T7_SWINFO0_C1_NROUTE_FAIL + 0, /* software info 0 */
- 0, /* software info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
-
- &t7AMacSetup[1], /* Link to MAC address */
- NULL, /* Link to IP address */
- pa_OK, /* Expected PA return value */
- 0, /* returned PA handle */
- TRUE, /* Dont wait for the command to complete */
- TF_LINKED_BUF_Q2, /* Free buffer queue */
- PAU_TEST_SETUP_STATUS_CMD_NOT_SENT /* Command status */
- }
-
-};
-
-
-#pragma DATA_SECTION(t7ATestSetup, ".testPkts")
-pauTestSetup_t t7ATestSetup =
-{
-
- sizeof(t7AMacSetup) / sizeof(pauTestMacSetup_t),
- t7AMacSetup,
-
- sizeof(t7AIpSetup) / sizeof(pauTestIpSetup_t),
- t7AIpSetup,
-
- sizeof(t7AL4Setup) / sizeof(pauTestL4Setup_t),
- t7AL4Setup,
-
- sizeof(t7ACl3Config) / sizeof(pauTestCl3Config_t),
- t7ACl3Config,
-
- sizeof(t7ACl3Setup) / sizeof(pauTestCl3Setup_t),
- t7ACl3Setup,
-
- sizeof(t7ACl4Config) / sizeof(pauTestCl4Config_t),
- t7ACl4Config,
-
- sizeof(t7ACl4Setup) / sizeof(pauTestCl4Setup_t),
- t7ACl4Setup,
-
- sizeof(t7ACmdSetSetup) / sizeof(pauTestCmdSetSetup_t),
- t7ACmdSetSetup
-
-};
-
-
-/* Packet 0 should match custom entry 0. This packet tests MAC/IP to custom switch/custom L4 */
-#pragma DATA_SECTION (pkt0Info, ".testPkts")
-static pasahoLongInfo_t pkt0Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,34), /* cmd len = 24, start offset = 34 (IP Payload) */
- TF_FORM_PKT_INFO_WORD1(162,0,1,0,0,0), /* end offset = 162, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,0,0,0), /* L3 offset = 14, l4Offset = 0, l5Offset = 0, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_CUSTOM),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4((uint32_t)0x9f6d) /* Pseudo header checksum */
-};
-
-#pragma DATA_SECTION (pkt0, ".testPkts")
-static uint8_t pkt0[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x7e, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9, /* IP dest = 200.201.202.100 */
- 0xca, 0x64, 0xba, 0xbe, 0xfa, 0xce, 0x00, 0x80,
- 0x00, 0x00, 0x00, 0x7c, 0x1a, 0x00, 0xa1, 0x00, /* bytes 10, 12, 14 are used for custom lookup */
- 0xf8, 0x6b, 0x6c, 0x6d, 0x00, 0x6f, 0x70, 0x71, /* UDP payload byte 10 contains the packet index */
- 0x2d, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, /* 20-byte Properitery header = UDP Header + 12 byte */
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, /* Payload = WCDMA FP HS-DSCH type 2 frame with 5 block (payload offset = 19) */
- 0x82, /* Mesage length at beginning of UDP payload (offset = 8) */
- 0xC0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, /* standard test vector: size 83 (0x53) CRC = 0xDA26) */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, /* Message length = 20 + 19 + 83 + 2 = 124 (0x7C) */
- 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, /* UDP Length = 124 + 4 (trail) = 128 (0x80) */
- 0xB0, 0xC0, 0xD0, 0xE0, 0xF1, 0x01, 0x11, 0x21,
- 0x31, 0x41, 0x51, 0x61, 0x71, 0x81, 0x91, 0xA1,
- 0xB1, 0xC1, 0xD1, 0xE1, 0xF2, 0x02, 0x12, 0x22,
- 0x32, 0x42, 0x52, 0x62, 0x72, 0x82, 0x92, 0xA2,
- 0xB2, 0xC2, 0xD2, 0xE2, 0xF3, 0x03, 0x13, 0x23,
- 0x33, 0x43, 0x53, 0x63, 0x73, 0x83, 0x93, 0xA3,
- 0xB3, 0xC3, 0xD3, 0xE3, 0xF4, 0x04, 0x14, 0x24,
- 0x34, 0x44, 0x50, 0xDA, 0x26, 0xde, 0xad, 0xbe,
- 0xef };
-
-/* Packet 1 should not match a custom entry since IP2 does not trigger custom lookup
- * This packet tests MAC/IP/UDP with no switch */
-#pragma DATA_SECTION (pkt1Info, ".testPkts")
-static pasahoLongInfo_t pkt1Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,24,42), /* cmd len = 20, start offset = 42 (Payload) */
- TF_FORM_PKT_INFO_WORD1(142,0,1,0,0,0), /* end offset = 142, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_UDP),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4((uint32_t)0x9f79) /* Pseudo header checksum */
-};
-
-
-/* Mac index 0, IP index 2, UDP dest = 2152, no custom lookup triggered */
-#pragma DATA_SECTION (pkt1, ".testPkts")
-static uint8_t pkt1[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x72, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9, /* IP dest = 200.201.202.102 */
- 0xca, 0x66, 0xaa, 0xbb, 0x08, 0x60, 0x00, 0x6C,
- 0x00, 0x00, 0x32, 0x33, 0xfa, 0x35, 0xaf, 0x37, /* Matches on data bytes 2,4 and 6 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* CRC payload offset = 14 from UDP payload (start offset) */
- /* Message length offset = 4 (negative) */
- 0xC0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, /* standard test vector: size 83 (0x53) CRC = 0xDA26) */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, /* Message(UDP) length = 8 + 14 + 83 + 2 = 107 (0x6B) */
- 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, /* message length adjust = 14 + 8 + 2 = 25 */
- 0xB0, 0xC0, 0xD0, 0xE0, 0xF1, 0x01, 0x11, 0x21,
- 0x31, 0x41, 0x51, 0x61, 0x71, 0x81, 0x91, 0xA1,
- 0xB1, 0xC1, 0xD1, 0xE1, 0xF2, 0x02, 0x12, 0x22,
- 0x32, 0x42, 0x52, 0x62, 0x72, 0x82, 0x92, 0xA2,
- 0xB2, 0xC2, 0xD2, 0xE2, 0xF3, 0x03, 0x13, 0x23,
- 0x33, 0x43, 0x53, 0x63, 0x73, 0x83, 0x93, 0xA3,
- 0xB3, 0xC3, 0xD3, 0xE3, 0xF4, 0x04, 0x14, 0x24,
- 0x34, 0x44, 0x50, 0xDA, 0x26, 0x00};
-
-/* Packet 2 should match custom entry 1. This packet tests MAC/IP to custom switch/custom L4 */
-#pragma DATA_SECTION (pkt2Info, ".testPkts")
-static pasahoLongInfo_t pkt2Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,34), /* cmd len = 20, start offset = 34 (Payload) */
- TF_FORM_PKT_INFO_WORD1(141,0,1,0,0,0), /* end offset = 141, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_CUSTOM),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4((uint32_t)0x9f82) /* Pseudo header checksum */
-};
-
-
-#pragma DATA_SECTION (pkt2, ".testPkts")
-static uint8_t pkt2[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x69, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9, /* IP dest = 200.201.202.101 */
- 0xca, 0x65, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6b,
- 0x00, 0x00, 0x3c, 0x3d, 0xfa, 0x3f, 0xaf, 0x41, /* Custom match info */
- 0xf8, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
-
- 0xC0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, /* standard test vector: size 83 (0x53) CRC = 0xDA26) */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, /* Message(UDP) length = 8 + 14 + 83 + 2 = 107 (0x6B) */
- 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, /* message length adjust = 14 + 8 + 2 = 24 */
- 0xB0, 0xC0, 0xD0, 0xE0, 0xF1, 0x01, 0x11, 0x21, /* CRC payload offset = 22 from UDP header (start offset) */
- 0x31, 0x41, 0x51, 0x61, 0x71, 0x81, 0x91, 0xA1, /* Message length offset = 4 from UDP header (start offset) */
- 0xB1, 0xC1, 0xD1, 0xE1, 0xF2, 0x02, 0x12, 0x22, /* length adjustment = 8 + 14 + 2 = 24 */
- 0x32, 0x42, 0x52, 0x62, 0x72, 0x82, 0x92, 0xA2,
- 0xB2, 0xC2, 0xD2, 0xE2, 0xF3, 0x03, 0x13, 0x23,
- 0x33, 0x43, 0x53, 0x63, 0x73, 0x83, 0x93, 0xA3,
- 0xB3, 0xC3, 0xD3, 0xE3, 0xF4, 0x04, 0x14, 0x24,
- 0x34, 0x44, 0x50, 0xDA, 0x26};
-
-
-/* Packet 3 matches the MAC/IP for custom lookup entry 1, but will fail
- * the custom lookup. This tests the nfail routing for custom lookup */
-#pragma DATA_SECTION (pkt3Info, ".testPkts")
-static pasahoLongInfo_t pkt3Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,34), /* cmd len = 20, start offset = 34 (Payload) */
- TF_FORM_PKT_INFO_WORD1(136,0,1,0,0,0), /* end offset = 136, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 1, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP | PASAHO_HDR_BITMASK_CUSTOM),PASAHO_HDR_UNKNOWN,0,1,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4((uint32_t)0x9f8c) /* Pseudo header checksum */
-};
-
-
-
-#pragma DATA_SECTION(pkt3, ".testPkts")
-static uint8_t pkt3[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0xaa, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x5f, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9,
- 0xca, 0x65, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x66, /* IP dest = 200.201.202.101 */
- 0x00, 0x00, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41,
- 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
- 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
- 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
- 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61,
- 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81,
- 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91,
- 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,};
-
-/* Packet 4 should match custom entry 0. This packet tests MAC to custom switch/custom LUT1 */
-#pragma DATA_SECTION (pkt4Info, ".testPkts")
-static pasahoLongInfo_t pkt4Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,34), /* cmd len = 20, start offset = 34 (Payload) */
- TF_FORM_PKT_INFO_WORD1(141,0,1,0,0,0), /* end offset = 141, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 0, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_CUSTOM),PASAHO_HDR_UNKNOWN,0,0,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4((uint32_t)0x9f6d) /* Pseudo header checksum */
-};
-
-#pragma DATA_SECTION (pkt4, ".testPkts")
-static uint8_t pkt4[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x11, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x7e, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9, /* IP dest = 200.201.202.103 */
- 0xca, 0x67, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6B,
- 0x00, 0x00, 0x64, 0x65, 0x1a, 0x00, 0xa1, 0x00, /* bytes 2, 4, 6 are used for custom lookup */
- 0xf8, 0x6b, 0x6c, 0x6d, 0x04, 0x6f, 0x70, 0x71, /* UDP payload byte 10 contains the packet index */
-
- 0xC0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, /* standard test vector: size 83 (0x53) CRC = 0xDA26) */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, /* Message(UDP) length = 8 + 14 + 83 + 2 = 107 (0x6B) */
- 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0,
- 0xB0, 0xC0, 0xD0, 0xE0, 0xF1, 0x01, 0x11, 0x21, /* CRC payload offset = 22 from UDP header (start offset) */
- 0x31, 0x41, 0x51, 0x61, 0x71, 0x81, 0x91, 0xA1, /* CRC payload size = 83 */
- 0xB1, 0xC1, 0xD1, 0xE1, 0xF2, 0x02, 0x12, 0x22,
- 0x32, 0x42, 0x52, 0x62, 0x72, 0x82, 0x92, 0xA2,
- 0xB2, 0xC2, 0xD2, 0xE2, 0xF3, 0x03, 0x13, 0x23,
- 0x33, 0x43, 0x53, 0x63, 0x73, 0x83, 0x93, 0xA3,
- 0xB3, 0xC3, 0xD3, 0xE3, 0xF4, 0x04, 0x14, 0x24,
- 0x34, 0x44, 0x50, 0xDA, 0x26};
-
-
-/* Packet 5 should match custom entry 1. This packet tests MAC to custom switch/custom LUT1 */
-#pragma DATA_SECTION (pkt5Info, ".testPkts")
-static pasahoLongInfo_t pkt5Info = {
-
- TF_FORM_PKT_INFO_WORD0(0,20,34), /* cmd len = 20, start offset = 34 (Payload) */
- TF_FORM_PKT_INFO_WORD1(141,0,1,0,0,0), /* end offset = 141, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,34,42,0), /* L3 offset = 14, l4Offset = 34, l5Offset = 42, ahEspOffset = 0 */
-
- /* bitmap, next header = Unkown, vlan count = 0, ip count = 0, gre count = 0, frag = 0, ip route options = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_CUSTOM),PASAHO_HDR_UNKNOWN,0,0,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4((uint32_t)0x9f6d) /* Pseudo header checksum */
-};
-
-#pragma DATA_SECTION (pkt5, ".testPkts")
-static uint8_t pkt5[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x12, 0x00, 0xe0,
- 0xa6, 0x66, 0x57, 0x04, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x16, 0x7e, 0x9e, 0xda, 0x6d, 0x0b, 0xc8, 0xc9, /* IP dest = 200.201.202.104 */
- 0xca, 0x68, 0xaa, 0xbb, 0x08, 0x68, 0x00, 0x6b,
- 0x00, 0x00, 0x64, 0x65, 0x1a, 0x00, 0xa1, 0x00, /* bytes 2, 4, 6 are used for custom lookup */
- 0xf8, 0x6b, 0x6c, 0x6d, 0x05, 0x6f, 0x70, 0x71, /* UDP payload byte 10 contains the packet index */
-
- 0xC0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, /* standard test vector: size 83 (0x53) CRC = 0xDA26) */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, /* Message(UDP) length = 8 + 14 + 83 + 2 = 107 (0x6B) */
- 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0,
- 0xB0, 0xC0, 0xD0, 0xE0, 0xF1, 0x01, 0x11, 0x21, /* CRC payload offset = 22 from UDP header (start offset) */
- 0x31, 0x41, 0x51, 0x61, 0x71, 0x81, 0x91, 0xA1, /* CRC payload size = 83 */
- 0xB1, 0xC1, 0xD1, 0xE1, 0xF2, 0x02, 0x12, 0x22, /* CRC offset = 105 from UDP header (start offset) */
- 0x32, 0x42, 0x52, 0x62, 0x72, 0x82, 0x92, 0xA2,
- 0xB2, 0xC2, 0xD2, 0xE2, 0xF3, 0x03, 0x13, 0x23,
- 0x33, 0x43, 0x53, 0x63, 0x73, 0x83, 0x93, 0xA3,
- 0xB3, 0xC3, 0xD3, 0xE3, 0xF4, 0x04, 0x14, 0x24,
- 0x34, 0x44, 0x50, 0xDA, 0x26};
-
-
-#pragma DATA_SECTION (t7PktInfo, ".testPkts")
-static pktTestInfo_t t7PktInfo[] = {
-
-#if 1
- /* Packet 0 */
- {
- (uint8_t *)pkt0,
- (pasahoLongInfo_t *)&pkt0Info,
- sizeof(pkt0),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_CUSTOM) }, /* C2 match */
- T7_SWINFO0_CUSTOM_C2_MATCH + 0 /* Expected swinfo0 to find with the packet */
- },
-
- /* Packet 1 */
- {
- (uint8_t *)pkt1,
- (pasahoLongInfo_t *)&pkt1Info,
- sizeof(pkt1),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_UDP) }, /* UDP match */
- T7_SWINFO0_UDP_MATCH + 1 /* Expected swinfo0 to find with the packet */
- },
-
- /* Packet 2 */
- {
- (uint8_t *)pkt2,
- (pasahoLongInfo_t *)&pkt2Info,
- sizeof(pkt2),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_CUSTOM) }, /* C2 match */
- T7_SWINFO0_CUSTOM_C2_MATCH + 1 /* Expected swinfo0 to find with the packet */
- },
-
-
-
- /* Packet 3 */
- {
- (uint8_t *)pkt3,
- (pasahoLongInfo_t *)&pkt3Info,
- sizeof(pkt3),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4), /* IP match */
- (1 << TF_STATS_BM_C2_NUM_PACKETS) | (1 << TF_STATS_BM_C2_NUM_CUSTOM) }, /* C2 lookup */ /* Fail Match */
- T7_SWINFO0_IP_NROUTE_FAIL + 1 /* Expected swinfo0 to find with the packet */
- },
-
-#endif
-
- /* Packet 4 */
- {
- (uint8_t *)pkt4,
- (pasahoLongInfo_t *)&pkt4Info,
- sizeof(pkt4),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_CUSTOM), /* C1 match */
- 0 }, /* None */
- T7_SWINFO0_CUSTOM_C1_MATCH + 0 /* Expected swinfo0 to find with the packet */
- },
-
- /* Packet 5 */
- {
- (uint8_t *)pkt5,
- (pasahoLongInfo_t *)&pkt5Info,
- sizeof(pkt5),
- { (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH), /* MAC match */
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_CUSTOM), /* C1 Match */
- 0 }, /* None */
- T7_SWINFO0_CUSTOM_C1_MATCH + 1 /* Expected swinfo0 to find with the packet */
- }
-
-};
-
-
-
-
-#endif /*TEST7PKTS_H_*/
diff --git a/test/PAUnitTest2/tests/test8.c b/test/PAUnitTest2/tests/test8.c
+++ /dev/null
@@ -1,1405 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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 "../pautest.h"
-#include "test8pkts.h"
-
-#ifdef __LINUX_USER_SPACE
-#include "fw_test.h"
-#include "fw_mem_allocator.h"
-#endif
-
-/* Broadcast, Multicast and Multi-route test
- * This test tests the LLD exception route and multi-route configuration functions, as well as the
- * PDSP firmware for routing broadcast and multicast packets.
- * This test invokes the following LLD APIs
- * - Pa_configMultiRoute
- * - Pa_configExceptionRoute
- * - Pa_addMac
- * - Pa_delHandle
- * - Pa_forwardResult
- * - Pa_requestStats
- * - Pa_formatStatsReply
- *
- * This test has the following sub-tests
- * - Test the ability to configure multiple multi-route sets
- * - Test the ability to configure exception routes for MAC/IP broadcast and multicast packets
- * - Test the LLD for the ability to detect configuration error related to the multi-route set
- * - Test the firmware for the ability to detect and forward MAC broadcast and multicast packets
- * - Test the firmware for the ability to detect and forward IP broadcast and multicast packets
- * - Test the firmware for the ability to forward packets to multiple destinations as specified
- * - Test the firmware for the ability to deliver the packet descriptor without the packet to the specified destinations
- */
-
- static char *tfName = "paTestMultiRouting";
-
- /* General purpose queue usage */
- #define Q_CMD_RECYCLE 0 /* Command descriptors/buffers recycled here after sent to PA */
- #define Q_CMD_REPLY 1 /* Replies from PA routed here */
- #define Q_MATCH 2 /* Packets from PA which match a lookup criteria */
- #define Q_NFAIL 3 /* Packets from PA which matches a mac lookup, but failed an L3 lookup */
- #define Q_PARSE_ERR 4 /* Packets which resulted in a parse error */
- /* Multi route group 1 */
- #define Q_MULTI_0 5 /* Multi route queue 0 */
- #define Q_MULTI_1 6 /* Multi route queue 1 */
- #define Q_MULTI_2 7 /* Multi route queue 2 */
- #define Q_MULTI_3 8 /* Multi route queue 3 */
- #define Q_MULTI_4 9 /* Multi route queue 4 */
- #define Q_MULTI_5 10 /* Multi route queue 5 */
- #define Q_MULTI_6 11 /* Multi route queue 6 */
- #define Q_MULTI_7 12 /* Multi route queue 7 */
- /* Multi route group 2 */
- #define Q_MULTI_10 13 /* Multi route queue 0 */
- #define Q_MULTI_11 14 /* Multi route queue 1 */
- #define Q_MULTI_12 15 /* Multi route queue 2 */
- #define Q_MULTI_13 16 /* Multi route queue 3 */
- #define Q_MULTI_14 17 /* Multi route queue 4 */
- #define Q_MULTI_15 18 /* Multi route queue 5 */
- #define Q_MULTI_16 19 /* Multi route queue 6 */
- #define Q_MULTI_17 20 /* Multi route queue 7 */
-
-#define Q_MULTI_START Q_MULTI_0
-#define Q_MULTI_END Q_MULTI_17
-
-/* The number of PA handles maintained by this test */
-#define T8_NUM_LOCAL_HANDLES sizeof(t8EthAndSwinfo)/sizeof(t8EthAndRoute_t)
-
-/* The total number of buffers with linked descriptors */
-#define TOTAL_BUFS (TF_LINKED_BUF_Q1_NBUFS + TF_LINKED_BUF_Q2_NBUFS + TF_LINKED_BUF_Q3_NBUFS)
-
- /* Commands to the PA are verified through the value in swinfo0.
- * The 16 ms bits are used as verification, the 16 lbs are for local handle id */
-#define T8_CMD_SWINFO0_ADD_ID 0x11110000 /* Identifies add mac command */
-#define T8_CMD_SWINFO0_DEL_ID 0x22220000 /* Identifies del mac command */
-#define T8_CMD_SWINFO0_STATS_REQ_ID 0x33330000 /* Identifies the req stats command */
-#define T8_CMD_SWINFO0_EROUTE_CFG_ID 0x44440000 /* Identifies Eroute configuration command */
-#define T8_CMD_SWINFO0_MROUTE_CFG_ID 0x55550000 /* Identifies Multi-route configuration command */
-#define T8_CMD_SWINFO0_PKT_ID 0x66660000 /* Identifies the packet as a data packet */
-
-#define T8_MAX_CHAN T8_IP_MULTICAST_PKT_INDEX
-
-#define T8_MAX_CMDS_PER_BURST 8
-
-
-static paSysStats_t paTestExpectedStats; /* Expected stats results */
-
- /* 32 L2 handles are managed. This structure is used to track the handle and
- * the activation state state of the handle */
-enum {
- L2_HANDLE_UNCONFIGURED = 0,
- L2_HANDLE_PENDING_ACK,
- L2_HANDLE_ACTIVE,
- L2_HANDLE_DISABLED
-};
-
- typedef struct t8Handles_s {
-
- paHandleL2L3_t paHandle; /* The handle returned by the PA LLD */
-
- uint32_t state; /* L2_HANDLE_UNCONFIGURED = handle not configured
- * L2_HANDLE_PENDING_ACK = handle configured and sent to pa
- * L2_HANDLE_ACTIVE = handle creation acknowledged by pa */
-
- } t8Handles_t;
-
-
- /* Static test configuration - routing of matching packets to the same queue and
- * distinguished by swinfo0 */
- typedef struct t8EthAndRoute_s {
-
- paEthInfo_t eth;
- paRouteInfo_t match;
- paRouteInfo_t nfail;
- } t8EthAndRoute_t;
-
-
- typedef struct pauMultiRoute_s {
- uint16_t index; /* Multi-route set index */
- uint16_t nRoute; /* number of routes */
- paMultiRouteEntry_t routeEntry[pa_MAX_MULTI_ROUTE_ENTRIES];
-
- } pauMultiRoute_t;
-
-/* use the first 10 packet ID */
-static t8EthAndRoute_t t8EthAndSwinfo[] = {
-
- { { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Entry 0: Route on dest mac only */
- { 0x10, 0x22, 0x33, 0x44, 0x55, 0x66 }, /* PA entry 0 */
- 0, 0, 0, 0},
- { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_MATCH, /* queue */
- -1, /* Multi route */
- T8_CMD_SWINFO0_PKT_ID, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}, /* No commands */
-
- { pa_DEST_DISCARD, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL} /* No commands */
- },
-
- { { { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, /* Entry 1: Route on dest/src mac */
- { 0x10, 0x22, 0x33, 0x44, 0x55, 0x66 }, /* PA entry 1 */
- 0, 0, 0, 0},
- { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_MATCH, /* queue */
- -1, /* Multi route */
- T8_CMD_SWINFO0_PKT_ID+1, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}, /* No commands */
-
- { pa_DEST_DISCARD, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL} /* No commands */
- },
-
-
- { { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Entry 2: Multi-cast dest mac */
- { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }, /* PA entry 2 */
- 0, 0, 0, 0},
- { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- TF_FIRST_GEN_QUEUE + Q_MATCH, /* queue */
- 10, /* Multi route */
- T8_CMD_SWINFO0_PKT_ID + 2, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}, /* No commands */
-
- { pa_DEST_DISCARD, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL} /* No commands */
- },
-
- { { { 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, /* Entry 3: Broadcast with source MAC */
- { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, /* PA entry 3 */
- 0, 0, 0, 0},
- { pa_DEST_CONTINUE_PARSE_LUT1, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}, /* No commands */
-
- { pa_DEST_DISCARD, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL} /* No commands */
- },
-
- { { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Entry 4: Multi-cast dest mac */
- { 0x01, 0x00, 0x1e, 0x14, 0x15, 0x16 }, /* PA entry 4 */
- 0, 0, 0, 0},
- { pa_DEST_CONTINUE_PARSE_LUT1, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}, /* No commands */
-
- { pa_DEST_DISCARD, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL} /* No commands */
- },
-
- { { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Entry 5: Route on dest mac only */
- { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15 }, /* PA entry 5 */
- 0, 0, 0, 0},
- { pa_DEST_CONTINUE_PARSE_LUT1, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}, /* No commands */
-
- { pa_DEST_EMAC, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- pa_EMAC_PORT_0, /* emacCtrl: for EMAC only */
- NULL} /* No commands */
- }
-
-
- };
-
- /* Define multi-route tables */
- static pauMultiRoute_t pauMultiRouteInfo[] = {
- { /* Entry 0 (MAC Broadcast) */
- 0, /* index */
- 8, /* nRoute */
- {
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_0
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_1
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_2
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_3
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_4
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_5
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_6
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_7
- }
- }
- },
-
- { /* Entry 1 (MAC Multicast) */
- 10, /* index */
- 4, /* nRoute */
- {
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_10
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_11
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_12
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_13
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_14
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_15
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_16
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_17
- }
- }
- },
- { /* Entry 2 (IP Broadcast) */
- 20, /* index */
- 6, /* nRoute */
- {
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_0
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_1
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_2
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_3
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_4
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_5
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_6
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_7
- }
- }
- },
-
- { /* Entry 3 (IP Multicast) */
- 31, /* index */
- 3, /* nRoute */
- {
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_10
- },
- {
- 0, /* pa_MULTI_ROUTE_DESCRIPTOR_ONLY,
- * Simulator does not deliver descriptor only packet to queue
- * Re-test after simulator problem is resolved
- */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_11
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_12
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_13
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_14
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_15
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_16
- },
- {
- 0, /* ctrlBitfield */
- 0, /* flow Id */
- TF_FIRST_GEN_QUEUE + Q_MULTI_17
- }
- }
- }
-
- };
-
- uint8_t t8CmdAck[T8_MAX_CMDS_PER_BURST];
-
-
- #define T8_NUM_EXCEPTION_ROUTES 5
- static int t8ErouteTypes[] = {
- pa_EROUTE_L2L3_FAIL,
- pa_EROUTE_MAC_BROADCAST,
- pa_EROUTE_MAC_MULTICAST,
- pa_EROUTE_IP_BROADCAST,
- pa_EROUTE_IP_MULTICAST
- };
-
- static paRouteInfo_t t8Eroutes[] = {
-
- /* LUT1 Failure */
- { pa_DEST_EMAC, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- 0, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- pa_EMAC_CTRL_CRC_DISABLE | pa_EMAC_PORT_1, /* emacCtrl: for EMAC only */
- NULL /* No commands */
- },
-
-
- /* MAC Broadcast */
- { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- 0, /* Multi route */
- T8_MAC_BROADCAST_PKT_INDEX + T8_CMD_SWINFO0_PKT_ID, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- /* MAC Multicast */
- { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- 10, /* Multi route */
- T8_MAC_MULTICAST_PKT_INDEX + T8_CMD_SWINFO0_PKT_ID, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- /* IP Broadcast */
- { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- 20, /* Multi route */
- T8_IP_BROADCAST_PKT_INDEX + T8_CMD_SWINFO0_PKT_ID, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- },
-
- /* IP Multicast */
- { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- 31, /* Multi route */
- T8_IP_MULTICAST_PKT_INDEX + T8_CMD_SWINFO0_PKT_ID, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL /* No commands */
- }
-
- };
-
-
-/* Prototype required due to circular function calling */
-static paTestStatus_t testCheckStats (tFramework_t *tf, paTest_t *pat, Bool clear, t8Handles_t *l2Handles);
-
-
-static Cppi_HostDesc *formDataPacket (tFramework_t *tf, paTest_t *pat, int32_t pktIdx, uint8_t *expectedPktCount)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
-
- /* Pop a descriptor off of the free queue list, format the return queue, and attach the packet */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QfreeDesc)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a descriptor off the free descriptor Q (%d)\n", tfName, __FILE__, __LINE__, tf->QfreeDesc);
- return (NULL);
- }
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = tf->QfreeDesc;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Make sure there is no control info. */
- Cppi_setPSLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, 0);
-
- /* Attach the data and set the length */
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)utilgAddr((uint32_t)(t8PktTestInfo[pktIdx].pkt)), t8PktTestInfo[pktIdx].pktLen);
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, t8PktTestInfo[pktIdx].pktLen);
-
- return (hd);
-}
-
-
-/* Recycle delete commands and command recycles */
-int32_t t8StateDel (tFramework_t *tf, paTest_t *pat, t8Handles_t *l2Handles)
-{
- Cppi_HostDesc *hd;
- paEntryHandle_t reth;
- paReturn_t paret;
- int32_t htype;
- int32_t cmdDest;
- int32_t i;
-
- /* Don't send the command until half of the rx buffers are available. The command replies will always be
- * sourced from QLinkedBuf1 and arrive in Q_CMD_REPLY. Delay the command until there are enough buffers available
- * to send and leave a 50% overhead.*/
- for (i = 0; (i < 100) && (Qmss_getQueueEntryCount (tf->QLinkedBuf1) < (TF_LINKED_BUF_Q1_NBUFS >> 1)); i++) {
- if ((Qmss_getQueueEntryCount (tf->QGen[Q_CMD_REPLY]) + Qmss_getQueueEntryCount(tf->QLinkedBuf1)) >= TF_LINKED_BUF_Q1_NBUFS)
- break;
- }
-
- while (Qmss_getQueueEntryCount (tf->QGen[Q_CMD_REPLY]) > 0) {
-
- /* Recycle the command descriptor/buffer */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_REPLY])) & ~15);
- if ((hd->softwareInfo0 & 0xffff0000u) != T8_CMD_SWINFO0_DEL_ID) {
- System_printf ("%s (%s:%d): Found packet in PA command reply queue without delete ID (found 0x%08x)", tfName, __FILE__, __LINE__, hd->softwareInfo0);
- return (-1);
- }
-
- /* Send the reply back to PA to let the driver know the command has been accepted */
- paret = Pa_forwardResult (tf->passHandle, (void *)hd->buffPtr, &reth, &htype, &cmdDest);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): paForwardResult returned error %d in response to pa_DelHandle reply from PA for handle #%d\n", tfName, __FILE__, __LINE__, hd->softwareInfo0 & 0xffff);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- return (-1);
- }
-
- l2Handles[hd->softwareInfo0 & 0xffff].state = L2_HANDLE_DISABLED;
-
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s: (%s:%d): testCommonRecycleLBDesc failed to return a buffer/descriptor\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- }
-
- utilCycleDelay (100);
-
-
-
- /* The command recycle descriptor/buffer */
- while (Qmss_getQueueEntryCount (tf->QGen[Q_CMD_RECYCLE]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s: (%s:%d): testCommonRecycleLBDesc failed to return a buffer/descriptor\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
- }
-
-
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Timeout waiting for free descriptor/buffer queue to fill to halfway point\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- return (0);
-
-}
-
-
-static void paTestRecoverAndExit (tFramework_t *tf, paTest_t *pat, t8Handles_t *l2Handles, paTestStatus_t status, Bool doStats)
-{
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
- int32_t i, j, m;
- volatile int32_t mdebugWait = 0;
-
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
- cmdReply.queue = (uint16_t) tf->QGen[Q_CMD_REPLY];
-
-
- /* Delete all the handles */
- for (i = 0; i < T8_NUM_LOCAL_HANDLES; i++) {
-
- cmdReply.replyId = T8_CMD_SWINFO0_DEL_ID + i;
- hd = testCommonDelHandle (tf, &l2Handles[i].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2, &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD returned error code %d on handle deletion\n", tfName, __FILE__, __LINE__, paret);
- status = PA_TEST_FAILED;
- break;
- }
-
- if (hd == NULL) {
- System_printf ("%s (%s:%d): No descriptor available for del handle command\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- break;
- }
-
- /* Wait to send the command until half of the rx buffers are available */
- if (t8StateDel (tf, pat, l2Handles)) {
- status = PA_TEST_FAILED;
- break;
- }
-
- /* mdebugHaltPdsp (0); */
- /* Send the command to the PA */
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestExpectedStats.classify1.nPackets += 1;
-
- while (mdebugWait);
- }
-
- /* Give some time for remaining commands to complete */
- for (i = 0; i < 100; i++) {
-
- for (j = m = 0; j < T8_NUM_LOCAL_HANDLES; j++)
- if (l2Handles[j].state != L2_HANDLE_DISABLED)
- m += 1;
-
- if (m) {
- if (t8StateDel (tf, pat, l2Handles)) {
- status = PA_TEST_FAILED;
- break;
- }
- utilCycleDelay (100);
- } else
- break;
-
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Unable to delete all L2 handles. %d remain undeleted\n", tfName, __FILE__, __LINE__, m);
- status = PA_TEST_FAILED;
- }
-
- /* Verify the stats are as expected */
- if (testCheckStats (tf, pat, TRUE, l2Handles) == PA_TEST_FAILED)
- status = PA_TEST_FAILED;
-
- /* Test result */
- pat->testStatus = status;
-
- /* Return */
- Task_exit();
-}
-
-/* Look for command replies from PA */
-void tsetL2CmdRep (tFramework_t *tf, paTest_t *pat, t8Handles_t *localHandles)
-{
- Cppi_HostDesc *hd;
- uint32_t *swInfo0;
- uint32_t swInfoCmd;
- uint32_t lid;
- paReturn_t paret;
- paEntryHandle_t reth;
- int32_t htype;
- int32_t cmdDest;
-
- while (Qmss_getQueueEntryCount ((tf->QGen)[Q_CMD_REPLY]) > 0) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop ((tf->QGen[Q_CMD_REPLY]))) & ~15);
- if (Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **) &swInfo0) == CPPI_EPIB_NOT_PRESENT) {
- System_printf ("%s (%s:%d): Found descriptor in PA command reply queue without EIPB present, failing\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestRecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
- swInfoCmd = (*swInfo0 & 0xffff0000u);
- lid = *swInfo0 & 0xffffu;
-
-
- /* Verify expected value in swinfo0 16 msbs */
- switch (swInfoCmd)
- {
- case T8_CMD_SWINFO0_ADD_ID:
- case T8_CMD_SWINFO0_DEL_ID:
- /* Extract the local instance value */
- if (lid >= T8_NUM_LOCAL_HANDLES) {
- System_printf ("%s (%s:%d): Received PA command reply for out of range local handle %d (max %d)\n", tfName, __FILE__, __LINE__, lid, T8_NUM_LOCAL_HANDLES);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestRecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- /* Send the reply back to PA to let the driver know the command has been accepted */
- paret = Pa_forwardResult (tf->passHandle, (void *)hd->buffPtr, &reth, &htype, &cmdDest);
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): paForwardResult returned error %d in response to paAddMac reply from PA\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestRecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- /* Make sure the handle returned by PA matches the local copy */
- if (localHandles[lid].paHandle != reth.l2l3Handle) {
- System_printf ("%s (%s:%d): paForwardResult returned handle (0x%08x) that did match internal table value (0x%08x)\n", tfName, __FILE__, __LINE__, (uint32_t)(localHandles[lid].paHandle), (uint32_t) reth.l2l3Handle);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestRecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- if (swInfoCmd == T8_CMD_SWINFO0_ADD_ID)
- localHandles[lid].state = L2_HANDLE_ACTIVE;
- else
- localHandles[lid].state = L2_HANDLE_UNCONFIGURED;
-
- break;
-
- case T8_CMD_SWINFO0_EROUTE_CFG_ID:
- case T8_CMD_SWINFO0_MROUTE_CFG_ID:
- /* Extract the local instance value */
- if (lid >= T8_MAX_CMDS_PER_BURST) {
- System_printf ("%s (%s:%d): Received PA command reply for out of range command id %d (max %d)\n", tfName, __FILE__, __LINE__, lid, T8_MAX_CMDS_PER_BURST);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestRecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- /* Send the reply back to PA to let the driver know the command has been accepted */
- paret = Pa_forwardResult (tf->passHandle, (void *)hd->buffPtr, &reth, &htype, &cmdDest);
- if (paret != pa_OK) {
- if (swInfoCmd == T8_CMD_SWINFO0_EROUTE_CFG_ID)
- System_printf ("%s (%s:%d): paForwardResult returned error %d in response to Pa_configExceptionRoute reply from PA\n", tfName, __FILE__, __LINE__);
- else
- System_printf ("%s (%s:%d): paForwardResult returned error %d in response to Pa_configMultiRouter reply from PA\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestRecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- t8CmdAck[lid] = TRUE;
-
- break;
-
-
-
- default:
- System_printf ("%s (%s:%d): Found descriptor in PA command reply queue without command reply swinfo0\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestRecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- break;
-
- }
-
- /* Recycle the descriptor and buffer */
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s: (%s:%d): testCommonRecycleLBDesc failed to return a buffer/descriptor\n", tfName, __FILE__, __LINE__);
- paTestRecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- }
-
- while (Qmss_getQueueEntryCount ((tf->QGen)[Q_CMD_RECYCLE]) > 0) {
-
- /* Recycle the command descriptor/buffer */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop ((tf->QGen[Q_CMD_RECYCLE]))) & ~15);
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s: (%s:%d): testCommonRecycleLBDesc failed to return a buffer/descriptor\n", tfName, __FILE__, __LINE__);
- paTestRecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- }
-
-}
-
-static void paL2HandleError (tFramework_t *tf, paTest_t *pat, t8Handles_t *l2Handles, paReturn_t paret, Cppi_HostDesc *hd)
-{
- /* Check paret before the descriptor. If paret indicates failure the descriptor will be NULL */
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD API call failed with error code = %d\n", tfName, __FILE__, __LINE__, paret);
- paTestRecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* No return */
- }
-
- if (hd == NULL) {
- System_printf ("%s (%s:%d): PA LLD API call failed due to unavailable free linked buffer descriptor\n", tfName, __FILE__, __LINE__);
- paTestRecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* No return */
- }
-}
-
-
-/* Check the stats */
-
-static paTestStatus_t testCheckStats (tFramework_t *tf, paTest_t *pat, Bool clear, t8Handles_t *l2Handles)
-{
- Cppi_HostDesc *hd;
- uint8_t *bp;
- paSysStats_t *paStats;
- uint32_t blen;
- int32_t i;
- paTestStatus_t status;
-
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
- cmdReply.queue = (uint16_t) tf->QGen[Q_CMD_REPLY];
-
-
- /* Check the PA stats to make sure they are set as expected */
- cmdReply.replyId = T8_CMD_SWINFO0_STATS_REQ_ID;
- if (testCommonRequestPaStats (tfName, tf, clear, tf->QLinkedBuf1, tf->QGen[Q_CMD_RECYCLE], &cmdReply)) {
- System_printf ("%s (%s:%d): testCommonRequestPaStats failed\n", tfName, __FILE__, __LINE__);
- paTestRecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, FALSE); /* No Return */
- }
-
- /* Wait for the stats reply */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (1000);
- if (Qmss_getQueueEntryCount (tf->QGen[Q_CMD_REPLY]) > 0)
- break;
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Did not find response from PA to stats request command\n", tfName, __FILE__, __LINE__);
- paTestRecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, FALSE); /* No Return */
- }
-
- /* Recycle the descriptor/buffer returned from the stats request */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find returned descriptor/buffer from stats request\n", tfName, __FILE__, __LINE__);
- paTestRecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, FALSE); /* No Return */
- }
-
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats request\n", tfName, __FILE__, __LINE__);
- paTestRecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, FALSE); /* No Return */
- }
-
- /* Format the stats response and compare to the expected results */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_REPLY])) & ~15);
- Cppi_getData (Cppi_DescType_HOST, (Cppi_Desc *)hd, &bp, &blen);
- paStats = (paSysStats_t *)Pa_formatStatsReply (tf->passHandle, (paCmd_t)bp);
-
- if (testCommonCompareStats (tfName, (paSysStats_t *)&paTestExpectedStats, paStats))
- status = PA_TEST_FAILED;
- else
- status = PA_TEST_PASSED;
-
- /* Recycle the descriptor and associated buffer back to queue from which it came */
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats response\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- }
-
- return (status);
-}
-
-
-static Cppi_HostDesc *t8GetRxPkt (tFramework_t *tf)
-{
- Cppi_HostDesc *hd = NULL;
- int index;
-
- if (Qmss_getQueueEntryCount(tf->QGen[Q_MATCH]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_MATCH])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a received packet\n", tfName, __FILE__, __LINE__);
- return (NULL);
- }
-
- return (hd);
- }
-
- if (Qmss_getQueueEntryCount(tf->QGen[Q_NFAIL]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_NFAIL])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a received packet\n", tfName, __FILE__, __LINE__);
- return (NULL);
- }
-
- return (hd);
- }
-
- for (index = Q_MULTI_START; index <= Q_MULTI_END; index++)
- {
-
- if (Qmss_getQueueEntryCount(tf->QGen[index]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[index])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a received packet from General Queue(%d)\n", tfName, __FILE__, __LINE__, index);
- return (NULL);
- }
-
- return (hd);
- }
-
- }
-
- return (NULL);
-
-}
-
-
-
-/* Search the receive data packet queue for received data packets. Remain in
- * this function until all buffers are restored to their respective queues */
-static int32_t t8ReceiveDataPkts (tFramework_t *tf, paTest_t *pat, uint8_t *actualPktCount, int expCount)
-{
- Cppi_HostDesc *hd;
- uint32_t *swInfo;
- pktTest8Info_t *tinfo;
- pasahoLongInfo_t *pinfo;
- uint32_t infoLen;
- int32_t i, j;
- uint32_t chan;
- int32_t count = 0;
-
- for (i = 0; i < 200; i++) {
-
- utilCycleDelay (500);
- while ((hd = t8GetRxPkt (tf)) != NULL) {
-
- /* Verify swInfo0 for packet match and packet ID number */
- Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **)&swInfo);
-
- if ((*swInfo & 0xffff0000) != T8_CMD_SWINFO0_PKT_ID) {
- System_printf ("%s (%s:%d): Found a packet in the receive packet queue but with incorrect swinfo0 Id: 0x%08x\n",
- tfName, __FILE__, __LINE__, *swInfo);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- chan = *swInfo & 0xffff;
- count++;
- if (chan <= T8_MAX_CHAN)
- actualPktCount[chan] += 1;
-
- /* locate the associated test information based on the channel value */
- for (j = 0, tinfo = NULL; j < sizeof(t8PktTestInfo) / sizeof(pktTest8Info_t); j++) {
- if (t8PktTestInfo[j].idx == chan) {
- tinfo = &t8PktTestInfo[j];
- break;
- }
- }
-
- if (tinfo == NULL) {
- System_printf ("%s (%s:%d): Found a packet in the receive packet queue for channel %d, but found no matching packet info\n",
- tfName, __FILE__, __LINE__, chan);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
-
- /* Verify the parse information is correct */
- if (Cppi_getPSData (Cppi_DescType_HOST, Cppi_PSLoc_PS_IN_DESC, (Cppi_Desc *)hd, (uint8_t **)&pinfo, &infoLen) != CPPI_SOK) {
- System_printf ("%s (%s:%d): Error getting control info from received data packet\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- if (testCommonComparePktInfo (tfName, tinfo->info, pinfo)) {
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- /* Return the descriptor/buffer */
- testCommonRecycleLBDesc (tf, hd);
- }
-
- if(count >= expCount)
- break;
-
- }
-
- if (i == 200) {
- System_printf ("%s (%s:%d): Error - unable to recover all descriptors with associated buffers (%d/%d)\n", tfName, __FILE__, __LINE__, count, expCount);
- System_flush();
- return (-1);
- }
-
- return (0);
-
-}
-
-
-#ifdef __LINUX_USER_SPACE
-void* paTestMultiRouting (void *args)
-{
- tFramework_t *tf = ((paTestArgs_t *)args)->tf;
- paTest_t *pat = ((paTestArgs_t *)args)->pat;
-#else
-void paTestMultiRouting (UArg a0, UArg a1)
-{
- tFramework_t *tf = (tFramework_t *)a0;
- paTest_t *pat = (paTest_t *)a1;
-#endif
- Cppi_HostDesc *hd[8];
- paReturn_t paret;
- t8Handles_t l2Handles[T8_NUM_LOCAL_HANDLES];
- int32_t n, i, j, l;
- int32_t state;
- int32_t count;
- int32_t cmdDest;
- Bool halt;
- uint16_t cmdSize;
- paTestStatus_t testStatus = PA_TEST_PASSED;
- uint8_t expectedPktCount[T8_MAX_CHAN+1];
- uint8_t actualPktCount[T8_MAX_CHAN+1];
-
-
- volatile int32_t mdebugWait = 1;
-
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
-#ifdef __LINUX_USER_SPACE
- for (i = 0; (i < (sizeof(t8PktTestInfo) / sizeof(pktTest8Info_t))); i++) {
- int pktSz;
- uint8_t *pkt;
-
- switch (i) {
- case 0:
- pktSz = sizeof(pkt1);
- pkt = pkt1;
- break;
-
- case 1:
- pktSz = sizeof(pkt2);
- pkt = pkt2;
- break;
-
- case 2:
- pktSz = sizeof(pkt3);
- pkt = pkt3;
- break;
-
- case 3:
- pktSz = sizeof(pkt4);
- pkt = pkt4;
- break;
-
- case 4:
- pktSz = sizeof(pkt5);
- pkt = pkt5;
- break;
-
- case 5:
- pktSz = sizeof(pkt6);
- pkt = pkt6;
- break;
-
- case 6:
- pktSz = sizeof(pkt7);
- pkt = pkt7;
- break;
-
- case 7:
- pktSz = sizeof(pkt8);
- pkt = pkt8;
- break;
- }
-
- /* Allocate memory for the Packet buffers */
- t8PktTestInfo[i].pkt = (uint8_t *)fw_memAlloc(pktSz, CACHE_LINESZ);
- if(t8PktTestInfo[i].pkt == NULL) {
- printf ("%s: memAlloc failed for pkt %d\n", tfName, i);
- pat->testStatus = PA_TEST_FAILED;
- return (void *)0;
- }
- memcpy(t8PktTestInfo[i].pkt, pkt, pktSz);
- }
-#endif
-
-
- /* Runtime initial values */
- cmdReply.queue = (uint16_t) tf->QGen[Q_CMD_REPLY];
-
- /* Zero out the l2Handle array and packet counts */
- memset (l2Handles, 0, sizeof(l2Handles));
- memset (expectedPktCount, 0, sizeof(expectedPktCount));
- memset (actualPktCount, 0, sizeof(actualPktCount));
-
- /* Zero out the expected stats. The stats will be updated as packets are sent into PA */
- memset (&paTestExpectedStats, 0, sizeof(paTestExpectedStats));
-
- /* Add the multiple MAC entries in a burst. Take the memory from linked buffer descriptor area two
- * since the responses will come from area one. */
- n = sizeof(t8EthAndSwinfo)/sizeof(t8EthAndRoute_t);
- for (i = 0; i < n; i++) {
- cmdReply.replyId = T8_CMD_SWINFO0_ADD_ID + i;
- hd[i] = testCommonAddMac (tf, pa_LUT1_INDEX_NOT_SPECIFIED, (paEthInfo_t *)&t8EthAndSwinfo[i].eth, &t8EthAndSwinfo[i].match,
- &t8EthAndSwinfo[i].nfail,
- &l2Handles[i].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
- paL2HandleError (tf, pat, l2Handles, paret, hd[i]); /* Will not return on error */
- }
-
-
- /* Send all the commands at once to test the ability to handle back to back commands */
- for (i = 0; i < n; i++) {
- //if (mdebugWait) mdebugHaltPdsp(0);
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[i], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- //while (mdebugWait);
-
- l2Handles[i].state = L2_HANDLE_PENDING_ACK;
- paTestExpectedStats.classify1.nPackets += 1;
-
- }
-
-
- /* Wait for the PA to generate all the responses */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (1000);
- tsetL2CmdRep (tf, pat, l2Handles);
-
- state = 1;
- for (j = 0; j < n; j++) {
- if (l2Handles[j].state == L2_HANDLE_PENDING_ACK)
- state = 0;
- }
-
- if (state == 1)
- break;
- }
-
- if ((i == 100) && (state == 0)) {
- System_printf ("%s: (%s:%d): Burst of addMac commands did not result in all acks from PA\n", tfName, __FILE__, __LINE__);
- paTestRecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE);
- }
-
- /* Add the multi-route entries in a burst. Take the memory from linked buffer descriptor area two
- * since the responses will come from area one. */
- n = sizeof(pauMultiRouteInfo)/sizeof(pauMultiRoute_t);
- for (i = 0; i < n; i++) {
- cmdReply.replyId = T8_CMD_SWINFO0_MROUTE_CFG_ID + i;
- hd[i] = testCommonConfigMultiRoute (tf, pa_MULTI_ROUTE_MODE_CONFIG, pauMultiRouteInfo[i].index, pauMultiRouteInfo[i].nRoute,
- pauMultiRouteInfo[i].routeEntry, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
- paL2HandleError (tf, pat, l2Handles, paret, hd[i]); /* Will not return on error */
- }
-
-
- /* Send all the commands at once to test the ability to handle back to back commands */
- for (i = 0; i < n; i++) {
- //mdebugWait = 1;
- //if (mdebugWait) mdebugHaltPdsp(4);
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[i], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- //while (mdebugWait);
-
- t8CmdAck[i] = FALSE;
-
- }
-
-
- /* Wait for the PA to generate all the responses */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (1000);
- tsetL2CmdRep (tf, pat, l2Handles);
-
- state = 1;
- for (j = 0; j < n; j++) {
- if (t8CmdAck[i] == FALSE)
- state = 0;
- }
-
- if (state == 1)
- break;
- }
-
- if ((i == 100) && (state == 0)) {
- System_printf ("%s: (%s:%d): Burst of Pa_configMultiRoute commands did not result in all acks from PA\n", tfName, __FILE__, __LINE__);
- paTestRecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE);
- }
-
-
- /* Issue the exception route command */
- cmdReply.replyId = T8_CMD_SWINFO0_EROUTE_CFG_ID;
- hd[0] = testCommonConfigExceptionRoute (tf, T8_NUM_EXCEPTION_ROUTES, t8ErouteTypes, t8Eroutes,
- tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf3,
- &cmdReply, &cmdDest, &cmdSize, &paret);
- paL2HandleError (tf, pat, l2Handles, paret, hd[i]); /* Will not return on error */
-
- /* Send command */
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[i], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- t8CmdAck[0] = FALSE;
-
- /* Wait for the PA to generate all the responses */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (1000);
- tsetL2CmdRep (tf, pat, l2Handles);
- if(t8CmdAck[0])break;
- }
-
- if ((i == 100) && (state == 0)) {
- System_printf ("%s: (%s:%d): Pa_configExceptionRoute commands did not result in all acks from PA\n", tfName, __FILE__, __LINE__);
- paTestRecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE);
- }
-
-
- /* Check and clear the stats */
- testStatus = testCheckStats (tf, pat, TRUE, l2Handles);
- memset (&paTestExpectedStats, 0, sizeof(paTestExpectedStats));
-
- if (testStatus != PA_TEST_PASSED)
- paTestRecoverAndExit (tf, pat, l2Handles, testStatus, TRUE);
-
- /* Run packets through the system. the complete set of packets is run through three times. */
- for (j = 0, halt = FALSE; (j < 1) && (halt == FALSE); j++) {
- count = 0;
- for (i = 0; (i < sizeof(t8PktTestInfo) / sizeof(pktTest8Info_t)) && (halt == FALSE); ) {
-
- hd[i] = formDataPacket (tf, pat, i, expectedPktCount);
-
- if (hd[i] == NULL) {
- halt = TRUE;
- break;
- }
-
- /* Inc the count if the packet is passed back to the host */
- if (t8PktTestInfo[i].idx >= 0)
- {
- expectedPktCount[t8PktTestInfo[i].idx] += t8PktTestInfo[i].multiCount;
- count += t8PktTestInfo[i].multiCount;
- }
- /* Increment any expected stats */
- testCommonIncStats (t8PktTestInfo[i].statsMap, &paTestExpectedStats);
-
- /* Proceed to the next packet */
- i += 1;
-
- }
-
- //mdebugWait = 1;
- //if (mdebugWait) mdebugHaltPdsp(4);
-
- for (l = 0; l < sizeof(t8PktTestInfo) / sizeof(pktTest8Info_t); l++)
- {
- Qmss_queuePush (tf->QPaTx[0], (Ptr)hd[l], hd[l]->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- }
-
- //while (mdebugWait);
-
- if (t8ReceiveDataPkts (tf, pat, actualPktCount, count))
- {
- /* Error Handling */
- System_printf ("%s (%s:%d): t8ReceiveDataPkts timeout\n", tfName,
- __FILE__, __LINE__);
- System_flush();
- break;
- }
- }
-
- /* Verify that the expected and actual received packet counts match */
- for (i = 0; i <= T8_MAX_CHAN; i++) {
- if (expectedPktCount[i] != actualPktCount[i]) {
- System_printf ("%s (%s:%d): Packet count mismatch for entry %d - expected %d, found %d\n", tfName,
- __FILE__, __LINE__, i, expectedPktCount[i], actualPktCount[i]);
- System_flush();
- testStatus = PA_TEST_FAILED;
- }
- }
-
- /* Clean up and return */
- paTestRecoverAndExit (tf, pat, l2Handles, testStatus, TRUE);
-
-#ifdef __LINUX_USER_SPACE
- return (void *)0;
-#endif
-}
-
-
-
-
-
-
-
-
diff --git a/test/PAUnitTest2/tests/test8pkts.h b/test/PAUnitTest2/tests/test8pkts.h
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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.
- *
-*/
-
-
-
-#define T8_MAC_BROADCAST_PKT_INDEX 10
-#define T8_MAC_MULTICAST_PKT_INDEX 11
-#define T8_IP_BROADCAST_PKT_INDEX 12
-#define T8_IP_MULTICAST_PKT_INDEX 13
-
-
-#pragma DATA_SECTION(pkt1, ".testPkts")
-#pragma DATA_ALIGN(pkt1, 8)
-static uint8_t pkt1[] = {
-
- 0x10, 0x22, 0x33, 0x44, 0x55, 0x66, 0xaa, 0xbb,
- 0xcc, 0xdd, 0xee, 0xff, 0x81, 0x00, 0x08, 0x88,
- 0x08, 0x00, 0x45, 0x00, 0x00, 0x5c, 0x00, 0x00,
- 0x00, 0x00, 0x05, 0x11, 0x75, 0x4e, 0x0a, 0x0b,
- 0x0c, 0x0d, 0x14, 0x15, 0x16, 0x17, 0x11, 0x11,
- 0x22, 0x22, 0x00, 0x48, 0x61, 0x89, 0x32, 0x33,
- 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
- 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43,
- 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
- 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53,
- 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b,
- 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63,
- 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
- 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71
-};
-
-static pasahoLongInfo_t pkt1Info = {
- TF_FORM_PKT_INFO_WORD0(0,20,18), /* cmd len = 20, start offset = 18 */
- TF_FORM_PKT_INFO_WORD1(110,0,1,0,0,0), /* end offset = 110, pmatch set */
- TF_FORM_PKT_INFO_WORD2(18,0,0,0), /* L3 offset = 18 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_VLAN),0,1,0,0,0,0,0), /* vlan count = 1 */
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-#pragma DATA_SECTION(pkt2, ".testPkts")
-#pragma DATA_ALIGN(pkt2, 8)
-static uint8_t pkt2[] = {
-
- 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0xaa, 0xbb,
- 0xcc, 0xdd, 0xee, 0xff, 0x81, 0x00, 0x08, 0x00,
- 0x45, 0x00,
- 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x75, 0x4e, 0x0a, 0x0b, 0x0c, 0x0d, 0x14, 0x15,
- 0x16, 0x17, 0x11, 0x11, 0x22, 0x22, 0x00, 0x48,
- 0x61, 0x89, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71
-
-};
-
-static pasahoLongInfo_t pkt2Info = {
- TF_FORM_PKT_INFO_WORD0(0,20,18), /* cmd len = 20, start offset = 18 */
- TF_FORM_PKT_INFO_WORD1(108,0,1,0,1,0), /* end offset = 108, errIdx = 0, pmatch = 1, c2c(custom) = 0, l1PdspId = 1, l1Idx = don't care */
- TF_FORM_PKT_INFO_WORD2(18,0,0,0), /* L3 offset = 18 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_VLAN),
- PASAHO_HDR_IPv4,1,0,0,0,0,0), /* bitmap, nextHdr = ipv4, vlan Count = 1,
- * ipCount = 0, gre count = 0, frag = 0,
- * ip route = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-#pragma DATA_SECTION(pkt3, ".testPkts")
-#pragma DATA_ALIGN(pkt3, 8)
-static uint8_t pkt3[] = {
-
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaa, 0xbb,
- 0xcc, 0xdd, 0xee, 0xff, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x75, 0x4e, 0x0a, 0x0b, 0x0c, 0x0d, 0x14, 0x15,
- 0x16, 0x17, 0x11, 0x11, 0x22, 0x22, 0x00, 0x48,
- 0x61, 0x89, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71
-
-};
-
-static pasahoLongInfo_t pkt3Info = {
- TF_FORM_PKT_INFO_WORD0(0,24,14), /* cmd len = 24, start offset = 14 */
- TF_FORM_PKT_INFO_WORD1(106,0,0,0,0,0), /* end offset = 106, errIdx = 0, pmatch = 0, c2c(custom) = 0, l1PdspId = 0, l1Idx = don't care */
- TF_FORM_PKT_INFO_WORD2(0,0,0,0), /* L3 offset = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC),
- PASAHO_HDR_IPv4,0,0,0,0,0,0), /* bitmap, nextHdr = ipv4, vlan Count = 0,
- * ipCount = 0, gre count = 0, frag = 0,
- * ip route = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-#pragma DATA_SECTION(pkt4, ".testPkts")
-#pragma DATA_ALIGN(pkt4, 8)
-static uint8_t pkt4[] = {
-
- 0x01, 0x00, 0x1e, 0x44, 0x55, 0x66, 0xaa, 0xbb,
- 0xcc, 0xdd, 0xee, 0xff, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x75, 0x4e, 0x0a, 0x0b, 0x0c, 0x0d, 0x14, 0x15,
- 0x16, 0x17, 0x11, 0x11, 0x22, 0x22, 0x00, 0x48,
- 0x61, 0x89, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71
-
-};
-
-static pasahoLongInfo_t pkt4Info = {
- TF_FORM_PKT_INFO_WORD0(0,24,14), /* cmd len = 24, start offset = 14 */
- TF_FORM_PKT_INFO_WORD1(106,0,0,0,0,0), /* end offset = 106, errIdx = 0, pmatch = 0, c2c(custom) = 0, l1PdspId = 0, l1Idx = don't care */
- TF_FORM_PKT_INFO_WORD2(0,0,0,0), /* L3 offset = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC),
- PASAHO_HDR_IPv4,0,0,0,0,0,0), /* bitmap, nextHdr = ipv4, vlan Count = 0,
- * ipCount = 0, gre count = 0, frag = 0,
- * ip route = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-
-#pragma DATA_SECTION(pkt5, ".testPkts")
-#pragma DATA_ALIGN(pkt5, 8)
-static uint8_t pkt5[] = {
-
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x1b,
- 0x1c, 0x1d, 0x1e, 0x1f, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x75, 0x4e, 0x0a, 0x0b, 0x0c, 0x0d, 0xff, 0xff,
- 0xff, 0xff, 0x11, 0x11, 0x22, 0x22, 0x00, 0x48,
- 0x61, 0x89, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71
-
-};
-
-static pasahoLongInfo_t pkt5Info = {
- TF_FORM_PKT_INFO_WORD0(0,24,34), /* cmd len = 24, start offset = 34 */
- TF_FORM_PKT_INFO_WORD1(106,0,1,0,0,59), /* end offset = 106, errIdx = 0, pmatch = 1, c2c(custom) = 0, l1PdspId = 0, l1Idx = don't care */
- TF_FORM_PKT_INFO_WORD2(14,0,0,0), /* L3 offset = 14 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP),
- PASAHO_HDR_UDP,0,1,0,0,0,0), /* bitmap, nextHdr = udp, vlan Count = 0,
- * ipCount = 1, gre count = 0, frag = 0,
- * ip route = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-#pragma DATA_SECTION(pkt6, ".testPkts")
-#pragma DATA_ALIGN(pkt6, 8)
-static uint8_t pkt6[] = {
-
- 0x01, 0x00, 0x1e, 0x14, 0x15, 0x16, 0xaa, 0xbb,
- 0xcc, 0xdd, 0xee, 0xff, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x75, 0x4e, 0x0a, 0x0b, 0x0c, 0x0d, 0xe1, 0x15,
- 0x16, 0x17, 0x11, 0x11, 0x22, 0x22, 0x00, 0x48,
- 0x61, 0x89, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71
-
-};
-
-static pasahoLongInfo_t pkt6Info = {
- TF_FORM_PKT_INFO_WORD0(0,24,34), /* cmd len = 24, start offset = 34 */
- TF_FORM_PKT_INFO_WORD1(106,0,1,0,0,58), /* end offset = 106, errIdx = 0, pmatch = 1, c2c(custom) = 0, l1PdspId = 0, l1Idx = don't care */
- TF_FORM_PKT_INFO_WORD2(14,0,0,0), /* L3 offset = 0 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP),
- PASAHO_HDR_UDP,0,1,0,0,0,0), /* bitmap, nextHdr = UDP, vlan Count = 0,
- * ipCount = 1, gre count = 0, frag = 0,
- * ip route = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-#pragma DATA_SECTION(pkt7, ".testPkts")
-#pragma DATA_ALIGN(pkt7, 8)
-static uint8_t pkt7[] = {
-
- 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0xaa, 0xbb,
- 0xcc, 0xdd, 0xee, 0xff, 0x81, 0x00, 0x08, 0x88,
- 0x08, 0x00, 0x45, 0x00, 0x00, 0x5c, 0x00, 0x00,
- 0x00, 0x00, 0x05, 0x11, 0x75, 0x4e, 0x0a, 0x0b,
- 0x0c, 0x0d, 0x14, 0x15, 0x16, 0x17, 0x11, 0x11,
- 0x22, 0x22, 0x00, 0x48, 0x61, 0x89, 0x32, 0x33,
- 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
- 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43,
- 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
- 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53,
- 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b,
- 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63,
- 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
- 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71
-};
-
-static pasahoLongInfo_t pkt7Info = {
- TF_FORM_PKT_INFO_WORD0(0,24,18), /* cmd len = 24, start offset = 18 */
- TF_FORM_PKT_INFO_WORD1(110,0,0,0,0,0), /* end offset = 110, pmatch clear */
- TF_FORM_PKT_INFO_WORD2(18,0,0,0), /* L3 offset = 18 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_VLAN),0,1,0,0,0,0,0), /* vlan count = 1 */
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-
-#pragma DATA_SECTION(pkt8, ".testPkts")
-#pragma DATA_ALIGN(pkt8, 8)
-static uint8_t pkt8[] = {
-
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0xaa, 0xbb,
- 0xcc, 0xdd, 0xee, 0xff,
- 0x08, 0x00, 0x45, 0x00, 0x00, 0x5c, 0x00, 0x00,
- 0x00, 0x00, 0x05, 0x11, 0x75, 0x4e, 0x0a, 0x0b,
- 0x0c, 0x0d, 0x14, 0x15, 0x16, 0x17, 0x11, 0x11,
- 0x22, 0x22, 0x00, 0x48, 0x61, 0x89, 0x32, 0x33,
- 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
- 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43,
- 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
- 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53,
- 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b,
- 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63,
- 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
- 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71
-};
-
-static pasahoLongInfo_t pkt8Info = {
- TF_FORM_PKT_INFO_WORD0(0,24,34), /* cmd len = 24, start offset = 34 */
- TF_FORM_PKT_INFO_WORD1(110,0,1,0,0,0), /* end offset = 106, pmatch set */
- TF_FORM_PKT_INFO_WORD2(14,0,0,0), /* L3 offset = 14 */
- TF_FORM_PKT_INFO_WORD3((PASAHO_HDR_BITMASK_MAC | PASAHO_HDR_BITMASK_IP),PASAHO_HDR_UDP,0,1,0,0,0,0), /* vlan count = 1 */
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-
-
-typedef struct pktTest8Info_s {
- uint8_t *pkt;
- pasahoLongInfo_t *info;
- int32_t pktLen;
- paStatsBmap_t statsMap[3]; /* Bit map of which stats to increment. Some stats must be incremented 3 times */
- int32_t idx; /* Used to increment the test tracking - tells the test to look for pkt Info */
- int32_t multiCount; /* Number of multiple entries */
-} pktTest8Info_t;
-
-
-pktTest8Info_t t8PktTestInfo[] = {
-
- { (uint8_t *)pkt1, (pasahoLongInfo_t *)&pkt1Info, sizeof(pkt1),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH),
- 0, 0, 1, 1 },
-
- { (uint8_t *)pkt2, (pasahoLongInfo_t *)&pkt2Info, sizeof(pkt2),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH),
- 0, 0, 2, 4 },
- { (uint8_t *)pkt3, (pasahoLongInfo_t *)&pkt3Info, sizeof(pkt3),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_NO_TABLE_MATCH),
- 0, 0, T8_MAC_BROADCAST_PKT_INDEX, 8 },
-
- { (uint8_t *)pkt4, (pasahoLongInfo_t *)&pkt4Info, sizeof(pkt4),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_NO_TABLE_MATCH),
- 0, 0, T8_MAC_MULTICAST_PKT_INDEX, 4 },
-
- { (uint8_t *)pkt5, (pasahoLongInfo_t *)&pkt5Info, sizeof(pkt5),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_NO_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4),
- 0, T8_IP_BROADCAST_PKT_INDEX, 6 },
-
- { (uint8_t *)pkt6, (pasahoLongInfo_t *)&pkt6Info, sizeof(pkt6),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_NO_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4),
- 0, T8_IP_MULTICAST_PKT_INDEX, 3 },
-
- { (uint8_t *)pkt7, (pasahoLongInfo_t *)&pkt7Info, sizeof(pkt7),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_NO_TABLE_MATCH),
- 0, 0, -1, 0 },
-
- { (uint8_t *)pkt8, (pasahoLongInfo_t *)&pkt8Info, sizeof(pkt8),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_NO_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_IPV4),
- 0, -1, 0 },
-
-};
-
-
-
-
-
diff --git a/test/PAUnitTest2/tests/test9.c b/test/PAUnitTest2/tests/test9.c
+++ /dev/null
@@ -1,1298 +0,0 @@
-/*
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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 "../pautest.h"
-#include "test9pkts.h"
-
-#ifdef __LINUX_USER_SPACE
-#include "fw_test.h"
-#include "fw_mem_allocator.h"
-#endif
-
-/* Add/Delete SRIO and PDSP routing test
- * This test tests the LLD Pa_addSrio and Pa_delHandle functions, as well as the
- * PDSP firmware for routing SRIO packets. This test has the following sub-tests
- * - Test the LLD for the ability to determine if a new entry invalidates a previous entry
- * - Test the LLD to enter increasingly strict match requirements (destination Id, source Id, mailbox ...)
- * - Test the LLD when entering more entries then configured for
- * - Test the firmware for the ability to take a burst of Pa_addSrio commands
- * - Test the firmware for the routing of matches and next step fail routes
- * - Test the firmware for the ability to take a burst of data packets
- * - Test the LLD/firmware for the ability to delete entries
- */
-
- static char *tfName = "paTestSrioRouting";
-
- /* General purpose queue usage */
- #define Q_CMD_RECYCLE 0 /* Command descriptors/buffers recycled here after sent to PA */
- #define Q_CMD_REPLY 1 /* Replies from PA routed here */
- #define Q_MATCH 2 /* Packets from PA which match a lookup criteria */
- #define Q_NFAIL 3 /* Packets from PA which matches a mac lookup, but failed an L3 lookup */
- #define Q_PARSE_ERR 4 /* Packets which resulted in a parse error */
- #define Q_MULTI_0 5 /* Multi route queue 0 */
- #define Q_MULTI_1 6 /* Multi route queue 1 */
- #define Q_MULTI_2 7 /* Multi route queue 2 */
- #define Q_MULTI_3 8 /* Multi route queue 3 */
- #define Q_MULTI_4 9 /* Multi route queue 4 */
- #define Q_MULTI_5 10 /* Multi route queue 5 */
- #define Q_MULTI_6 11 /* Multi route queue 6 */
- #define Q_MULTI_7 12 /* Multi route queue 7 */
-
-/* The number of PA handles maintained by this test */
-#ifdef __LINUX_USER_SPACE
-#define T9_NUM_LOCAL_HANDLES 63
-#else
-#define T9_NUM_LOCAL_HANDLES 64
-#endif
-
-/* The total number of buffers with linked descriptors */
-#define TOTAL_BUFS (TF_LINKED_BUF_Q1_NBUFS + TF_LINKED_BUF_Q2_NBUFS + TF_LINKED_BUF_Q3_NBUFS)
-
- /* Commands to the PA are verified through the value in swinfo0.
- * The 16 ms bits are used as verification, the 16 lbs are for local handle id */
-#define T9_CMD_SWINFO0_ADD_ID 0x11110000 /* Identifies add mac command */
-#define T9_CMD_SWINFO0_DEL_ID 0x22220000 /* Identifies del mac command */
-#define T9_CMD_SWINFO0_STATS_REQ_ID 0x33330000 /* Identifies the req stats command */
-#define T9_CMD_SWINFO0_PKT_ID 0x55550000 /* Identifies the packet as a data packet */
-
-/* Cycle delay count for PA reply */
-#define T9_PA_CMD_REPLY_DELAY 10000
-
-static paSysStats_t paTestL2ExpectedStats; /* Expected stats results */
-
- /* 32 L2 handles are managed. This structure is used to track the handle and
- * the activation state state of the handle */
-enum {
- L2_HANDLE_UNCONFIGURED = 0,
- L2_HANDLE_PENDING_ACK,
- L2_HANDLE_ACTIVE,
- L2_HANDLE_DISABLED
-};
-
- typedef struct t9Handles_s {
-
- paHandleL2L3_t paHandle; /* The handle returned by the PA LLD */
-
- uint32_t state; /* L2_HANDLE_UNCONFIGURED = handle not configured
- * L2_HANDLE_PENDING_ACK = handle configured and sent to pa
- * L2_HANDLE_ACTIVE = handle creation acknowledged by pa */
-
- } t9Handles_t;
-
-
- /* Static test configuration - routing of matching packets to the same queue and
- * distinguished by swinfo0 */
- typedef struct t9SrioAndRoute_s {
-
- paSrioInfo_t srio;
- uint32_t swinfo0;
- uint16_t nextHdrOffset;
- uint8_t nextHdr;
-
- } t9SrioAndRoute_t;
-
-static t9SrioAndRoute_t t9SrioAndSwinfo[] = {
-
- {
- /* Entry 0: Route on dest Id only */
- {
- pa_SRIO_INFO_VALID_DEST_ID, /* valid bits */
- 0, /* srcId */
- 0x1234, /* destId */
- pa_SRIO_TRANSPORT_TYPE_1, /* transport type */
- 0, /* completion code */
- 0, /* priority */
- pa_SRIO_TYPE_11, /* message type */
- {
- 0, /* mbox */
- 0 /* letter */
- }
- },
- T9_CMD_SWINFO0_PKT_ID, /* swInfo0 */
- 0, /* next hedaer offset */
- pa_HDR_TYPE_UNKNOWN /* next header type */
- },
-
- {
- /* Entry 1: Route on dest/src Id only */
- {
- pa_SRIO_INFO_VALID_ID, /* valid bits */
- 0x5678, /* srcId */
- 0x1234, /* destId */
- pa_SRIO_TRANSPORT_TYPE_1, /* transport type */
- 0, /* completion code */
- 0, /* priority */
- pa_SRIO_TYPE_11, /* message type */
- {
- 0, /* mbox */
- 0 /* letter */
- }
- },
- T9_CMD_SWINFO0_PKT_ID + 1, /* swInfo0 */
- 0, /* next hedaer offset */
- pa_HDR_TYPE_UNKNOWN /* next header type */
- },
-
- {
- /* Entry 2: Route on dest/src Id and mbox */
- {
- pa_SRIO_INFO_VALID_ID | /* valid bits */
- pa_SRIO_INFO_VALID_TYPE_INFO_MAILBOX,
- 0x5678, /* srcId */
- 0x1234, /* destId */
- pa_SRIO_TRANSPORT_TYPE_1, /* transport type */
- 0, /* completion code */
- 0, /* priority */
- pa_SRIO_TYPE_11, /* message type */
- {
- 2, /* mbox */
- 0 /* letter */
- }
- },
- T9_CMD_SWINFO0_PKT_ID + 2, /* swInfo0 */
- 0, /* next hedaer offset */
- pa_HDR_TYPE_UNKNOWN /* next header type */
- },
-
- {
- /* Entry 3: Route on dest/src Id, mbox and letter */
- {
- pa_SRIO_INFO_VALID_ID | /* valid bits */
- pa_SRIO_INFO_VALID_TYPE_INFO_MAILBOX |
- pa_SRIO_INFO_VALID_TYPE_INFO_LETTER,
- 0x5678, /* srcId */
- 0x1234, /* destId */
- pa_SRIO_TRANSPORT_TYPE_1, /* transport type */
- 0, /* completion code */
- 0, /* priority */
- pa_SRIO_TYPE_11, /* message type */
- {
- 2, /* mbox */
- 1 /* letter */
- }
- },
- T9_CMD_SWINFO0_PKT_ID + 3, /* swInfo0 */
- 0, /* next hedaer offset */
- pa_HDR_TYPE_UNKNOWN /* next header type */
- },
-
- {
- /* Entry 4: Route on dest/src Id, mbox, letter and priority */
- {
- pa_SRIO_INFO_VALID_ID | /* valid bits */
- pa_SRIO_INFO_VALID_TYPE_INFO_MAILBOX |
- pa_SRIO_INFO_VALID_TYPE_INFO_LETTER |
- pa_SRIO_INFO_VALID_PRI,
- 0x5678, /* srcId */
- 0x1234, /* destId */
- pa_SRIO_TRANSPORT_TYPE_1, /* transport type */
- 0, /* completion code */
- 2, /* priority */
- pa_SRIO_TYPE_11, /* message type */
- {
- 2, /* mbox */
- 1 /* letter */
- }
- },
- T9_CMD_SWINFO0_PKT_ID + 4, /* swInfo0 */
- 0, /* next hedaer offset */
- pa_HDR_TYPE_UNKNOWN /* next header type */
- },
-
-
- {
- /* Entry 5: Route on dest Id only */
- {
- pa_SRIO_INFO_VALID_DEST_ID, /* valid bits */
- 0, /* srcId */
- 0x12, /* destId */
- pa_SRIO_TRANSPORT_TYPE_0, /* transport type */
- 0, /* completion code */
- 0, /* priority */
- pa_SRIO_TYPE_9, /* message type */
- {
- 0, /* stream Id */
- 0 /* class of service */
- }
- },
- T9_CMD_SWINFO0_PKT_ID + 5, /* swInfo0 */
- 0, /* next hedaer offset */
- pa_HDR_TYPE_UNKNOWN /* next header type */
- },
-
- {
- /* Entry 6: Route on dest/src Id only */
- {
- pa_SRIO_INFO_VALID_ID, /* valid bits */
- 0x56, /* srcId */
- 0x12, /* destId */
- pa_SRIO_TRANSPORT_TYPE_0, /* transport type */
- 0, /* completion code */
- 0, /* priority */
- pa_SRIO_TYPE_9, /* message type */
- {
- 0, /* stream Id */
- 0 /* class of service */
- }
- },
- T9_CMD_SWINFO0_PKT_ID + 6, /* swInfo0 */
- 0, /* next hedaer offset */
- pa_HDR_TYPE_UNKNOWN /* next header type */
- },
-
- {
- /* Entry 7: Route on dest/src Id and stream Id */
- {
- pa_SRIO_INFO_VALID_ID | /* valid bits */
- pa_SRIO_INFO_VALID_TYPE_INFO_STREAMID,
- 0x56, /* srcId */
- 0x12, /* destId */
- pa_SRIO_TRANSPORT_TYPE_0, /* transport type */
- 0, /* completion code */
- 0, /* priority */
- pa_SRIO_TYPE_9, /* message type */
- {
- 0xbabe, /* stream Id */
- 0 /* class of service */
- }
- },
- T9_CMD_SWINFO0_PKT_ID + 7, /* swInfo0 */
- 0, /* next hedaer offset */
- pa_HDR_TYPE_UNKNOWN /* next header type */
- },
-
- {
- /* Entry 8: Route on dest/src Id, stream Id and class of service */
- {
- pa_SRIO_INFO_VALID_ID | /* valid bits */
- pa_SRIO_INFO_VALID_TYPE_INFO_STREAMID |
- pa_SRIO_INFO_VALID_TYPE_INFO_COS,
- 0x56, /* srcId */
- 0x12, /* destId */
- pa_SRIO_TRANSPORT_TYPE_0, /* transport type */
- 0, /* completion code */
- 0, /* priority */
- pa_SRIO_TYPE_9, /* message type */
- {
- 0xbabe, /* stream Id */
- 2 /* class of service */
- }
- },
- T9_CMD_SWINFO0_PKT_ID + 8, /* swInfo0 */
- 0, /* next hedaer offset */
- pa_HDR_TYPE_UNKNOWN /* next header type */
- },
-
- {
- /* Entry 9: Route on dest/src Id, stream Id, class of service and priority */
- {
- pa_SRIO_INFO_VALID_ID | /* valid bits */
- pa_SRIO_INFO_VALID_TYPE_INFO_STREAMID |
- pa_SRIO_INFO_VALID_TYPE_INFO_COS |
- pa_SRIO_INFO_VALID_PRI,
- 0x56, /* srcId */
- 0x12, /* destId */
- pa_SRIO_TRANSPORT_TYPE_0, /* transport type */
- 0, /* completion code */
- 0, /* priority */
- pa_SRIO_TYPE_9, /* message type */
- {
- 0xbabe, /* stream Id */
- 2 /* class of service */
- }
- },
- T9_CMD_SWINFO0_PKT_ID + 9, /* swInfo0 */
- 0, /* next hedaer offset */
- pa_HDR_TYPE_UNKNOWN /* next header type */
- },
-
- {
- /* Entry 10: Route on letter only */
- {
- pa_SRIO_INFO_VALID_TYPE_INFO_LETTER, /* valid bits */
- 0, /* srcId */
- 0, /* destId */
- pa_SRIO_TRANSPORT_TYPE_1, /* transport type */
- 0, /* completion code */
- 2, /* priority */
- pa_SRIO_TYPE_11, /* message type */
- {
- 0, /* mbox */
- 3 /* letter */
- }
- },
- T9_CMD_SWINFO0_PKT_ID + 10, /* swInfo0 */
- 0, /* next hedaer offset */
- pa_HDR_TYPE_UNKNOWN /* next header type */
- },
-
- };
-
-/*
- * Use both pre-determined and system-allocated LUT1 entry index
- * Note: The pre-determined LUT1 entry index should be consistent with the system-allocated one.
- * It is not recommended to mix those two modes in the application.
- */
-
-const int t9SrioIndex[] = {
- pa_LUT1_INDEX_NOT_SPECIFIED, /* entry 0 */
- 62, /* entry 1 */
- pa_LUT1_INDEX_NOT_SPECIFIED, /* entry 2 */
- 60, /* entry 3 */
- pa_LUT1_INDEX_NOT_SPECIFIED, /* entry 4 */
- pa_LUT1_INDEX_NOT_SPECIFIED, /* entry 5 */
- pa_LUT1_INDEX_NOT_SPECIFIED, /* entry 6 */
- 56, /* entry 7 */
- pa_LUT1_INDEX_NOT_SPECIFIED, /* entry 8 */
- 54, /* entry 9 */
- 40 /* entry 10 */
-};
-
-static t9SrioAndRoute_t t9SrioAndSwinfoFail =
- {
- /* This would steal matches from entry 4 if allowed */
- /* This entry is not passed to PA */
- /* !!! No PA Entry !!!! */
- {
- pa_SRIO_INFO_VALID_SRC_ID | /* valid bits */
- pa_SRIO_INFO_VALID_TYPE_INFO_MAILBOX |
- pa_SRIO_INFO_VALID_TYPE_INFO_LETTER |
- pa_SRIO_INFO_VALID_PRI,
- 0x5678, /* srcId */
- 0x1234, /* destId */
- pa_SRIO_TRANSPORT_TYPE_1, /* transport type */
- 0, /* completion code */
- 2, /* priority */
- pa_SRIO_TYPE_11, /* message type */
- {
- 2, /* mbox */
- 1 /* letter */
- }
- },
- 0xDEADBEEF, /* swInfo0 */
- 0, /* next hedaer offset */
- pa_HDR_TYPE_UNKNOWN /* next header type */
- };
-
-
-/* A single non-const entry is used to test handling entering too many table elements
- * as well as delete and add */
-static t9SrioAndRoute_t t9VarSrioAndRoute =
- {
- /* Entry 0: Route on dest Id only */
- {
- pa_SRIO_INFO_VALID_DEST_ID, /* valid bits */
- 0, /* srcId */
- 0x2000, /* destId */
- pa_SRIO_TRANSPORT_TYPE_1, /* transport type */
- 0, /* completion code */
- 0, /* priority */
- pa_SRIO_TYPE_11, /* message type */
- {
- 0, /* mbox */
- 0 /* letter */
- }
- },
- 0, /* swInfo0 */
- 0, /* next hedaer offset */
- pa_HDR_TYPE_UNKNOWN /* next header type */
- };
-
-
-/* Prototype required due to circular function calling */
-static paTestStatus_t t9CheckStats (tFramework_t *tf, paTest_t *pat, Bool clear, t9Handles_t *l2Handles);
-
-
-static Cppi_HostDesc *formDataPacket (tFramework_t *tf, paTest_t *pat, int32_t pktIdx, uint8_t *expectedPktCount)
-{
- Cppi_HostDesc *hd;
- Qmss_Queue q;
-
- /* Pop a descriptor off of the free queue list, format the return queue, and attach the packet */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QfreeDesc)) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Failed to pop a descriptor off the free descriptor Q (%d)\n", tfName, __FILE__, __LINE__, tf->QfreeDesc);
- return (NULL);
- }
-
- /* Setup the return for the descriptor */
- q.qMgr = 0;
- q.qNum = tf->QfreeDesc;
- Cppi_setReturnQueue (Cppi_DescType_HOST, (Cppi_Desc *)hd, q);
-
- /* Attach the data and set the length */
- Cppi_setPacketType(Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t) t9PktTestInfo[pktIdx].pktType);
- Cppi_setPSData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)t9PktTestInfo[pktIdx].psInfo, 8);
- Cppi_setData (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t *)utilgAddr((uint32_t)(t9PktTestInfo[pktIdx].pkt)), t9PktTestInfo[pktIdx].pktLen);
- Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)hd, t9PktTestInfo[pktIdx].pktLen);
-
- return (hd);
-}
-
-/* Recycle delete commands and command recycles */
-static int32_t t9StateDel (tFramework_t *tf, paTest_t *pat, t9Handles_t *l2Handles)
-{
- Cppi_HostDesc *hd;
- paEntryHandle_t reth;
- paReturn_t paret;
- int32_t htype;
- int32_t cmdDest;
- int32_t i;
-
- /* Don't send the command until half of the rx buffers are available. The command replies will always be
- * sourced from QLinkedBuf1 and arrive in Q_CMD_REPLY. Delay the command until there are enough buffers available
- * to send and leave a 50% overhead.*/
- for (i = 0; (i < 100) && (Qmss_getQueueEntryCount (tf->QLinkedBuf1) < (TF_LINKED_BUF_Q1_NBUFS >> 1)); i++) {
- if ((Qmss_getQueueEntryCount (tf->QGen[Q_CMD_REPLY]) + Qmss_getQueueEntryCount(tf->QLinkedBuf1)) >= TF_LINKED_BUF_Q1_NBUFS)
- break;
- }
-
- while (Qmss_getQueueEntryCount (tf->QGen[Q_CMD_REPLY]) > 0) {
-
- /* Recycle the command descriptor/buffer */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_REPLY])) & ~15);
- if ((hd->softwareInfo0 & 0xffff0000u) != T9_CMD_SWINFO0_DEL_ID) {
- System_printf ("%s (%s:%d): Found packet in PA command reply queue without delete ID (found 0x%08x)", tfName, __FILE__, __LINE__, hd->softwareInfo0);
- return (-1);
- }
-
- /* Send the reply back to PA to let the driver know the command has been accepted */
- paret = Pa_forwardResult (tf->passHandle, (void *)hd->buffPtr, &reth, &htype, &cmdDest);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): paForwardResult returned error %d in response to pa_DelHandle reply from PA for handle #%d\n", tfName, __FILE__, __LINE__, hd->softwareInfo0 & 0xffff);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- return (-1);
- }
-
- l2Handles[hd->softwareInfo0 & 0xffff].state = L2_HANDLE_DISABLED;
-
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s: (%s:%d): testCommonRecycleLBDesc failed to return a buffer/descriptor\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- }
-
- utilCycleDelay (100);
-
- /* The command recycle descriptor/buffer */
- while (Qmss_getQueueEntryCount (tf->QGen[Q_CMD_RECYCLE]) > 0) {
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s: (%s:%d): testCommonRecycleLBDesc failed to return a buffer/descriptor\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Timeout waiting for free descriptor/buffer queue to fill to halfway point\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- return (0);
-
-}
-
-
-static void paTestL2RecoverAndExit (tFramework_t *tf, paTest_t *pat, t9Handles_t *l2Handles, paTestStatus_t status, Bool doStats)
-{
- Cppi_HostDesc *hd;
- paReturn_t paret;
- int32_t cmdDest;
- uint16_t cmdSize;
- int32_t i, j, m;
- volatile int32_t mdebugWait = 0;
-
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
- cmdReply.queue = (uint16_t) tf->QGen[Q_CMD_REPLY];
-
-
- /* Delete all the handles */
- for (i = 0; i < T9_NUM_LOCAL_HANDLES; i++) {
-
- cmdReply.replyId = T9_CMD_SWINFO0_DEL_ID + i;
- hd = testCommonDelHandle (tf, &l2Handles[i].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2, &cmdReply, &cmdDest, &cmdSize, &paret);
-
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): PA LLD returned error code %d on handle deletion\n", tfName, __FILE__, __LINE__, paret);
- status = PA_TEST_FAILED;
- break;
- }
-
- if (hd == NULL) {
- System_printf ("%s (%s:%d): No descriptor available for del handle command\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- break;
- }
-
- /* Wait to send the command until half of the rx buffers are available */
- if (t9StateDel (tf, pat, l2Handles)) {
- status = PA_TEST_FAILED;
- break;
- }
-
- /* mdebugHaltPdsp (0); */
- /* Send the command to the PA */
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd, cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- paTestL2ExpectedStats.classify1.nPackets += 1;
-
- while (mdebugWait);
- }
-
- /* Give some time for remaining commands to complete */
- for (i = 0; i < 100; i++) {
-
- for (j = m = 0; j < T9_NUM_LOCAL_HANDLES; j++)
- if (l2Handles[j].state != L2_HANDLE_DISABLED)
- m += 1;
-
- if (m) {
- if (t9StateDel (tf, pat, l2Handles)) {
- status = PA_TEST_FAILED;
- break;
- }
- utilCycleDelay (100);
- } else
- break;
-
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Unable to delete all L2 handles. %d remain undeleted\n", tfName, __FILE__, __LINE__, m);
- status = PA_TEST_FAILED;
- }
-
- /* Verify the stats are as expected */
-#ifndef __LINUX_USER_SPACE
- if (t9CheckStats (tf, pat, TRUE, l2Handles) == PA_TEST_FAILED)
- status = PA_TEST_FAILED;
-#endif
-
- /* Test result */
- pat->testStatus = status;
-
- /* Return */
- Task_exit();
-}
-
-/* Look for command replies from PA */
-static void t9L2CmdRep (tFramework_t *tf, paTest_t *pat, t9Handles_t *localHandles)
-{
- Cppi_HostDesc *hd;
- uint32_t *swInfo0;
- uint32_t swInfoCmd;
- uint32_t lid;
- paReturn_t paret;
- paEntryHandle_t reth;
- int32_t htype;
- int32_t cmdDest;
-
- while (Qmss_getQueueEntryCount ((tf->QGen)[Q_CMD_REPLY]) > 0) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop ((tf->QGen[Q_CMD_REPLY]))) & ~15);
- if (Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **) &swInfo0) == CPPI_EPIB_NOT_PRESENT) {
- System_printf ("%s (%s:%d): Found descriptor in PA command reply queue without EIPB present, failing\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
- swInfoCmd = (*swInfo0 & 0xffff0000u);
- /* Verify expected value in swinfo0 16 msbs */
- if ( (swInfoCmd != T9_CMD_SWINFO0_ADD_ID) && (swInfoCmd != T9_CMD_SWINFO0_DEL_ID) ) {
- System_printf ("%s (%s:%d): Found descriptor in PA command reply queue without command reply swinfo0\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- /* Extract the local instance value */
- lid = *swInfo0 & 0xffffu;
- if (lid >= T9_NUM_LOCAL_HANDLES) {
- System_printf ("%s (%s:%d): Received PA command reply for out of range local handle %d (max %d)\n", tfName, __FILE__, __LINE__, lid, T9_NUM_LOCAL_HANDLES);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- /* Send the reply back to PA to let the driver know the command has been accepted */
- paret = Pa_forwardResult (tf->passHandle, (void *)hd->buffPtr, &reth, &htype, &cmdDest);
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): paForwardResult returned error %d in response to paAddMac reply from PA\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- /* Make sure the handle returned by PA matches the local copy */
- if (localHandles[lid].paHandle != reth.l2l3Handle) {
- System_printf ("%s (%s:%d): paForwardResult returned handle (0x%08x) that did match internal table value (0x%08x)\n", tfName, __FILE__, __LINE__, (uint32_t)(localHandles[lid].paHandle), (uint32_t) reth.l2l3Handle);
- testCommonRecycleLBDesc (tf, hd); /* Ignore return code */
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- /* Recycle the descriptor and buffer */
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s: (%s:%d): testCommonRecycleLBDesc failed to return a buffer/descriptor\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- if (swInfoCmd == T9_CMD_SWINFO0_ADD_ID)
- localHandles[lid].state = L2_HANDLE_ACTIVE;
- else
- localHandles[lid].state = L2_HANDLE_UNCONFIGURED;
- }
-
- while (Qmss_getQueueEntryCount ((tf->QGen)[Q_CMD_RECYCLE]) > 0) {
-
- /* Recycle the command descriptor/buffer */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop ((tf->QGen[Q_CMD_RECYCLE]))) & ~15);
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s: (%s:%d): testCommonRecycleLBDesc failed to return a buffer/descriptor\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, localHandles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- }
-
-
-}
-
-
-
-
-static void paL2HandleError (tFramework_t *tf, paTest_t *pat, t9Handles_t *l2Handles, paReturn_t paret, Cppi_HostDesc *hd)
-{
- /* Check paret before the descriptor. If paret indicates failure the descriptor will be NULL */
- if (paret != pa_OK) {
- System_printf ("%s (%s:%d): testCommonAddSrio failed, PA LLD error code = %d\n", tfName, __FILE__, __LINE__, paret);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* No return */
- }
-
- if (hd == NULL) {
- System_printf ("%s (%s:%d): testCommonAddSrio failed due to unavailable free linked buffer descriptor\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* No return */
- }
-}
-
-
-/* Check the stats */
-static paTestStatus_t t9CheckStats (tFramework_t *tf, paTest_t *pat, Bool clear, t9Handles_t *l2Handles)
-{
- Cppi_HostDesc *hd;
- uint8_t *bp;
- paSysStats_t *paStats;
- uint32_t blen;
- int32_t i;
- paTestStatus_t status;
-
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
- cmdReply.queue = (uint16_t) tf->QGen[Q_CMD_REPLY];
-
-
- /* Check the PA stats to make sure they are set as expected */
- cmdReply.replyId = T9_CMD_SWINFO0_STATS_REQ_ID;
- if (testCommonRequestPaStats (tfName, tf, clear, tf->QLinkedBuf1, tf->QGen[Q_CMD_RECYCLE], &cmdReply)) {
- System_printf ("%s (%s:%d): testCommonRequestPaStats failed\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, FALSE); /* No Return */
- }
-
- /* Wait for the stats reply */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (T9_PA_CMD_REPLY_DELAY);
- if (Qmss_getQueueEntryCount (tf->QGen[Q_CMD_REPLY]) > 0)
- break;
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Did not find response from PA to stats request command\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, FALSE); /* No Return */
- }
-
- /* Recycle the descriptor/buffer returned from the stats request */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_RECYCLE])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Did not find returned descriptor/buffer from stats request\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, FALSE); /* No Return */
- }
-
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats request\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, FALSE); /* No Return */
- }
-
- /* Format the stats response and compare to the expected results */
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_CMD_REPLY])) & ~15);
- Cppi_getData (Cppi_DescType_HOST, (Cppi_Desc *)hd, &bp, &blen);
- paStats = (paSysStats_t *)Pa_formatStatsReply (tf->passHandle, (paCmd_t)bp);
-
- if (testCommonCompareStats (tfName, (paSysStats_t *)&paTestL2ExpectedStats, paStats))
- status = PA_TEST_FAILED;
- else
- status = PA_TEST_PASSED;
-
- /* Recycle the descriptor and associated buffer back to queue from which it came */
- if (testCommonRecycleLBDesc (tf, hd)) {
- System_printf ("%s (%s:%d): Failed to find original free buffer Q for stats response\n", tfName, __FILE__, __LINE__);
- status = PA_TEST_FAILED;
- }
-
- return (status);
-}
-
-
-/* Search the receive data packet queue for received data packets. Remain in
- * this function until all buffers are restored to their respective queues */
-static int32_t t9ReceiveDataPkts (tFramework_t *tf, paTest_t *pat, uint8_t *actualPktCount)
-{
- Cppi_HostDesc *hd;
- uint32_t *swInfo;
- pktTest9Info_t *tinfo;
- pasahoLongInfo_t *pinfo;
- uint32_t infoLen;
- int32_t i, j;
- uint32_t chan;
-
- for (i = 0; i < 100; i++) {
-
- utilCycleDelay (1000);
- while (Qmss_getQueueEntryCount (tf->QGen[Q_MATCH]) > 0) {
-
- hd = (Cppi_HostDesc *)(((uint32_t)Qmss_queuePop (tf->QGen[Q_MATCH])) & ~15);
- if (hd == NULL) {
- System_printf ("%s (%s:%d): Popped a NULL descriptor off of match queue\n", tfName, __FILE__, __LINE__);
- return (-1);
- }
-
- /* Verify swInfo0 for packet match and packet ID number */
- Cppi_getSoftwareInfo (Cppi_DescType_HOST, (Cppi_Desc *)hd, (uint8_t **)&swInfo);
-
- if ((*swInfo & 0xffff0000) != T9_CMD_SWINFO0_PKT_ID) {
- System_printf ("%s (%s:%d): Found a packet in the receive packet queue but with incorrect swinfo0 Id: 0x%08x\n",
- tfName, __FILE__, __LINE__, *swInfo);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- chan = *swInfo & 0xffff;
- if (chan < T9_NUM_LOCAL_HANDLES)
- actualPktCount[chan] += 1;
-
- /* locate the associated test information based on the channel value */
- for (j = 0, tinfo = NULL; j < sizeof(t9PktTestInfo) / sizeof(pktTest9Info_t); j++) {
- if (t9PktTestInfo[j].idx == chan) {
- tinfo = &t9PktTestInfo[j];
- break;
- }
- }
-
- if (tinfo == NULL) {
- System_printf ("%s (%s:%d): Found a packet in the receive packet queue for channel %d, but found no matching packet info\n",
- tfName, __FILE__, __LINE__, chan);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- /* Verify the parse information is correct */
- if (Cppi_getPSData (Cppi_DescType_HOST, Cppi_PSLoc_PS_IN_DESC, (Cppi_Desc *)hd, (uint8_t **)&pinfo, &infoLen) != CPPI_SOK) {
- System_printf ("%s (%s:%d): Error getting control info from received data packet\n", tfName, __FILE__, __LINE__);
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- if (testCommonComparePktInfo (tfName, tinfo->info, pinfo)) {
- testCommonRecycleLBDesc (tf, hd);
- return (-1);
- }
-
- /* Return the descriptor/buffer */
- testCommonRecycleLBDesc (tf, hd);
-
- }
-
- if ( (Qmss_getQueueEntryCount(TF_LINKED_BUF_Q1) == TF_LINKED_BUF_Q1_NBUFS) &&
- (Qmss_getQueueEntryCount(TF_LINKED_BUF_Q2) == TF_LINKED_BUF_Q2_NBUFS) &&
- (Qmss_getQueueEntryCount(TF_LINKED_BUF_Q3) == TF_LINKED_BUF_Q3_NBUFS) )
- break;
-
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Error - unable to recover all descriptors with associated buffers\n", tfName, __FILE__, __LINE__);
- System_flush();
- return (-1);
- }
-
- return (0);
-
-}
-
-#ifdef __LINUX_USER_SPACE
-void* paTestSrioRouting (void *args)
-{
- tFramework_t *tf = ((paTestArgs_t *)args)->tf;
- paTest_t *pat = ((paTestArgs_t *)args)->pat;
-#else
-void paTestSrioRouting (UArg a0, UArg a1)
-{
- tFramework_t *tf = (tFramework_t *)a0;
- paTest_t *pat = (paTest_t *)a1;
-#endif
- Cppi_HostDesc *hd[8];
- paReturn_t paret;
- t9Handles_t l2Handles[T9_NUM_LOCAL_HANDLES];
- paHandleL2L3_t fHandle;
- int32_t i, j, k, l;
- int32_t state;
- int32_t count;
- int32_t cmdDest;
- Bool halt;
- uint16_t cmdSize;
- paTestStatus_t testStatus = PA_TEST_PASSED;
- uint8_t expectedPktCount[T9_NUM_LOCAL_HANDLES];
- uint8_t actualPktCount[T9_NUM_LOCAL_HANDLES];
-
-
- volatile int32_t mdebugWait = 1;
-
- paRouteInfo_t matchRoute = { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}; /* No commands */
-
- paRouteInfo_t nfailRoute = { pa_DEST_HOST, /* Dest */
- 0, /* Flow ID */
- 0, /* queue */
- -1, /* Multi route */
- 0, /* sw Info 0 */
- 0, /* sw Info 1 */
- 0, /* customType : not used */
- 0, /* customIndex: not used */
- 0, /* pkyType: for SRIO only */
- NULL}; /* No commands */
-
- paCmdReply_t cmdReply = { pa_DEST_HOST, /* Dest */
- 0, /* Reply ID (returned in swinfo0) */
- 0, /* Queue */
- 0 }; /* Flow ID */
-
-#ifdef __LINUX_USER_SPACE
- for (i = 0; (i < (sizeof(t9PktTestInfo) / sizeof(pktTest9Info_t))); i++) {
- int pktSz;
- uint8_t *pkt;
-
- switch (i) {
- case 0:
- pktSz = sizeof(pkt2);
- pkt = pkt2;
- break;
-
- case 1:
- pktSz = sizeof(pkt5);
- pkt = pkt5;
- break;
-
- case 2:
- pktSz = sizeof(pkt10);
- pkt = pkt10;
- break;
- }
-
- /* Allocate memory for the Packet buffers */
- t9PktTestInfo[i].pkt = (uint8_t *)fw_memAlloc(pktSz, CACHE_LINESZ);
- if(t9PktTestInfo[i].pkt == NULL) {
- printf ("%s: memAlloc failed for pkt %d\n", tfName, i);
- pat->testStatus = PA_TEST_FAILED;
- return (void *)0;
- }
- memcpy(t9PktTestInfo[i].pkt, pkt, pktSz);
- }
-#endif
-
- /* Runtime initial values */
- matchRoute.queue = (uint16_t) tf->QGen[Q_MATCH];
- nfailRoute.queue = (uint16_t) tf->QGen[Q_NFAIL];
- cmdReply.queue = (uint16_t) tf->QGen[Q_CMD_REPLY];
- cmdReply.flowId = tf->tfFlowNum;
-
- /* Zero out the l2Handle array and packet counts */
- memset (l2Handles, 0, sizeof(l2Handles));
- memset (expectedPktCount, 0, sizeof(expectedPktCount));
- memset (actualPktCount, 0, sizeof(actualPktCount));
-
- /* Zero out the expected stats. The stats will be updated as packets are sent into PA */
- memset (&paTestL2ExpectedStats, 0, sizeof(paTestL2ExpectedStats));
-
- /* Initialize the first entry in the table */
- cmdReply.replyId = T9_CMD_SWINFO0_ADD_ID + 0; /* T9_CMD_SWINFO0_ADD_ID identifies command, 16 LS bits identify the local handle number */
- cmdReply.queue = tf->QGen[Q_CMD_REPLY];
- matchRoute.swInfo0 = nfailRoute.swInfo0 = t9SrioAndSwinfo[0].swinfo0;
-
- hd[0] = testCommonAddSrio (tf, t9SrioIndex[0], &t9SrioAndSwinfo[0].srio, t9SrioAndSwinfo[0].nextHdr, t9SrioAndSwinfo[0].nextHdrOffset,
- &matchRoute, &nfailRoute, &l2Handles[0].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
-
- paL2HandleError (tf, pat, l2Handles, paret, hd[0]); /* Will not return on error */
-
- /* Send the command to PA. This will result in 1 packet in classify1 */
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[0], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- l2Handles[0].state = L2_HANDLE_PENDING_ACK;
- paTestL2ExpectedStats.classify1.nPackets += 1;
-
- /* Wait for a PA reply */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (T9_PA_CMD_REPLY_DELAY);
- t9L2CmdRep (tf, pat, l2Handles);
- if (l2Handles[0].state == L2_HANDLE_ACTIVE)
- break;
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Reply to paAddSrio not found\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* no return */
- }
-
-
- /* Add the next 6 entries in a burst. Take the memory from linked buffer descriptor area two
- * since the responses will come from area one. These are entries 1-6 in the local handle table */
- for (i = 1; i < 7; i++) {
- cmdReply.replyId = T9_CMD_SWINFO0_ADD_ID + i;
- matchRoute.swInfo0 = nfailRoute.swInfo0 = t9SrioAndSwinfo[i].swinfo0;
- hd[i] = testCommonAddSrio (tf, t9SrioIndex[i+1], &t9SrioAndSwinfo[i].srio, t9SrioAndSwinfo[i].nextHdr, t9SrioAndSwinfo[i].nextHdrOffset,
- &matchRoute, &nfailRoute, &l2Handles[i].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
- paL2HandleError (tf, pat, l2Handles, paret, hd[i]); /* Will not return on error */
- }
-
-
- /* Send all the commands at once to test the ability to handle back to back commands */
- for (i = 1; i < 7; i++) {
- /* if (mdebugWait) mdebugHaltPdsp(0); */
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[i], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- /* while (mdebugWait); */
-
- l2Handles[i].state = L2_HANDLE_PENDING_ACK;
- paTestL2ExpectedStats.classify1.nPackets += 1;
-
- }
-
-
- /* Wait for the PA to generate all the responses */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (T9_PA_CMD_REPLY_DELAY);
- t9L2CmdRep (tf, pat, l2Handles);
-
- state = 1;
- for (j = 1; j < 7; j++) {
- if (l2Handles[i].state == L2_HANDLE_PENDING_ACK)
- state = 0;
- }
-
- if (state == 1)
- break;
- }
-
- if ((i == 100) && (state == 0)) {
- System_printf ("%s: (%s:%d): Burst of 6 addSrio commands did not result in 6 acks from PA\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE);
- }
-
- /* The next entry should result in the PA generating an error */
- cmdReply.replyId = T9_CMD_SWINFO0_ADD_ID + 7; /* T9_CMD_SWINFO0_ADD_ID identfies command, 16 LS bits identify the local handle number */
- matchRoute.swInfo0 = nfailRoute.swInfo0 = t9SrioAndSwinfoFail.swinfo0;
- hd[0] = testCommonAddSrio (tf, pa_LUT1_INDEX_NOT_SPECIFIED, &t9SrioAndSwinfoFail.srio, t9SrioAndSwinfoFail.nextHdr, t9SrioAndSwinfoFail.nextHdrOffset,
- &matchRoute, &nfailRoute, &l2Handles[7].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- /* If the descriptor came back non-null, restore it and return it */
- if (hd[0] != NULL) {
- hd[0]->buffLen = hd[0]->origBufferLen;
- Qmss_queuePush (tf->QLinkedBuf2, (Ptr)hd[0], hd[0]->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- }
-
- /* The test won't exit on this failure since no commands have been sent to PA */
- if (paret != pa_INVALID_TABLE_MORE_SPECIFIC_ENTRY_PRESENT) {
- System_printf ("%s (%s:%d): function paAddSrio did not detect an invalid entry order\n", tfName, __FILE__, __LINE__);
- testStatus = PA_TEST_FAILED;
- }
-
-
- /* Rapid fire the next 4 entries from the const table to the PA */
- /* Add the next 4 entries in a burst. Take the memory from linked buffer descriptor area two
- * since the responses will come from area one. These are entries 1-6 in the local handle table */
- for (i = 7; i < 11; i++) {
- cmdReply.replyId = T9_CMD_SWINFO0_ADD_ID + i;
- matchRoute.swInfo0 = nfailRoute.swInfo0 = t9SrioAndSwinfo[i].swinfo0;
- hd[i-7] = testCommonAddSrio (tf, t9SrioIndex[i], &t9SrioAndSwinfo[i].srio, t9SrioAndSwinfo[i].nextHdr, t9SrioAndSwinfo[i].nextHdrOffset,
- &matchRoute, &nfailRoute, &l2Handles[i].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
- paL2HandleError (tf, pat, l2Handles, paret, hd[i-7]); /* Will not return on error */
- }
-
- /* Send all the commands at once to test the ability to handle back to back commands */
- for (i = 7; i < 11; i++) {
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[i-7], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- l2Handles[i].state = L2_HANDLE_PENDING_ACK;
- paTestL2ExpectedStats.classify1.nPackets += 1;
- }
-
- /* Wait for the PA to generate all the responses */
- for (i = 0; i < 100; i++) {
- utilCycleDelay (T9_PA_CMD_REPLY_DELAY);
- t9L2CmdRep (tf, pat, l2Handles);
-
- state = 1;
- for (j = 7; j < 11; j++) {
- if (l2Handles[i].state == L2_HANDLE_PENDING_ACK)
- state = 0;
- }
-
- if (state == 1)
- break;
- }
-
- if (i == 100) {
- System_printf ("%s (%s:%d): Failed to find responses from PA\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
-
- /* 11 Entries into the table have been made. Make an additional 52 entries in 13 batches of 4.
- * These entries do not test any particular routing, simply table addition and overflow */
- for (i = k = 0; i < 13; i++, k += 4) {
- for (j = 0; j < 4; j++) {
-
- cmdReply.replyId = T9_CMD_SWINFO0_ADD_ID + 11 + k + j;
- t9VarSrioAndRoute.srio.destId = 0x2000 + k + j;
- matchRoute.swInfo0 = nfailRoute.swInfo0 = 0x5555000b + k + j + 11;
- hd[j] = testCommonAddSrio (tf, pa_LUT1_INDEX_NOT_SPECIFIED, &t9VarSrioAndRoute.srio, t9VarSrioAndRoute.nextHdr, t9VarSrioAndRoute.nextHdrOffset,
- &matchRoute, &nfailRoute, &l2Handles[k+j+11].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
- paL2HandleError (tf, pat, l2Handles, paret, hd[j]); /* Will not return on error */
- }
-
- /* Send all the commands at once to test the ability to handle back to back commands */
- for (j = 0; j < 4; j++) {
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[j], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- l2Handles[k+j+11].state = L2_HANDLE_PENDING_ACK;
- paTestL2ExpectedStats.classify1.nPackets += 1;
- }
-
- /* Wait for the PA to generate all the responses */
- for (l = 0; l < 100; l++) {
- utilCycleDelay (T9_PA_CMD_REPLY_DELAY);
- t9L2CmdRep (tf, pat, l2Handles);
-
- state = 1;
- for (j = 0; j < 4; j++) {
- if (l2Handles[11 + k + j].state == L2_HANDLE_PENDING_ACK)
- state = 0;
- }
-
- if (state == 1)
- break;
- }
-
- if (l == 100) {
- System_printf ("%s (%s:%d): Failed to find responses from PA\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* No Return */
- }
- }
-
-#ifndef __LINUX_USER_SPACE
- /* There is one place left in the table. Try to make two more entries. The first one should succeed
- * but the next one should be rejected by the PA lld */
- cmdReply.replyId = T9_CMD_SWINFO0_ADD_ID + 11 + k;
- t9VarSrioAndRoute.srio.destId = 0x2000 + k + 11;
- matchRoute.swInfo0 = nfailRoute.swInfo0 = T9_CMD_SWINFO0_ADD_ID + k + 11;
- hd[0] = testCommonAddSrio (tf, pa_LUT1_INDEX_NOT_SPECIFIED, &t9VarSrioAndRoute.srio, t9VarSrioAndRoute.nextHdr, t9VarSrioAndRoute.nextHdrOffset,
- &matchRoute, &nfailRoute, &l2Handles[k+11].paHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
- paL2HandleError (tf, pat, l2Handles, paret, hd[0]); /* Will not return on error */
-
- Qmss_queuePush (tf->QPaTx[cmdDest - pa_CMD_TX_DEST_0], (Ptr)hd[0], cmdSize, TF_SIZE_DESC, Qmss_Location_TAIL);
- l2Handles[k+11].state = L2_HANDLE_PENDING_ACK;
- paTestL2ExpectedStats.classify1.nPackets += 1;
-
-
- /* Wait for the PA to generate the response */
- for (l = 0; l < 100; l++) {
- utilCycleDelay (T9_PA_CMD_REPLY_DELAY);
- t9L2CmdRep (tf, pat, l2Handles);
-
- if (l2Handles[11+k].state == L2_HANDLE_ACTIVE)
- break;
- }
-
- if (l == 100) {
- System_printf ("%s (%s:%d): Failed to find responses from PA\n", tfName, __FILE__, __LINE__);
- paTestL2RecoverAndExit (tf, pat, l2Handles, PA_TEST_FAILED, TRUE); /* No Return */
- }
-
- /* The next add mac command should fail */
- k += 1;
- t9VarSrioAndRoute.srio.destId = 0x2000 + k + 11;
- matchRoute.swInfo0 = nfailRoute.swInfo0 = T9_CMD_SWINFO0_ADD_ID + k + 11;
- hd[0] = testCommonAddSrio (tf, pa_LUT1_INDEX_NOT_SPECIFIED, &t9VarSrioAndRoute.srio, t9VarSrioAndRoute.nextHdr, t9VarSrioAndRoute.nextHdrOffset,
- &matchRoute, &nfailRoute, &fHandle, tf->QGen[Q_CMD_RECYCLE], tf->QLinkedBuf2,
- &cmdReply, &cmdDest, &cmdSize, &paret);
-
- /* If the descriptor came back non-null, restore it and return it */
- if (hd[0] != NULL) {
- hd[0]->buffLen = hd[0]->origBufferLen;
- Qmss_queuePush (tf->QLinkedBuf2, (Ptr)hd[0], hd[0]->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
- }
-
- /* The test will continue on failure since the PA sub-system has not been changed */
- if (paret != pa_HANDLE_TABLE_FULL) {
- System_printf ("%s (%s:%d): function paAddSrio did not detect a full handle table\n", tfName, __FILE__, __LINE__);
- testStatus = PA_TEST_FAILED;
- }
-
- /* Check and clear the stats */
- testStatus = t9CheckStats (tf, pat, TRUE, l2Handles);
- memset (&paTestL2ExpectedStats, 0, sizeof(paTestL2ExpectedStats));
-
- if (testStatus != PA_TEST_PASSED)
- paTestL2RecoverAndExit (tf, pat, l2Handles, testStatus, TRUE);
-#endif
-
- /* Run packets through the system. the complete set of packets is run through three times. */
- for (j = 0, halt = FALSE; (j < 3) && (halt == FALSE); j++) {
-
- for (i = 0; (i < sizeof(t9PktTestInfo) / sizeof(pktTest9Info_t)) && (halt == FALSE); ) {
-
- /* Form up to 8 data packets to send */
- for (k = 0; ((k < 8) && (i < sizeof(t9PktTestInfo) / sizeof(pktTest9Info_t))); k++) {
- hd[k] = formDataPacket (tf, pat, i, expectedPktCount);
-
- if (hd[k] == NULL) {
- halt = TRUE;
- break;
- }
-
- /* Inc the count if the packet is passed back to the host */
- if (t9PktTestInfo[i].idx >= 0)
- expectedPktCount[t9PktTestInfo[i].idx] += 1;
-
- /* Increment any expected stats */
- testCommonIncStats (t9PktTestInfo[i].statsMap, &paTestL2ExpectedStats);
-
- /* Proceed to the next packet */
- i += 1;
-
- }
-
- //mdebugWait = 1;
- //if (mdebugWait) mdebugHaltPdsp(0);
-
- for (l = 0; l < k; l++)
- Qmss_queuePush (tf->QPaTx[0], (Ptr)hd[l], hd[l]->buffLen, TF_SIZE_DESC, Qmss_Location_TAIL);
-
- //while (mdebugWait);
-
- }
-
- /* Wait for all descriptors associated with received packets to be recycled. The descriptors
- * had to go somewhere so wait until the total count is accounted for */
- for (l = 0, count = 0; ((l < 100) && (count != TOTAL_BUFS)); l++)
- {
- utilCycleDelay (100);
- count = Qmss_getQueueEntryCount(tf->QGen[Q_MATCH]) + Qmss_getQueueEntryCount(tf->QGen[Q_NFAIL]) +
- Qmss_getQueueEntryCount(tf->QGen[Q_PARSE_ERR]) + Qmss_getQueueEntryCount(tf->QLinkedBuf1) +
- Qmss_getQueueEntryCount(tf->QLinkedBuf2) + Qmss_getQueueEntryCount(tf->QLinkedBuf3);
- }
-
- if (l == 100) {
- System_printf ("%s (%s:%d): Timeout waiting for packets from PA\n", tfName, __FILE__, __LINE__);
- testStatus = PA_TEST_FAILED;
- break;
- }
-
- if (t9ReceiveDataPkts (tf, pat, actualPktCount))
- {
- /* Error Handling */
- System_printf ("%s (%s:%d): t9ReceiveDataPkts timeout %d\n", tfName,
- __FILE__, __LINE__);
- System_flush();
- break;
- }
- }
-
- /* Give a good delay for any more packets to come through, and examine the epackets. */
- //utilCycleDelay (2000);
- t9ReceiveDataPkts (tf, pat, actualPktCount);
-
-
- /* Verify that the expected and actual received packet counts match */
- for (i = 0; i < T9_NUM_LOCAL_HANDLES; i++) {
- if (expectedPktCount[i] != actualPktCount[i]) {
- System_printf ("%s (%s:%d): Packet count mismatch for entry %d - expected %d, found %d\n", tfName,
- __FILE__, __LINE__, i, expectedPktCount[i], actualPktCount[i]);
- System_flush();
- testStatus = PA_TEST_FAILED;
- }
- }
-
- /* Clean up and return */
- paTestL2RecoverAndExit (tf, pat, l2Handles, testStatus, TRUE);
-
-#ifdef __LINUX_USER_SPACE
- return (void *)0;
-#endif
-}
-
-
-
-
-
-
-
-
diff --git a/test/PAUnitTest2/tests/test9pkts.h b/test/PAUnitTest2/tests/test9pkts.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- *
- * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * 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.
- *
-*/
-
-
-
-/* Packet and associated structures */
-typedef struct pktTest9Info_s {
- uint8_t *pkt;
- pasahoLongInfo_t *info;
- uint32_t *psInfo;
- int32_t pktType;
- int32_t pktLen;
- paStatsBmap_t statsMap[3]; /* Bit map of which stats to increment. Some stats must be incremented 3 times */
- int32_t idx; /* Used to increment the test tracking - tells the test to look for
- * a packet with this index */
-} pktTest9Info_t;
-
-
-#pragma DATA_SECTION(pkt2, ".testPkts")
-#pragma DATA_ALIGN(pkt2, 8)
-static uint8_t pkt2[] = {
-
- 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0xaa, 0xbb,
- 0xcc, 0xdd, 0xee, 0xff, 0x81, 0x00, 0x08, 0x88,
- 0x08, 0x00, 0x45, 0x00, 0x00, 0x5c, 0x00, 0x00,
- 0x00, 0x00, 0x05, 0x11, 0x75, 0x4e, 0x0a, 0x0b,
- 0x0c, 0x0d, 0x14, 0x15, 0x16, 0x17, 0x11, 0x11,
- 0x22, 0x22, 0x00, 0x48, 0x61, 0x89, 0x32, 0x33,
- 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
- 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43,
- 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b,
- 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53,
- 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b,
- 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63,
- 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
- 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71
-};
-
-
-static pasahoLongInfo_t pkt2Info = {
- TF_FORM_PKT_INFO_WORD0(0,24,0), /* cmd len = 24, start offset = 18 */
- TF_FORM_PKT_INFO_WORD1(110,0,1,0,0,0), /* end offset = 110, pmatch set */
- TF_FORM_PKT_INFO_WORD2(0,0,0,0), /* L3 offset = 0 */
- TF_FORM_PKT_INFO_WORD3(0,0,0,0,0,0,0,0), /* vlan count = 0 */
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-static uint32_t psInfo2[2] = {
- TF_FORM_SRIO_PSINFO_WORD0(0x5678, 0x1234),
- TF_FORM_SRIO_PSINFO_WORD1_TYPE11(0, 0, pa_SRIO_TRANSPORT_TYPE_1, 0, 2)
-};
-
-#pragma DATA_SECTION(pkt5, ".testPkts")
-#pragma DATA_ALIGN(pkt5, 8)
-static uint8_t pkt5[] = {
-
- 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0xaa, 0xbb,
- 0xcc, 0xdd, 0xee, 0xff, 0x81, 0x00, 0x08, 0x88,
- 0x88, 0x47, 0x12, 0x34, 0x51, 0x64, 0x45, 0x00,
- 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x11,
- 0x75, 0x4e, 0x0a, 0x0b, 0x0c, 0x0d, 0x14, 0x15,
- 0x16, 0x17, 0x11, 0x11, 0x22, 0x22, 0x00, 0x48,
- 0x61, 0x89, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71
-
-};
-
-static pasahoLongInfo_t pkt5Info = {
- TF_FORM_PKT_INFO_WORD0(0,24,0), /* cmd len = 24, start offset = 0 */
- TF_FORM_PKT_INFO_WORD1(114,0,1,0,0,0), /* end offset = 114, errIdx = 0, pmatch = 1, c2c(custom) = 0, l1PdspId = 0, l1Idx = don't care */
- TF_FORM_PKT_INFO_WORD2(0,0,0,0), /* L3 offset = 0 */
- TF_FORM_PKT_INFO_WORD3((0),
- 0,0,0,0,0,0,0), /* bitmap, nextHdr = ipv4, vlan Count = 0,
- * ipCount = 0, gre count = 0, frag = 0,
- * ip route = 0, multi route = 0 */
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-static uint32_t psInfo5[2] = {
- TF_FORM_SRIO_PSINFO_WORD0(0x66, 0x12),
- TF_FORM_SRIO_PSINFO_WORD1_TYPE9(0, 0, pa_SRIO_TRANSPORT_TYPE_0, 0xface, 5)
-};
-
-
-/* Packet 10 is an ARP request over SRIO */
-#pragma DATA_SECTION(pkt10, ".testPkts")
-#pragma DATA_ALIGN(pkt10, 8)
-static uint8_t pkt10[] = {
-
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Dest MAC */
- 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0x01, /* Src MAC */
- 0x08, 0x06, /* Ethertype = ARP */
- 0x00, 0x01, /* Hardware type = ethernet */
- 0x08, 0x00, /* Protocol type = IP */
- 0x06, 0x04, /* Hardware size = 6, protocol size = 4 */
- 0x00, 0x01, /* Opcode = request */
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, /* Sender MAC */
- 0x10, 0x11, 0x12, 0x13, /* Sender IP */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Target MAC */
- 0x14, 0x15, 0x16, 0x17, /* Target IP */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Trailer */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-};
-
-
-static pasahoLongInfo_t pkt10Info = {
- TF_FORM_PKT_INFO_WORD0(0,24,0), /* cmd len = 24, start offset = 0 */
- TF_FORM_PKT_INFO_WORD1(60,0,1,0,0,0), /* end offset = 60, errIdx = 0, pmatch = 1, c2c = 0, l1PdspId = 0, l1idx = dont care */
- TF_FORM_PKT_INFO_WORD2(0,0,0,0),
- TF_FORM_PKT_INFO_WORD3(0,0,0,0,0,0,0,0),
- TF_FORM_PKT_INFO_WORD4(0)
-};
-
-static uint32_t psInfo10[2] = {
- TF_FORM_SRIO_PSINFO_WORD0(0x6666, 0x7777),
- TF_FORM_SRIO_PSINFO_WORD1_TYPE11(0, 0, pa_SRIO_TRANSPORT_TYPE_1, 3, 5)
-};
-
-
-
-
-pktTest9Info_t t9PktTestInfo[] = {
-
-
- { (uint8_t *)pkt2, (pasahoLongInfo_t *)&pkt2Info, psInfo2, PA_PKT_TYPE_SRIO_TYPE_11, sizeof(pkt2),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_SRIO),
- 0, 0, 2 },
-
- { (uint8_t *)pkt5, (pasahoLongInfo_t *)&pkt5Info, psInfo5, PA_PKT_TYPE_SRIO_TYPE_9, sizeof(pkt5),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_SRIO),
- 0, 0, 5 },
-
- { (uint8_t *)pkt10, (pasahoLongInfo_t *)&pkt10Info, psInfo10, PA_PKT_TYPE_SRIO_TYPE_11, sizeof(pkt10),
- (1 << TF_STATS_BM_C1_NUM_PACKETS) | (1 << TF_STATS_BM_C1_TABLE_MATCH) | (1 << TF_STATS_BM_C1_NUM_SRIO),
- 0, 0, 10 }
-
-};
-
-
-
-
-