-
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
ieee802154_submac: add initial support for common MAC sub layer #14950
Conversation
b2dc920
to
83c8676
Compare
83c8676
to
caba86e
Compare
Just pushed an implementation of |
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.
Looking good!
Some comments
return count; | ||
} | ||
|
||
int txtsnd(int argc, char **argv) |
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.
Isn't there a gnrc_txtsnd
already?
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.
yes, but this test has no GNRC dependencies, so we couldn't use that one :(
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 it can be moved elsewhere to be put in common?
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.
we could do that. Ideally it would be cool to have an L2 interface here (this is exactly what txtsnd
does)
0ad1e04
to
362d259
Compare
rebased on top of #14984 |
60e63ac
to
fbbb882
Compare
rebased on top of master |
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.
Nice work @jia200x, a couple of comments on the interface, I haven't followed the discussion that closely so maybe this had already been agreed upon before.
bool wait_for_ack; /**< SubMAC is waiting for an ACK frame */ | ||
bool tx; /**< SubMAC is currently transmitting a 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.
Whats the difference between this tx
and the ieee802154_submac_state_t
couldn't a TX_STATE
be added there? Could a waiting_for_ack
state be added there as well?
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.
The thing is, the ieee802154_submac_state_t
states are simply "upper layer states" (they don't reflect the internal state machine).
@benpicco I'm having issues integrating the
|
66e7e18
to
e93c362
Compare
Oh well, Murdock is still not happy, but this time we again ran into the build system limitation that modules can't provide features. Maybe just whitelist a select few boards for the test? That would be the easiest solution. |
I had MAC layer security implemented in my RIOT fork in a branch for an |
Yea since now it world not have to be driver specific and could just work ™️ with any 802.15.4 / sub-MAC driver. AFAIU the payload would be encrypted / decrypted by the sub-MAC and then handed to the driver. |
This could be indeed analyzed. I was always considering that the encryption was going on top of the SubMAC (by the actual MAC component), but there are some radios that do in-place encryption. This means it could be possible to add security to the SubMAC, if we think it makes sense |
e93c362
to
9ebc3f8
Compare
done! let's see how it goes now |
The But the call to decrypt/encrypt a frame still happens in
(then I have the raw data what has been received)
That´s what I think of. Or do you think encrypt()/decrypt() should be called by |
Yes. It emulates a "super" radio with frame retransmissions, CSMA-CA and any other features.
The idea would be to have this as a stack independent component (otherwise it's attached to GNRC). This could be done properly with a MAC layer, or ismply trying to integrate this feature to the SubMAC (if applies).
I think this multiplex here could work OK with the SubMAC. Maybe it could be the right place to put it.
I'm not entirely sure how the encryption works here. Do you think it could make sense? If so, I don't see any showstoppers for going in this direction. |
green :) |
That check-labels thing is weird - what does it actually do? |
thanks a lot for the review!! |
+1. I always require to remove and re-add a label |
This is indeed weird. It should react to open, reopen, label, unlabel, and reviews but appearently it is also resetted to pending on push. :-/
Checking labels: https://github.com/RIOT-OS/check-labels-action/ |
Sorry for the late reply, but I was thinking about it and I am still not sure if it would make sense. Maybe you can checkout #15150 |
Contribution description
This PR adds initial support for the IEEE 802.15.4 SubMAC (#13376). Although this component was introduced in the draft PR #14787 , this PR should contain the "merge-able" version.
In a nutshell, this module provides a uniform layer to send and receive IEEE 802.15.4 MAC frames with retransmissions and CSMA-CA. The SubMAC emulates in software hardware features (CSMA-CA, Retransmissions, etc) missing on a given radio.
This component also keeps track of certain MAC Information Base parameters like channel settings, TX power, etc. An upper layer might (in the near future) request such information directly from the SubMAC layer instead of fetching it from a network device.
Besides that, I added a a
netdev_ieee802154_submac
as a transition layer. With this, default and gnrc_networking are indirectly working on top on the Radio HAL (#13943 ).Since the Radio HAL (#14371 ) is asynchronous, #11263 is required in order to send packets with several 6LowPAN fragments.
This module heavily improves the performance of radios without retransmissions / CSMA-CA handling (see e.g #14787 (comment)).
In the future, the full IEEE 802.15.4 MAC layer (to be implemented) can benefit of this, as well as applications interested in the lower part of the MAC layer (CSMA-CA, retransmissions, etc) like
lwip
.Testing procedure
So far, only the CC2538 has an implementation of the Radio HAL API, but this might change depending on the status of #14792.
netdev
abstraction still works as expected with GNRC.tests/ieee802154_submac
to send and receive packets using the SubMAC.gnrc_networking
anddefault
using thenetdev_ieee802154_submac
module. E.gUSEMODULE=netdev_ieee802154_submac BOARD=cc2538dk make -C examples/gnrc_networking all flash term
. Try to run some tests and compare the performance for radios without CSMA-CA or retransmissions. I suggest running the Release tests.Here are some test results for
samr21-xpro
andremote-revb
using this PR (both with CSMA-CA and retransmissions):Disabling retransmissions in
cc2538
(similar to what we have in master):Issues/PRs references
#13376
#14787
#11263