-
Notifications
You must be signed in to change notification settings - Fork 2.1k
ieee802154: Add support for default flag settings #9592
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
Conversation
As a follow up I'd like to extend this to also set the channel and PAN ID this way. |
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 agree with the general idea. Only checked the gnrc code change.
Maybe there should be some ifdef for removing the dead code if we are building an application without 802.15.4 (e.g. Ethernet only), to reduce the rom usage
sys/net/gnrc/netif/gnrc_netif.c
Outdated
@@ -1226,6 +1226,29 @@ static void _init_from_device(gnrc_netif_t *netif) | |||
_update_l2addr_from_dev(netif); | |||
} | |||
|
|||
static void _configure_netdev_802154(netdev_t *dev) | |||
{ | |||
netopt_enable_t enable = NETOPT_ENABLE; |
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.
Make this static const to reduce stack usage
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
sys/net/gnrc/netif/gnrc_netif.c
Outdated
switch(dev_type) { | ||
case NETDEV_TYPE_IEEE802154: | ||
_configure_netdev_802154(dev); | ||
break; |
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.
Maybe there should be some ifdef for removing the dead code if we are building an application without 802.15.4 (e.g. Ethernet only), to reduce the rom usage
I can put a #ifdef MODULE_NETDEV_IEEE802154
around the case here and the configuration function above.
@gebart fixed! I've also added an ifdef around the config in LwIP. I've used |
I actually already dislike the |
Yeah, I agree with this.
What exactly is the I strongly prefer to keep the initialization of the device settings outside of netdev. When we have the layered netdev approach, it can be dangerous to set netopt settings halfway the stack. Layers on top of the layer enabling settings might have to be aware of settings that get enabled/disabled or have to mask certain settings for lower layers. For example a software "AUTOACK" layer would have to be aware of enabling or disabling the Maybe we can move this to the |
Agreed :-/ |
@miri64 I've moved the flag setters for gnrc to a new (but already supported) |
I just tested it. My expectation would be that if I set |
@bergzand ping? |
It was originally intended. For now it is probably better to enable/disable every setting the way it is defined. In the long I'd like to remove the mix of flag settings from each device and only enable the flags required/configured by the network stack. |
Ok. That should however be done ASAP after this PR was merged. |
Ping @bergzand? |
There is this function. It ask for the radio capabilities. So, up to a certain level we can specify some flags at compile time and report them to the stack with that function. Concerning CHANNEL, PANID, etc we might need to think how to integrate them at compile time. We have our own init for OpenThread, so I guess it's possible ;) |
@jia200x But from the set of { |
I will check this ASAP. At least I know the ACK_REQ and AUTOACK are required with the current implemetation. Ping me during the next week if I don't reply :) |
This adds support to GNRC for enabling radio flags on device initialization
This adds support to LwIP for enabling radio flags on device initialization
This adds support to emb6 for enabling radio flags on device initialization
ACK_REQ and AUTOACK are always forced on independent of the settings as Openthread requires that these are enabled.
61d5179
to
84e9b6d
Compare
Rebased and added openthread based on @jia200x current instructions. |
@@ -74,6 +76,31 @@ static gnrc_pktsnip_t *_make_netif_hdr(uint8_t *mhr) | |||
return snip; | |||
} | |||
|
|||
static void _init(gnrc_netif_t *netif) |
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.
This should also be called when a NETOPT_STATE_RESET
set is done
@jia200x More ping! |
@bergzand The current OpenThread port assumes:
However most of these features are also implemented by OpenThread (but not used in the RIOT implementation). So, in theory there's no strict requirement on {ACK_REQ, AUTOACK, CSMA} set to make it work. But ACK_REQ should be enabled. The thing is, otPlatRadioGetCaps should be implemented with netdev->driver->get calls (NETOPT_CSMA, NETOPT_AUTOACK, etc). I plan do it now-ish :) TL;DR: Let's assume for now only AUTOACK and ACK_REQ are required (I guess it also calls NOACK if failed, doesn't?) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
Contribution description
This PR adds a number of configuration flags to
ieee802154.h
similar to the current defaultPANID
andCHANNEL
define. This allows for configuring theAUTOACK
,ACK_REQ
andCSMA
flag at compile time.Except for Openthread, the current set of supported network stacks are updated to set these flags on interface initialization.
Issues/PRs references
Testing
samr21-xpro
Remove L81-L83 from the at86rf2xx driver to prevent it from setting its own default. Also keep in mind that there is the issue piggybacked with #9581 where modifying the
AUTOACK
flag influences theACK_REQ
flag.Other radios
The other radios have different defaults enabled in their reset functions which should be removed to effectively test this PR.
Known issues
For some reason the
AUTOACK
flag is always enabled on the at86rf2xx independent of the settings provided in this PR, I haven't tested yet if the other radios are also affected, but it could be a default setting from the radio hardware itself.I don't really like the code duplication between the stack initialization functions but at the moment I don't know a nice place to put a common settings init function
@jia200x Does OpenThread require any specific flags from the network interface to function, does it make sense to honor the settings provided at compile time as much as possible except for any flags strictly required?