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

netdev_ieee802154/radios: refactor PAN ID reset to generic ieee802154 reset #10384

Merged
merged 11 commits into from
Nov 28, 2018

Conversation

bergzand
Copy link
Member

@bergzand bergzand commented Nov 13, 2018

Contribution description

This PR refactors the PAN ID from the radio reset function to the generic netdev_ieee802154_reset and sets it via the netdev::set call. This allows for removal of the dev->netdev accesses in the radio specific set_pan calls.

Testing procedure

Verify that initialization and reset of the PAN ID works for the affected radios

  • cc2538
  • socket_zep
  • at86rf2xx
  • cc2420
  • kw2xrf
  • mrf24j40

Issues/PRs references

Chipping away at dependencies for #7736

@bergzand bergzand added Area: network Area: Networking Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Area: drivers Area: Device drivers labels Nov 13, 2018
Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

ACK on the code change. It removes a lot of duplicates of setting netdev_ieee802154_t::pan for a device and centralizes it and the initialization of the value to the cental netdev_ieee802154_reset() function, which is called by either the init or reset function of all touched devices.

One minor optimization proposal I'm not sure about: I think this can be removed:

netdev_ieee802154_set(&dev->netdev, NETOPT_NID,
&pan, sizeof(pan));

I'll test with the devices available to me as soon as I have access to them again.

@miri64 miri64 added Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines labels Nov 13, 2018
@bergzand
Copy link
Member Author

One minor optimization proposal I'm not sure about: I think this can be removed:

Thanks, I already suspected that I was missing something in that driver.

Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

Another question after scrolling through the code a bit again

@miri64 miri64 removed the Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines label Nov 13, 2018
miri64
miri64 previously requested changes Nov 13, 2018
@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines labels Nov 13, 2018
@miri64
Copy link
Member

miri64 commented Nov 13, 2018

Tested socket_zep by running test/socket_zep and by switching out gnrc_netdev_default with socket_zep in examples/gnrc_networking and pinging between two native instances.

@miri64
Copy link
Member

miri64 commented Nov 13, 2018

Also tested at86rf2xx with gnrc_networking and pinging (and checking ifconfig) on iotlab-m3

@miri64 miri64 removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 13, 2018
@miri64
Copy link
Member

miri64 commented Nov 13, 2018

Murdock likes it (at least compilation-wise) so I guess we can put a (virtual) tick on that as well :-)

@miri64
Copy link
Member

miri64 commented Nov 14, 2018

cc2420 doesn't work (when using example/default it doesn't send packets that are recognized by an at86rf2xx device, multicast does not work and when a packet is sent from an at86rf2xx device it doesn't show the packet). But that's the case in master (not sure if there is already an issue for that). It sends however packets with the correct PAN ID and I confirmed with ifconfig in examples/default that the PAN ID is the one configured at compile time.

@miri64
Copy link
Member

miri64 commented Nov 14, 2018

kw2xrf confirmed to work on pba-d-01-kw2x.

@miri64
Copy link
Member

miri64 commented Nov 14, 2018

@PeterKietzmann can you have a look with the cc2538 and the mrf24j40 (and maybe confirm the bug in cc2420 in master)?

@miri64
Copy link
Member

miri64 commented Nov 22, 2018

@smlng do you have access to the missing devices?

@miri64
Copy link
Member

miri64 commented Nov 22, 2018

(cc2538 I'll test myself in the testbed ;-))

@smlng
Copy link
Member

smlng commented Nov 22, 2018

remote-revb (cc2538) works as expected

smlng
smlng previously approved these changes Nov 22, 2018
Copy link
Member

@smlng smlng left a comment

Choose a reason for hiding this comment

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

PreACK, looks good to me

@miri64 miri64 dismissed smlng’s stale review November 22, 2018 11:59

@smlng please don't approve a PR, if you did not test everything. A verbal ACK and the respective Reviewed: labels should suffice.

@miri64
Copy link
Member

miri64 commented Nov 22, 2018

Tested on firefly (cc2538) with example/default (both by changing the PAN ID using ifconfig and by at compile time using CFLAGS=-DIEEE802154_DEFAULT_PANID=0x6456). ifconfig still shows the expected value and I was still able to exchange packages packets between the nodes if (and only if - as expecded) the the PAN ID was the same on both nodes. A sniffer running in parallel also showed the correct PAN ID for the exchanged packets.

@miri64 miri64 dismissed their stale review November 22, 2018 12:12

Change request was addressed.

@PeterKietzmann
Copy link
Member

Tested with mrf24j40 + nucleo-l476rg and gnrc_networking:

  • PANID after reset
  • changing PAN ID
  • verified by pinging a samr21-xpro with gnrc_networking and master

-> works as expected to I'll check the box above.

Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

All drivers were tested. @bergzand please squash!

This commit adds the reset of the PAN ID to the generic ieee802154 reset
function.
This write access is only required when a modification to the PAN ID
happened directly via this function and not via a netdev::set operation.
The only direct call was done in the reset function of the driver
This write access is only required when a modification to the PAN ID
happened directly via this function and not via a netdev::set operation.
The only direct call was done in the reset function of the driver
This write access is only required when a modification to the PAN ID
happened directly via this function and not via a netdev::set operation.
The only direct call was done in the reset function of the driver
This write access is only required when a modification to the PAN ID
happened directly via this function and not via a netdev::set operation.
The only direct call was done in the reset function of the driver
@bergzand
Copy link
Member Author

Squashed, thanks for testing!

@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines labels Nov 28, 2018
@smlng smlng merged commit 4eaf1d8 into RIOT-OS:master Nov 28, 2018
@bergzand bergzand deleted the pr/netdev/ref_nid branch November 28, 2018 11:17
@aabadie aabadie added this to the Release 2019.01 milestone Dec 2, 2018
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: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines 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