sync patches ranges from versoin 9 t0 17 from master branch Signed-off-by: speech_white <humin29@huawei.com>
192 lines
5.7 KiB
Diff
192 lines
5.7 KiB
Diff
From f50d0076e2e9dad6e94fcc64108fb52592bf5c00 Mon Sep 17 00:00:00 2001
|
|
From: "Min Hu (Connor)" <humin29@huawei.com>
|
|
Date: Sat, 6 Nov 2021 09:43:03 +0800
|
|
Subject: [PATCH 29/33] net/hns3: move declarations in flow header file
|
|
|
|
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 | 1 +
|
|
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(+), 31 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 818835391..5a826c7aa 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 96671159b..960f781e1 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
|
|
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
|
|
index c234e74b8..84ae26987 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 3f610f7b1..f9efff3b5 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 b25fccbca..73ef91ce9 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 000000000..2eb451b72
|
|
--- /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
|
|
|