sock_async: initial import of event-based implementation#12602
sock_async: initial import of event-based implementation#12602fjmolinas merged 2 commits intoRIOT-OS:masterfrom
Conversation
022d687 to
6650680
Compare
|
I rewrote this so that the callback types from |
6650680 to
477bcc0
Compare
Forgot to amend the co-authorship 😅. No longer waiting for another PR (#11723 was merged a while back and I rebased it to current master. Also no longer WIP as the work that was in progress is now done with the latest update |
477bcc0 to
3aae764
Compare
|
With #12625 now merged, I rebased to current master and adapted the test |
| #ifdef MODULE_SOCK_DTLS | ||
| #include "net/sock/dtls.h" | ||
| #endif /* MODULE_SOCK_DTLS */ | ||
| #include "net/sock/ip.h" | ||
| #include "net/sock/tcp.h" | ||
| #include "net/sock/udp.h" | ||
| #include "net/sock/async.h" |
There was a problem hiding this comment.
When re-ordering this to a more sensible order I fall into the same trap as I am currently stuck in with sock_dtls in #12907 :-/
diff --git a/sys/include/net/sock/async/event.h b/sys/include/net/sock/async/event.h
index 9533334ff..02ad40cda 100644
--- a/sys/include/net/sock/async/event.h
+++ b/sys/include/net/sock/async/event.h
@@ -157,6 +157,7 @@
#define NET_SOCK_ASYNC_EVENT_H
#include "event.h"
+#include "net/sock/async.h"
/* guard required since `sock_dtls_types.h` might not be provided */
#ifdef MODULE_SOCK_DTLS
#include "net/sock/dtls.h"
@@ -164,7 +165,6 @@
#include "net/sock/ip.h"
#include "net/sock/tcp.h"
#include "net/sock/udp.h"
-#include "net/sock/async.h"
#ifdef __cplusplus
extern "C" {In file included from /home/mlenders/Repositories/RIOT-OS/RIOT/sys/include/net/sock/ip.h:453,
from /home/mlenders/Repositories/RIOT-OS/RIOT/sys/include/net/sock/async.h:31,
from /home/mlenders/Repositories/RIOT-OS/RIOT/sys/include/net/sock/async/event.h:160,
from /home/mlenders/Repositories/RIOT-OS/RIOT/sys/net/sock/async/event/sock_async_event.c:16:
/home/mlenders/Repositories/RIOT-OS/RIOT/sys/net/gnrc/sock/include/sock_types.h:58:36: error: unknown type name ‘sock_async_flags_t’
58 | sock_async_flags_t flags);
| ^~~~~~~~~~~~~~~~~~
/home/mlenders/Repositories/RIOT-OS/RIOT/sys/net/gnrc/sock/include/sock_types.h:81:9: error: unknown type name ‘gnrc_sock_reg_cb_t’
81 | gnrc_sock_reg_cb_t generic; /**< generic version */
| ^~~~~~~~~~~~~~~~~~
/home/mlenders/Repositories/RIOT-OS/RIOT/sys/net/gnrc/sock/include/sock_types.h:83:9: error: unknown type name ‘sock_ip_cb_t’
83 | sock_ip_cb_t ip; /**< IP version */
| ^~~~~~~~~~~~
/home/mlenders/Repositories/RIOT-OS/RIOT/sys/net/gnrc/sock/include/sock_types.h:86:9: error: unknown type name ‘sock_udp_cb_t’
86 | sock_udp_cb_t udp; /**< UDP version */
| ^~~~~~~~~~~~~
"make" -C /home/mlenders/Repositories/RIOT-OS/RIOT/sys/net/gnrc/pktdump
/home/mlenders/Repositories/RIOT-OS/RIOT/sys/net/gnrc/sock/include/sock_types.h:90:5: error: unknown type name ‘sock_async_ctx_t’
90 | sock_async_ctx_t async_ctx; /**< asynchronous event context */
| ^~~~~~~~~~~~~~~~
"make" -C /home/mlenders/Repositories/RIOT-OS/RIOT/sys/net/gnrc/sock
There was a problem hiding this comment.
The problem is that there is a circular dependency, where-in both sock_types.h/sock_dtls_types.h of the network stack requires to include net/sock/async.h to add members related to asynchronous behavior to the type definition of the socks, while net/sock/async.h needs to include net/sock/<prot>.h to access the sock types which in turn pulls in sock_types.h/sock_dtls_types.h for the actual type definition of the socks. I'm currently unsure how to solve this :-/.
3aae764 to
d996506
Compare
|
Added #12921 as a dependency for the cyclic header dependency problem. |
|
@miri64 you can rebase this one :) |
d996506 to
0131708
Compare
|
Rebased and squashed. No longer waiting for another PR. |
|
Just to be clear, this should be mergeable during soft feature freeze, right @fjmolinas? |
Yes for me this is a contained feature so it can get in, but maybe tagged as experimental though. And by that I mean that bug fixes wouldn't get backported. |
Done |
fjmolinas
left a comment
There was a problem hiding this comment.
Tested the documentation and the code.
Minimal example:
2020-01-14 15:16:15,200 # �main(): This is RIOT! (Version: 2020.01-devel-1628-gfead8-pr-12602)
2020-01-14 15:16:18,227 #
2020-01-14 15:16:20,895 # Received a message
2020-01-14 15:16:22,111 # Received a message
I would personally ACK this, code looks good and I have tested my issue is that it was tagged as RFC (only I have commented so ar) and I'm not that familiar with the event api. Can someone else give it a second look as well maybe @kaspar030 or @jia200x? (it shouldn't be too much work)
sys/include/net/sock/async/event.h
Outdated
| * | ||
| * You need to [include](@ref including-modules) at least one module that | ||
| * implements a [`sock` API](@ref net_sock) and the module `sock_async_event` in | ||
| * your application's Makefile. |
There was a problem hiding this comment.
I used the following modules:
USEMODULE += auto_init_gnrc_netif
USEMODULE += gnrc_netdev_default
USEMODULE += gnrc_ipv6_default
USEMODULE += sock_async_event
USEMODULE += gnrc_sock_async
USEMODULE += gnrc_sock_udp
I think it would make easier for a user to give it a test if those modules are given es examples. What I mean by that would be for example and at least one network device (e.g: gnrc_netdev_default) and implements a [sock API](@ref net_sock) (e.g: gnrc_sock_async, gnrc_sock_udp). I won't insist on this though, since it wasn't hard to figure out the needed MODULES
|
IMO this one is good to go, please squash! |
05ba39d to
2687b24
Compare
|
Squashed |
This has been open for a while so I'm going with out implicit rule, no comment being a go ahead (not sure oh the exact formulation hahaha). Adding it to the long murdock queue. |
|
The test fails for |
|
Murdock only failed on unrelated tests, re-triggering without tests. I'll take a look at the failing tests since I have both boards. |
Would be great to have the output as well. Is it a setup/flash problem or a real failure of the test itself (a crash or something) ? |
I'll test locally. |
|
Since the build now went on (and I don't know if the logs are recoverable... @kaspar030?) I just can summarize from memory, that it was the test script itself that failed (on line 10) |
Both timed-out on expecting the digit match. |
|
Can |
|
Thanks for testing and the review @fjmolinas! |
In my experience both |
|
Thanks for reporting @miri64. I tested tensorflow-lite on nrf52 and it was working. But the fact that 2 platforms are failing on the same test in the same run put some doubt :) |
Only one build for |
I captured the output from the build of #12848, will open an issue. |

Contribution description
This provides a
event-based front-end implementation forsock_async(see #11723).Testing procedure
You can test (did not try this yet) the example provided in the header with the GNRC backend in #12625.
Issues/PRs references
Requires
#11723(merged) and#12921(merged).