Skip to content

Commit db6d1d1

Browse files
committed
net: ip: Fix the warning in the data path
Instead of warning for every-packet, warn only once and let user debug the underlying cause. Fix #49845 partially. Signed-off-by: Chaitanya Tata <[email protected]>
1 parent 72dc0e5 commit db6d1d1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

include/zephyr/net/net_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ extern "C" {
5959
#endif /* CONFIG_THREAD_NAME */
6060
#define NET_ERR(fmt, ...) LOG_ERR(fmt, ##__VA_ARGS__)
6161
#define NET_WARN(fmt, ...) LOG_WRN(fmt, ##__VA_ARGS__)
62+
#define NET_WARN_ONCE(fmt, ...) LOG_WRN_ONCE(fmt, ##__VA_ARGS__)
6263
#define NET_INFO(fmt, ...) LOG_INF(fmt, ##__VA_ARGS__)
6364

6465
#define NET_HEXDUMP_DBG(_data, _length, _str) LOG_HEXDUMP_DBG(_data, _length, _str)

subsys/net/ip/net_if.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ static bool net_if_tx(struct net_if *iface, struct net_pkt *pkt)
262262
status = net_if_l2(iface)->send(iface, pkt);
263263
net_if_tx_unlock(iface);
264264
if (status < 0) {
265-
NET_WARN("iface %d pkt %p send failure status %d",
266-
net_if_get_by_iface(iface), pkt, status);
265+
NET_WARN_ONCE("iface %d pkt %p send failure status %d",
266+
net_if_get_by_iface(iface), pkt, status);
267267
}
268268

269269
if (IS_ENABLED(CONFIG_NET_PKT_TXTIME_STATS) ||

0 commit comments

Comments
 (0)