slipdev: simplify and solidify byte-unstuffing#8268
Conversation
|
I noticed some weird behavior, when I don't assign a GUA to the SLIP interface (might be unrelated, since the link-local address is |
|
The problem was, that either the ID or the sequence number of the pong message was wrong, so I got an "error: unexpected parameter" message. Not sure what caused this, but I'm unable to reproduce it now... |
jnohlgard
left a comment
There was a problem hiding this comment.
The theory behind the PR sounds reasonable. I have not had time to review the implementation yet.
|
Test results after a some experiments in the shell on samr21 Xplained Pro.
I can try to dig deeper later on to see how the gcoap request fails. |
|
I can confirm the findings of @kb2ma. Furthermore I'd like to add that ping from the workstation to the node (nucleo-f446 with a cheap usb to serial converter) can have response times between 4 to 5 seconds. It looks like something is causing a lot of delay in the line somewhere. Measuring this with wireshark I observe that when I start a ping sequence (after having some traffic between the nodes), there is first some leftover replies from the previous sequence and then the current responses start coming through. This stops as soon as the ping sequence stops. |
|
@bergzand which host is which in your wireshark dump? |
|
|
Header should be: I'm suspecting that somewhere the tsrb desyncs, causing an offset in the packet passed to the upper layer. For example in my pcap, packet number 13 arriving in the buffer causing packet number 1 to be passed to gnrc (and generating the delayed response packet). |
|
Could this be caused by bugs in the ethos implementation? |
|
Nm, I just reread the PR title |
As you noticed yourself: |
drivers/slipdev/slipdev.c
Outdated
| } | ||
| } | ||
| else if (len < dev->pktfifo[idx]) { | ||
| else if (len < tsrb_avail(&dev->inbuf)) { |
There was a problem hiding this comment.
Is theoretically possible to have multiple packets in the tsrb at when this is checked? If a byte arrives in the tsrb between the _recv() call to get the expected buffer size and the _recv() call to copy the buffer to the pktsnip, this would evaluate to true and return an error.
There was a problem hiding this comment.
Additional problem clarification: If the above is possible, gnrc_netif_raw would return, but the current packet in the tsrb would never get removed, and would instead be returned as a received packet when the next packet is added to the tsrb (, as that one would trigger the next SLIP_END; NETDEV_EVENT_RX_COMPLETE etc sequence).
There was a problem hiding this comment.
Yes, I have fixed that now. See my latest commit.
|
With the latest commit (a9c6648), I am able to force ping ( There were multiple problems:
|
|
@miri64 Works for me here too. I can't get it to break anymore. |
|
Then, since I'm going on vacation in 3 min, I guess I squash? :D |
4026535 to
72652ce
Compare
|
(didn't wait for a reply, just squashed) |
|
Works for me, too! Many thanks. :-) |
|
Fixed Murdock issue. Can I get an ACK now? |
drivers/slipdev/slipdev.c
Outdated
| dev->inesc = 0; | ||
| break; | ||
| } | ||
| /* falls through intentionally to default */ |
There was a problem hiding this comment.
These (this one and the case below) dont fall through anymore.
There was a problem hiding this comment.
Yes they do, if dev->inesc is not set.
There was a problem hiding this comment.
(but I can extent the comment to make that clear).
There was a problem hiding this comment.
Ah, completely missed that, better this way!
drivers/slipdev/slipdev.c
Outdated
| #define SLIP_END (0xC0U) | ||
| #define SLIP_ESC (0xDBU) | ||
| #define SLIP_END_ESC (0xDCU) | ||
| #define SLIP_ESC_ESC (0xDDU) |
There was a problem hiding this comment.
Is there a reason for the switch to upper case here?
There was a problem hiding this comment.
No particular, I guess. Shall I revert?
There was a problem hiding this comment.
Only if it is not too much work :)
There was a problem hiding this comment.
C-v3jlgu isn't too much work IMHO ;)
|
ACK, Ready for squash. |
This simplifies and solidifies the reversal of SLIP's byte-stuffing (aka byte-unstuffing ;-)) by 1. Using `tsrb` instead of `ringbuffer`: there are two actors. The ISR and the device's event handler. 2. Moving the byte-unstuffing from the UART RX-handler (i.e. the ISR) to the device's receive function (potentially not the ISR) 3. Removing the `pktfifo` member. The current number of bytes in the ringbuffer is returned for `recv(data = NULL, len = 0)`. If that is more than the packet contains (due to the byte stuffing it most likely will be) the packet is reallocated in GNRC anyway.
c882206 to
c61a343
Compare
|
Squashed |

Contribution description
This simplifies and solidifies the reversal of SLIP's byte-stuffing
(aka byte-unstuffing ;-)) by
tsrbinstead ofringbuffer: there are two actors. The ISRand the device's event handler.
to the device's receive function (potentially not the ISR)
pktfifomember. The current number of bytes in theringbuffer is returned for
recv(data = NULL, len = 0). If that ismore than the packet contains (due to the byte stuffing it most
likely will be) the packet is reallocated in GNRC anyway.
Issues/PRs references
Alternative to #8258, fixes #8003.