summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2016-02-25 13:14:36 +0200
committerGerrit Code Review <gerrit@zephyrproject.org>2016-03-01 13:49:55 +0000
commitca3d1adc434cb93f3b058c60c596f204cc213430 (patch)
treed6bf621c53a097df6dee29818692c0db995b8ec5
parent410d6849a62793bad59e5965747a479164b77bda (diff)
net: Use the existing logging option in Kconfig for debugging
Instead of new config option for debugging, lets re-use the existing logging option CONFIG_NETWORKING_WITH_LOGGING that is found in Kconfig. Unselecting that option will turn off the debug messages in IP stack. Change-Id: I4c1e0e91f3959304b7dc2b62d2bf73ec87cd1114 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
-rw-r--r--net/ip/Kconfig13
-rw-r--r--net/ip/Kconfig.debug15
-rw-r--r--net/ip/ip_buf.c5
-rw-r--r--net/ip/l2_buf.c5
-rw-r--r--net/ip/net_core.c4
5 files changed, 26 insertions, 16 deletions
diff --git a/net/ip/Kconfig b/net/ip/Kconfig
index 734fdca10..32297258e 100644
--- a/net/ip/Kconfig
+++ b/net/ip/Kconfig
@@ -90,6 +90,8 @@ config NETWORKING_WITH_IPV4
Legacy IP.
endchoice
+source "net/ip/Kconfig.debug"
+
config NETWORKING_STATISTICS
bool
prompt "Enable IP statistics gathering"
@@ -159,15 +161,6 @@ config RPL_WITH_OF0
Objective function zero (OF0).
endchoice
-config NETWORKING_WITH_LOGGING
- bool
- prompt "Enable logging of the uIP stack"
- depends on NETWORKING
- select STDOUT_CONSOLE
- default n
- help
- Enable packet and uIP stack logging
-
config NETWORKING_WITH_LOOPBACK
bool
prompt "Enable loopback driver"
@@ -435,6 +428,4 @@ config NET_15_4_LOOPBACK_NUM
help
Number of times loopback test runs, 0 means infinite.
-source "net/ip/Kconfig.debug"
-
endif
diff --git a/net/ip/Kconfig.debug b/net/ip/Kconfig.debug
index 1e8a0c9a3..2a75190f2 100644
--- a/net/ip/Kconfig.debug
+++ b/net/ip/Kconfig.debug
@@ -16,13 +16,14 @@
# limitations under the License.
#
-menuconfig NETWORKING_IP_STACK_DEBUG
- bool "IP stack Debuggging options"
+menuconfig NETWORKING_WITH_LOGGING
+ bool "Enable network stack logging"
+ select STDOUT_CONSOLE
default n
help
- Enable the menu to select IP stack debugging part by part
+ Enable logging in various parts of the network stack.
-if NETWORKING_IP_STACK_DEBUG
+if NETWORKING_WITH_LOGGING
choice
prompt "General debug level"
@@ -38,6 +39,12 @@ config NETWORK_IP_STACK_DEBUG_FULL
bool "Print both messages and annotations"
endchoice
+config NETWORK_IP_STACK_DEBUG_NET_BUF
+ bool "Debug network buffer allocation"
+ default n
+ help
+ Enables printing of network buffer allocations and frees.
+
config NETWORK_IP_STACK_DEBUG_IPV6
bool "Debug core IPv6"
depends on NETWORKING_WITH_IPV6
diff --git a/net/ip/ip_buf.c b/net/ip/ip_buf.c
index f1eedc915..1a0bed667 100644
--- a/net/ip/ip_buf.c
+++ b/net/ip/ip_buf.c
@@ -33,6 +33,11 @@
#include "ip/uip.h"
+#if !defined(CONFIG_NETWORK_IP_STACK_DEBUG_NET_BUF)
+#undef NET_DBG
+#define NET_DBG(...)
+#endif
+
extern struct net_tuple *net_context_get_tuple(struct net_context *context);
/* Available (free) buffers queue */
diff --git a/net/ip/l2_buf.c b/net/ip/l2_buf.c
index 4201e5c29..2da83a76a 100644
--- a/net/ip/l2_buf.c
+++ b/net/ip/l2_buf.c
@@ -33,6 +33,11 @@
#include "ip/uip.h"
+#if !defined(CONFIG_NETWORK_IP_STACK_DEBUG_NET_BUF)
+#undef NET_DBG
+#define NET_DBG(...)
+#endif
+
/* Available (free) layer 2 (MAC/L2) buffers queue */
#ifndef NET_NUM_L2_BUFS
/* Default value is 13 (receiving side) which means that max. UDP data
diff --git a/net/ip/net_core.c b/net/ip/net_core.c
index 70dcacd16..6059feac6 100644
--- a/net/ip/net_core.c
+++ b/net/ip/net_core.c
@@ -22,7 +22,9 @@
* limitations under the License.
*/
-#define DEBUG DEBUG_PRINT
+#ifdef CONFIG_NETWORKING_WITH_LOGGING
+#define DEBUG 1
+#endif
#include "contiki/ip/uip-debug.h"
#include <nanokernel.h>