-
Notifications
You must be signed in to change notification settings - Fork 2.1k
ng_at86rf2xx: Implement CSMA en/disable and setting retries #3138
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
@@ -754,7 +754,7 @@ int kw2xrf_set(ng_netdev_t *netdev, ng_netconf_opt_t opt, void *value, size_t va | |||
((bool *)value)[0]); | |||
return sizeof(ng_netconf_enable_t); | |||
|
|||
case NETCONF_OPT_AUTOCCA: | |||
case NETCONF_OPT_CSMA: |
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.
Is this change intensional?
nvm
The IEEE 802.15.4 (2011) standard also defines them as standard values. However, if one want to send out data at a precise time, without (unpredictable) delay, BE should be set to 0. Figure 11 (p. 23) in the IEEE 802.15.4 standard shows that the backoff-wait is performed always initially before CCA (and of course later again, if the channel was busy). Since this behaviour could be of interest for other MAC-protocols and is "hidden" in HW in this Atmel device, we should maybe document that somewhere in the driver. I think e.g. Contiki-MAC would expect a min BE value of 0 to avoid any delays before sending. The wait-time, after which the packet will be send again, is defined as:
|
That's actually a very good point. I wasn't aware that the random backoff wait is already active before the first attempt to transmitting. As I'm aiming for a MAC layer is even more important to me. So in the first step it would be ok for me to have minBE=0 as a default, but I guess this should be configurable somehow. While going through all the interfaces involved, I still fail to find a good place for this, as it's really hardware specific and maybe not well placed as a NETCONF option. What do you say? |
yes, I guess making this option configurable is a good idea. I actually think it should be an ordinary NETCONF option. All devices that implements CSMA/backoff in hardware will be able to set this option. All other devices simply don't implement it and will automatically return -ENOTSUP by design. But we should clarify in the documentation, that this option is explicitly described as hardware-only function. If the option can not be set, the MAC layer has to handle the CSMA/backoff procedure. @haukepetersen do you agree? To go further, this could even be an indication for the MAC layer to en/disable software CSMA/backoff. |
I'm without a computer for the next two and a half weeks - hence, someone else should review this. |
@OlegHahm ping |
* @brief Set the maximum number of channel access attempts per frame (CSMA) | ||
* | ||
* This setting specifies the number of attempts to access the channel to | ||
* transmit a frame. If the channel is busy *retries* times, then frame |
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.
@p retries
before sending the channel is clear. */ | ||
NETCONF_OPT_CSMA, /**< en/disable to check automatically | ||
* before sending the channel is clear. */ | ||
NETCONF_OPT_CSMA_RETRIES /**< get/set the number of retries when |
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.
Please add a semicolon, there were other options added below in the meanwhile.
d89b1ae
to
91f8e27
Compare
@jremmert-phytec-iot I updated the docs and now _AUTOCCA and _CSMA options exist both in parallel. But there is no "AUTOCCA-emulation" for at86rf2xx yet. |
Please rebase. |
@daniel-k, willing to provide an extension to the |
91f8e27
to
1f19589
Compare
Rebased. Will look into |
fec3841
to
58bc85d
Compare
@OlegHahm |
I would suggest to add either a setter for |
@OlegHahm |
aa9f871
to
1ba806c
Compare
ACK. Please rebase and squash! |
1ba806c
to
ac62a8c
Compare
ac62a8c
to
6ac9443
Compare
You have to add a string representation of the new netopt types. |
6ac9443
to
6f705a5
Compare
@OlegHahm string representations added and squashed again |
ng_at86rf2xx: Implement CSMA en/disable and setting retries
When enabling CSMA it defaults to 4 retries and sets min BE to 3 and max BE 5. I'm not sure if these are sensible defaults, they are the reset values of the transceiver.
The BE cannot yet be configured though. I wasn't sure how to integrate the BE setting into the given interfaces, so any proposal is welcome!
I'm not sure if there is a way to test and verify this in the current state, but I've got more changes in the pipe that depend on this (namely TX feedback, see #3125).