1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef _DPAA2_SPARSER_H
14#define _DPAA2_SPARSER_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#define WRIOP_SS_INITIALIZER(priv) \
21do { \
22 \
23 (priv)->ss_offset = 0x20; \
24 (priv)->ss_iova = (size_t)NULL; \
25 (priv)->ss_param_iova = (size_t)NULL; \
26} while (0)
27
28
29
30
31
32
33
34enum parser_starting_hxs_code {
35
36 PARSER_ETH_STARTING_HXS = 0x0000,
37
38 PARSER_LLC_SNAP_STARTING_HXS = 0x0001,
39
40 PARSER_VLAN_STARTING_HXS = 0x0002,
41
42 PARSER_PPPOE_PPP_STARTING_HXS = 0x0003,
43
44 PARSER_MPLS_STARTING_HXS = 0x0004,
45
46 PARSER_ARP_STARTING_HXS = 0x0005,
47
48 PARSER_IP_STARTING_HXS = 0x0006,
49
50 PARSER_IPV4_STARTING_HXS = 0x0007,
51
52 PARSER_IPV6_STARTING_HXS = 0x0008,
53
54 PARSER_GRE_STARTING_HXS = 0x0009,
55
56 PARSER_MINENCAP_STARTING_HXS = 0x000A,
57
58 PARSER_OTHER_L3_SHELL_STARTING_HXS = 0x000B,
59
60 PARSER_TCP_STARTING_HXS = 0x000C,
61
62 PARSER_UDP_STARTING_HXS = 0x000D,
63
64 PARSER_IPSEC_STARTING_HXS = 0x000E,
65
66 PARSER_SCTP_STARTING_HXS = 0x000F,
67
68 PARSER_DCCP_STARTING_HXS = 0x0010,
69
70 PARSER_OTHER_L4_SHELL_STARTING_HXS = 0x0011,
71
72 PARSER_GTP_STARTING_HXS = 0x0012,
73
74 PARSER_ESP_STARTING_HXS = 0x0013,
75
76 PARSER_VXLAN_STARTING_HXS = 0x0014,
77
78 PARSER_L5_SHELL_STARTING_HXS = 0x001E,
79
80 PARSER_FINAL_SHELL_STARTING_HXS = 0x001F
81};
82
83
84
85
86
87
88
89
90struct dpni_drv_sparser_param {
91
92
93
94
95 uint8_t custom_header_first;
96
97
98
99
100 enum parser_starting_hxs_code link_to_hard_hxs;
101
102 uint16_t start_pc;
103
104 uint8_t *byte_code;
105
106 uint16_t size;
107
108 uint8_t *param_array;
109
110 uint8_t param_offset;
111
112 uint8_t param_size;
113};
114
115struct sp_parse_result {
116
117 uint16_t nxt_hdr;
118
119 uint16_t frame_attribute_flags_extension;
120
121 uint32_t frame_attribute_flags_1;
122
123 uint32_t frame_attribute_flags_2;
124
125 uint32_t frame_attribute_flags_3;
126
127 uint8_t shim_offset_1;
128
129 uint8_t shim_offset_2;
130
131 uint8_t ip_1_pid_offset;
132
133 uint8_t eth_offset;
134
135 uint8_t llc_snap_offset;
136
137 uint8_t vlan_tci1_offset;
138
139 uint8_t vlan_tcin_offset;
140
141 uint8_t last_etype_offset;
142
143 uint8_t pppoe_offset;
144
145 uint8_t mpls_offset_1;
146
147 uint8_t mpls_offset_n;
148
149 uint8_t l3_offset;
150
151 uint8_t ipn_or_minencap_offset;
152
153 uint8_t gre_offset;
154
155 uint8_t l4_offset;
156
157 uint8_t l5_offset;
158
159 uint8_t routing_hdr_offset1;
160
161 uint8_t routing_hdr_offset2;
162
163 uint8_t nxt_hdr_offset;
164
165 uint8_t ipv6_frag_offset;
166
167 uint16_t gross_running_sum;
168
169 uint16_t running_sum;
170
171 uint8_t parse_error_code;
172
173 uint8_t nxt_hdr_before_ipv6_frag_ext;
174
175 uint8_t ip_n_pid_offset;
176
177 uint8_t soft_parsing_context[21];
178};
179
180struct frame_attr {
181 const char *fld_name;
182 uint8_t faf_offset;
183 uint32_t fld_mask;
184};
185
186struct frame_attr_ext {
187 const char *fld_name;
188 uint8_t faf_ext_offset;
189 uint16_t fld_mask;
190};
191
192
193struct parse_err {
194 uint16_t code;
195 const char *err_name;
196};
197
198
199#define IS_ONE_BIT_FIELD(_mask) \
200(!((_mask) & ((_mask) - 1)) || (_mask == 1))
201
202int dpaa2_eth_load_wriop_soft_parser(struct dpaa2_dev_priv *priv,
203 enum dpni_soft_sequence_dest dest);
204int dpaa2_eth_enable_wriop_soft_parser(struct dpaa2_dev_priv *priv,
205 enum dpni_soft_sequence_dest dest);
206#endif
207