-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
netdev2_test: initial import #4835
Conversation
@PeterKietzmann maybe of interest to you for the next iteration of |
@thomaseichinger @OlegHahm @rousselk and others might also be interested for testing their MAC implementations. |
Yes I am, thanks! Might take some days to review. But somehow the name (netdev2_test) and maybe also the location of that file seem strange to me. |
Well it's a test framework and a network library. Where else should it go and be called in your opinion? |
Well, I know it's not really concrete but ideas going through my head:
What do you think? |
IMHO it's neither a stub, nor lacking a link, nor is it empty. Because of the callbacks it's quite powerful and could even be used to write (or [partially] wrap) a real driver.
But it is no device, but a library. Though it's position is special
I gave a small example in the doc, but sure a test application for a full example might be helpful. |
* } | ||
* | ||
* int main(void) { | ||
* ipv6_addr_t dst = IPV6_ADRD_UNSPECIFIED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ADDR?
I'm not sure I quite get the concept. |
Don't think of it as a layer but a test dummy. It allows for total control of what should happen at the device level while providing an interface that is exactly the same to a normal |
Whats the advantage over just defining a netdev2_t whose "driver" passes through stuff to a (possible) real driver? |
It's a) platform independent (no need for a dependency on a specific netdev) |
And again: don't think of it as an overriding or adaption layer between a stack and a device, but a separate device. Just because you can override functionality of an existing device with this does not mean you have to. My showcase will hopefully demonstrate this. |
done.
I think this can be simplified a lot. |
Since I don't get what this has to do with this module... what it netdev2_test fields? How are they composed? How do I reperesent a device that has an l2addr length of 8 AND a device that has no l2addr at all with this to simulate a border router e.g.? What is |
Or do you mean that |
Also would time measurements be done in this scenario? |
Regardless of this discussion: I will use this framework for my experiments. I only have 5 weeks left for my thesis so not much time to redo stuff... |
It's netdev2 with getters/setters for the driver struct and an array for get/set handlers. Maybe that is handy. |
Added a test application. |
I'm not available during the next days. @kaspar030 would you take this PR over? You are already involved in discussions and Martine is in a hurry... |
6d19fe6
to
b04f4c0
Compare
Rebased and adapted to current master. |
Done. |
or Fixed. |
Confirmed that the tests succeeds now. I need to further look into your code. |
mutex_lock(&dev->mutex); | ||
if (dev->recv_cb != NULL) { | ||
/* could fire context change and call _recv so we need to unlock */ | ||
mutex_unlock(&dev->mutex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see why you unlock so mutex before recv_cb
but what if recv_cb == NULL
? Don't you need to unlock the mutex in that case as well?
I would have liked some more control messages in the application to better understand the program flow. E.g. one before a netdev action happens and one message per callback to see some kind of action-response scheme. But I leave it up to you how to improve that :-) |
void *info); | ||
|
||
/** | ||
* @brief Callback type to handle device initialization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's picky but sometimes you end the line with a dot and sometimes you don't
@authmillenon we're not far from ACKing :-)! |
What do you mean by control messages? Isn't messaging a little bit to complicated for this simple test application? |
Addressed comments |
I didn't mean messages in terms of IPC but as "debug messages" to STDOUT. IMO it is not too simple. For example: I also put some printfs here and there and stepped through the application code to see what is happening before the output says "test successful". Besides of that: please squash |
Imports a generic framework to test and experiment with netdev2-based modules.
773259a
to
09852e1
Compare
Done. |
|
Black list I would say. Will fix. |
09852e1
to
076a49b
Compare
Added |
Good idea! Then -finally- let's get this in. ACK and go |
Imports a generic framework to test and experiment with netdev2-based modules.