lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliabl


From: Noam Weissman
Subject: Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?
Date: Tue, 7 Nov 2017 09:21:41 +0000

Hi Itzik,

 

I have never worked with Android so I cannot help in that area.

 

My options are defined for a small micro with limited resources so I hope I am not confusing you.

 

BR,

Noam.

 

From: lwip-users [mailto:lwip-users-bounces+address@hidden On Behalf Of Itzik Levi
Sent: Tuesday, November 07, 2017 11:17 AM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

 

Hi Noam,

 

For the purpose of evaluation, I'm using Android OS, with lwip-port provided by contrib repo.

 

I'll go over your lwipopts and see whether I missed something.

In addition, I will attempt to use SO_SNDTIMEO and SO_RCVTIMEO instead of polling in parallel to write and read(I understand by the samples its a more health way of using this api).

 

If you have anymore suggestions, that will be great!

 

Thanks,

Itzik

 

 

 

 

On Tue, Nov 7, 2017 at 9:39 AM, Noam Weissman <address@hidden> wrote:

Hi Itzik,

 

Ops I missed that J

 

I am attaching my own lwpopts.h

 

I am using FreeRTOS as OS on STMF32xx micro’s.

 

I am running several modules (SDDP, TCP terminal, HTTP, SSH etc… ) with the above settings

on the same platform.

 

What micro are you using and what OS ?

 

 

BR,

Noam.

 

 

From: lwip-users [mailto:lwip-users-bounces+noam=address@hidden] On Behalf Of Itzik Levi
Sent: Tuesday, November 07, 2017 12:52 AM


To: Mailing list for lwIP users
Subject: Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

 

Thanks Noam!

 

But I am running an OS.

 

NO_SYS is defined to 0 as you can see, and I AM using threads.

 

I will try reducing the memory usage and look at socket examples, maybe this will help.

 

 

 

On Nov 7, 2017 12:44 AM, "Noam Weissman" <address@hidden> wrote:

Hi Itzik,

 

From participating the group here I have heard many complaining that the driver level

is the cause to problems like you are facing.

 

From my own experience I have noticed problems when using the RAW API. The RAW

API is NOT thread safe (I am using an OS) and therefore one needs to follow the guidelines

and understand how to use it.

 

LwIP is small and light weight. I have used it with ARM9 that had only 96K RAM. Actually TCP

stack was assigned less then 10K... 😊

If you have 50Mb why not run an OS and run it with threads etc...

 

I suggest looking for a nice example with Sockets + lwipopt.h and continue from there.

 

If you are using it to stream an unreliable connection you should probably add some protocol

to overcome this instability.

 

I do not see the reasoning for defining 8M for MEM_SIZE ?

 

You do not need so much. 100K is more then sufficient for your testing, I think.

You do not more PCB's... PCB is your control block... every block you send or receive is using one.

I am defining 80 TCP PCB's with 25K RAM for MEM_SIZE and I do not have so much RAM.

 

Check some examples and see if you can find more ideas...

 

Hope that helped,

Noam.

 

 

 


From: lwip-users <lwip-users-bounces+noam=address@hidden> on behalf of Itzik Levi <address@hidden>

Sent: Monday, November 6, 2017 11:45 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

 

Hi Noam,

 

Thanks for the prompt response!

 

The actual link isn't serial. its a non-reliable rfcomm link, which is a stream based protocol.

Regarding ram available ram - up to 50MB I would say.

 

I'm attaching my entire lwipopts.h here.

 

Regarding the socket API - I did not actually put lots of thought to it, it was trivial to implement and that's that. do you have a reason to believe the root cause is there? Although the only change between the 2 tests I ran was randomly dropping data in the physical layer output?

If you think that might be it, I can rewrite the socket layer and attempt to test again.

 

 

And regarding misusing the stack - I totally agree, I probably did misused it somehow, I'm new to lwip and that's why I'm here.

Question is, what did I do wrong, and how to pinpoint the problem.

 

Thanks,

Itzik.

 

 

 

 

 

On Mon, Nov 6, 2017 at 11:19 PM, Noam Weissman <address@hidden> wrote:

Hi Itzik,

 

I see that you have defined:

TCP_WND=(100 * TCP_MSS)

TCP_SND_BUF=TCP_WND

MEMP_NUM_TCP_SEG=TCP_SND_QUEUELEN

 

If TCP_MSS is defined 536 (default) that means that your TCP_WND is 53,600 bytes ?

and that is over a serial line ?

 

How much RAM do you have?, How much RAM is defined for TCP memory?

 

I never worked with PPP so I am a bit on the dark here.

 

From my experience with LwIP (over 6 years) Almost always it was misusing the stack or

doing something wrong.

 

You have written that you are using the Socket API. Normally Socket API is used with different

threads/task. If you do not use an OS why not use the RAW API ?

 

BR,

Noam. 

 


From: lwip-users <lwip-users-bounces+noam=address@hidden> on behalf of Itzik Levi <address@hidden>
Sent: Monday, November 6, 2017 7:07 PM
To: address@hidden
Subject: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

 

Hi All, 

 

Firstly, a bit of background:

I'm currently evaluating lwip stack in order to determine whether it can fit my needs.

 

The end-goal, is integrating Socket API --> TCP/IP --> PPPoS stack on both sides over a serial-like-interface(stream-based)  which isn't reliable.

 

I decided to unittest it before actually integrating the stack.

 

Setup:

(This is done symmetrically on both "client" and "server")

  1. Network Interface:
    1. The "physical layer" is currently a localhost connected tcp socket.
    2. Using pppapi in order to create the network interface.
    3. Its "output_cb" is the tcp connect socket(as mentioned before).
    4. Using "pppos_input_tcpip" which is fed by the same tcp socket.
  1. Forming a TCP connection over the interface:
    1. Using lwip's bsd-like socket api.
    2. Single socket connection.
    3. Disabling Nagle.
    4. Working with a non-blocking sockets.
    5. Not writing and reading at the same time(mutex protected), but using lwip_poll in parallel to both.
  1. Data validation:
    1. Transferring the same generated data client-->server and server-->client and validating at the same time.

 

Results:

  • When not introducing losses to the physical layer, the data is passed and validated successfully without any issues.
  • When starting to randomly introduce losses to the physical layer(basically drop some data when output_cb is being called), it seems to go well for minutes, but eventually it appears that I'm loosing data when sending.

 

I'm sure I'm doing something wrong here, can you please help me figure this thing out?

Pointers to debug such a case is also welcome!

 

I'm attaching lwip's debug logs from both client and server, when losses are introduced to both physical layer ends.

 

In this specific case some data that was sent from the client --> server, and the server failed to validate the data.

 

The last received valid stream offset is 19008, the next 400 bytes were incorrect(future data), basically I got some skipped data.

 

lwip configuration:

SYS_LIGHTWEIGHT_PROT=1

NO_SYS =0

LWIP_TCPIP_CORE_LOCKING=1

LWIP_TCPIP_CORE_LOCKING_INPUT=1

 

TCP_WND=(100 * TCP_MSS)

TCP_SND_BUF=TCP_WND

MEMP_NUM_TCP_SEG=TCP_SND_QUEUELEN

 

I used lwip's repo commit: 5d8d21fcae63c36005baf1b15e91268836dec679.

(which is lwip 2.0.3 plus some..)

 

 

Please tell me if any more info is required.

 

Thanks,

Itzik

 

 

 


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

 


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

 


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]