-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
if ((memcmp(&nrf802154_pan_id, pan_bcast, 2) == 0)) { | ||
return true; | ||
} | ||
} | ||
/* filter PAN ID */ | ||
/* Will only work on little endian platform (all?) */ | ||
|
||
|
@@ -197,7 +202,7 @@ static int _request_op(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx) | |
(void) dev; | ||
|
||
int res = -EBUSY; | ||
int state; | ||
int state = STATE_IDLE; | ||
|
||
switch (op) { | ||
case IEEE802154_HAL_OP_TRANSMIT: | ||
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because that overwrites the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I still don't fully understand.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The If |
||
info->status = (_state == STATE_CCA_BUSY) ? TX_STATUS_MEDIUM_BUSY : TX_STATUS_SUCCESS; | ||
} | ||
|
||
break; | ||
case IEEE802154_HAL_OP_SET_RX: | ||
eagain = (radio_state == RADIO_STATE_STATE_RxRu); | ||
|
@@ -291,10 +300,6 @@ static int _confirm_op(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx) | |
|
||
_state = state; | ||
|
||
if (info) { | ||
info->status = (_state == STATE_CCA_BUSY) ? TX_STATUS_MEDIUM_BUSY : TX_STATUS_SUCCESS; | ||
} | ||
|
||
if (enable_shorts) { | ||
NRF_RADIO->SHORTS = DEFAULT_SHORTS; | ||
DEBUG("[nrf802154] TX Finished\n"); | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).