1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2001-2021 Intel Corporation
8 #include "ice_metainit.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 #include "ice_tmatch.h"
21 struct ice_hw *hw; /* pointer to the hardware structure */
23 /* load data from section ICE_SID_RX_PARSER_IMEM */
24 struct ice_imem_item *imem_table;
25 /* load data from section ICE_SID_RXPARSER_METADATA_INIT */
26 struct ice_metainit_item *mi_table;
27 /* load data from section ICE_SID_RXPARSER_CAM */
28 struct ice_pg_cam_item *pg_cam_table;
29 /* load data from section ICE_SID_RXPARSER_PG_SPILL */
30 struct ice_pg_cam_item *pg_sp_cam_table;
31 /* load data from section ICE_SID_RXPARSER_NOMATCH_CAM */
32 struct ice_pg_nm_cam_item *pg_nm_cam_table;
33 /* load data from section ICE_SID_RXPARSER_NOMATCH_SPILL */
34 struct ice_pg_nm_cam_item *pg_nm_sp_cam_table;
35 /* load data from section ICE_SID_RXPARSER_BOOST_TCAM */
36 struct ice_bst_tcam_item *bst_tcam_table;
37 /* load data from section ICE_SID_LBL_RXPARSER_TMEM */
38 struct ice_lbl_item *bst_lbl_table;
39 /* load data from section ICE_SID_RXPARSER_MARKER_PTYPE */
40 struct ice_ptype_mk_tcam_item *ptype_mk_tcam_table;
41 /* load data from section ICE_SID_RXPARSER_MARKER_GRP */
42 struct ice_mk_grp_item *mk_grp_table;
43 /* load data from section ICE_SID_RXPARSER_PROTO_GRP */
44 struct ice_proto_grp_item *proto_grp_table;
45 /* load data from section ICE_SID_RXPARSER_FLAG_REDIR */
46 struct ice_flg_rd_item *flg_rd_table;
47 /* load data from section ICE_SID_XLT_KEY_BUILDER_SW */
48 struct ice_xlt_kb *xlt_kb_sw;
49 /* load data from section ICE_SID_XLT_KEY_BUILDER_ACL */
50 struct ice_xlt_kb *xlt_kb_acl;
51 /* load data from section ICE_SID_XLT_KEY_BUILDER_FD */
52 struct ice_xlt_kb *xlt_kb_fd;
53 /* load data from section ICE_SID_XLT_KEY_BUILDER_RSS */
54 struct ice_xlt_kb *xlt_kb_rss;
55 struct ice_parser_rt rt; /* parser runtime */
58 enum ice_status ice_parser_create(struct ice_hw *hw, struct ice_parser **psr);
59 void ice_parser_destroy(struct ice_parser *psr);
60 void ice_parser_dvm_set(struct ice_parser *psr, bool on);
61 enum ice_status ice_parser_vxlan_tunnel_set(struct ice_parser *psr,
62 u16 udp_port, bool on);
63 enum ice_status ice_parser_geneve_tunnel_set(struct ice_parser *psr,
64 u16 udp_port, bool on);
65 enum ice_status ice_parser_ecpri_tunnel_set(struct ice_parser *psr,
66 u16 udp_port, bool on);
68 struct ice_parser_proto_off {
69 u8 proto_id; /* hardware protocol ID */
70 u16 offset; /* offset where the protocol header start */
73 struct ice_parser_result {
74 u16 ptype; /* 16 bits hardware PTYPE */
75 /* protocol and header offset pairs */
76 struct ice_parser_proto_off po[16];
77 int po_num; /* number of pairs must <= 16 */
78 u64 flags_psr; /* 64 bits parser flags */
79 u64 flags_pkt; /* 64 bits packet flags */
80 u16 flags_sw; /* 16 bits key builder flag for SW */
81 u16 flags_acl; /* 16 bits key builder flag for ACL */
82 u16 flags_fd; /* 16 bits key builder flag for FD */
83 u16 flags_rss; /* 16 bits key builder flag for RSS */
86 enum ice_status ice_parser_run(struct ice_parser *psr, const u8 *pkt_buf,
87 int pkt_len, struct ice_parser_result *rslt);
88 void ice_parser_result_dump(struct ice_hw *hw, struct ice_parser_result *rslt);
90 struct ice_parser_fv {
91 u8 proto_id; /* hardware protocol ID */
92 u16 offset; /* offset from the start of the protocol header */
93 u16 spec; /* 16 bits pattern to match */
94 u16 msk; /* 16 bits pattern mask */
97 struct ice_parser_profile {
98 struct ice_parser_fv fv[48]; /* field vector array */
99 int fv_num; /* field vector number must <= 48 */
100 u16 flags; /* 16 bits key builder flag */
101 u16 flags_msk; /* key builder flag masker */
102 /* 1024 bits PTYPE bitmap */
103 ice_declare_bitmap(ptypes, ICE_FLOW_PTYPE_MAX);
106 enum ice_status ice_parser_profile_init(struct ice_parser_result *rslt,
107 const u8 *pkt_buf, const u8 *msk_buf,
108 int buf_len, enum ice_block blk,
110 struct ice_parser_profile *prof);
111 void ice_parser_profile_dump(struct ice_hw *hw,
112 struct ice_parser_profile *prof);
113 bool ice_check_ddp_support_proto_id(struct ice_hw *hw,
114 enum ice_prot_id proto_id);
115 #endif /* _ICE_PARSER_H_ */