raw/ioat: add xstats tracking for idxd device
authorBruce Richardson <bruce.richardson@intel.com>
Thu, 8 Oct 2020 09:51:31 +0000 (10:51 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 8 Oct 2020 12:33:20 +0000 (14:33 +0200)
Add update of the relevant stats for the data path functions and point the
overall device struct xstats function pointers to the existing ioat
functions.

At this point, all necessary hooks for supporting the existing unit tests
are in place so call them for each device.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
drivers/raw/ioat/idxd_pci.c
drivers/raw/ioat/idxd_vdev.c
drivers/raw/ioat/ioat_rawdev_test.c
drivers/raw/ioat/rte_ioat_rawdev_fns.h

index bf5edcf..9113f8c 100644 (file)
@@ -107,6 +107,9 @@ static const struct rte_rawdev_ops idxd_pci_ops = {
                .dev_start = idxd_pci_dev_start,
                .dev_stop = idxd_pci_dev_stop,
                .dev_info_get = idxd_dev_info_get,
+               .xstats_get = ioat_xstats_get,
+               .xstats_get_names = ioat_xstats_get_names,
+               .xstats_reset = ioat_xstats_reset,
 };
 
 /* each portal uses 4 x 4k pages */
index c75ac43..38218cc 100644 (file)
@@ -36,6 +36,9 @@ static const struct rte_rawdev_ops idxd_vdev_ops = {
                .dump = idxd_dev_dump,
                .dev_configure = idxd_dev_configure,
                .dev_info_get = idxd_dev_info_get,
+               .xstats_get = ioat_xstats_get,
+               .xstats_get_names = ioat_xstats_get_names,
+               .xstats_reset = ioat_xstats_reset,
 };
 
 static void *
index ceeac92..a84be56 100644 (file)
@@ -273,5 +273,5 @@ int
 idxd_rawdev_test(uint16_t dev_id)
 {
        rte_rawdev_dump(dev_id, stdout);
-       return 0;
+       return ioat_rawdev_test(dev_id);
 }
index 89bfc8d..d0045d8 100644 (file)
@@ -184,6 +184,8 @@ struct rte_idxd_user_hdl {
  */
 struct rte_idxd_rawdev {
        enum rte_ioat_dev_type type;
+       struct rte_ioat_xstats xstats;
+
        void *portal; /* address to write the batch descriptor */
 
        /* counters to track the batches and the individual op handles */
@@ -369,9 +371,11 @@ __idxd_write_desc(int dev_id, const struct rte_idxd_hw_desc *desc,
        if (++idxd->next_free_hdl == idxd->hdl_ring_sz)
                idxd->next_free_hdl = 0;
 
+       idxd->xstats.enqueued++;
        return 1;
 
 failed:
+       idxd->xstats.enqueue_failed++;
        rte_errno = ENOSPC;
        return 0;
 }
@@ -429,6 +433,7 @@ __idxd_perform_ops(int dev_id)
 
        if (++idxd->next_batch == idxd->batch_ring_sz)
                idxd->next_batch = 0;
+       idxd->xstats.started = idxd->xstats.enqueued;
 }
 
 static __rte_always_inline int
@@ -466,6 +471,7 @@ __idxd_completed_ops(int dev_id, uint8_t max_ops,
 
        idxd->next_ret_hdl = h_idx;
 
+       idxd->xstats.completed += n;
        return n;
 }