Re: [lwip-users] Help with LwIP Modem
Hi All, To close the loop on my original question maybe it can help another rookie like me. My goal was to set my ethernet device so that it will act as a cable, received packets from the netif, modulates them, send them over a cable, have another device demod, the exact same packet, and last transmit the packet out over its netif. My initialization changed from: // netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP; netif->flags = 0; Now I'm able to receive all incoming packets but not answer or react to any of them. For example, if I ping the target I see the packet but lwip does not ack and replies back. Thanks all for the help and suggestions. Jaime On Sat, Jul 9, 2016 at 3:30 PM, Jeff Barlowwrote: > On 07/09/2016 12:10 PM, goldsi...@gmx.de wrote: > >> Jeff Barlow wrote: >> >>> I think you will find that ChibiOS does much the same. The reasoning >>> as I understand it is to keep ISR code paths as short as possible to >>> minimize latency in hard real time systems. >>> >> >> Without knowing ChibiOS in detail, I'd be interested in knowing what >> would be the actual penalty of removing the need for the API user to >> supply the "bool inIsr"... >> > > I don't claim to be an expert on ChibiOS in particular. It seems fairly > obvious to me though that inserting extra code in the ISR path that inspect > some globals only to figure out that it is indeed in an ISR will have an > adverse effect on latency. ChibiOS is very tightly tuned to minimize > latency. For some of us this makes the difference between a working system > and one that almost works. > > -- > Later, > Jeff > > > ___ > lwip-users mailing list > lwip-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/lwip-users > ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
[lwip-users] Netconn write and non-blocking
Dear all, What is the best way to handle the following situation when using netconn in TCPIP mode and v2.0.0RC1. If I connect (with netconn_connect() ) to a device that's not available and netconn is blocking how long do I have to wait? Because it's unknown to me and it could take very long I decided to use the "netconn_set_nonblocking(conn, 1)" so I can delete the connection if it takes to long to connect. But when the device is available I cannot use the netconn_write() (the function returns ERR_VAL). In the command it says: /* This implies netconn_write() cannot be used for non-blocking send, since it has no way to return the number of bytes written. */ How can I use netconn_write() in a non-blocking situation? -- View this message in context: http://lwip.100.n7.nabble.com/Netconn-write-and-non-blocking-tp26792.html Sent from the lwip-users mailing list archive at Nabble.com. ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] lwIP delays outgoing TCP packets by up to 500ms
It's worth comparing the behavior of the netconn API. Even though the netconn API is only available with NO_SYS = 0, it is still a user of the raw API like the applications mentioned in this email thread. lwip_netconn_do_writemore() calls tcp_write() until all segments have been put into the TCP send buffer, then calls tcp_output(). Joel On Jul 13, 2016, at 10:36 AM, Pîrvu Mihaiwrote: Again, it's probably not be the wrong approach, it's just what I've been told on this thread: https://lists.gnu.org/archive/html/lwip-users/2016-06/msg00055.html Since it worked for me at that moment, I just let it like that, and reading the responses here confirms that it's the correct approach if you don't want to wait for the delay. Mihai On Wed, Jul 13, 2016 at 5:59 PM, Jakub Schmidtke wrote: I think you might have missed reading the documentation: tcp_write enqueue data, tcp_outout tries to send it. You always have to call both. I actually found the recommended call flow on wiki (Here: http://lwip.wikia.com/wiki/Raw/TCP ) after Mihai mentioned using tcp_output(). And yes, I haven't fully read the docs/wiki yet, since I am trying to fix existing code written by someone else - who must have missed that... However, Mihai mentions that calling tcp_output() might be the wrong approach... Is it really? Thanks! ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] lwIP delays outgoing TCP packets by up to 500ms
Again, it's probably not be the wrong approach, it's just what I've been told on this thread: https://lists.gnu.org/archive/html/lwip-users/2016-06/msg00055.html Since it worked for me at that moment, I just let it like that, and reading the responses here confirms that it's the correct approach if you don't want to wait for the delay. Mihai On Wed, Jul 13, 2016 at 5:59 PM, Jakub Schmidtkewrote: > I think you might have missed reading the documentation: tcp_write enqueue >> data, tcp_outout tries to send it. You always have to call both. >> >> I actually found the recommended call flow on wiki (Here: > http://lwip.wikia.com/wiki/Raw/TCP ) after Mihai mentioned using > tcp_output(). > And yes, I haven't fully read the docs/wiki yet, since I am trying to fix > existing code written by someone else - who must have missed that... > > However, Mihai mentions that calling tcp_output() might be the wrong > approach... Is it really? > > Thanks! > > ___ > lwip-users mailing list > lwip-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/lwip-users > ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] 0MQ, MQTT and RabbitMQ
Hi, I contributed the transport abstraction for the Packet libraries for MQTT and MQTT-SN in Paho for embedded. I've been working on the transport for MQTT-SN to use the lwIP RAW API, which seemed to be working, but I didn't submit them to Paho. I can post it if you or anyone else are willing to try it and comment. MQTT is perhaps more involved as it requires a permanent connection and that is probably not very embedded, but I plan to write examples for MQTT anyway, it is just that I'll be more likely using MQTT-SN and time is a scarce resource these days. Paho: org.eclipse.paho.mqtt.embedded-c org.eclipse.paho.mqtt-sn.embedded-c ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] lwIP delays outgoing TCP packets by up to 500ms
> > I think you might have missed reading the documentation: tcp_write enqueue > data, tcp_outout tries to send it. You always have to call both. > > I actually found the recommended call flow on wiki (Here: http://lwip.wikia.com/wiki/Raw/TCP ) after Mihai mentioned using tcp_output(). And yes, I haven't fully read the docs/wiki yet, since I am trying to fix existing code written by someone else - who must have missed that... However, Mihai mentions that calling tcp_output() might be the wrong approach... Is it really? Thanks! ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] lwIP delays outgoing TCP packets by up to 500ms
Confusion might arise from the examples in contrib, neither tcpecho_raw nor smtp do call tcp_output(). Not everyone seems to look at httpd... nor read the wiki, nor the docs... ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
[lwip-users] 0MQ, MQTT and RabbitMQ
Hello, Could anyone share their experience(s) of any integration of LWIP with OMQ, MQTT and RabbitMQ. Much obliged, Abdul Hakeem ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] lwIP delays outgoing TCP packets by up to 500ms
I think you might have missed reading the documentation: tcp_write enqueue data, tcp_outout tries to send it. You always have to call both. Simon Gesendet mit AquaMail für Android http://www.aqua-mail.com Am 13. Juli 2016 2:35:59 nachm. schrieb Jakub Schmidtke: Maybe your sys_now() or sys_jiffies() functions are too course? They should have a resolution of approx. 1 msec. I am not even talking about observed delays. I am looking at the code, and based on that, those packets will be delayed by up to twice the value of TCP_TMR_INTERVAL in milliseconds. TCP_TMR_INTERVAL is set, by default, to 250. The TCP timer is scheduled to run every TCP_TMR_INTERVAL milliseconds. Actually every TCP_TMR_INTERVAL values returned by sys_now(), which is supposed to return milliseconds. That timer calls tcp_tmr(), which will always call tcp_fasttmr() and call tcp_slowtmr() every other time. Even the comments in tcp_tmr() say that tcp_slowtmr() will be called every 500ms. And I am looking at tcp_write(). It is a pretty big function so I may be missing something, but it doesn't look like it's actually sending any of the packets being written, it just appends them to 'unsent' queue. The actual writing happens inside tcp_slowtmr() which, again, is called every 500ms. So if something is written using tcp_write() 10ms after tcp_slowtmr() triggered, it will be actually sent out 490ms later. Even assuming perfect resolution of sys_now and being able to call things at exactly the right time. It's still up to a half a second later! Which is the problem I am experiencing. Now I could modify TCP_TMR_INTERVAL to much lower value, and call sys_check_timeouts() much more often to cause tcp_slowtmr() to be called much more frequently. Or modify sys_now() to return values that don't represent milliseconds but something smaller (and still call sys_check_timeouts() more often), but this changes the whole time scale and I have no idea what other effects this might have. Both of these solutions feel ugly and could affect the performance. I even tried calling tcp_slowtmr() manually, and it seems to send out those TCP packets sooner, but it doesn't feel like the right solution. I haven't looked into manually calling tcp_output after each tcp_write as suggested in an earlier response yet, but the same response also says that it's a wrong thing to do... That is why I am asking if I am missing something... But depending on your hardware it could not be so easy to accomplish. BTW, what is your hardware? I am running it as a part of a system that generates IP packets in software. Right now I am running it on a powerful i5 machine, so performance is not an issue. I've myself built with NO_SYS=1 on djgpp/MSDOS with no long delays as you describe. Hence I think it's a problem with your 'clock-tick' function. What is your TCP_TMR_INTERVAL? What do you return in sys_now()? Thanks! -- ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] lwIP delays outgoing TCP packets by up to 500ms
> > Maybe your sys_now() or sys_jiffies() functions are too course? > They should have a resolution of approx. 1 msec. I am not even talking about observed delays. I am looking at the code, and based on that, those packets will be delayed by up to twice the value of TCP_TMR_INTERVAL in milliseconds. TCP_TMR_INTERVAL is set, by default, to 250. The TCP timer is scheduled to run every TCP_TMR_INTERVAL milliseconds. Actually every TCP_TMR_INTERVAL values returned by sys_now(), which is supposed to return milliseconds. That timer calls tcp_tmr(), which will always call tcp_fasttmr() and call tcp_slowtmr() every other time. Even the comments in tcp_tmr() say that tcp_slowtmr() will be called every 500ms. And I am looking at tcp_write(). It is a pretty big function so I may be missing something, but it doesn't look like it's actually sending any of the packets being written, it just appends them to 'unsent' queue. The actual writing happens inside tcp_slowtmr() which, again, is called every 500ms. So if something is written using tcp_write() 10ms after tcp_slowtmr() triggered, it will be actually sent out 490ms later. Even assuming perfect resolution of sys_now and being able to call things at exactly the right time. It's still up to a half a second later! Which is the problem I am experiencing. Now I could modify TCP_TMR_INTERVAL to much lower value, and call sys_check_timeouts() much more often to cause tcp_slowtmr() to be called much more frequently. Or modify sys_now() to return values that don't represent milliseconds but something smaller (and still call sys_check_timeouts() more often), but this changes the whole time scale and I have no idea what other effects this might have. Both of these solutions feel ugly and could affect the performance. I even tried calling tcp_slowtmr() manually, and it seems to send out those TCP packets sooner, but it doesn't feel like the right solution. I haven't looked into manually calling tcp_output after each tcp_write as suggested in an earlier response yet, but the same response also says that it's a wrong thing to do... That is why I am asking if I am missing something... But depending on your hardware it could not be so easy to accomplish. BTW, > what is your hardware? > I am running it as a part of a system that generates IP packets in software. Right now I am running it on a powerful i5 machine, so performance is not an issue. > I've myself built with NO_SYS=1 on djgpp/MSDOS with no long delays > as you describe. Hence I think it's a problem with your 'clock-tick' > function. > What is your TCP_TMR_INTERVAL? What do you return in sys_now()? Thanks! ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] lwIP delays outgoing TCP packets by up to 500ms
Jakub Schmidtke wrote: > I am using lwip with NO_SYS=1, and I have noticed > that outgoing TCP packets are very delayed. > > It looks like between writing a packet (using tcp_write), > and the time it actually written to the interface it takes usually about > 200ms. Maybe your sys_now() or sys_jiffies() functions are too course? They should have a resolution of approx. 1 msec. But depending on your hardware it could not be so easy to accomplish. BTW, what is your hardware? I've myself built with NO_SYS=1 on djgpp/MSDOS with no long delays as you describe. Hence I think it's a problem with your 'clock-tick' function. -- --gv ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users
Re: [lwip-users] lwIP delays outgoing TCP packets by up to 500ms
I've worked around this disabling Nagle Algorithm for each pcb and also calling tcp_output after every write. But somebody told me it was the wrong approach doing so, but it works for me so I don't know what to say. Mihai On Wed, Jul 13, 2016 at 3:20 AM, Jakub Schmidtkewrote: > Hi, > > I am using lwip with NO_SYS=1, and I have noticed > that outgoing TCP packets are very delayed. > > It looks like between writing a packet (using tcp_write), > and the time it actually written to the interface it takes usually about > 200ms. > > I examined the code, and it looks like lwip only writes regular packets > every 500ms. > > Basically tcp_write only adds segments to a list, and they are only > actually sent inside tcp_slowtmr. > Which, by default, is only called once every two calls to tcp_tmr(). > Which gets called every 250ms, so the data being written with tcp_write > will be sent out up to 500ms later. > > This is a really, really long time! > > Am I missing something? > > > Thanks! > > > ___ > lwip-users mailing list > lwip-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/lwip-users > ___ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users