SLIP: Switch to poll based design#9396
Conversation
This is a refactored version of the SLIP network driver. Updates include: 1. The original design started two kernel threads per SLIP device. The refactored version uses file_poll to essentially be driven by the UART RX and TX interrupts and pushes work to the low priority work queue. 2. The SLIP byte un-/stuffing is more efficient now, using memcpy instead of handling each byte individually. 3. The switch of the old SLIP driver to IOBs caused buffer overwrites if packets were sent that would not fit into a single IOB. This is fixed now. Signed-off-by: Michael Jung <michael.jung@secore.ly>
|
Very nice @michi-jung ! I want to create a video tutorial explaining how to use SLIP. My last video was about using ZMODEM, so SLIP demo should be nice! Was it easy to use/test? |
|
@michi-jung did you test with Linux? http://patrickst.blogspot.com/2011/11/tcpip-over-slip-on-gnulinux-ubuntu.html |
@michi-jung but the change need resolve two big buffer and copy them to/from iob. Why not simply extend iob to SLIP MTU or support the chain IOB instead? |
Hi @acassis, yes, only on Debian 11 (bullseye). To setup a point-to-point connection the following was sufficient for me (as root or with an account with sufficient capabilities): To enable access to the network access from you devices to the wider network, you have to enable ip forwarding and network address translation on the host: Since the MTU for SLIP is very small (296 bytes), IP packets from the internet will often be fragmented by the host before being forwarded to the device. Thus, you should have IP defragmentation enabled in NuttX ( |
I tried to avoid the complexity of doing the byte de-/stuffing in IOBs. And the two buffers are still smaller than the two stacks required by the tx and rx kernel threads in the old design. However, it is of course possible to do this in IOBs. I will open an issue to investigate this in the future. I am currently short on time, but will do this over the next couple of weeks. |
|
Thanks, @michi-jung |
Summary
This is a refactored version of the SLIP network driver. Updates include:
The original design started two kernel threads per SLIP device. The refactored version uses file_poll to essentially be driven by the UART RX and TX interrupts and pushes work to the low priority work queue.
The SLIP byte un-/stuffing is more efficient now, using memcpy instead of handling each byte individually.
The switch of the old SLIP driver to IOBs caused buffer overwrites if packets were sent that would not fit into a single IOB. This is fixed now.
Impact
Changes are contained to the SLIP network driver. This fix is reducing latency, improving throughput and is more resource efficient.
Testing
Working fine for me with LwM2M, Telnet, and iperf