From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 77360A055C; Fri, 27 May 2022 05:47:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B3465427F0; Fri, 27 May 2022 05:47:11 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 5BFA740E25 for ; Fri, 27 May 2022 05:47:09 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4L8W1S5kDczhXZJ; Fri, 27 May 2022 11:46:04 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 27 May 2022 11:47:06 +0800 From: Chengwen Feng To: CC: , , Subject: [PATCH 1/4] dma/hisilicon: fix return last-idx when no DMA completed Date: Fri, 27 May 2022 11:40:52 +0800 Message-ID: <20220527034055.33271-2-fengchengwen@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220527034055.33271-1-fengchengwen@huawei.com> References: <20220527034055.33271-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org If no DMA request is completed, the ring_idx of the last completed operation need returned by last_idx parameter. This patch fixes it. Fixes: 2db4f0b82360 ("dma/hisilicon: add data path") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- drivers/dma/hisilicon/hisi_dmadev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c index 9cef2cbfbe..f5c3cd914d 100644 --- a/drivers/dma/hisilicon/hisi_dmadev.c +++ b/drivers/dma/hisilicon/hisi_dmadev.c @@ -702,12 +702,12 @@ hisi_dma_completed(void *dev_private, } sq_head = (sq_head + 1) & hw->sq_depth_mask; } + *last_idx = hw->cridx + i - 1; if (i > 0) { hw->cridx += i; - *last_idx = hw->cridx - 1; hw->sq_head = sq_head; + hw->completed += i; } - hw->completed += i; return i; } @@ -761,12 +761,12 @@ hisi_dma_completed_status(void *dev_private, hw->status[sq_head] = HISI_DMA_STATUS_SUCCESS; sq_head = (sq_head + 1) & hw->sq_depth_mask; } + *last_idx = hw->cridx + cpl_num - 1; if (likely(cpl_num > 0)) { hw->cridx += cpl_num; - *last_idx = hw->cridx - 1; hw->sq_head = sq_head; + hw->completed += cpl_num; } - hw->completed += cpl_num; return cpl_num; } -- 2.33.0