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

at86rf2xx: Don't use netdev_ieee802154_t for link layer address #10401

Closed
wants to merge 3 commits into from

Conversation

bergzand
Copy link
Member

@bergzand bergzand commented Nov 15, 2018

Contribution description

This PR modifies the behaviour of the at86rf2xx driver to not propagate the link layer address to the netdev_ieee802154_t struct. This helps the goal of separating the netdev and the ieee802154_t layer by another bit. The end goal is to remove the short and long address from the netdev_ieee802154_t struct and match the behaviour of the ethernet drivers.

The performance impact of this change should be negligible, the NETOPT_ADDRESS(_LONG) call is only used on initialization and by the ifconfig command.

Testing procedure

Test whether:

  • ifconfig still shows the correct link layer addresses. These should not have changed between this PR and master.
  • ping still works. This to verify that the link layer address is also properly configured in the radio, if the ping echo/reply fails, the address filter of the radio might be configured in the wrong endianness.

Issues/PRs references

First part in a sequence to remove the link layer address from the netdev_ieee802154_t struct

This change modifies the at86rf2xx driver to read the address directly
from the device instead of returning the netdev_ieee802154_t member
This adds the link layer address retrieval to the netdev::get function.
The consequence is that the address is directly read from the device and
no longer from the netdev_ieee802154_t layer when requesting the
address.
@bergzand bergzand added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: drivers Area: Device drivers labels Nov 15, 2018
miri64
miri64 previously requested changes Nov 15, 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.

I'm not sure about the pulling in of the byteorder dependency. I don't mind it, but other voices might disagree.

dev->netdev.short_addr[0] = (uint8_t)(addr);
dev->netdev.short_addr[1] = (uint8_t)(addr >> 8);
/* addr is in network byte order */
network_uint16_t ap;
Copy link
Member

Choose a reason for hiding this comment

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

What does ap stand for? in the original code here I could imagine it meaning "address pointer", but this is not a pointer anymore... :-/

@miri64 miri64 dismissed their stale review November 15, 2018 13:54

Oops only wanted to comment

@bergzand
Copy link
Member Author

I'm not sure about the pulling in of the byteorder dependency. I don't mind it, but other voices might disagree.

It can do without, the motivation for adding it here was to clarify the code a bit, at least to have it clear that the addresses here are already in big endian form.

@miri64
Copy link
Member

miri64 commented Nov 15, 2018

Question: How are netdev_ieee802154_t::short_addr and netdev_ieee802154_t::long_addr set now? I wasn't able to find anything on that in the code base.

@miri64
Copy link
Member

miri64 commented Nov 15, 2018

It can do without, the motivation for adding it here was to clarify the code a bit, at least to have it clear that the addresses here are already in big endian form.

Maybe put the introduction into a separate commit. That way we can easier test the size impact and also revert it if others don't like it.

@bergzand
Copy link
Member Author

Question: How a netdev_ieee802154_t::short_addr and netdev_ieee802154_t::long_addr set now? I wasn't able to find anything on that in the code base.

Do you mean after merging this PR or in current master?

In current master they are set in the set_addr functions of the drivers and with the netdev_driver::set call. The at86rf2xx sets the return value to -ENOTSUP to propagate the value to the netdev_ieee802154::set` function.

WIth this PR it is no longer set, but also no longer read. Instead it is directly read from the device driver. This way the behaviour matches the behaviour for ethernet drivers.

@miri64
Copy link
Member

miri64 commented Nov 15, 2018

WIth this PR it is no longer set, but also no longer read. Instead it is directly read from the device driver. This way the behaviour matches the behaviour for ethernet drivers.

Aren't they read/set by the netdev_ieee802154 "layer"? Or is this removed now somehow?

@bergzand
Copy link
Member Author

Aren't they read/set by the netdev_ieee802154 "layer"? Or is this removed now somehow?

I can't remove them yet since other drivers are not yet adapted. But the idea is to remove the short_address and long_address from the netdev_ieee802154_t struct. This PR only modifies the at86rf2xx driver so that the addresses are no longer set and read from the netdev_ieee802154 layer.

@miri64
Copy link
Member

miri64 commented Nov 15, 2018

Thanks, that and #7736 (comment) clarify the trajectory of this for me.

@bergzand
Copy link
Member Author

I'm not sure about the pulling in of the byteorder dependency. I don't mind it, but other voices might disagree.

Just remembered, byteorder.h is already used in drivers/at86rf2xx/at86rf2xx.c to convert the link layer address to big endian.

@bergzand
Copy link
Member Author

I want to do a similar PR for the radio channel, I can imagine that waiting for that PR and testing them both at the same time can save some time :)

@miri64
Copy link
Member

miri64 commented Dec 4, 2018

We should wait merging this until #10537 is merged ;-)

@bergzand bergzand added the State: waiting for other PR State: The PR requires another PR to be merged first label Dec 4, 2018
@miri64
Copy link
Member

miri64 commented Dec 12, 2018

I believe tests/driver_at86rf2xx needs to be adapted for this change

@miri64
Copy link
Member

miri64 commented Dec 14, 2018

#10537 got merged into master. Please rebase.

@miri64
Copy link
Member

miri64 commented Feb 26, 2019

Ping @bergzand?

@miri64 miri64 removed the State: waiting for other PR State: The PR requires another PR to be merged first label Feb 26, 2019
@stale
Copy link

stale bot commented Aug 30, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Aug 30, 2019
@miri64 miri64 removed the State: stale State: The issue / PR has no activity for >185 days label Aug 30, 2019
@stale
Copy link

stale bot commented Mar 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Mar 2, 2020
@miri64 miri64 removed the State: stale State: The issue / PR has no activity for >185 days label Mar 3, 2020
@miri64
Copy link
Member

miri64 commented Jun 24, 2020

I guess this needs to be re-thought with #13943 around the corner. Let's close it as archived?

@miri64 miri64 closed this Jun 24, 2020
@miri64 miri64 added the State: archived State: The PR has been archived for possible future re-adaptation label Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers State: archived State: The PR has been archived for possible future re-adaptation 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