Skip to content

Commit

Permalink
rpmsg_virtio: fix the rpmsg_get_tx/rx_buffer() api
Browse files Browse the repository at this point in the history
user tx/rx buffer size = orignal tx/rx buffer_size - sizeof(rpmsg_hdr)

And use buffer size in config to calculate the user buffer size instead
the buffer size from virtqueue, because there may be no buffer in virtqueeu.

Signed-off-by: yintao <[email protected]>
Signed-off-by: Bowen Wang <[email protected]>
  • Loading branch information
CV-Bowen committed Nov 4, 2024
1 parent 71887e7 commit dd3eff5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/rpmsg/rpmsg_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,7 @@ int rpmsg_virtio_get_tx_buffer_size(struct rpmsg_device *rdev)
* If other core is host then buffers are provided by it,
* so get the buffer size from the virtqueue.
*/
size = (int)virtqueue_get_desc_size(rvdev->svq) -
sizeof(struct rpmsg_hdr);
size = rvdev->config.r2h_buf_size - sizeof(struct rpmsg_hdr);
}

if (size <= 0)
Expand Down Expand Up @@ -763,8 +762,7 @@ int rpmsg_virtio_get_rx_buffer_size(struct rpmsg_device *rdev)
* If other core is host then buffers are provided by it,
* so get the buffer size from the virtqueue.
*/
size = (int)virtqueue_get_desc_size(rvdev->rvq) -
sizeof(struct rpmsg_hdr);
size = rvdev->config.h2r_buf_size - sizeof(struct rpmsg_hdr);
}

if (size <= 0)
Expand Down

0 comments on commit dd3eff5

Please sign in to comment.