diff --git a/drivers/ieee802154/Kconfig.nrf5 b/drivers/ieee802154/Kconfig.nrf5 index 11ce0565a90..e539dad1c13 100644 --- a/drivers/ieee802154/Kconfig.nrf5 +++ b/drivers/ieee802154/Kconfig.nrf5 @@ -67,4 +67,12 @@ config IEEE802154_NRF5_UICR_EUI64_REG endif # IEEE802154_NRF5_UICR_EUI64_ENABLE +config IEEE802154_NRF5_FCS_IN_LENGTH + bool "Include FCS field in the overall packet length" + default y if IEEE802154_RAW_MODE || NET_L2_OPENTHREAD + help + 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. + endif diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 6ce932dfcf0..83b620cfc91 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -150,8 +150,7 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3) * The last 2 bytes contain LQI or FCS, depending if * automatic CRC handling is enabled or not, respectively. */ - if (IS_ENABLED(CONFIG_IEEE802154_RAW_MODE) || - IS_ENABLED(CONFIG_NET_L2_OPENTHREAD)) { + if (IS_ENABLED(CONFIG_IEEE802154_NRF5_FCS_IN_LENGTH)) { pkt_len = rx_frame->psdu[0]; } else { pkt_len = rx_frame->psdu[0] - NRF5_FCS_LENGTH; @@ -374,7 +373,7 @@ static int handle_ack(struct nrf5_802154_data *nrf5_radio) struct net_pkt *ack_pkt; int err = 0; - if (IS_ENABLED(CONFIG_IEEE802154_RAW_MODE) || IS_ENABLED(CONFIG_NET_L2_OPENTHREAD)) { + if (IS_ENABLED(CONFIG_IEEE802154_NRF5_FCS_IN_LENGTH)) { ack_len = nrf5_radio->ack_frame.psdu[0]; } else { ack_len = nrf5_radio->ack_frame.psdu[0] - NRF5_FCS_LENGTH;