[v5,07/14] net/bonding: create new rte flow header file

Message ID 20231226023745.3144143-8-chaoyong.he@corigine.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series Enhance the bond framework to support offload |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chaoyong He Dec. 26, 2023, 2:37 a.m. UTC
  From: Long Wu <long.wu@corigine.com>

Move the flow code to a new head file to make flow related
code more clean and make the code architecture more reasonable
in the future. There is no functional change, just moving
verbatim code around.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: James Hershaw <james.hershaw@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/bonding/eth_bond_private.h  | 13 -------------
 drivers/net/bonding/rte_eth_bond_api.c  |  1 +
 drivers/net/bonding/rte_eth_bond_flow.c |  1 +
 drivers/net/bonding/rte_eth_bond_flow.h | 22 ++++++++++++++++++++++
 drivers/net/bonding/rte_eth_bond_pmd.c  |  1 +
 5 files changed, 25 insertions(+), 13 deletions(-)
 create mode 100644 drivers/net/bonding/rte_eth_bond_flow.h
  

Patch

diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h
index f9603a0f6b..4373465d8d 100644
--- a/drivers/net/bonding/eth_bond_private.h
+++ b/drivers/net/bonding/eth_bond_private.h
@@ -9,10 +9,8 @@ 
 #include <sys/queue.h>
 
 #include <ethdev_driver.h>
-#include <rte_flow.h>
 #include <rte_spinlock.h>
 #include <rte_bitmap.h>
-#include <rte_flow_driver.h>
 
 #include "rte_eth_bond.h"
 #include "eth_bond_8023ad_private.h"
@@ -47,8 +45,6 @@  extern const char *pmd_bond_init_valid_arguments[];
 
 extern struct rte_vdev_driver pmd_bond_drv;
 
-extern const struct rte_flow_ops bond_flow_ops;
-
 /** Port Queue Mapping Structure */
 struct bond_rx_queue {
 	uint16_t queue_id;
@@ -94,15 +90,6 @@  struct bond_member_details {
 	uint16_t reta_size;
 };
 
-struct rte_flow {
-	TAILQ_ENTRY(rte_flow) next;
-	/* Members flows */
-	struct rte_flow *flows[RTE_MAX_ETHPORTS];
-	/* Flow description for synchronization */
-	struct rte_flow_conv_rule rule;
-	uint8_t rule_data[];
-};
-
 typedef void (*burst_xmit_hash_t)(struct rte_mbuf **buf, uint16_t nb_pkts,
 		uint16_t member_count, uint16_t *members);
 
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 5e9437c786..0a296d3894 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -12,6 +12,7 @@ 
 #include <rte_kvargs.h>
 
 #include "rte_eth_bond.h"
+#include "rte_eth_bond_flow.h"
 #include "eth_bond_private.h"
 #include "eth_bond_8023ad_private.h"
 
diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c
index 71a91675f7..e6c7ce5362 100644
--- a/drivers/net/bonding/rte_eth_bond_flow.c
+++ b/drivers/net/bonding/rte_eth_bond_flow.c
@@ -1,6 +1,7 @@ 
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2018 Mellanox Technologies, Ltd
  */
+#include "rte_eth_bond_flow.h"
 
 #include <stddef.h>
 #include <string.h>
diff --git a/drivers/net/bonding/rte_eth_bond_flow.h b/drivers/net/bonding/rte_eth_bond_flow.h
new file mode 100644
index 0000000000..7394e0e2e1
--- /dev/null
+++ b/drivers/net/bonding/rte_eth_bond_flow.h
@@ -0,0 +1,22 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2023 Corigine, Inc.
+ */
+
+#ifndef _RTE_ETH_BOND_FLOW_H_
+#define _RTE_ETH_BOND_FLOW_H_
+
+#include <rte_flow.h>
+#include <rte_flow_driver.h>
+
+extern const struct rte_flow_ops bond_flow_ops;
+
+struct rte_flow {
+	TAILQ_ENTRY(rte_flow) next;
+	struct rte_flow *flows[RTE_MAX_ETHPORTS];
+	/**< Member ports flows */
+	struct rte_flow_conv_rule rule;
+	/**< Flow description for synchronization */
+	uint8_t rule_data[];
+};
+
+#endif /* _RTE_ETH_BOND_FLOW_H_ */
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index b3a37a36c8..650f8061a2 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -21,6 +21,7 @@ 
 #include <rte_string_fns.h>
 
 #include "rte_eth_bond.h"
+#include "rte_eth_bond_flow.h"
 #include "eth_bond_private.h"
 #include "eth_bond_8023ad_private.h"