-
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
sys: net: Initial import of a general interface to a network protocol #1448
Conversation
@thomaseichinger @rousselk could you maybe look if the dummy MAC layer makes sense somehow. I based it mainly on #925, (edit ->) but tried to generalize the assumptions a bit. |
@LudwigOrtmann since HEAD~1 touches nativenet, this PR might interest you, too. |
The dummy_mac seems good to me. One thing we have to consider, what if we have 2+ radio devices of the same kind e.g. same radio driver implementation. We'd have to determine somehow which device to use. MAC / radio driver internally we can talk about either passing the device to each function call, what we do in low level drivers right now, or save the device in a variable. I'd plead for version 1, since it is more consistent to our existing model. |
The idea for dummy_mac here is very simple: the radio driver is "identified" by it's functions, which the driver developer supplies to dummy_mac via Since radio devices are very heterogenous and boards can have reattachable network devices (:point_right: arduino) I think there is no easy way via some |
I agree with you but I don't think we can find a generic way around |
Ah yes, now I see your problem. I totally forgot about that :/ |
Rebased to current status of #1492. |
Rebased and cleaned up PR a bit. |
Note: I'm aware that Travis is failing. Will fix that in a few hours ;-) |
fa256fc
to
ecd3610
Compare
73d6fa0
to
4a7a728
Compare
Rebased due to b799292 and adapted dummy_mac for ISR event handling |
2120d7f
to
f66b26d
Compare
netapi_ack_t ack; | ||
int ack_result; | ||
|
||
DEBUG("send command to %d, cmd = %p, cmd->type = %d\n", |
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.
Use PRIkernel_pid
instead of %d
.
Be consistent with full-stops in the documentation. |
Addressed @OlegHahm's comments and added new functionality to the REG command. |
* | ||
* @param[in] pid The PID of the protocol's control thread. | ||
* @param[in] reg_pid The PID of the upper layer protocol's control thread. | ||
* @param[in] demux_ctx Protocol specific demuxing context |
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.
full-stop missing ;)
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.
Oops 😊
Fixed last comment |
*/ | ||
typedef struct { | ||
/* cppcheck-suppress unusedStructMember because interface is not used yet */ | ||
netapi_cmd_type_t type; /**< Type of the command. Must be NETAPI_CMD_RCV. */ |
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.
Isn't this member superfluous if it has to be NETAPI_CMD_RCV
anyway?
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.
No, otherwise you wouldn't be able to identify the incoming netapi_cmd_t
as a netapi_rcv_pkt_t
.
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.
Why not doing it with pointers like
typedef struct {
netapi_cmd_type_t type;
void *data;
} netapi_msg_t;
?
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.
Why have another pointer (and 2-4 byte more for every command depending on the platform) deeper down when you can have all the data on the same level?
Other answer: because I use it like this (very successfully, see this file in #1680 e.g.) for months now and it would cost way more time than I'd like to put into it to change it to your approach ;-)
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.
Hm, I see.
Kicked Travis. Apart from the name of |
* @return -ENOMSG if wrong acknowledgement was received or was no | ||
* acknowledgement at all. | ||
*/ | ||
int netapi_send_data(kernel_pid_t pid, netdev_hlist_t *upper_layer_hdrs, |
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.
@OlegHahm Use-case: Send data as it is intended to be: Payload and Headers seperated, a lower layer is in charge of the reassembly.
ef93fa4
to
8ceb24e
Compare
Rebased to master |
ACK. From my point of view, ready to be squashed and merged. @haukepetersen, you want to comment on this? |
8ceb24e
to
598e73b
Compare
Squashed |
no, just looked through it again, looks fine to me -> ACK |
Very core-like for something that is not used by now :D |
598e73b
to
b7a0794
Compare
Changed commit author. |
sys: net: Initial import of a general interface to a network protocol
The definitions for the new network stack API