From 798962cedd7e30f95e9a3a6126276b77086a6d08 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Sat, 7 Oct 2023 21:53:12 -0400 Subject: net: Add option for tracing packets Add an option to trace all packets send/received. This can be helpful when debugging protocol issues, as the packets can then be imported into wireshark [1] and analyzed further. [1] https://www.wireshark.org/docs/wsug_html_chunked/ChIOImportSection.html Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- include/net.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/net.h b/include/net.h index e254df7d7f4..e63a946002d 100644 --- a/include/net.h +++ b/include/net.h @@ -16,6 +16,7 @@ #include #include /* for nton* / ntoh* stuff */ #include +#include #include #include #include @@ -29,6 +30,7 @@ struct udevice; #define DEBUG_DEV_PKT 0 /* Packets or info directed to the device */ #define DEBUG_NET_PKT 0 /* Packets on info on the network at large */ #define DEBUG_INT_STATE 0 /* Internal network state changes */ +#define DEBUG_NET_PKT_TRACE 0 /* Trace all packet data */ /* * The number of receive packet buffers, and the required packet buffer @@ -640,6 +642,8 @@ uchar * net_get_async_tx_pkt_buf(void); /* Transmit a packet */ static inline void net_send_packet(uchar *pkt, int len) { + if (DEBUG_NET_PKT_TRACE) + print_hex_dump_bytes("tx: ", DUMP_PREFIX_OFFSET, pkt, len); /* Currently no way to return errors from eth_send() */ (void) eth_send(pkt, len); } -- cgit v1.2.3