-
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
pkg/lwip / pkg/tinydtls: use new mbox_avail() / mbox_unset() function. #15484
Conversation
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.
ACK. Straight forward replace of cib_avail(&mbox->cib)
with mbox_avail(mbox)
Sorry, decided last minute to also create and use mbox_unset()
core/include/mbox.h
Outdated
@@ -185,6 +185,17 @@ static inline size_t mbox_avail(mbox_t *mbox) | |||
return cib_avail(&mbox->cib); | |||
} | |||
|
|||
/** | |||
* @brief Unset's the mbox, effectively deinitializing invalidating it. |
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.
both deinitializing and invalidating? Comma missing? :)
This leaks a possibly supplied queue. Maybe better call it mbox_release_queue?
The mbox actually works without queue, it'd just be synchronous from that point on.
This is also a bit dangerous, if this is called with messages in the queue, they get lost. If there's a sender that was previously waiting, it would be stuck there until the queue transitions from full to empty again.
Why is this needed?
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 suggest splitting, the other changes were already ACKed...)
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 is this needed?
Scroll the code and you see, that lwIP requires a way to invalidate their mboxes and check the validiy.
RIOT/pkg/lwip/include/arch/sys_arch.h
Lines 101 to 111 in dd1de91
static inline bool sys_mbox_valid(sys_mbox_t *mbox) | |
{ | |
return (mbox != NULL) && (mbox->mbox.cib.mask != 0); | |
} | |
static inline void sys_mbox_set_invalid(sys_mbox_t *mbox) | |
{ | |
if (mbox != NULL) { | |
mbox->mbox.cib.mask = 0; | |
} | |
} |
I agree that the current approach is not the correct one, maybe. Any idea how we should proceed with that?
(I suggest splitting, the other changes were already ACKed...)
Can do.
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.
See #15485
22ec43a
to
ef5e034
Compare
Reverted to ACK'd state, as suggested in #15484 (comment) |
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.
re-ACK.
Contribution description
Follow-up on #15478
Testing procedure
The following tests should still compile and run successfully:
tests/lwip
tests/lwip_sock_ip
(both withLWIP_IPV4=1
andLWIP_IPV6=1
and their combination)tests/lwip_sock_tcp
(both withLWIP_IPV4=1
andLWIP_IPV6=1
and their combination)tests/lwip_sock_udp
(both withLWIP_IPV4=1
andLWIP_IPV6=1
and their combination)tests/pkg_tinydtls_sock_async/
Issues/PRs references
Follow-up on #15478