This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I have posted an issue of packet loss in Linux forum. But the issue is not in linux kernel, the real issue is packet missing at ARM CPU. So, I am moving the question to Keystone forum. Please find the copy of post from linux.
We are having custom board based on 66AK2H06. We are losing UDP packets between two custom boards. Port 0 is interfaced to FPGA which in turn is connected to backplane. The two custom boards talk to each other over backplane. One of the application from board 1 sends bursty traffic less than 50Mbps. We see that the packets are lost. There are no RcvBuf errors and InErrors reported in linux kernel.
No errors seen in CPSW statistics as seen by following command.
ethtool -S eth0
There are no drops seen in any of the socket Qs when observed using
cat /proc/net/udp.
We have a FPGA probe which monitors the sequence number of the packets for all the ports. When the packet loss happens, we do not see any packet lost until the FPGA nor in Linux. The packets are dropped somewhere between FPGA and CPU. Is that possible to get additional debug information on the switch statistics.
Is there any additional configuration required for CPSW ?
We are trying to send UDP traffic using iperf and the FPGA in Board 2 (Receiver Board) is probing the incoming UDP traffic on port 5001. The FPGA probe counter sees all the packets at the receiving end. But the packets are lost at CPU and not seen in Linux.
Please see below the log from iperf, netstat and FPGA probe.
~ $ iperf3 -c 192.168.0.104 -u -b 200M -l 1500 -p 5001
Connecting to host 192.168.0.104, port 5001
[ 4] local 192.168.0.102 port 58203 connected to 192.168.0.104 port 5001
[ ID] Interval Transfer Bandwidth Total Datagrams
[ 4] 0.00-1.00 sec 21.5 MBytes 181 Mbits/sec 15063
[ 4] 1.00-2.00 sec 24.9 MBytes 209 Mbits/sec 17426
[ 4] 2.00-3.00 sec 22.7 MBytes 191 Mbits/sec 15899
[ 4] 3.00-4.00 sec 25.4 MBytes 213 Mbits/sec 17760
[ 4] 4.00-5.00 sec 22.9 MBytes 192 Mbits/sec 16039
[ 4] 5.00-6.00 sec 25.3 MBytes 212 Mbits/sec 17656
[ 4] 6.00-7.00 sec 22.5 MBytes 189 Mbits/sec 15748
[ 4] 7.00-8.00 sec 23.9 MBytes 201 Mbits/sec 16739
[ 4] 8.00-9.00 sec 23.4 MBytes 197 Mbits/sec 16380
[ 4] 9.00-10.00 sec 23.5 MBytes 197 Mbits/sec 16435
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 4] 0.00-10.00 sec 236 MBytes 198 Mbits/sec 0.022 ms 4096/165145 (2.5%)
[ 4] Sent 165145 datagrams
iperf Done.
################## Board 1 Receiver: ###############################
~ $ netstat.arm -s
Ip:
1421153 total packets received
0 forwarded
0 incoming packets discarded
1097051 incoming packets delivered
590165 requests sent out
173 fragments dropped after timeout
647641 reassemblies required
323539 packets reassembled ok
563 packet reassembles failed
Icmp:
67 ICMP messages received
0 input ICMP message failed.
InCsumErrors: 0
ICMP input histogram:
destination unreachable: 67
416 ICMP messages sent
0 ICMP messages failed
ICMP output histogram:
destination unreachable: 397
time exceeded: 19
IcmpMsg:
InType3: 67
OutType3: 397
OutType11: 19
Tcp:
5 active connections openings
6 passive connection openings
1 failed connection attempts
3 connection resets received
6 connections established
17357 segments received
20548 segments send out
0 segments retransmited
0 bad segments received.
1 resets sent
InCsumErrors: 0
Udp:
1053123 packets received
103635 packets to unknown port received.
0 packet receive errors
569302 packets sent
RcvbufErrors: 0
SndbufErrors: 0
InCsumErrors: 0
UdpLite:
InDatagrams: 0
NoPorts: 0
InErrors: 0
OutDatagrams: 0
RcvbufErrors: 0
SndbufErrors: 0
InCsumErrors: 0
error parsing /proc/net/snmp: Success
################# FPGA status ####################
Status 32769: "Packet loss monitor"
* Timestamp : 2015-09-10 14:01:46.614067
Packet cnt. : 165146
Hello,
I switched my kernel version from 3.10.72 which uses NetCP PA firmware rev 3.0.1.3 to an older kernel version which uses NetCP PA firmware rev 3.0.1.2 and repeated iperf test with different bandwidth.
The test results with NetCP PA firmware rev 3.0.1.2 showed better results than 3.0.1.3 in terms of percentage drops from 15% to 0.6%. But then, this issue is different from what I have reported earlier. Here the packet drops are in Linux kernel with RcvbufErrors. The RcvbufErrors increases if the UDP packet are smaller.
iperf3 -c 192.168.0.104 -u -b 800M -l 600
reports 30% loss whereas
iperf3 -c 192.168.0.104 -u -b 800M
reports 0.22% loss.
These packet drops are in kernel with rcvBuf errors.
The idea was to test older NetCP PA firmware rev 3.0.1.2 to rule out any issue with NetCP firmware. But before that, kindly clarify whether any wrong packet streaming interface configuration can introduce packet drops. If so, how can we check the packet drop counts at PA?
Could you please clarify my previous posts also?
Thanks
Rams
We are running our custom application on our custom boards. We have some PA configuration to forward some traffic to the DSP cores.
I switched my kernel version from 3.10.72 which uses NetCP PA firmware rev 3.0.1.3 to an older kernel version which uses NetCP PA firmware rev 3.0.1.2 and repeated iperf test with different bandwidth.
Rams,
See the device tree binding documentation in /Documentation/devicetree/bindings/keystone-net.txt of your Linux source. This document explains that these device tree settings are configuring the the number of descriptors in each receive queue as well as the size of the descriptors in each queue. Your new settings are increasing the number of descriptors in the two receive queues of interface 0 from 128 descriptors to 512 descriptors. Since this alleviates your dropping issue I'm led to believe that the packets were getting dropped (after being passed up all the way to the NETCP PKTDMA) due to your host core being too slow to service the incoming packets without overwhelming the 128 descriptor buffer.
The path of a packet coming into the device is:
RX at external Ethernet port -> Forwarded to host port 0 -> sent to the PA for classification -> sent to the NETCP PKTDMA -> data copied into a descriptor buffer and the buffer is placed on the RX queue -> OS or host core consumes the buffer from the RX queue -> OS or host core returns the buffer to be used again.
It appears that your packets were making it all the way up to the 'copy into a descriptor buffer' step and then when a descriptor/buffer wasn't available the packet was dropped. This is why the switch statistics weren't showing any dropped packets (only the first two steps above are handled by the switch) because from its perspective the packets were passed up the chain to the PA with no errors.
Jason Reeder
Hi Jason Reeder,
Thanks a lot.
You indicated that the core/OS is slow in consuming packets. Here, the Linux network stack has to handle the packets and the network drivers are running in kernel context which has higher priority. If the applications are slow in handling the packets, it will be dropped anyway by the kernel. The issue is that the packets did not reach kernel. Our assumption is that with default NETCP configuration, the packets should arrive network stack and should not be dropped in PA even during full load. Dont you think this will be a general issue for all running linux on K2H when there are burst traffic with RX FDQ queue size as 128 in PA. Our system was running with appox 10% load. There were burst of packets in our system. We enabled flow control and checked for pause frame counters. But the bandwidth was around 300M. and we have MAC-MAC link (No MDIO). When switch is able to handle the burst traffic which was less than half of the maximum bandwidth of 1G, I guess, the PA RX FDQ size should be large enough to handle the maximum bandwidth of the link. I had raised this question in this post already which was not answered. If the RX queue size is 128, is that large enough to handle 1G of bandwidth with burst packet inflow?
I have also asked on how to dump PA statistics. Are there any counters that would point to us if there are packets drops in PA for what so ever reason. We tried reading C1 and C2 statistics using the PA API paSysStats_t..
None of these counters classify1.nIpDepthOverflow, classify1.nSilentDiscard, classify2.nSilentDiscard indicated drops at PA
Can you point to me to the register which will indicate the packet drops in PA for this issue.
It will be very useful if TI clarifies all the queries.
Thanks
Rams
Rams,
Please see Figure 1-1 in section 1.4 of the NetCP User Guide (http://www.ti.com/lit/ug/sprugz6/sprugz6.pdf). The descriptors/buffers that you are modifying using the device tree would be to the left of the PKTDMA, completely outside of the NetCP itself. These buffers/descriptors are actually part of the Multicore Navigator system in the SoC (http://www.ti.com/lit/ug/sprugr9h/sprugr9h.pdf).
So, from the perspective of the GbE Switch (Layer 2 hardware switch) there are no packets dropped because they all get passed along to the PA. From the perspective of the PA there are no packets dropped because they were all classified and forwarded on to the PKTDMA. This is why those statistics are both showing no packets drops.
When there are no descriptors remaining in a free descriptor queue (we call this buffer starvation) then the PKTDMA has two choices: either drop the packet immediately, or retry the packet after a timeout period. This behavior is controlled by the RX_ERROR_HANDLING bit in the 'RX Flow N Configuration Register A' (section 4.2.4.1 http://www.ti.com/lit/ug/sprugr9h/sprugr9h.pdf). If this bit is set to 0 then the PKTDMA will drop packets as they arrive on the RX flow until a free descriptor becomes available. So, even if flow control is enabled, if RX_ERROR_HANDLING is set to 0 then packets will be dropped by the PKTDMA and no flow control frames would be sent. This is my theory on what is happening in your case with 128 descriptors in the FDQ.
I'll ask someone else on my team to comment on your Linux specific questions.
Jason Reeder
Hi, Rams,
The descriptors are used by PA to send to CPPI and PA would not have stats for it. To PA, the packet is received and considered delivered.
The current setting should be able to support 1K, may be up to 2K descriptors. Anything higher than that, the region-12 and pool-net may need to increase as well.
Increasing descriptors seems to hide the issue, not to solve the issue. You should find out why your hardware/software can not meet TI's performance. You mentioned that you are only be able to get 300Mbps out of 1GbE. Our iperf performance can reach 960Mbps. What MCSDK release are you using and are you using TI's driver?
Rex
Thanks Jason Reeder for giving more insight into the issue.
Hello Rex,
I completely agree that increasing the descriptors seems to hide the core issue and is not the solution. I would like to clarify that we are able to get full bandwidth capacity with iperf without losses when no applications are running. I will repeat the tests and post the results.
We are seeing issues when system is loaded while running custom applications.
I am not sure how to simulate same conditions on Eval kit with iperf or other tool to generate burst traffic when there is normal traffic of 200M.
I am trying to understand your statement "You should find out why your hardware/software can not meet TI's performance". When packets are getting dropped inside K2H, how could be this be attributed to specific hardware issue or software application issue.
Our tests show that there are no issues when we pump in upto 1G traffic and all that could be delivered without any issues till the K2 Switch. Even if you consider the situation during this issue, the switch does not drop any packets. There were no pause frames when flow control was enabled. The packets are able to pass through the keystone switch without issues. The packets are getting dropped in multicore navigator as pointed out by Jason Reeder and there seems to be buffer starvation. At the consumption side, it is kernel driver (Using only TI driver, no custom drivers) which has to consume and pass it on to linux network stack and make up free descriptor for Multicore navigator. There should not be any specific hardware issues or application software issues. If the custom applications are slow and not grabbing packets, network stack will naturally drop the packets. We do not see any packets getting dropped by linux kernel. Please correct me if I am wrong
We use TI driver and MCSDK releases.
We use 3_01_03_06 MCSDK for MPM.
Our kernel version is from MCSDK 3.1.4 (K2_LINUX_03.10.72_15.08)
Our U-Boot version is from K2_UBOOT_2013_01_15.02_01
Hi, Rams,
There are several things we'd like to get clarification:
1) Without any software running, just iperf, are you able to get close to 1Gbps performance on your boards?
2) When you observed the UDP dropped, were there other ethernet port connected to the network? or just eth0?
3) Can you explain why in your netstat stats that IP packets are 400K more than UDP? ICMP and TCP are only around 70 pakcets total. Does it mean that the other ethernet port was also connected to the network? If that is the case, then the UDP counts will be the combination of all ethernet ports and will be off from what FPGA expects to receive.
4) Is the received packet coutns at FPGA close to the number of RX packets in ifconfig for that port?
5) How does the FPGA receive packets from kernel?
6) Kernel handles 64 packets (NAPI weight) per each Rx interrupt then returns these 64 descriptors back to the free queue. For each packet, it calls into application Rx function and this is in kernel context. Is it possible that the FPGA receive function is not returning the control back to kernel driver soon enough?
Rex
Hi Rex,
Please find answers inline.
1) Without any software running, just iperf, are you able to get close to 1Gbps performance on your boards?
Yes, you are right. We are able to get close to 1Gbps when no application software is running.
2) When you observed the UDP dropped, were there other ethernet port connected to the network? or just eth0?
We are using only one ethernet port, port 0 which is directly interfaced to FPGA(PHYless configuration), No MDIO
3) Can you explain why in your netstat stats that IP packets are 400K more than UDP? ICMP and TCP are only around 70 pakcets total. Does it mean that the other ethernet port was also connected to the network? If that is the case, then the UDP counts will be the combination of all ethernet ports and will be off from what FPGA expects to receive.
We have enabled only one ethernet port which is interfaced to FPGA and configured in SGMII_LINK_MAC_MAC_FORCED mode.
4) Is the received packet coutns at FPGA close to the number of RX packets in ifconfig for that port?
We tried match number of packets at FPGA close to the number of RX packets in the Switch statistics (ethtool -S eth0)
5) How does the FPGA receive packets from kernel?
FPGA is directly interfaced to eth0 and FPGA has unique ipadress
6) Kernel handles 64 packets (NAPI weight) per each Rx interrupt then returns these 64 descriptors back to the free queue. For each packet, it calls into application Rx function and this is in kernel context. Is it possible that the FPGA receive function is not returning the control back to kernel driver soon enough?
There is no FPGA driver component separately to handle receive/send.
Thanks
Rams
P.S
I am travelling and will be back to work on 8th Oct. I will be able to send you a detailed block diagram if it is not clear.
Hi, Rams,
We get even more confused with your answers.
1) FPGA has unique IP address - is it not the same IP address assigned to eth0? If it is a different IP address, then how does that work? We have one MAC address on eth0 with 2 different IP addresses?
2) FPGA is directly interfaced with eth0 - You will need to describe more details on how this work. Does it mean that FPGA gets packets directly from eth0? If that is the case, where is the Linux Kernel in the picture?
3) There is no FPGA driver component separately to hanel receive/send - we will need to know how FPGA receive the packets from SoC. The way we understand the packet flow in Linux is that the UDP application opens a socket of a specific UDP port on a specific ethernet interface (IP address) which it listens to. Take iperf as an example which sits on top of the UDP stack listens to a UDP port of the eth0 IP address, and when UDP delivers the packets, iperf acts on them (bookkeeping, etc.). As I described in previous post, the kernel driver delivers packets in descriptors, 64 of them per interrupt. We'll need to know if the FPGA does not fit in this picture, how does it receive packets? If it receives directly (steals under IP stack) from eth0, then how is this done?
Please note the ethtool stats in K2H are the combination of all NetCP ports including host port which should not be taken as a whole being the stats on the specific interface. The Rx Packets from ifconfig is more accurate on the packets count on that interface.
Rex
Hi Rex,
Sorry for late response. I was out of office.
Please find the block diagram which shows how the FPGA is interfaced to CPU.
Note that the FPGA and CPU have the same IP address, and the FPGA acts simply as a bridge. (The FPGA logic will receive packets on specific ports and everything else is forwarded directly to the CPU.)
Our packet counter is right before the PCS.
Thanks
Rams
Hi, Rams,
If I understand the diagram correctly, the FPGA replaces the PHY on TI EVM, and if I recall correctly that there are 2 devices connected to the Backplane, So your set up should look like:
Keystone-II-A ==SGMII==> FPGA-A ==> BackPlane ==> FPGA-B ==SGMII==> Keystone-II-B
1) was iperf run between KS-II-A and KS-II-B which shows no packet loss? If not, is it from some other device send to BackPlane then to receiving KS-II-B?
2) If packet loss is in FPGA-B, then we should look at the transmit side because the packets are not even reached the CPSW and Kernel in Keystone-II-B.
3) What is the transmit packet count shown at the source application which generates the packets? in ifconfig of KS-II-A? and in FPGA-A?
Rex
Rams,
We understand your system better now. What we don't understand is why on TI EVM it can reach 960Mbps UDP throughput with default number of descriptors, but it can't on your system. Without reproducing it on TI EVM, it is impossible for us to work on the issue. If increasing the descriptor number can solve the issue, we suggest to adapter it as a workaround.
Rex