common/cnxk: add null authentication with IPsec
[dpdk.git] / drivers / dma / ioat / ioat_dmadev.c
index 48126a1..a230496 100644 (file)
@@ -516,6 +516,19 @@ ioat_completed_status(void *dev_private, uint16_t qid __rte_unused,
        return count;
 }
 
+/* Get the remaining capacity of the ring. */
+static uint16_t
+ioat_burst_capacity(const void *dev_private, uint16_t vchan __rte_unused)
+{
+       const struct ioat_dmadev *ioat = 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,
@@ -542,6 +555,26 @@ ioat_stats_reset(struct rte_dma_dev *dev, uint16_t vchan __rte_unused)
        return 0;
 }
 
+/* Check if the IOAT device is idle. */
+static int
+ioat_vchan_status(const struct rte_dma_dev *dev, uint16_t vchan __rte_unused,
+               enum rte_dma_vchan_status *status)
+{
+       int state = 0;
+       const struct ioat_dmadev *ioat = dev->fp_obj->dev_private;
+       const uint16_t mask = ioat->qcfg.nb_desc - 1;
+       const uint16_t last = __get_last_completed(ioat, &state);
+
+       if (state == IOAT_CHANSTS_HALTED || state == IOAT_CHANSTS_SUSPENDED)
+               *status = RTE_DMA_VCHAN_HALTED_ERROR;
+       else if (last == ((ioat->next_write - 1) & mask))
+               *status = RTE_DMA_VCHAN_IDLE;
+       else
+               *status = RTE_DMA_VCHAN_ACTIVE;
+
+       return 0;
+}
+
 /* Create a DMA device. */
 static int
 ioat_dmadev_create(const char *name, struct rte_pci_device *dev)
@@ -555,6 +588,7 @@ ioat_dmadev_create(const char *name, struct rte_pci_device *dev)
                .dev_stop = ioat_dev_stop,
                .stats_get = ioat_stats_get,
                .stats_reset = ioat_stats_reset,
+               .vchan_status = ioat_vchan_status,
                .vchan_setup = ioat_vchan_setup,
        };
 
@@ -580,6 +614,7 @@ ioat_dmadev_create(const char *name, struct rte_pci_device *dev)
 
        dmadev->dev_ops = &ioat_dmadev_ops;
 
+       dmadev->fp_obj->burst_capacity = ioat_burst_capacity;
        dmadev->fp_obj->completed = ioat_completed;
        dmadev->fp_obj->completed_status = ioat_completed_status;
        dmadev->fp_obj->copy = ioat_enqueue_copy;