diff mbox series

[v4,10/11] dma/ioat: add burst capacity function

Message ID 20210917154227.737554-11-conor.walsh@intel.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series dma: add dmadev driver for ioat devices | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Walsh, Conor Sept. 17, 2021, 3:42 p.m. UTC
Adds the ability to find the remaining space in the IOAT ring.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
---
 drivers/dma/ioat/ioat_dmadev.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Bruce Richardson Sept. 20, 2021, 1:49 p.m. UTC | #1
On Fri, Sep 17, 2021 at 03:42:26PM +0000, Conor Walsh wrote:
> Adds the ability to find the remaining space in the IOAT ring.
> 
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>
> Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
diff mbox series

Patch

diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c
index b93289516e..e82a7424e5 100644
--- a/drivers/dma/ioat/ioat_dmadev.c
+++ b/drivers/dma/ioat/ioat_dmadev.c
@@ -493,6 +493,19 @@  ioat_completed_status(struct rte_dma_dev *dev, uint16_t qid __rte_unused,
 	return count;
 }
 
+/* Get the remaining capacity of the ring. */
+static uint16_t
+ioat_burst_capacity(const struct rte_dma_dev *dev, uint16_t vchan __rte_unused)
+{
+	struct ioat_dmadev *ioat = dev->data->dev_private;
+	unsigned short size = ioat->qcfg.nb_desc - 1;
+	unsigned short read = ioat->next_read;
+	unsigned short write = ioat->next_write;
+	unsigned short space = size - (write - read);
+
+	return space;
+}
+
 /* Retrieve the generic stats of a DMA device. */
 static int
 ioat_stats_get(const struct rte_dma_dev *dev, uint16_t vchan __rte_unused,
@@ -544,6 +557,7 @@  static int
 ioat_dmadev_create(const char *name, struct rte_pci_device *dev)
 {
 	static const struct rte_dma_dev_ops ioat_dmadev_ops = {
+		.burst_capacity = ioat_burst_capacity,
 		.dev_close = ioat_dev_close,
 		.dev_configure = ioat_dev_configure,
 		.dev_dump = ioat_dev_dump,