This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 464d23a8c00 drivers/rpmsg/rpmsg_virtio: trace the rx endpoint callbacks
464d23a8c00 is described below

commit 464d23a8c00e31cbb4056232e42720b1c11cc87b
Author: mazhuang <[email protected]>
AuthorDate: Wed Jul 16 16:10:04 2025 +0800

    drivers/rpmsg/rpmsg_virtio: trace the rx endpoint callbacks
    
    rpmsg_port records every endpoint callback with rpmsg_trace(), but
    rpmsg_virtio does not, so with CONFIG_RPMSG_TRACE the note stream only
    shows the port links. Trace the start and the end of each callback in
    rpmsg_virtio_process_rx_buffer(), with the message header and payload
    on the start record, the same way rpmsg_port does.
    
    Signed-off-by: mazhuang <[email protected]>
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/rpmsg/rpmsg_virtio.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/rpmsg/rpmsg_virtio.c b/drivers/rpmsg/rpmsg_virtio.c
index 8a52eda7e01..c5763e359a5 100644
--- a/drivers/rpmsg/rpmsg_virtio.c
+++ b/drivers/rpmsg/rpmsg_virtio.c
@@ -244,6 +244,7 @@ static int rpmsg_virtio_process_rx_buffer(FAR struct 
rpmsg_device *rdev,
                                           FAR struct rpmsg_endpoint *ept,
                                           FAR struct rpmsg_hdr *hdr)
 {
+  size_t len = hdr->len + sizeof(*hdr);
   int status;
 
   if (ept->dest_addr == RPMSG_ADDR_ANY)
@@ -258,9 +259,19 @@ static int rpmsg_virtio_process_rx_buffer(FAR struct 
rpmsg_device *rdev,
   rpmsg_ept_incref(ept);
   metal_mutex_release(&rdev->lock);
 
+  rpmsg_trace(ept->name, false, hdr, len,
+              "[Virtio] rx ept->cb start ept:%p name:%s cb:%p "
+              "rdev:%p hdr:%p len:%zu\n",
+              ept, ept->name, ept->cb, rdev, hdr, len);
+
   status = ept->cb(ept, RPMSG_LOCATE_DATA(hdr), hdr->len, hdr->src,
                    ept->priv);
 
+  rpmsg_trace(ept->name, false, NULL, 0,
+              "[Virtio] rx ept->cb end ept:%p name:%s cb:%p "
+              "rdev:%p hdr:%p len:%zu\n",
+              ept, ept->name, ept->cb, rdev, hdr, len);
+
   RPMSG_ASSERT(status >= 0 || status == RPMSG_SUCCESS_BUFFER_RELEASED,
                "unexpected callback status\r\n");
 

Reply via email to