net: Refactor debug printing in net_if

There is now Kconfig option to enable net_if debugging.
Also use NET_DBG() instead of directly calling syslog macros
so that we can print fiber id automatically.

Change-Id: I150d363006e4be358c38308a93771ba444b0835e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2016-05-09 15:43:06 +03:00
commit 9ad626e8f7

View file

@ -14,11 +14,18 @@
* limitations under the License.
*/
#if defined(CONFIG_NETWORK_IP_STACK_DEBUG_IF)
#define SYS_LOG_DOMAIN "net/if"
#define NET_DEBUG 1
#endif
#include <init.h>
#include <nanokernel.h>
#include <sections.h>
#include <string.h>
#include <misc/sys_log.h>
#include <net/net_if.h>
#include <net/net_core.h>
/* net_if dedicated section limiters */
extern struct net_if __net_if_start[];
@ -32,8 +39,7 @@ static char __noinit __stack tx_fiber_stack[CONFIG_NET_TX_STACK_SIZE];
static void net_if_tx_fiber(struct net_if *iface)
{
SYS_LOG_DBG("Starting TX fiber (stack %d bytes)\n",
sizeof(tx_fiber_stack));
NET_DBG("Starting TX fiber (stack %d bytes)", sizeof(tx_fiber_stack));
while (1) {
struct net_buf *buf;
@ -41,7 +47,7 @@ static void net_if_tx_fiber(struct net_if *iface)
/* Get next packet from application - wait if necessary */
buf = nano_fifo_get(&iface->tx_queue, TICKS_UNLIMITED);
SYS_LOG_DBG("Processing (buf %p, len %u) network packet\n",
NET_DBG("Processing (buf %p, len %u) network packet",
buf, buf->len);
/* FIXME - Do something with the packet */