net/ice/base: init IMEM table for parser
[dpdk.git] / drivers / net / ice / base / ice_imem.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2001-2021 Intel Corporation
3  */
4
5 #ifndef _ICE_IMEM_H_
6 #define _ICE_IMEM_H_
7
8 struct ice_bst_main {
9         bool al0;
10         bool al1;
11         bool al2;
12         bool pg;
13 };
14
15 struct ice_bst_keybuilder {
16         u8 priority;
17         bool tsr_ctrl;
18 };
19
20 struct ice_np_keybuilder {
21         u8 ops;
22         u8 start_or_reg0;
23         u8 len_or_reg1;
24 };
25
26 struct ice_pg_keybuilder {
27         bool flag0_ena;
28         bool flag1_ena;
29         bool flag2_ena;
30         bool flag3_ena;
31         u8 flag0_idx;
32         u8 flag1_idx;
33         u8 flag2_idx;
34         u8 flag3_idx;
35         u8 alu_reg_idx;
36 };
37
38 enum ice_alu_opcode {
39         ICE_ALU_PARK = 0,
40         ICE_ALU_MOV_ADD = 1,
41         ICE_ALU_ADD = 2,
42         ICE_ALU_MOV_AND = 4,
43         ICE_ALU_AND = 5,
44         ICE_ALU_AND_IMM = 6,
45         ICE_ALU_MOV_OR = 7,
46         ICE_ALU_OR = 8,
47         ICE_ALU_MOV_XOR = 9,
48         ICE_ALU_XOR = 10,
49         ICE_ALU_NOP = 11,
50         ICE_ALU_BR = 12,
51         ICE_ALU_BREQ = 13,
52         ICE_ALU_BRNEQ = 14,
53         ICE_ALU_BRGT = 15,
54         ICE_ALU_BRLT = 16,
55         ICE_ALU_BRGEQ = 17,
56         ICE_ALU_BRLEG = 18,
57         ICE_ALU_SETEQ = 19,
58         ICE_ALU_ANDEQ = 20,
59         ICE_ALU_OREQ = 21,
60         ICE_ALU_SETNEQ = 22,
61         ICE_ALU_ANDNEQ = 23,
62         ICE_ALU_ORNEQ = 24,
63         ICE_ALU_SETGT = 25,
64         ICE_ALU_ANDGT = 26,
65         ICE_ALU_ORGT = 27,
66         ICE_ALU_SETLT = 28,
67         ICE_ALU_ANDLT = 29,
68         ICE_ALU_ORLT = 30,
69         ICE_ALU_MOV_SUB = 31,
70         ICE_ALU_SUB = 32,
71         ICE_ALU_INVALID = 64,
72 };
73
74 struct ice_alu {
75         enum ice_alu_opcode opc;
76         u8 src_start;
77         u8 src_len;
78         bool shift_xlate_select;
79         u8 shift_xlate_key;
80         u8 src_reg_id;
81         u8 dst_reg_id;
82         bool inc0;
83         bool inc1;
84         u8 proto_offset_opc;
85         u8 proto_offset;
86         u8 branch_addr;
87         u16 imm;
88         bool dedicate_flags_ena;
89         u8 dst_start;
90         u8 dst_len;
91         bool flags_extr_imm;
92         u8 flags_start_imm;
93 };
94
95 struct ice_imem_item {
96         u16 idx;
97         struct ice_bst_main b_m;
98         struct ice_bst_keybuilder b_kb;
99         u8 pg;
100         struct ice_np_keybuilder np_kb;
101         struct ice_pg_keybuilder pg_kb;
102         struct ice_alu alu0;
103         struct ice_alu alu1;
104         struct ice_alu alu2;
105 };
106
107 void ice_imem_dump(struct ice_hw *hw, struct ice_imem_item *item);
108 struct ice_imem_item *ice_imem_table_get(struct ice_hw *hw);
109 #endif /* _ICE_IMEM_H_ */