// SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2024 Intel Corporation */ #include "ice_common.h" struct ice_pkg_sect_hdr { … }; /** * ice_parser_sect_item_get - parse an item from a section * @sect_type: section type * @section: section object * @index: index of the item to get * @offset: dummy as prototype of ice_pkg_enum_entry's last parameter * * Return: a pointer to the item or NULL. */ static void *ice_parser_sect_item_get(u32 sect_type, void *section, u32 index, u32 __maybe_unused *offset) { … } /** * ice_parser_create_table - create an item table from a section * @hw: pointer to the hardware structure * @sect_type: section type * @item_size: item size in bytes * @length: number of items in the table to create * @parse_item: the function to parse the item * @no_offset: ignore header offset, calculate index from 0 * * Return: a pointer to the allocated table or ERR_PTR. */ static void * ice_parser_create_table(struct ice_hw *hw, u32 sect_type, u32 item_size, u32 length, void (*parse_item)(struct ice_hw *hw, u16 idx, void *item, void *data, int size), bool no_offset) { … } /*** ICE_SID_RXPARSER_IMEM section ***/ static void ice_imem_bst_bm_dump(struct ice_hw *hw, struct ice_bst_main *bm) { … } static void ice_imem_bst_kb_dump(struct ice_hw *hw, struct ice_bst_keybuilder *kb) { … } static void ice_imem_np_kb_dump(struct ice_hw *hw, struct ice_np_keybuilder *kb) { … } static void ice_imem_pg_kb_dump(struct ice_hw *hw, struct ice_pg_keybuilder *kb) { … } static void ice_imem_alu_dump(struct ice_hw *hw, struct ice_alu *alu, int index) { … } /** * ice_imem_dump - dump an imem item info * @hw: pointer to the hardware structure * @item: imem item to dump */ static void ice_imem_dump(struct ice_hw *hw, struct ice_imem_item *item) { … } #define ICE_IM_BM_ALU0 … #define ICE_IM_BM_ALU1 … #define ICE_IM_BM_ALU2 … #define ICE_IM_BM_PG … /** * ice_imem_bm_init - parse 4 bits of Boost Main * @bm: pointer to the Boost Main structure * @data: Boost Main data to be parsed */ static void ice_imem_bm_init(struct ice_bst_main *bm, u8 data) { … } #define ICE_IM_BKB_PRIO … #define ICE_IM_BKB_TSR_CTRL … /** * ice_imem_bkb_init - parse 10 bits of Boost Main Build * @bkb: pointer to the Boost Main Build structure * @data: Boost Main Build data to be parsed */ static void ice_imem_bkb_init(struct ice_bst_keybuilder *bkb, u16 data) { … } #define ICE_IM_NPKB_OPC … #define ICE_IM_NPKB_S_R0 … #define ICE_IM_NPKB_L_R1 … /** * ice_imem_npkb_init - parse 18 bits of Next Protocol Key Build * @kb: pointer to the Next Protocol Key Build structure * @data: Next Protocol Key Build data to be parsed */ static void ice_imem_npkb_init(struct ice_np_keybuilder *kb, u32 data) { … } #define ICE_IM_PGKB_F0_ENA … #define ICE_IM_PGKB_F0_IDX … #define ICE_IM_PGKB_F1_ENA … #define ICE_IM_PGKB_F1_IDX … #define ICE_IM_PGKB_F2_ENA … #define ICE_IM_PGKB_F2_IDX … #define ICE_IM_PGKB_F3_ENA … #define ICE_IM_PGKB_F3_IDX … #define ICE_IM_PGKB_AR_IDX … /** * ice_imem_pgkb_init - parse 35 bits of Parse Graph Key Build * @kb: pointer to the Parse Graph Key Build structure * @data: Parse Graph Key Build data to be parsed */ static void ice_imem_pgkb_init(struct ice_pg_keybuilder *kb, u64 data) { … } #define ICE_IM_ALU_OPC … #define ICE_IM_ALU_SS … #define ICE_IM_ALU_SL … #define ICE_IM_ALU_SXS … #define ICE_IM_ALU_SXK … #define ICE_IM_ALU_SRID … #define ICE_IM_ALU_DRID … #define ICE_IM_ALU_INC0 … #define ICE_IM_ALU_INC1 … #define ICE_IM_ALU_POO … #define ICE_IM_ALU_PO … #define ICE_IM_ALU_BA_S … #define ICE_IM_ALU_BA … #define ICE_IM_ALU_IMM … #define ICE_IM_ALU_DFE … #define ICE_IM_ALU_DS … #define ICE_IM_ALU_DL … #define ICE_IM_ALU_FEI … #define ICE_IM_ALU_FSI … /** * ice_imem_alu_init - parse 96 bits of ALU entry * @alu: pointer to the ALU entry structure * @data: ALU entry data to be parsed * @off: offset of the ALU entry data */ static void ice_imem_alu_init(struct ice_alu *alu, u8 *data, u8 off) { … } #define ICE_IMEM_BM_S … #define ICE_IMEM_BKB_S … #define ICE_IMEM_BKB_IDD … #define ICE_IMEM_BKB_OFF … #define ICE_IMEM_PGP … #define ICE_IMEM_NPKB_S … #define ICE_IMEM_NPKB_IDD … #define ICE_IMEM_NPKB_OFF … #define ICE_IMEM_PGKB_S … #define ICE_IMEM_PGKB_IDD … #define ICE_IMEM_PGKB_OFF … #define ICE_IMEM_ALU0_S … #define ICE_IMEM_ALU0_IDD … #define ICE_IMEM_ALU0_OFF … #define ICE_IMEM_ALU1_S … #define ICE_IMEM_ALU1_IDD … #define ICE_IMEM_ALU1_OFF … #define ICE_IMEM_ALU2_S … #define ICE_IMEM_ALU2_IDD … #define ICE_IMEM_ALU2_OFF … /** * ice_imem_parse_item - parse 384 bits of IMEM entry * @hw: pointer to the hardware structure * @idx: index of IMEM entry * @item: item of IMEM entry * @data: IMEM entry data to be parsed * @size: size of IMEM entry */ static void ice_imem_parse_item(struct ice_hw *hw, u16 idx, void *item, void *data, int __maybe_unused size) { … } /** * ice_imem_table_get - create an imem table * @hw: pointer to the hardware structure * * Return: a pointer to the allocated IMEM table. */ static struct ice_imem_item *ice_imem_table_get(struct ice_hw *hw) { … } /*** ICE_SID_RXPARSER_METADATA_INIT section ***/ /** * ice_metainit_dump - dump an metainit item info * @hw: pointer to the hardware structure * @item: metainit item to dump */ static void ice_metainit_dump(struct ice_hw *hw, struct ice_metainit_item *item) { … } #define ICE_MI_TSR … #define ICE_MI_HO … #define ICE_MI_PC … #define ICE_MI_PGRN … #define ICE_MI_CD … #define ICE_MI_GAC … #define ICE_MI_GADM … #define ICE_MI_GADS … #define ICE_MI_GADL … #define ICE_MI_GAI … #define ICE_MI_GBC … #define ICE_MI_GBDM_S … #define ICE_MI_GBDM_IDD … #define ICE_MI_GBDM_OFF … #define ICE_MI_GBDM_GENMASK_ULL(high, low) … #define ICE_MI_GBDM … #define ICE_MI_GBDS … #define ICE_MI_GBDL … #define ICE_MI_GBI … #define ICE_MI_GCC … #define ICE_MI_GCDM … #define ICE_MI_GCDS … #define ICE_MI_GCDL … #define ICE_MI_GCI … #define ICE_MI_GDC … #define ICE_MI_GDDM … #define ICE_MI_GDDS … #define ICE_MI_GDDL … #define ICE_MI_GDI … #define ICE_MI_FLAG_S … #define ICE_MI_FLAG_IDD … #define ICE_MI_FLAG_OFF … #define ICE_MI_FLAG … /** * ice_metainit_parse_item - parse 192 bits of Metadata Init entry * @hw: pointer to the hardware structure * @idx: index of Metadata Init entry * @item: item of Metadata Init entry * @data: Metadata Init entry data to be parsed * @size: size of Metadata Init entry */ static void ice_metainit_parse_item(struct ice_hw *hw, u16 idx, void *item, void *data, int __maybe_unused size) { … } /** * ice_metainit_table_get - create a metainit table * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Metadata initialization table. */ static struct ice_metainit_item *ice_metainit_table_get(struct ice_hw *hw) { … } /** * ice_bst_tcam_search - find a TCAM item with specific type * @tcam_table: the TCAM table * @lbl_table: the lbl table to search * @type: the type we need to match against * @start: start searching from this index * * Return: a pointer to the matching BOOST TCAM item or NULL. */ struct ice_bst_tcam_item * ice_bst_tcam_search(struct ice_bst_tcam_item *tcam_table, struct ice_lbl_item *lbl_table, enum ice_lbl_type type, u16 *start) { … } /*** ICE_SID_RXPARSER_CAM, ICE_SID_RXPARSER_PG_SPILL, * ICE_SID_RXPARSER_NOMATCH_CAM and ICE_SID_RXPARSER_NOMATCH_CAM * sections ***/ static void ice_pg_cam_key_dump(struct ice_hw *hw, struct ice_pg_cam_key *key) { … } static void ice_pg_nm_cam_key_dump(struct ice_hw *hw, struct ice_pg_nm_cam_key *key) { … } static void ice_pg_cam_action_dump(struct ice_hw *hw, struct ice_pg_cam_action *action) { … } /** * ice_pg_cam_dump - dump an parse graph cam info * @hw: pointer to the hardware structure * @item: parse graph cam to dump */ static void ice_pg_cam_dump(struct ice_hw *hw, struct ice_pg_cam_item *item) { … } /** * ice_pg_nm_cam_dump - dump an parse graph no match cam info * @hw: pointer to the hardware structure * @item: parse graph no match cam to dump */ static void ice_pg_nm_cam_dump(struct ice_hw *hw, struct ice_pg_nm_cam_item *item) { … } #define ICE_PGCA_NN … #define ICE_PGCA_NPC … #define ICE_PGCA_IPG … #define ICE_PGCA_PID … #define ICE_PGCA_IMG … #define ICE_PGCA_MID … #define ICE_PGCA_ILR … #define ICE_PGCA_HOP … #define ICE_PGCA_HOI … /** * ice_pg_cam_action_init - parse 55 bits of Parse Graph CAM Action * @action: pointer to the Parse Graph CAM Action structure * @data: Parse Graph CAM Action data to be parsed */ static void ice_pg_cam_action_init(struct ice_pg_cam_action *action, u64 data) { … } #define ICE_PGNCK_VLD … #define ICE_PGNCK_NID … #define ICE_PGNCK_F0 … #define ICE_PGNCK_F1 … #define ICE_PGNCK_F2 … #define ICE_PGNCK_F3 … #define ICE_PGNCK_BH … #define ICE_PGNCK_BI … #define ICE_PGNCK_AR … /** * ice_pg_nm_cam_key_init - parse 41 bits of Parse Graph NoMatch CAM Key * @key: pointer to the Parse Graph NoMatch CAM Key structure * @data: Parse Graph NoMatch CAM Key data to be parsed */ static void ice_pg_nm_cam_key_init(struct ice_pg_nm_cam_key *key, u64 data) { … } #define ICE_PGCK_VLD … #define ICE_PGCK_NID … #define ICE_PGCK_F0 … #define ICE_PGCK_F1 … #define ICE_PGCK_F2 … #define ICE_PGCK_F3 … #define ICE_PGCK_BH … #define ICE_PGCK_BI … #define ICE_PGCK_AR … #define ICE_PGCK_NPK_S … #define ICE_PGCK_NPK_IDD … #define ICE_PGCK_NPK_OFF … #define ICE_PGCK_NPK … /** * ice_pg_cam_key_init - parse 73 bits of Parse Graph CAM Key * @key: pointer to the Parse Graph CAM Key structure * @data: Parse Graph CAM Key data to be parsed */ static void ice_pg_cam_key_init(struct ice_pg_cam_key *key, u8 *data) { … } #define ICE_PG_CAM_ACT_S … #define ICE_PG_CAM_ACT_IDD … #define ICE_PG_CAM_ACT_OFF … /** * ice_pg_cam_parse_item - parse 128 bits of Parse Graph CAM Entry * @hw: pointer to the hardware structure * @idx: index of Parse Graph CAM Entry * @item: item of Parse Graph CAM Entry * @data: Parse Graph CAM Entry data to be parsed * @size: size of Parse Graph CAM Entry */ static void ice_pg_cam_parse_item(struct ice_hw *hw, u16 idx, void *item, void *data, int __maybe_unused size) { … } #define ICE_PG_SP_CAM_KEY_S … #define ICE_PG_SP_CAM_KEY_IDD … /** * ice_pg_sp_cam_parse_item - parse 136 bits of Parse Graph Spill CAM Entry * @hw: pointer to the hardware structure * @idx: index of Parse Graph Spill CAM Entry * @item: item of Parse Graph Spill CAM Entry * @data: Parse Graph Spill CAM Entry data to be parsed * @size: size of Parse Graph Spill CAM Entry */ static void ice_pg_sp_cam_parse_item(struct ice_hw *hw, u16 idx, void *item, void *data, int __maybe_unused size) { … } #define ICE_PG_NM_CAM_ACT_S … #define ICE_PG_NM_CAM_ACT_IDD … #define ICE_PG_NM_CAM_ACT_OFF … /** * ice_pg_nm_cam_parse_item - parse 96 bits of Parse Graph NoMatch CAM Entry * @hw: pointer to the hardware structure * @idx: index of Parse Graph NoMatch CAM Entry * @item: item of Parse Graph NoMatch CAM Entry * @data: Parse Graph NoMatch CAM Entry data to be parsed * @size: size of Parse Graph NoMatch CAM Entry */ static void ice_pg_nm_cam_parse_item(struct ice_hw *hw, u16 idx, void *item, void *data, int __maybe_unused size) { … } #define ICE_PG_NM_SP_CAM_ACT_S … #define ICE_PG_NM_SP_CAM_ACT_IDD … #define ICE_PG_NM_SP_CAM_ACT_OFF … /** * ice_pg_nm_sp_cam_parse_item - parse 104 bits of Parse Graph NoMatch Spill * CAM Entry * @hw: pointer to the hardware structure * @idx: index of Parse Graph NoMatch Spill CAM Entry * @item: item of Parse Graph NoMatch Spill CAM Entry * @data: Parse Graph NoMatch Spill CAM Entry data to be parsed * @size: size of Parse Graph NoMatch Spill CAM Entry */ static void ice_pg_nm_sp_cam_parse_item(struct ice_hw *hw, u16 idx, void *item, void *data, int __maybe_unused size) { … } /** * ice_pg_cam_table_get - create a parse graph cam table * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Parse Graph CAM table. */ static struct ice_pg_cam_item *ice_pg_cam_table_get(struct ice_hw *hw) { … } /** * ice_pg_sp_cam_table_get - create a parse graph spill cam table * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Parse Graph Spill CAM table. */ static struct ice_pg_cam_item *ice_pg_sp_cam_table_get(struct ice_hw *hw) { … } /** * ice_pg_nm_cam_table_get - create a parse graph no match cam table * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Parse Graph No Match CAM table. */ static struct ice_pg_nm_cam_item *ice_pg_nm_cam_table_get(struct ice_hw *hw) { … } /** * ice_pg_nm_sp_cam_table_get - create a parse graph no match spill cam table * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Parse Graph No Match Spill CAM table. */ static struct ice_pg_nm_cam_item *ice_pg_nm_sp_cam_table_get(struct ice_hw *hw) { … } static bool __ice_pg_cam_match(struct ice_pg_cam_item *item, struct ice_pg_cam_key *key) { … } static bool __ice_pg_nm_cam_match(struct ice_pg_nm_cam_item *item, struct ice_pg_cam_key *key) { … } /** * ice_pg_cam_match - search parse graph cam table by key * @table: parse graph cam table to search * @size: cam table size * @key: search key * * Return: a pointer to the matching PG CAM item or NULL. */ struct ice_pg_cam_item *ice_pg_cam_match(struct ice_pg_cam_item *table, int size, struct ice_pg_cam_key *key) { … } /** * ice_pg_nm_cam_match - search parse graph no match cam table by key * @table: parse graph no match cam table to search * @size: cam table size * @key: search key * * Return: a pointer to the matching PG No Match CAM item or NULL. */ struct ice_pg_nm_cam_item * ice_pg_nm_cam_match(struct ice_pg_nm_cam_item *table, int size, struct ice_pg_cam_key *key) { … } /*** Ternary match ***/ /* Perform a ternary match on a 1-byte pattern (@pat) given @key and @key_inv * Rules (per bit): * Key == 0 and Key_inv == 0 : Never match (Don't care) * Key == 0 and Key_inv == 1 : Match on bit == 1 * Key == 1 and Key_inv == 0 : Match on bit == 0 * Key == 1 and Key_inv == 1 : Always match (Don't care) * * Return: true if all bits match, false otherwise. */ static bool ice_ternary_match_byte(u8 key, u8 key_inv, u8 pat) { … } static bool ice_ternary_match(const u8 *key, const u8 *key_inv, const u8 *pat, int len) { … } /*** ICE_SID_RXPARSER_BOOST_TCAM and ICE_SID_LBL_RXPARSER_TMEM sections ***/ static void ice_bst_np_kb_dump(struct ice_hw *hw, struct ice_np_keybuilder *kb) { … } static void ice_bst_pg_kb_dump(struct ice_hw *hw, struct ice_pg_keybuilder *kb) { … } static void ice_bst_alu_dump(struct ice_hw *hw, struct ice_alu *alu, int idx) { … } /** * ice_bst_tcam_dump - dump a boost tcam info * @hw: pointer to the hardware structure * @item: boost tcam to dump */ static void ice_bst_tcam_dump(struct ice_hw *hw, struct ice_bst_tcam_item *item) { … } static void ice_lbl_dump(struct ice_hw *hw, struct ice_lbl_item *item) { … } #define ICE_BST_ALU_OPC … #define ICE_BST_ALU_SS … #define ICE_BST_ALU_SL … #define ICE_BST_ALU_SXS … #define ICE_BST_ALU_SXK … #define ICE_BST_ALU_SRID … #define ICE_BST_ALU_DRID … #define ICE_BST_ALU_INC0 … #define ICE_BST_ALU_INC1 … #define ICE_BST_ALU_POO … #define ICE_BST_ALU_PO … #define ICE_BST_ALU_BA_S … #define ICE_BST_ALU_BA … #define ICE_BST_ALU_IMM … #define ICE_BST_ALU_DFE … #define ICE_BST_ALU_DS … #define ICE_BST_ALU_DL … #define ICE_BST_ALU_FEI … #define ICE_BST_ALU_FSI … /** * ice_bst_alu_init - parse 96 bits of ALU entry * @alu: pointer to the ALU entry structure * @data: ALU entry data to be parsed * @off: offset of the ALU entry data */ static void ice_bst_alu_init(struct ice_alu *alu, u8 *data, u8 off) { … } #define ICE_BST_PGKB_F0_ENA … #define ICE_BST_PGKB_F0_IDX … #define ICE_BST_PGKB_F1_ENA … #define ICE_BST_PGKB_F1_IDX … #define ICE_BST_PGKB_F2_ENA … #define ICE_BST_PGKB_F2_IDX … #define ICE_BST_PGKB_F3_ENA … #define ICE_BST_PGKB_F3_IDX … #define ICE_BST_PGKB_AR_IDX … /** * ice_bst_pgkb_init - parse 35 bits of Parse Graph Key Build * @kb: pointer to the Parse Graph Key Build structure * @data: Parse Graph Key Build data to be parsed */ static void ice_bst_pgkb_init(struct ice_pg_keybuilder *kb, u64 data) { … } #define ICE_BST_NPKB_OPC … #define ICE_BST_NPKB_S_R0 … #define ICE_BST_NPKB_L_R1 … /** * ice_bst_npkb_init - parse 18 bits of Next Protocol Key Build * @kb: pointer to the Next Protocol Key Build structure * @data: Next Protocol Key Build data to be parsed */ static void ice_bst_npkb_init(struct ice_np_keybuilder *kb, u32 data) { … } #define ICE_BT_KEY_S … #define ICE_BT_KEY_IDD … #define ICE_BT_KIV_S … #define ICE_BT_KIV_IDD … #define ICE_BT_HIG_S … #define ICE_BT_HIG_IDD … #define ICE_BT_PGP_S … #define ICE_BT_PGP_IDD … #define ICE_BT_PGP_M … #define ICE_BT_NPKB_S … #define ICE_BT_NPKB_IDD … #define ICE_BT_NPKB_OFF … #define ICE_BT_PGKB_S … #define ICE_BT_PGKB_IDD … #define ICE_BT_PGKB_OFF … #define ICE_BT_ALU0_S … #define ICE_BT_ALU0_IDD … #define ICE_BT_ALU0_OFF … #define ICE_BT_ALU1_S … #define ICE_BT_ALU1_IDD … #define ICE_BT_ALU1_OFF … #define ICE_BT_ALU2_S … #define ICE_BT_ALU2_IDD … #define ICE_BT_ALU2_OFF … /** * ice_bst_parse_item - parse 704 bits of Boost TCAM entry * @hw: pointer to the hardware structure * @idx: index of Boost TCAM entry * @item: item of Boost TCAM entry * @data: Boost TCAM entry data to be parsed * @size: size of Boost TCAM entry */ static void ice_bst_parse_item(struct ice_hw *hw, u16 idx, void *item, void *data, int __maybe_unused size) { … } /** * ice_bst_tcam_table_get - create a boost tcam table * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Boost TCAM table. */ static struct ice_bst_tcam_item *ice_bst_tcam_table_get(struct ice_hw *hw) { … } static void ice_parse_lbl_item(struct ice_hw *hw, u16 idx, void *item, void *data, int __maybe_unused size) { … } /** * ice_bst_lbl_table_get - create a boost label table * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Boost label table. */ static struct ice_lbl_item *ice_bst_lbl_table_get(struct ice_hw *hw) { … } /** * ice_bst_tcam_match - match a pattern on the boost tcam table * @tcam_table: boost tcam table to search * @pat: pattern to match * * Return: a pointer to the matching Boost TCAM item or NULL. */ struct ice_bst_tcam_item * ice_bst_tcam_match(struct ice_bst_tcam_item *tcam_table, u8 *pat) { … } /*** ICE_SID_RXPARSER_MARKER_PTYPE section ***/ /** * ice_ptype_mk_tcam_dump - dump an ptype marker tcam info * @hw: pointer to the hardware structure * @item: ptype marker tcam to dump */ static void ice_ptype_mk_tcam_dump(struct ice_hw *hw, struct ice_ptype_mk_tcam_item *item) { … } static void ice_parse_ptype_mk_tcam_item(struct ice_hw *hw, u16 idx, void *item, void *data, int size) { … } /** * ice_ptype_mk_tcam_table_get - create a ptype marker tcam table * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Marker PType TCAM table. */ static struct ice_ptype_mk_tcam_item *ice_ptype_mk_tcam_table_get(struct ice_hw *hw) { … } /** * ice_ptype_mk_tcam_match - match a pattern on a ptype marker tcam table * @table: ptype marker tcam table to search * @pat: pattern to match * @len: length of the pattern * * Return: a pointer to the matching Marker PType item or NULL. */ struct ice_ptype_mk_tcam_item * ice_ptype_mk_tcam_match(struct ice_ptype_mk_tcam_item *table, u8 *pat, int len) { … } /*** ICE_SID_RXPARSER_MARKER_GRP section ***/ /** * ice_mk_grp_dump - dump an marker group item info * @hw: pointer to the hardware structure * @item: marker group item to dump */ static void ice_mk_grp_dump(struct ice_hw *hw, struct ice_mk_grp_item *item) { … } static void ice_mk_grp_parse_item(struct ice_hw *hw, u16 idx, void *item, void *data, int __maybe_unused size) { … } /** * ice_mk_grp_table_get - create a marker group table * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Marker Group ID table. */ static struct ice_mk_grp_item *ice_mk_grp_table_get(struct ice_hw *hw) { … } /*** ICE_SID_RXPARSER_PROTO_GRP section ***/ static void ice_proto_off_dump(struct ice_hw *hw, struct ice_proto_off *po, int idx) { … } /** * ice_proto_grp_dump - dump a proto group item info * @hw: pointer to the hardware structure * @item: proto group item to dump */ static void ice_proto_grp_dump(struct ice_hw *hw, struct ice_proto_grp_item *item) { … } #define ICE_PO_POL … #define ICE_PO_PID … #define ICE_PO_OFF … /** * ice_proto_off_parse - parse 22 bits of Protocol entry * @po: pointer to the Protocol entry structure * @data: Protocol entry data to be parsed */ static void ice_proto_off_parse(struct ice_proto_off *po, u32 data) { … } /** * ice_proto_grp_parse_item - parse 192 bits of Protocol Group Table entry * @hw: pointer to the hardware structure * @idx: index of Protocol Group Table entry * @item: item of Protocol Group Table entry * @data: Protocol Group Table entry data to be parsed * @size: size of Protocol Group Table entry */ static void ice_proto_grp_parse_item(struct ice_hw *hw, u16 idx, void *item, void *data, int __maybe_unused size) { … } /** * ice_proto_grp_table_get - create a proto group table * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Protocol Group table. */ static struct ice_proto_grp_item *ice_proto_grp_table_get(struct ice_hw *hw) { … } /*** ICE_SID_RXPARSER_FLAG_REDIR section ***/ /** * ice_flg_rd_dump - dump a flag redirect item info * @hw: pointer to the hardware structure * @item: flag redirect item to dump */ static void ice_flg_rd_dump(struct ice_hw *hw, struct ice_flg_rd_item *item) { … } #define ICE_FRT_EXPO … #define ICE_FRT_IFID … /** * ice_flg_rd_parse_item - parse 8 bits of Flag Redirect Table entry * @hw: pointer to the hardware structure * @idx: index of Flag Redirect Table entry * @item: item of Flag Redirect Table entry * @data: Flag Redirect Table entry data to be parsed * @size: size of Flag Redirect Table entry */ static void ice_flg_rd_parse_item(struct ice_hw *hw, u16 idx, void *item, void *data, int __maybe_unused size) { … } /** * ice_flg_rd_table_get - create a flag redirect table * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Flags Redirection table. */ static struct ice_flg_rd_item *ice_flg_rd_table_get(struct ice_hw *hw) { … } /** * ice_flg_redirect - redirect a parser flag to packet flag * @table: flag redirect table * @psr_flg: parser flag to redirect * * Return: flag or 0 if @psr_flag = 0. */ u64 ice_flg_redirect(struct ice_flg_rd_item *table, u64 psr_flg) { … } /*** ICE_SID_XLT_KEY_BUILDER_SW, ICE_SID_XLT_KEY_BUILDER_ACL, * ICE_SID_XLT_KEY_BUILDER_FD and ICE_SID_XLT_KEY_BUILDER_RSS * sections ***/ static void ice_xlt_kb_entry_dump(struct ice_hw *hw, struct ice_xlt_kb_entry *entry, int idx) { … } /** * ice_xlt_kb_dump - dump a xlt key build info * @hw: pointer to the hardware structure * @kb: key build to dump */ static void ice_xlt_kb_dump(struct ice_hw *hw, struct ice_xlt_kb *kb) { … } #define ICE_XLT_KB_X1AS_S … #define ICE_XLT_KB_X1AS_IDD … #define ICE_XLT_KB_X1AS_OFF … #define ICE_XLT_KB_X1AS … #define ICE_XLT_KB_X2AS … #define ICE_XLT_KB_FL00 … #define ICE_XLT_KB_FL01 … #define ICE_XLT_KB_FL02 … #define ICE_XLT_KB_FL03 … #define ICE_XLT_KB_FL04 … #define ICE_XLT_KB_FL05 … #define ICE_XLT_KB_FL06_S … #define ICE_XLT_KB_FL06_IDD … #define ICE_XLT_KB_FL06_OFF … #define ICE_XLT_KB_FL06 … #define ICE_XLT_KB_FL07 … #define ICE_XLT_KB_FL08 … #define ICE_XLT_KB_FL09 … #define ICE_XLT_KB_FL10 … #define ICE_XLT_KB_FL11 … #define ICE_XLT_KB_FL12_S … #define ICE_XLT_KB_FL12_IDD … #define ICE_XLT_KB_FL12_OFF … #define ICE_XLT_KB_FL12 … #define ICE_XLT_KB_FL13 … #define ICE_XLT_KB_FL14 … #define ICE_XLT_KB_X1MS … #define ICE_XLT_KB_X2MS … /** * ice_kb_entry_init - parse 192 bits of XLT Key Builder entry * @entry: pointer to the XLT Key Builder entry structure * @data: XLT Key Builder entry data to be parsed */ static void ice_kb_entry_init(struct ice_xlt_kb_entry *entry, u8 *data) { … } #define ICE_XLT_KB_X1PM_OFF … #define ICE_XLT_KB_X2PM_OFF … #define ICE_XLT_KB_PIPM_OFF … #define ICE_XLT_KB_FL15_OFF … #define ICE_XLT_KB_TBL_OFF … /** * ice_parse_kb_data - parse 204 bits of XLT Key Build Table * @hw: pointer to the hardware structure * @kb: pointer to the XLT Key Build Table structure * @data: XLT Key Build Table data to be parsed */ static void ice_parse_kb_data(struct ice_hw *hw, struct ice_xlt_kb *kb, void *data) { … } static struct ice_xlt_kb *ice_xlt_kb_get(struct ice_hw *hw, u32 sect_type) { … } /** * ice_xlt_kb_get_sw - create switch xlt key build * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Key Builder table for Switch. */ static struct ice_xlt_kb *ice_xlt_kb_get_sw(struct ice_hw *hw) { … } /** * ice_xlt_kb_get_acl - create acl xlt key build * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Key Builder table for ACL. */ static struct ice_xlt_kb *ice_xlt_kb_get_acl(struct ice_hw *hw) { … } /** * ice_xlt_kb_get_fd - create fdir xlt key build * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Key Builder table for Flow Director. */ static struct ice_xlt_kb *ice_xlt_kb_get_fd(struct ice_hw *hw) { … } /** * ice_xlt_kb_get_rss - create rss xlt key build * @hw: pointer to the hardware structure * * Return: a pointer to the allocated Key Builder table for RSS. */ static struct ice_xlt_kb *ice_xlt_kb_get_rss(struct ice_hw *hw) { … } #define ICE_XLT_KB_MASK … /** * ice_xlt_kb_flag_get - aggregate 64 bits packet flag into 16 bits xlt flag * @kb: xlt key build * @pkt_flag: 64 bits packet flag * * Return: XLT flag or 0 if @pkt_flag = 0. */ u16 ice_xlt_kb_flag_get(struct ice_xlt_kb *kb, u64 pkt_flag) { … } /*** Parser API ***/ /** * ice_parser_create - create a parser instance * @hw: pointer to the hardware structure * * Return: a pointer to the allocated parser instance or ERR_PTR * in case of error. */ struct ice_parser *ice_parser_create(struct ice_hw *hw) { … } /** * ice_parser_destroy - destroy a parser instance * @psr: pointer to a parser instance */ void ice_parser_destroy(struct ice_parser *psr) { … } /** * ice_parser_run - parse on a packet in binary and return the result * @psr: pointer to a parser instance * @pkt_buf: packet data * @pkt_len: packet length * @rslt: input/output parameter to save parser result. * * Return: 0 on success or errno. */ int ice_parser_run(struct ice_parser *psr, const u8 *pkt_buf, int pkt_len, struct ice_parser_result *rslt) { … } /** * ice_parser_result_dump - dump a parser result info * @hw: pointer to the hardware structure * @rslt: parser result info to dump */ void ice_parser_result_dump(struct ice_hw *hw, struct ice_parser_result *rslt) { … } #define ICE_BT_VLD_KEY … #define ICE_BT_INV_KEY … static void ice_bst_dvm_set(struct ice_parser *psr, enum ice_lbl_type type, bool on) { … } /** * ice_parser_dvm_set - configure double vlan mode for parser * @psr: pointer to a parser instance * @on: true to turn on; false to turn off */ void ice_parser_dvm_set(struct ice_parser *psr, bool on) { … } static int ice_tunnel_port_set(struct ice_parser *psr, enum ice_lbl_type type, u16 udp_port, bool on) { … } /** * ice_parser_vxlan_tunnel_set - configure vxlan tunnel for parser * @psr: pointer to a parser instance * @udp_port: vxlan tunnel port in UDP header * @on: true to turn on; false to turn off * * Return: 0 on success or errno on failure. */ int ice_parser_vxlan_tunnel_set(struct ice_parser *psr, u16 udp_port, bool on) { … } /** * ice_parser_geneve_tunnel_set - configure geneve tunnel for parser * @psr: pointer to a parser instance * @udp_port: geneve tunnel port in UDP header * @on: true to turn on; false to turn off * * Return: 0 on success or errno on failure. */ int ice_parser_geneve_tunnel_set(struct ice_parser *psr, u16 udp_port, bool on) { … } /** * ice_parser_ecpri_tunnel_set - configure ecpri tunnel for parser * @psr: pointer to a parser instance * @udp_port: ecpri tunnel port in UDP header * @on: true to turn on; false to turn off * * Return: 0 on success or errno on failure. */ int ice_parser_ecpri_tunnel_set(struct ice_parser *psr, u16 udp_port, bool on) { … } /** * ice_nearest_proto_id - find nearest protocol ID * @rslt: pointer to a parser result instance * @offset: a min value for the protocol offset * @proto_id: the protocol ID (output) * @proto_off: the protocol offset (output) * * From the protocols in @rslt, find the nearest protocol that has offset * larger than @offset. * * Return: if true, the protocol's ID and offset */ static bool ice_nearest_proto_id(struct ice_parser_result *rslt, u16 offset, u8 *proto_id, u16 *proto_off) { … } /* default flag mask to cover GTP_EH_PDU, GTP_EH_PDU_LINK and TUN2 * In future, the flag masks should learn from DDP */ #define ICE_KEYBUILD_FLAG_MASK_DEFAULT_SW … #define ICE_KEYBUILD_FLAG_MASK_DEFAULT_ACL … #define ICE_KEYBUILD_FLAG_MASK_DEFAULT_FD … #define ICE_KEYBUILD_FLAG_MASK_DEFAULT_RSS … /** * ice_parser_profile_init - initialize a FXP profile based on parser result * @rslt: a instance of a parser result * @pkt_buf: packet data buffer * @msk_buf: packet mask buffer * @buf_len: packet length * @blk: FXP pipeline stage * @prof: input/output parameter to save the profile * * Return: 0 on success or errno on failure. */ int ice_parser_profile_init(struct ice_parser_result *rslt, const u8 *pkt_buf, const u8 *msk_buf, int buf_len, enum ice_block blk, struct ice_parser_profile *prof) { … } /** * ice_parser_profile_dump - dump an FXP profile info * @hw: pointer to the hardware structure * @prof: profile info to dump */ void ice_parser_profile_dump(struct ice_hw *hw, struct ice_parser_profile *prof) { … }