diff --git a/Kconfig b/Kconfig index d2157939e8f..0479955f529 100644 --- a/Kconfig +++ b/Kconfig @@ -848,15 +848,6 @@ config DEBUG_SYSCALL_INFO endif # DEBUG_SYSCALL -config DEBUG_WIRELESS - bool "Wireless Device Debug Output" - default n - depends on WIRELESS - ---help--- - Enable low level debug SYSLOG output from the wireless subsystem and - device drivers. (disabled by default). Support for this debug option - is architecture-specific and may not be available for some MCUs. - comment "OS Function Debug Options" config DEBUG_DMA @@ -1107,6 +1098,15 @@ config DEBUG_ANALOG_INFO endif # DEBUG_ANALOG +config DEBUG_WIRELESS + bool "Wireless Device Debug Output" + default n + depends on WIRELESS + ---help--- + Enable low level debug SYSLOG output from the wireless subsystem and + device drivers. (disabled by default). Support for this debug option + is architecture-specific and may not be available for some MCUs. + config DEBUG_CAN bool "CAN Debug Features" default n diff --git a/configs/clicker2-stm32/README.txt b/configs/clicker2-stm32/README.txt index 49b645204a9..260137c1522 100644 --- a/configs/clicker2-stm32/README.txt +++ b/configs/clicker2-stm32/README.txt @@ -447,12 +447,21 @@ Configurations The ifconfig command will show the IP address of the server. Then on the client node use this IP address to start the client: - nsh> udpserver & + nsh> udpclient & Where is the IP address of the server that you got above. NOTE: There is no way to stop the UDP test once it has been started other than by resetting the board. + STATUS: + 2017-06-19: The Telnet Daemon does not start. This is simply because + the daemon is started too early in the sequence... before the network + has been brought up: + + telnetd_daemon: ERROR: socket failure: 106 + + 2017-06-20: Debug underway.. not yet functional. + nsh: Configures the NuttShell (nsh) located at examples/nsh. This diff --git a/configs/clicker2-stm32/mrf24j40-6lowpan/defconfig b/configs/clicker2-stm32/mrf24j40-6lowpan/defconfig index 9619d02170a..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 @@ -1374,6 +1374,8 @@ CONFIG_EXAMPLES_UDP_SERVERIPv6ADDR_5=0x0000 CONFIG_EXAMPLES_UDP_SERVERIPv6ADDR_6=0x00ff CONFIG_EXAMPLES_UDP_SERVERIPv6ADDR_7=0xfe00 CONFIG_EXAMPLES_UDP_SERVERIPv6ADDR_8=0x0d00 +CONFIG_EXAMPLES_SERVER_PORTNO=61616 +CONFIG_EXAMPLES_CLIENT_PORTNO=61617 # CONFIG_EXAMPLES_UDPBLASTER is not set # CONFIG_EXAMPLES_USBSERIAL is not set # CONFIG_EXAMPLES_WATCHDOG is not set diff --git a/net/sixlowpan/README.txt b/net/sixlowpan/README.txt index 775357260bc..4c654caef14 100644 --- a/net/sixlowpan/README.txt +++ b/net/sixlowpan/README.txt @@ -82,7 +82,8 @@ Optimal 6LoWPAN Configuration fe80 0000 0000 0000 0000 00ff fe00 MMMM 2-byte short address IEEE 48-bit MAC fe80 0000 0000 0000 NNNN NNNN NNNN NNNN 8-byte extended address IEEE EUI-64 -4. Compressable port numbers in the rangs 0xf0b0-0xf0bf +4. To be compressable, port numbers must be in the range 0xf0b0-0xf0bf, + hexadecimal. That is 61616-61631 decimal. 5. IOBs: Must be big enough to hold one IEEE802.15.4 frame (CONFIG_NET_6LOWPAN_FRAMELEN, typically 127). There must be enough IOBs to decompose the largest IPv6 diff --git a/net/sixlowpan/sixlowpan_framelist.c b/net/sixlowpan/sixlowpan_framelist.c index 0b17e6dbaba..db420cbdd39 100644 --- a/net/sixlowpan/sixlowpan_framelist.c +++ b/net/sixlowpan/sixlowpan_framelist.c @@ -224,6 +224,8 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee, #endif int ret; + ninfo("buflen=%lu", (unsigned long)buflen); + /* Initialize global data. Locking the network guarantees that we have * exclusive use of the global values for intermediate calculations. */ @@ -442,6 +444,9 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee, /* Add the first frame to the IOB queue */ + ninfo("Queuing frame io_len=%u io_offset=%u\n", + iob->io_len, iob->io_offset); + qhead = iob; qtail = iob; @@ -520,6 +525,9 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee, /* Add the next frame to the tail of the IOB queue */ + ninfo("Queuing frame io_len=%u io_offset=%u\n", + iob->io_len, iob->io_offset); + qtail->io_flink = iob; qtail = iob; @@ -542,6 +550,7 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee, /* And submit the frame to the MAC */ + ninfo("Submitting frame\n"); ret = sixlowpan_frame_submit(ieee, &meta, iob); if (ret < 0) { @@ -578,6 +587,9 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee, /* And submit the frame to the MAC */ + ninfo("Submitting frame length=%u io_offset=%u\n", + iob->io_len, iob->io_offset); + ret = sixlowpan_frame_submit(ieee, &meta, iob); if (ret < 0) { diff --git a/net/sixlowpan/sixlowpan_send.c b/net/sixlowpan/sixlowpan_send.c index a8fcdea983f..18202d4b954 100644 --- a/net/sixlowpan/sixlowpan_send.c +++ b/net/sixlowpan/sixlowpan_send.c @@ -182,7 +182,7 @@ static uint16_t send_interrupt(FAR struct net_driver_s *dev, if ((flags & NETDEV_DOWN) != 0) { - ninfo("Device is down\n"); + nwarn("WARNING: Device is down\n"); sinfo->s_result = -ENOTCONN; goto end_wait; } @@ -279,6 +279,8 @@ int sixlowpan_send(FAR struct net_driver_s *dev, { struct sixlowpan_send_s sinfo; + ninfo("len=%lu timeout=%u\n", (unsigned long)len, timeout); + /* Initialize the send state structure */ sem_init(&sinfo.s_waitsem, 0, 0); @@ -301,16 +303,16 @@ int sixlowpan_send(FAR struct net_driver_s *dev, * device related events, no connect-related events. */ - sinfo.s_cb = devif_callback_alloc(dev, list); + sinfo.s_cb = devif_callback_alloc(dev, list); if (sinfo.s_cb != NULL) { int ret; /* Set up the callback in the connection */ - sinfo.s_cb->flags = (NETDEV_DOWN | WPAN_POLL); - sinfo.s_cb->priv = (FAR void *)&sinfo; - sinfo.s_cb->event = send_interrupt; + sinfo.s_cb->flags = (NETDEV_DOWN | WPAN_POLL); + sinfo.s_cb->priv = (FAR void *)&sinfo; + sinfo.s_cb->event = send_interrupt; /* Notify the IEEE802.15.4 MAC that we have data to send. */ @@ -322,6 +324,8 @@ int sixlowpan_send(FAR struct net_driver_s *dev, * automatically re-enabled when the task restarts. */ + ninfo("Wait for send complete\n"); + ret = net_lockedwait(&sinfo.s_waitsem); if (ret < 0) { 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.c b/wireless/ieee802154/mac802154.c index c7d53fd2658..70e44b68f5c 100644 --- a/wireless/ieee802154/mac802154.c +++ b/wireless/ieee802154/mac802154.c @@ -130,6 +130,7 @@ static void mac802154_resetqueues(FAR struct ieee802154_privmac_s *priv) { sq_addlast((FAR sq_entry_t *)&priv->txdesc_pool[i], &priv->txdesc_queue); } + sem_init(&priv->txdesc_sem, 0, CONFIG_MAC802154_NTXDESC); /* Initialize the notifcation allocation pool */ @@ -169,7 +170,6 @@ int mac802154_txdesc_alloc(FAR struct ieee802154_privmac_s *priv, */ ret = sem_trywait(&priv->txdesc_sem); - if (ret == OK) { *txdesc = (FAR struct ieee802154_txdesc_s *)sq_remfirst(&priv->txdesc_queue); @@ -189,6 +189,7 @@ int mac802154_txdesc_alloc(FAR struct ieee802154_privmac_s *priv, { /* MAC is already released */ + wlwarn("WARNING: mac802154_takesem failed: %d\n", ret); return -EINTR; } @@ -200,6 +201,8 @@ int mac802154_txdesc_alloc(FAR struct ieee802154_privmac_s *priv, ret = mac802154_takesem(&priv->exclsem, allow_interrupt); if (ret < 0) { + wlwarn("WARNING: mac802154_takesem failed: %d\n", ret); + mac802154_givesem(&priv->txdesc_sem); return -EINTR; } @@ -228,7 +231,6 @@ int mac802154_txdesc_alloc(FAR struct ieee802154_privmac_s *priv, } (*txdesc)->conf = ¬if->u.dataconf; - return OK; } @@ -251,7 +253,6 @@ void mac802154_create_datareq(FAR struct ieee802154_privmac_s *priv, FAR struct ieee802154_txdesc_s *txdesc) { FAR struct iob_s *iob; - FAR uint16_t *u16; /* The only node allowed to use a source address of none is the PAN Coordinator. * PAN coordinators should not be sending data request commans. @@ -269,16 +270,16 @@ void mac802154_create_datareq(FAR struct ieee802154_privmac_s *priv, iob->io_offset = 0; iob->io_pktlen = 0; - /* Get a uin16_t reference to the first two bytes. ie frame control field */ + /* Set the frame control fields */ - u16 = (FAR uint16_t *)&iob->io_data[iob->io_len]; + iob->io_data[0] = 0; + iob->io_data[1] = 0; + IEEE802154_SETACKREQ(iob->io_data, 0); + IEEE802154_SETFTYPE(iob->io_data, 0, IEEE802154_FRAME_COMMAND); + IEEE802154_SETDADDRMODE(iob->io_data, 0, coordaddr->mode); + IEEE802154_SETSADDRMODE(iob->io_data, 0, srcmode); iob->io_len = 2; - *u16 = (IEEE802154_FRAME_COMMAND << IEEE802154_FRAMECTRL_SHIFT_FTYPE); - *u16 |= IEEE802154_FRAMECTRL_ACKREQ; - *u16 |= (coordaddr->mode << IEEE802154_FRAMECTRL_SHIFT_DADDR); - *u16 |= (srcmode << IEEE802154_FRAMECTRL_SHIFT_SADDR); - /* Each time a data or a MAC command frame is generated, the MAC sublayer * shall copy the value of macDSN into the Sequence Number field of the * MHR of the outgoing frame and then increment it by one. [1] pg. 40. @@ -304,8 +305,6 @@ void mac802154_create_datareq(FAR struct ieee802154_privmac_s *priv, } } - *u16 |= (coordaddr->mode << IEEE802154_FRAMECTRL_SHIFT_DADDR); - /* If the Destination Addressing Mode field is set to indicate that * destination addressing information is not present, the PAN ID Compression * field shall be set to zero and the source PAN identifier shall contain the @@ -318,7 +317,7 @@ void mac802154_create_datareq(FAR struct ieee802154_privmac_s *priv, if (coordaddr->mode != IEEE802154_ADDRMODE_NONE && IEEE802154_PANIDCMP(coordaddr->panid, priv->addr.panid)) { - *u16 |= IEEE802154_FRAMECTRL_PANIDCOMP; + IEEE802154_SETPANIDCOMP(iob->io_data, 0); } else { diff --git a/wireless/ieee802154/mac802154_assoc.c b/wireless/ieee802154/mac802154_assoc.c index c6c2135fc08..fd31623d200 100644 --- a/wireless/ieee802154/mac802154_assoc.c +++ b/wireless/ieee802154/mac802154_assoc.c @@ -86,7 +86,6 @@ int mac802154_req_associate(MACHANDLE mac, (FAR struct ieee802154_privmac_s *)mac; FAR struct ieee802154_txdesc_s *txdesc; FAR struct iob_s *iob; - FAR uint16_t *u16; bool rxonidle; int ret; @@ -177,12 +176,13 @@ int mac802154_req_associate(MACHANDLE mac, /* Get a uin16_t reference to the first two bytes. ie frame control field */ - u16 = (FAR uint16_t *)&iob->io_data[0]; + iob->io_data[0] = 0; + iob->io_data[1] = 0; - *u16 = (IEEE802154_FRAME_COMMAND << IEEE802154_FRAMECTRL_SHIFT_FTYPE); - *u16 |= IEEE802154_FRAMECTRL_ACKREQ; - *u16 |= (priv->coordaddr.mode << IEEE802154_FRAMECTRL_SHIFT_DADDR); - *u16 |= (IEEE802154_ADDRMODE_EXTENDED << IEEE802154_FRAMECTRL_SHIFT_SADDR); + IEEE802154_SETACKREQ(iob->io_data, 0); + IEEE802154_SETFTYPE(iob->io_data, 0, IEEE802154_FRAME_COMMAND); + IEEE802154_SETDADDRMODE(iob->io_data, 0, priv->coordaddr.mode); + IEEE802154_SETSADDRMODE(iob->io_data, 0, IEEE802154_ADDRMODE_EXTENDED); iob->io_len = 2; @@ -281,7 +281,6 @@ int mac802154_resp_associate(MACHANDLE mac, (FAR struct ieee802154_privmac_s *)mac; FAR struct ieee802154_txdesc_s *txdesc; FAR struct iob_s *iob; - FAR uint16_t *u16; int ret; /* Allocate an IOB to put the frame in */ @@ -294,10 +293,6 @@ int mac802154_resp_associate(MACHANDLE mac, iob->io_offset = 0; iob->io_pktlen = 0; - /* Get a uin16_t reference to the first two bytes. ie frame control field */ - - u16 = (FAR uint16_t *)&iob->io_data[0]; - /* The Destination Addressing Mode and Source Addressing Mode fields shall * each be set to indicate extended addressing. * @@ -307,12 +302,13 @@ int mac802154_resp_associate(MACHANDLE mac, * The PAN ID Compression field shall be set to one. [1] pg. 69 */ - *u16 = (IEEE802154_FRAME_COMMAND << IEEE802154_FRAMECTRL_SHIFT_FTYPE); - *u16 |= IEEE802154_FRAMECTRL_ACKREQ; - *u16 |= IEEE802154_FRAMECTRL_PANIDCOMP; - *u16 |= (IEEE802154_ADDRMODE_EXTENDED << IEEE802154_FRAMECTRL_SHIFT_DADDR); - *u16 |= (IEEE802154_ADDRMODE_EXTENDED << IEEE802154_FRAMECTRL_SHIFT_SADDR); - + iob->io_data[0] = 0; + iob->io_data[1] = 0; + IEEE802154_SETACKREQ(iob->io_data, 0); + IEEE802154_SETPANIDCOMP(iob->io_data, 0); + IEEE802154_SETFTYPE(iob->io_data, 0, IEEE802154_FRAME_COMMAND); + IEEE802154_SETDADDRMODE(iob->io_data, 0, IEEE802154_ADDRMODE_EXTENDED); + IEEE802154_SETSADDRMODE(iob->io_data, 0, IEEE802154_ADDRMODE_EXTENDED); iob->io_len = 2; /* Each time a data or a MAC command frame is generated, the MAC sublayer diff --git a/wireless/ieee802154/mac802154_data.c b/wireless/ieee802154/mac802154_data.c index c97d55eddba..6223cd6a033 100644 --- a/wireless/ieee802154/mac802154_data.c +++ b/wireless/ieee802154/mac802154_data.c @@ -82,12 +82,15 @@ int mac802154_req_data(MACHANDLE mac, uint8_t mhr_len = 3; int ret; + wlinfo("Received frame io_len=%u io_offset=%u\n", + frame->io_offset, frame->io_len); + /* Check the required frame size */ if (frame->io_len > IEEE802154_MAX_PHY_PACKET_SIZE) - { - return -E2BIG; - } + { + return -E2BIG; + } /* Cast the first two bytes of the IOB to a uint16_t frame control field */ @@ -147,6 +150,9 @@ int mac802154_req_data(MACHANDLE mac, ret = mac802154_takesem(&priv->exclsem, true); if (ret < 0) { + /* Should only fail if interrupted by a signal */ + + wlwarn("WARNING: mac802154_takesem failed: %d\n", ret); return ret; } @@ -201,7 +207,8 @@ int mac802154_req_data(MACHANDLE mac, if (priv->devmode != IEEE802154_DEVMODE_PANCOORD) { - return -EINVAL; + ret = -EINVAL; + goto errout_with_sem; } } @@ -222,18 +229,32 @@ int mac802154_req_data(MACHANDLE mac, * here that created the header */ + wlinfo("mhr_len=%u\n", mhr_len); DEBUGASSERT(mhr_len == frame->io_offset); - frame->io_offset = 0; /* Set the offset to 0 to include the header */ - /* Allocate the txdesc, waiting if necessary, allow interruptions */ ret = mac802154_txdesc_alloc(priv, &txdesc, true); if (ret < 0) { + /* Should only fail if interrupted by a signal while re-acquiring + * exclsem. So the lock is not held if a failure is returned. + */ + + wlwarn("WARNING: mac802154_txdesc_alloc failed: %d\n", ret); return ret; } + /* Set the offset to 0 to include the header ( we do not want to + * modify the frame until AFTER the last place that -EINTR could + * be returned and could generate a retry. Subsequent error returns + * are fatal and no retry should occur. + */ + + frame->io_offset = 0; + + /* Then initialize the TX descriptor */ + txdesc->conf->handle = meta->msdu_handle; txdesc->frame = frame; txdesc->frametype = IEEE802154_FRAME_DATA; @@ -259,11 +280,8 @@ int mac802154_req_data(MACHANDLE mac, * don't have to try and kick-off any transmission here. */ - /* We no longer need to have the MAC layer locked. */ - - mac802154_givesem(&priv->exclsem); - - return -ENOTSUP; + ret = -ENOTSUP; + goto errout_with_txdesc; } else { @@ -299,8 +317,8 @@ int mac802154_req_data(MACHANDLE mac, } else { - mac802154_givesem(&priv->exclsem); - return -EINVAL; + ret = -EINVAL; + goto errout_with_txdesc; } } else @@ -320,6 +338,16 @@ int mac802154_req_data(MACHANDLE mac, } return OK; + +errout_with_txdesc: + /* Free TX the descriptor, but preserve the IOB. */ + + txdesc->frame = NULL; + mac802154_txdesc_free(priv, txdesc); + +errout_with_sem: + mac802154_givesem(&priv->exclsem); + return ret; } /**************************************************************************** diff --git a/wireless/ieee802154/mac802154_internal.h b/wireless/ieee802154/mac802154_internal.h index 2fa01eda5bf..1ebfa0e15ac 100644 --- a/wireless/ieee802154/mac802154_internal.h +++ b/wireless/ieee802154/mac802154_internal.h @@ -127,16 +127,31 @@ #define GETNET16(ptr,index) \ ((((uint16_t)((ptr)[(index) + 1])) << 8) | ((uint16_t)(((ptr)[index])))) -/* PUT 16-bit data: source in host order, result in newtwork order */ +/* Set 16-bit data: source in host order, result in network order. */ -#define PUTHOST16(ptr,index,value) \ +#define IEEE802154_SETBITS_U16(ptr,index,value) \ do \ { \ - (ptr)[index] = ((uint16_t)(value) >> 8) & 0xff; \ - (ptr)[index + 1] = (uint16_t)(value) & 0xff; \ + (ptr)[index] |= (uint16_t)(value) & 0xff; \ + (ptr)[index + 1] |= ((uint16_t)(value) >> 8) & 0xff; \ } \ while(0) +#define IEEE802154_SETFTYPE(ptr, index, ftype) \ + IEEE802154_SETBITS_U16(ptr, index, (ftype << IEEE802154_FRAMECTRL_SHIFT_FTYPE)) + +#define IEEE802154_SETACKREQ(ptr, index) \ + IEEE802154_SETBITS_U16(ptr, index, IEEE802154_FRAMECTRL_ACKREQ) + +#define IEEE802154_SETDADDRMODE(ptr, index, mode) \ + IEEE802154_SETBITS_U16(ptr, index, (mode << IEEE802154_FRAMECTRL_SHIFT_DADDR)) + +#define IEEE802154_SETSADDRMODE(ptr, index, mode) \ + IEEE802154_SETBITS_U16(ptr, index, (mode << IEEE802154_FRAMECTRL_SHIFT_SADDR)) + +#define IEEE802154_SETPANIDCOMP(ptr, index) \ + IEEE802154_SETBITS_U16(ptr, index, IEEE802154_FRAMECTRL_PANIDCOMP) + /* Configuration ************************************************************/ /* If processing is not done at the interrupt level, then work queue support * is required. diff --git a/wireless/ieee802154/mac802154_netdev.c b/wireless/ieee802154/mac802154_netdev.c index d30320efb7b..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; } @@ -676,27 +679,6 @@ static int macnet_txpoll_callback(FAR struct net_driver_s *dev) return 0; } -/**************************************************************************** - * Name: macnet_txpoll_process - * - * Description: - * Perform the periodic poll. This may be called either from watchdog - * timer logic or from the worker thread, depending upon the configuration. - * - * Parameters: - * priv - Reference to the driver state structure - * - * Returned Value: - * None - * - * Assumptions: - * - ****************************************************************************/ - -static inline void macnet_txpoll_process(FAR struct macnet_driver_s *priv) -{ -} - /**************************************************************************** * Name: macnet_txpoll_work * @@ -792,20 +774,20 @@ static int macnet_ifup(FAR struct net_driver_s *dev) ret = macnet_advertise(dev); if (ret >= 0) { - ninfo("Bringing up: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", - dev->d_ipv6addr[0], dev->d_ipv6addr[1], dev->d_ipv6addr[2], - dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5], - dev->d_ipv6addr[6], dev->d_ipv6addr[7]); + wlinfo("Bringing up: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", + dev->d_ipv6addr[0], dev->d_ipv6addr[1], dev->d_ipv6addr[2], + dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5], + dev->d_ipv6addr[6], dev->d_ipv6addr[7]); #ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR - ninfo(" Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - dev->d_mac.ieee802154.u8[0], dev->d_mac.ieee802154.u8[1], - dev->d_mac.ieee802154.u8[2], dev->d_mac.ieee802154.u8[3], - dev->d_mac.ieee802154.u8[4], dev->d_mac.ieee802154.u8[5], - dev->d_mac.ieee802154.u8[6], dev->d_mac.ieee802154.u8[7]); + wlinfo(" Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", + dev->d_mac.ieee802154.u8[0], dev->d_mac.ieee802154.u8[1], + dev->d_mac.ieee802154.u8[2], dev->d_mac.ieee802154.u8[3], + dev->d_mac.ieee802154.u8[4], dev->d_mac.ieee802154.u8[5], + dev->d_mac.ieee802154.u8[6], dev->d_mac.ieee802154.u8[7]); #else - ninfo(" Node: %02x:%02x\n", - dev->d_mac.ieee802154.u8[0], dev->d_mac.ieee802154.u8[1]); + wlinfo(" Node: %02x:%02x\n", + dev->d_mac.ieee802154.u8[0], dev->d_mac.ieee802154.u8[1]); #endif /* Set and activate a timer process */ @@ -884,6 +866,8 @@ static void macnet_txavail_work(FAR void *arg) { FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)arg; + wlinfo("ifup=%u\n", priv->md_bifup); + /* Lock the network and serialize driver operations if necessary. * NOTE: Serialization is only required in the case where the driver work * is performed on an LP worker thread and where more than one LP worker @@ -929,6 +913,8 @@ static int macnet_txavail(FAR struct net_driver_s *dev) { FAR struct macnet_driver_s *priv = (FAR struct macnet_driver_s *)dev->d_private; + wlinfo("Available=%u\n", work_available(&priv->md_pollwork)); + /* Is our single work structure available? It may not be if there are * pending interrupt actions and we will have to ignore the Tx * availability action. @@ -1111,6 +1097,8 @@ static int macnet_req_data(FAR struct ieee802154_driver_s *netdev, FAR struct iob_s *iob; int ret; + wlinfo("Received framelist\n"); + DEBUGASSERT(netdev != NULL && netdev->i_dev.d_private != NULL); priv = (FAR struct macnet_driver_s *)netdev->i_dev.d_private; @@ -1129,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); diff --git a/wireless/ieee802154/mac802154_poll.c b/wireless/ieee802154/mac802154_poll.c index 7f5251fdc97..f82ba91f3d8 100644 --- a/wireless/ieee802154/mac802154_poll.c +++ b/wireless/ieee802154/mac802154_poll.c @@ -142,6 +142,12 @@ int mac802154_req_poll(MACHANDLE mac, FAR struct ieee802154_poll_req_s *req) txdesc); } + /* Save a copy of the destination addressing infromation into the tx descriptor. + * We only do this for commands to help with handling their progession. + */ + + memcpy(&txdesc->destaddr, &req->coordaddr, sizeof(struct ieee802154_addr_s)); + /* Save a reference of the tx descriptor */ priv->cmd_desc = txdesc;