crypto/dpaa_sec: support authonly and chain with raw API
[dpdk.git] / drivers / net / ice / base / ice_mk_grp.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2001-2021 Intel Corporation
3  */
4
5 #include "ice_common.h"
6 #include "ice_parser_util.h"
7
8 #define ICE_MK_GRP_TABLE_SIZE 128
9 #define ICE_MK_COUNT_PER_GRP 8
10
11 /**
12  * ice_mk_grp_dump - dump an marker group item info
13  * @ice_hw: pointer to the hardware structure
14  * @item: marker group item to dump
15  */
16 void ice_mk_grp_dump(struct ice_hw *hw, struct ice_mk_grp_item *item)
17 {
18         int i;
19
20         ice_info(hw, "index = %d\n", item->idx);
21         ice_info(hw, "markers: ");
22         for (i = 0; i < ICE_MK_COUNT_PER_GRP; i++)
23                 ice_info(hw, "%d ", item->markers[i]);
24         ice_info(hw, "\n");
25 }
26
27 static void _mk_grp_parse_item(struct ice_hw *hw, u16 idx, void *item,
28                                void *data, int size)
29 {
30         struct ice_mk_grp_item *grp = (struct ice_mk_grp_item *)item;
31         u8 *buf = (u8 *)data;
32         int i;
33
34         grp->idx = idx;
35
36         for (i = 0; i < ICE_MK_COUNT_PER_GRP; i++)
37                 grp->markers[i] = buf[i];
38
39         if (hw->debug_mask & ICE_DBG_PARSER)
40                 ice_mk_grp_dump(hw, grp);
41 }
42
43 /**
44  * ice_mk_grp_table_get - create a marker group table
45  * @ice_hw: pointer to the hardware structure
46  */
47 struct ice_mk_grp_item *ice_mk_grp_table_get(struct ice_hw *hw)
48 {
49         return (struct ice_mk_grp_item *)
50                 ice_parser_create_table(hw, ICE_SID_RXPARSER_MARKER_GRP,
51                                         sizeof(struct ice_mk_grp_item),
52                                         ICE_MK_GRP_TABLE_SIZE,
53                                         ice_parser_sect_item_get,
54                                         _mk_grp_parse_item, false);
55 }