f71a8d87751d48ab0cbe58d74383b8838e5766a7
[dpdk.git] / drivers / net / ice / base / ice_parser.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2001-2021 Intel Corporation
3  */
4
5 #ifndef _ICE_PARSER_H_
6 #define _ICE_PARSER_H_
7
8 #include "ice_metainit.h"
9 #include "ice_imem.h"
10 #include "ice_pg_cam.h"
11 #include "ice_bst_tcam.h"
12 #include "ice_ptype_mk.h"
13 #include "ice_mk_grp.h"
14 #include "ice_proto_grp.h"
15 #include "ice_flg_rd.h"
16 #include "ice_xlt_kb.h"
17 #include "ice_parser_rt.h"
18
19 struct ice_parser {
20         struct ice_hw *hw; /* pointer to the hardware structure */
21
22         /* load data from section ICE_SID_RX_PARSER_IMEM */
23         struct ice_imem_item *imem_table;
24         /* load data from section ICE_SID_RXPARSER_METADATA_INIT */
25         struct ice_metainit_item *mi_table;
26         /* load data from section ICE_SID_RXPARSER_CAM */
27         struct ice_pg_cam_item *pg_cam_table;
28         /* load data from section ICE_SID_RXPARSER_PG_SPILL */
29         struct ice_pg_cam_item *pg_sp_cam_table;
30         /* load data from section ICE_SID_RXPARSER_NOMATCH_CAM */
31         struct ice_pg_nm_cam_item *pg_nm_cam_table;
32         /* load data from section ICE_SID_RXPARSER_NOMATCH_SPILL */
33         struct ice_pg_nm_cam_item *pg_nm_sp_cam_table;
34         /* load data from section ICE_SID_RXPARSER_BOOST_TCAM */
35         struct ice_bst_tcam_item *bst_tcam_table;
36         /* load data from section ICE_SID_LBL_RXPARSER_TMEM */
37         struct ice_lbl_item *bst_lbl_table;
38         /* load data from section ICE_SID_RXPARSER_MARKER_PTYPE */
39         struct ice_ptype_mk_tcam_item *ptype_mk_tcam_table;
40         /* load data from section ICE_SID_RXPARSER_MARKER_GRP */
41         struct ice_mk_grp_item *mk_grp_table;
42         /* load data from section ICE_SID_RXPARSER_PROTO_GRP */
43         struct ice_proto_grp_item *proto_grp_table;
44         /* load data from section ICE_SID_RXPARSER_FLAG_REDIR */
45         struct ice_flg_rd_item *flg_rd_table;
46         /* load data from section ICE_SID_XLT_KEY_BUILDER_SW */
47         struct ice_xlt_kb *xlt_kb_sw;
48         /* load data from section ICE_SID_XLT_KEY_BUILDER_ACL */
49         struct ice_xlt_kb *xlt_kb_acl;
50         /* load data from section ICE_SID_XLT_KEY_BUILDER_FD */
51         struct ice_xlt_kb *xlt_kb_fd;
52         /* load data from section ICE_SID_XLT_KEY_BUILDER_RSS */
53         struct ice_xlt_kb *xlt_kb_rss;
54         struct ice_parser_rt rt; /* parser runtime */
55 };
56
57 enum ice_status ice_parser_create(struct ice_hw *hw, struct ice_parser **psr);
58 void ice_parser_destroy(struct ice_parser *psr);
59
60 struct ice_parser_proto_off {
61         u8 proto_id; /* hardware protocol ID */
62         u16 offset;  /* offset where the  protocol header start */
63 };
64
65 struct ice_parser_result {
66         u16 ptype; /* 16 bits hardware PTYPE */
67         /* protocol and header offset pairs */
68         struct ice_parser_proto_off po[16];
69         int po_num; /* number of pairs must <= 16 */
70         u64 flags_psr; /* 64 bits parser flags */
71         u64 flags_pkt; /* 64 bits packet flags */
72         u16 flags_sw; /* 16 bits key builder flag for SW */
73         u16 flags_acl; /* 16 bits key builder flag for ACL */
74         u16 flags_fd; /* 16 bits key builder flag for FD */
75         u16 flags_rss; /* 16 bits key builder flag for RSS */
76 };
77
78 enum ice_status ice_parser_run(struct ice_parser *psr, const u8 *pkt_buf,
79                                int pkt_len, struct ice_parser_result *rslt);
80 void ice_parser_result_dump(struct ice_hw *hw, struct ice_parser_result *rslt);
81 #endif /* _ICE_PARSER_H_ */