contrib/vhost-user-bridge: Add UDP receive hexdump

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 <marcandre.lureau@redhat.com>
Signed-off-by: Yodel Eldar <yodel.eldar@yodel.dev>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20260129133049.119829-4-yodel.eldar@yodel.dev>
This commit is contained in:
Yodel Eldar
2026-01-29 07:30:49 -06:00
committed by Michael S. Tsirkin
parent 051364b36b
commit fa33e6815e

View File

@@ -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);
}