net: Introduction of global protocol handler registry -> netreg (WIP)#2310
net: Introduction of global protocol handler registry -> netreg (WIP)#2310haukepetersen wants to merge 8 commits intoRIOT-OS:masterfrom
Conversation
|
In general I like the idea, but I'm conflicted if
|
I think the contrary is true, as the network modules do not have to care about storing PID's anymore -> see removed code in
You have to think of protocol more as network module, so we could add a module |
This will definitely increase code overhead. Instead of: "give me all UDP threads" it would be "give me UDP1, UDP2, UDP3" and ideally (not) with an humongous tree of In general I see a lot of reintroduction and requirements of |
|
On a more constructive note: how about making the registry a list of (kernel_pid_t, kernel_pid_t, pkt_proto_t) tuples, where the first ist always the lower and the last always the upper layer thread. This way we identify implementations by their PIDs and specifications by an arbitrary number that is independent of the implementation as before. |
|
There is also the matter of demultipexing identifiers (next header identifiers in IPv6, Ports in UDP/TCP) that is missing from here. |
|
Hm, I see it completely on the contrary: For one I don't see any I also don't see the overhead: Why would you do something like: give me all UDP threads? |
|
Ok, UDP might have been a bad example, but take for example Broadcast in IP: "give me all MAC threads". |
|
It's also still unclear to me: If I have a e.g. a cc110x device with a |
|
And how would I find out which address to use / which header (if we decide upon it) to use if the |
You wouldn't use either of them :-) As interfaces are are accessed by there interface identifier, thats what you use. So if you have a standard IP address you want to send to, you ask your neighbor table to give you the interface id for that device. You ask then the netreg for the PID of that interface. In case of multicast/broadcast, the neighbor/forwarding table gives you a list of interface ID's you can lookup. |
There was a problem hiding this comment.
Would start with something like NETMOD_UNDEF for unidentified data. To save space in the lookup-array and to have the correct behaviour for NETMOD_NUMOF I would suggest:
typedef enum __attribute__((packed)) { // packed to make enum as small as possible
NETMOD_UNDEF = -1,
#ifdef MODULE_UDP
NETMOD_UDP,
#endif
/* … */
NETMOD_NUMOF
}|
as I said, it's more or less pseudo-code. I will only start to make it work when we really decide to run with this concept... |
|
Can we close this after #2404 got merged or do you plan to use this for a somehow optimized version of netreg? |
|
this PR is it's obsolete. |
This PR is opened for discussion and to demonstrate the concept of a global protocol handler/module registry that takes care or keeping lists of PID's.
This code is not compiling (I havn't even tried) and please don't spend much thought on the doxygen... I just want to get feedback on the overall concept.
The main things shown are:
netregnetmodnetapiby throwing out everything related to (un-)registeringpkt_tto make use ofnetmodnomacby making use ofnetreg(and integrating some thoughts about netdev -> compare to net: minimization and simplification of netdev (WIP) #2297)Let me know what you think or where I have more explaining to do!