From 6dafb4f53293f8f906b006251cc87f15ebfa6c74 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 20 Jun 2017 10:37:32 -0600 Subject: [PATCH] 6LoWPAN: Add debug statements; Update configuration, need to specific 6LoWPAN compatible port numbers. --- Kconfig | 18 +++---- .../clicker2-stm32/mrf24j40-6lowpan/defconfig | 2 + net/sixlowpan/README.txt | 3 +- net/sixlowpan/sixlowpan_framelist.c | 2 + net/sixlowpan/sixlowpan_send.c | 14 ++++-- wireless/ieee802154/mac802154_netdev.c | 49 +++++++------------ 6 files changed, 41 insertions(+), 47 deletions(-) diff --git a/Kconfig b/Kconfig index d2157939e8..0479955f52 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/mrf24j40-6lowpan/defconfig b/configs/clicker2-stm32/mrf24j40-6lowpan/defconfig index 9619d02170..8759fc1248 100644 --- a/configs/clicker2-stm32/mrf24j40-6lowpan/defconfig +++ b/configs/clicker2-stm32/mrf24j40-6lowpan/defconfig @@ -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 775357260b..4c654caef1 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 0b17e6dbab..226711af02 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. */ diff --git a/net/sixlowpan/sixlowpan_send.c b/net/sixlowpan/sixlowpan_send.c index a8fcdea983..18202d4b95 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/mac802154_netdev.c b/wireless/ieee802154/mac802154_netdev.c index d30320efb7..5966532b88 100644 --- a/wireless/ieee802154/mac802154_netdev.c +++ b/wireless/ieee802154/mac802154_netdev.c @@ -676,27 +676,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 +771,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 +863,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 +910,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 +1094,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;