net: Add debug configuration for 802.15.4 network driver

User can toggle 802.15.4 network driver debugging from Kconfig.

Change-Id: I63f8e319172bce0561123416d18397468da671bf
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2016-03-16 12:33:25 +02:00
commit 2ec63ec481
2 changed files with 15 additions and 1 deletions

View file

@ -93,6 +93,13 @@ config NETWORK_IP_STACK_DEBUG_IPV6_ROUTE
help help
Enables IPv6 route code part to output debug messages Enables IPv6 route code part to output debug messages
config NETWORK_IP_STACK_DEBUG_15_4_NET_DRIVER
bool "Debug 802.15.4 network driver"
depends on NETWORKING_WITH_15_4
default n
help
Enables 802.15.4 network driver output debug messages
config NETWORK_IP_STACK_DEBUG_15_4_MAC config NETWORK_IP_STACK_DEBUG_15_4_MAC
bool "Debug 802.15.4 MAC layer" bool "Debug 802.15.4 MAC layer"
depends on NETWORKING_WITH_15_4 depends on NETWORKING_WITH_15_4

View file

@ -39,6 +39,11 @@
#include "contiki/netstack.h" #include "contiki/netstack.h"
#include <net_driver_15_4.h> #include <net_driver_15_4.h>
#if !defined(CONFIG_NETWORK_IP_STACK_DEBUG_15_4_NET_DRIVER)
#undef NET_DBG
#define NET_DBG(...)
#endif
/* Stacks for the tx & rx fibers. /* Stacks for the tx & rx fibers.
* FIXME: stack size needs fine-tuning * FIXME: stack size needs fine-tuning
*/ */
@ -65,7 +70,7 @@ static int net_driver_15_4_open(void)
static int net_driver_15_4_send(struct net_buf *buf) static int net_driver_15_4_send(struct net_buf *buf)
{ {
#ifdef CONFIG_NETWORKING_WITH_LOGGING #if defined(CONFIG_NETWORK_IP_STACK_DEBUG_15_4_NET_DRIVER)
int orig_len = ip_buf_len(buf); int orig_len = ip_buf_len(buf);
#endif #endif
@ -131,6 +136,8 @@ static void net_rx_15_4_fiber(void)
byte_count = uip_pkt_buflen(buf); byte_count = uip_pkt_buflen(buf);
#endif #endif
if (!NETSTACK_RDC.input(buf)) { if (!NETSTACK_RDC.input(buf)) {
NET_DBG("802.15.4 RDC input failed, "
"buf %p discarded\n", buf);
l2_buf_unref(buf); l2_buf_unref(buf);
} else { } else {
#if NET_MAC_CONF_STATS #if NET_MAC_CONF_STATS