Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #28852

Re: High packet rate ethernet with LwIP

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.arch.embedded
Subject Re: High packet rate ethernet with LwIP
Date 2019-09-23 14:04 +0200
Organization A noiseless patient Spider
Message-ID <qmacda$reg$1@dont-email.me> (permalink)
References <nnd$46f32a8f$5fab99bf@bacadb246ebd9154> <f75aoe97bvj84fdfhp80376p9k1o1vm55v@4ax.com> <nnd$385a4f2f$5a6cc64f@f248034e4c3a4bf9>

Show all headers | View raw


On 23/09/2019 10:37, Stef wrote:
> On 2019-09-20 upsidedown@downunder.com wrote in comp.arch.embedded:
>> On Fri, 20 Sep 2019 18:27:52 +0200, Stef
>> <stef33d@yahooI-N-V-A-L-I-D.com.invalid> wrote:
>>
>>> For transportation of several high speed serial ports, we want to use a
>>> serial over ethernet approach. At a minimum I need to transfer four ports
>>> with 512 byte packets that come in every 40 ms at 2 Mbps.
>>>
>>> Search for a ready to use (for test at least) device has turned up nothing.
>>> Standard devices usually go up to 230 kbps, some to 1 Mbps. Most faster
>>> ones are single port only. And it should be a small device, embeddable,
>>> logic level is all that is needed. If anyone knows of a usable device...
>>>
>>> Since the board that this is on incorparates an ethernet capable controller
>>> (LPC4088) that has not that much work to do richt now, I thought it should
>>> be possible to add ethernet to it.
>>>
>>> For testing I got an LPC4088 demo board with ethernet interface and got
>>> LwIP running on it (stand alone, no OS).
>>>
>>> Got it working OK to simulate 4 ports sending slow data to 4 TCP ports
>>> that can be opened with a PC terminal program.
>>>
>>> But when I turn up the data volume and packet rate, it stops working.
>>> In some cases stuck in the hard fault handler, in other cases in a
>>> timed waiting loop in the LwIP stack.
>>>
>>> At this moment it is running fine with 2 ports open and a 512 byte packet
>>> every 100 ms on each. When I increase the speed to 50 ms, it stops after
>>> a while.
>>>
>>> I have no previous experience with LwIP so where to start looking?
>>> - First of all does it sound feasable over a 100 Mbit ethernet
>>>  connection using TCP?
>>> - What can be tuned in LwIP to improve this?
>>>  I have already increased PBUF_POOL_SIZE from default 7 to 64 and
>>>  MEM_SIZE from 12k to 32k
>>
>> Have you looked at the Ethernet traffic with e.g. Wireshark ? Look for
>> TCP retransmissions. If each serial line pumps data at 2 Mbit/s
>> without any flow control, a TCP retransmission will upset the Ethernet
>> traffic for a while, possibly overflowing buffers. Anyway, if retrials
>> are expected, the gross (ethernet) speed must be several times larger
>> than the net data rate.
> 
> No, not done that yet, but indeed something I need to do.
> 
>> Is it possible to use UDP and accept that some packets may be lost ?
>> Include a serial number in each frame and the receiver can detect
>> missing packets (that have failed CRC test) and mark the missing data
>> accordingly. This way the net speed can be much closer to the raw data
>> rate.
> 
> That is something that came to my mind just after posting the question.
> Would UDP be a better match for this application? The whole TCP
> retransmission and timers may be the mechanisms causing the problem.
> I think the standard TCP timeouts ar far too slow for this kind of
> thing? Think I saw a 250 ms timer tick in the LwIP docs?

TCP/IP timeouts are slow, yes - you need to consider if that will be an
issue.  But TCP/IP gives you better guarantees about delivery - either
the packets will all arrive, with correct contents, sorted in the right
order, or you will get a clear failure indication for the whole
connection.  With UDP, you need to handle this manually - you might need
more checksumming, re-ordering, re-tries, etc., depending on the
application.  But UDP has fewer overheads, and with manual coding comes
greater control and flexibility.

TCP/IP is also /much/ easier to handle over longer networks - through
NAT routers, VPN's, ssh tunnels, and the like.

Note that if you are getting retries or re-ordering of TCP/IP packets
while you are on local network, you have something badly wrong with the
software or the network - retries should be very rare.

> 
> Missing packets may not be a problem. It is measurement data and if
> any re-transmit takes over 40 ms there is no point anyway, there is
> already new data. On a much slower rate, some control connection does
> have to be reliable. So that could use TCP (if is does not disturb
> the parallel UDP flow in LwIP) or use UDP as well and implement the
> retries in the application.
> 
> 

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

High packet rate ethernet with LwIP Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2019-09-20 18:27 +0200
  Re: High packet rate ethernet with LwIP upsidedown@downunder.com - 2019-09-20 21:20 +0300
    Re: High packet rate ethernet with LwIP Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2019-09-23 10:37 +0200
      Re: High packet rate ethernet with LwIP Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2019-09-23 14:08 +0300
      Re: High packet rate ethernet with LwIP Richard Damon <Richard@Damon-Family.org> - 2019-09-23 07:13 -0400
        Re: High packet rate ethernet with LwIP Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2019-09-23 18:55 +0300
      Re: High packet rate ethernet with LwIP David Brown <david.brown@hesbynett.no> - 2019-09-23 14:04 +0200
        Re: High packet rate ethernet with LwIP Dimiter_Popoff <dp@tgi-sci.com> - 2019-09-23 17:03 +0300
          Re: High packet rate ethernet with LwIP David Brown <david.brown@hesbynett.no> - 2019-09-23 18:37 +0200
            Re: High packet rate ethernet with LwIP Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2019-09-24 14:22 +0200
              Re: High packet rate ethernet with LwIP upsidedown@downunder.com - 2019-09-25 07:55 +0300
                Re: High packet rate ethernet with LwIP David Brown <david.brown@hesbynett.no> - 2019-09-25 09:51 +0200
                Re: High packet rate ethernet with LwIP Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2019-09-25 16:03 +0200
                Re: High packet rate ethernet with LwIP Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2019-09-25 11:59 +0200
                Re: High packet rate ethernet with LwIP Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2019-09-25 13:16 +0200
              Re: High packet rate ethernet with LwIP David Brown <david.brown@hesbynett.no> - 2019-09-25 09:42 +0200
                Re: High packet rate ethernet with LwIP Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2019-09-25 13:41 +0200
                Re: High packet rate ethernet with LwIP David Brown <david.brown@hesbynett.no> - 2019-09-25 14:10 +0200
                Re: High packet rate ethernet with LwIP Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2019-09-25 15:22 +0200
      Re: High packet rate ethernet with LwIP upsidedown@downunder.com - 2019-09-23 22:26 +0300
        Re: High packet rate ethernet with LwIP Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2019-09-23 22:16 +0200
          Re: High packet rate ethernet with LwIP David Brown <david.brown@hesbynett.no> - 2019-09-23 23:08 +0200
  Re: High packet rate ethernet with LwIP Joe Chisolm <jchisolm6@earthlink.net> - 2019-09-20 13:44 -0500
    Re: High packet rate ethernet with LwIP Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2019-09-23 10:46 +0200
  Re: High packet rate ethernet with LwIP David Brown <david.brown@hesbynett.no> - 2019-09-21 19:00 +0200
    Re: High packet rate ethernet with LwIP upsidedown@downunder.com - 2019-09-22 00:01 +0300
      Re: High packet rate ethernet with LwIP David Brown <david.brown@hesbynett.no> - 2019-09-22 09:06 +0200
        Re: High packet rate ethernet with LwIP upsidedown@downunder.com - 2019-09-22 11:29 +0300
          Re: High packet rate ethernet with LwIP David Brown <david.brown@hesbynett.no> - 2019-09-22 23:24 +0200
        Re: High packet rate ethernet with LwIP Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2019-09-23 11:10 +0200
    Re: High packet rate ethernet with LwIP Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2019-09-23 11:03 +0200

csiph-web