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>
#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
#include "hns3_fdir.h"
#include "hns3_stats.h"
#include "hns3_tm.h"
+#include "hns3_flow.h"
/* Vendor ID */
#define PCI_VENDOR_ID_HUAWEI 0x19e5
}
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);
#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 */
#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;
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
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.
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);
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_ */
#include "hns3_ethdev.h"
#include "hns3_logs.h"
+#include "hns3_flow.h"
/* Default default keys */
static uint8_t hns3_hash_key[] = {
--- /dev/null
+/* 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_ */