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 */