net: Convert core IP stack to use log levels

Instead of one global log level option and one on/off boolean
config option / module, this commit creates one log level option
for each module. This simplifies the logging as it is now possible
to enable different level of debugging output for each network
module individually.

The commit also converts the code to use the new logger
instead of the old sys_log.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2018-07-06 11:35:07 +03:00
parent 3d1a659019
commit a76814bfb6
74 changed files with 754 additions and 795 deletions

View file

@ -35,23 +35,31 @@ extern "C" {
/* Network subsystem logging helpers */
#if defined(NET_LOG_ENABLED)
#if !defined(SYS_LOG_DOMAIN)
#define SYS_LOG_DOMAIN "net"
#endif /* !SYS_LOG_DOMAIN */
#if !defined(LOG_LEVEL)
#if !defined(NET_LOG_LEVEL)
#define NET_LOG_LEVEL CONFIG_NET_DEFAULT_LOG_LEVEL
#endif /* !NET_LOG_LEVEL */
#undef SYS_LOG_LEVEL
#ifndef NET_SYS_LOG_LEVEL
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_NET_LEVEL
#else
#define SYS_LOG_LEVEL NET_SYS_LOG_LEVEL
#endif /* !NET_SYS_LOG_LEVEL */
#if NET_LOG_LEVEL > CONFIG_NET_MAX_LOG_LEVEL
#undef NET_LOG_LEVEL
#define NET_LOG_LEVEL CONFIG_NET_MAX_LOG_LEVEL
#endif /* NET_LOG_LEVEL > CONFIG_NET_MAX_LOG_LEVEL */
#define LOG_LEVEL NET_LOG_LEVEL
#endif /* !LOG_LEVEL */
#if defined(NET_LOG_LEVEL)
#include <logging/log.h>
LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#endif /* NET_LOG_LEVEL */
#define NET_DBG(fmt, ...) LOG_DBG("(%p): %s: " fmt, k_current_get(), \
__func__, ##__VA_ARGS__)
#define NET_ERR(fmt, ...) LOG_ERR(fmt, ##__VA_ARGS__)
#define NET_WARN(fmt, ...) LOG_WRN(fmt, ##__VA_ARGS__)
#define NET_INFO(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__)
#define NET_DBG(fmt, ...) SYS_LOG_DBG("(%p): " fmt, k_current_get(), \
##__VA_ARGS__)
#define NET_ERR(fmt, ...) SYS_LOG_ERR(fmt, ##__VA_ARGS__)
#define NET_WARN(fmt, ...) SYS_LOG_WRN(fmt, ##__VA_ARGS__)
#define NET_INFO(fmt, ...) SYS_LOG_INF(fmt, ##__VA_ARGS__)
#define NET_ASSERT(cond) do { \
if (!(cond)) { \
NET_ERR("{assert: '" #cond "' failed}"); \
@ -61,14 +69,6 @@ extern "C" {
NET_ERR("{assert: '" #cond "' failed} " fmt, \
##__VA_ARGS__); \
} } while (false)
#else /* NET_LOG_ENABLED */
#define NET_DBG(...)
#define NET_ERR(...)
#define NET_INFO(...)
#define NET_WARN(...)
#define NET_ASSERT(...)
#define NET_ASSERT_INFO(...)
#endif /* NET_LOG_ENABLED */
#include <kernel.h>
@ -77,7 +77,6 @@ struct net_pkt;
struct net_context;
struct net_if;
#include <logging/sys_log.h>
#include <string.h>
/**

View file

@ -228,7 +228,6 @@ enum net_addr_type {
NET_ADDR_OVERRIDABLE,
} __packed;
#if NET_LOG_ENABLED > 0
static inline const char *net_addr_type2str(enum net_addr_type type)
{
switch (type) {
@ -247,14 +246,6 @@ static inline const char *net_addr_type2str(enum net_addr_type type)
return "<unknown>";
}
#else /* NET_LOG_ENABLED */
static inline const char *net_addr_type2str(enum net_addr_type type)
{
ARG_UNUSED(type);
return NULL;
}
#endif /* NET_LOG_ENABLED */
/** What is the current state of the network address */
enum net_addr_state {

View file

@ -704,7 +704,7 @@ static inline void net_pkt_set_src_ipv6_addr(struct net_pkt *pkt)
NET_BUF_POOL_DEFINE(name, count, CONFIG_NET_BUF_DATA_SIZE, \
CONFIG_NET_BUF_USER_DATA_SIZE, NULL)
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
/* Debug versions of the net_pkt functions that are used when tracking
* buffer usage.
@ -821,7 +821,7 @@ void net_pkt_frag_insert_debug(struct net_pkt *pkt, struct net_buf *frag,
*/
void net_pkt_print_frags(struct net_pkt *pkt);
#else /* CONFIG_NET_DEBUG_NET_PKT */
#else /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
#define net_pkt_print_frags(...)
@ -1052,7 +1052,7 @@ void net_pkt_frag_add(struct net_pkt *pkt, struct net_buf *frag);
*/
void net_pkt_frag_insert(struct net_pkt *pkt, struct net_buf *frag);
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
/**
* @brief Copy a packet fragment list while reserving some extra space
@ -1850,7 +1850,7 @@ int net_pkt_get_dst_addr(struct net_pkt *pkt,
struct sockaddr *addr,
socklen_t addrlen);
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
/**
* @brief Debug helper to print out the buffer allocations
*/
@ -1872,7 +1872,7 @@ const char *net_pkt_pool2str(struct net_buf_pool *pool);
#else
#define net_pkt_print(...)
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
/**
* @}

View file

@ -27,10 +27,10 @@ config NET_HOSTNAME_UNIQUE
hostname. For example, zephyr00005e005357 could be the hostname
if this setting is enabled.
config NET_DEBUG_HOSTNAME
bool "Debug hostname configuration"
depends on NET_LOG
help
Enables hostname configuration functions to output debug messages
module = NET_HOSTNAME
module-dep = NET_LOG
module-str = Log level for hostname configuration
module-help = Enables hostname configuration code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
endif

View file

@ -0,0 +1,52 @@
# Kconfig template file for setting networking log level for
# various network related components. This template variant
# allows user to specify the default log level.
#
# Copyright (c) 2018 Intel Corporation.
#
# SPDX-License-Identifier: Apache-2.0
#
choice
prompt "$(module-str)"
default $(module)_$(module-def)
depends on $(module-dep)
# If we ever get help text macro expansion, then just uncomment
# the following lines.
# help
# $(module-help)
config $(module)_LOG_LEVEL_OFF
bool "Off"
help
Do not write to log.
config $(module)_LOG_LEVEL_ERR
bool "Error"
help
Only write to log when NET_ERR or LOG_ERR is used.
config $(module)_LOG_LEVEL_WRN
bool "Warning"
help
Write to log with NET_WARN or LOG_WRN in addition to previous level.
config $(module)_LOG_LEVEL_INF
bool "Info"
help
Write to log with NET_INFO or LOG_INF in addition to previous levels.
config $(module)_LOG_LEVEL_DBG
bool "Debug"
help
Write to log with NET_DBG or LOG_DBG in addition to previous levels.
endchoice
config $(module)_LOG_LEVEL
int
default 0 if $(module)_LOG_LEVEL_OFF || !$(module-dep)
default 1 if $(module)_LOG_LEVEL_ERR
default 2 if $(module)_LOG_LEVEL_WRN
default 3 if $(module)_LOG_LEVEL_INF
default 4 if $(module)_LOG_LEVEL_DBG

View file

@ -0,0 +1,51 @@
# Kconfig template file for setting networking log level for
# various network related components.
#
# Copyright (c) 2018 Intel Corporation.
#
# SPDX-License-Identifier: Apache-2.0
#
choice
prompt "$(module-str)"
default $(module)_LOG_LEVEL_WRN
depends on $(module-dep)
# If we ever get help text macro expansion, then just uncomment
# the following lines.
# help
# $(module-help)
config $(module)_LOG_LEVEL_OFF
bool "Off"
help
Do not write to log.
config $(module)_LOG_LEVEL_ERR
bool "Error"
help
Only write to log when NET_ERR or LOG_ERR is used.
config $(module)_LOG_LEVEL_WRN
bool "Warning"
help
Write to log with NET_WARN or LOG_WRN in addition to previous level.
config $(module)_LOG_LEVEL_INF
bool "Info"
help
Write to log with NET_INFO or LOG_INF in addition to previous levels.
config $(module)_LOG_LEVEL_DBG
bool "Debug"
help
Write to log with NET_DBG or LOG_DBG in addition to previous levels.
endchoice
config $(module)_LOG_LEVEL
int
default 0 if $(module)_LOG_LEVEL_OFF || !$(module-dep)
default 1 if $(module)_LOG_LEVEL_ERR
default 2 if $(module)_LOG_LEVEL_WRN
default 3 if $(module)_LOG_LEVEL_INF
default 4 if $(module)_LOG_LEVEL_DBG

View file

@ -8,10 +8,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_HOSTNAME)
#define SYS_LOG_DOMAIN "net/hostname"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_hostname
#define NET_LOG_LEVEL CONFIG_NET_HOSTNAME_LOG_LEVEL
#include <zephyr.h>

View file

@ -8,10 +8,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_6LO)
#define SYS_LOG_DOMAIN "net/6lo"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_6lo
#define NET_LOG_LEVEL CONFIG_NET_6LO_LOG_LEVEL
#include <errno.h>
#include <net/net_core.h>

View file

@ -180,11 +180,13 @@ config NET_TCP_CHECKSUM
Enables TCP handler to check TCP checksum. If the checksum is invalid,
then the packet is discarded.
config NET_DEBUG_TCP
bool "Debug TCP"
depends on NET_TCP && NET_LOG
help
Enables TCP handler output debug messages
if NET_TCP
module = NET_TCP
module-dep = NET_LOG
module-str = Log level for TCP
module-help = Enables TCP handler output debug messages
source "subsys/net/Kconfig.template.log_config.net"
endif # NET_TCP
config NET_TCP_BACKLOG_SIZE
int "Number of simultaneous incoming TCP connections"
@ -267,11 +269,13 @@ config NET_UDP_CHECKSUM
Enables UDP handler to check UDP checksum. If the checksum is invalid,
then the packet is discarded.
config NET_DEBUG_UDP
bool "Debug UDP"
depends on NET_UDP && NET_LOG
help
Enables UDP handler output debug messages
if NET_UDP
module = NET_UDP
module-dep = NET_LOG
module-str = Log level for UDP
module-help = Enables UDP handler output debug messages
source "subsys/net/Kconfig.template.log_config.net"
endif # NET_UDP
config NET_MAX_CONN
int "How many network connections are supported"
@ -353,11 +357,13 @@ config NET_TRICKLE
Normally this is enabled automatically if needed,
so say 'n' if unsure.
config NET_DEBUG_TRICKLE
bool "Debug Trickle algorithm"
depends on NET_TRICKLE && NET_LOG
help
Enables Trickle library output debug messages
if NET_TRICKLE
module = NET_TRICKLE
module-dep = NET_LOG
module-str = Log level for Trickle algorithm
module-help = Enables Trickle library output debug messages
source "subsys/net/Kconfig.template.log_config.net"
endif # NET_TRICKLE
endif # NET_RAW_MODE
@ -477,12 +483,12 @@ config NET_OFFLOAD
help
Enables TCP/IP stack to be offload to a co-processor.
config NET_DEBUG_NET_OFFLOAD
bool "Debug Net Offload Layer"
default y if NET_LOG_GLOBAL
depends on NET_LOG
depends on NET_OFFLOAD
help
Enables offload TCP/IP stack output debug messages.
if NET_OFFLOAD
module = NET_OFFLOAD
module-dep = NET_LOG
module-str = Log level for offload layer
module-help = Enables offload layer to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
endif # NET_OFFLOAD
endmenu

View file

@ -8,91 +8,65 @@
menuconfig NET_LOG
bool "Enable network stack logging and debugging"
select SYS_LOG
select LOG
help
Enable logging in various parts of the network stack.
Specific debugging options to other sub-menus will be unlocked
as well (IPv6, IPv4, ...).
if NET_LOG
module = NET_DEFAULT
module-dep = NET_LOG
module-def = LOG_LEVEL_ERR
module-str=Default network stack logging level
module-help=Default log level if the user has not specified one.
source "subsys/net/Kconfig.template.log_config.default.net"
config SYS_LOG_NET_LEVEL
int "Network Stack Logging level"
default 1
depends on SYS_LOG
range 0 4
help
Sets log level for the network stack.
Levels are:
0 OFF, do not write
1 ERROR, only write SYS_LOG_ERR
2 WARNING, write SYS_LOG_WRN in addition to previous level
3 INFO, write SYS_LOG_INF in addition to previous levels
4 DEBUG, write SYS_LOG_DBG in addition to previous levels
module = NET_MAX
module-dep = NET_LOG
module-def = LOG_LEVEL_DBG
module-str = Max network stack logging level
module-help = Max log level. This overrides individual networking log levels.
source "subsys/net/Kconfig.template.log_config.default.net"
config NET_LOG_GLOBAL
bool "Enable global network stack logging"
select NET_DEBUG_CORE
select NET_DEBUG_IF
select NET_DEBUG_UTILS
select NET_DEBUG_CONTEXT
select NET_DEBUG_NET_PKT
select NET_DEBUG_CONN
select NET_DEBUG_ROUTE if NET_ROUTE
select NET_DEBUG_IPV6 if NET_IPV6
select NET_DEBUG_ICMPV6 if NET_IPV6
select NET_DEBUG_IPV6_NBR_CACHE if NET_IPV6
select NET_DEBUG_6LO if NET_6LO
select NET_DEBUG_IPV4 if NET_IPV4
select NET_DEBUG_ICMPV4 if NET_IPV4
select NET_DEBUG_DHCPV4 if NET_DHCPV4
select NET_DEBUG_UDP if NET_UDP
select NET_DEBUG_TCP if NET_TCP
select NET_DEBUG_RPL if NET_RPL
select NET_DEBUG_TRICKLE if NET_TRICKLE
select NET_DEBUG_MGMT_EVENT if NET_MGMT
select NET_DEBUG_MGMT_EVENT_STACK if NET_MGMT_EVENT
help
By default, logging will apply only on enabled CONFIG_NET_DEBUG_*
options, on which CONFIG_SYS_LOG_NET_LEVEL would be applied.
However, if you want all the network stack logging enabled at once,
use this option. Beware logging takes a lot of ROM/RAM and kills
execution timing so it can affect your use case.
module = NET_CORE
module-dep = NET_LOG
module-str = Log level for core IP stack
module-help = Enables core network stack code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
config NET_DEBUG_CORE
bool "Debug core IP stack"
help
Enables core network stack code part to output debug messages
module = NET_IF
module-dep = NET_LOG
module-str = Log level for network interface code
module-help = Enables network interface code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
config NET_DEBUG_IF
bool "Debug network interface code"
help
Enables network interface code part to output debug messages
module = NET_TC
module-dep = NET_LOG
module-str = Log level for network traffic class code
module-help = Enables network traffic class code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
config NET_DEBUG_TC
bool "Debug network traffic class code"
help
Enables network traffic class code part to output debug messages
module = NET_UTILS
module-dep = NET_LOG
module-str = Log level for utility functions in IP stack
module-help = Enables utility functions to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
config NET_DEBUG_UTILS
bool "Debug utility functions in IP stack"
help
Enables utility functions to output debug messages
module = NET_CONTEXT
module-dep = NET_LOG
module-str = Log level for network context allocation
module-help = Enables printing of network context allocations and frees.
source "subsys/net/Kconfig.template.log_config.net"
config NET_DEBUG_CONTEXT
bool "Debug network context allocation"
help
Enables printing of network context allocations and frees.
config NET_DEBUG_NET_PKT
bool "Debug network packet and buffer allocation"
select NET_BUF_POOL_USAGE
help
Enables collection of network packet and buffer allocations and frees.
module = NET_PKT
module-dep = NET_LOG
module-str = Log level for network packet and buffer allocation
module-help = Enables debug of network packet and buffer allocations and frees.
source "subsys/net/Kconfig.template.log_config.net"
if NET_PKT_LOG_LEVEL >= 4
config NET_DEBUG_NET_PKT_ALL
bool "Debug network packet and buffer individual allocation"
depends on NET_DEBUG_NET_PKT
help
Enables printing of network packet and buffer allocations and frees for
each allocation. This can produce lot of output so it is disabled by
@ -101,21 +75,20 @@ config NET_DEBUG_NET_PKT_ALL
config NET_DEBUG_NET_PKT_EXTERNALS
int "How many external network packet allocations"
default 0
depends on NET_DEBUG_NET_PKT
help
How many external net_pkt objects are there in user specific pools.
This value is used when allocating space for tracking the
memory allocations.
endif
config NET_DEBUG_CONN
bool "Debug connection handling"
help
Enables connection debug messages
module = NET_CONN
module-dep = NET_LOG
module-str = Log level for UDP/TCP connection handling
module-help = Enables UDP/TCP connection debug messages.
source "subsys/net/Kconfig.template.log_config.net"
config NET_DEBUG_ROUTE
bool "Debug route management"
depends on NET_ROUTE
help
Enables routing engine debug messages
endif # NET_LOG
module = NET_ROUTE
module-dep = NET_LOG
module-str = Log level for route management
module-help = Enables routing engine debug messages.
source "subsys/net/Kconfig.template.log_config.net"

View file

@ -47,30 +47,32 @@ config NET_IPV4_AUTO
help
Enables IPv4 auto IP address configuration (see RFC 3927)
if NET_LOG
module = NET_IPV4
module-dep = NET_LOG
module-str = Log level for core IPv4
module-help = Enables core IPv4 code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
config NET_DEBUG_IPV4
bool "Debug core IPv4"
help
Enables core IPv4 code part to output debug messages
module = NET_ICMPV4
module-dep = NET_LOG
module-str = Log level for ICMPv4
module-help = Enables ICMPv4 code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
config NET_DEBUG_ICMPV4
bool "Debug ICMPv4"
help
Enables ICMPv4 code part to output debug messages
if NET_DHCPV4
module = NET_DHCPV4
module-dep = NET_LOG
module-str = Log level for DHCPv4 client
module-help = Enable debug diagnostic from DHCPV4 client.
source "subsys/net/Kconfig.template.log_config.net"
endif # NET_DHCPV4
config NET_DEBUG_DHCPV4
bool "Debug DHCPv4 client"
depends on NET_DHCPV4
help
Enable debug diagnostic from DHCPV4 client.
config NET_DEBUG_IPV4_AUTOCONF
bool "Debug IPv4 autoconf client"
depends on NET_IPV4_AUTO
help
Enable debug diagnostic from IPv4 autoconf client.
endif # NET_LOG
if NET_IPV4_AUTO
module = NET_IPV4_AUTO
module-dep = NET_LOG
module-str = Log level for IPv4 autoconf client
module-help = Enable debug diagnostic from IPv4 autoconf client.
source "subsys/net/Kconfig.template.log_config.net"
endif # NET_IPV4_AUTO
endif # NET_IPV4

View file

@ -141,27 +141,30 @@ config NET_MAX_6LO_CONTEXTS
6lowpan context options table size. The value depends on your
network and memory consumption. More 6CO options uses more memory.
config NET_DEBUG_6LO
bool "Enable 6lowpan debug"
depends on NET_6LO && NET_LOG
if NET_6LO
module = NET_6LO
module-dep = NET_LOG
module-str = Log level for 6LoWPAN library
module-help = Enables 6LoWPAN code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
endif # NET_6LO
if NET_LOG
module = NET_IPV6
module-dep = NET_LOG
module-str = Log level for core IPv6
module-help = Enables core IPv6 code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
config NET_DEBUG_IPV6
bool "Debug core IPv6"
help
Enables core IPv6 code part to output debug messages
module = NET_ICMPV6
module-dep = NET_LOG
module-str = Log level for ICMPv6
module-help = Enables ICMPv6 code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
config NET_DEBUG_ICMPV6
bool "Debug ICMPv6"
help
Enables ICMPv6 code part to output debug messages
config NET_DEBUG_IPV6_NBR_CACHE
bool "Debug IPv6 neighbor cache"
help
Enables Neighbor Cache code to output debug messages
endif # NET_LOG
module = NET_IPV6_NBR_CACHE
module-dep = NET_LOG
module-str = Log level for IPv6 neighbor cache
module-help = Enables IPv6 Neighbor Cache code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
endif # NET_IPV6

View file

@ -54,10 +54,11 @@ config NET_MGMT_EVENT_INFO
and listeners will then be able to get it. Such information depends
on the type of event.
config NET_DEBUG_MGMT_EVENT
bool "Enable debug output on Net MGMT event core"
help
Add debug messages output on how Net MGMT events are handled.
module = NET_MGMT_EVENT
module-dep = NET_LOG
module-str = Log level for network management event core
module-help = Enable debug messages output for network management events.
source "subsys/net/Kconfig.template.log_config.net"
config NET_DEBUG_MGMT_EVENT_STACK
bool "Enable stack analysis output on Net MGMT event core"

View file

@ -274,10 +274,10 @@ config NET_STATISTICS_RPL
help
Keep track of RPL related statistics
config NET_DEBUG_RPL
bool "Debug RPL"
depends on NET_RPL && NET_LOG
help
Enables RPL output debug messages
module = NET_RPL
module-dep = NET_LOG
module-str = Log level for RPL
module-help = Enables RPL output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
endif # NET_RPL

View file

@ -13,6 +13,12 @@ menuconfig NET_STATISTICS
if NET_STATISTICS
module = NET_STATISTICS
module-dep = NET_LOG
module-str = Log level for network statistics
module-help = Enables statistics module to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
config NET_STATISTICS_PER_INTERFACE
bool "Collect statistics per network interface"
default y

View file

@ -8,10 +8,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_CONN)
#define SYS_LOG_DOMAIN "net/conn"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_conn
#define NET_LOG_LEVEL CONFIG_NET_CONN_LOG_LEVEL
#include <errno.h>
#include <misc/util.h>
@ -390,7 +388,6 @@ int net_conn_change_callback(struct net_conn_handle *handle,
return 0;
}
#if defined(CONFIG_NET_DEBUG_CONN)
static inline
void prepare_register_debug_print(char *dst, int dst_len,
char *src, int src_len,
@ -398,50 +395,49 @@ void prepare_register_debug_print(char *dst, int dst_len,
const struct sockaddr *local_addr)
{
if (remote_addr && remote_addr->sa_family == AF_INET6) {
#if defined(CONFIG_NET_IPV6)
snprintk(dst, dst_len, "%s",
net_sprint_ipv6_addr(&net_sin6(remote_addr)->
sin6_addr));
#else
snprintk(dst, dst_len, "%s", "?");
#endif
if (IS_ENABLED(CONFIG_NET_IPV6)) {
snprintk(dst, dst_len, "%s",
net_sprint_ipv6_addr(&net_sin6(remote_addr)->
sin6_addr));
} else {
snprintk(dst, dst_len, "%s", "?");
}
} else if (remote_addr && remote_addr->sa_family == AF_INET) {
#if defined(CONFIG_NET_IPV4)
snprintk(dst, dst_len, "%s",
net_sprint_ipv4_addr(&net_sin(remote_addr)->
sin_addr));
#else
snprintk(dst, dst_len, "%s", "?");
#endif
if (IS_ENABLED(CONFIG_NET_IPV4)) {
snprintk(dst, dst_len, "%s",
net_sprint_ipv4_addr(&net_sin(remote_addr)->
sin_addr));
} else {
snprintk(dst, dst_len, "%s", "?");
}
} else {
snprintk(dst, dst_len, "%s", "-");
}
if (local_addr && local_addr->sa_family == AF_INET6) {
#if defined(CONFIG_NET_IPV6)
snprintk(src, src_len, "%s",
net_sprint_ipv6_addr(&net_sin6(local_addr)->
sin6_addr));
#else
snprintk(src, src_len, "%s", "?");
#endif
if (IS_ENABLED(CONFIG_NET_IPV6)) {
snprintk(src, src_len, "%s",
net_sprint_ipv6_addr(&net_sin6(local_addr)->
sin6_addr));
} else {
snprintk(src, src_len, "%s", "?");
}
} else if (local_addr && local_addr->sa_family == AF_INET) {
#if defined(CONFIG_NET_IPV4)
snprintk(src, src_len, "%s",
net_sprint_ipv4_addr(&net_sin(local_addr)->
sin_addr));
#else
snprintk(src, src_len, "%s", "?");
#endif
if (IS_ENABLED(CONFIG_NET_IPV4)) {
snprintk(src, src_len, "%s",
net_sprint_ipv4_addr(&net_sin(local_addr)->
sin_addr));
} else {
snprintk(src, src_len, "%s", "?");
}
} else {
snprintk(src, src_len, "%s", "-");
}
}
#endif /* CONFIG_NET_DEBUG_CONN */
/* Check if we already have identical connection handler installed. */
static int find_conn_handler(enum net_ip_protocol proto,
@ -679,8 +675,7 @@ int net_conn_register(enum net_ip_protocol proto,
/* Cache needs to be cleared if new entries are added. */
cache_clear();
#if defined(CONFIG_NET_DEBUG_CONN)
do {
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) {
char dst[NET_IPV6_ADDR_LEN];
char src[NET_IPV6_ADDR_LEN];
@ -689,14 +684,13 @@ int net_conn_register(enum net_ip_protocol proto,
remote_addr,
local_addr);
NET_DBG("[%d/%d/%u/0x%02x] remote %p/%s/%u "
"local %p/%s/%u cb %p ud %p",
i, local_addr ? local_addr->sa_family : AF_UNSPEC,
proto, rank, remote_addr, dst, remote_port,
NET_DBG("[%d/%d/%u/0x%02x] remote %p/%s/%u ", i,
local_addr ? local_addr->sa_family : AF_UNSPEC,
proto, rank, remote_addr, dst, remote_port);
NET_DBG(" local %p/%s/%u cb %p ud %p",
local_addr, src, local_port,
cb, user_data);
} while (0);
#endif /* CONFIG_NET_DEBUG_CONN */
}
if (handle) {
*handle = (struct net_conn_handle *)&conns[i];
@ -862,7 +856,7 @@ enum net_verdict net_conn_input(enum net_ip_protocol proto, struct net_pkt *pkt)
return NET_DROP;
}
if (IS_ENABLED(CONFIG_NET_DEBUG_CONN)) {
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) {
int data_len = -1;
if (IS_ENABLED(CONFIG_NET_IPV4) &&

View file

@ -9,10 +9,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_DHCPV4)
#define SYS_LOG_DOMAIN "net/dhcpv4"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_dhcpv4
#define NET_LOG_LEVEL CONFIG_NET_DHCPV4_LOG_LEVEL
#include <errno.h>
#include <inttypes.h>

View file

@ -8,10 +8,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_ICMPV4)
#define SYS_LOG_DOMAIN "net/icmpv4"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_icmpv4
#define NET_LOG_LEVEL CONFIG_NET_ICMPV4_LOG_LEVEL
#include <errno.h>
#include <misc/slist.h>

View file

@ -8,10 +8,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_ICMPV6)
#define SYS_LOG_DOMAIN "net/icmpv6"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_icmpv6
#define NET_LOG_LEVEL CONFIG_NET_ICMPV6_LOG_LEVEL
#include <errno.h>
#include <misc/slist.h>

View file

@ -8,10 +8,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_IPV4)
#define SYS_LOG_DOMAIN "net/ipv4"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_ipv4
#define NET_LOG_LEVEL CONFIG_NET_IPV4_LOG_LEVEL
#include <errno.h>
#include <net/net_core.h>

View file

@ -9,10 +9,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_IPV4_AUTOCONF)
#define SYS_LOG_DOMAIN "net/ipv4ll"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_ipv4_autoconf
#define NET_LOG_LEVEL CONFIG_NET_IPV4_AUTOCONF_LOG_LEVEL
#include "net_private.h"
#include <errno.h>

View file

@ -8,15 +8,13 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_IPV6)
#define SYS_LOG_DOMAIN "net/ipv6"
#define NET_LOG_ENABLED 1
#define LOG_MODULE_NAME net_ipv6
#define NET_LOG_LEVEL CONFIG_NET_IPV6_LOG_LEVEL
/* By default this prints too much data, set the value to 1 to see
* neighbor cache contents.
*/
#define NET_DEBUG_NBR 0
#endif
#include <errno.h>
#include <stdlib.h>

View file

@ -8,15 +8,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_IPV6)
#define SYS_LOG_DOMAIN "net/ipv6-frag"
#define NET_LOG_ENABLED 1
/* By default this prints too much data, set the value to 1 to see
* neighbor cache contents.
*/
#define NET_DEBUG_NBR 0
#endif
#define LOG_MODULE_NAME net_ipv6_frag
#define NET_LOG_LEVEL CONFIG_NET_IPV6_LOG_LEVEL
#include <errno.h>
#include <net/net_core.h>

View file

@ -8,15 +8,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_IPV6)
#define SYS_LOG_DOMAIN "net/ipv6-mld"
#define NET_LOG_ENABLED 1
/* By default this prints too much data, set the value to 1 to see
* neighbor cache contents.
*/
#define NET_DEBUG_NBR 0
#endif
#define LOG_MODULE_NAME net_ipv6_mld
#define NET_LOG_LEVEL CONFIG_NET_IPV6_LOG_LEVEL
#include <errno.h>
#include <net/net_core.h>
@ -300,7 +293,6 @@ drop:
net_pkt_unref(pkt);
}
#if defined(CONFIG_NET_DEBUG_IPV6)
#define dbg_addr(action, pkt_str, src, dst) \
do { \
NET_DBG("%s %s from %s to %s", action, pkt_str, \
@ -310,10 +302,6 @@ drop:
#define dbg_addr_recv(pkt_str, src, dst) \
dbg_addr("Received", pkt_str, src, dst)
#else
#define dbg_addr(...)
#define dbg_addr_recv(...)
#endif /* CONFIG_NET_DEBUG_IPV6 */
static enum net_verdict handle_mld_query(struct net_pkt *pkt)
{

View file

@ -8,15 +8,13 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_IPV6)
#define SYS_LOG_DOMAIN "net/ipv6-nbr"
#define NET_LOG_ENABLED 1
#define LOG_MODULE_NAME net_ipv6_nbr
#define NET_LOG_LEVEL CONFIG_NET_IPV6_LOG_LEVEL
/* By default this prints too much data, set the value to 1 to see
* neighbor cache contents.
*/
#define NET_DEBUG_NBR 0
#endif
#include <errno.h>
#include <stdlib.h>
@ -430,10 +428,9 @@ static struct net_nbr *nbr_new(struct net_if *iface,
return nbr;
}
#if defined(CONFIG_NET_DEBUG_IPV6)
static inline void dbg_update_neighbor_lladdr(struct net_linkaddr *new_lladdr,
struct net_linkaddr_storage *old_lladdr,
struct in6_addr *addr)
static void dbg_update_neighbor_lladdr(struct net_linkaddr *new_lladdr,
struct net_linkaddr_storage *old_lladdr,
struct in6_addr *addr)
{
char out[sizeof("xx:xx:xx:xx:xx:xx:xx:xx")];
@ -446,9 +443,9 @@ static inline void dbg_update_neighbor_lladdr(struct net_linkaddr *new_lladdr,
out);
}
static inline void dbg_update_neighbor_lladdr_raw(u8_t *new_lladdr,
struct net_linkaddr_storage *old_lladdr,
struct in6_addr *addr)
static void dbg_update_neighbor_lladdr_raw(u8_t *new_lladdr,
struct net_linkaddr_storage *old_lladdr,
struct in6_addr *addr)
{
struct net_linkaddr lladdr = {
.len = old_lladdr->len,
@ -485,17 +482,6 @@ static inline void dbg_update_neighbor_lladdr_raw(u8_t *new_lladdr,
#define dbg_addr_sent_tgt(pkt_str, src, dst, tgt) \
dbg_addr_with_tgt("Sent", pkt_str, src, dst, tgt)
#else
#define dbg_update_neighbor_lladdr(...)
#define dbg_update_neighbor_lladdr_raw(...)
#define dbg_addr(...)
#define dbg_addr_recv(...)
#define dbg_addr_sent(...)
#define dbg_addr_with_tgt(...)
#define dbg_addr_recv_tgt(...)
#define dbg_addr_sent_tgt(...)
#endif /* CONFIG_NET_DEBUG_IPV6 */
struct net_nbr *net_ipv6_nbr_add(struct net_if *iface,
struct in6_addr *addr,
@ -1208,18 +1194,21 @@ static void ns_routing_info(struct net_pkt *pkt,
struct in6_addr *nexthop,
struct in6_addr *tgt)
{
#if defined(CONFIG_NET_DEBUG_IPV6) && (CONFIG_SYS_LOG_NET_LEVEL > 3)
char out[NET_IPV6_ADDR_LEN];
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) {
char out[NET_IPV6_ADDR_LEN];
snprintk(out, sizeof(out), "%s", net_sprint_ipv6_addr(nexthop));
snprintk(out, sizeof(out), "%s",
net_sprint_ipv6_addr(nexthop));
if (net_ipv6_addr_cmp(nexthop, tgt)) {
NET_DBG("Routing to %s iface %p", out, net_pkt_iface(pkt));
} else {
NET_DBG("Routing to %s via %s iface %p",
net_sprint_ipv6_addr(tgt), out, net_pkt_iface(pkt));
if (net_ipv6_addr_cmp(nexthop, tgt)) {
NET_DBG("Routing to %s iface %p", out,
net_pkt_iface(pkt));
} else {
NET_DBG("Routing to %s via %s iface %p",
net_sprint_ipv6_addr(tgt), out,
net_pkt_iface(pkt));
}
}
#endif
}
static enum net_verdict handle_ns_input(struct net_pkt *pkt)

View file

@ -6,10 +6,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_IPV6_NBR_CACHE)
#define SYS_LOG_DOMAIN "net/nbr"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_nbr
#define NET_LOG_LEVEL CONFIG_NET_IPV6_NBR_CACHE_LOG_LEVEL
#include <errno.h>
@ -21,14 +19,14 @@
NET_NBR_LLADDR_INIT(net_neighbor_lladdr, CONFIG_NET_IPV6_MAX_NEIGHBORS);
#if defined(CONFIG_NET_DEBUG_IPV6_NBR_CACHE)
#if defined(CONFIG_NET_IPV6_NBR_CACHE_LOG_LEVEL_DBG)
void net_nbr_unref_debug(struct net_nbr *nbr, const char *caller, int line)
#define net_nbr_unref(nbr) net_nbr_unref_debug(nbr, __func__, __LINE__)
#else
void net_nbr_unref(struct net_nbr *nbr)
#endif
{
#if defined(CONFIG_NET_DEBUG_IPV6_NBR_CACHE)
#if defined(CONFIG_NET_IPV6_NBR_CACHE_LOG_LEVEL_DBG)
NET_DBG("nbr %p ref %u (%s():%d)", nbr, nbr->ref - 1, caller, line);
#else
NET_DBG("nbr %p ref %u", nbr, nbr->ref - 1);
@ -42,14 +40,14 @@ void net_nbr_unref(struct net_nbr *nbr)
}
}
#if defined(CONFIG_NET_DEBUG_IPV6_NBR_CACHE)
#if defined(CONFIG_NET_IPV6_NBR_CACHE_LOG_LEVEL_DBG)
struct net_nbr *net_nbr_ref_debug(struct net_nbr *nbr, const char *caller,
int line)
#else
struct net_nbr *net_nbr_ref(struct net_nbr *nbr)
#endif
{
#if defined(CONFIG_NET_DEBUG_IPV6_NBR_CACHE)
#if defined(CONFIG_NET_IPV6_NBR_CACHE_LOG_LEVEL_DBG)
NET_DBG("nbr %p ref %u (%s():%d)", nbr, nbr->ref + 1, caller, line);
#else
NET_DBG("nbr %p ref %u", nbr, nbr->ref + 1);
@ -206,24 +204,27 @@ void net_nbr_clear_table(struct net_nbr_table *table)
}
}
#if defined(CONFIG_NET_DEBUG_IPV6_NBR_CACHE)
void net_nbr_print(struct net_nbr_table *table)
{
int i;
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) {
int i;
for (i = 0; i < table->nbr_count; i++) {
struct net_nbr *nbr = get_nbr(table->nbr, i);
for (i = 0; i < table->nbr_count; i++) {
struct net_nbr *nbr = get_nbr(table->nbr, i);
if (!nbr->ref) {
continue;
if (!nbr->ref) {
continue;
}
NET_DBG("[%d] nbr %p data %p ref %d iface %p idx %d "
"ll %s",
i, nbr, nbr->data, nbr->ref, nbr->iface,
nbr->idx,
nbr->idx == NET_NBR_LLADDR_UNKNOWN ?
"<unknown>" :
net_sprint_ll_addr(
net_neighbor_lladdr[nbr->idx].lladdr.addr,
net_neighbor_lladdr[nbr->idx].lladdr.len));
}
NET_DBG("[%d] nbr %p data %p ref %d iface %p idx %d ll %s",
i, nbr, nbr->data, nbr->ref, nbr->iface, nbr->idx,
nbr->idx == NET_NBR_LLADDR_UNKNOWN ? "<unknown>" :
net_sprint_ll_addr(
net_neighbor_lladdr[nbr->idx].lladdr.addr,
net_neighbor_lladdr[nbr->idx].lladdr.len));
}
}
#endif /* CONFIG_NET_DEBUG_IPV6_NBR_CACHE */

View file

@ -132,7 +132,7 @@ static inline void *net_nbr_extra_data(struct net_nbr *nbr)
* is released and returned to free list.
* @param nbr Pointer to neighbor
*/
#if defined(CONFIG_NET_DEBUG_IPV6_NBR_CACHE)
#if defined(CONFIG_NET_IPV6_NBR_CACHE_LOG_LEVEL_DBG)
void net_nbr_unref_debug(struct net_nbr *nbr, const char *caller, int line);
#define net_nbr_unref(nbr) net_nbr_unref_debug(nbr, __func__, __LINE__)
#else
@ -144,7 +144,7 @@ void net_nbr_unref(struct net_nbr *nbr);
* @param nbr Pointer to neighbor
* @return Pointer to neighbor
*/
#if defined(CONFIG_NET_DEBUG_IPV6_NBR_CACHE)
#if defined(CONFIG_NET_IPV6_NBR_CACHE_LOG_LEVEL_DBG)
struct net_nbr *net_nbr_ref_debug(struct net_nbr *nbr, const char *caller,
int line);
#define net_nbr_ref(nbr) net_nbr_ref_debug(nbr, __func__, __LINE__)
@ -202,15 +202,11 @@ struct net_linkaddr_storage *net_nbr_get_lladdr(u8_t idx);
*/
void net_nbr_clear_table(struct net_nbr_table *table);
#if defined(CONFIG_NET_DEBUG_IPV6_NBR_CACHE)
/**
* @brief Debug helper to print out the neighbor information.
* @param table Neighbor table
*/
void net_nbr_print(struct net_nbr_table *table);
#else
#define net_nbr_print(...)
#endif /* CONFIG_NET_DEBUG_IPV6_NBR_CACHE */
#ifdef __cplusplus
}

View file

@ -10,10 +10,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_CONTEXT)
#define SYS_LOG_DOMAIN "net/ctx"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_ctx
#define NET_LOG_LEVEL CONFIG_NET_CONTEXT_LOG_LEVEL
#include <kernel.h>
#include <string.h>

View file

@ -11,10 +11,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_CORE)
#define SYS_LOG_DOMAIN "net/core"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_core
#define NET_LOG_LEVEL CONFIG_NET_CORE_LOG_LEVEL
#include <init.h>
#include <kernel.h>
@ -293,13 +291,12 @@ int net_send_data(struct net_pkt *pkt)
static void net_rx(struct net_if *iface, struct net_pkt *pkt)
{
#if defined(CONFIG_NET_STATISTICS) || defined(CONFIG_NET_DEBUG_CORE)
size_t pkt_len;
#if defined(CONFIG_NET_STATISTICS)
pkt_len = pkt->total_pkt_len;
#else
pkt_len = net_pkt_get_len(pkt);
#endif
#endif
NET_DBG("Received pkt %p len %zu", pkt, pkt_len);

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_IF)
#define SYS_LOG_DOMAIN "net/if"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_if
#define NET_LOG_LEVEL CONFIG_NET_IF_LOG_LEVEL
#include <init.h>
#include <kernel.h>
@ -99,7 +97,7 @@ static struct k_thread tx_thread_ts;
static sys_slist_t timestamp_callbacks;
#endif /* CONFIG_NET_PKT_TIMESTAMP */
#if defined(CONFIG_NET_DEBUG_IF)
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG
#if defined(CONFIG_NET_STATISTICS)
#define debug_check_packet(pkt) \
do { \
@ -121,7 +119,7 @@ static sys_slist_t timestamp_callbacks;
#endif /* CONFIG_NET_STATISTICS */
#else
#define debug_check_packet(...)
#endif /* CONFIG_NET_DEBUG_IF */
#endif /* NET_LOG_LEVEL >= LOG_LEVEL_DBG */
static inline void net_context_send_cb(struct net_context *context,
void *token, int status)

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_MGMT_EVENT)
#define SYS_LOG_DOMAIN "net/mgmt"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_mgmt
#define NET_LOG_LEVEL CONFIG_NET_MGMT_EVENT_LOG_LEVEL
#include <kernel.h>
#include <toolchain.h>

View file

@ -10,16 +10,15 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#define SYS_LOG_DOMAIN "net/pkt"
#define NET_LOG_ENABLED 1
#define LOG_MODULE_NAME net_pkt
#define NET_LOG_LEVEL CONFIG_NET_PKT_LOG_LEVEL
/* This enables allocation debugging but does not print so much output
* as that can slow things down a lot.
*/
#if !defined(CONFIG_NET_DEBUG_NET_PKT_ALL)
#define NET_SYS_LOG_LEVEL 5
#endif
#if defined(CONFIG_NET_DEBUG_NET_PKT_ALL)
#undef NET_LOG_LEVEL
#define NET_LOG_LEVEL 5
#endif
#include <kernel.h>
@ -88,7 +87,7 @@ NET_PKT_SLAB_DEFINE(tx_pkts, CONFIG_NET_PKT_TX_COUNT);
NET_PKT_DATA_POOL_DEFINE(rx_bufs, CONFIG_NET_BUF_RX_COUNT);
NET_PKT_DATA_POOL_DEFINE(tx_bufs, CONFIG_NET_BUF_TX_COUNT);
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
#define NET_FRAG_CHECK_IF_NOT_IN_USE(frag, ref) \
do { \
@ -238,7 +237,29 @@ const char *net_pkt_pool2str(struct net_buf_pool *pool)
static inline s16_t get_frees(struct net_buf_pool *pool)
{
#if defined(CONFIG_NET_BUF_POOL_USAGE)
return pool->avail_count;
#else
return 0;
#endif
}
static inline const char *get_name(struct net_buf_pool *pool)
{
#if defined(CONFIG_NET_BUF_POOL_USAGE)
return pool->name;
#else
return "?";
#endif
}
static inline s16_t get_size(struct net_buf_pool *pool)
{
#if defined(CONFIG_NET_BUF_POOL_USAGE)
return pool->pool_size;
#else
return 0;
#endif
}
static inline const char *slab2str(struct k_mem_slab *slab)
@ -293,11 +314,11 @@ struct net_pkt *net_pkt_get_reserve_debug(struct k_mem_slab *slab,
s32_t timeout,
const char *caller,
int line)
#else /* CONFIG_NET_DEBUG_NET_PKT */
#else /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
struct net_pkt *net_pkt_get_reserve(struct k_mem_slab *slab,
u16_t reserve_head,
s32_t timeout)
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
{
struct net_pkt *pkt;
int ret;
@ -322,7 +343,7 @@ struct net_pkt *net_pkt_get_reserve(struct k_mem_slab *slab,
net_pkt_set_priority(pkt, CONFIG_NET_TX_DEFAULT_PRIORITY);
net_pkt_set_vlan_tag(pkt, NET_VLAN_TAG_UNSPEC);
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
net_pkt_alloc_add(pkt, true, caller, line);
NET_DBG("%s [%u] pkt %p reserve %u ref %d (%s():%d)",
@ -332,17 +353,17 @@ struct net_pkt *net_pkt_get_reserve(struct k_mem_slab *slab,
return pkt;
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
struct net_buf *net_pkt_get_reserve_data_debug(struct net_buf_pool *pool,
u16_t reserve_head,
s32_t timeout,
const char *caller,
int line)
#else /* CONFIG_NET_DEBUG_NET_PKT */
#else /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
struct net_buf *net_pkt_get_reserve_data(struct net_buf_pool *pool,
u16_t reserve_head,
s32_t timeout)
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
{
struct net_buf *frag;
@ -363,13 +384,13 @@ struct net_buf *net_pkt_get_reserve_data(struct net_buf_pool *pool,
net_buf_reserve(frag, reserve_head);
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
NET_FRAG_CHECK_IF_NOT_IN_USE(frag, frag->ref + 1);
net_pkt_alloc_add(frag, false, caller, line);
NET_DBG("%s (%s) [%d] frag %p reserve %u ref %d (%s():%d)",
pool2str(pool), pool->name, get_frees(pool),
pool2str(pool), get_name(pool), get_frees(pool),
frag, reserve_head, frag->ref, caller, line);
#endif
@ -379,7 +400,7 @@ struct net_buf *net_pkt_get_reserve_data(struct net_buf_pool *pool,
/* Get a fragment, try to figure out the pool from where to get
* the data.
*/
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
struct net_buf *net_pkt_get_frag_debug(struct net_pkt *pkt,
s32_t timeout,
const char *caller, int line)
@ -393,7 +414,7 @@ struct net_buf *net_pkt_get_frag(struct net_pkt *pkt,
context = net_pkt_context(pkt);
if (context && context->data_pool) {
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
return net_pkt_get_reserve_data_debug(context->data_pool(),
net_pkt_ll_reserve(pkt),
timeout, caller, line);
@ -401,12 +422,12 @@ struct net_buf *net_pkt_get_frag(struct net_pkt *pkt,
return net_pkt_get_reserve_data(context->data_pool(),
net_pkt_ll_reserve(pkt),
timeout);
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
}
#endif /* CONFIG_NET_CONTEXT_NET_PKT_POOL */
if (pkt->slab == &rx_pkts) {
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
return net_pkt_get_reserve_rx_data_debug(
net_pkt_ll_reserve(pkt), timeout, caller, line);
#else
@ -415,7 +436,7 @@ struct net_buf *net_pkt_get_frag(struct net_pkt *pkt,
#endif
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
return net_pkt_get_reserve_tx_data_debug(net_pkt_ll_reserve(pkt),
timeout, caller, line);
#else
@ -424,7 +445,7 @@ struct net_buf *net_pkt_get_frag(struct net_pkt *pkt,
#endif
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
struct net_pkt *net_pkt_get_reserve_rx_debug(u16_t reserve_head,
s32_t timeout,
const char *caller, int line)
@ -457,7 +478,7 @@ struct net_buf *net_pkt_get_reserve_tx_data_debug(u16_t reserve_head,
timeout, caller, line);
}
#else /* CONFIG_NET_DEBUG_NET_PKT */
#else /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
struct net_pkt *net_pkt_get_reserve_rx(u16_t reserve_head,
s32_t timeout)
@ -483,10 +504,10 @@ struct net_buf *net_pkt_get_reserve_tx_data(u16_t reserve_head,
return net_pkt_get_reserve_data(&tx_bufs, reserve_head, timeout);
}
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
static struct net_pkt *net_pkt_get_debug(struct k_mem_slab *slab,
struct net_context *context,
s32_t timeout,
@ -495,7 +516,7 @@ static struct net_pkt *net_pkt_get_debug(struct k_mem_slab *slab,
static struct net_pkt *net_pkt_get(struct k_mem_slab *slab,
struct net_context *context,
s32_t timeout)
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
{
struct in6_addr *addr6 = NULL;
struct net_if *iface;
@ -516,7 +537,7 @@ static struct net_pkt *net_pkt_get(struct k_mem_slab *slab,
addr6 = &((struct sockaddr_in6 *) &context->remote)->sin6_addr;
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
pkt = net_pkt_get_reserve_debug(slab,
net_if_get_ll_reserve(iface, addr6),
timeout, caller, line);
@ -585,7 +606,7 @@ static struct net_pkt *net_pkt_get(struct k_mem_slab *slab,
return pkt;
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
static struct net_buf *_pkt_get_data_debug(struct net_buf_pool *pool,
struct net_context *context,
s32_t timeout,
@ -594,7 +615,7 @@ static struct net_buf *_pkt_get_data_debug(struct net_buf_pool *pool,
static struct net_buf *_pkt_get_data(struct net_buf_pool *pool,
struct net_context *context,
s32_t timeout)
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
{
struct in6_addr *addr6 = NULL;
struct net_if *iface;
@ -614,7 +635,7 @@ static struct net_buf *_pkt_get_data(struct net_buf_pool *pool,
addr6 = &((struct sockaddr_in6 *) &context->remote)->sin6_addr;
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
frag = net_pkt_get_reserve_data_debug(pool,
net_if_get_ll_reserve(iface,
addr6),
@ -651,7 +672,7 @@ static inline struct net_buf_pool *get_data_pool(struct net_context *context)
#define get_data_pool(...) NULL
#endif /* CONFIG_NET_CONTEXT_NET_PKT_POOL */
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
struct net_pkt *net_pkt_get_rx_debug(struct net_context *context,
s32_t timeout,
const char *caller, int line)
@ -679,7 +700,7 @@ struct net_buf *net_pkt_get_data_debug(struct net_context *context,
timeout, caller, line);
}
#else /* CONFIG_NET_DEBUG_NET_PKT */
#else /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
struct net_pkt *net_pkt_get_rx(struct net_context *context, s32_t timeout)
{
@ -713,10 +734,10 @@ struct net_buf *net_pkt_get_data(struct net_context *context, s32_t timeout)
return _pkt_get_data(pool ? pool : &tx_bufs, context, timeout);
}
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
void net_pkt_unref_debug(struct net_pkt *pkt, const char *caller, int line)
{
struct net_buf *frag;
@ -724,14 +745,16 @@ void net_pkt_unref_debug(struct net_pkt *pkt, const char *caller, int line)
#else
void net_pkt_unref(struct net_pkt *pkt)
{
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
if (!pkt) {
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
NET_ERR("*** ERROR *** pkt %p (%s():%d)", pkt, caller, line);
#endif
return;
}
if (!pkt->ref) {
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
const char *func_freed;
int line_freed;
@ -747,7 +770,7 @@ void net_pkt_unref(struct net_pkt *pkt)
return;
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
NET_DBG("%s [%d] pkt %p ref %d frags %p (%s():%d)",
slab2str(pkt->slab), k_mem_slab_num_free_get(pkt->slab),
pkt, pkt->ref - 1, pkt->frags, caller, line);
@ -760,7 +783,7 @@ void net_pkt_unref(struct net_pkt *pkt)
while (frag) {
NET_DBG("%s (%s) [%d] frag %p ref %d frags %p (%s():%d)",
pool2str(net_buf_pool_get(frag->pool_id)),
net_buf_pool_get(frag->pool_id)->name,
get_name(net_buf_pool_get(frag->pool_id)),
get_frees(net_buf_pool_get(frag->pool_id)), frag,
frag->ref - 1, frag->frags, caller, line);
@ -789,7 +812,7 @@ void net_pkt_unref(struct net_pkt *pkt)
net_pkt_alloc_del(pkt, caller, line);
done:
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
if (--pkt->ref > 0) {
return;
}
@ -801,19 +824,21 @@ done:
k_mem_slab_free(pkt->slab, (void **)&pkt);
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
struct net_pkt *net_pkt_ref_debug(struct net_pkt *pkt, const char *caller,
int line)
#else
struct net_pkt *net_pkt_ref(struct net_pkt *pkt)
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
{
if (!pkt) {
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
NET_ERR("*** ERROR *** pkt %p (%s():%d)", pkt, caller, line);
#endif
return NULL;
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
NET_DBG("%s [%d] pkt %p ref %d (%s():%d)",
slab2str(pkt->slab), k_mem_slab_num_free_get(pkt->slab),
pkt, pkt->ref + 1, caller, line);
@ -824,22 +849,24 @@ struct net_pkt *net_pkt_ref(struct net_pkt *pkt)
return pkt;
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
struct net_buf *net_pkt_frag_ref_debug(struct net_buf *frag,
const char *caller, int line)
#else
struct net_buf *net_pkt_frag_ref(struct net_buf *frag)
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
{
if (!frag) {
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
NET_ERR("*** ERROR *** frag %p (%s():%d)", frag, caller, line);
#endif
return NULL;
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
NET_DBG("%s (%s) [%d] frag %p ref %d (%s():%d)",
pool2str(net_buf_pool_get(frag->pool_id)),
net_buf_pool_get(frag->pool_id)->name,
get_name(net_buf_pool_get(frag->pool_id)),
get_frees(net_buf_pool_get(frag->pool_id)),
frag, frag->ref + 1, caller, line);
#endif
@ -848,22 +875,24 @@ struct net_buf *net_pkt_frag_ref(struct net_buf *frag)
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
void net_pkt_frag_unref_debug(struct net_buf *frag,
const char *caller, int line)
#else
void net_pkt_frag_unref(struct net_buf *frag)
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
{
if (!frag) {
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
NET_ERR("*** ERROR *** frag %p (%s():%d)", frag, caller, line);
#endif
return;
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
NET_DBG("%s (%s) [%d] frag %p ref %d (%s():%d)",
pool2str(net_buf_pool_get(frag->pool_id)),
net_buf_pool_get(frag->pool_id)->name,
get_name(net_buf_pool_get(frag->pool_id)),
get_frees(net_buf_pool_get(frag->pool_id)),
frag, frag->ref - 1, caller, line);
@ -874,7 +903,7 @@ void net_pkt_frag_unref(struct net_buf *frag)
net_buf_unref(frag);
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
struct net_buf *net_pkt_frag_del_debug(struct net_pkt *pkt,
struct net_buf *parent,
struct net_buf *frag,
@ -885,7 +914,7 @@ struct net_buf *net_pkt_frag_del(struct net_pkt *pkt,
struct net_buf *frag)
#endif
{
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
NET_DBG("pkt %p parent %p frag %p ref %u (%s:%d)",
pkt, parent, frag, frag->ref, caller, line);
@ -906,14 +935,16 @@ struct net_buf *net_pkt_frag_del(struct net_pkt *pkt,
return net_buf_frag_del(parent, frag);
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
void net_pkt_frag_add_debug(struct net_pkt *pkt, struct net_buf *frag,
const char *caller, int line)
#else
void net_pkt_frag_add(struct net_pkt *pkt, struct net_buf *frag)
#endif
{
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
NET_DBG("pkt %p frag %p (%s:%d)", pkt, frag, caller, line);
#endif
/* We do not use net_buf_frag_add() as this one will refcount
* the frag once more if !pkt->frags
@ -926,14 +957,16 @@ void net_pkt_frag_add(struct net_pkt *pkt, struct net_buf *frag)
net_buf_frag_insert(net_buf_frag_last(pkt->frags), frag);
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
void net_pkt_frag_insert_debug(struct net_pkt *pkt, struct net_buf *frag,
const char *caller, int line)
#else
void net_pkt_frag_insert(struct net_pkt *pkt, struct net_buf *frag)
#endif
{
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
NET_DBG("pkt %p frag %p (%s:%d)", pkt, frag, caller, line);
#endif
net_buf_frag_last(frag)->frags = pkt->frags;
pkt->frags = frag;
@ -1945,15 +1978,15 @@ int net_pkt_get_dst_addr(struct net_pkt *pkt, struct sockaddr *addr,
return net_pkt_get_addr(pkt, false, addr, addrlen);
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
void net_pkt_print(void)
{
NET_DBG("TX %u RX %u RDATA %d TDATA %d",
k_mem_slab_num_free_get(&tx_pkts),
k_mem_slab_num_free_get(&rx_pkts),
rx_bufs.avail_count, tx_bufs.avail_count);
get_frees(&rx_bufs), get_frees(&tx_bufs));
}
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
struct net_buf *net_frag_get_pos(struct net_pkt *pkt,
u16_t offset,
@ -1969,7 +2002,7 @@ struct net_buf *net_frag_get_pos(struct net_pkt *pkt,
return frag;
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
static void too_short_msg(char *msg, struct net_pkt *pkt, u16_t offset,
size_t extra_len)
{
@ -2163,6 +2196,7 @@ struct net_pkt *net_pkt_clone(struct net_pkt *pkt, s32_t timeout)
void net_pkt_init(void)
{
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
NET_DBG("Allocating %u RX (%zu bytes), %u TX (%zu bytes), "
"%d RX data (%u bytes) and %d TX data (%u bytes) buffers",
k_mem_slab_num_free_get(&rx_pkts),
@ -2171,6 +2205,7 @@ void net_pkt_init(void)
k_mem_slab_num_free_get(&tx_pkts),
(size_t)(k_mem_slab_num_free_get(&tx_pkts) *
sizeof(struct net_pkt)),
get_frees(&rx_bufs), rx_bufs.pool_size,
get_frees(&tx_bufs), tx_bufs.pool_size);
get_frees(&rx_bufs), get_size(&rx_bufs),
get_frees(&tx_bufs), get_size(&tx_bufs));
#endif
}

View file

@ -174,7 +174,6 @@ static inline u16_t net_calc_chksum_tcp(struct net_pkt *pkt)
return net_calc_chksum(pkt, IPPROTO_TCP);
}
#if NET_LOG_ENABLED > 0
static inline char *net_sprint_ll_addr(const u8_t *ll, u8_t ll_len)
{
static char buf[sizeof("xx:xx:xx:xx:xx:xx:xx:xx")];
@ -187,7 +186,7 @@ static inline void _hexdump(const u8_t *packet, size_t length, u8_t reserve)
char output[sizeof("xxxxyyyy xxxxyyyy")];
int n = 0, k = 0;
u8_t byte;
#if defined(CONFIG_SYS_LOG) && (SYS_LOG_LEVEL > SYS_LOG_LEVEL_OFF)
#if defined(CONFIG_LOG) && (NET_LOG_LEVEL >= LOG_LEVEL_DBG)
u8_t r = reserve;
#endif
@ -198,7 +197,7 @@ static inline void _hexdump(const u8_t *packet, size_t length, u8_t reserve)
byte = *packet++;
#if defined(CONFIG_SYS_LOG) && (SYS_LOG_LEVEL > SYS_LOG_LEVEL_OFF)
#if defined(CONFIG_LOG) && (NET_LOG_LEVEL >= LOG_LEVEL_DBG)
if (reserve) {
if (r) {
printk(SYS_LOG_COLOR_YELLOW);
@ -250,11 +249,11 @@ static inline void net_hexdump(const char *str,
const u8_t *packet, size_t length)
{
if (!length) {
SYS_LOG_DBG("%s zero-length packet", str);
LOG_DBG("%s zero-length packet", str);
return;
}
printk("%s\n", str);
LOG_DBG("%s", str);
_hexdump(packet, length, 0);
}
@ -308,20 +307,3 @@ static inline void net_print_frags(const char *str, struct net_pkt *pkt)
printk("\n");
}
#else /* NET_LOG_ENABLED */
static inline char *net_sprint_ll_addr(const u8_t *ll, u8_t ll_len)
{
ARG_UNUSED(ll);
ARG_UNUSED(ll_len);
return NULL;
}
#define net_hexdump(...)
#define net_hexdump_frags(...)
#define net_print_frags(...)
#endif /* NET_LOG_ENABLED */

View file

@ -10,6 +10,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_MODULE_NAME net_shell
#include <zephyr.h>
#include <stdlib.h>
#include <stdio.h>
@ -68,12 +70,6 @@
#include "net_shell.h"
#include "net_stats.h"
/*
* Set NET_LOG_ENABLED in order to activate address printing functions
* in net_private.h
*/
#define NET_LOG_ENABLED 1
#include "net_private.h"
#define NET_SHELL_MODULE "net"
@ -880,7 +876,7 @@ static void context_cb(struct net_context *context, void *user_data)
(*count)++;
}
#if defined(CONFIG_NET_DEBUG_CONN)
#if CONFIG_NET_CONN_LOG_LEVEL >= LOG_LEVEL_DBG
static void conn_handler_cb(struct net_conn *conn, void *user_data)
{
#if defined(CONFIG_NET_IPV6) && !defined(CONFIG_NET_IPV4)
@ -933,7 +929,7 @@ static void conn_handler_cb(struct net_conn *conn, void *user_data)
(*count)++;
}
#endif /* CONFIG_NET_DEBUG_CONN */
#endif /* CONFIG_NET_CONN_LOG_LEVEL >= LOG_LEVEL_DBG */
#if defined(CONFIG_NET_TCP)
static void tcp_cb(struct net_tcp *tcp, void *user_data)
@ -951,7 +947,7 @@ static void tcp_cb(struct net_tcp *tcp, void *user_data)
(*count)++;
}
#if defined(CONFIG_NET_DEBUG_TCP)
#if CONFIG_NET_TCP_LOG_LEVEL >= LOG_LEVEL_DBG
static void tcp_sent_list_cb(struct net_tcp *tcp, void *user_data)
{
int *printed = user_data;
@ -1000,7 +996,7 @@ static void tcp_sent_list_cb(struct net_tcp *tcp, void *user_data)
*printed = true;
}
#endif /* CONFIG_NET_DEBUG_TCP */
#endif /* CONFIG_NET_TCP_LOG_LEVEL >= LOG_LEVEL_DBG */
#endif
#if defined(CONFIG_NET_IPV6_FRAGMENT)
@ -1044,7 +1040,7 @@ static void ipv6_frag_cb(struct net_ipv6_reassembly *reass,
}
#endif /* CONFIG_NET_IPV6_FRAGMENT */
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
static void allocs_cb(struct net_pkt *pkt,
struct net_buf *buf,
const char *func_alloc,
@ -1098,7 +1094,7 @@ buf:
}
}
}
#endif /* CONFIG_NET_DEBUG_NET_PKT */
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
/* Put the actual shell commands after this */
@ -1107,18 +1103,18 @@ int net_shell_cmd_allocs(int argc, char *argv[])
ARG_UNUSED(argc);
ARG_UNUSED(argv);
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
printk("Network memory allocations\n\n");
printk("memory\t\tStatus\tPool\tFunction alloc -> freed\n");
net_pkt_allocs_foreach(allocs_cb, NULL);
#else
printk("Enable CONFIG_NET_DEBUG_NET_PKT to see allocations.\n");
#endif /* CONFIG_NET_DEBUG_NET_PKT */
printk("Set CONFIG_NET_PKT_LOG_LEVEL_DBG=y to see allocations.\n");
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
return 0;
}
#if defined(CONFIG_NET_DEBUG_APP) && \
#if (CONFIG_NET_LOG_LEVEL_APP >= LOG_LEVEL_DBG) && \
(defined(CONFIG_NET_APP_SERVER) || defined(CONFIG_NET_APP_CLIENT))
#if defined(CONFIG_NET_APP_TLS) || defined(CONFIG_NET_APP_DTLS)
@ -1314,8 +1310,6 @@ static void net_app_cb(struct net_app_ctx *ctx, void *user_data)
return;
}
#elif defined(CONFIG_NET_DEBUG_APP)
static void net_app_cb(struct net_app_ctx *ctx, void *user_data) {}
#endif
int net_shell_cmd_app(int argc, char *argv[])
@ -1323,7 +1317,7 @@ int net_shell_cmd_app(int argc, char *argv[])
ARG_UNUSED(argc);
ARG_UNUSED(argv);
#if defined(CONFIG_NET_DEBUG_APP)
#if CONFIG_NET_LOG_LEVEL_APP >= LOG_LEVEL_DBG
int i = 0;
if (IS_ENABLED(CONFIG_NET_APP_SERVER)) {
@ -1348,7 +1342,7 @@ int net_shell_cmd_app(int argc, char *argv[])
}
}
#else
printk("Enable CONFIG_NET_DEBUG_APP and either CONFIG_NET_APP_CLIENT "
printk("Enable CONFIG_NET_APP_LOG_LEVEL_DBG and either CONFIG_NET_APP_CLIENT "
"or CONFIG_NET_APP_SERVER to see client/server instance "
"information.\n");
#endif
@ -1421,7 +1415,7 @@ int net_shell_cmd_conn(int argc, char *argv[])
printk("No connections\n");
}
#if defined(CONFIG_NET_DEBUG_CONN)
#if CONFIG_NET_CONN_LOG_LEVEL >= LOG_LEVEL_DBG
printk("\n Handler Callback \tProto\t"
"Local \tRemote\n");
@ -1445,16 +1439,16 @@ int net_shell_cmd_conn(int argc, char *argv[])
if (count == 0) {
printk("No TCP connections\n");
} else {
#if defined(CONFIG_NET_DEBUG_TCP)
#if CONFIG_NET_TCP_LOG_LEVEL >= LOG_LEVEL_DBG
/* Print information about pending packets */
count = 0;
net_tcp_foreach(tcp_sent_list_cb, &count);
#endif /* CONFIG_NET_DEBUG_TCP */
#endif /* CONFIG_NET_TCP_LOG_LEVEL >= LOG_LEVEL_DBG */
}
#if !defined(CONFIG_NET_DEBUG_TCP)
printk("\nEnable CONFIG_NET_DEBUG_TCP for additional info\n");
#endif /* CONFIG_NET_DEBUG_TCP */
#if CONFIG_NET_TCP_LOG_LEVEL < LOG_LEVEL_DBG
printk("\nSet CONFIG_NET_TCP_LOG_LEVEL_DBG=y for additional info\n");
#endif /* CONFIG_NET_TCP_LOG_LEVEL < LOG_LEVEL_DBG */
#endif
@ -2565,6 +2559,26 @@ static bool slab_pool_found_already(struct ctx_info *info,
}
#endif
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
static s16_t get_frees(struct net_buf_pool *pool)
{
#if defined(CONFIG_NET_BUF_POOL_USAGE)
return pool->avail_count;
#else
return 0;
#endif
}
static const char *get_name(struct net_buf_pool *pool)
{
#if defined(CONFIG_NET_BUF_POOL_USAGE)
return pool->name;
#else
return "?";
#endif
}
#endif /* CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG */
static void context_info(struct net_context *context, void *user_data)
{
#if defined(CONFIG_NET_CONTEXT_NET_PKT_POOL)
@ -2583,7 +2597,7 @@ static void context_info(struct net_context *context, void *user_data)
return;
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
printk("%p\t%u\t%u\tETX\n",
slab, slab->num_blocks, k_mem_slab_num_free_get(slab));
#else
@ -2600,10 +2614,10 @@ static void context_info(struct net_context *context, void *user_data)
return;
}
#if defined(CONFIG_NET_DEBUG_NET_PKT)
#if CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG
printk("%p\t%d\t%d\tEDATA (%s)\n",
pool, pool->buf_count,
pool->avail_count, pool->name);
get_frees(pool), get_name(pool));
#else
printk("%p\t%d\tEDATA\n", pool, pool->buf_count);
#endif

View file

@ -4,10 +4,12 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_MODULE_NAME net_stats
#if defined(CONFIG_NET_STATISTICS_PERIODIC_OUTPUT)
#define SYS_LOG_DOMAIN "net/stats"
#define NET_SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
#define NET_LOG_ENABLED 1
#define NET_LOG_LEVEL LOG_LEVEL_INF
#else
#define NET_LOG_LEVEL CONFIG_NET_STATISTICS_LOG_LEVEL
#endif
#include <kernel.h>

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_TC)
#define SYS_LOG_DOMAIN "net/tc"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_tc
#define NET_LOG_LEVEL CONFIG_NET_TC_LOG_LEVEL
#include <zephyr.h>
#include <string.h>

View file

@ -12,10 +12,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_PROMISC)
#define SYS_LOG_DOMAIN "net/promisc"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_promisc
#define NET_LOG_LEVEL CONFIG_NET_PROMISC_LOG_LEVEL
#include <kernel.h>
#include <errno.h>

View file

@ -9,10 +9,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_ROUTE)
#define SYS_LOG_DOMAIN "net/route"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_route
#define NET_LOG_LEVEL CONFIG_NET_ROUTE_LOG_LEVEL
#include <kernel.h>
#include <limits.h>
@ -146,7 +144,6 @@ struct net_nbr *net_route_get_nbr(struct net_route_entry *route)
return NULL;
}
#if defined(CONFIG_NET_DEBUG_ROUTE)
void net_routes_print(void)
{
int i;
@ -158,11 +155,11 @@ void net_routes_print(void)
continue;
}
NET_DBG("[%d] %p %d addr %s/%d iface %p idx %d "
"ll %s",
NET_DBG("[%d] %p %d addr %s/%d",
i, nbr, nbr->ref,
net_sprint_ipv6_addr(&net_route_data(nbr)->addr),
net_route_data(nbr)->prefix_len,
net_route_data(nbr)->prefix_len);
NET_DBG(" iface %p idx %d ll %s",
nbr->iface, nbr->idx,
nbr->idx == NET_NBR_LLADDR_UNKNOWN ? "?" :
net_sprint_ll_addr(
@ -170,9 +167,6 @@ void net_routes_print(void)
net_nbr_get_lladdr(nbr->idx)->len));
}
}
#else
#define net_routes_print(...)
#endif /* CONFIG_NET_DEBUG_ROUTE */
static inline void nbr_free(struct net_nbr *nbr)
{
@ -236,9 +230,9 @@ static int nbr_nexthop_put(struct net_nbr *nbr)
return 0;
}
#if defined(CONFIG_NET_DEBUG_ROUTE)
#define net_route_info(str, route, dst) \
do { \
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) { \
struct in6_addr *naddr = net_route_get_nexthop(route); \
\
NET_ASSERT_INFO(naddr, "Unknown nexthop address"); \
@ -247,9 +241,6 @@ static int nbr_nexthop_put(struct net_nbr *nbr)
net_sprint_ipv6_addr(dst), \
net_sprint_ipv6_addr(naddr), route->iface); \
} while (0)
#else
#define net_route_info(...)
#endif /* CONFIG_NET_DEBUG_ROUTE */
/* Route was accessed, so place it in front of the routes list */
static inline void update_route_access(struct net_route_entry *route)
@ -359,8 +350,8 @@ struct net_route_entry *net_route_add(struct net_if *iface,
route = CONTAINER_OF(last,
struct net_route_entry,
node);
#if defined(CONFIG_NET_DEBUG_ROUTE)
do {
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) {
struct in6_addr *tmp;
struct net_linkaddr_storage *llstorage;
@ -376,8 +367,7 @@ struct net_route_entry *net_route_add(struct net_if *iface,
net_sprint_ll_addr(llstorage->addr,
llstorage->len));
}
} while (0);
#endif /* CONFIG_NET_DEBUG_ROUTE */
}
net_route_del(route);

View file

@ -38,10 +38,8 @@
* SUCH DAMAGE.
*/
#if defined(CONFIG_NET_DEBUG_RPL)
#define SYS_LOG_DOMAIN "net/rpl"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_rpl_mrhof
#define NET_LOG_LEVEL CONFIG_NET_RPL_LOG_LEVEL
#include <kernel.h>
#include <limits.h>

View file

@ -38,10 +38,8 @@
* SUCH DAMAGE.
*/
#if defined(CONFIG_NET_DEBUG_RPL)
#define SYS_LOG_DOMAIN "net/rpl"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_rpl_of0
#define NET_LOG_LEVEL CONFIG_NET_RPL_LOG_LEVEL
#include <kernel.h>
#include <limits.h>

View file

@ -38,10 +38,8 @@
* SUCH DAMAGE.
*/
#if defined(CONFIG_NET_DEBUG_RPL)
#define SYS_LOG_DOMAIN "net/rpl"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_rpl
#define NET_LOG_LEVEL CONFIG_NET_RPL_LOG_LEVEL
#include <kernel.h>
#include <limits.h>
@ -218,7 +216,6 @@ NET_NBR_POOL_INIT(net_rpl_neighbor_pool, CONFIG_NET_RPL_MAX_PARENTS,
NET_NBR_TABLE_INIT(NET_NBR_LOCAL, rpl_parents, net_rpl_neighbor_pool,
net_rpl_neighbor_table_clear);
#if defined(CONFIG_NET_DEBUG_RPL)
#define net_rpl_info(pkt, req) \
do { \
NET_DBG("Received %s from %s to %s", req, \
@ -239,11 +236,6 @@ NET_NBR_TABLE_INIT(NET_NBR_LOCAL, rpl_parents, net_rpl_neighbor_pool,
prf, net_sprint_ipv6_addr(src), out); \
} while (0)
#else /* CONFIG_NET_DEBUG_RPL */
#define net_rpl_info(...)
#define net_rpl_dao_info(...)
#endif /* CONFIG_NET_DEBUG_RPL */
static void new_dio_interval(struct net_rpl_instance *instance);
static inline struct net_nbr *get_nbr(int idx)
@ -356,7 +348,7 @@ int net_rpl_foreach_parent(net_rpl_parent_cb_t cb, void *user_data)
return ret;
}
#if defined(CONFIG_NET_DEBUG_RPL) && (CONFIG_SYS_LOG_NET_LEVEL > 3)
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG
static void net_rpl_print_parents(void)
{
struct net_rpl_parent *parent;
@ -405,7 +397,7 @@ static void net_rpl_print_parents(void)
}
#else
#define net_rpl_print_parents(...)
#endif /* CONFIG_NET_DEBUG_RPL */
#endif
struct net_route_entry *net_rpl_add_route(struct net_rpl_dag *dag,
struct net_if *iface,
@ -1498,9 +1490,7 @@ static void net_rpl_nullify_parent(struct net_if *iface,
struct net_rpl_parent *parent)
{
struct net_rpl_dag *dag = parent->dag;
#if defined(CONFIG_NET_DEBUG_RPL) && (CONFIG_SYS_LOG_NET_LEVEL > 3)
struct in6_addr *addr = net_rpl_get_parent_addr(iface, parent);
#endif
/* This function can be called when the preferred parent is NULL,
* so we need to handle this condition properly.
@ -1534,11 +1524,6 @@ static void net_rpl_remove_parent(struct net_if *iface,
struct net_rpl_parent *parent,
struct net_nbr *nbr)
{
#if defined(CONFIG_NET_DEBUG_RPL)
struct in6_addr *addr;
struct net_linkaddr_storage *lladdr;
#endif
NET_ASSERT(iface);
if (!nbr) {
@ -1548,13 +1533,16 @@ static void net_rpl_remove_parent(struct net_if *iface,
}
}
#if defined(CONFIG_NET_DEBUG_RPL)
addr = net_rpl_get_parent_addr(iface, parent);
lladdr = net_nbr_get_lladdr(nbr->idx);
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) {
struct in6_addr *addr;
struct net_linkaddr_storage *lladdr;
NET_DBG("Removing parent %s [%s]", net_sprint_ipv6_addr(addr),
net_sprint_ll_addr(lladdr->addr, lladdr->len));
#endif /* CONFIG_NET_DEBUG_RPL */
addr = net_rpl_get_parent_addr(iface, parent);
lladdr = net_nbr_get_lladdr(nbr->idx);
NET_DBG("Removing parent %s [%s]", net_sprint_ipv6_addr(addr),
net_sprint_ll_addr(lladdr->addr, lladdr->len));
}
net_rpl_nullify_parent(iface, parent);
nbr_free(nbr);
@ -2023,10 +2011,6 @@ static bool net_rpl_process_parent_event(struct net_if *iface,
{
bool ret = true;
#if defined(CONFIG_NET_DEBUG_RPL)
u16_t old_rank = instance->current_dag->rank;
#endif
if (!acceptable_rank(parent->dag, parent->rank)) {
/* The candidate parent is no longer valid: the rank increase
* resulting from the choice of it as a parent would be too
@ -2052,29 +2036,33 @@ static bool net_rpl_process_parent_event(struct net_if *iface,
return false;
}
#if defined(CONFIG_NET_DEBUG_RPL)
if (NET_RPL_DAG_RANK(old_rank, instance) !=
NET_RPL_DAG_RANK(instance->current_dag->rank, instance)) {
NET_DBG("Moving in the instance from rank %u to %u",
NET_RPL_DAG_RANK(old_rank, instance),
NET_RPL_DAG_RANK(instance->current_dag->rank,
instance));
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) {
u16_t old_rank = instance->current_dag->rank;
if (instance->current_dag->rank != NET_RPL_INFINITE_RANK) {
NET_DBG("The preferred parent is %s (rank %u)",
net_sprint_ipv6_addr(
net_rpl_get_parent_addr(iface,
instance->current_dag->
preferred_parent)),
NET_RPL_DAG_RANK(instance->current_dag->
preferred_parent->rank,
if (NET_RPL_DAG_RANK(old_rank, instance) !=
NET_RPL_DAG_RANK(instance->current_dag->rank, instance)) {
NET_DBG("Moving in the instance from rank %u to %u",
NET_RPL_DAG_RANK(old_rank, instance),
NET_RPL_DAG_RANK(instance->current_dag->rank,
instance));
} else {
NET_DBG("We don't have any parent");
if (instance->current_dag->rank !=
NET_RPL_INFINITE_RANK) {
NET_DBG("The preferred parent is %s (rank %u)",
net_sprint_ipv6_addr(
net_rpl_get_parent_addr(iface,
instance->current_dag->
preferred_parent)),
NET_RPL_DAG_RANK(
instance->current_dag->
preferred_parent->rank,
instance));
} else {
NET_DBG("We don't have any parent");
}
}
}
#endif /* CONFIG_NET_DEBUG_RPL */
return ret;
}
@ -3531,7 +3519,7 @@ static enum net_verdict handle_dao(struct net_pkt *pkt)
if (dag->preferred_parent) {
r = forwarding_dao(instance, dag,
pkt, sequence, flags,
#if defined(CONFIG_NET_DEBUG_RPL)
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG
"Forwarding no-path DAO to "
"parent"
#else

View file

@ -13,10 +13,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_TCP)
#define SYS_LOG_DOMAIN "net/tcp"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_tcp
#define NET_LOG_LEVEL CONFIG_NET_TCP_LOG_LEVEL
#include <kernel.h>
#include <string.h>
@ -102,7 +100,6 @@ struct tcp_segment {
const struct sockaddr *dst_addr;
};
#if defined(CONFIG_NET_DEBUG_TCP) && (CONFIG_SYS_LOG_NET_LEVEL > 2)
static char upper_if_set(char chr, bool set)
{
if (set) {
@ -118,6 +115,10 @@ static void net_tcp_trace(struct net_pkt *pkt, struct net_tcp *tcp)
u32_t rel_ack, ack;
u8_t flags;
if (NET_LOG_LEVEL < LOG_LEVEL_DBG) {
return;
}
tcp_hdr = net_tcp_get_hdr(pkt, &hdr);
if (!tcp_hdr) {
return;
@ -152,9 +153,6 @@ static void net_tcp_trace(struct net_pkt *pkt, struct net_tcp *tcp)
sys_get_be16(tcp_hdr->wnd),
ntohs(tcp_hdr->chksum));
}
#else
#define net_tcp_trace(...)
#endif /* CONFIG_NET_DEBUG_TCP */
static inline u32_t retry_timeout(const struct net_tcp *tcp)
{
@ -773,7 +771,7 @@ int net_tcp_prepare_reset(struct net_tcp *tcp,
const char *net_tcp_state_str(enum net_tcp_state state)
{
#if defined(CONFIG_NET_DEBUG_TCP) || defined(CONFIG_NET_SHELL)
#if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) || defined(CONFIG_NET_SHELL)
switch (state) {
case NET_TCP_CLOSED:
return "CLOSED";
@ -798,9 +796,9 @@ const char *net_tcp_state_str(enum net_tcp_state state)
case NET_TCP_CLOSING:
return "CLOSING";
}
#else /* CONFIG_NET_DEBUG_TCP */
#else
ARG_UNUSED(state);
#endif /* CONFIG_NET_DEBUG_TCP */
#endif
return "";
}
@ -1111,7 +1109,7 @@ void net_tcp_init(void)
{
}
#if defined(CONFIG_NET_DEBUG_TCP)
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG
static void validate_state_transition(enum net_tcp_state current,
enum net_tcp_state new)
{
@ -1151,7 +1149,14 @@ static void validate_state_transition(enum net_tcp_state current,
net_tcp_state_str(new), new);
}
}
#endif /* CONFIG_NET_DEBUG_TCP */
#else
static inline void validate_state_transition(enum net_tcp_state current,
enum net_tcp_state new)
{
ARG_UNUSED(current);
ARG_UNUSED(new);
}
#endif
void net_tcp_change_state(struct net_tcp *tcp,
enum net_tcp_state new_state)
@ -1169,9 +1174,7 @@ void net_tcp_change_state(struct net_tcp *tcp,
tcp, net_tcp_state_str(tcp->state), tcp->state,
net_tcp_state_str(new_state), new_state);
#if defined(CONFIG_NET_DEBUG_TCP)
validate_state_transition(tcp->state, new_state);
#endif /* CONFIG_NET_DEBUG_TCP */
tcp->state = new_state;
@ -1271,7 +1274,7 @@ struct net_tcp_hdr *net_tcp_get_hdr(struct net_pkt *pkt,
/* If the pkt is compressed, then this is the typical outcome
* so no use printing error in this case.
*/
if (IS_ENABLED(CONFIG_NET_DEBUG_TCP) &&
if ((NET_LOG_LEVEL >= LOG_LEVEL_DBG) &&
!is_6lo_technology(pkt)) {
NET_ASSERT(frag);
}
@ -1817,9 +1820,8 @@ int net_tcp_unref(struct net_context *context)
/** **/
#if defined(CONFIG_NET_DEBUG_CONTEXT)
#define net_tcp_print_recv_info(str, pkt, port) \
do { \
if (IS_ENABLED(CONFIG_NET_TCP_LOG_LEVEL_DBG)) { \
if (net_context_get_family(context) == AF_INET6) { \
NET_DBG("%s received from %s port %d", str, \
net_sprint_ipv6_addr(&NET_IPV6_HDR(pkt)->src),\
@ -1829,10 +1831,10 @@ int net_tcp_unref(struct net_context *context)
net_sprint_ipv4_addr(&NET_IPV4_HDR(pkt)->src),\
ntohs(port)); \
} \
} while (0)
}
#define net_tcp_print_send_info(str, pkt, port) \
do { \
if (IS_ENABLED(CONFIG_NET_TCP_LOG_LEVEL_DBG)) { \
struct net_context *ctx = net_pkt_context(pkt); \
if (net_context_get_family(ctx) == AF_INET6) { \
NET_DBG("%s sent to %s port %d", str, \
@ -1843,16 +1845,11 @@ int net_tcp_unref(struct net_context *context)
net_sprint_ipv4_addr(&NET_IPV4_HDR(pkt)->dst),\
ntohs(port)); \
} \
} while (0)
#else
#define net_tcp_print_recv_info(...)
#define net_tcp_print_send_info(...)
#endif /* CONFIG_NET_DEBUG_CONTEXT */
}
static void print_send_info(struct net_pkt *pkt, const char *msg)
{
if (IS_ENABLED(CONFIG_NET_DEBUG_CONTEXT)) {
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) {
struct net_tcp_hdr hdr, *tcp_hdr;
tcp_hdr = net_tcp_get_hdr(pkt, &hdr);

View file

@ -10,10 +10,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_TRICKLE)
#define SYS_LOG_DOMAIN "net/trickle"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_trickle
#define NET_LOG_LEVEL CONFIG_NET_TRICKLE_LOG_LEVEL
#include <errno.h>
#include <misc/util.h>
@ -55,10 +53,7 @@ static void double_interval_timeout(struct k_work *work)
struct net_trickle,
timer);
u32_t rand_time;
#if defined(CONFIG_NET_DEBUG_TRICKLE) && (CONFIG_SYS_LOG_NET_LEVEL > 2)
u32_t last_end = get_end(trickle);
#endif
trickle->c = 0;

View file

@ -8,10 +8,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_UDP)
#define SYS_LOG_DOMAIN "net/udp"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_udp
#define NET_LOG_LEVEL CONFIG_NET_UDP_LOG_LEVEL
#include "net_private.h"
#include "udp_internal.h"

View file

@ -9,10 +9,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_UTILS)
#define SYS_LOG_DOMAIN "net/utils"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_utils
#define NET_LOG_LEVEL CONFIG_NET_UTILS_LOG_LEVEL
#include <stdlib.h>
#include <zephyr/types.h>

View file

@ -48,13 +48,13 @@ config NET_L2_BT_SEC_LEVEL
Level 3 (BT_SECURITY_HIGH) = Encryption and authentication required
Level 4 (BT_SECURITY_FIPS) = Secure connection required
config NET_DEBUG_L2_BT
bool "Debug Bluetooth L2 layer"
default y if NET_LOG_GLOBAL
depends on NET_LOG
depends on NET_L2_BT
help
Enables Bluetooth L2 output debug messages
if NET_L2_BT
module = NET_L2_BT
module-dep = NET_LOG
module-str = Log level for Bluetooth L2 layer
module-help = Enables Bluetooth L2 to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
endif
config NET_L2_BT_MGMT
bool "Enable Bluetooth Network Management support"
@ -84,12 +84,13 @@ config NET_L2_WIFI_MGMT
help
Add support for WiFi Management interface.
config NET_DEBUG_L2_WIFI_MGMT
bool "Debug WiFi Management layer"
default y if NET_LOG_GLOBAL
depends on NET_LOG && NET_L2_WIFI_MGMT
help
Enables WiFi management interface to output debug messages
if NET_L2_WIFI_MGMT
module = NET_L2_WIFI_MGMT
module-dep = NET_LOG
module-str = Log level for WiFi management layer
module-help = Enables WiFi management interface to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
endif # NET_L2_WIFI_MGMT
config NET_L2_WIFI_SHELL
bool "Enable WiFi shell module"

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_L2_BT)
#define SYS_LOG_DOMAIN "net/bt"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_bt
#define NET_LOG_LEVEL CONFIG_NET_L2_BT_LOG_LEVEL
#include <kernel.h>
#include <toolchain.h>
@ -122,24 +120,22 @@ static void ipsp_connected(struct bt_l2cap_chan *chan)
struct net_linkaddr ll;
struct in6_addr in6;
#if defined(CONFIG_NET_DEBUG_L2_BT)
char src[BT_ADDR_LE_STR_LEN];
char dst[BT_ADDR_LE_STR_LEN];
#endif
if (bt_conn_get_info(chan->conn, &info) < 0) {
NET_ERR("Unable to get connection info");
bt_l2cap_chan_disconnect(chan);
return;
}
#if defined(CONFIG_NET_DEBUG_L2_BT)
bt_addr_le_to_str(info.le.src, src, sizeof(src));
bt_addr_le_to_str(info.le.dst, dst, sizeof(dst));
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) {
char src[BT_ADDR_LE_STR_LEN];
char dst[BT_ADDR_LE_STR_LEN];
NET_DBG("Channel %p Source %s connected to Destination %s", chan,
src, dst);
#endif
bt_addr_le_to_str(info.le.src, src, sizeof(src));
bt_addr_le_to_str(info.le.dst, dst, sizeof(dst));
NET_DBG("Channel %p Source %s connected to Destination %s",
chan, src, dst);
}
/* Swap bytes since net APIs expect big endian address */
sys_memcpy_swap(ctxt->src.val, info.le.src->a.val, sizeof(ctxt->src));
@ -364,10 +360,7 @@ static bool eir_found(u8_t type, const u8_t *data, u8_t data_len,
void *user_data)
{
int i;
#if defined(CONFIG_NET_DEBUG_L2_BT)
bt_addr_le_t *addr = user_data;
char dev[BT_ADDR_LE_STR_LEN];
#endif
if (type != BT_DATA_UUID16_SOME && type != BT_DATA_UUID16_ALL) {
return false;
}
@ -387,10 +380,13 @@ static bool eir_found(u8_t type, const u8_t *data, u8_t data_len,
continue;
}
#if defined(CONFIG_NET_DEBUG_L2_BT)
bt_addr_le_to_str(addr, dev, sizeof(dev));
NET_DBG("[DEVICE]: %s", dev);
#endif
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) {
bt_addr_le_t *addr = user_data;
char dev[BT_ADDR_LE_STR_LEN];
bt_addr_le_to_str(addr, dev, sizeof(dev));
NET_DBG("[DEVICE]: %s", dev);
}
/* TODO: Notify device address found */
net_mgmt_event_notify(NET_EVENT_BT_SCAN_RESULT,
@ -510,13 +506,15 @@ static int bt_disconnect(u32_t mgmt_request, struct net_if *iface,
static void connected(struct bt_conn *conn, u8_t err)
{
if (err) {
#if defined(CONFIG_NET_DEBUG_L2_BT)
char addr[BT_ADDR_LE_STR_LEN];
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) {
char addr[BT_ADDR_LE_STR_LEN];
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
bt_addr_le_to_str(bt_conn_get_dst(conn), addr,
sizeof(addr));
NET_ERR("Failed to connect to %s (%u)\n", addr, err);
}
NET_ERR("Failed to connect to %s (%u)\n", addr, err);
#endif
return;
}
@ -530,19 +528,16 @@ static void connected(struct bt_conn *conn, u8_t err)
static void disconnected(struct bt_conn *conn, u8_t reason)
{
#if defined(CONFIG_NET_DEBUG_L2_BT)
char addr[BT_ADDR_LE_STR_LEN];
#endif
if (conn != default_conn) {
return;
}
#if defined(CONFIG_NET_DEBUG_L2_BT)
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) {
char addr[BT_ADDR_LE_STR_LEN];
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
NET_DBG("Disconnected: %s (reason %u)\n", addr, reason);
#endif
NET_DBG("Disconnected: %s (reason %u)\n", addr, reason);
}
bt_conn_unref(default_conn);
default_conn = NULL;

View file

@ -4,6 +4,9 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_MODULE_NAME net_bt_shell
#define NET_LOG_LEVEL LOG_LEVEL_DBG
#include <kernel.h>
#include <toolchain.h>
#include <linker/sections.h>

View file

@ -4,6 +4,9 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_MODULE_NAME net_l2_dummy
#define NET_LOG_LEVEL LOG_LEVEL_NONE
#include <net/net_core.h>
#include <net/net_l2.h>
#include <net/net_if.h>

View file

@ -13,12 +13,11 @@ menuconfig NET_L2_ETHERNET
if NET_L2_ETHERNET
config NET_DEBUG_L2_ETHERNET
bool "Debug Ethernet L2 layer"
default y if NET_LOG_GLOBAL
depends on NET_LOG
help
Enables Ethernet L2 output debug messages
module = NET_L2_ETHERNET
module-dep = NET_LOG
module-str = Log level for Ethernet L2 layer
module-help = Enables Ethernet L2 to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
config NET_L2_ETHERNET_MGMT
bool "Enable Ethernet network management interface"
@ -55,12 +54,13 @@ config NET_ARP_TABLE_SIZE
help
Each entry in the ARP table consumes 22 bytes of memory.
config NET_DEBUG_ARP
bool "Debug IPv4 ARP"
depends on NET_ARP && NET_LOG
default y if NET_LOG_GLOBAL
help
Enables core ARP code part to output debug messages
if NET_ARP
module = NET_ARP
module-dep = NET_LOG
module-str = Log level for IPv4 ARP
module-help = Enables core ARP code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
endif # NET_ARP
source "subsys/net/l2/ethernet/gptp/Kconfig"
source "subsys/net/l2/ethernet/lldp/Kconfig"

View file

@ -8,10 +8,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_ARP)
#define SYS_LOG_DOMAIN "net/arp"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_arp
#define NET_LOG_LEVEL CONFIG_NET_ARP_LOG_LEVEL
#include <errno.h>
#include <net/net_core.h>

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_L2_ETHERNET)
#define SYS_LOG_DOMAIN "net/ethernet"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_ethernet
#define NET_LOG_LEVEL CONFIG_NET_L2_ETHERNET_LOG_LEVEL
#include <net/net_core.h>
#include <net/net_l2.h>
@ -50,9 +48,8 @@ void net_eth_ipv6_mcast_to_mac_addr(const struct in6_addr *ipv6_addr,
memcpy(mac_addr->addr + 2, &ipv6_addr->s6_addr[12], 4);
}
#if defined(CONFIG_NET_DEBUG_L2_ETHERNET)
#define print_ll_addrs(pkt, type, len, src, dst) \
do { \
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) { \
char out[sizeof("xx:xx:xx:xx:xx:xx")]; \
\
snprintk(out, sizeof(out), "%s", \
@ -64,10 +61,10 @@ void net_eth_ipv6_mcast_to_mac_addr(const struct in6_addr *ipv6_addr,
net_sprint_ll_addr((dst)->addr, \
sizeof(struct net_eth_addr)), \
type, (size_t)len); \
} while (0)
}
#define print_vlan_ll_addrs(pkt, type, tci, len, src, dst) \
do { \
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) { \
char out[sizeof("xx:xx:xx:xx:xx:xx")]; \
\
snprintk(out, sizeof(out), "%s", \
@ -81,11 +78,7 @@ void net_eth_ipv6_mcast_to_mac_addr(const struct in6_addr *ipv6_addr,
sizeof(struct net_eth_addr)), \
type, net_eth_vlan_get_vid(tci), \
net_eth_vlan_get_pcp(tci), (size_t)len); \
} while (0)
#else
#define print_ll_addrs(...)
#define print_vlan_ll_addrs(...)
#endif /* CONFIG_NET_DEBUG_L2_ETHERNET */
}
static inline void ethernet_update_length(struct net_if *iface,
struct net_pkt *pkt)

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_L2_ETHERNET)
#define SYS_LOG_DOMAIN "net/ethernet"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_ethernet_mgmt
#define NET_LOG_LEVEL CONFIG_NET_L2_ETHERNET_LOG_LEVEL
#include <errno.h>

View file

@ -4,6 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_MODULE_NAME net_ethernet_stats
#include <kernel.h>
#include <string.h>
#include <errno.h>

View file

@ -15,11 +15,11 @@ menuconfig NET_GPTP
if NET_GPTP
config NET_DEBUG_GPTP
bool "Enable Debug Information for gPTP"
depends on NET_LOG
help
Enable logs for the gPTP stack.
module = NET_GPTP
module-dep = NET_LOG
module-str = Log level for gPTP
module-help = Enable logs for the gPTP stack.
source "subsys/net/Kconfig.template.log_config.net"
config NET_GPTP_GM_CAPABLE
bool "Enable IEEE 802.1AS GrandMaster Capability"

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_GPTP)
#define SYS_LOG_DOMAIN "net/gptp"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_gptp
#define NET_LOG_LEVEL CONFIG_NET_GPTP_LOG_LEVEL
#include <net/net_pkt.h>
#include <ptp_clock.h>

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_GPTP)
#define SYS_LOG_DOMAIN "net/gptp"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_gptp_md
#define NET_LOG_LEVEL CONFIG_NET_GPTP_LOG_LEVEL
#include "gptp_messages.h"
#include "gptp_md.h"

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_GPTP)
#define SYS_LOG_DOMAIN "net/gptp"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_gptp_msg
#define NET_LOG_LEVEL CONFIG_NET_GPTP_LOG_LEVEL
#include <net/net_if.h>
@ -26,12 +24,10 @@ static bool ts_cb_registered;
static const struct net_eth_addr gptp_multicast_eth_addr = {
{ 0x01, 0x80, 0xc2, 0x00, 0x00, 0x0e } };
#define NET_GPTP_INFO(msg, pkt) do { \
if (IS_ENABLED(NET_LOG_ENABLED)) { \
#define NET_GPTP_INFO(msg, pkt) \
if (NET_LOG_LEVEL >= LOG_LEVEL_DBG) { \
struct gptp_hdr *hdr = GPTP_HDR(pkt); \
\
ARG_UNUSED(hdr); \
\
if (hdr->message_type == GPTP_ANNOUNCE_MESSAGE) { \
struct gptp_announce *ann = GPTP_ANNOUNCE(pkt); \
char output[sizeof("xx:xx:xx:xx:xx:xx:xx:xx")]; \
@ -52,8 +48,7 @@ static const struct net_eth_addr gptp_multicast_eth_addr = {
NET_DBG("Sending %s seq %d pkt %p", msg, \
ntohs(hdr->sequence_id), pkt); \
} \
} \
} while (0)
}
static void gptp_sync_timestamp_callback(struct net_pkt *pkt)
{

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_GPTP)
#define SYS_LOG_DOMAIN "net/gptp"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_gptp_mi
#define NET_LOG_LEVEL CONFIG_NET_GPTP_LOG_LEVEL
#include <ptp_clock.h>
@ -16,8 +14,6 @@
#include "gptp_state.h"
#include "gptp_private.h"
#if defined(CONFIG_NET_DEBUG_GPTP) && \
(CONFIG_SYS_LOG_NET_LEVEL > SYS_LOG_LEVEL_INFO)
static const char * const state2str(enum gptp_port_state state)
{
switch (state) {
@ -43,7 +39,6 @@ static const char * const state2str(enum gptp_port_state state)
return "<unknown>";
}
#endif
void gptp_change_port_state(int port, enum gptp_port_state state)
{

View file

@ -4,9 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_GPTP)
#define SYS_LOG_DOMAIN "net/gptp"
#endif
#define LOG_MODULE_NAME net_gptp_api
#define NET_LOG_LEVEL CONFIG_NET_GPTP_LOG_LEVEL
#include <ptp_clock.h>
#include <net/gptp.h>

View file

@ -18,12 +18,11 @@ config NET_LLDP
if NET_LLDP
config NET_DEBUG_LLDP
bool "Debug LLDP"
depends on NET_LOG
default n
help
Enables core LLDP code part to output debug messages.
module = NET_LLDP
module-dep = NET_LOG
module-str = Log level for LLDP
module-help = Enables core LLDP code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
#
# LLDP Tx state machine config

View file

@ -8,10 +8,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_LLDP)
#define SYS_LOG_DOMAIN "net/lldp"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_lldp
#define NET_LOG_LEVEL CONFIG_NET_LLDP_LOG_LEVEL
#include <errno.h>
#include <stdlib.h>

View file

@ -23,13 +23,11 @@ config NET_L2_IEEE802154_SUB_GHZ
logic in L2 code for channel management. This option is automatically
selected when relevant device driver is enabled.
config NET_DEBUG_L2_IEEE802154
bool "Enable IEEE 802.15.4 stack debug messages"
default y if NET_LOG_GLOBAL
depends on NET_LOG
help
Enable it if you want to see what's happening. Only useful
for developers.
module = NET_L2_IEEE802154
module-dep = NET_LOG
module-str = Log level for IEEE 802.15.4
module-help = Enables IEEE 802.15.4 code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
config NET_DEBUG_L2_IEEE802154_DISPLAY_PACKET
bool "Enable IEEE 802.15.4 packet display"
@ -124,7 +122,7 @@ config NET_L2_IEEE802154_REASSEMBLY_TIMEOUT
config NET_DEBUG_L2_IEEE802154_FRAGMENT
bool "Enable debug support for IEEE 802.15.4 fragmentation"
depends on NET_L2_IEEE802154_FRAGMENT && NET_LOG
default y if NET_LOG_GLOBAL
default y if NET_L2_IEEE802154_LOG_LEVEL_DBG
config NET_L2_IEEE802154_SECURITY
bool "Enable IEEE 802.15.4 security [EXPERIMENTAL]"

View file

@ -4,11 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_L2_IEEE802154) || \
defined(CONFIG_NET_DEBUG_L2_IEEE802154_DISPLAY_PACKET)
#define SYS_LOG_DOMAIN "net/ieee802154"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_ieee802154
#define NET_LOG_LEVEL CONFIG_NET_L2_IEEE802154_LOG_LEVEL
#include <net/net_core.h>
#include <net/net_l2.h>
@ -58,10 +55,6 @@ static inline void pkt_hexdump(const char *title, struct net_pkt *pkt,
}
}
#ifndef CONFIG_NET_DEBUG_L2_IEEE802154
#undef NET_LOG_ENABLED
#endif /* CONFIG_NET_DEBUG_L2_IEEE802154 */
#else
#define pkt_hexdump(...)
#endif /* CONFIG_NET_DEBUG_L2_IEEE802154_DISPLAY_PACKET */

View file

@ -8,10 +8,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_L2_IEEE802154_FRAGMENT)
#define SYS_LOG_DOMAIN "net/ieee802154"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_ieee802154_fragment
#define NET_LOG_LEVEL CONFIG_NET_L2_IEEE802154_LOG_LEVEL
#include <errno.h>
#include <net/net_core.h>

View file

@ -4,9 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_L2_IEEE802154)
#define SYS_LOG_DOMAIN "net/ieee802154"
#define NET_LOG_ENABLED 1
#define LOG_MODULE_NAME net_ieee802154_frame
#define NET_LOG_LEVEL CONFIG_NET_L2_IEEE802154_LOG_LEVEL
#define dbg_print_fs(fs) \
NET_DBG("fs: %u/%u/%u/%u/%u/%u/%u/%u/%u/%u/%u - %u", \

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_L2_IEEE802154)
#define SYS_LOG_DOMAIN "net/ieee802154"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_ieee802154_mgmt
#define NET_LOG_LEVEL CONFIG_NET_L2_IEEE802154_LOG_LEVEL
#include <net/net_core.h>

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_L2_IEEE802154)
#define SYS_LOG_DOMAIN "net/ieee802154"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_ieee802154_aloha
#define NET_LOG_LEVEL CONFIG_NET_L2_IEEE802154_LOG_LEVEL
#include <net/net_core.h>
#include <net/net_if.h>

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_L2_IEEE802154)
#define SYS_LOG_DOMAIN "net/ieee802154"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_ieee802154_csma
#define NET_LOG_LEVEL CONFIG_NET_L2_IEEE802154_LOG_LEVEL
#include <net/net_core.h>
#include <net/net_if.h>

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_L2_IEEE802154)
#define SYS_LOG_DOMAIN "net/ieee802154"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_ieee802154_security
#define NET_LOG_LEVEL CONFIG_NET_L2_IEEE802154_LOG_LEVEL
#include <crypto/cipher.h>
#include <net/net_core.h>

View file

@ -8,6 +8,9 @@
* @brief IEEE 802.15.4 shell module
*/
#define LOG_MODULE_NAME net_ieee802154_shell
#define NET_LOG_LEVEL CONFIG_NET_L2_IEEE802154_LOG_LEVEL
#include <zephyr.h>
#include <stdio.h>
#include <stdlib.h>

View file

@ -4,12 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define NET_SYS_LOG_LEVEL CONFIG_OPENTHREAD_L2_LOG_LEVEL
#if defined(CONFIG_OPENTHREAD_L2_DEBUG)
#define NET_DOMAIN "net/openthread_l2"
#define NET_LOG_ENABLED 1
#endif
#define NET_LOG_LEVEL CONFIG_OPENTHREAD_L2_LOG_LEVEL
#define LOG_MODULE_NAME net_l2_openthread
#include <net/net_core.h>
#include <net/net_pkt.h>

View file

@ -4,12 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define NET_SYS_LOG_LEVEL CONFIG_OPENTHREAD_L2_LOG_LEVEL
#if defined(CONFIG_OPENTHREAD_L2_DEBUG)
#define NET_DOMAIN "net/openthread_l2"
#define NET_LOG_ENABLED 1
#endif
#define NET_LOG_LEVEL CONFIG_OPENTHREAD_L2_LOG_LEVEL
#define LOG_MODULE_NAME net_l2_openthread_utils
#include <net/net_core.h>
#include <net/net_pkt.h>

View file

@ -4,10 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(CONFIG_NET_DEBUG_L2_WIFI_MGMT)
#define SYS_LOG_DOMAIN "net/wifi_mgmt"
#define NET_LOG_ENABLED 1
#endif
#define LOG_MODULE_NAME net_wifi_mgmt
#define NET_LOG_LEVEL CONFIG_NET_L2_WIFI_MGMT_LOG_LEVEL
#include <errno.h>