net: ip: net_if: warning message on send failure

Print a warning if sending a packet on the L2 interface fails. Currently
this is completely silent unless `NET_DBG` is enabled and the `context`
parameter is provided.

Signed-off-by: Jordan Yates <jordan@embeint.com>
This commit is contained in:
Jordan Yates 2025-04-21 15:57:55 +10:00 committed by Benjamin Cabé
commit 4e0386a445

View file

@ -261,6 +261,10 @@ static bool net_if_tx(struct net_if *iface, struct net_pkt *pkt)
net_if_tx_lock(iface);
status = net_if_l2(iface)->send(iface, pkt);
net_if_tx_unlock(iface);
if (status < 0) {
NET_WARN("iface %d pkt %p send failure status %d",
net_if_get_by_iface(iface), pkt, status);
}
if (IS_ENABLED(CONFIG_NET_PKT_TXTIME_STATS) ||
IS_ENABLED(CONFIG_TRACING_NET_CORE)) {