xref: /dpdk/drivers/net/ntnic/include/stream_binary_flow_api.h (revision 7fa0bf29e667c12dc32a8cfd6330a639adcf1358)
1 /*
2  * SPDX-License-Identifier: BSD-3-Clause
3  * Copyright(c) 2023 Napatech A/S
4  */
5 
6 #ifndef _STREAM_BINARY_FLOW_API_H_
7 #define _STREAM_BINARY_FLOW_API_H_
8 
9 #include "rte_flow.h"
10 #include "rte_flow_driver.h"
11 
12 /* Max RSS hash key length in bytes */
13 #define MAX_RSS_KEY_LEN 40
14 
15 /* NT specific MASKs for RSS configuration */
16 /* NOTE: Masks are required for correct RSS configuration, do not modify them! */
17 #define NT_ETH_RSS_IPV4_MASK                                                                      \
18 	(RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_OTHER |              \
19 	 RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_NONFRAG_IPV4_TCP |                           \
20 	 RTE_ETH_RSS_NONFRAG_IPV4_UDP)
21 
22 #define NT_ETH_RSS_IPV6_MASK                                                                      \
23 	(RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_IPV6_EX |                         \
24 	 RTE_ETH_RSS_IPV6_TCP_EX | RTE_ETH_RSS_IPV6_UDP_EX | RTE_ETH_RSS_NONFRAG_IPV6_OTHER |     \
25 	 RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_NONFRAG_IPV6_TCP |                           \
26 	 RTE_ETH_RSS_NONFRAG_IPV6_UDP)
27 
28 #define NT_ETH_RSS_IP_MASK                                                                        \
29 	(NT_ETH_RSS_IPV4_MASK | NT_ETH_RSS_IPV6_MASK | RTE_ETH_RSS_L3_SRC_ONLY |                  \
30 	 RTE_ETH_RSS_L3_DST_ONLY)
31 
32 /* List of all RSS flags supported for RSS calculation offload */
33 #define NT_ETH_RSS_OFFLOAD_MASK                                                                   \
34 	(RTE_ETH_RSS_ETH | RTE_ETH_RSS_L2_PAYLOAD | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP |            \
35 	 RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_SRC_ONLY | RTE_ETH_RSS_L2_DST_ONLY | \
36 	 RTE_ETH_RSS_L4_SRC_ONLY | RTE_ETH_RSS_L4_DST_ONLY | RTE_ETH_RSS_L3_SRC_ONLY |            \
37 	 RTE_ETH_RSS_L3_DST_ONLY | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_LEVEL_MASK |                    \
38 	 RTE_ETH_RSS_IPV4_CHKSUM | RTE_ETH_RSS_L4_CHKSUM | RTE_ETH_RSS_PORT | RTE_ETH_RSS_GTPU)
39 
40 /*
41  * Flow frontend for binary programming interface
42  */
43 
44 #define FLOW_MAX_QUEUES 128
45 
46 #define RAW_ENCAP_DECAP_ELEMS_MAX 16
47 /*
48  * Flow eth dev profile determines how the FPGA module resources are
49  * managed and what features are available
50  */
51 enum flow_eth_dev_profile {
52 	FLOW_ETH_DEV_PROFILE_INLINE = 0,
53 };
54 
55 struct flow_queue_id_s {
56 	int id;
57 	int hw_id;
58 };
59 
60 /*
61  * RTE_FLOW_ACTION_TYPE_RAW_ENCAP
62  */
63 struct flow_action_raw_encap {
64 	uint8_t *data;
65 	uint8_t *preserve;
66 	size_t size;
67 	struct rte_flow_item items[RAW_ENCAP_DECAP_ELEMS_MAX];
68 	int item_count;
69 };
70 
71 /*
72  * RTE_FLOW_ACTION_TYPE_RAW_DECAP
73  */
74 struct flow_action_raw_decap {
75 	uint8_t *data;
76 	size_t size;
77 	struct rte_flow_item items[RAW_ENCAP_DECAP_ELEMS_MAX];
78 	int item_count;
79 };
80 
81 struct flow_eth_dev;             /* port device */
82 struct flow_handle;
83 
84 #endif  /* _STREAM_BINARY_FLOW_API_H_ */
85