trident3_power_test.c (3148B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 * 7 * The l3uc test checks TDM and L3 unicast functionality and performance by 8 * streaming IPv4 packets on all ports at maximum rate. All ports are 9 * configured in MAC loopback mode and each port is paired with a same speed 10 * port. The test calculates the number of packets needed to saturate the ports 11 * and send the IPv4 packets from the CPU to each port pairs initially. 12 * Then the packets are L3 switched between the port pairs indefinitely. The 13 * MAC DA, MAC SA, and VLAN are changed every time a packet is L3 switched. Once 14 * the traffic reaches steady state, rate calculation is done by dividing the 15 * transmit packet count changes and transmit byte count changes over a 16 * programmable interval. The rates are checked against expected rates based on 17 * port configuration and oversubscription ratio. Finally, packet integrity 18 * check is achieved by redirecting the packets back to the CPU and compared 19 * against expected packets. 20 * 21 * Configuration parameters passed from CLI: 22 * PktSize: Packet size in bytes. Set to 0 for worst case packet sizes on all 23 * ports (145B for ENET, 76B for HG2). Set to 1 for random packet sizes 24 * FloodCnt: Number of packets in each swill. Setting this to 0 will let the 25 * test calculate the number of packets that can be sent to achieve 26 * a lossless swirl at full rate. Set to 0 by default. 27 * RateCalcInt: Interval in seconds over which rate is to be calculated 28 * TolLr: Rate tolerance percentage for linerate ports (1% by default). 29 * TolOv: Rate tolerance percentage for oversubscribed ports (3% by default). 30 * ChkPktInteg: Set to 0 to disable packet integrity checks, 1 to enable 31 (default). 32 * MaxNumCells: Max number of cells for random packet sizes. Default = 4. Set 33 * to 0 for random. 34 * TrafficLoad: Percentage of traffic load are allowed to pass through based on 35 * port speed. 36 * VfpEnable: Enable Vfp and fill it with miss entries. 37 * EfpEnable: Enable Efp and fill it with miss entries. 38 * VfpMatch: Program a hit entry in Vfp. 39 * EfpMatch: Program a hit entry in Efp. 40 * L3EcmpEnable: Enable ecmp for l3 routing. 41 */ 42 43 #include <appl/diag/system.h> 44 #include <shared/alloc.h> 45 #include <shared/bsl.h> 46 47 #include <soc/cm.h> 48 #include <soc/dma.h> 49 #include <soc/drv.h> 50 #include <soc/dcb.h> 51 #include <soc/cmicm.h> 52 #include <soc/cmic.h> 53 54 #include <sal/types.h> 55 #include <appl/diag/parse.h> 56 #include <bcm/port.h> 57 #include <bcm/vlan.h> 58 59 #include "testlist.h" 60 #include "gen_pkt.h" 61 #include "streaming_lib.h" 62 63 #define RMAC_ADDR {0x00, 0x11, 0x40, 0x88, 0x00, 0xff} 64 #define MAC_BASE {0x00, 0x11, 0x40, 0x88, 0x00, 0xff} 65 #define MAC_DA {0x00, 0x11, 0x40, 0x88, 0x00, 0xff} 66 #define MAC_SA {0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54} 67 #define VLAN 0x0a00 68 #define TTL 255 69 #define IPV4_ADDR 0xc0a80001 70 #define IPV6_ADDR { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 71 0x00, 0x00, 0x00, 0x00, 0xc0, 0xa8, 0x00, 0x01 }; 72