| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
/* Copyright (C) 2024 Intel Corporation */ |
| 3 |
|
| 4 |
#ifndef _ICE_PARSER_H_ |
| 5 |
#define _ICE_PARSER_H_ |
| 6 |
|
| 7 |
#define ICE_SEC_DATA_OFFSET 4 |
| 8 |
#define ICE_SID_RXPARSER_IMEM_ENTRY_SIZE 48 |
| 9 |
#define ICE_SID_RXPARSER_METADATA_INIT_ENTRY_SIZE 24 |
| 10 |
#define ICE_SID_RXPARSER_CAM_ENTRY_SIZE 16 |
| 11 |
#define ICE_SID_RXPARSER_PG_SPILL_ENTRY_SIZE 17 |
| 12 |
#define ICE_SID_RXPARSER_NOMATCH_CAM_ENTRY_SIZE 12 |
| 13 |
#define ICE_SID_RXPARSER_NOMATCH_SPILL_ENTRY_SIZE 13 |
| 14 |
#define ICE_SID_RXPARSER_BOOST_TCAM_ENTRY_SIZE 88 |
| 15 |
#define ICE_SID_RXPARSER_MARKER_TYPE_ENTRY_SIZE 24 |
| 16 |
#define ICE_SID_RXPARSER_MARKER_GRP_ENTRY_SIZE 8 |
| 17 |
#define ICE_SID_RXPARSER_PROTO_GRP_ENTRY_SIZE 24 |
| 18 |
#define ICE_SID_RXPARSER_FLAG_REDIR_ENTRY_SIZE 1 |
| 19 |
|
| 20 |
#define ICE_SEC_LBL_DATA_OFFSET 2 |
| 21 |
#define ICE_SID_LBL_ENTRY_SIZE 66 |
| 22 |
|
| 23 |
/*** ICE_SID_RXPARSER_IMEM section ***/ |
| 24 |
#define ICE_IMEM_TABLE_SIZE 192 |
| 25 |
|
| 26 |
/* TCAM boost Master; if bit is set, and TCAM hit, TCAM output overrides iMEM |
| 27 |
* output. |
| 28 |
*/ |
| 29 |
struct ice_bst_main { |
| 30 |
bool alu0; |
| 31 |
bool alu1; |
| 32 |
bool alu2; |
| 33 |
bool pg; |
| 34 |
}; |
| 35 |
|
| 36 |
struct ice_bst_keybuilder { |
| 37 |
u8 prio; /* 0-3: PG precedence within ALUs (3 highest) */ |
| 38 |
bool tsr_ctrl; /* TCAM Search Register control */ |
| 39 |
}; |
| 40 |
|
| 41 |
/* Next protocol Key builder */ |
| 42 |
struct ice_np_keybuilder { |
| 43 |
u8 opc; |
| 44 |
u8 start_reg0; |
| 45 |
u8 len_reg1; |
| 46 |
}; |
| 47 |
|
| 48 |
enum ice_np_keybuilder_opcode { |
| 49 |
ICE_NPKB_OPC_EXTRACT = 0, |
| 50 |
ICE_NPKB_OPC_BUILD = 1, |
| 51 |
ICE_NPKB_OPC_BYPASS = 2, |
| 52 |
}; |
| 53 |
|
| 54 |
/* Parse Graph Key builder */ |
| 55 |
struct ice_pg_keybuilder { |
| 56 |
bool flag0_ena; |
| 57 |
bool flag1_ena; |
| 58 |
bool flag2_ena; |
| 59 |
bool flag3_ena; |
| 60 |
u8 flag0_idx; |
| 61 |
u8 flag1_idx; |
| 62 |
u8 flag2_idx; |
| 63 |
u8 flag3_idx; |
| 64 |
u8 alu_reg_idx; |
| 65 |
}; |
| 66 |
|
| 67 |
enum ice_alu_idx { |
| 68 |
ICE_ALU0_IDX = 0, |
| 69 |
ICE_ALU1_IDX = 1, |
| 70 |
ICE_ALU2_IDX = 2, |
| 71 |
}; |
| 72 |
|
| 73 |
enum ice_alu_opcode { |
| 74 |
ICE_ALU_PARK = 0, |
| 75 |
ICE_ALU_MOV_ADD = 1, |
| 76 |
ICE_ALU_ADD = 2, |
| 77 |
ICE_ALU_MOV_AND = 4, |
| 78 |
ICE_ALU_AND = 5, |
| 79 |
ICE_ALU_AND_IMM = 6, |
| 80 |
ICE_ALU_MOV_OR = 7, |
| 81 |
ICE_ALU_OR = 8, |
| 82 |
ICE_ALU_MOV_XOR = 9, |
| 83 |
ICE_ALU_XOR = 10, |
| 84 |
ICE_ALU_NOP = 11, |
| 85 |
ICE_ALU_BR = 12, |
| 86 |
ICE_ALU_BREQ = 13, |
| 87 |
ICE_ALU_BRNEQ = 14, |
| 88 |
ICE_ALU_BRGT = 15, |
| 89 |
ICE_ALU_BRLT = 16, |
| 90 |
ICE_ALU_BRGEQ = 17, |
| 91 |
ICE_ALU_BRLEG = 18, |
| 92 |
ICE_ALU_SETEQ = 19, |
| 93 |
ICE_ALU_ANDEQ = 20, |
| 94 |
ICE_ALU_OREQ = 21, |
| 95 |
ICE_ALU_SETNEQ = 22, |
| 96 |
ICE_ALU_ANDNEQ = 23, |
| 97 |
ICE_ALU_ORNEQ = 24, |
| 98 |
ICE_ALU_SETGT = 25, |
| 99 |
ICE_ALU_ANDGT = 26, |
| 100 |
ICE_ALU_ORGT = 27, |
| 101 |
ICE_ALU_SETLT = 28, |
| 102 |
ICE_ALU_ANDLT = 29, |
| 103 |
ICE_ALU_ORLT = 30, |
| 104 |
ICE_ALU_MOV_SUB = 31, |
| 105 |
ICE_ALU_SUB = 32, |
| 106 |
ICE_ALU_INVALID = 64, |
| 107 |
}; |
| 108 |
|
| 109 |
enum ice_proto_off_opcode { |
| 110 |
ICE_PO_OFF_REMAIN = 0, |
| 111 |
ICE_PO_OFF_HDR_ADD = 1, |
| 112 |
ICE_PO_OFF_HDR_SUB = 2, |
| 113 |
}; |
| 114 |
|
| 115 |
struct ice_alu { |
| 116 |
enum ice_alu_opcode opc; |
| 117 |
u8 src_start; |
| 118 |
u8 src_len; |
| 119 |
bool shift_xlate_sel; |
| 120 |
u8 shift_xlate_key; |
| 121 |
u8 src_reg_id; |
| 122 |
u8 dst_reg_id; |
| 123 |
bool inc0; |
| 124 |
bool inc1; |
| 125 |
u8 proto_offset_opc; |
| 126 |
u8 proto_offset; |
| 127 |
u8 branch_addr; |
| 128 |
u16 imm; |
| 129 |
bool dedicate_flags_ena; |
| 130 |
u8 dst_start; |
| 131 |
u8 dst_len; |
| 132 |
bool flags_extr_imm; |
| 133 |
u8 flags_start_imm; |
| 134 |
}; |
| 135 |
|
| 136 |
/* Parser program code (iMEM) */ |
| 137 |
struct ice_imem_item { |
| 138 |
u16 idx; |
| 139 |
struct ice_bst_main b_m; |
| 140 |
struct ice_bst_keybuilder b_kb; |
| 141 |
u8 pg_prio; |
| 142 |
struct ice_np_keybuilder np_kb; |
| 143 |
struct ice_pg_keybuilder pg_kb; |
| 144 |
struct ice_alu alu0; |
| 145 |
struct ice_alu alu1; |
| 146 |
struct ice_alu alu2; |
| 147 |
}; |
| 148 |
|
| 149 |
/*** ICE_SID_RXPARSER_METADATA_INIT section ***/ |
| 150 |
#define ICE_METAINIT_TABLE_SIZE 16 |
| 151 |
|
| 152 |
/* Metadata Initialization item */ |
| 153 |
struct ice_metainit_item { |
| 154 |
u16 idx; |
| 155 |
|
| 156 |
u8 tsr; /* TCAM Search key Register */ |
| 157 |
u16 ho; /* Header Offset register */ |
| 158 |
u16 pc; /* Program Counter register */ |
| 159 |
u16 pg_rn; /* Parse Graph Root Node */ |
| 160 |
u8 cd; /* Control Domain ID */ |
| 161 |
|
| 162 |
/* General Purpose Registers */ |
| 163 |
bool gpr_a_ctrl; |
| 164 |
u8 gpr_a_data_mdid; |
| 165 |
u8 gpr_a_data_start; |
| 166 |
u8 gpr_a_data_len; |
| 167 |
u8 gpr_a_id; |
| 168 |
|
| 169 |
bool gpr_b_ctrl; |
| 170 |
u8 gpr_b_data_mdid; |
| 171 |
u8 gpr_b_data_start; |
| 172 |
u8 gpr_b_data_len; |
| 173 |
u8 gpr_b_id; |
| 174 |
|
| 175 |
bool gpr_c_ctrl; |
| 176 |
u8 gpr_c_data_mdid; |
| 177 |
u8 gpr_c_data_start; |
| 178 |
u8 gpr_c_data_len; |
| 179 |
u8 gpr_c_id; |
| 180 |
|
| 181 |
bool gpr_d_ctrl; |
| 182 |
u8 gpr_d_data_mdid; |
| 183 |
u8 gpr_d_data_start; |
| 184 |
u8 gpr_d_data_len; |
| 185 |
u8 gpr_d_id; |
| 186 |
|
| 187 |
u64 flags; /* Initial value for all flags */ |
| 188 |
}; |
| 189 |
|
| 190 |
/*** ICE_SID_RXPARSER_CAM, ICE_SID_RXPARSER_PG_SPILL, |
| 191 |
* ICE_SID_RXPARSER_NOMATCH_CAM and ICE_SID_RXPARSER_NOMATCH_CAM |
| 192 |
* sections ***/ |
| 193 |
#define ICE_PG_CAM_TABLE_SIZE 2048 |
| 194 |
#define ICE_PG_SP_CAM_TABLE_SIZE 128 |
| 195 |
#define ICE_PG_NM_CAM_TABLE_SIZE 1024 |
| 196 |
#define ICE_PG_NM_SP_CAM_TABLE_SIZE 64 |
| 197 |
|
| 198 |
struct ice_pg_cam_key { |
| 199 |
bool valid; |
| 200 |
struct_group_attr(val, __packed, |
| 201 |
u16 node_id; /* Node ID of protocol in parse graph */ |
| 202 |
bool flag0; |
| 203 |
bool flag1; |
| 204 |
bool flag2; |
| 205 |
bool flag3; |
| 206 |
u8 boost_idx; /* Boost TCAM match index */ |
| 207 |
u16 alu_reg; |
| 208 |
u32 next_proto; /* next Protocol value (must be last) */ |
| 209 |
); |
| 210 |
}; |
| 211 |
|
| 212 |
struct ice_pg_nm_cam_key { |
| 213 |
bool valid; |
| 214 |
struct_group_attr(val, __packed, |
| 215 |
u16 node_id; |
| 216 |
bool flag0; |
| 217 |
bool flag1; |
| 218 |
bool flag2; |
| 219 |
bool flag3; |
| 220 |
u8 boost_idx; |
| 221 |
u16 alu_reg; |
| 222 |
); |
| 223 |
}; |
| 224 |
|
| 225 |
struct ice_pg_cam_action { |
| 226 |
u16 next_node; /* Parser Node ID for the next round */ |
| 227 |
u8 next_pc; /* next Program Counter */ |
| 228 |
bool is_pg; /* is protocol group */ |
| 229 |
u8 proto_id; /* protocol ID or proto group ID */ |
| 230 |
bool is_mg; /* is marker group */ |
| 231 |
u8 marker_id; /* marker ID or marker group ID */ |
| 232 |
bool is_last_round; |
| 233 |
bool ho_polarity; /* header offset polarity */ |
| 234 |
u16 ho_inc; |
| 235 |
}; |
| 236 |
|
| 237 |
/* Parse Graph item */ |
| 238 |
struct ice_pg_cam_item { |
| 239 |
u16 idx; |
| 240 |
struct ice_pg_cam_key key; |
| 241 |
struct ice_pg_cam_action action; |
| 242 |
}; |
| 243 |
|
| 244 |
/* Parse Graph No Match item */ |
| 245 |
struct ice_pg_nm_cam_item { |
| 246 |
u16 idx; |
| 247 |
struct ice_pg_nm_cam_key key; |
| 248 |
struct ice_pg_cam_action action; |
| 249 |
}; |
| 250 |
|
| 251 |
struct ice_pg_cam_item *ice_pg_cam_match(struct ice_pg_cam_item *table, |
| 252 |
int size, struct ice_pg_cam_key *key); |
| 253 |
struct ice_pg_nm_cam_item * |
| 254 |
ice_pg_nm_cam_match(struct ice_pg_nm_cam_item *table, int size, |
| 255 |
struct ice_pg_cam_key *key); |
| 256 |
|
| 257 |
/*** ICE_SID_RXPARSER_BOOST_TCAM and ICE_SID_LBL_RXPARSER_TMEM sections ***/ |
| 258 |
#define ICE_BST_TCAM_TABLE_SIZE 256 |
| 259 |
#define ICE_BST_TCAM_KEY_SIZE 20 |
| 260 |
|
| 261 |
/* Boost TCAM item */ |
| 262 |
struct ice_bst_tcam_item { |
| 263 |
u16 addr; |
| 264 |
u8 key[ICE_BST_TCAM_KEY_SIZE]; |
| 265 |
u8 key_inv[ICE_BST_TCAM_KEY_SIZE]; |
| 266 |
u8 hit_idx_grp; |
| 267 |
u8 pg_prio; |
| 268 |
struct ice_np_keybuilder np_kb; |
| 269 |
struct ice_pg_keybuilder pg_kb; |
| 270 |
struct ice_alu alu0; |
| 271 |
struct ice_alu alu1; |
| 272 |
struct ice_alu alu2; |
| 273 |
}; |
| 274 |
|
| 275 |
#define ICE_LBL_LEN 64 |
| 276 |
#define ICE_LBL_BST_DVM "BOOST_MAC_VLAN_DVM" |
| 277 |
#define ICE_LBL_BST_SVM "BOOST_MAC_VLAN_SVM" |
| 278 |
#define ICE_LBL_TNL_VXLAN "TNL_VXLAN" |
| 279 |
#define ICE_LBL_TNL_GENEVE "TNL_GENEVE" |
| 280 |
#define ICE_LBL_TNL_UDP_ECPRI "TNL_UDP_ECPRI" |
| 281 |
|
| 282 |
enum ice_lbl_type { |
| 283 |
ICE_LBL_BST_TYPE_UNKNOWN, |
| 284 |
ICE_LBL_BST_TYPE_DVM, |
| 285 |
ICE_LBL_BST_TYPE_SVM, |
| 286 |
ICE_LBL_BST_TYPE_VXLAN, |
| 287 |
ICE_LBL_BST_TYPE_GENEVE, |
| 288 |
ICE_LBL_BST_TYPE_UDP_ECPRI, |
| 289 |
}; |
| 290 |
|
| 291 |
struct ice_lbl_item { |
| 292 |
u16 idx; |
| 293 |
char label[ICE_LBL_LEN]; |
| 294 |
|
| 295 |
/* must be at the end, not part of the DDP section */ |
| 296 |
enum ice_lbl_type type; |
| 297 |
}; |
| 298 |
|
| 299 |
struct ice_bst_tcam_item * |
| 300 |
ice_bst_tcam_match(struct ice_bst_tcam_item *tcam_table, u8 *pat); |
| 301 |
struct ice_bst_tcam_item * |
| 302 |
ice_bst_tcam_search(struct ice_bst_tcam_item *tcam_table, |
| 303 |
struct ice_lbl_item *lbl_table, |
| 304 |
enum ice_lbl_type type, u16 *start); |
| 305 |
|
| 306 |
/*** ICE_SID_RXPARSER_MARKER_PTYPE section ***/ |
| 307 |
#define ICE_PTYPE_MK_TCAM_TABLE_SIZE 1024 |
| 308 |
#define ICE_PTYPE_MK_TCAM_KEY_SIZE 10 |
| 309 |
|
| 310 |
struct ice_ptype_mk_tcam_item { |
| 311 |
u16 address; |
| 312 |
u16 ptype; |
| 313 |
u8 key[ICE_PTYPE_MK_TCAM_KEY_SIZE]; |
| 314 |
u8 key_inv[ICE_PTYPE_MK_TCAM_KEY_SIZE]; |
| 315 |
} __packed; |
| 316 |
|
| 317 |
struct ice_ptype_mk_tcam_item * |
| 318 |
ice_ptype_mk_tcam_match(struct ice_ptype_mk_tcam_item *table, |
| 319 |
u8 *pat, int len); |
| 320 |
/*** ICE_SID_RXPARSER_MARKER_GRP section ***/ |
| 321 |
#define ICE_MK_GRP_TABLE_SIZE 128 |
| 322 |
#define ICE_MK_COUNT_PER_GRP 8 |
| 323 |
|
| 324 |
/* Marker Group item */ |
| 325 |
struct ice_mk_grp_item { |
| 326 |
int idx; |
| 327 |
u8 markers[ICE_MK_COUNT_PER_GRP]; |
| 328 |
}; |
| 329 |
|
| 330 |
/*** ICE_SID_RXPARSER_PROTO_GRP section ***/ |
| 331 |
#define ICE_PROTO_COUNT_PER_GRP 8 |
| 332 |
#define ICE_PROTO_GRP_TABLE_SIZE 192 |
| 333 |
#define ICE_PROTO_GRP_ITEM_SIZE 22 |
| 334 |
struct ice_proto_off { |
| 335 |
bool polarity; /* true: positive, false: negative */ |
| 336 |
u8 proto_id; |
| 337 |
u16 offset; /* 10 bit protocol offset */ |
| 338 |
}; |
| 339 |
|
| 340 |
/* Protocol Group item */ |
| 341 |
struct ice_proto_grp_item { |
| 342 |
u16 idx; |
| 343 |
struct ice_proto_off po[ICE_PROTO_COUNT_PER_GRP]; |
| 344 |
}; |
| 345 |
|
| 346 |
/*** ICE_SID_RXPARSER_FLAG_REDIR section ***/ |
| 347 |
#define ICE_FLG_RD_TABLE_SIZE 64 |
| 348 |
#define ICE_FLG_RDT_SIZE 64 |
| 349 |
|
| 350 |
/* Flags Redirection item */ |
| 351 |
struct ice_flg_rd_item { |
| 352 |
u16 idx; |
| 353 |
bool expose; |
| 354 |
u8 intr_flg_id; /* Internal Flag ID */ |
| 355 |
}; |
| 356 |
|
| 357 |
u64 ice_flg_redirect(struct ice_flg_rd_item *table, u64 psr_flg); |
| 358 |
|
| 359 |
/*** ICE_SID_XLT_KEY_BUILDER_SW, ICE_SID_XLT_KEY_BUILDER_ACL, |
| 360 |
* ICE_SID_XLT_KEY_BUILDER_FD and ICE_SID_XLT_KEY_BUILDER_RSS |
| 361 |
* sections ***/ |
| 362 |
#define ICE_XLT_KB_FLAG0_14_CNT 15 |
| 363 |
#define ICE_XLT_KB_TBL_CNT 8 |
| 364 |
#define ICE_XLT_KB_TBL_ENTRY_SIZE 24 |
| 365 |
|
| 366 |
struct ice_xlt_kb_entry { |
| 367 |
u8 xlt1_ad_sel; |
| 368 |
u8 xlt2_ad_sel; |
| 369 |
u16 flg0_14_sel[ICE_XLT_KB_FLAG0_14_CNT]; |
| 370 |
u8 xlt1_md_sel; |
| 371 |
u8 xlt2_md_sel; |
| 372 |
}; |
| 373 |
|
| 374 |
/* XLT Key Builder */ |
| 375 |
struct ice_xlt_kb { |
| 376 |
u8 xlt1_pm; /* XLT1 Partition Mode */ |
| 377 |
u8 xlt2_pm; /* XLT2 Partition Mode */ |
| 378 |
u8 prof_id_pm; /* Profile ID Partition Mode */ |
| 379 |
u64 flag15; |
| 380 |
|
| 381 |
struct ice_xlt_kb_entry entries[ICE_XLT_KB_TBL_CNT]; |
| 382 |
}; |
| 383 |
|
| 384 |
u16 ice_xlt_kb_flag_get(struct ice_xlt_kb *kb, u64 pkt_flag); |
| 385 |
|
| 386 |
/*** Parser API ***/ |
| 387 |
#define ICE_GPR_HV_IDX 64 |
| 388 |
#define ICE_GPR_HV_SIZE 32 |
| 389 |
#define ICE_GPR_ERR_IDX 84 |
| 390 |
#define ICE_GPR_FLG_IDX 104 |
| 391 |
#define ICE_GPR_FLG_SIZE 16 |
| 392 |
|
| 393 |
#define ICE_GPR_TSR_IDX 108 /* TSR: TCAM Search Register */ |
| 394 |
#define ICE_GPR_NN_IDX 109 /* NN: Next Parsing Cycle Node ID */ |
| 395 |
#define ICE_GPR_HO_IDX 110 /* HO: Next Parsing Cycle hdr Offset */ |
| 396 |
#define ICE_GPR_NP_IDX 111 /* NP: Next Parsing Cycle */ |
| 397 |
|
| 398 |
#define ICE_PARSER_MAX_PKT_LEN 504 |
| 399 |
#define ICE_PARSER_PKT_REV 32 |
| 400 |
#define ICE_PARSER_GPR_NUM 128 |
| 401 |
#define ICE_PARSER_FLG_NUM 64 |
| 402 |
#define ICE_PARSER_ERR_NUM 16 |
| 403 |
#define ICE_MARKER_ID_SIZE 9 |
| 404 |
#define ICE_MARKER_MAX_SIZE \ |
| 405 |
(ICE_MARKER_ID_SIZE * BITS_PER_BYTE - 1) |
| 406 |
#define ICE_MARKER_ID_NUM 8 |
| 407 |
#define ICE_PO_PAIR_SIZE 256 |
| 408 |
|
| 409 |
struct ice_gpr_pu { |
| 410 |
/* array of flags to indicate if GRP needs to be updated */ |
| 411 |
bool gpr_val_upd[ICE_PARSER_GPR_NUM]; |
| 412 |
u16 gpr_val[ICE_PARSER_GPR_NUM]; |
| 413 |
u64 flg_msk; |
| 414 |
u64 flg_val; |
| 415 |
u16 err_msk; |
| 416 |
u16 err_val; |
| 417 |
}; |
| 418 |
|
| 419 |
enum ice_pg_prio { |
| 420 |
ICE_PG_P0 = 0, |
| 421 |
ICE_PG_P1 = 1, |
| 422 |
ICE_PG_P2 = 2, |
| 423 |
ICE_PG_P3 = 3, |
| 424 |
}; |
| 425 |
|
| 426 |
struct ice_parser_rt { |
| 427 |
struct ice_parser *psr; |
| 428 |
u16 gpr[ICE_PARSER_GPR_NUM]; |
| 429 |
u8 pkt_buf[ICE_PARSER_MAX_PKT_LEN + ICE_PARSER_PKT_REV]; |
| 430 |
u16 pkt_len; |
| 431 |
u16 po; |
| 432 |
u8 bst_key[ICE_BST_TCAM_KEY_SIZE]; |
| 433 |
struct ice_pg_cam_key pg_key; |
| 434 |
u8 pg_prio; |
| 435 |
struct ice_alu *alu0; |
| 436 |
struct ice_alu *alu1; |
| 437 |
struct ice_alu *alu2; |
| 438 |
struct ice_pg_cam_action *action; |
| 439 |
struct ice_gpr_pu pu; |
| 440 |
u8 markers[ICE_MARKER_ID_SIZE]; |
| 441 |
bool protocols[ICE_PO_PAIR_SIZE]; |
| 442 |
u16 offsets[ICE_PO_PAIR_SIZE]; |
| 443 |
}; |
| 444 |
|
| 445 |
struct ice_parser_proto_off { |
| 446 |
u8 proto_id; /* hardware protocol ID */ |
| 447 |
u16 offset; /* offset from the start of the protocol header */ |
| 448 |
}; |
| 449 |
|
| 450 |
#define ICE_PARSER_PROTO_OFF_PAIR_SIZE 16 |
| 451 |
#define ICE_PARSER_FLAG_PSR_SIZE 8 |
| 452 |
#define ICE_PARSER_FV_SIZE 48 |
| 453 |
#define ICE_PARSER_FV_MAX 24 |
| 454 |
#define ICE_BT_TUN_PORT_OFF_H 16 |
| 455 |
#define ICE_BT_TUN_PORT_OFF_L 15 |
| 456 |
#define ICE_BT_VM_OFF 0 |
| 457 |
#define ICE_UDP_PORT_OFF_H 1 |
| 458 |
#define ICE_UDP_PORT_OFF_L 0 |
| 459 |
|
| 460 |
struct ice_parser_result { |
| 461 |
u16 ptype; /* 16 bits hardware PTYPE */ |
| 462 |
/* array of protocol and header offset pairs */ |
| 463 |
struct ice_parser_proto_off po[ICE_PARSER_PROTO_OFF_PAIR_SIZE]; |
| 464 |
int po_num; /* # of protocol-offset pairs must <= 16 */ |
| 465 |
u64 flags_psr; /* parser flags */ |
| 466 |
u64 flags_pkt; /* packet flags */ |
| 467 |
u16 flags_sw; /* key builder flags for SW */ |
| 468 |
u16 flags_acl; /* key builder flags for ACL */ |
| 469 |
u16 flags_fd; /* key builder flags for FD */ |
| 470 |
u16 flags_rss; /* key builder flags for RSS */ |
| 471 |
}; |
| 472 |
|
| 473 |
void ice_parser_rt_reset(struct ice_parser_rt *rt); |
| 474 |
void ice_parser_rt_pktbuf_set(struct ice_parser_rt *rt, const u8 *pkt_buf, |
| 475 |
int pkt_len); |
| 476 |
int ice_parser_rt_execute(struct ice_parser_rt *rt, |
| 477 |
struct ice_parser_result *rslt); |
| 478 |
|
| 479 |
struct ice_parser { |
| 480 |
struct ice_hw *hw; /* pointer to the hardware structure */ |
| 481 |
|
| 482 |
struct ice_imem_item *imem_table; |
| 483 |
struct ice_metainit_item *mi_table; |
| 484 |
|
| 485 |
struct ice_pg_cam_item *pg_cam_table; |
| 486 |
struct ice_pg_cam_item *pg_sp_cam_table; |
| 487 |
struct ice_pg_nm_cam_item *pg_nm_cam_table; |
| 488 |
struct ice_pg_nm_cam_item *pg_nm_sp_cam_table; |
| 489 |
|
| 490 |
struct ice_bst_tcam_item *bst_tcam_table; |
| 491 |
struct ice_lbl_item *bst_lbl_table; |
| 492 |
struct ice_ptype_mk_tcam_item *ptype_mk_tcam_table; |
| 493 |
struct ice_mk_grp_item *mk_grp_table; |
| 494 |
struct ice_proto_grp_item *proto_grp_table; |
| 495 |
struct ice_flg_rd_item *flg_rd_table; |
| 496 |
|
| 497 |
struct ice_xlt_kb *xlt_kb_sw; |
| 498 |
struct ice_xlt_kb *xlt_kb_acl; |
| 499 |
struct ice_xlt_kb *xlt_kb_fd; |
| 500 |
struct ice_xlt_kb *xlt_kb_rss; |
| 501 |
|
| 502 |
struct ice_parser_rt rt; |
| 503 |
}; |
| 504 |
|
| 505 |
struct ice_parser *ice_parser_create(struct ice_hw *hw); |
| 506 |
void ice_parser_destroy(struct ice_parser *psr); |
| 507 |
void ice_parser_dvm_set(struct ice_parser *psr, bool on); |
| 508 |
int ice_parser_vxlan_tunnel_set(struct ice_parser *psr, u16 udp_port, bool on); |
| 509 |
int ice_parser_geneve_tunnel_set(struct ice_parser *psr, u16 udp_port, bool on); |
| 510 |
int ice_parser_ecpri_tunnel_set(struct ice_parser *psr, u16 udp_port, bool on); |
| 511 |
int ice_parser_run(struct ice_parser *psr, const u8 *pkt_buf, |
| 512 |
int pkt_len, struct ice_parser_result *rslt); |
| 513 |
void ice_parser_result_dump(struct ice_hw *hw, struct ice_parser_result *rslt); |
| 514 |
|
| 515 |
struct ice_parser_fv { |
| 516 |
u8 proto_id; /* hardware protocol ID */ |
| 517 |
u16 offset; /* offset from the start of the protocol header */ |
| 518 |
u16 spec; /* pattern to match */ |
| 519 |
u16 msk; /* pattern mask */ |
| 520 |
}; |
| 521 |
|
| 522 |
struct ice_parser_profile { |
| 523 |
/* array of field vectors */ |
| 524 |
struct ice_parser_fv fv[ICE_PARSER_FV_SIZE]; |
| 525 |
int fv_num; /* # of field vectors must <= 48 */ |
| 526 |
u16 flags; /* key builder flags */ |
| 527 |
u16 flags_msk; /* key builder flag mask */ |
| 528 |
|
| 529 |
DECLARE_BITMAP(ptypes, ICE_FLOW_PTYPE_MAX); /* PTYPE bitmap */ |
| 530 |
}; |
| 531 |
|
| 532 |
int ice_parser_profile_init(struct ice_parser_result *rslt, |
| 533 |
const u8 *pkt_buf, const u8 *msk_buf, |
| 534 |
int buf_len, enum ice_block blk, |
| 535 |
struct ice_parser_profile *prof); |
| 536 |
void ice_parser_profile_dump(struct ice_hw *hw, |
| 537 |
struct ice_parser_profile *prof); |
| 538 |
#endif /* _ICE_PARSER_H_ */ |