net: ip: Enable Kconfig based debug options for the IP stack
It will be possible to enable/disable debug messages from IP stack from make menuconfig, instead of modifying the relevant files to do so. Change-Id: I065f10bcc2bc3579081b2fcdb1c47e12d148e2f1 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
0abd5dd7d5
commit
ee587244f4
11 changed files with 138 additions and 18 deletions
|
@ -435,5 +435,6 @@ config NET_15_4_LOOPBACK_NUM
|
||||||
help
|
help
|
||||||
Number of times loopback test runs, 0 means infinite.
|
Number of times loopback test runs, 0 means infinite.
|
||||||
|
|
||||||
|
source "net/ip/Kconfig.debug"
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
97
net/ip/Kconfig.debug
Normal file
97
net/ip/Kconfig.debug
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
# Kconfig.debug - IP stack debugging configuration options
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016 Intel Corporation.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
menuconfig NETWORKING_IP_STACK_DEBUG
|
||||||
|
bool "IP stack Debuggging options"
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enable the menu to select IP stack debugging part by part
|
||||||
|
|
||||||
|
if NETWORKING_IP_STACK_DEBUG
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "General debug level"
|
||||||
|
help
|
||||||
|
Set the level of debugging you want. This will be generalized,
|
||||||
|
whatever the part you will be debugging.
|
||||||
|
default NETWORK_IP_STACK_DEBUG_PRINT
|
||||||
|
config NETWORK_IP_STACK_DEBUG_PRINT
|
||||||
|
bool "Print only debug messages"
|
||||||
|
config NETWORK_IP_STACK_DEBUG_ANNOTATE
|
||||||
|
bool "Print only annotations"
|
||||||
|
config NETWORK_IP_STACK_DEBUG_FULL
|
||||||
|
bool "Print both messages and annotations"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config NETWORK_IP_STACK_DEBUG_IPV6
|
||||||
|
bool "Debug core IPv6"
|
||||||
|
depends on NETWORKING_WITH_IPV6
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enables core IPv6 code part to output debug messages
|
||||||
|
|
||||||
|
config NETWORK_IP_STACK_DEBUG_IPV6_DS
|
||||||
|
bool "Debug IPv6 Data Structures"
|
||||||
|
depends on NETWORKING_WITH_IPV6
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enables IPv6 Data Structures code part to output debug messages
|
||||||
|
|
||||||
|
config NETWORK_IP_STACK_DEBUG_IPV6_ICMPV6
|
||||||
|
bool "Debug ICMPv6"
|
||||||
|
depends on NETWORKING_WITH_IPV6
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enables ICMPv6 code part to output debug messages
|
||||||
|
|
||||||
|
config NETWORK_IP_STACK_DEBUG_IPV6_ND
|
||||||
|
bool "Debug IPv6 Neighbour Discovery"
|
||||||
|
depends on NETWORKING_WITH_IPV6
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enables IPv6 Neighbour Discovery code part to output debug messages
|
||||||
|
|
||||||
|
config NETWORK_IP_STACK_DEBUG_IPV6_NBR_CACHE
|
||||||
|
bool "Debug IPv6 neighbour cache"
|
||||||
|
depends on NETWORKING_WITH_IPV6
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enables Neighbour Cache code part to output debug messages
|
||||||
|
|
||||||
|
config NETWORK_IP_STACK_DEBUG_IPV6_ROUTE
|
||||||
|
bool "Debug IPv6 route"
|
||||||
|
depends on NETWORKING_WITH_IPV6
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enables IPv6 route code part to output debug messages
|
||||||
|
|
||||||
|
config NETWORK_IP_STACK_DEBUG_IPV4
|
||||||
|
bool "Debug core IPv4"
|
||||||
|
depends on NETWORKING_WITH_IPV4
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enables core IPv4 code part to output debug messages
|
||||||
|
|
||||||
|
config NETWORK_IP_STACK_DEBUG_IPV4_ARP
|
||||||
|
bool "Debug IPv4 ARP"
|
||||||
|
depends on NETWORKING_WITH_IPV4
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enables core ARP code part to output debug messages
|
||||||
|
|
||||||
|
endif
|
|
@ -61,6 +61,18 @@ void uip_debug_hex_dump(const unsigned char *buffer, int len);
|
||||||
#define DEBUG_ANNOTATE 2
|
#define DEBUG_ANNOTATE 2
|
||||||
#define DEBUG_FULL DEBUG_ANNOTATE | DEBUG_PRINT
|
#define DEBUG_FULL DEBUG_ANNOTATE | DEBUG_PRINT
|
||||||
|
|
||||||
|
#if (DEBUG == 1)
|
||||||
|
#if defined(CONFIG_NETWORK_IP_STACK_DEBUG_PRINT)
|
||||||
|
#define _DEBUG_ DEBUG_PRINT
|
||||||
|
#elif defined(CONFIG_NETWORK_IP_STACK_DEBUG_ANNOTATE)
|
||||||
|
#define _DEBUG_ DEBUG_ANNOTATE
|
||||||
|
#elif defined(CONFIG_NETWORK_IP_STACK_DEBUG_FULL)
|
||||||
|
#define _DEBUG_ DEBUG_FULL
|
||||||
|
#else
|
||||||
|
#define _DEBUG_ DEBUG_NONE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* PRINTA will always print if the debug routines are called directly */
|
/* PRINTA will always print if the debug routines are called directly */
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
|
@ -69,7 +81,7 @@ void uip_debug_hex_dump(const unsigned char *buffer, int len);
|
||||||
#define PRINTA(...) PRINT(__VA_ARGS__)
|
#define PRINTA(...) PRINT(__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (DEBUG) & DEBUG_ANNOTATE
|
#if (_DEBUG_) & DEBUG_ANNOTATE
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
#define ANNOTATE(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
|
#define ANNOTATE(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
|
||||||
#else
|
#else
|
||||||
|
@ -77,9 +89,9 @@ void uip_debug_hex_dump(const unsigned char *buffer, int len);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define ANNOTATE(...)
|
#define ANNOTATE(...)
|
||||||
#endif /* (DEBUG) & DEBUG_ANNOTATE */
|
#endif /* (_DEBUG_) & DEBUG_ANNOTATE */
|
||||||
|
|
||||||
#if (DEBUG) & DEBUG_PRINT
|
#if (_DEBUG_) & DEBUG_PRINT
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
|
#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
|
||||||
#else
|
#else
|
||||||
|
@ -91,6 +103,6 @@ void uip_debug_hex_dump(const unsigned char *buffer, int len);
|
||||||
#define PRINTF(...)
|
#define PRINTF(...)
|
||||||
#define PRINT6ADDR(addr)
|
#define PRINT6ADDR(addr)
|
||||||
#define PRINTLLADDR(lladdr)
|
#define PRINTLLADDR(lladdr)
|
||||||
#endif /* (DEBUG) & DEBUG_PRINT */
|
#endif /* (_DEBUG_) & DEBUG_PRINT */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -76,7 +76,9 @@
|
||||||
|
|
||||||
#include "contiki/ipv4/uip-neighbor.h"
|
#include "contiki/ipv4/uip-neighbor.h"
|
||||||
|
|
||||||
#define DEBUG DEBUG_NONE
|
#ifdef CONFIG_NETWORK_IP_STACK_DEBUG_IPV4
|
||||||
|
#define DEBUG 1
|
||||||
|
#endif
|
||||||
#include "contiki/ip/uip-debug.h"
|
#include "contiki/ip/uip-debug.h"
|
||||||
|
|
||||||
#include <net/ip_buf.h>
|
#include <net/ip_buf.h>
|
||||||
|
|
|
@ -113,13 +113,10 @@ static uint8_t tmpage;
|
||||||
#define BUF(buf) ((struct arp_hdr *)&uip_buf(buf)[0])
|
#define BUF(buf) ((struct arp_hdr *)&uip_buf(buf)[0])
|
||||||
#define IPBUF(buf) ((struct ethip_hdr *)&uip_buf(buf)[0])
|
#define IPBUF(buf) ((struct ethip_hdr *)&uip_buf(buf)[0])
|
||||||
|
|
||||||
#define DEBUG 0
|
#ifdef CONFIG_NETWORK_IP_STACK_DEBUG_IPV4_ARP
|
||||||
#if DEBUG
|
#define DEBUG 1
|
||||||
#include <stdio.h>
|
|
||||||
#define PRINTF(...) printf(__VA_ARGS__)
|
|
||||||
#else
|
|
||||||
#define PRINTF(...)
|
|
||||||
#endif
|
#endif
|
||||||
|
#include "contiki/ip/uip-debug.h"
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -51,7 +51,9 @@
|
||||||
#include "contiki/packetbuf.h"
|
#include "contiki/packetbuf.h"
|
||||||
#include "contiki/ipv6/uip-ds6-nbr.h"
|
#include "contiki/ipv6/uip-ds6-nbr.h"
|
||||||
|
|
||||||
#define DEBUG DEBUG_NONE
|
#ifdef CONFIG_NETWORK_IP_STACK_DEBUG_IPV6_NBR_CACHE
|
||||||
|
#define DEBUG 1
|
||||||
|
#endif
|
||||||
#include "contiki/ip/uip-debug.h"
|
#include "contiki/ip/uip-debug.h"
|
||||||
|
|
||||||
#ifdef UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED
|
#ifdef UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED
|
||||||
|
|
|
@ -72,8 +72,9 @@ LIST(notificationlist);
|
||||||
|
|
||||||
static int num_routes = 0;
|
static int num_routes = 0;
|
||||||
|
|
||||||
#undef DEBUG
|
#ifdef CONFIG_NETWORK_IP_STACK_DEBUG_IPV6_ROUTE
|
||||||
#define DEBUG DEBUG_NONE
|
#define DEBUG 1
|
||||||
|
#endif
|
||||||
#include "contiki/ip/uip-debug.h"
|
#include "contiki/ip/uip-debug.h"
|
||||||
|
|
||||||
static void rm_routelist_callback(nbr_table_item_t *ptr);
|
static void rm_routelist_callback(nbr_table_item_t *ptr);
|
||||||
|
|
|
@ -50,7 +50,9 @@
|
||||||
#include "contiki/ipv6/uip-ds6.h"
|
#include "contiki/ipv6/uip-ds6.h"
|
||||||
#include "contiki/ip/uip-packetqueue.h"
|
#include "contiki/ip/uip-packetqueue.h"
|
||||||
|
|
||||||
#define DEBUG DEBUG_NONE
|
#ifdef CONFIG_NETWORK_IP_STACK_DEBUG_IPV6_DS
|
||||||
|
#define DEBUG 1
|
||||||
|
#endif
|
||||||
#include "contiki/ip/uip-debug.h"
|
#include "contiki/ip/uip-debug.h"
|
||||||
|
|
||||||
struct etimer uip_ds6_timer_periodic; /** \brief Timer for maintenance of data structures */
|
struct etimer uip_ds6_timer_periodic; /** \brief Timer for maintenance of data structures */
|
||||||
|
|
|
@ -49,7 +49,9 @@
|
||||||
#include "contiki/ipv6/uip-icmp6.h"
|
#include "contiki/ipv6/uip-icmp6.h"
|
||||||
#include "contiki-default-conf.h"
|
#include "contiki-default-conf.h"
|
||||||
|
|
||||||
#define DEBUG DEBUG_NONE
|
#ifdef CONFIG_NETWORK_IP_STACK_DEBUG_IPV6_ICMPV6
|
||||||
|
#define DEBUG 1
|
||||||
|
#endif
|
||||||
#include "contiki/ip/uip-debug.h"
|
#include "contiki/ip/uip-debug.h"
|
||||||
|
|
||||||
#define UIP_IP_BUF(buf) ((struct uip_ip_hdr *)&uip_buf(buf)[UIP_LLH_LEN])
|
#define UIP_IP_BUF(buf) ((struct uip_ip_hdr *)&uip_buf(buf)[UIP_LLH_LEN])
|
||||||
|
|
|
@ -78,7 +78,9 @@
|
||||||
#include "lib/random.h"
|
#include "lib/random.h"
|
||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
#define DEBUG 0
|
#ifdef CONFIG_NETWORK_IP_STACK_DEBUG_IPV6_ND
|
||||||
|
#define DEBUG 1
|
||||||
|
#endif
|
||||||
#include "contiki/ip/uip-debug.h"
|
#include "contiki/ip/uip-debug.h"
|
||||||
|
|
||||||
#if UIP_LOGGING
|
#if UIP_LOGGING
|
||||||
|
|
|
@ -86,7 +86,9 @@
|
||||||
/* For Debug, logging, statistics */
|
/* For Debug, logging, statistics */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#define DEBUG DEBUG_NONE
|
#ifdef CONFIG_NETWORK_IP_STACK_DEBUG_IPV6
|
||||||
|
#define DEBUG 1
|
||||||
|
#endif
|
||||||
#include "contiki/ip/uip-debug.h"
|
#include "contiki/ip/uip-debug.h"
|
||||||
|
|
||||||
#if UIP_CONF_IPV6_RPL
|
#if UIP_CONF_IPV6_RPL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue