net: buf: Print pool name if available

In case CONFIG_NET_BUF_POOL_USAGE is defined use print pool->name
instead of the pointer.

Change-Id: I0be5fd8283a887145e61bdad02f721265453ce20
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2017-04-10 16:34:45 +03:00 committed by Jukka Rissanen
commit 9c0ea2b90b

View file

@ -115,12 +115,23 @@ struct net_buf *net_buf_alloc(struct net_buf_pool *pool, int32_t timeout)
uint32_t ref = k_uptime_get_32(); uint32_t ref = k_uptime_get_32();
buf = k_lifo_get(&pool->free, K_NO_WAIT); buf = k_lifo_get(&pool->free, K_NO_WAIT);
while (!buf) { while (!buf) {
#if defined(CONFIG_NET_BUF_POOL_USAGE)
NET_BUF_WARN("%s():%d: Pool %s low on buffers.",
func, line, pool->name);
#else
NET_BUF_WARN("%s():%d: Pool %p low on buffers.", NET_BUF_WARN("%s():%d: Pool %p low on buffers.",
func, line, pool); func, line, pool);
#endif
buf = k_lifo_get(&pool->free, WARN_ALLOC_INTERVAL); buf = k_lifo_get(&pool->free, WARN_ALLOC_INTERVAL);
NET_BUF_WARN("%s():%d: blocked for %u secs", #if defined(CONFIG_NET_BUF_POOL_USAGE)
func, line, NET_BUF_WARN("%s():%d: Pool %s blocked for %u secs",
func, line, pool->name,
(k_uptime_get_32() - ref) / MSEC_PER_SEC); (k_uptime_get_32() - ref) / MSEC_PER_SEC);
#else
NET_BUF_WARN("%s():%d: Pool %p blocked for %u secs",
func, line, pool,
(k_uptime_get_32() - ref) / MSEC_PER_SEC);
#endif
} }
} else { } else {
buf = k_lifo_get(&pool->free, timeout); buf = k_lifo_get(&pool->free, timeout);