[RFC PATCH v2 3/3] contrib/vhost-user-bridge: Add UDP receive hexdump

Yodel Eldar posted 3 patches 3 weeks, 6 days ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Zhao Liu <zhao1.liu@intel.com>
There is a newer version of this series
[RFC PATCH v2 3/3] contrib/vhost-user-bridge: Add UDP receive hexdump
Posted by Yodel Eldar 3 weeks, 6 days ago
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.

Signed-off-by: Yodel Eldar <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);
         }
-- 
2.52.0
Re: [RFC PATCH v2 3/3] contrib/vhost-user-bridge: Add UDP receive hexdump
Posted by Marc-André Lureau 3 weeks, 6 days ago
On Tue, Jan 13, 2026 at 3:03 AM Yodel Eldar <yodel.eldar@yodel.dev> wrote:
>
> 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.
>
> Signed-off-by: Yodel Eldar <yodel.eldar@yodel.dev>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

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


-- 
Marc-André Lureau