ethdev: add API to dump device internal flow info
authorXiaoyu Min <jackmin@mellanox.com>
Fri, 17 Jan 2020 11:55:59 +0000 (13:55 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 17 Jan 2020 18:59:19 +0000 (19:59 +0100)
Introduce an API which dump the device's internal representation
information of rte flows in hardware.

Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
lib/librte_ethdev/rte_ethdev_version.map
lib/librte_ethdev/rte_flow.c
lib/librte_ethdev/rte_flow.h
lib/librte_ethdev/rte_flow_driver.h

index a7dacf2..3f32fde 100644 (file)
@@ -227,4 +227,7 @@ EXPERIMENTAL {
        rte_flow_dynf_metadata_mask;
        rte_flow_dynf_metadata_register;
        rte_eth_dev_set_ptypes;
+
+       # added in 20.02
+       rte_flow_dev_dump;
 };
index 26b4f75..885a7ff 100644 (file)
@@ -1215,3 +1215,19 @@ rte_flow_expand_rss(struct rte_flow_expand_rss *buf, size_t size,
        }
        return lsize;
 }
+
+int
+rte_flow_dev_dump(uint16_t port_id, FILE *file, struct rte_flow_error *error)
+{
+       struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+       const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error);
+
+       if (unlikely(!ops))
+               return -rte_errno;
+       if (likely(!!ops->dev_dump))
+               return flow_err(port_id, ops->dev_dump(dev, file, error),
+                               error);
+       return rte_flow_error_set(error, ENOSYS,
+                                 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+                                 NULL, rte_strerror(ENOSYS));
+}
index 706dcfb..c531c6e 100644 (file)
@@ -2848,6 +2848,27 @@ enum rte_flow_conv_op {
        RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
 };
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Dump hardware internal representation information of
+ * rte flow to file.
+ *
+ * @param[in] port_id
+ *    The port identifier of the Ethernet device.
+ * @param[in] file
+ *   A pointer to a file for output.
+ * @param[out] error
+ *   Perform verbose error reporting if not NULL. PMDs initialize this
+ *   structure in case of error only.
+ * @return
+ *   0 on success, a nagative value otherwise.
+ */
+__rte_experimental
+int
+rte_flow_dev_dump(uint16_t port_id, FILE *file, struct rte_flow_error *error);
+
 /**
  * Check if mbuf dynamic field for metadata is registered.
  *
index a035985..51a9a57 100644 (file)
@@ -96,6 +96,11 @@ struct rte_flow_ops {
                (struct rte_eth_dev *,
                 int,
                 struct rte_flow_error *);
+       /** See rte_flow_dev_dump(). */
+       int (*dev_dump)
+               (struct rte_eth_dev *dev,
+                FILE *file,
+                struct rte_flow_error *error);
 };
 
 /**