net/mvpp2: add init and deinit to flow
authorTomasz Duszynski <tdu@semihalf.com>
Tue, 25 Sep 2018 07:05:01 +0000 (09:05 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 27 Sep 2018 23:41:03 +0000 (01:41 +0200)
Add init and deinit functionality to flow implementation.

Init puts structures used by flow in a sane sate.
Deinit deallocates all resources used by flow.

Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
Reviewed-by: Shlomi Gridish <sgridish@marvell.com>
drivers/net/mvpp2/mrvl_ethdev.c
drivers/net/mvpp2/mrvl_flow.c
drivers/net/mvpp2/mrvl_flow.h [new file with mode: 0644]

index 0571635..461f297 100644 (file)
@@ -23,6 +23,7 @@
 #include <rte_mvep_common.h>
 #include "mrvl_ethdev.h"
 #include "mrvl_qos.h"
+#include "mrvl_flow.h"
 #include "mrvl_mtr.h"
 
 /* bitmask with reserved hifs */
@@ -619,6 +620,7 @@ mrvl_dev_start(struct rte_eth_dev *dev)
                        goto out;
        }
 
+       mrvl_flow_init(dev);
        mrvl_mtr_init(dev);
 
        return 0;
@@ -759,6 +761,7 @@ mrvl_dev_close(struct rte_eth_dev *dev)
 
        mrvl_flush_rx_queues(dev);
        mrvl_flush_tx_shadow_queues(dev);
+       mrvl_flow_deinit(dev);
        mrvl_mtr_deinit(dev);
 
        for (i = 0; i < priv->ppio_params.inqs_params.num_tcs; ++i) {
index e6953e4..065b1aa 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <arpa/inet.h>
 
-#include "mrvl_ethdev.h"
+#include "mrvl_flow.h"
 #include "mrvl_qos.h"
 
 /** Number of rules in the classifier table. */
@@ -2790,3 +2790,34 @@ const struct rte_flow_ops mrvl_flow_ops = {
        .flush = mrvl_flow_flush,
        .isolate = mrvl_flow_isolate
 };
+
+/**
+ * Initialize flow resources.
+ *
+ * @param dev Pointer to the device.
+ */
+void
+mrvl_flow_init(struct rte_eth_dev *dev)
+{
+       struct mrvl_priv *priv = dev->data->dev_private;
+
+       LIST_INIT(&priv->flows);
+}
+
+/**
+ * Cleanup flow resources.
+ *
+ * @param dev Pointer to the device.
+ */
+void
+mrvl_flow_deinit(struct rte_eth_dev *dev)
+{
+       struct mrvl_priv *priv = dev->data->dev_private;
+
+       mrvl_flow_flush(dev, NULL);
+
+       if (priv->cls_tbl) {
+               pp2_cls_tbl_deinit(priv->cls_tbl);
+               priv->cls_tbl = NULL;
+       }
+}
diff --git a/drivers/net/mvpp2/mrvl_flow.h b/drivers/net/mvpp2/mrvl_flow.h
new file mode 100644 (file)
index 0000000..f63747c
--- /dev/null
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Marvell International Ltd.
+ * Copyright(c) 2018 Semihalf.
+ * All rights reserved.
+ */
+
+#ifndef _MRVL_FLOW_H_
+#define _MRVL_FLOW_H_
+
+#include "mrvl_ethdev.h"
+
+void mrvl_flow_init(struct rte_eth_dev *dev);
+void mrvl_flow_deinit(struct rte_eth_dev *dev);
+
+#endif /* _MRVL_FLOW_H_ */