Skip to content

Commit

Permalink
rpmsg: fix rpmsg_virtio_get_tx_buffer() no idx return in host side
Browse files Browse the repository at this point in the history
In rpmsg host side, the tx buffer index is not assigned when this buffer
is obtained from the reclaimer list, this commit fix this issue.

Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
  • Loading branch information
GUIDINGLI authored and CV-Bowen committed Oct 17, 2023
1 parent 329fe10 commit ffdb7a6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/rpmsg/rpmsg_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,15 @@ static void *rpmsg_virtio_get_tx_buffer(struct rpmsg_virtio_device *rvdev,
r_desc = metal_container_of(node, struct vbuff_reclaimer_t, node);
metal_list_del(node);
data = r_desc;
*idx = r_desc->idx;

#ifndef VIRTIO_DEVICE_ONLY
if (role == RPMSG_HOST)
if (role == RPMSG_HOST) {
*len = rvdev->config.h2r_buf_size;
}
#endif /*!VIRTIO_DEVICE_ONLY*/
#ifndef VIRTIO_DRIVER_ONLY
if (role == RPMSG_REMOTE) {
*idx = r_desc->idx;
*len = virtqueue_get_buffer_length(rvdev->svq, *idx);
}
#endif /*!VIRTIO_DRIVER_ONLY*/
Expand Down

0 comments on commit ffdb7a6

Please sign in to comment.