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 4E75FA0C4E; Tue, 2 Nov 2021 13:02:47 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1154A4068F; Tue, 2 Nov 2021 13:02:46 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id BDBAC40689 for ; Tue, 2 Nov 2021 13:02:43 +0100 (CET) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Hk7lr3t6DzSh0C; Tue, 2 Nov 2021 20:01:12 +0800 (CST) Received: from dggpeml500024.china.huawei.com (7.185.36.10) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 2 Nov 2021 20:02:40 +0800 Received: from [127.0.0.1] (10.67.100.224) 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.2308.15; Tue, 2 Nov 2021 20:02:40 +0800 To: Radha Mohan Chintakuntla , , , , , , , CC: References: <20211026041300.28924-1-radhac@marvell.com> <20211102034019.28900-1-radhac@marvell.com> <20211102034019.28900-4-radhac@marvell.com> From: fengchengwen Message-ID: <45a2e127-753a-30cc-7531-fe5f1a32c921@huawei.com> Date: Tue, 2 Nov 2021 20:02:40 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20211102034019.28900-4-radhac@marvell.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.100.224] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH v2 4/4] dma/cnxk: add copy_sg function 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 Sender: "dev" On 2021/11/2 11:40, Radha Mohan Chintakuntla wrote: > Add the copy_sg function that will do the multiple DMA transfers of > different sizes and different source/destination as well. > ... > > +static int > +cnxk_dmadev_copy_sg(void *dev_private, uint16_t vchan, > + const struct rte_dma_sge *src, > + const struct rte_dma_sge *dst, > + uint16_t nb_src, uint16_t nb_dst, uint64_t flags) > +{ > + struct cnxk_dpi_vf_s *dpivf = dev_private; > + union dpi_instr_hdr_s *header = &dpivf->conf.hdr; > + const struct rte_dma_sge *fptr, *lptr; > + struct cnxk_dpi_compl_s *comp_ptr; > + int num_words = 0; > + int i, rc; > + > + RTE_SET_USED(vchan); > + > + comp_ptr = dpivf->conf.c_desc.compl_ptr[dpivf->conf.c_desc.tail]; > + comp_ptr->cdata = DPI_REQ_CDATA; > + header->s.ptr = (uint64_t)comp_ptr; > + STRM_INC(dpivf->conf.c_desc); > + > + /* > + * For inbound case, src pointers are last pointers. > + * For all other cases, src pointers are first pointers. > + */ > + if (header->s.xtype == DPI_XTYPE_INBOUND) { > + header->s.nfst = nb_dst & 0xf; > + header->s.nlst = nb_src & 0xf; > + fptr = &dst[0]; > + lptr = &src[0]; > + } else { > + header->s.nfst = nb_src & 0xf; > + header->s.nlst = nb_dst & 0xf; > + fptr = &src[0]; > + lptr = &dst[0]; > + } > + > + dpivf->cmd[0] = header->u[0]; > + dpivf->cmd[1] = header->u[1]; > + dpivf->cmd[2] = header->u[2]; > + num_words += 4; > + for (i = 0; i < header->s.nfst; i++) { > + dpivf->cmd[num_words++] = (uint64_t)fptr->length; > + dpivf->cmd[num_words++] = fptr->addr; > + fptr++; > + } > + > + for (i = 0; i < header->s.nlst; i++) { > + dpivf->cmd[num_words++] = (uint64_t)lptr->length; > + dpivf->cmd[num_words++] = lptr->addr; > + lptr++; > + } > + > + rc = __dpi_queue_write(&dpivf->rdpi, dpivf->cmd, num_words); > + if (!rc) { > + if (flags & RTE_DMA_OP_FLAG_SUBMIT) { > + rte_wmb(); > + plt_write64(num_words, > + dpivf->rdpi.rbase + DPI_VDMA_DBELL); > + } > + dpivf->num_words = num_words; > + } > + > + return rc; should return ring index which in [0, 0xffff] > +} > + > static uint16_t > cnxk_dmadev_completed(void *dev_private, uint16_t vchan, const uint16_t nb_cpls, > uint16_t *last_idx, bool *has_error) > @@ -369,6 +434,7 @@ cnxk_dmadev_probe(struct rte_pci_driver *pci_drv __rte_unused, > dmadev->dev_ops = &cnxk_dmadev_ops; > > dmadev->fp_obj->copy = cnxk_dmadev_copy; > + dmadev->fp_obj->copy_sg = cnxk_dmadev_copy_sg; > dmadev->fp_obj->submit = cnxk_dmadev_submit; > dmadev->fp_obj->completed = cnxk_dmadev_completed; > dmadev->fp_obj->completed_status = cnxk_dmadev_completed_status; >