ieee802154 network driver now retries if ieee802154_req_data() returns EINTR. In clicker2-stm32 6LoWPAN configuration, increased the number of TX descriptors to match then number of IOBs.

This commit is contained in:
Gregory Nutt
2017-06-20 13:30:17 -06:00
parent d3b9ea9d66
commit 192bacbd7f
3 changed files with 23 additions and 5 deletions
@@ -1138,7 +1138,7 @@ CONFIG_WIRELESS=y
CONFIG_WIRELESS_IEEE802154=y CONFIG_WIRELESS_IEEE802154=y
CONFIG_IEEE802154_DEFAULT_EADDR=0x00fade00deadbeef CONFIG_IEEE802154_DEFAULT_EADDR=0x00fade00deadbeef
CONFIG_MAC802154_HPWORK=y CONFIG_MAC802154_HPWORK=y
CONFIG_IEEE802154_NTXDESC=3 CONFIG_IEEE802154_NTXDESC=32
CONFIG_IEEE802154_IND_PREALLOC=20 CONFIG_IEEE802154_IND_PREALLOC=20
CONFIG_IEEE802154_IND_IRQRESERVE=10 CONFIG_IEEE802154_IND_IRQRESERVE=10
CONFIG_IEEE802154_MACDEV=y CONFIG_IEEE802154_MACDEV=y
+7
View File
@@ -47,6 +47,13 @@ config IEEE802154_NTXDESC
---help--- ---help---
Configured number of Tx descriptors. Default: 3 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 config IEEE802154_IND_PREALLOC
int "Number of pre-allocated meta-data structures" int "Number of pre-allocated meta-data structures"
default 20 default 20
+13 -2
View File
@@ -405,6 +405,7 @@ static int macnet_rxframe(FAR struct mac802154_maccb_s *maccb,
if (!priv->md_bifup) if (!priv->md_bifup)
{ {
wlwarn("WARNING: Dropped... Network is down\n");
return -ENETDOWN; 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) == if ((iob->io_data[iob->io_offset] & SIXLOWPAN_DISPATCH_NALP_MASK) ==
SIXLOWPAN_DISPATCH_NALP) SIXLOWPAN_DISPATCH_NALP)
{ {
wlwarn("WARNING: Dropped... Not a 6LoWPAN frame: %02x\n",
iob->io_data[iob->io_offset]);
return -EINVAL; return -EINVAL;
} }
@@ -1114,9 +1117,17 @@ static int macnet_req_data(FAR struct ieee802154_driver_s *netdev,
framelist = iob->io_flink; framelist = iob->io_flink;
iob->io_flink = NULL; 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) if (ret < 0)
{ {
wlerr("ERROR: mac802154_req_data failed: %d\n", ret); wlerr("ERROR: mac802154_req_data failed: %d\n", ret);