summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTinku Mannan2019-08-13 14:33:46 -0500
committerTinku Mannan2019-08-13 16:00:21 -0500
commit1ec9489276e253dc581f808c4cb0ddbb83d2894e (patch)
treecc0767762288387f627be5dff437d35637e18c62
parent91a6ae70f64ddc9d7e0661e67db967960d7fcb17 (diff)
downloademac-lld-1ec9489276e253dc581f808c4cb0ddbb83d2894e.tar.gz
emac-lld-1ec9489276e253dc581f808c4cb0ddbb83d2894e.tar.xz
emac-lld-1ec9489276e253dc581f808c4cb0ddbb83d2894e.zip
am65xx: Test application updates
Adding icssg switch benchmarking application Updates for IOCTL verification at the driver level Signed-off-by: Tinku Mannan <tmannan@ti.com>
-rw-r--r--emac_component.mk26
-rw-r--r--test/EmacLoopbackTest/am65xx/icssg/makefile_switch_benchmark49
-rw-r--r--test/EmacLoopbackTest/main_am65xx.c21
-rw-r--r--test/EmacLoopbackTest/test_loc.h22
-rw-r--r--test/EmacLoopbackTest/test_utils_switch_k3.c313
-rw-r--r--test/Module.xs6
6 files changed, 306 insertions, 131 deletions
diff --git a/emac_component.mk b/emac_component.mk
index a8f0003..f66c612 100644
--- a/emac_component.mk
+++ b/emac_component.mk
@@ -1,5 +1,5 @@
1# 1#
2# Copyright (c) 2016-2018, Texas Instruments Incorporated 2# Copyright (c) 2016-2019, Texas Instruments Incorporated
3# All rights reserved. 3# All rights reserved.
4# 4#
5# Redistribution and use in source and binary forms, with or without 5# Redistribution and use in source and binary forms, with or without
@@ -82,7 +82,7 @@ drvemac_omapl137_CORELIST = c674x arm9_0
82drvemac_omapl138_CORELIST = c674x arm9_0 82drvemac_omapl138_CORELIST = c674x arm9_0
83drvemac_c6657_CORELIST = c66x 83drvemac_c6657_CORELIST = c66x
84drvemac_am65xx_CORELIST = mpu1_0 mcu1_0 84drvemac_am65xx_CORELIST = mpu1_0 mcu1_0
85drvemac_j721e_CORELIST = mcu1_0 mpu1_0 85drvemac_j721e_CORELIST = mpu1_0 mcu1_0
86 86
87############################ 87############################
88# emac package 88# emac package
@@ -98,7 +98,7 @@ drvemac_LIB_LIST = $(emac_LIB_LIST)
98# All the tests mentioned in list are built when test target is called 98# All the tests mentioned in list are built when test target is called
99# List below all test apps for allowed values 99# List below all test apps for allowed values
100############################ 100############################
101emac_EXAMPLE_LIST = Emac_Icssg_Switch_TestApp Emac_Icssg_TestApp Emac_Cpsw_TestApp Emac_Cpsw_Smp_TestApp Emac_Icssg_WithoutDDR_TestApp 101emac_EXAMPLE_LIST = Emac_Icssg_Switch_TestApp Emac_Icssg_TestApp Emac_Cpsw_TestApp Emac_Cpsw_Smp_TestApp Emac_Icssg_WithoutDDR_TestApp Emac_Icssg_Switch_Benchmark_TestApp
102drvemac_EXAMPLE_LIST = $(emac_EXAMPLE_LIST) 102drvemac_EXAMPLE_LIST = $(emac_EXAMPLE_LIST)
103 103
104# 104#
@@ -331,6 +331,26 @@ export Emac_Icssg_Switch_TestApp_$(SOC)_CORELIST
331 331
332Emac_Icssg_Switch_TestApp_SBL_APPIMAGEGEN = yes 332Emac_Icssg_Switch_TestApp_SBL_APPIMAGEGEN = yes
333export Emac_Icssg_Switch_TestApp_SBL_APPIMAGEGEN 333export Emac_Icssg_Switch_TestApp_SBL_APPIMAGEGEN
334
335# EMAC SWITCH Benchmark unit test app ICSSG
336Emac_Icssg_Switch_Benchmark_TestApp_COMP_LIST = Emac_Icssg_Switch_Benchmark_TestApp
337Emac_Icssg_Switch_Benchmark_TestApp_RELPATH = ti/drv/emac/test/EmacLoopbackTest
338Emac_Icssg_Switch_Benchmark_TestApp_PATH = $(PDK_EMAC_COMP_PATH)/test/EmacLoopbackTest
339Emac_Icssg_Switch_Benchmark_TestApp_BOARD_DEPENDENCY = yes
340Emac_Icssg_Switch_Benchmark_TestApp_CORE_DEPENDENCY = no
341Emac_Icssg_Switch_Benchmark_TestApp_XDC_CONFIGURO = yes
342Emac_Icssg_Switch_Benchmark_TestApp_MAKEFILE = -f am65xx/icssg/makefile_switch_benchmark
343export Emac_Icssg_Switch_Benchmark_TestApp_MAKEFILE
344export Emac_Icssg_Switch_Benchmark_TestApp_board_dependency
345export Emac_Icssg_Switch_Benchmark_TestApp_core_dependency
346export Emac_Icssg_Switch_Benchmark_TestApp_xdc_configuro
347Emac_Icssg_Switch_Benchmark_TestApp_PKG_LIST = Emac_Icssg_Switch_Benchmark_TestApp
348Emac_Icssg_Switch_Benchmark_TestApp_INCLUDE = $(Emac_Icssg_Switch_Benchmark_TestApp_PATH)
349Emac_Icssg_Switch_Benchmark_TestApp_BOARDLIST = am65xx_idk
350export Emac_Icssg_Switch_Benchmark_TestApp_BOARDLIST
351Emac_Icssg_Switch_Benchmark_TestApp_$(SOC)_CORELIST = $(drvemac_$(SOC)_CORELIST)
352export Emac_Icssg_Switch_Benchmark_TestApp_$(SOC)_CORELIST
353
334export drvemac_LIB_LIST 354export drvemac_LIB_LIST
335export emac_LIB_LIST 355export emac_LIB_LIST
336export emac_EXAMPLE_LIST 356export emac_EXAMPLE_LIST
diff --git a/test/EmacLoopbackTest/am65xx/icssg/makefile_switch_benchmark b/test/EmacLoopbackTest/am65xx/icssg/makefile_switch_benchmark
new file mode 100644
index 0000000..6d7e618
--- /dev/null
+++ b/test/EmacLoopbackTest/am65xx/icssg/makefile_switch_benchmark
@@ -0,0 +1,49 @@
1# Makefile for EMAC Switch Benchmark app
2include $(PDK_INSTALL_PATH)/ti/build/Rules.make
3
4#Name of the directory created under packages/ti/binary/
5APP_NAME = Emac_Icssg_Switch_Benchmark_TestApp
6
7# Name of the binary if different from the default (APP_NAME)_$(BOARD_$(CORE)_<build_profile>
8LOCAL_APP_NAME = EMAC_Icssg_$(BOARD)_$(CORE)Switch_Benchmark_TestApp
9
10SRCDIR += $(PDK_EMAC_COMP_PATH)/firmware/icss_switch/config
11INCDIR += $(PDK_EMAC_COMP_PATH)/firmware/icss_switch/config
12
13ifeq ($(SOC),$(filter $(SOC), am65xx))
14SRCS_COMMON += main_am65xx.c test_utils_switch_k3.c emac_fw_config_switch.c
15endif
16# List all the external components/interfaces, whose interface header files
17# need to be included for this component
18INCLUDE_EXTERNAL_INTERFACES = bios xdc pdk
19
20# List all the components required by the application
21COMP_LIST_COMMON = emac uart uart_console osal_tirtos csl pruss board udma sciclient
22
23ifeq ($(CORE),$(filter $(CORE), mpu1_0))
24# Enable XDC build for application by providing XDC CFG File per core
25XDC_CFG_FILE_$(CORE) = ./am65xx/emacUnitTest_a53.cfg
26EXTERNAL_LNKCMD_FILE_LOCAL = $(pdk_PATH)/ti/drv/emac/test/EmacLoopbackTest/am65xx/emac_linker_a53.lds
27endif
28
29ifeq ($(CORE),$(filter $(CORE), mcu1_0))
30# Enable XDC build for application by providing XDC CFG File per core
31XDC_CFG_FILE_$(CORE) = ./am65xx/emacUnitTest_r5.cfg
32EXTERNAL_LNKCMD_FILE_LOCAL = $(pdk_PATH)/ti/drv/emac/test/EmacLoopbackTest/am65xx/emac_linker_r5.lds
33endif
34
35PACKAGE_SRCS_COMMON = .
36CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS) -DEMAC_TEST_APP_ICSSG -DEMAC_TEST_APP_ICSSG_SWITCH -DEMAC_BENCHMARK
37
38# Include common make files
39ifeq ($(MAKERULEDIR), )
40#Makerule path not defined, define this and assume relative path from ROOTDIR
41 MAKERULEDIR := $(ROOTDIR)/ti/build/makerules
42 export MAKERULEDIR
43endif
44include $(MAKERULEDIR)/common.mk
45
46# OBJs and libraries are built by using rule defined in rules_<target>.mk
47# and need not be explicitly specified here
48
49# Nothing beyond this point
diff --git a/test/EmacLoopbackTest/main_am65xx.c b/test/EmacLoopbackTest/main_am65xx.c
index 8c08cdf..f46ad91 100644
--- a/test/EmacLoopbackTest/main_am65xx.c
+++ b/test/EmacLoopbackTest/main_am65xx.c
@@ -142,11 +142,20 @@ int main(void)
142 Error_init(&eb); 142 Error_init(&eb);
143 143
144#ifdef EMAC_TEST_APP_ICSSG_SWITCH 144#ifdef EMAC_TEST_APP_ICSSG_SWITCH
145 /* Create the task start the unit test.*/ 145#ifndef EMAC_BENCHMARK
146 Task_Params_init(&taskParams); 146 /* Create the task start the unit test.*/
147 taskParams.priority = 10; 147 Task_Params_init(&taskParams);
148 taskParams.instance->name = "app_test_task_verify_ut_switch"; 148 taskParams.priority = 10;
149 Task_create( app_test_task_verify_ut_switch, &taskParams, NULL); 149 taskParams.instance->name = "app_test_task_verify_ut_switch";
150 Task_create( app_test_task_verify_ut_switch, &taskParams, NULL);
151#else
152 /* Create the task to start BENCHMARK testing.*/
153 Task_Params_init(&taskParams);
154 taskParams.priority = 11;
155 taskParams.arg0 = EMAC_SWITCH_PORT1;
156 taskParams.instance->name = "app_test_task_benchmark";
157 Task_create( app_test_task_benchmark, &taskParams, NULL);
158#endif
150 159
151 /* Create the task to poll driver to rx pkts.*/ 160 /* Create the task to poll driver to rx pkts.*/
152 /* set the priority to 10 for both polling tasks */ 161 /* set the priority to 10 for both polling tasks */
@@ -159,7 +168,6 @@ int main(void)
159 taskParams.arg0 = EMAC_SWITCH_PORT2; 168 taskParams.arg0 = EMAC_SWITCH_PORT2;
160 taskParams.instance->name = rxTaskName[2]; 169 taskParams.instance->name = rxTaskName[2];
161 Task_create(app_test_task_poll_ctrl, &taskParams, NULL); 170 Task_create(app_test_task_poll_ctrl, &taskParams, NULL);
162
163#else 171#else
164#ifndef EMAC_BENCHMARK 172#ifndef EMAC_BENCHMARK
165 /* Create the task start the unit test.*/ 173 /* Create the task start the unit test.*/
@@ -171,6 +179,7 @@ int main(void)
171 /* Create the task to start BENCHMARK testing.*/ 179 /* Create the task to start BENCHMARK testing.*/
172 Task_Params_init(&taskParams); 180 Task_Params_init(&taskParams);
173 taskParams.priority = 10; 181 taskParams.priority = 10;
182 taskParams.arg0 = EMAC_PORT_ICSS + 4;
174 taskParams.instance->name = "app_test_task_benchmark"; 183 taskParams.instance->name = "app_test_task_benchmark";
175 Task_create( app_test_task_benchmark, &taskParams, NULL); 184 Task_create( app_test_task_benchmark, &taskParams, NULL);
176#endif 185#endif
diff --git a/test/EmacLoopbackTest/test_loc.h b/test/EmacLoopbackTest/test_loc.h
index e75a759..94e5045 100644
--- a/test/EmacLoopbackTest/test_loc.h
+++ b/test/EmacLoopbackTest/test_loc.h
@@ -155,17 +155,19 @@ extern "C" {
155#if defined(SOC_DRA72x) || defined(SOC_DRA75x) || defined(SOC_DRA78x) || defined(SOC_AM571x) || defined(SOC_AM572x) || defined(SOC_AM574x) 155#if defined(SOC_DRA72x) || defined(SOC_DRA75x) || defined(SOC_DRA78x) || defined(SOC_AM571x) || defined(SOC_AM572x) || defined(SOC_AM574x)
156#define APP_MAX_PKTS 512 156#define APP_MAX_PKTS 512
157#elif defined(SOC_K2G) 157#elif defined(SOC_K2G)
158#ifdef _TMS320C6X 158 #ifdef _TMS320C6X
159#define APP_MAX_PKTS 128 159 #define APP_MAX_PKTS 128
160#else 160 #else
161#define APP_MAX_PKTS 1024 161 #define APP_MAX_PKTS 1024
162#endif 162 #endif
163#elif defined(SOC_AM65XX) || defined(SOC_J721E) 163#elif defined(SOC_AM65XX) || defined(SOC_J721E)
164#ifdef EMAC_TEST_APP_WITHOUT_DDR 164 #if defined(EMAC_TEST_APP_WITHOUT_DDR)
165#define APP_MAX_PKTS (MAX_NUM_EMAC_PORTS*16*4) 165 #define APP_MAX_PKTS (MAX_NUM_EMAC_PORTS*16*4)
166#else 166 #elif defined (EMAC_BENCHMARK)
167#define APP_MAX_PKTS (MAX_NUM_EMAC_PORTS*16*16) 167 #define APP_MAX_PKTS (128*4*8) /* sized for icssg switch use case, 4 ports, 128 descriptors/ring, 8 rings/port */
168#endif 168 #else
169 #define APP_MAX_PKTS (MAX_NUM_EMAC_PORTS*16*16)
170 #endif
169#else 171#else
170#define APP_MAX_PKTS 128 172#define APP_MAX_PKTS 128
171#endif 173#endif
diff --git a/test/EmacLoopbackTest/test_utils_switch_k3.c b/test/EmacLoopbackTest/test_utils_switch_k3.c
index 66f63ba..17b7fcc 100644
--- a/test/EmacLoopbackTest/test_utils_switch_k3.c
+++ b/test/EmacLoopbackTest/test_utils_switch_k3.c
@@ -60,7 +60,6 @@
60#include <ti/drv/emac/src/emac_osal.h> 60#include <ti/drv/emac/src/emac_osal.h>
61#include <ti/drv/emac/src/v5/emac_drv_v5.h> 61#include <ti/drv/emac/src/v5/emac_drv_v5.h>
62#include <ti/drv/emac/firmware/icss_switch/config/emac_fw_config_switch.h> 62#include <ti/drv/emac/firmware/icss_switch/config/emac_fw_config_switch.h>
63#include <ti/drv/emac/firmware/icss_dualmac/config/emac_fw_config_dual_mac.h>
64 63
65/* SOC Include Files. */ 64/* SOC Include Files. */
66#include <ti/drv/emac/soc/emac_soc_v5.h> 65#include <ti/drv/emac/soc/emac_soc_v5.h>
@@ -257,14 +256,34 @@ static volatile uint32_t timestamp_received = 1;
257/********************************************************************** 256/**********************************************************************
258 ****************** Test Configuration Variables ********************** 257 ****************** Test Configuration Variables **********************
259 **********************************************************************/ 258 **********************************************************************/
260
261
262#define APP_TEST_PKT_SEND_COUNT 16
263#define APP_TEST_MAX_PKT_SEND_SIZE 1500
264
265/* DO NOT CHANGE app_test_loopback_pkt_vlan UNLESS APP_TEST_PKT_SIZE IS UPDATED */ 259/* DO NOT CHANGE app_test_loopback_pkt_vlan UNLESS APP_TEST_PKT_SIZE IS UPDATED */
266#define APP_TEST_PKT_SIZE 64 260#define APP_TEST_PKT_SIZE 64
267uint8_t lclMac[EMAC_MAC_ADDR_LENTH] = {0x48, 0x93, 0xfe, 0xda, 0x16, 0x4a}; 261uint8_t lclMac[EMAC_MAC_ADDR_LENTH] = {0x48, 0x93, 0xfe, 0xda, 0x16, 0x4a};
262
263#ifdef EMAC_BENCHMARK
264#define APP_TEST_MAX_PKT_SEND_SIZE 1500
265#define APP_TEST_PKT_SEND_COUNT 500000
266
267static uint8_t app_test_loopback_pkt_vlan[APP_TEST_MAX_PKT_SEND_SIZE] = {
268 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // dest
269 0x48, 0x93, 0xfe, 0xfa, 0x18, 0x4a, // src
270 0x81, 0x00, 0x00,0x64, /* priority 0, 02 is vlanId */
271 0x08, 0x06, 0x00, 0x01,
272 0x08, 0x00, 0x06, 0x04,
273 0x00,0x01,0x01, 0xbb,
274 0xcc, 0xdd, 0xee, 0xff,
275 0xc0, 0xa8, 0x01, 0x16,
276 0x00, 0x00, 0x00, 0x00,
277 0xc0, 0xa8,0x01, 0x02,
278 0x01,0x02,0x03,0x04,
279 0x01,0x02,0x03,0x04,
280 0x01,0x02,0x03,0x04,
281 0x01,0x02,0x03,0x04,
282 0x01,0x02,0x03,0x04,
283 0xfe,0xfe, 0x00, 0x00
284};
285#else
286#define APP_TEST_PKT_SEND_COUNT 16
268static uint8_t app_test_loopback_pkt_vlan[APP_TEST_PKT_SIZE+4] = { 287static uint8_t app_test_loopback_pkt_vlan[APP_TEST_PKT_SIZE+4] = {
269 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // dest 288 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // dest
270 0x48, 0x93, 0xfe, 0xfa, 0x18, 0x4a, // src 289 0x48, 0x93, 0xfe, 0xfa, 0x18, 0x4a, // src
@@ -283,7 +302,7 @@ static uint8_t app_test_loopback_pkt_vlan[APP_TEST_PKT_SIZE+4] = {
283 0x01,0x02,0x03,0x04, 302 0x01,0x02,0x03,0x04,
284 0xfe,0xfe, 0x00, 0x00 303 0xfe,0xfe, 0x00, 0x00
285}; 304};
286 305#endif
287static uint8_t *pTestPkt = (uint8_t*)(&app_test_loopback_pkt_vlan[0]); 306static uint8_t *pTestPkt = (uint8_t*)(&app_test_loopback_pkt_vlan[0]);
288 307
289/********************************************************************** 308/**********************************************************************
@@ -640,29 +659,35 @@ int32_t app_test_vlan_ctrl_set_tbl_entry(uint32_t portNum, uint8_t fid, uint16_t
640 return retVal; 659 return retVal;
641} 660}
642 661
662#ifndef EMAC_BENCHMARK
663static uint32_t app_test_clone_count = 2;
664#else
643uint32_t app_test_send_fail = 0; 665uint32_t app_test_send_fail = 0;
644uint32_t app_test_alloc_fail = 0; 666uint32_t app_test_alloc_fail = 0;
645 667
668/******************************************************************************
669 * Function: EMAC test loopback packet
670 ******************************************************************************/
646/** 671/**
647 * @brief This function is used to loopback the pkt received to sender 672 * @brief This function is used to loopback the pkt received to sender
648 */ 673 */
649void app_test_loopback_pkts(uint32_t portNum, EMAC_PKT_DESC_T* pDesc) 674void app_test_loopback_pkt(uint32_t portNum, EMAC_PKT_DESC_T* pDesc)
650{ 675{
651 EMAC_DRV_ERR_E sentRetVal; 676 EMAC_DRV_ERR_E sentRetVal;
652 uint8_t* temp; 677 uint8_t* temp;
653 EMAC_PKT_DESC_T *p_pkt_desc = app_alloc_pkt(portNum, APP_EMAC_MAX_PKT_SIZE); 678 EMAC_PKT_DESC_T *p_pkt_desc = app_alloc_pkt(portNum, APP_EMAC_MAX_PKT_SIZE);
654 if (p_pkt_desc == NULL) 679 if (p_pkt_desc == NULL)
655 { 680 {
656 UART_printf("app_test_loopback_pkts: app alloc pkt failed\n"); 681 UART_printf("app_test_loopback_pkt: app alloc pkt failed\n");
657 app_test_alloc_fail++; 682 app_test_alloc_fail++;
658 } 683 }
659 else 684 else
660 { 685 {
661 temp = p_pkt_desc->pDataBuffer; // temp is now buffer 686 temp = p_pkt_desc->pDataBuffer; // temp is now buffer
662 687
663 p_pkt_desc->pDataBuffer = pDesc->pDataBuffer; 688 p_pkt_desc->pDataBuffer = pDesc->pDataBuffer;
664 pDesc->pDataBuffer = temp; 689 pDesc->pDataBuffer = temp;
665 690
666 p_pkt_desc->AppPrivate = (uint32_t)p_pkt_desc; 691 p_pkt_desc->AppPrivate = (uint32_t)p_pkt_desc;
667 p_pkt_desc->ValidLen = pDesc->PktLength-4; 692 p_pkt_desc->ValidLen = pDesc->PktLength-4;
668 p_pkt_desc->DataOffset = 0; 693 p_pkt_desc->DataOffset = 0;
@@ -672,8 +697,6 @@ void app_test_loopback_pkts(uint32_t portNum, EMAC_PKT_DESC_T* pDesc)
672 p_pkt_desc->pPrev = NULL; 697 p_pkt_desc->pPrev = NULL;
673 p_pkt_desc->PktChannel = 0; 698 p_pkt_desc->PktChannel = 0;
674 p_pkt_desc->PktLength = pDesc->PktLength-4; 699 p_pkt_desc->PktLength = pDesc->PktLength-4;
675
676
677 sentRetVal = emac_send(portNum, p_pkt_desc); 700 sentRetVal = emac_send(portNum, p_pkt_desc);
678 if(sentRetVal != EMAC_DRV_RESULT_OK) 701 if(sentRetVal != EMAC_DRV_RESULT_OK)
679 { 702 {
@@ -682,8 +705,8 @@ void app_test_loopback_pkts(uint32_t portNum, EMAC_PKT_DESC_T* pDesc)
682 } 705 }
683 } 706 }
684} 707}
708#endif
685 709
686static uint32_t app_test_clone_count = 2;
687 710
688/** 711/**
689 * @brief This function is used to call back the network application when a 712 * @brief This function is used to call back the network application when a
@@ -691,6 +714,7 @@ static uint32_t app_test_clone_count = 2;
691 */ 714 */
692void app_test_rx_pkt_cb(uint32_t port_num, EMAC_PKT_DESC_T* p_desc) 715void app_test_rx_pkt_cb(uint32_t port_num, EMAC_PKT_DESC_T* p_desc)
693{ 716{
717#ifndef EMAC_BENCHMARK
694 if (p_desc->AppPrivate) 718 if (p_desc->AppPrivate)
695 { 719 {
696 if (memcmp(p_desc->pDataBuffer, pTestPkt, APP_TEST_PKT_SIZE) == 0) 720 if (memcmp(p_desc->pDataBuffer, pTestPkt, APP_TEST_PKT_SIZE) == 0)
@@ -722,6 +746,17 @@ void app_test_rx_pkt_cb(uint32_t port_num, EMAC_PKT_DESC_T* p_desc)
722 } 746 }
723 } 747 }
724 pkt_rcv_count++; 748 pkt_rcv_count++;
749#else
750 if (p_desc->AppPrivate != 0U)
751 {
752 if (port_num != 6)
753 app_test_loopback_pkt(EMAC_SWITCH_PORT1,p_desc);
754
755 app_free_pkt(port_num, (EMAC_PKT_DESC_T*) p_desc->AppPrivate);
756 pkt_received = 1;
757 }
758 pkt_rcv_count++;
759#endif
725} 760}
726 761
727/** 762/**
@@ -818,9 +853,15 @@ void app_test_task_poll_pkt (UArg arg0, UArg arg1)
818void app_test_task_poll_ctrl (UArg arg0, UArg arg1) 853void app_test_task_poll_ctrl (UArg arg0, UArg arg1)
819{ 854{
820 uint32_t port = (uint32_t) arg0; 855 uint32_t port = (uint32_t) arg0;
821 uint32_t mgmtRings =0x7; 856#ifndef EMAC_BENCHMARK
822 uint32_t pktRings = 0x1ff; 857 uint32_t mgmtRings =EMAC_POLL_RX_MGMT_RING_ALL;
823 uint32_t txRings = 0xf; 858 uint32_t pktRings = EMAC_POLL_RX_PKT_RING_ALL;
859 uint32_t txRings = EMAC_POLL_TX_COMPLETION_RING_ALL;
860#else
861 uint32_t mgmtRings =EMAC_POLL_RX_MGMT_RING_ALL;
862 uint32_t pktRings = EMAC_POLL_RX_PKT_RING1 | EMAC_POLL_RX_PKT_RING2;
863 uint32_t txRings = EMAC_POLL_TX_COMPLETION_RING1;
864#endif
824 while(initComplete == 0) 865 while(initComplete == 0)
825 { 866 {
826 Task_sleep(1); 867 Task_sleep(1);
@@ -839,67 +880,79 @@ void app_test_task_poll_ctrl (UArg arg0, UArg arg1)
839 880
840static int32_t emac_send_fail = 0; 881static int32_t emac_send_fail = 0;
841 882
842int32_t app_test_send(uint32_t port_num, uint8_t* pPkt, uint32_t pktChannel, uint32_t pktSize, uint8_t tx_ts_req) 883int32_t app_test_send(uint32_t port_num, uint8_t* pPkt, uint32_t pktChannel, uint32_t pktSize, uint8_t txTsReq)
843{ 884{
844 uint32_t i; 885 uint32_t i;
845 static uint32_t pkt_send_count =0; 886 static uint32_t pkt_send_count =0;
846 EMAC_DRV_ERR_E sentRetVal; 887 EMAC_DRV_ERR_E sentRetVal;
847 uint32_t fail_count = 0; 888
848 for (i = 0; i < APP_TEST_PKT_SEND_COUNT; i++) 889 for (i = 0; i < APP_TEST_PKT_SEND_COUNT; i++)
849 { 890 {
850 fail_count = 0; 891 uint32_t fail_count = 0;
851 892 fail_count = fail_count;
852 EMAC_PKT_DESC_T *p_pkt_desc = app_alloc_pkt(port_num, pktSize); 893 EMAC_PKT_DESC_T *p_pkt_desc = app_alloc_pkt(port_num, pktSize);
853 if (p_pkt_desc == NULL) 894 if (p_pkt_desc == NULL)
854 { 895 {
855 UART_printf("app_test_send: app alloc pkt failed\n"); 896 UART_printf("app_test_send: app alloc pkt failed\n");
856 while(1); 897 Task_sleep(50);
857 }
858 memcpy (p_pkt_desc->pDataBuffer, pPkt, pktSize);
859 p_pkt_desc->AppPrivate = (uint32_t)p_pkt_desc;
860
861 if (tx_ts_req)
862 {
863 /* To test TX timestamp, enable the follwing 3 lines */
864 p_pkt_desc->Flags = EMAC_PKT_FLAG_TX_TS_REQ;
865 p_pkt_desc->TxtimestampId = port_num + i;
866 timestamp_received = 0;
867 } 898 }
868 else 899 else
869 { 900 {
870 p_pkt_desc->Flags = 0; 901 memcpy (p_pkt_desc->pDataBuffer, pPkt, pktSize);
871 } 902 p_pkt_desc->AppPrivate = (uint32_t)p_pkt_desc;
872 p_pkt_desc->TxPktTc = i % 8;
873 p_pkt_desc->ValidLen = pktSize;
874 p_pkt_desc->DataOffset = 0;
875 p_pkt_desc->PktLength = pktSize;
876 p_pkt_desc->PktFrags = 1;
877 p_pkt_desc->pNext = NULL;
878 p_pkt_desc->pPrev = NULL;
879 p_pkt_desc->PktChannel = i % 4;
880 p_pkt_desc->PktLength = pktSize;
881 903
882 sentRetVal = emac_send(port_num, p_pkt_desc); 904 if (txTsReq)
883 if(sentRetVal != EMAC_DRV_RESULT_OK) 905 {
884 { 906 /* To test TX timestamp, enable the follwing 3 lines */
885 UART_printf("app_test_send: emac send on port failed with status: : %d: retVal %d, pkt_count: %d\n", port_num, sentRetVal, i+1); 907 p_pkt_desc->Flags = EMAC_PKT_FLAG_TX_TS_REQ;
886 app_free_pkt(port_num,p_pkt_desc); 908 p_pkt_desc->TxtimestampId = port_num + i;
887 emac_send_fail++; 909 timestamp_received = 0;
888 } 910 }
911 else
912 {
913 p_pkt_desc->Flags = 0;
914 }
915#ifndef EMAC_BENCHMARK
916 p_pkt_desc->TxPktTc = i % 8;
917 p_pkt_desc->PktChannel = i % 4;
918#else
919 p_pkt_desc->TxPktTc = 0;
920 p_pkt_desc->PktChannel = 0;
921#endif
922 p_pkt_desc->ValidLen = pktSize;
923 p_pkt_desc->DataOffset = 0;
924 p_pkt_desc->PktLength = pktSize;
925 p_pkt_desc->PktFrags = 1;
926 p_pkt_desc->pNext = NULL;
927 p_pkt_desc->pPrev = NULL;
928 p_pkt_desc->PktLength = pktSize;
889 929
890 while((pkt_received == 0) || (timestamp_received == 0)) 930 sentRetVal = emac_send(port_num, p_pkt_desc);
891 { 931 if(sentRetVal != EMAC_DRV_RESULT_OK)
892 fail_count++;
893 Task_sleep(100);
894 if (fail_count == 5)
895 { 932 {
896 pkt_received = 1; 933 UART_printf("app_test_send: emac send on port failed with status: : %d: retVal %d, pkt_count: %d\n", port_num, sentRetVal, i+1);
934 app_free_pkt(port_num,p_pkt_desc);
935 emac_send_fail++;
936 Task_sleep(50);
897 } 937 }
938#ifndef EMAC_BENCHMARK
939 {
940 while((pkt_received == 0) || (timestamp_received == 0))
941 {
942 fail_count++;
943 Task_sleep(100);
944 if (fail_count == 5)
945 {
946 pkt_received = 1;
947 }
948 }
949 }
950#endif
951 pkt_received = 0;
952 pkt_send_count++;
898 } 953 }
899 pkt_received = 0;
900 pkt_send_count++;
901 } 954 }
902 return fail_count; 955 return 0;
903} 956}
904 957
905void app_test_tx_chans(void) 958void app_test_tx_chans(void)
@@ -952,6 +1005,54 @@ int32_t app_test_configure_default_prio_regen_tbl(uint32_t port_num)
952 return retVal; 1005 return retVal;
953} 1006}
954 1007
1008int32_t app_test_configure_cut_through_or_prempt_select_ctrl(uint32_t port_num)
1009{
1010 int32_t queue_num;
1011 int32_t retVal = 0;
1012 EMAC_IOCTL_PARAMS params;
1013 EMAC_IOCTL_PREMPT_OR_CUT_THROUGH_MAP entry;
1014 uint8_t temp_byte;
1015 uintptr_t expressPremptiveQueueAddr;
1016
1017 memset(&entry, 0, sizeof(EMAC_IOCTL_PREMPT_OR_CUT_THROUGH_MAP));
1018
1019 for (queue_num = 0; queue_num < EMAC_IOCTL_PRIO_MAX; queue_num++)
1020 {
1021 entry.pcpPreemptMap[queue_num] = queue_num;
1022 entry.pcpCutThroughMap[queue_num] = queue_num;
1023 }
1024
1025 params.ioctlVal = (void*)&entry;
1026 retVal = emac_ioctl(port_num,EMAC_IOCTL_CUT_THROUGH_PREEMPT_SELECT,&params);
1027
1028 /* now just read the value back */
1029 if (retVal == 0)
1030 {
1031 EMAC_socGetInitCfg(0, &app_emac_cfg);
1032 if (port_num == EMAC_SWITCH_PORT1)
1033 {
1034 expressPremptiveQueueAddr = app_emac_cfg.portCfg[0].icssDram0BaseAddr+ EXPRESS_PRE_EMPTIVE_Q_MAP;
1035 }
1036 else
1037 {
1038 expressPremptiveQueueAddr = app_emac_cfg.portCfg[2].icssDram0BaseAddr+ EXPRESS_PRE_EMPTIVE_Q_MAP;
1039 }
1040 for (queue_num = 0; queue_num < EMAC_IOCTL_PRIO_MAX; queue_num++)
1041 {
1042 //temp_byte = (entry->pcpPreemptMap[queue_num] << 4) | (entry->pcpCutThroughMap[queue_num] << 7); /*as per bit order in descriptor flags. Helps save PRU cycles*/
1043 temp_byte = CSL_REG8_RD(expressPremptiveQueueAddr+(queue_num*4));
1044 temp_byte = (temp_byte &0x70)>> 4;
1045 UART_printf("app_test_configure_cut_through_or_prempt_select_ctrl: port_num: %d, addr: 0x%x, value: 0x%x\n",
1046 port_num, expressPremptiveQueueAddr,
1047 temp_byte);
1048 if (entry.pcpPreemptMap[queue_num] != temp_byte)
1049 retVal = -1;
1050 }
1051 }
1052
1053 return retVal;
1054}
1055
955void app_test_port_priority(void) 1056void app_test_port_priority(void)
956{ 1057{
957 uint8_t pcp; 1058 uint8_t pcp;
@@ -1009,7 +1110,6 @@ EMAC_DRV_ERR_E app_test_flood_ctrl(void)
1009 return status; 1110 return status;
1010} 1111}
1011 1112
1012
1013void app_test_pkt_clone(void) 1113void app_test_pkt_clone(void)
1014{ 1114{
1015 UART_printf("app_test_pkt_clone: BEGIN\n"); 1115 UART_printf("app_test_pkt_clone: BEGIN\n");
@@ -1019,11 +1119,10 @@ void app_test_pkt_clone(void)
1019 1119
1020} 1120}
1021 1121
1022
1023void app_test_local_injection(void) 1122void app_test_local_injection(void)
1024{ 1123{
1025 EMAC_STATISTICS_ICSSG_T stats; 1124 EMAC_STATISTICS_ICSSG_T stats;
1026 UART_printf("app_test_new_pkt: BEGIN\n"); 1125 UART_printf("app_test_local_injection: BEGIN\n");
1027 pTestPkt = (uint8_t*)(&app_test_loopback_pkt_vlan[0]); 1126 pTestPkt = (uint8_t*)(&app_test_loopback_pkt_vlan[0]);
1028 1127
1029 app_test_send(EMAC_SWITCH_PORT1, pTestPkt, 0, APP_TEST_PKT_SIZE+4,0); 1128 app_test_send(EMAC_SWITCH_PORT1, pTestPkt, 0, APP_TEST_PKT_SIZE+4,0);
@@ -1044,7 +1143,7 @@ void app_test_local_injection(void)
1044 gTestFailCount++; 1143 gTestFailCount++;
1045 } 1144 }
1046 1145
1047 UART_printf("app_test_new_pkt: END\n"); 1146 UART_printf("app_test_local_injection: END\n");
1048} 1147}
1049 1148
1050 1149
@@ -1176,12 +1275,6 @@ int32_t app_test_send_receive(uint32_t startP, uint32_t endP, uint32_t displayRe
1176 return status; 1275 return status;
1177} 1276}
1178 1277
1179#define TX_BUFF_POOL_SIZE 0X1800u
1180#define TX_BUFF_POOL_TOTAL_DUAL_MAC (TX_BUFF_POOL_SIZE + 0x80) * 8U /* //50176 per PORT, total of 100352 */
1181
1182
1183
1184
1185void app_test_setup_fw_switch(uint32_t port_num, EMAC_HwAttrs_V5 *pEmacCfg) 1278void app_test_setup_fw_switch(uint32_t port_num, EMAC_HwAttrs_V5 *pEmacCfg)
1186{ 1279{
1187 EMAC_FW_APP_CONFIG *pFwAppCfg; 1280 EMAC_FW_APP_CONFIG *pFwAppCfg;
@@ -1221,6 +1314,12 @@ int32_t app_test_emac_open_switch(uint32_t mode)
1221 if (!port_en[port_num]) 1314 if (!port_en[port_num])
1222 continue; 1315 continue;
1223 1316
1317#ifdef EMAC_BENCHMARK
1318 app_emac_cfg.portCfg[port_num].nTxChans = 1;
1319 app_emac_cfg.portCfg[port_num].rxChannel.nsubChan = 2;
1320 app_emac_cfg.portCfg[port_num].rxChannelCfgOverPSI.nsubChan= 3;
1321 app_emac_cfg.portCfg[port_num].rxChannel2CfgOverPSI.nsubChan= 3;
1322#endif
1224 1323
1225 for (chanNum = 0; chanNum < app_emac_cfg.portCfg[port_num].nTxChans; chanNum++) 1324 for (chanNum = 0; chanNum < app_emac_cfg.portCfg[port_num].nTxChans; chanNum++)
1226 { 1325 {
@@ -1303,8 +1402,13 @@ int32_t app_test_emac_open_switch(uint32_t mode)
1303 app_open_cfg.tx_ts_cb = app_test_ts_response_cb; 1402 app_open_cfg.tx_ts_cb = app_test_ts_response_cb;
1304 app_open_cfg.drv_trace_cb = app_test_trace_cb; 1403 app_open_cfg.drv_trace_cb = app_test_trace_cb;
1305 app_open_cfg.loop_back = 0U; 1404 app_open_cfg.loop_back = 0U;
1306 app_open_cfg.num_of_rx_pkt_desc = 8; 1405#ifndef EMAC_BENCHMARK
1307 app_open_cfg.num_of_tx_pkt_desc = 8; 1406 app_open_cfg.num_of_rx_pkt_desc = 8U;
1407 app_open_cfg.num_of_tx_pkt_desc = 8U;
1408#else
1409 app_open_cfg.num_of_rx_pkt_desc = 128U;
1410 app_open_cfg.num_of_tx_pkt_desc = 128U;
1411#endif
1308 app_open_cfg.master_core_flag = 1; 1412 app_open_cfg.master_core_flag = 1;
1309 app_open_cfg.max_pkt_size = APP_EMAC_MAX_PKT_SIZE; 1413 app_open_cfg.max_pkt_size = APP_EMAC_MAX_PKT_SIZE;
1310 app_open_cfg.mdio_flag = 1; 1414 app_open_cfg.mdio_flag = 1;
@@ -1417,32 +1521,6 @@ void app_test_udma_init(void)
1417 gDrvHandle = &gUdmaDrvObj; 1521 gDrvHandle = &gUdmaDrvObj;
1418 } 1522 }
1419} 1523}
1420void app_test_check_port_link(uint32_t startP, uint32_t endP)
1421{
1422 uint32_t port_num;
1423 EMAC_LINK_INFO_T linkInfo;
1424
1425 for (port_num = startP; port_num <= endP; port_num++)
1426 {
1427 if (!port_en[port_num])
1428 continue;
1429 if (1 == interposerCardPresent)
1430 {
1431 if((port_num == 2) || (port_num == 3))
1432 continue;
1433 }
1434 memset(&linkInfo, 0, sizeof(EMAC_LINK_INFO_T));
1435 do
1436 {
1437 emac_poll(port_num, &linkInfo);
1438 Osal_delay(100);
1439 UART_printf("Link for port %d is DOWN\n", port_num);
1440 } while(linkInfo.link_status == EMAC_LINKSTATUS_NOLINK);
1441 UART_printf("Link for port %d is now UP\n", port_num);
1442 }
1443
1444}
1445
1446 1524
1447void app_test_check_port_link_switch(uint32_t portNum) 1525void app_test_check_port_link_switch(uint32_t portNum)
1448{ 1526{
@@ -1452,10 +1530,10 @@ void app_test_check_port_link_switch(uint32_t portNum)
1452 do 1530 do
1453 { 1531 {
1454 emac_poll(portNum, &linkInfo); 1532 emac_poll(portNum, &linkInfo);
1455 Osal_delay(100); 1533 Task_sleep(100);
1456 UART_printf("Link for port %d is DOWN\n", portNum); 1534 UART_printf("Link for port %d is DOWN\n", portNum);
1457 } while(linkInfo.link_status == EMAC_LINKSTATUS_NOLINK); 1535 } while(linkInfo.link_status == EMAC_LINKSTATUS_NOLINK);
1458 UART_printf("Link for port %d is now UP\n", portNum); 1536 UART_printf("Link for port %d is now UP, change: %d, link status: %d\n", portNum, linkInfo.link_status_change, linkInfo.link_status);
1459} 1537}
1460 1538
1461void app_test_port_set_state(uint32_t portNum, uint8_t state) 1539void app_test_port_set_state(uint32_t portNum, uint8_t state)
@@ -1469,9 +1547,11 @@ void app_test_port_set_state(uint32_t portNum, uint8_t state)
1469} 1547}
1470 1548
1471 1549
1472 1550#ifdef EMAC_BENCHMARK
1551uint32_t app_test_start_send = 1;
1473void app_test_task_benchmark(UArg arg0, UArg arg1) 1552void app_test_task_benchmark(UArg arg0, UArg arg1)
1474{ 1553{
1554 uint32_t port = (uint32_t) arg0;
1475 Board_STATUS boardInitStatus =0; 1555 Board_STATUS boardInitStatus =0;
1476 PRUICSS_Config *prussCfg; 1556 PRUICSS_Config *prussCfg;
1477 SemaphoreP_Params emac_app_test_sem_params; 1557 SemaphoreP_Params emac_app_test_sem_params;
@@ -1514,25 +1594,29 @@ void app_test_task_benchmark(UArg arg0, UArg arg1)
1514 UART_printf("app_test_emac_open failed\n"); 1594 UART_printf("app_test_emac_open failed\n");
1515 } 1595 }
1516 initComplete = 1; 1596 initComplete = 1;
1517 app_test_check_port_link_switch(EMAC_SWITCH_PORT1); 1597 app_test_check_port_link_switch(port);
1518 app_test_check_port_link_switch(EMAC_SWITCH_PORT2);
1519 1598
1520 /*Set up default setting for test app */ 1599 /*Set up default setting for test app */
1521 app_test_setup_default_settings(); 1600 app_test_setup_default_settings();
1522 1601
1523 /*Set port state to Forward*/ 1602 /*Set port state to Forward*/
1524 app_test_port_set_state(EMAC_SWITCH_PORT1,EMAC_IOCTL_PORT_STATE_FORWARD); 1603 app_test_port_set_state(port,EMAC_IOCTL_PORT_STATE_FORWARD);
1525 app_test_port_set_state(EMAC_SWITCH_PORT2,EMAC_IOCTL_PORT_STATE_FORWARD);
1526 1604
1527 /* Verify local injection using loopback connection between SW1 and SW2 */ 1605 Task_sleep(2000);
1528 app_test_local_injection();
1529 1606
1530 /* Verify Port Priority by sending packets with different PCP to ensure recieved on correct flow/ring pair*/ 1607 pTestPkt = (uint8_t*)(&app_test_loopback_pkt_vlan[0]);
1531 app_test_port_priority();
1532
1533 while(1);
1534}
1535 1608
1609 while (1)
1610 {
1611 if (app_test_start_send == 1)
1612 {
1613 app_test_send(port, pTestPkt, 0, APP_TEST_MAX_PKT_SEND_SIZE,0);
1614 app_test_start_send = 0;
1615 }
1616 Task_sleep(5000);
1617 }
1618}
1619#else
1536void app_test_task_verify_ut_switch(UArg arg0, UArg arg1) 1620void app_test_task_verify_ut_switch(UArg arg0, UArg arg1)
1537{ 1621{
1538 Board_STATUS boardInitStatus =0; 1622 Board_STATUS boardInitStatus =0;
@@ -1608,6 +1692,10 @@ void app_test_task_verify_ut_switch(UArg arg0, UArg arg1)
1608 /* Port port control ioctl verification */ 1692 /* Port port control ioctl verification */
1609 app_test_verify_port_ctrl_ioctl(); 1693 app_test_verify_port_ctrl_ioctl();
1610 1694
1695 /* Cut through/prempt select ioctl verification */
1696 app_test_configure_cut_through_or_prempt_select_ctrl(EMAC_SWITCH_PORT1);
1697 app_test_configure_cut_through_or_prempt_select_ctrl(EMAC_SWITCH_PORT2);
1698
1611 emac_close(EMAC_SWITCH_PORT); 1699 emac_close(EMAC_SWITCH_PORT);
1612 1700
1613 if (gTestFailCount == 0) 1701 if (gTestFailCount == 0)
@@ -1623,6 +1711,7 @@ void app_test_task_verify_ut_switch(UArg arg0, UArg arg1)
1623 Task_sleep(1000); 1711 Task_sleep(1000);
1624 } 1712 }
1625} 1713}
1714#endif
1626 1715
1627/* 1716/*
1628 * ======== app_test_task_init_pruicss======== 1717 * ======== app_test_task_init_pruicss========
@@ -2011,3 +2100,5 @@ int32_t app_test_setup_default_settings()
2011 return retVal; 2100 return retVal;
2012} 2101}
2013 2102
2103
2104
diff --git a/test/Module.xs b/test/Module.xs
index e0c9c32..08db6e9 100644
--- a/test/Module.xs
+++ b/test/Module.xs
@@ -84,12 +84,16 @@ function modBuild()
84 Pkg.otherFiles[Pkg.otherFiles.length++] = documentFiles[k]; 84 Pkg.otherFiles[Pkg.otherFiles.length++] = documentFiles[k];
85 } 85 }
86 86
87
88 var documentFiles = libUtility.listAllFiles ("makefile_switch", "./test"); 87 var documentFiles = libUtility.listAllFiles ("makefile_switch", "./test");
89 for (var k = 0 ; k < documentFiles.length; k++) { 88 for (var k = 0 ; k < documentFiles.length; k++) {
90 Pkg.otherFiles[Pkg.otherFiles.length++] = documentFiles[k]; 89 Pkg.otherFiles[Pkg.otherFiles.length++] = documentFiles[k];
91 } 90 }
92 91
92 var documentFiles = libUtility.listAllFiles ("makefile_switch_benchmark", "./test");
93 for (var k = 0 ; k < documentFiles.length; k++) {
94 Pkg.otherFiles[Pkg.otherFiles.length++] = documentFiles[k];
95 }
96
93 var documentFiles = libUtility.listAllFiles (".cdtbuild", "./test"); 97 var documentFiles = libUtility.listAllFiles (".cdtbuild", "./test");
94 for (var k = 0 ; k < documentFiles.length; k++) { 98 for (var k = 0 ; k < documentFiles.length; k++) {
95 Pkg.otherFiles[Pkg.otherFiles.length++] = documentFiles[k]; 99 Pkg.otherFiles[Pkg.otherFiles.length++] = documentFiles[k];