1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2001-2021 Intel Corporation
5 #include "ice_common.h"
6 #include "ice_parser_util.h"
8 #define ICE_FLG_RD_TABLE_SIZE 64
11 * ice_flg_rd_dump - dump a flag redirect item info
12 * @ice_hw: pointer to the hardware structure
13 * @item: flag redirect item to dump
15 void ice_flg_rd_dump(struct ice_hw *hw, struct ice_flg_rd_item *item)
17 ice_info(hw, "index = %d\n", item->idx);
18 ice_info(hw, "expose = %d\n", item->expose);
19 ice_info(hw, "intr_flg_id = %d\n", item->intr_flg_id);
22 /** The function parses a 8 bits Flag Redirect Table entry with below format:
23 * BIT 0: Expose (rdi->expose)
24 * BIT 1-6: Internal Flag ID (rdi->intr_flg_id)
27 static void _flg_rd_parse_item(struct ice_hw *hw, u16 idx, void *item,
30 struct ice_flg_rd_item *rdi = (struct ice_flg_rd_item *)item;
34 rdi->expose = (d8 & 0x1) != 0;
35 rdi->intr_flg_id = (u8)((d8 >> 1) & 0x3f);
37 if (hw->debug_mask & ICE_DBG_PARSER)
38 ice_flg_rd_dump(hw, rdi);
42 * ice_flg_rd_table_get - create a flag redirect table
43 * @ice_hw: pointer to the hardware structure
45 struct ice_flg_rd_item *ice_flg_rd_table_get(struct ice_hw *hw)
47 return (struct ice_flg_rd_item *)
48 ice_parser_create_table(hw, ICE_SID_RXPARSER_FLAG_REDIR,
49 sizeof(struct ice_flg_rd_item),
50 ICE_FLG_RD_TABLE_SIZE,
51 ice_parser_sect_item_get,
52 _flg_rd_parse_item, false);
56 * ice_flg_redirect - redirect a parser flag to packet flag
57 * @table: flag redirect table
58 * @psr_flg: parser flag to redirect
60 u64 ice_flg_redirect(struct ice_flg_rd_item *table, u64 psr_flg)
65 for (i = 0; i < 64; i++) {
66 struct ice_flg_rd_item *item = &table[i];
71 if (psr_flg & (1ul << item->intr_flg_id))