Re: [lwip-users] netconn send broadcast

2017-11-07 Thread Dirk Ziegelmeier
Yes, that's correct. Be aware this is not thread-safe, you should not change that option during runtime. You should do it before binding the PCB. Ciao Dirk ___ lwip-users mailing list lwip-users@nongnu.org

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Dirk Ziegelmeier
Sorry for the DisableInterrupts() / EnableInterrupts() confusion, I forgot you are running on Android in a process. Ciao Dirk -- Dirk Ziegelmeier * d...@ziegelmeier.net * http://www.ziegelmeier.net On Tue, Nov 7, 2017 at 9:07 PM, Dirk Ziegelmeier wrote: > Try

[lwip-users] netconn send broadcast

2017-11-07 Thread Jan Menzel
Hi all! Today I've implemented a little debug facility that sends out some data using netconn api in broadcast mode. It took a while until I figured out, that broadcast transmission is disabled by default and requires SOF_BROADCAST to be set in the pcbs so_options member. I found the macro

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Itzik Levi
Hi Simon, Thanks for the prompt response! I'll try to clarify. I'm testing the stack as much as I can before integrating to my final setup: Currently, I have 2 processes, each has an lwip's PPPoS stack, and on top of that using lwips socket api to create a tcp socket. PPPoS read write methods

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread goldsi...@gmx.de
Itzik Levi wrote: I'll recap the setup: 1. Non blocking sockets. 2. poll(thread 1). OK, poll is pretty new. There might be problems of course, as it's new code and also select has change a bit due to adding poll support. 1. read/write in 2 different threads, but not in parallel, mutex

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Itzik Levi
Hi Simon, I'll recap the setup: 1. Non blocking sockets. 2. poll(thread 1). 3. read/write in 2 different threads, but not in parallel, mutex protected. 4. poll may occur in parallel to read/write. But the original problem, as described, is the matter of tcp stream corruption. I

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread goldsi...@gmx.de
Itzik Levi wrote: After debugging a bit further, it seems that the data corruption I'm having, is an old tcp segment, that was already received being sent again(??). [..] Dumps are here:https://ufile.io/gbwit What kind of "dumps" are these, and what do you expect me to do with them? Anyway,

Re: [lwip-users] Externally allocated memory pool for pbufs

2017-11-07 Thread goldsi...@gmx.de
Olivier Desenfans wrote: Regarding the TX side of things, Keep in mind that most TX functions allocate PBUF_RAM pbufs, which are allocated via mem_malloc(). To move this into pools, you'll need some extra work. Also, are you *sure* constructing packets in uncached memory is faster than

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread goldsi...@gmx.de
Itzik Levi wrote: Now I cant even reach the corruption issue(not sure if solved or not), as I constantly getting another assert after a while : "Assertion "sock->fd_used != 0" failed at line 344 in lwip/src/api/sockets.c.". Could you add a description of the call stack or what your

Re: [lwip-users] Externally allocated memory pool for pbufs

2017-11-07 Thread Dirk Ziegelmeier
RX is OK, updated example: http://www.nongnu.org/lwip/2_0_x/group__pbuf.html Moving PBUFs: http://www.nongnu.org/lwip/2_0_x/group__mempool.html#ga5b1fb3ce7942432d87cc948b1c5ed6cb Ciao Dirk ___ lwip-users mailing list lwip-users@nongnu.org

Re: [lwip-users] 2 Devices

2017-11-07 Thread goldsi...@gmx.de
Dirk Ziegelmeier wrote: Try SO_BINDTODEVICE socket option A better description for this short answer is: having 2 netifs on the same subnet was not supported until we implemented SO_BINDTODEVICE. It might now work, but there might be pitfalls we haven't thought of/haven't tested yet.

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Dirk Ziegelmeier
Try implementing it as DisableInterrupts() / EnableInterrupts() Ciao Dirk ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Itzik Levi
Just to be sure, I've just implemented both SYS_ARCH_PROTECT and SYS_ARCH_UNPROTECT with one global recursive-mutex. Still having the "sock->fd_used != 0" Assertion.. Do we have another way chasing this issue? On Tue, Nov 7, 2017 at 8:47 PM, Itzik Levi wrote: > Wait,

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Itzik Levi
Wait, it might be the implementation for SYS_ARCH_PROTECT, SYS_ARCH_UNPROTECT. I will check. On Tue, Nov 7, 2017 at 8:42 PM, Itzik Levi wrote: > Some update: > > I've enabled "LWIP_NETCONN_FULLDUPLEX" - needed some work as it requires > LWIP_NETCON_SEM_PER_THREAD. > > So

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Itzik Levi
Some update: I've enabled "LWIP_NETCONN_FULLDUPLEX" - needed some work as it requires LWIP_NETCON_SEM_PER_THREAD. So I needed to implement(getting a unique semaphore per thread): - LWIP_NETCONN_THREAD_SEM_GET() - LWIP_NETCONN_THREAD_SEM_ALLOC() - LWIP_NETCONN_THREAD_SEM_FREE() Now I

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Itzik Levi
Hi Sylvain, Although I am reading and writing from separated threads, I am not doing that in parallel(mutex protected), lwip_recv is never called in parallel to lwip_send. I will try and enable LWIP_NETCONN_FULLDUPLEX to see if it does anything, but I remember its highly experimental at this

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Sylvain Rochet
Hi Itzik, On Tue, Nov 07, 2017 at 06:40:52PM +0200, Itzik Levi wrote: > Hi Sylvain, > > Thanks for the response! > > Just tried disabling both CORE_LOCKING and CORE_LOCKING_INPUT and > unfortunately encountered the same problem. > > I'm probably missing something, but what... loss-less stream

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Itzik Levi
Hi Sylvain, Thanks for the response! Just tried disabling both CORE_LOCKING and CORE_LOCKING_INPUT and unfortunately encountered the same problem. I'm probably missing something, but what... loss-less stream works excellent, without any corruption, might be some kind of internal tcp queue

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Noam Weissman
Hi, So maybe enlarge MEMP_NUM_PBUF 100-150 your have the memory for it ☺ Noam. From: lwip-users [mailto:lwip-users-bounces+noam=silrd@nongnu.org] On Behalf Of Itzik Levi Sent: Tuesday, November 07, 2017 6:15 PM To: Mailing list for lwIP users Subject: Re: [lwip-users] Lwip tcp-stack

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Itzik Levi
Hi Noam, Thanks. Just increased both MEMP_NUM_PBUF to 50, MEM_NUM_TCP_PCB TO 15. I'm not sure if its harder to reproduce(longer time to run) - maybe. but it still happens.. On Tue, Nov 7, 2017 at 5:36 PM, Noam Weissman wrote: > Hi, > > > > Check that you have MEMP_NUM_PBUF

[lwip-users] Externally allocated memory pool for pbufs

2017-11-07 Thread Olivier Desenfans
Hello, I am currently porting LwIP to our in-house RTOS. I am trying to implement zero-copy transfers (both TX and RX). I have several questions. Regarding the TX side of things, our RTOS enables the MMU and provides facilities for DMA-based drivers to allocate uncacheable memory beforehand in

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Noam Weissman
Hi, Check that you have MEMP_NUM_PBUF 50 or more that MEMP_NUM_TCP_PCB is 15 or more The above may help, I think. Noam. From: lwip-users [mailto:lwip-users-bounces+noam=silrd@nongnu.org] On Behalf Of Itzik Levi Sent: Tuesday, November 07, 2017 5:29 PM To: Mailing list for lwIP users

Re: [lwip-users] 2 Devices

2017-11-07 Thread Fabian Cenedese
At 16:14 07.11.2017, you wrote: >It's in git head Interesting, seems like I need to update. Thanks for the hint. bye Fabi ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] 2 Devices

2017-11-07 Thread Fabian Cenedese
At 15:59 07.11.2017, you wrote: >Try SO_BINDTODEVICE socket option Apparently that's still not supported by LwIP? Or did you add this in your copy? bye Fabi ___ lwip-users mailing list lwip-users@nongnu.org

Re: [lwip-users] 2 Devices

2017-11-07 Thread Dirk Ziegelmeier
Try SO_BINDTODEVICE socket option Ciao Dirk On Tue, Nov 7, 2017 at 3:55 PM, Fabian Cenedese wrote: > At 15:20 07.11.2017, you wrote: > >Hi, > > > >I am doing similar thing. I think I will use one thread to collect data > from multiple devices and feed them to corresponding

Re: [lwip-users] 2 Devices

2017-11-07 Thread Fabian Cenedese
At 15:20 07.11.2017, you wrote: >Hi, > >I am doing similar thing. I think I will use one thread to collect data from >multiple devices and feed them to corresponding netif->input. >Don't feed data directly to tcpip_input, if you do so, make sure you pass the >right netif to it. Anyway make sure

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Itzik Levi
Thanks for the reply! Actually, the end goal is to integrate the solution into rfcomm. For now, the "physical layer" is being simulated by a single local host tcp connection(under Android OS). The losses are simulated by simply randomly dropping data in lwip's pppos " output_cb". I'll attempt

Re: [lwip-users] [EXTERNAL] 2 Devices

2017-11-07 Thread Xiaomin Lin
Hi, I am doing similar thing. I think I will use one thread to collect data from multiple devices and feed them to corresponding netif->input. Don't feed data directly to tcpip_input, if you do so, make sure you pass the right netif to it. Anyway make sure you have two individual netif. For

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Gisle Vanem
Itzik Levi wrote: I'll go over your lwipopts and see whether I missed something. In addition, I will attempt to useSO_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

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Itzik Levi
Hi All, After debugging a bit further, it seems that the data corruption I'm having, is an old tcp segment, that was already received being sent again(??). 2.dump is the stream the sender sent. 1.dump is the stream the receiver got. I can see in 1.dump, in offset "11640" I have 520 bytes of

[lwip-users] 2 Devices

2017-11-07 Thread Fabian Cenedese
Hello I'm trying to implement 2 physical devices with LwIP. This is what I have so far: "One" LwIP (functions and global variables) One tcpip_thread Twice netif_add() and netif_set_up() Two threads to read the frames from the PHY and giving it to LwIP with tcpip_input One PHY is working

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Itzik Levi
Hi, Thank you so much for the assistance, tried reducing my memory usage, reducing the window size, using SO_SNDTIMEO, SO_RCVTIMEO instead of non-blocking sockets. Nothing seems to help :(, if I'm not introducing losses, all seems to be fine. I'm trying to dig in to the nature of the data

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Noam Weissman
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+noam=silrd@nongnu.org] On Behalf Of Itzik Levi Sent: Tuesday,

Re: [lwip-users] Lwip tcp-stack reliability issue when using non-reliable network?

2017-11-07 Thread Itzik Levi
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