Skip to content

netdev_ieee802154_submac: unify legacy and radio HAL bootstrap#15231

Merged
benpicco merged 6 commits into
RIOT-OS:masterfrom
jia200x:pr/refactor_hal_auto_init
Oct 19, 2020
Merged

netdev_ieee802154_submac: unify legacy and radio HAL bootstrap#15231
benpicco merged 6 commits into
RIOT-OS:masterfrom
jia200x:pr/refactor_hal_auto_init

Conversation

@jia200x

@jia200x jia200x commented Oct 15, 2020

Copy link
Copy Markdown
Member

Contribution description

This PR unifies the init procedure for the Radio HAL and legacy netdev_<device> interface. This allocates a netdev_ieee802154_submac_t descriptor if module netdev_ieee802154_submac is present. If it's not present, it allocates the legacy netdev_ieee802154_t only if the Radio HAL is not present. This ensures that no netdev dependencies are pulled if only the Radio HAL is used (e.g OpenWSN).

This whole step allows to run all radios that implement the Radio HAL with netdev_ieee802154_submac without changing the bootstrap code. For instance, #15132 should work with this PR.

TL;DR: USEMODULE+=netdev_ieee802154_submac should work out of the box for all radios that implement the Radio HAL (e.g LWIP, OpenThread can bootstrap a radio in the same way they used to do with netdev)

Testing procedure

  • Murdock should do its work compiling tests/ieee802154_hal and tests/ieee802154_submac.
  • Try testing gnrc_networking with and without netdev_ieee802154_submac.
  • Try LWIP with nrf802154 (the cc2538_rf is not yet in the bootstrap list :/)
  • Test that addresses don't change if netdev_ieee802154_submac is selected.

Issues/PRs references

#15132

@jia200x jia200x requested review from a user, aabadie and benpicco October 15, 2020 15:02
@jia200x jia200x added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: network Area: Networking labels Oct 15, 2020
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Oct 15, 2020
Comment thread cpu/cc2538/radio/cc2538_rf.c
@jia200x

jia200x commented Oct 16, 2020

Copy link
Copy Markdown
Member Author

done! it works now with netdev_register

@jia200x jia200x force-pushed the pr/refactor_hal_auto_init branch from 8c82154 to ad7650d Compare October 16, 2020 09:52
@benpicco

Copy link
Copy Markdown
Contributor

Please squash.

Comment thread sys/net/link_layer/ieee802154/submac.c
@jia200x jia200x force-pushed the pr/refactor_hal_auto_init branch from dd65863 to e6e4a31 Compare October 16, 2020 15:38
@jia200x

jia200x commented Oct 16, 2020

Copy link
Copy Markdown
Member Author

done! I also dropped the luid dependency and squashed directly

Comment thread cpu/nrf52/radio/nrf802154/nrf802154.c Outdated
@jia200x

jia200x commented Oct 19, 2020

Copy link
Copy Markdown
Member Author

shall I squash?

@jia200x jia200x force-pushed the pr/refactor_hal_auto_init branch from 1c6bc91 to 00b0186 Compare October 19, 2020 12:10
@benpicco benpicco added Area: arduino API Area: Arduino wrapper API and removed Area: arduino API Area: Arduino wrapper API labels Oct 19, 2020

@benpicco benpicco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nrf52840dk now gets stuck in a boot loop with examples/gnrc_networking.

Works fine when using netdev_ieee802154_submac.

@@ -197,7 +178,7 @@ static void _set_chan(uint16_t chan)
/* Channel map between 2400 MHZ ... 2500 MHz

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The above assertion is triggered, channel = 0

@jia200x jia200x force-pushed the pr/refactor_hal_auto_init branch from 00b0186 to ca7240e Compare October 19, 2020 13:18
@jia200x

jia200x commented Oct 19, 2020

Copy link
Copy Markdown
Member Author

fixed. I squashes and amended directly (it fails because I removed the initialization). Also, nobody was calling netdev_ieee802154_reset there o.O

@benpicco

Copy link
Copy Markdown
Contributor

Yup, that fixed it.
btw: when squashing please don't do a git rebase master, instead only do a git rebase HEAD~n where n is the number of commits you want to go back, or git rebase <hash of commit before the PR> so when clicking the force-pushed link only the changes from this PR show up.

I'll give it a try on the openmote-b with cc2538_rf just to be sure 😉

@benpicco benpicco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

cc2538_rf is also still working, both with netdev_ieee802154_submac and without.

@jia200x

jia200x commented Oct 19, 2020

Copy link
Copy Markdown
Member Author

btw: when squashing please don't do a git rebase master, instead only do a git rebase HEAD~n where n is the number of commits you want to go back, or git rebase so when clicking the force-pushed link only the changes from this PR show up.

Sure!

@benpicco benpicco merged commit 5d67d0e into RIOT-OS:master Oct 19, 2020
@benpicco

benpicco commented Oct 19, 2020

Copy link
Copy Markdown
Contributor

Strange observation (possibly unrelated):

With netdev_ieee802154_submac on nrf52840dk I don't get a public address from the border router in tests/riotboot_flashwrite (and the border router can't ping it) - but without it I always do.

netdev_ieee802154_submac

2020-10-19 18:31:44,300 # Iface  5  HWaddr: 3F:3A  Channel: 26  NID: 0x23 
2020-10-19 18:31:44,304 #           Long HWaddr: DE:07:24:D6:6E:0B:3F:3A 
2020-10-19 18:31:44,306 #            State: IDLE 
2020-10-19 18:31:44,311 #           ACK_REQ  L2-PDU:102  MTU:1280  HL:64  RTR  
2020-10-19 18:31:44,313 #           6LO  IPHC  
2020-10-19 18:31:44,316 #           Source address length: 8
2020-10-19 18:31:44,319 #           Link type: wireless
2020-10-19 18:31:44,325 #           inet6 addr: fe80::dc07:24d6:6e0b:3f3a  scope: link  VAL
2020-10-19 18:31:44,328 #           inet6 group: ff02::2
2020-10-19 18:31:44,330 #           inet6 group: ff02::1
2020-10-19 18:31:44,334 #           inet6 group: ff02::1:ff0b:3f3a

classic netdev

2020-10-19 18:32:12,203 # Configured network interfaces:
2020-10-19 18:32:12,208 # Iface  5  HWaddr: 3F:3A  Channel: 26  NID: 0x23 
2020-10-19 18:32:12,212 #           Long HWaddr: DE:07:24:D6:6E:0B:3F:3A 
2020-10-19 18:32:12,218 #            TX-Power: 0dBm L2-PDU:102  MTU:1280  HL:64  RTR  
2020-10-19 18:32:12,221 #           RTR_ADV  6LO  IPHC  
2020-10-19 18:32:12,224 #           Source address length: 8
2020-10-19 18:32:12,227 #           Link type: wireless
2020-10-19 18:32:12,232 #           inet6 addr: fe80::dc07:24d6:6e0b:3f3a  scope: link  VAL
2020-10-19 18:32:12,238 #           inet6 addr: 2001:db8::dc07:24d6:6e0b:3f3a  scope: global  VAL
2020-10-19 18:32:12,241 #           inet6 group: ff02::2
2020-10-19 18:32:12,244 #           inet6 group: ff02::1
2020-10-19 18:32:12,247 #           inet6 group: ff02::1:ff0b:3f3a

examples/gnrc_networking works either way.

@jia200x

jia200x commented Oct 20, 2020

Copy link
Copy Markdown
Member Author

hmmm strange. I will check what's going on there

@jia200x

jia200x commented Oct 21, 2020

Copy link
Copy Markdown
Member Author

@benpicco did #15237 by chance fix the issue?

@benpicco

Copy link
Copy Markdown
Contributor

Unfortunately not, the issue is still present on current master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants