DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <andrew.rybchenko@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH v2 6/9] net/hns3: add hns3 flow header file
Date: Fri, 5 Nov 2021 10:46:54 +0800	[thread overview]
Message-ID: <20211105024657.60302-7-humin29@huawei.com> (raw)
In-Reply-To: <20211105024657.60302-1-humin29@huawei.com>

This patch adds a hns3_flow.h to make the code easier to maintain.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    |  1 +
 drivers/net/hns3/hns3_ethdev.h    |  3 +--
 drivers/net/hns3/hns3_ethdev_vf.c |  1 +
 drivers/net/hns3/hns3_fdir.h      | 31 ----------------------
 drivers/net/hns3/hns3_flow.c      |  1 +
 drivers/net/hns3/hns3_flow.h      | 44 +++++++++++++++++++++++++++++++
 6 files changed, 48 insertions(+), 33 deletions(-)
 create mode 100644 drivers/net/hns3/hns3_flow.h

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 2ddd29515a..181694bf8c 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -15,6 +15,7 @@
 #include "hns3_regs.h"
 #include "hns3_dcb.h"
 #include "hns3_mp.h"
+#include "hns3_flow.h"
 
 #define HNS3_SERVICE_INTERVAL		1000000 /* us */
 #define HNS3_SERVICE_QUICK_INTERVAL	10
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 634018c847..a28c7c262b 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -17,6 +17,7 @@
 #include "hns3_fdir.h"
 #include "hns3_stats.h"
 #include "hns3_tm.h"
+#include "hns3_flow.h"
 
 /* Vendor ID */
 #define PCI_VENDOR_ID_HUAWEI			0x19e5
@@ -1034,8 +1035,6 @@ hns3_test_and_clear_bit(unsigned int nr, volatile uint64_t *addr)
 uint32_t hns3_get_speed_capa(struct hns3_hw *hw);
 
 int hns3_buffer_alloc(struct hns3_hw *hw);
-int hns3_dev_flow_ops_get(struct rte_eth_dev *dev,
-			  const struct rte_flow_ops **ops);
 bool hns3_is_reset_pending(struct hns3_adapter *hns);
 bool hns3vf_is_reset_pending(struct hns3_adapter *hns);
 void hns3_update_linkstatus_and_event(struct hns3_hw *hw, bool query);
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 1df8966cea..8632c8f19b 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -17,6 +17,7 @@
 #include "hns3_intr.h"
 #include "hns3_dcb.h"
 #include "hns3_mp.h"
+#include "hns3_flow.h"
 
 #define HNS3VF_KEEP_ALIVE_INTERVAL	2000000 /* us */
 #define HNS3VF_SERVICE_INTERVAL		1000000 /* us */
diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h
index 3f610f7b11..f9efff3b52 100644
--- a/drivers/net/hns3/hns3_fdir.h
+++ b/drivers/net/hns3/hns3_fdir.h
@@ -5,8 +5,6 @@
 #ifndef _HNS3_FDIR_H_
 #define _HNS3_FDIR_H_
 
-#include <rte_flow.h>
-
 struct hns3_fd_key_cfg {
 	uint8_t key_sel;
 	uint8_t inner_sipv6_word_en;
@@ -124,14 +122,6 @@ struct hns3_fd_ad_data {
 	uint16_t rule_id;
 };
 
-struct hns3_flow_counter {
-	LIST_ENTRY(hns3_flow_counter) next; /* Pointer to the next counter. */
-	uint32_t shared:1;   /* Share counter ID with other flow rules. */
-	uint32_t ref_cnt:31; /* Reference counter. */
-	uint16_t id;   /* Counter ID. */
-	uint64_t hits; /* Number of packets matched by the rule. */
-};
-
 #define HNS3_RULE_FLAG_FDID		0x1
 #define HNS3_RULE_FLAG_VF_ID		0x2
 #define HNS3_RULE_FLAG_COUNTER		0x4
@@ -173,21 +163,7 @@ struct hns3_fdir_rule_ele {
 	struct hns3_fdir_rule fdir_conf;
 };
 
-/* rss filter list structure */
-struct hns3_rss_conf_ele {
-	TAILQ_ENTRY(hns3_rss_conf_ele) entries;
-	struct hns3_rss_conf filter_info;
-};
-
-/* hns3_flow memory list structure */
-struct hns3_flow_mem {
-	TAILQ_ENTRY(hns3_flow_mem) entries;
-	struct rte_flow *flow;
-};
-
 TAILQ_HEAD(hns3_fdir_rule_list, hns3_fdir_rule_ele);
-TAILQ_HEAD(hns3_rss_filter_list, hns3_rss_conf_ele);
-TAILQ_HEAD(hns3_flow_mem_list, hns3_flow_mem);
 
 /*
  *  A structure used to define fields of a FDIR related info.
@@ -199,11 +175,6 @@ struct hns3_fdir_info {
 	struct hns3_fd_cfg fd_cfg;
 };
 
-struct rte_flow {
-	enum rte_filter_type filter_type;
-	void *rule;
-	uint32_t counter_id;
-};
 struct hns3_adapter;
 
 int hns3_init_fd_config(struct hns3_adapter *hns);
@@ -213,8 +184,6 @@ int hns3_fdir_filter_program(struct hns3_adapter *hns,
 			     struct hns3_fdir_rule *rule, bool del);
 int hns3_clear_all_fdir_filter(struct hns3_adapter *hns);
 int hns3_get_count(struct hns3_hw *hw, uint32_t id, uint64_t *value);
-void hns3_flow_init(struct rte_eth_dev *dev);
-void hns3_flow_uninit(struct rte_eth_dev *dev);
 int hns3_restore_all_fdir_filter(struct hns3_adapter *hns);
 
 #endif /* _HNS3_FDIR_H_ */
diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index da6918fddd..9f2f9cb6cd 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -8,6 +8,7 @@
 
 #include "hns3_ethdev.h"
 #include "hns3_logs.h"
+#include "hns3_flow.h"
 
 /* Default default keys */
 static uint8_t hns3_hash_key[] = {
diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h
new file mode 100644
index 0000000000..2eb451b720
--- /dev/null
+++ b/drivers/net/hns3/hns3_flow.h
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 HiSilicon Limited
+ */
+
+#ifndef _HNS3_FLOW_H_
+#define _HNS3_FLOW_H_
+
+#include <rte_flow.h>
+
+struct hns3_flow_counter {
+	LIST_ENTRY(hns3_flow_counter) next; /* Pointer to the next counter. */
+	uint32_t shared:1;   /* Share counter ID with other flow rules. */
+	uint32_t ref_cnt:31; /* Reference counter. */
+	uint16_t id;   /* Counter ID. */
+	uint64_t hits; /* Number of packets matched by the rule. */
+};
+
+struct rte_flow {
+	enum rte_filter_type filter_type;
+	void *rule;
+	uint32_t counter_id;
+};
+
+/* rss filter list structure */
+struct hns3_rss_conf_ele {
+	TAILQ_ENTRY(hns3_rss_conf_ele) entries;
+	struct hns3_rss_conf filter_info;
+};
+
+/* hns3_flow memory list structure */
+struct hns3_flow_mem {
+	TAILQ_ENTRY(hns3_flow_mem) entries;
+	struct rte_flow *flow;
+};
+
+TAILQ_HEAD(hns3_rss_filter_list, hns3_rss_conf_ele);
+TAILQ_HEAD(hns3_flow_mem_list, hns3_flow_mem);
+
+int hns3_dev_flow_ops_get(struct rte_eth_dev *dev,
+			  const struct rte_flow_ops **ops);
+void hns3_flow_init(struct rte_eth_dev *dev);
+void hns3_flow_uninit(struct rte_eth_dev *dev);
+
+#endif /* _HNS3_FLOW_H_ */
-- 
2.33.0


  parent reply	other threads:[~2021-11-05  2:49 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02  3:17 [dpdk-dev] [PATCH 0/9] code optimization for hns3 PMD Min Hu (Connor)
2021-11-02  3:17 ` [dpdk-dev] [PATCH 1/9] net/hns3: fix the shift of DMA address in Rx/Tx queue Min Hu (Connor)
2021-11-02  3:17 ` [dpdk-dev] [PATCH 2/9] net/hns3: remove a redundant function declaration Min Hu (Connor)
2021-11-02  3:17 ` [dpdk-dev] [PATCH 3/9] net/hns3: modifying code alignment Min Hu (Connor)
2021-11-02  3:17 ` [dpdk-dev] [PATCH 4/9] net/hns3: use unsigned integer for bitwise operations Min Hu (Connor)
2021-11-02  3:17 ` [dpdk-dev] [PATCH 5/9] net/hns3: extract a common file Min Hu (Connor)
2021-11-02  3:17 ` [dpdk-dev] [PATCH 6/9] net/hns3: add hns3 flow header file Min Hu (Connor)
2021-11-02  3:17 ` [dpdk-dev] [PATCH 7/9] net/hns3: remove magic numbers Min Hu (Connor)
2021-11-02  3:17 ` [dpdk-dev] [PATCH 8/9] net/hns3: fix the return value of the function Min Hu (Connor)
2021-11-02  3:17 ` [dpdk-dev] [PATCH 9/9] net/hns3: remove PF/VF duplicate code Min Hu (Connor)
2021-11-04 14:55   ` Ferruh Yigit
2021-11-05  2:49     ` Min Hu (Connor)
2021-11-05  2:46 ` [dpdk-dev] [PATCH v2 0/9] code optimization for hns3 PMD Min Hu (Connor)
2021-11-05  2:46   ` [dpdk-dev] [PATCH v2 1/9] net/hns3: fix the shift of DMA address in Rx/Tx queue Min Hu (Connor)
2021-11-05 17:03     ` Ferruh Yigit
2021-11-05 17:05     ` Ferruh Yigit
2021-11-05  2:46   ` [dpdk-dev] [PATCH v2 2/9] net/hns3: remove a redundant function declaration Min Hu (Connor)
2021-11-05  2:46   ` [dpdk-dev] [PATCH v2 3/9] net/hns3: modifying code alignment Min Hu (Connor)
2021-11-05  2:46   ` [dpdk-dev] [PATCH v2 4/9] net/hns3: use unsigned integer for bitwise operations Min Hu (Connor)
2021-11-05  2:46   ` [dpdk-dev] [PATCH v2 5/9] net/hns3: extract a common file Min Hu (Connor)
2021-11-05 17:11     ` Ferruh Yigit
2021-11-05  2:46   ` Min Hu (Connor) [this message]
2021-11-05  2:46   ` [dpdk-dev] [PATCH v2 7/9] net/hns3: remove magic numbers Min Hu (Connor)
2021-11-05  2:46   ` [dpdk-dev] [PATCH v2 8/9] net/hns3: fix the return value of the function Min Hu (Connor)
2021-11-05 17:04     ` Ferruh Yigit
2021-11-05  2:46   ` [dpdk-dev] [PATCH v2 9/9] net/hns3: remove PF/VF duplicate code Min Hu (Connor)
2021-11-05 17:02     ` Ferruh Yigit
2021-11-06  1:42 ` [dpdk-dev] [PATCH v3 0/9] code optimization for hns3 PMD Min Hu (Connor)
2021-11-06  1:42   ` [dpdk-dev] [PATCH v3 1/9] net/hns3: fix the shift of DMA address in Rx/Tx queue Min Hu (Connor)
2021-11-06  1:42   ` [dpdk-dev] [PATCH v3 2/9] net/hns3: remove a redundant function declaration Min Hu (Connor)
2021-11-06  1:43   ` [dpdk-dev] [PATCH v3 3/9] net/hns3: modifying code alignment Min Hu (Connor)
2021-11-06  1:43   ` [dpdk-dev] [PATCH v3 4/9] net/hns3: use unsigned integer for bitwise operations Min Hu (Connor)
2021-11-06  1:43   ` [dpdk-dev] [PATCH v3 5/9] net/hns3: extract a common file Min Hu (Connor)
2021-11-06  1:43   ` [dpdk-dev] [PATCH v3 6/9] net/hns3: add hns3 flow header file Min Hu (Connor)
2021-11-06  1:43   ` [dpdk-dev] [PATCH v3 7/9] net/hns3: remove magic numbers Min Hu (Connor)
2021-11-06  1:43   ` [dpdk-dev] [PATCH v3 8/9] net/hns3: fix the return value of the function Min Hu (Connor)
2021-11-06  1:43   ` [dpdk-dev] [PATCH v3 9/9] net/hns3: remove PF/VF duplicate code Min Hu (Connor)
2021-11-08 15:13   ` [dpdk-dev] [PATCH v3 0/9] code optimization for hns3 PMD Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211105024657.60302-7-humin29@huawei.com \
    --to=humin29@huawei.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).