netif: Initial import of a common network interface API#6413
netif: Initial import of a common network interface API#6413miri64 wants to merge 11 commits intoRIOT-OS:masterfrom
Conversation
|
@kaspar030 I added the params-structs for the auto-initialization of |
|
Rebased to current master and refined documentation |
Refine documentation
Simplify netif_type and start skeleton implementation
sys/include/net/netif.h
Outdated
| */ | ||
|
|
||
| /** | ||
| * @defgroup Network interfaces |
There was a problem hiding this comment.
should be @defgroup net_netif Network Interfaces?
|
I hit a wall when trying to port the auto-initialization for GNRC... (mainly questions like: "Where is the thread's memory stack stored and how is its size determined?" and "Where is the adapter struct stored?") Need to think about this a bit more :-/. Input is welcome. |
For this question I basically have an answer (and had when I stated that question) already in my back-hand an answer, but this is related to my over-all GNRC overhaul. |
| */ | ||
| const void *dev_params; | ||
| netif_type_t type; /**< type of the interface */ | ||
| const char *name; /**< name of the interface */ |
There was a problem hiding this comment.
is it necessary to have the name attached to every device?
I was thinking of something like a common prefix for certain netif_type_t types and let the system number them starting with 0. (Or instead of const char *name have a uint8_t name_prefix.) And then have map from type (or name_prefix ) to a char prefix (without a number), e.g. "eth" or "wpan" or maybe "gnrc"?
I hope you get what I mean 😕 ❓
There was a problem hiding this comment.
Hi, I think that makes the initialization just more complicated, because then we need to keep track of how many interfaces are already initialized. The auto-initialization is already pretty complicated so let's not make things more complicated for a totally optional thing for most stacks (the only stack actually requiring a name at the moment is lwIP).
|
Can you please elaborate what you intend to do with this interface? |
For now I am only planing auto-initialization, yes. But long-term plans include a generalized
What define are you talking about? |
|
Maybe we should define first what needs to be configurable, find a nice way of representing that, and then code the initialization around that?
You've got IMO it would make sense to keep configuration within the stacks, come up with a way to configure which stack uses which network device, and let them handle it as desired. |
I think these can be removed, the number in the enum is all what matters after all.
This is what this PR is about and that's exactly what I do in #7144. |
Done |
It's not about the define, it's about the dependency. As is, you'd need to edit netif if you'd like to use a previously unknown stack. That is unnecessary. For auto-init, a shared initialization function and parameter definition just don't make sense anyways. |
As is it is, because currently the auto-initialization is per device, not per stack.
Another approach I was thinking about would be put all initialized netdevs into a linked list, and then iterating over that for a stack-specific initialization. But that would mean |
|
I fear it won't make it for the release, postponed to 2017.10. |
|
Anyone care to review? |
|
@miri64 I need some help/recap on this one: is it still on? And if so how does it fit with netif2? |
|
thanks for resetting my mind 😄 So this could (or better should) wait until #7925 is merge anyways? |
|
okay I think now I got it 😉 |
|
For reference: since that is automated and I add all PRs related to #7925 to that project: https://github.com/RIOT-OS/RIOT/projects/6 gives you all related PRs (but ignore the TODO column, those are mostly notes for myself) |
|
No, but I'd like to redo this in a 2-phase approach.
|
|
Let's clean this up! I'm going back to the roots in #8841. |
Adaptation of @kaspar030's proposal in #5511.