xref: /dpdk/drivers/net/ice/base/ice_parser_rt.h (revision 39925373)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2001-2021 Intel Corporation
3  */
4 
5 #ifndef _ICE_PARSER_RT_H_
6 #define _ICE_PARSER_RT_H_
7 
8 struct ice_parser_ctx;
9 
10 #define ICE_PARSER_MAX_PKT_LEN 504
11 #define ICE_PARSER_GPR_NUM 128
12 #define ICE_PARSER_HDR_BUF_LEN 32
13 #define ICE_PARSER_BST_KEY_LEN 20
14 #define ICE_PARSER_MARKER_NUM_IN_BYTES 9 /* 72 bits */
15 #define ICE_PARSER_PROTO_NUM 256
16 
17 struct ice_gpr_pu {
18 	/* flag to indicate if GRP needs to be updated */
19 	bool gpr_val_upd[ICE_PARSER_GPR_NUM];
20 	u16 gpr_val[ICE_PARSER_GPR_NUM];
21 	u64 flg_msk;
22 	u64 flg_val;
23 	u16 err_msk;
24 	u16 err_val;
25 };
26 
27 struct ice_parser_rt {
28 	struct ice_parser *psr;
29 	u16 gpr[ICE_PARSER_GPR_NUM];
30 	u8 pkt_buf[ICE_PARSER_MAX_PKT_LEN + ICE_PARSER_HDR_BUF_LEN];
31 	u16 pkt_len;
32 	u16 po;
33 	u8 bst_key[ICE_PARSER_BST_KEY_LEN];
34 	struct ice_pg_cam_key pg_key;
35 	struct ice_alu *alu0;
36 	struct ice_alu *alu1;
37 	struct ice_alu *alu2;
38 	struct ice_pg_cam_action *action;
39 	u8 pg;
40 	struct ice_gpr_pu pu;
41 	u8 markers[ICE_PARSER_MARKER_NUM_IN_BYTES];
42 	bool protocols[ICE_PARSER_PROTO_NUM];
43 	u16 offsets[ICE_PARSER_PROTO_NUM];
44 };
45 
46 void ice_parser_rt_reset(struct ice_parser_rt *rt);
47 void ice_parser_rt_pktbuf_set(struct ice_parser_rt *rt, const u8 *pkt_buf,
48 			      int pkt_len);
49 
50 struct ice_parser_result;
51 enum ice_status ice_parser_rt_execute(struct ice_parser_rt *rt,
52 				      struct ice_parser_result *rslt);
53 #endif /* _ICE_PARSER_RT_H_ */
54