[v5,01/12] common/cnxk: use unique name for DPI memzone

Message ID 20230823111525.3975662-1-amitprakashs@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v5,01/12] common/cnxk: use unique name for DPI memzone |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Amit Prakash Shukla Aug. 23, 2023, 11:15 a.m. UTC
  roc_dpi was using vfid as part of name for memzone allocation.
This led to memzone allocation failure in case of multiple
physical functions. vfid is not unique by itself since multiple
physical functions can have the same virtual function indices.
So use complete DBDF as part of memzone name to make it unique.

Fixes: b6e395692b6d ("common/cnxk: add DPI DMA support")
Cc: stable@dpdk.org

Signed-off-by: Radha Mohan Chintakuntla <radhac@marvell.com>
Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
---
v2:
- Fix for bugs observed in v1.
- Squashed few commits.

v3:
- Resolved review suggestions.
- Code improvement.

v4:
- Resolved checkpatch warnings.

v5:
- Updated commit message.
- Split the commits.

 drivers/common/cnxk/roc_dpi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Jerin Jacob Aug. 23, 2023, 3:30 p.m. UTC | #1
On Wed, Aug 23, 2023 at 4:45 PM Amit Prakash Shukla
<amitprakashs@marvell.com> wrote:
>
> roc_dpi was using vfid as part of name for memzone allocation.
> This led to memzone allocation failure in case of multiple
> physical functions. vfid is not unique by itself since multiple
> physical functions can have the same virtual function indices.
> So use complete DBDF as part of memzone name to make it unique.
>
> Fixes: b6e395692b6d ("common/cnxk: add DPI DMA support")
> Cc: stable@dpdk.org
>
> Signed-off-by: Radha Mohan Chintakuntla <radhac@marvell.com>
> Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>


Updated the git commit as follows and series applied to
dpdk-next-net-mrvl/for-next-net. Thanks


commit 33e784c82a1f0e97cbc10e5a5bcd0bdc4738b3de (HEAD -> for-next-net)
Author: Vamsi Attunuru <vattunuru@marvell.com>
Date:   Wed Aug 23 16:45:25 2023 +0530

    dma/cnxk: track last index return value

    Last index value might lost the order when dma stats are reset
    in between copy operations. Patch adds a variable to track the
    completed count, that can be used to compute the last index, also
    patch adds misc other changes.

    Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>

commit 93d72a0046aa924b9f36848b73027c181347c9e8
Author: Vamsi Attunuru <vattunuru@marvell.com>
Date:   Wed Aug 23 16:45:24 2023 +0530

    dma/cnxk: fix completion ring tail wrap

    Adds a check to avoid tail wrap when completion desc ring
    is full. Also patch increase max desc size to 2048.

    Fixes: b56f1e2dad38 ("dma/cnxk: add channel operations")
    Fixes: 3340c3e22783 ("dma/cnxk: add scatter-gather copy")
    Fixes: 681851b347ad ("dma/cnxk: support CN10K DMA engine")
    Cc: stable@dpdk.org

    Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>

commit 71d2cd2221fcd4715eb33a866a33ba8bc8be54f5
Author: Amit Prakash Shukla <amitprakashs@marvell.com>
Date:   Wed Aug 23 16:45:23 2023 +0530

    dma/cnxk: enhance vchan support

    Added changes to realign dpi private structure based on vchan.
    Also resets DMA dev stats while starting dma device.

    Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>

commit 370fabc5515b3b459c0bf21596a26bd3ca754bf8
Author: Amit Prakash Shukla <amitprakashs@marvell.com>
Date:   Wed Aug 23 16:45:22 2023 +0530

    dma/cnxk: increase vchan per queue to max 4

    To support multiple directions in same queue make use of multiple vchan
    per queue. Each vchan can be configured in some direction and used.

    Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
    Signed-off-by: Radha Mohan Chintakuntla <radhac@marvell.com>

commit 495d2689eb21fffe0c2cc9a090971f656c736770
Author: Amit Prakash Shukla <amitprakashs@marvell.com>
Date:   Wed Aug 23 16:45:21 2023 +0530

    dma/cnxk: update func field based on transfer type

    Use pfid and vfid of src_port for incoming DMA transfers and dst_port
    for outgoing DMA transfers.

    Signed-off-by: Radha Mohan Chintakuntla <radhac@marvell.com>
    Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>

commit b938db4eb11b4b9dfdd9929516cdb9d714942189
Author: Amit Prakash Shukla <amitprakashs@marvell.com>
Date:   Wed Aug 23 16:45:20 2023 +0530

    dma/cnxk: support all models of cn10xxx

    Valid function pointers are set for DMA device operations
    i.e. cn10k_dmadev_ops are used for all cn10k devices.

    Signed-off-by: Radha Mohan Chintakuntla <radhac@marvell.com>
    Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>

commit a3b4b6da918c7380d9ffbf24f670c4bcf1e27494
Author: Amit Prakash Shukla <amitprakashs@marvell.com>
Date:   Wed Aug 23 16:45:19 2023 +0530

    dma/cnxk: fix chunk buffer failure return code

    On chunk buffer alloc failure, ENOMEM is returned. As per DMA spec
    ENOSPC shall be returned on failure to allocate memory. This
    changeset fixes the same.

    Fixes: b56f1e2dad38 ("dma/cnxk: add channel operations")
    Cc: stable@dpdk.org

    Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>

commit 28392a849e9e04040ad49a3c61d0d0f3f39ff6e3
Author: Amit Prakash Shukla <amitprakashs@marvell.com>
Date:   Wed Aug 23 16:45:18 2023 +0530

    dma/cnxk: make completion ring buffer as dynamic

    Completion buffer was a static array per dma device. This would
    consume memory for max number of descriptor supported by device
    which might be more than configured by application. The change
    allocates the memory for completion buffer based on the number
    of descriptor configured by application.

    Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>

Author: Amit Prakash Shukla <amitprakashs@marvell.com>
Date:   Wed Aug 23 16:45:17 2023 +0530

    dma/cnxk: fix device reconfigure

    Multiple call to configure, setup queues without stopping the device
    would leak the ring descriptor and hardware queue memory. This patch
    adds flags support to prevent configuring without stopping the
    device.

    Fixes: b56f1e2dad38 ("dma/cnxk: add channel operations")
    Cc: stable@dpdk.org

    Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>

commit d32fabfad6a62959d2196a342605f64b787cd936
Author: Amit Prakash Shukla <amitprakashs@marvell.com>
Date:   Wed Aug 23 16:45:16 2023 +0530

    dma/cnxk: fix device state

    When a device is not set to a ready state, on exiting the application
    proper cleanup is not done. This causes the application to fail on
    trying to run next time.

    Setting the device to ready state on successful probe fixes the issue.

    Fixes: 53f6d7328bf4 ("dma/cnxk: create and initialize device on
PCI probing")
    Cc: stable@dpdk.org

    Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>

commit 8c0b8bfa4b7d6ead026d2e22ac91f219303baa30
Author: Amit Prakash Shukla <amitprakashs@marvell.com>
Date:   Wed Aug 23 16:45:15 2023 +0530

    dma/cnxk: support for burst capacity

    Adds support for the burst capacity. Call to the function return
    number of vacant space in descriptor ring for the current burst.

    Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>

commit 9b6dc3fc98ad0be2f45b6eadbd88e13f0f0e1492
Author: Amit Prakash Shukla <amitprakashs@marvell.com>
Date:   Wed Aug 23 16:45:14 2023 +0530

    common/cnxk: fix DPI memzone name

    roc_dpi was using vfid as part of name for memzone allocation.
    This led to memzone allocation failure in case of multiple
    physical functions. vfid is not unique by itself since multiple
    physical functions can have the same virtual function indices.
    So use complete DBDF as part of memzone name to make it unique.

    Fixes: b6e395692b6d ("common/cnxk: add DPI DMA support")
    Cc: stable@dpdk.org

    Signed-off-by: Radha Mohan Chintakuntla <radhac@marvell.com>
    Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
  

Patch

diff --git a/drivers/common/cnxk/roc_dpi.c b/drivers/common/cnxk/roc_dpi.c
index 93c8318a3d..0e2f803077 100644
--- a/drivers/common/cnxk/roc_dpi.c
+++ b/drivers/common/cnxk/roc_dpi.c
@@ -81,10 +81,10 @@  roc_dpi_configure(struct roc_dpi *roc_dpi)
 		return rc;
 	}
 
-	snprintf(name, sizeof(name), "dpimem%d", roc_dpi->vfid);
+	snprintf(name, sizeof(name), "dpimem%d:%d:%d:%d", pci_dev->addr.domain, pci_dev->addr.bus,
+		 pci_dev->addr.devid, pci_dev->addr.function);
 	buflen = DPI_CMD_QUEUE_SIZE * DPI_CMD_QUEUE_BUFS;
-	dpi_mz = plt_memzone_reserve_aligned(name, buflen, 0,
-					     DPI_CMD_QUEUE_SIZE);
+	dpi_mz = plt_memzone_reserve_aligned(name, buflen, 0, DPI_CMD_QUEUE_SIZE);
 	if (dpi_mz == NULL) {
 		plt_err("dpi memzone reserve failed");
 		rc = -ENOMEM;