FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [December 2011 Threads] Web server demo gets stuck.Posted by Teppo Maenpaa on December 20, 2011 Hi, I am running Full demo on SmartFusion ( CORTEX_A2F200_SoftConsole ), using FreeRTOS version 7.0.1 and Microsemi toolkit from Libero 9.1. The webserver of the Full demo enters occasionally enters infinite loop. The error is most likely caused by a long IP packet in my LAN. Flow of events: * MSS_MAC_rx_packet returns a negative number ( FreeRTOS/Demo/CORTEX_A2F200_SoftConsole/MicroSemi_Code/drivers/mss_ethernet_mac/mss_ethernet_mac.c line 585) * vuIP_task only handles positive return values ( FreeRTOS/Demo/CORTEX_A2F200_SoftConsole/uIP_Task.c line 180 ) * The supposedly-too-large packet is never acknowledged, and hence all subsequent packets are lost. * webserver no longer serves anything, as IP receive queues is stuck. I do not know who generates the those too large packets in 1st packet; my LAN is large and noisy and the error is rather infrequent. Artificially they can be generated e.g. with ping -s Where and how should this be fixed ? The following seems to make the problem go away, but I am not sure if this is the best way. --- Demo/CORTEX_A2F200_SoftConsole/MicroSemi_Code/drivers/mss_ethernet_mac/mss_ethernet_mac.c 2011-12-20 16:12:18.000000000 +0200 +++ Demo/CORTEX_A2F200_SoftConsole/MicroSemi_Code/drivers/mss_ethernet_mac/mss_ethernet_mac.c 2011-12-20 16:12:54.000000000 +0200 @@ -582,6 +582,7 @@ frame_length -= 4u; if( frame_length > macBUFFER_SIZE ) { + MSS_MAC_prepare_rx_descriptor(); return MAC_NOT_ENOUGH_SPACE; }
RE: Web server demo gets stuck.Posted by Richard on December 20, 2011 “* MSS_MAC_rx_packet returns a negative number ( FreeRTOS/Demo/CORTEX_A2F200_SoftConsole/MicroSemi_Code/drivers/mss_ethernet_mac/mss_ethernet_mac.c line 585)” I'm not sure how that line could be hit, as macBUFFER_SIZE appears to be large enough. Do you know how big frame_length is when MAC_NOT_ENOUGH_SPACE is returned? It might be that you can increase macBUFFER_SIZE but it should not make any difference. If frame_length is very large, or even just bigger than a valid Ethernet frame, then it could be a problem with the drivers configuration of the MAC interface, or just plain old data corruption somewhere. This is Actel/Microsemi code. “* vuIP_task only handles positive return values ( FreeRTOS/Demo/CORTEX_A2F200_SoftConsole/uIP_Task.c line 180 )” Ideally the driver should clean up then silently ignore bad data, but un-ideally you could extend the code here to look for error values coming back, and then to a manual clean up when they do. That would prevent you having to change the driver code. Regards.
RE: Web server demo gets stuck.Posted by Teppo Maenpaa on December 20, 2011 Thanks for the quick answer. “I'm not sure how that line could be hit, as macBUFFER_SIZE appears to be large enough.” I have no idea either. I suppose it could be IPv6 over ethernet, but have not checked. Still, I am not happy with the idea that a single packet crashes the uIP thread. By the way, the buffer size is 1488 bytes; according to wikipedia, ethernet packet payload can be up to 1500 bytes. What makes the difference ? I would have guessed that the whole payload goes into a macBUFFER. “That would prevent you having to change the driver code.” This is the first time I am using FreeRTOS for anything, and have no idea how difficult it would be to add fault tolerance here. FreeRTOS runs over rather many platforms.. Would pay to capture the packets giving me trouble ? I would learn how the particular packets in my lan look like, but other people might see something else. I tried to do some more reading but failed to find answer. With a fix like above, am I still corrupting other buffers by these large infoming frames or not ? I would appreciate if you could point me where this data copying takes place. Thanks !
RE: Web server demo gets stuck.Posted by MEdwards on December 20, 2011 Even if just the payload goes into the buffer it can be up to 1500 if my memory is right. Normally descriptors and some time buffers have to be byte aligned, 8, 16, 32 etc depending on the architecture. Trying increasing the buffer to the next valid byte aligned value over 1522, then the entire frame should always got in.
RE: Web server demo gets stuck.Posted by Teppo Maenpaa on December 20, 2011 “Would pay to capture the packets giving me trouble ?” Intended to ask: Would it pay to capture the packets that are causing the problem ? The reason why I ask the question is that those packet are damn infrequent.
RE: Web server demo gets stuck.Posted by Teppo Maenpaa on December 21, 2011 “Trying increasing the buffer to the next valid byte aligned value over 1522, then the entire frame should always got in.” I started logging the largest seen packet size. The value after some hours was 1514. Your suggestion seems like worth trying. Should buffers be increased similartly in a future FreeRTOS release, too?
RE: Web server demo gets stuck.Posted by Teppo Maenpaa on March 28, 2012 Hi all,
Increasing the buffer size seems to make problems go away, at least in my use-case. From my point of view this is a bug in FreeRTOS that needs fixing. How to find and alert the person that supervises this code in a more official manner ?
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|