diff --git a/configs/clicker2-stm32/mrf24j40-6lowpan/defconfig b/configs/clicker2-stm32/mrf24j40-6lowpan/defconfig index 8759fc12485..76c738cd115 100644 --- a/configs/clicker2-stm32/mrf24j40-6lowpan/defconfig +++ b/configs/clicker2-stm32/mrf24j40-6lowpan/defconfig @@ -1138,7 +1138,7 @@ CONFIG_WIRELESS=y CONFIG_WIRELESS_IEEE802154=y CONFIG_IEEE802154_DEFAULT_EADDR=0x00fade00deadbeef CONFIG_MAC802154_HPWORK=y -CONFIG_IEEE802154_NTXDESC=3 +CONFIG_IEEE802154_NTXDESC=32 CONFIG_IEEE802154_IND_PREALLOC=20 CONFIG_IEEE802154_IND_IRQRESERVE=10 CONFIG_IEEE802154_MACDEV=y diff --git a/wireless/ieee802154/Kconfig b/wireless/ieee802154/Kconfig index d06ed743c1b..baf801b7e7f 100644 --- a/wireless/ieee802154/Kconfig +++ b/wireless/ieee802154/Kconfig @@ -46,7 +46,14 @@ config IEEE802154_NTXDESC default 3 ---help--- Configured number of Tx descriptors. Default: 3 - + + When used with 6LoWPAN, the descriptor allocator runs on a work + and must avoid blocking if possible. Each frame will be provided in + an IOB and each TX frame will need a TX descriptor. So the safe + thing to do is set CONFIG_IEEE802154_NTXDESC to CONFIG_IOB_NBUFFERS. + Then there should be the maximum pre-allocated buffers for each + possible TX frame. + config IEEE802154_IND_PREALLOC int "Number of pre-allocated meta-data structures" default 20 @@ -75,7 +82,7 @@ config IEEE802154_IND_IRQRESERVE Non-interrupt logic will also first attempt to allocate from the general, pre-allocated structure pool. If that fails, it will dynamically allocate the meta data structure with an additional cost in performance. - + config IEEE802154_MACDEV bool "Character driver for IEEE 802.15.4 MAC layer" default n diff --git a/wireless/ieee802154/mac802154_netdev.c b/wireless/ieee802154/mac802154_netdev.c index 5966532b88a..b48c6afcaaf 100644 --- a/wireless/ieee802154/mac802154_netdev.c +++ b/wireless/ieee802154/mac802154_netdev.c @@ -405,6 +405,7 @@ static int macnet_rxframe(FAR struct mac802154_maccb_s *maccb, if (!priv->md_bifup) { + wlwarn("WARNING: Dropped... Network is down\n"); return -ENETDOWN; } @@ -421,6 +422,8 @@ static int macnet_rxframe(FAR struct mac802154_maccb_s *maccb, if ((iob->io_data[iob->io_offset] & SIXLOWPAN_DISPATCH_NALP_MASK) == SIXLOWPAN_DISPATCH_NALP) { + wlwarn("WARNING: Dropped... Not a 6LoWPAN frame: %02x\n", + iob->io_data[iob->io_offset]); return -EINVAL; } @@ -1114,9 +1117,17 @@ static int macnet_req_data(FAR struct ieee802154_driver_s *netdev, framelist = iob->io_flink; iob->io_flink = NULL; - /* Transfer the frame to the MAC */ + /* Transfer the frame to the MAC. mac802154_req_data will return + * -EINTR if a signal is received during certain phases of processing. + * In this context we just need to ignore -EINTR errors and try again. + */ + + do + { + ret = mac802154_req_data(priv->md_mac, meta, iob); + } + while (ret == -EINTR); - ret = mac802154_req_data(priv->md_mac, meta, iob); if (ret < 0) { wlerr("ERROR: mac802154_req_data failed: %d\n", ret);