From: Satheesh Paul <psathe...@marvell.com>

This patch adds filter_ctrl operation to enable rte_flow_ops.

Signed-off-by: Satheesh Paul <psathe...@marvell.com>
---
 drivers/common/cnxk/roc_npc.c      |  2 ++
 drivers/net/cnxk/cnxk_ethdev.c     |  3 +++
 drivers/net/cnxk/cnxk_ethdev.h     |  6 +++++-
 drivers/net/cnxk/cnxk_ethdev_ops.c | 21 +++++++++++++++++++++
 4 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index 0efe080..b862e23 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -645,6 +645,8 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct 
roc_npc_attr *attr,
        struct npc_flow_list *list;
        int rc;
 
+       npc->channel = roc_npc->channel;
+
        flow = plt_zmalloc(sizeof(*flow), 0);
        if (flow == NULL) {
                *errcode = NPC_ERR_NO_MEM;
diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index afe97f1..347428e 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -773,6 +773,8 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
                goto fail_configure;
        }
 
+       dev->npc.channel = roc_nix_get_base_chan(nix);
+
        nb_rxq = data->nb_rx_queues;
        nb_txq = data->nb_tx_queues;
        rc = -ENOMEM;
@@ -1176,6 +1178,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
        .rxq_info_get = cnxk_nix_rxq_info_get,
        .txq_info_get = cnxk_nix_txq_info_get,
        .tx_done_cleanup = cnxk_nix_tx_done_cleanup,
+       .filter_ctrl = cnxk_nix_filter_ctrl,
 };
 
 static int
diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h
index e3b0bc1..7cf7cf7 100644
--- a/drivers/net/cnxk/cnxk_ethdev.h
+++ b/drivers/net/cnxk/cnxk_ethdev.h
@@ -218,6 +218,8 @@ cnxk_eth_pmd_priv(struct rte_eth_dev *eth_dev)
 /* Common ethdev ops */
 extern struct eth_dev_ops cnxk_eth_dev_ops;
 
+extern const struct rte_flow_ops cnxk_flow_ops;
+
 /* Ops */
 int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
                   struct rte_pci_device *pci_dev);
@@ -255,7 +257,9 @@ int cnxk_nix_rx_queue_intr_disable(struct rte_eth_dev 
*eth_dev,
                                   uint16_t rx_queue_id);
 int cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool);
 int cnxk_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
-
+int cnxk_nix_filter_ctrl(struct rte_eth_dev *eth_dev,
+                        enum rte_filter_type filter_type,
+                        enum rte_filter_op filter_op, void *arg);
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
                            uint16_t nb_desc, uint16_t fp_tx_q_sz,
diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c 
b/drivers/net/cnxk/cnxk_ethdev_ops.c
index ff8afac..00f1fe7 100644
--- a/drivers/net/cnxk/cnxk_ethdev_ops.c
+++ b/drivers/net/cnxk/cnxk_ethdev_ops.c
@@ -294,6 +294,27 @@ cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,
 }
 
 int
+cnxk_nix_filter_ctrl(struct rte_eth_dev *eth_dev,
+                    enum rte_filter_type filter_type,
+                    enum rte_filter_op filter_op, void *arg)
+{
+       RTE_SET_USED(eth_dev);
+
+       if (filter_type != RTE_ETH_FILTER_GENERIC) {
+               plt_err("Unsupported filter type %d", filter_type);
+               return -ENOTSUP;
+       }
+
+       if (filter_op == RTE_ETH_FILTER_GET) {
+               *(const void **)arg = &cnxk_flow_ops;
+               return 0;
+       }
+
+       plt_err("Invalid filter_op %d", filter_op);
+       return -EINVAL;
+}
+
+int
 cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr)
 {
        struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
-- 
2.8.4

Reply via email to