From fa33e6815ee3926b485a12a6b654c7edbac8b373 Mon Sep 17 00:00:00 2001 From: Yodel Eldar Date: Thu, 29 Jan 2026 07:30:49 -0600 Subject: [PATCH] contrib/vhost-user-bridge: Add UDP receive hexdump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vhost-user-bridge debug prints UDP TX hexdumps in its transmit handler, but does not for receives, even though they are beneficial for testing. Add an RX hexdump in the receive callback. To delineate between transmits and receives, also add a debug print indicating that the program is in the transmit handler. Reviewed-by: Marc-André Lureau Signed-off-by: Yodel Eldar Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Message-Id: <20260129133049.119829-4-yodel.eldar@yodel.dev> --- contrib/vhost-user-bridge/vhost-user-bridge.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/vhost-user-bridge/vhost-user-bridge.c b/contrib/vhost-user-bridge/vhost-user-bridge.c index ce4c3426d3..3f0fd0fa49 100644 --- a/contrib/vhost-user-bridge/vhost-user-bridge.c +++ b/contrib/vhost-user-bridge/vhost-user-bridge.c @@ -179,6 +179,9 @@ vubr_handle_tx(VuDev *dev, int qidx) assert(qidx % 2); + DPRINT("\n\n *** IN UDP TRANSMIT HANDLER ***\n\n"); + DPRINT(" hdrlen = %d\n", hdrlen); + for (;;) { ssize_t ret; unsigned int out_num; @@ -333,6 +336,10 @@ vubr_backend_recv_cb(int sock, void *ctx) }; ret = RETRY_ON_EINTR(recvmsg(vubr->backend_udp_sock, &msg, 0)); + if (ret > 0 && VHOST_USER_BRIDGE_DEBUG) { + iov_hexdump(sg, num, stderr, "RX:", ret); + } + if (i == 0) { iov_restore_front(elem->in_sg, sg, hdrlen); }