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/nrf802154: do not filter broadcast PAN ID #18283

Merged
merged 3 commits into from
Aug 16, 2022

Conversation

jia200x
Copy link
Member

@jia200x jia200x commented Jun 29, 2022

Contribution description

This changes were (almost) cherry-picked from #18156.
It addresses three things:

  • It fixes CCA result (before was just throwing garbage)
  • It fixes a variable initialization
  • It prevents the broadcast PAN ID being filtered.

These commits are required in order to run #18156.

Testing procedure

  • Try running the cca command in tests/ieee802154_hal. It should report a mixture of "BUSY" and "CLEAR".
  • Set the PAN address of any node to the PAN broadcast (0xffff). The node should still be able to receive frames.

Issues/PRs references

#18156

@jia200x jia200x requested review from miri64 and benpicco June 29, 2022 15:46
@jia200x jia200x requested a review from bergzand as a code owner June 29, 2022 15:46
@github-actions github-actions bot added Area: cpu Area: CPU/MCU ports Platform: ARM Platform: This PR/issue effects ARM-based platforms labels Jun 29, 2022
@@ -265,6 +270,10 @@ static int _confirm_op(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx)

state = STATE_IDLE;
enable_shorts = true;
if (info) {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this the right location for this check and not just before if (eagain) (below switch case?)

Copy link
Member Author

Choose a reason for hiding this comment

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

because that overwrites the IEEE802154_HAL_OP_CCA case. Since info has "something", it replaces the CCA status with garbage

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I still don't fully understand.

  1. What do you mean by "that" overwrites the IEEE802154_HAL_OP_CCA case? How to overwrite a case at all?
  2. The starting point for my comment was: we are in the "confirm operation" function here and I was wondering, shouldn't be the "confirm CCA operation" actually be the most accurate place to indicate whether the CCA found a busy or free channel?

Copy link
Contributor

Choose a reason for hiding this comment

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

The IEEE802154_HAL_OP_CCA already handles ctx, in fact it always assumes it to be a bool * that must be present.

If info is then set after the switch case, it would overwrite that.

@@ -124,6 +124,11 @@ static bool _l2filter(uint8_t *mhr)

int addr_len = ieee802154_get_dst(mhr, dst_addr, &dst_pan);

if ((mhr[0] & IEEE802154_FCF_TYPE_MASK) == IEEE802154_FCF_TYPE_BEACON) {
Copy link
Member

Choose a reason for hiding this comment

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

In earlier days (before 802.15.4 radio HAL) GNRC got stuck receiving beacon frames from devices that did not filter those in hardware. Clearly, you need to receive beacons to enable a proper MAC. I just want to make sure we don't break the "standard" CSMA sender with this.

Copy link
Member

Choose a reason for hiding this comment

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

Could you add a comment that explains the filter in words? Then I would feel more comfortable checking the "reviewed documentation" label

Copy link
Member Author

Choose a reason for hiding this comment

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

In case this is a problem, I think these stuff should be fixed in an upper layer (e.g SubMAC). Otherwise we will end up with too many corner cases at driver level, because some modules need it and some not

Copy link
Member

Choose a reason for hiding this comment

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

Have you tested on this PR what happens in a standard CSMA case when a beacon is received?

I agree that the driver is not the best place for it (actually for any of the common 802.15.4 filter routines) but in the first place we should not introduce a feature that breaks the (currently) most common use case.

Copy link
Contributor

Choose a reason for hiding this comment

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

GNRC should just discard the frame if it finds it to not be a valid 6LoWPAN frame, right @miri64?

Copy link
Member

Choose a reason for hiding this comment

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

GNRC should just discard the frame if it finds it to not be a valid 6LoWPAN frame, right @miri64?

No, gnrc_sixlowpan will do that, yes, but GNRC will just eat up anything you give it ;-). If there is a Zigbee handler it will also handle Zigbee packets (which are not valid 6LoWPAN frames IIRC).

@PeterKietzmann PeterKietzmann added Reviewed: 2-code-design The code design of the PR was reviewed 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 Jul 4, 2022
@benpicco benpicco added the Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) label Jul 17, 2022
@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 Aug 10, 2022
@benpicco benpicco merged commit f272094 into RIOT-OS:master Aug 16, 2022
@maribu maribu added this to the Release 2022.10 milestone Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Reviewed: 2-code-design The code design of the PR was reviewed 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: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants