Skip to content

Commit 5cf235e

Browse files
rlubosnashif
authored andcommitted
drivers: ieee802154_nrf5: Add Kconfig to configure FCS inclusion policy
Some 802.15.4 L2 implementations expect that FCS length is included in the overall packet length while others not. Allow to configure this behavior, based on the selected upper layer. Signed-off-by: Robert Lubos <[email protected]>
1 parent 9a31922 commit 5cf235e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

drivers/ieee802154/Kconfig.nrf5

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,12 @@ config IEEE802154_NRF5_UICR_EUI64_REG
6767

6868
endif # IEEE802154_NRF5_UICR_EUI64_ENABLE
6969

70+
config IEEE802154_NRF5_FCS_IN_LENGTH
71+
bool "Include FCS field in the overall packet length"
72+
default y if IEEE802154_RAW_MODE || NET_L2_OPENTHREAD
73+
help
74+
Some 802.15.4 L2 implementations expect that FCS length is included in
75+
the overall packet length while others not. Allow to configure this
76+
behavior, based on the selected upper layer.
77+
7078
endif

drivers/ieee802154/ieee802154_nrf5.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
150150
* The last 2 bytes contain LQI or FCS, depending if
151151
* automatic CRC handling is enabled or not, respectively.
152152
*/
153-
if (IS_ENABLED(CONFIG_IEEE802154_RAW_MODE) ||
154-
IS_ENABLED(CONFIG_NET_L2_OPENTHREAD)) {
153+
if (IS_ENABLED(CONFIG_IEEE802154_NRF5_FCS_IN_LENGTH)) {
155154
pkt_len = rx_frame->psdu[0];
156155
} else {
157156
pkt_len = rx_frame->psdu[0] - NRF5_FCS_LENGTH;
@@ -374,7 +373,7 @@ static int handle_ack(struct nrf5_802154_data *nrf5_radio)
374373
struct net_pkt *ack_pkt;
375374
int err = 0;
376375

377-
if (IS_ENABLED(CONFIG_IEEE802154_RAW_MODE) || IS_ENABLED(CONFIG_NET_L2_OPENTHREAD)) {
376+
if (IS_ENABLED(CONFIG_IEEE802154_NRF5_FCS_IN_LENGTH)) {
378377
ack_len = nrf5_radio->ack_frame.psdu[0];
379378
} else {
380379
ack_len = nrf5_radio->ack_frame.psdu[0] - NRF5_FCS_LENGTH;

0 commit comments

Comments
 (0)