Skip to content
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

drivers/at86rf2xx: isolate netdev logic #18988

Merged
merged 13 commits into from
Dec 7, 2022

Conversation

jia200x
Copy link
Member

@jia200x jia200x commented Nov 28, 2022

Contribution description

This PR isolates the netdev logic, in order to facilitate the replacement with the Radio HAL interface.
There's still more cleanup to be done, but I think this is the bare minimum to write the Radio HAL port. We can later continue with optimizations.

Testing procedure

AT86RF2xx devices should still work as expected.

Issues/PRs references

#18967

@github-actions github-actions bot added the Area: drivers Area: Device drivers label Nov 28, 2022
@jia200x jia200x force-pushed the pr/at86rf2xx/isolate_netdev branch from 19dcb76 to a544b98 Compare November 28, 2022 15:38
@jia200x
Copy link
Member Author

jia200x commented Nov 28, 2022

This PR is technically an API change, because I removed several functions (getters, at86rf2xx_send). However, these functions were never used and some of them may not even work. Therefore, I propose to just remove them without deprecation

@jia200x jia200x added the Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation label Nov 28, 2022
@jia200x jia200x force-pushed the pr/at86rf2xx/isolate_netdev branch from a544b98 to f34695f Compare November 29, 2022 10:17
@github-actions github-actions bot added the Area: tools Area: Supplementary tools label Nov 29, 2022
@jia200x jia200x added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Dec 5, 2022
@riot-ci
Copy link

riot-ci commented Dec 5, 2022

Murdock results

✔️ PASSED

1d60301 doccheck: update AT86RF2XX macros

Success Failures Total Runtime
118126 0 118126 01h:58m:39s

Artifacts

@jia200x jia200x force-pushed the pr/at86rf2xx/isolate_netdev branch from 83f27d0 to fa61430 Compare December 6, 2022 14:41
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just moves code around, solid cleanup.
Some small comments:

@@ -363,7 +363,6 @@ void at86rf2xx_set_option(at86rf2xx_t *dev, uint16_t option, bool state)
DEBUG("[at86rf2xx] opt: enabling CSMA mode" \
"(4 retries, min BE: 3 max BE: 5)\n");
/* Initialize CSMA seed with hardware address */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment needs to be moved too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just squash directly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

#ifdef MODULE_SIXLOWPAN
/* https://tools.ietf.org/html/rfc4944#section-12 requires the first bit to
* 0 for unicast addresses */
dev->netdev.short_addr[0] &= 0x7F;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

netdev_eui64_get() should already take care of this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup. But since that was already there (and #19015 is the direct follow up) I didn't want to fix these snippets, since they are not used at all in #19015

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, if you are getting rid of this anyway you might as well keep it.

Comment on lines +276 to 286
netdev_ieee802154_reset(&dev->netdev);
/* set short and long address */
at86rf2xx_set_addr_long(dev, (eui64_t *)dev->netdev.long_addr);
at86rf2xx_set_addr_short(dev, (network_uint16_t *)dev->netdev.short_addr);

if (!IS_ACTIVE(AT86RF2XX_BASIC_MODE)) {
static const netopt_enable_t enable = NETOPT_ENABLE;
netdev_ieee802154_set(&dev->netdev, NETOPT_ACK_REQ,
&enable, sizeof(enable));
}
at86rf2xx_reset(dev);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just call _init() here (btw: is NETOPT_STATE_RESET even used by anything?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here. I don't use these snippet anymore in #19015, this is just to ease the review of #19015. Should I address it anyway?
No, we don't seem to be using NETOPT_STATE_RESET, and I think as it is it will in most cases de-synchronize the radio with the MAC.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well if it goes away anyway no need to bother with it.

@jia200x jia200x force-pushed the pr/at86rf2xx/isolate_netdev branch from a4ca5eb to 1d60301 Compare December 6, 2022 16:53
@aabadie aabadie added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Dec 7, 2022
@benpicco benpicco merged commit 2e50d5e into RIOT-OS:master Dec 7, 2022
@kaspar030 kaspar030 added this to the Release 2023.01 milestone Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants