[WIP]gnrc_tcp#2827
[WIP]gnrc_tcp#2827brummer-simon wants to merge 1 commit intoRIOT-OS:masterfrom brummer-simon:devel-ng_tcp
Conversation
sys/include/net/ng_tcp.h
Outdated
There was a problem hiding this comment.
For readability and documentation I would prefer to put each enum into a single line.
|
@cgundogan, maybe you are interested, too. |
|
Please don't use sub-directories in |
There was a problem hiding this comment.
ifdefs should not be necessary here
|
@brummer-simon, what's the latest on this one? |
|
Currently I am running in a bunch of problems with implementing TCP. I suspect the cause of it in RIOTs scheduling model and timer implementation. The non-premetive scheduling model seems to be the biggest obstacle because RFC 793 assumes a premetive scheduler. Currently I'll write it down and upload the pdf up for discussion. |
Huh? Since when does RIOT has a non-preemptive scheduler? Don't confuse the fact that RIOT's scheduler works without timeslices to interrupt threads periodically with the fact threads are preemptible. |
|
Okay. Still the Problem is, main Function runs as long as it doesn't put itself to sleep or wait for a message or what ever. After that TCP is able to do actual work. And this is a Problem. The TCP-Thread must be able react on incomming data as soon as possible, independently from userspace. As far as is see it this is currently a huge obstacle and i am not sure how to solve it. |
|
Okay. Still the Problem is, main Function runs as long as it doesn't put itself to sleep or wait for a message or what ever. After that TCP is able to do actual work. And this is a Problem. The TCP-Thread must be able react on incomming data as soon as possible, independently from userspace.
Give TCP a higher priority (lower priority value) than main, if your
main does busy-waiting.
|
|
Okay as general scheduling questing. If my TCP-Thread has a higher priority than my main-Thread and the TCP-Thread is currently waiting for a message, the main thread is running. If a message for the tcp thread commes in, will there be a context switch to the tcp thread as soon as the message comes in or after the main thread puts it self to sleep ? |
As soon as the message comes in. |
|
Ah okay. Then I see why its not a non-premptive scheduler. Still i'll have to figure out where exactly my Problem is. |
|
Let us know as soon as you've figured out what the problem is. Maybe we can help. |
|
Still i'll have to figure out where exactly my Problem is.
Are you testing on native?
|
|
Native and the samr-xpro board. |
|
Native and the samr-xpro board.
Are you using the shell? And if yes, are you using uart0?
|
|
Yes and Yes. Currently I focus more on Bugfixing on native. |
|
Also note that in order to give a thread a higher priority means that you
|
|
Okay followup question about scheduling. My main thread is waiting for a message. the tcp thread is running and it is sending a message to the main thread. The priority of the tcp thread is higher than main(a lower number). After the message was sent from tcp to main, main takes over. That means the priority is raised after getting a message from a higher prioritzed thread. Is that right? Ist there somehow a tutorial how the scheduler behaves? |
Not quite. After TCP thread sent the message to main thread, TCP will keep running. Just the main thread will change its state to
I'm not sure. At least there should be something in @kaspar030's thesis IIRC. |
|
The segfault has to do with the the The SYN/ACK still is invalid though, the TCP header is correct but although Any ideas? |
|
Related to issue: #3707 When we want to keep the packet for the retry timer etc. however when used is set to 1 the response would be valid but the packet is overwritten by another packet and when TCP tries to resend it, it would resend an overwritten packet. However when you set the used count to 2 since you want to keep a copy of the packet in the retry queue an invalid IPv6 header would be send. |
|
Okay I pulled the current Master and DipSwitchs Branch that did the whole renaming(Thanks by the Way:) ) and squashed the hole thing. I'll try to get the handshake going |
|
The handshake is working :) I think we can start sending data :D |
|
Nice. 😎 |
|
My original goal was to implement the connection termination first, to make sure the fsm work as it should be. But as i wrote yesterday, I focus the next months on my Bachelor Thesis. |
|
Oh the merge included a lot files that aren't involved in the hole tcp thing. I'll fix that in the afternoon. |
|
Both are even important :) good luck with your thesis! |
|
@DipSwitch please comment in the PR not the commit. Comments in commits get easily lost. |
|
You probably need to rebase to current master. There are a lot of changes in here now, that are actually a part of master already. |
|
I rebased and forced updated, sorry not the best way possible... If you do close implementation, I'll see if I can start with send in my free time ^_^ |
|
Yes I'll implement the close operation. Over the next weeks. |
|
The last time I tried (about 1 month ago), I was not able to get the test application to send anything (not even the handshake packets). Some more "formal" comments:
|
|
Hi Oleg, currently i'am doing buzy spliting the static includes into thier own c-Files, and doing some renaming. For your concern with the _fsm corresponance. TCPs statemaschine must be able to do translations, without the users interaction, in case a FIN-Packet was received. Moving from ESTABLISHED to CLOSE_WAIT. The Eventloop interacts only in case of Packet reception with the FSM. The Transmission control blocks are organized as a linked list. If the eventloop receives a packet, it looks for the receivers pid. The pid is part of an tcb as well. The eventloop searches for the receivers tcb and calls the fsm-function with this specific tcb. Long story short, only one eventloop is needed for multiple connections. |
|
Merge fuckup lead to this pull request: #4744 |
|
closed in favor of #4744 |
Current State of ng_tcp. This Branch is currently under heavy development. Your comments on the current state are very welcome :).
This PR is intendend for reference in the NSTF Todo List.