-
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/auto_init: allow delayed initialisation of SAUL & gnrc_netif #13548
Conversation
5e392f5
to
ac56ee0
Compare
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.
First ground-level review.
Neither |
Huh? |
Ah, maybe because you now effectively made them PSEUDOMODULES, but that means, they are always included in the build even if they are thrown out later (in the optimization step). |
Is that a problem? |
Modules you don't have to include but are just compiled under certain side conditions sound like a problem, yeah. Maybe its not really inconvenient now, but can very well fall on our feet some day ;-).
If you want to have it as a mostly empty function as part of the main module then describe it as such in the build system. If not, then make it a sub-module (maybe as a pseudo-module). |
I'm not sure what you mean (and how the possible solution would look like).
If neither of the two modules is used, neither of the two modules is build. |
May I push into your branch? I think it's quicker if I just do that instead of trying to explain... |
Sure, go ahead. |
Done. |
I moved the Furthermore, IMHO the PR should contain in the end two commits: one for the |
Yes that works for me 😄 |
Yes, please. |
b83cefe
to
7d2cf2a
Compare
Co-authored-by: Martine S. Lenders <[email protected]>
Co-authored-by: Martine S. Lenders <[email protected]>
7d2cf2a
to
521b1ce
Compare
All green here! |
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. Tested that functions where still compiled in. And tested the delyed init mechanism:
2020-03-05 17:02:05,324 # help
2020-03-05 17:02:05,326 # Command Description
2020-03-05 17:02:05,330 # ---------------------------------------
2020-03-05 17:02:05,335 # udp send data over UDP and listen on UDP ports
2020-03-05 17:02:05,340 # start Bring up network interfaces
2020-03-05 17:02:05,343 # reboot Reboot the node
2020-03-05 17:02:05,348 # ps Prints information about running threads.
2020-03-05 17:02:05,352 # ping6 Ping via ICMPv6
2020-03-05 17:02:05,355 # random_init initializes the PRNG
2020-03-05 17:02:05,360 # random_get returns 32 bit of pseudo randomness
2020-03-05 17:02:05,365 # nib Configure neighbor information base
2020-03-05 17:02:05,369 # ifconfig Configure network interfaces
2020-03-05 17:02:05,376 # rpl rpl configuration tool ('rpl help' for more information)
2020-03-05 17:02:05,381 # 6ctx 6LoWPAN context configuration tool
> ifconfig
2020-03-05 17:02:06,589 # ifconfig
> start
2020-03-05 17:02:09,213 # start
> ifconfig
2020-03-05 17:02:10,918 # ifconfig
2020-03-05 17:02:10,922 # Iface 7 HWaddr: 13:36 Channel: 26 NID: 0x23
2020-03-05 17:02:10,926 # Long HWaddr: D3:C1:6D:4E:AB:6A:13:36
2020-03-05 17:02:10,930 # TX-Power: 0dBm State: IDLE
2020-03-05 17:02:10,933 # AUTOACK ACK_REQ AUTOCCA
2020-03-05 17:02:10,938 # L2-PDU:102 MTU:1280 HL:64 RTR 6LO IPHC
2020-03-05 17:02:10,941 # Source address length: 8
2020-03-05 17:02:10,944 # Link type: wireless
2020-03-05 17:02:10,949 # inet6 addr: fe80::d1c1:6d4e:ab6a:1336 scope: link VAL
2020-03-05 17:02:10,952 # inet6 group: ff02::2
2020-03-05 17:02:10,955 # inet6 group: ff02::1
2020-03-05 17:02:10,958 # inet6 group: ff02::1:ff6a:1336
2020-03-05 17:02:10,959 #
2020-03-05 17:02:10,962 # Statistics for Layer 2
2020-03-05 17:02:10,965 # RX packets 0 bytes 0
2020-03-05 17:02:10,969 # TX packets 2 (Multicast: 2) bytes 86
2020-03-05 17:02:10,973 # TX succeeded 2 errors 0
2020-03-05 17:02:10,975 # Statistics for IPv6
2020-03-05 17:02:10,978 # RX packets 0 bytes 0
2020-03-05 17:02:10,983 # TX packets 2 (Multicast: 2) bytes 128
2020-03-05 17:02:10,986 # TX succeeded 2 errors 0
2020-03-05 17:02:10,986 #
Maybe the next step is to generalize the "netif up" command (already used in gnrc_lorawan for setting up the connection). It would be possible to call e.g |
In general, I agree but shouldn't this rather be modeled as a |
It would be indeed possible, but IMO it's too primitive and low level that I have the impression it would be a perfect candidate for it's own mechanism (same as the "send()"). |
(for handling connections we could use the NETOPT_LINK netopt, but I still think it would be better to have a dedicated function to initialize the device) |
I don't understand how this is too primitive.
If so, then that function should call |
That raises the question: What state should a device be in after |
What speaks against that? This PR is still valuable IMHO, as a separate |
But for now we only have one way to initialize the interface (first lines of the
I tend to say SLEEP after |
|
The flow could look like |
Ok, it falls to semantics. But the idea is the same :)
True |
And that way you break potentially your interface because none of these functions were called from the operating context/thread (which the network device might expect ;-)). |
There might be some benefits of leveraging this though IMO :). As discussed some time ago, we could potentially get rid of the |
Shouldn't it be the other way round? |
We should first make it possible to wake an interface up, then redesign ;-). |
Yes, of course. I was referring to the process (basically the "up" mechanism calls |
But you might want to initialize the radio even if you don't want to bring up the interface. |
I see what you mean. Why don't we add a proper "init" function to the raw driver (e.g at86rf2xx_init" and only leave the start up code in |
This was pointed out here #12469 (comment) |
Allow to disable auto_init_gnrc_netif, but still retain the capability
of initialising network interfaces manually at a later time.
Contribution description
Testing procedure
The default behavior should remain unchanged.
You can try out the delayed manual initialization of network devices with
this patch
Issues/PRs references
alternative to #13488