@samitouri / QOSamiQemu / commits / fa33e6815e

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>

Yodel Eldar committed Jan 29, 2026 at 07:30 UTC fa33e6815ee3926b485a12a6b654c7edbac8b373
1 file changed +7
contrib/vhost-user-bridge/vhost-user-bridge.c
+7
@@ -179,6 +179,9 @@ vubr_handle_tx(VuDev *dev, int qidx)
179
180 assert(qidx % 2);
181
182 + DPRINT("\n\n *** IN UDP TRANSMIT HANDLER ***\n\n");
183 + DPRINT(" hdrlen = %d\n", hdrlen);
184 +
185 for (;;) {
186 ssize_t ret;
187 unsigned int out_num;
@@ -333,6 +336,10 @@ vubr_backend_recv_cb(int sock, void *ctx)
336 };
337 ret = RETRY_ON_EINTR(recvmsg(vubr->backend_udp_sock, &msg, 0));
338
339 + if (ret > 0 && VHOST_USER_BRIDGE_DEBUG) {
340 + iov_hexdump(sg, num, stderr, "RX:", ret);
341 + }
342 +
343 if (i == 0) {
344 iov_restore_front(elem->in_sg, sg, hdrlen);
345 }