4 * Copyright (C) Cavium Inc. 2017. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of Cavium networks nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #ifndef __OCTEONTX_PKI_H__
34 #define __OCTEONTX_PKI_H__
38 #include <rte_pmd_octeontx_ssovf.h>
40 #define OCTEONTX_PKI_COPROC 5
44 #define MBOX_PKI_PORT_OPEN 1
45 #define MBOX_PKI_PORT_START 2
46 #define MBOX_PKI_PORT_STOP 3
47 #define MBOX_PKI_PORT_CLOSE 4
48 #define MBOX_PKI_PORT_CONFIG 5
49 #define MBOX_PKI_PORT_OPT_PARSER_CONFIG 6
50 #define MBOX_PKI_PORT_CUSTOM_PARSER_CONFIG 7
51 #define MBOX_PKI_PORT_PKTBUF_CONFIG 8
52 #define MBOX_PKI_PORT_HASH_CONFIG 9
53 #define MBOX_PKI_PORT_ERRCHK_CONFIG 10
54 #define MBOX_PKI_PORT_CREATE_QOS 11
55 #define MBOX_PKI_PORT_MODIFY_QOS 12
56 #define MBOX_PKI_PORT_DELETE_QOS 13
57 #define MBOX_PKI_PORT_PKTDROP_CONFIG 14
58 #define MBOX_PKI_PORT_WQE_GEN_CONFIG 15
59 #define MBOX_PKI_BACKPRESSURE_CONFIG 16
60 #define MBOX_PKI_PORT_GET_STATS 17
61 #define MBOX_PKI_PORT_RESET_STATS 18
62 #define MBOX_PKI_GET_PORT_CONFIG 19
63 #define MBOX_PKI_GET_PORT_QOS_CONFIG 20
65 #define MBOX_PKI_MAX_QOS_ENTRY 64
67 /* pki pkind parse mode */
69 MBOX_PKI_PARSE_LA_TO_LG = 0,
70 MBOX_PKI_PARSE_LB_TO_LG = 1,
71 MBOX_PKI_PARSE_LC_TO_LG = 3,
72 MBOX_PKI_PARSE_LG = 0x3f,
73 MBOX_PKI_PARSE_NOTHING = 0x7f
76 /* Interface types: */
78 OCTTX_PORT_TYPE_NET, /* Network interface ports */
79 OCTTX_PORT_TYPE_INT, /* CPU internal interface ports */
80 OCTTX_PORT_TYPE_PCI, /* DPI/PCIe interface ports */
85 typedef struct mbox_pki_port_type {
90 typedef struct mbox_pki_port_cfg {
97 uint8_t inst_hdr_parse:1;
107 uint8_t inst_hdr_parse;
112 } mbox_pki_prt_cfg_t;
114 /* pki Flow/style packet buffer config */
115 typedef struct mbox_pki_port_pktbuf_cfg {
118 uint16_t f_mbuff_size:1;
119 uint16_t f_wqe_skip:1;
120 uint16_t f_first_skip:1;
121 uint16_t f_later_skip:1;
122 uint16_t f_pkt_outside_wqe:1;
123 uint16_t f_wqe_endian:1;
124 uint16_t f_cache_mode:1;
130 uint8_t pkt_outside_wqe;
133 } mbox_pki_pktbuf_cfg_t;
135 /* pki flow/style tag config */
136 typedef struct mbox_pki_port_hash_cfg {
147 uint32_t tag_vlan0:1;
148 uint32_t tag_vlan1:1;
149 uint32_t tag_ip_pctl:1;
154 } mbox_pki_hash_cfg_t;
156 /* pki flow/style errcheck config */
157 typedef struct mbox_pki_port_errcheck_cfg {
160 uint32_t f_ip6_udp_opt:1;
161 uint32_t f_lenerr_en:1;
162 uint32_t f_maxerr_en:1;
163 uint32_t f_minerr_en:1;
164 uint32_t f_fcs_chk:1;
165 uint32_t f_fcs_strip:1;
170 uint32_t f_csum_lf:1;
171 uint32_t f_csum_le:1;
172 uint32_t f_csum_ld:1;
173 uint32_t f_csum_lc:1;
174 uint32_t f_min_frame_len;
175 uint32_t f_max_frame_len;
177 uint64_t ip6_udp_opt:1;
178 uint64_t lenerr_en:1;
179 uint64_t maxerr_en:1;
180 uint64_t minerr_en:1;
182 uint64_t fcs_strip:1;
191 uint64_t min_frame_len;
192 uint64_t max_frame_len;
193 } mbox_pki_errcheck_cfg_t;
197 MBOX_PKI_OPC_MODE_STT = 0LL,
198 MBOX_PKI_OPC_MODE_STF = 1LL,
199 MBOX_PKI_OPC_MODE_STF1_STT = 2LL,
200 MBOX_PKI_OPC_MODE_STF2_STT = 3LL
205 MBOX_PKI_QPG_QOS_NONE = 0,
206 MBOX_PKI_QPG_QOS_VLAN,
207 MBOX_PKI_QPG_QOS_MPLS,
208 MBOX_PKI_QPG_QOS_DSA_SRC,
209 MBOX_PKI_QPG_QOS_DIFFSERV,
210 MBOX_PKI_QPG_QOS_HIGIG,
213 struct mbox_pki_qos_entry {
222 /* pki flow/style enable qos */
223 typedef struct mbox_pki_port_create_qos {
229 struct mbox_pki_qos_entry qos_entry[MBOX_PKI_MAX_QOS_ENTRY];
230 } mbox_pki_qos_cfg_t;
232 /* pki flow/style enable qos */
233 typedef struct mbox_pki_port_modify_qos_entry {
237 uint8_t f_port_add:1;
241 uint8_t f_grptag_ok:1;
242 uint8_t f_grptag_bad:1;
244 struct mbox_pki_qos_entry qos_entry;
245 } mbox_pki_mod_qos_t;
247 /* PKI maximum constants */
248 #define PKI_VF_MAX (1)
249 #define PKI_MAX_PKTLEN (32768)
251 /* pki pkind parse mode */
253 PKI_PARSE_LA_TO_LG = 0,
254 PKI_PARSE_LB_TO_LG = 1,
255 PKI_PARSE_LC_TO_LG = 3,
257 PKI_PARSE_NOTHING = 0x7f
260 /* pki port config */
261 typedef struct pki_port_cfg {
266 uint8_t parse_mode:1;
267 uint8_t mpls_parse:1;
268 uint8_t inst_hdr_parse:1;
269 uint8_t fulc_parse:1;
278 uint8_t inst_hdr_parse;
286 /* pki Flow/style packet buffer config */
287 typedef struct pki_port_pktbuf_cfg {
290 uint16_t f_mbuff_size:1;
291 uint16_t f_wqe_skip:1;
292 uint16_t f_first_skip:1;
293 uint16_t f_later_skip:1;
294 uint16_t f_pkt_outside_wqe:1;
295 uint16_t f_wqe_endian:1;
296 uint16_t f_cache_mode:1;
302 uint8_t pkt_outside_wqe;
307 /* pki flow/style tag config */
308 typedef struct pki_port_hash_cfg {
319 uint32_t tag_vlan0:1;
320 uint32_t tag_vlan1:1;
321 uint32_t tag_ip_pctl:1;
328 /* pki flow/style errcheck config */
329 typedef struct pki_port_errcheck_cfg {
332 uint32_t f_ip6_udp_opt:1;
333 uint32_t f_lenerr_en:1;
334 uint32_t f_maxerr_en:1;
335 uint32_t f_minerr_en:1;
336 uint32_t f_fcs_chk:1;
337 uint32_t f_fcs_strip:1;
342 uint32_t f_csum_lf:1;
343 uint32_t f_csum_le:1;
344 uint32_t f_csum_ld:1;
345 uint32_t f_csum_lc:1;
346 uint32_t f_min_frame_len;
347 uint32_t f_max_frame_len;
349 uint64_t ip6_udp_opt:1;
350 uint64_t lenerr_en:1;
351 uint64_t maxerr_en:1;
352 uint64_t minerr_en:1;
354 uint64_t fcs_strip:1;
363 uint64_t min_frame_len;
364 uint64_t max_frame_len;
370 PKI_OPC_MODE_STT = 0LL,
371 PKI_OPC_MODE_STF = 1LL,
372 PKI_OPC_MODE_STF1_STT = 2LL,
373 PKI_OPC_MODE_STF2_STT = 3LL
378 PKI_QPG_QOS_NONE = 0,
382 PKI_QPG_QOS_DIFFSERV,
386 struct pki_qos_entry {
397 #define PKO_MAX_QOS_ENTRY 64
399 /* pki flow/style enable qos */
400 typedef struct pki_port_create_qos {
406 struct pki_qos_entry qos_entry[PKO_MAX_QOS_ENTRY];
409 /* pki flow/style enable qos */
410 typedef struct pki_port_modify_qos_entry {
414 uint8_t f_port_add:1;
419 struct pki_qos_entry qos_entry;
422 int octeontx_pki_port_open(int port);
423 int octeontx_pki_port_hash_config(int port, pki_hash_cfg_t *hash_cfg);
424 int octeontx_pki_port_pktbuf_config(int port, pki_pktbuf_cfg_t *buf_cfg);
425 int octeontx_pki_port_create_qos(int port, pki_qos_cfg_t *qos_cfg);
426 int octeontx_pki_port_close(int port);
427 int octeontx_pki_port_start(int port);
428 int octeontx_pki_port_stop(int port);
429 int octeontx_pki_port_errchk_config(int port, pki_errchk_cfg_t *cfg);
431 #endif /* __OCTEONTX_PKI_H__ */