From: fengchengwen <fengchengwen@huawei.com>
To: Radha Mohan Chintakuntla <radhac@marvell.com>,
<thomas@monjalon.net>, <ndabilpuram@marvell.com>,
<kirankumark@marvell.com>, <skori@marvell.com>,
<skoteshwar@marvell.com>, <jerinj@marvell.com>,
<sburla@marvell.com>
Cc: <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2 4/4] dma/cnxk: add copy_sg function
Date: Tue, 2 Nov 2021 20:02:40 +0800 [thread overview]
Message-ID: <45a2e127-753a-30cc-7531-fe5f1a32c921@huawei.com> (raw)
In-Reply-To: <20211102034019.28900-4-radhac@marvell.com>
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;
>
next prev parent reply other threads:[~2021-11-02 12:02 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-26 4:12 [dpdk-dev] [PATCH 1/4] common/cnxk: add DPI DMA support Radha Mohan Chintakuntla
2021-10-26 4:12 ` [dpdk-dev] [PATCH 2/4] dma/cnxk: create and initialize dmadev on pci probe Radha Mohan Chintakuntla
2021-10-26 8:36 ` Jerin Jacob
2021-10-26 21:05 ` Radha Mohan
2021-10-26 4:12 ` [dpdk-dev] [PATCH 3/4] dma/cnxk: add dma channel operations Radha Mohan Chintakuntla
2021-10-26 8:41 ` Jerin Jacob
2021-10-28 18:18 ` Radha Mohan
2021-10-29 14:54 ` Jerin Jacob
2021-10-29 18:02 ` Radha Mohan
2021-10-26 4:13 ` [dpdk-dev] [PATCH 4/4] dma/cnxk: add copy_sg function Radha Mohan Chintakuntla
2021-10-26 8:42 ` Jerin Jacob
2021-10-26 8:33 ` [dpdk-dev] [PATCH 1/4] common/cnxk: add DPI DMA support Jerin Jacob
2021-10-26 15:57 ` Radha Mohan
2021-11-02 3:40 ` [dpdk-dev] [PATCH v2 " Radha Mohan Chintakuntla
2021-11-02 3:40 ` [dpdk-dev] [PATCH v2 2/4] dma/cnxk: create and initialize dmadev on pci probe Radha Mohan Chintakuntla
2021-11-02 4:02 ` Jerin Jacob
2021-11-02 11:49 ` fengchengwen
2021-11-02 3:40 ` [dpdk-dev] [PATCH v2 3/4] dma/cnxk: add dma channel operations Radha Mohan Chintakuntla
2021-11-02 11:59 ` fengchengwen
2021-11-02 18:11 ` Radha Mohan
2021-11-02 3:40 ` [dpdk-dev] [PATCH v2 4/4] dma/cnxk: add copy_sg function Radha Mohan Chintakuntla
2021-11-02 12:02 ` fengchengwen [this message]
2021-11-02 11:45 ` [dpdk-dev] [PATCH v2 1/4] common/cnxk: add DPI DMA support fengchengwen
2021-11-03 18:01 ` [dpdk-dev] [PATCH v3 1/5] " Radha Mohan Chintakuntla
2021-11-03 18:01 ` [dpdk-dev] [PATCH v3 2/5] dma/cnxk: create and initialize dmadev on pci probe Radha Mohan Chintakuntla
2021-11-07 20:55 ` Thomas Monjalon
2021-11-07 23:04 ` Thomas Monjalon
2021-11-09 3:52 ` Radha Mohan
2021-11-09 8:11 ` Thomas Monjalon
2021-11-03 18:01 ` [dpdk-dev] [PATCH v3 3/5] dma/cnxk: add dma channel operations Radha Mohan Chintakuntla
2021-11-03 18:01 ` [dpdk-dev] [PATCH v3 4/5] dma/cnxk: add copy_sg function Radha Mohan Chintakuntla
2021-11-03 18:01 ` [dpdk-dev] [PATCH v3 5/5] dma/cnxk: add stats function Radha Mohan Chintakuntla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45a2e127-753a-30cc-7531-fe5f1a32c921@huawei.com \
--to=fengchengwen@huawei.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=radhac@marvell.com \
--cc=sburla@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).