From: Sunil Kumar Kori <sk...@marvell.com>

To enable support for ingress meter, supported operations
are exposed for CN10K platform.

Signed-off-by: Sunil Kumar Kori <sk...@marvell.com>
Signed-off-by: Rakesh Kudurumalla <rkuduruma...@marvell.com>
---
v2:
 - Rebase support on latest DPDK
 - Handled multilevel chaining for linear hierarchy
 - Review comments incorporated

 drivers/net/cnxk/cn10k_ethdev.c     |  1 +
 drivers/net/cnxk/cn10k_ethdev.h     |  2 ++
 drivers/net/cnxk/cn10k_ethdev_mtr.c | 18 ++++++++++++++++++
 drivers/net/cnxk/meson.build        |  1 +
 4 files changed, 22 insertions(+)
 create mode 100644 drivers/net/cnxk/cn10k_ethdev_mtr.c

diff --git a/drivers/net/cnxk/cn10k_ethdev.c b/drivers/net/cnxk/cn10k_ethdev.c
index 7caec6cf14..8c1f6a4408 100644
--- a/drivers/net/cnxk/cn10k_ethdev.c
+++ b/drivers/net/cnxk/cn10k_ethdev.c
@@ -457,6 +457,7 @@ nix_eth_dev_ops_override(void)
        cnxk_eth_dev_ops.dev_ptypes_set = cn10k_nix_ptypes_set;
        cnxk_eth_dev_ops.timesync_enable = cn10k_nix_timesync_enable;
        cnxk_eth_dev_ops.timesync_disable = cn10k_nix_timesync_disable;
+       cnxk_eth_dev_ops.mtr_ops_get = cn10k_nix_mtr_ops_get;
 }
 
 static void
diff --git a/drivers/net/cnxk/cn10k_ethdev.h b/drivers/net/cnxk/cn10k_ethdev.h
index 8b6e0f2b3f..117aa2a62d 100644
--- a/drivers/net/cnxk/cn10k_ethdev.h
+++ b/drivers/net/cnxk/cn10k_ethdev.h
@@ -38,4 +38,6 @@ struct cn10k_eth_rxq {
 void cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev);
 void cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev);
 
+/* MTR */
+int cn10k_nix_mtr_ops_get(struct rte_eth_dev *dev, void *ops);
 #endif /* __CN10K_ETHDEV_H__ */
diff --git a/drivers/net/cnxk/cn10k_ethdev_mtr.c 
b/drivers/net/cnxk/cn10k_ethdev_mtr.c
new file mode 100644
index 0000000000..9b46032858
--- /dev/null
+++ b/drivers/net/cnxk/cn10k_ethdev_mtr.c
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include "cn10k_ethdev.h"
+#include <rte_mtr_driver.h>
+
+const struct rte_mtr_ops nix_mtr_ops = {
+};
+
+int
+cn10k_nix_mtr_ops_get(struct rte_eth_dev *dev, void *ops)
+{
+       RTE_SET_USED(dev);
+
+       *(const void **)ops = &nix_mtr_ops;
+       return 0;
+}
diff --git a/drivers/net/cnxk/meson.build b/drivers/net/cnxk/meson.build
index d4cdd1744a..91afc1de4c 100644
--- a/drivers/net/cnxk/meson.build
+++ b/drivers/net/cnxk/meson.build
@@ -35,6 +35,7 @@ sources += files(
 # CN10K
 sources += files(
         'cn10k_ethdev.c',
+        'cn10k_ethdev_mtr.c',
         'cn10k_rte_flow.c',
         'cn10k_rx.c',
         'cn10k_rx_mseg.c',
-- 
2.25.1

Reply via email to