1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(C) 2021 HiSilicon Limited 3 */ 4 5 #ifndef _HNS3_FLOW_H_ 6 #define _HNS3_FLOW_H_ 7 8 #include <rte_flow.h> 9 10 struct hns3_flow_counter { 11 LIST_ENTRY(hns3_flow_counter) next; /* Pointer to the next counter. */ 12 uint32_t indirect:1; /* Indirect counter flag */ 13 uint32_t ref_cnt:31; /* Reference counter. */ 14 uint16_t id; /* Counter ID. */ 15 uint64_t hits; /* Number of packets matched by the rule. */ 16 }; 17 18 struct rte_flow { 19 enum rte_filter_type filter_type; 20 void *rule; 21 uint32_t counter_id; 22 }; 23 24 /* rss filter list structure */ 25 struct hns3_rss_conf_ele { 26 TAILQ_ENTRY(hns3_rss_conf_ele) entries; 27 struct hns3_rss_conf filter_info; 28 }; 29 30 /* hns3_flow memory list structure */ 31 struct hns3_flow_mem { 32 TAILQ_ENTRY(hns3_flow_mem) entries; 33 struct rte_flow *flow; 34 }; 35 36 enum { 37 HNS3_INDIRECT_ACTION_TYPE_COUNT = 1, 38 }; 39 40 struct rte_flow_action_handle { 41 int indirect_type; 42 uint32_t counter_id; 43 }; 44 45 TAILQ_HEAD(hns3_rss_filter_list, hns3_rss_conf_ele); 46 TAILQ_HEAD(hns3_flow_mem_list, hns3_flow_mem); 47 48 int hns3_dev_flow_ops_get(struct rte_eth_dev *dev, 49 const struct rte_flow_ops **ops); 50 void hns3_flow_init(struct rte_eth_dev *dev); 51 void hns3_flow_uninit(struct rte_eth_dev *dev); 52 53 #endif /* _HNS3_FLOW_H_ */ 54