39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
|
From 8aff77d4ceea809da273b68763aea737ed81da38 Mon Sep 17 00:00:00 2001
|
||
|
From: Guiding Li <liguiding1@xiaomi.com>
|
||
|
Date: Tue, 2 Aug 2022 11:12:19 +0800
|
||
|
Subject: [PATCH 09/12] openamp: firstly take all buffer from shram pool
|
||
|
|
||
|
1. the memory already alloced for shram
|
||
|
2. this can help dump the right free cnt
|
||
|
|
||
|
Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
|
||
|
---
|
||
|
lib/rpmsg/rpmsg_virtio.c | 9 +++++----
|
||
|
1 file changed, 5 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c
|
||
|
index 92f5883..4f26b01 100644
|
||
|
--- a/lib/rpmsg/rpmsg_virtio.c
|
||
|
+++ open-amp/lib/rpmsg/rpmsg_virtio.c
|
||
|
@@ -154,12 +154,13 @@ static void *rpmsg_virtio_get_tx_buffer(struct rpmsg_virtio_device *rvdev,
|
||
|
|
||
|
#ifndef VIRTIO_DEVICE_ONLY
|
||
|
if (role == RPMSG_HOST) {
|
||
|
- data = virtqueue_get_buffer(rvdev->svq, len, idx);
|
||
|
- if (!data && rvdev->svq->vq_free_cnt) {
|
||
|
- data = rpmsg_virtio_shm_pool_get_buffer(rvdev->shpool,
|
||
|
- rvdev->config.h2r_buf_size);
|
||
|
+ data = rpmsg_virtio_shm_pool_get_buffer(rvdev->shpool,
|
||
|
+ rvdev->config.h2r_buf_size);
|
||
|
+ if (data) {
|
||
|
*len = rvdev->config.h2r_buf_size;
|
||
|
*idx = 0;
|
||
|
+ } else {
|
||
|
+ data = virtqueue_get_buffer(rvdev->svq, len, idx);
|
||
|
}
|
||
|
}
|
||
|
#endif /*!VIRTIO_DEVICE_ONLY*/
|
||
|
--
|
||
|
2.25.1
|
||
|
|