Skip to content

Commit

Permalink
rpmsg: let rpmsg_virtio_get_tx_buffer() always return idx 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 let
rpmsg_virtio_get_tx_buffer() always get correct idx.

Note: the idx in rpmsg host side is not used, so this commit is just
an improvement and not fix any 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 19, 2023
1 parent cd88238 commit 795df46
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/rpmsg/rpmsg_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +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)
*len = rvdev->config.h2r_buf_size;
#endif /*!VIRTIO_DEVICE_ONLY*/
#ifndef VIRTIO_DRIVER_ONLY
if (role == RPMSG_REMOTE) {
*idx = r_desc->idx;
if (role == RPMSG_REMOTE)
*len = virtqueue_get_buffer_length(rvdev->svq, *idx);
}
#endif /*!VIRTIO_DRIVER_ONLY*/
#ifndef VIRTIO_DEVICE_ONLY
} else if (role == RPMSG_HOST) {
Expand Down

0 comments on commit 795df46

Please sign in to comment.