52 lines
1.4 KiB
Diff
52 lines
1.4 KiB
Diff
From dafb286fe6ca5ba2a4ddf2381db1750b87dd3e1b Mon Sep 17 00:00:00 2001
|
|
From: Yang Shen <shenyang39@huawei.com>
|
|
Date: Mon, 20 Nov 2023 15:22:01 +0800
|
|
Subject: [PATCH 85/85] uadk: drv/hisi - fix sgl copy offset error
|
|
|
|
The HiSilicon drivers support copy data between the pbuffer and sgl.
|
|
And it supports copying data from the specified domain of sgl.
|
|
|
|
There is a bug when the driver calculate the sgl address. It adds the
|
|
next sgl node length rather than the origin one. So if the sgl lengths
|
|
are not equal, the target node will be wrong.
|
|
|
|
Therefore, the driver should add the origin sgl length and then fetch
|
|
the next node.
|
|
|
|
Signed-off-by: Yang Shen <shenyang39@huawei.com>
|
|
---
|
|
drv/hisi_qm_udrv.c | 7 +++----
|
|
1 file changed, 3 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/drv/hisi_qm_udrv.c b/drv/hisi_qm_udrv.c
|
|
index d86a692..13db3f0 100644
|
|
--- a/drv/hisi_qm_udrv.c
|
|
+++ b/drv/hisi_qm_udrv.c
|
|
@@ -972,20 +972,19 @@ void hisi_qm_sgl_copy(void *pbuff, void *hw_sgl, __u32 offset, __u32 size,
|
|
__u8 direct)
|
|
{
|
|
struct hisi_sgl *tmp = hw_sgl;
|
|
+ int begin_sge = 0, i;
|
|
__u32 sge_offset = 0;
|
|
__u32 len = 0;
|
|
- int begin_sge = 0;
|
|
- int i;
|
|
|
|
if (!pbuff || !size || !tmp)
|
|
return;
|
|
|
|
while (len + tmp->entry_size_in_sgl <= offset) {
|
|
+ len += tmp->entry_size_in_sgl;
|
|
+
|
|
tmp = (struct hisi_sgl *)tmp->next_dma;
|
|
if (!tmp)
|
|
return;
|
|
-
|
|
- len += tmp->entry_size_in_sgl;
|
|
}
|
|
|
|
/* find the start sge position and start offset */
|
|
--
|
|
2.25.1
|
|
|