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 <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2021-11-18 17:17:10 +01:00 committed by Anas Nashif
commit 5cf235e601
2 changed files with 10 additions and 3 deletions

View file

@ -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;