1
2
3
4
5#ifndef _ENA_ETH_IO_H_
6#define _ENA_ETH_IO_H_
7
8enum ena_eth_io_l3_proto_index {
9 ENA_ETH_IO_L3_PROTO_UNKNOWN = 0,
10 ENA_ETH_IO_L3_PROTO_IPV4 = 8,
11 ENA_ETH_IO_L3_PROTO_IPV6 = 11,
12 ENA_ETH_IO_L3_PROTO_FCOE = 21,
13 ENA_ETH_IO_L3_PROTO_ROCE = 22,
14};
15
16enum ena_eth_io_l4_proto_index {
17 ENA_ETH_IO_L4_PROTO_UNKNOWN = 0,
18 ENA_ETH_IO_L4_PROTO_TCP = 12,
19 ENA_ETH_IO_L4_PROTO_UDP = 13,
20 ENA_ETH_IO_L4_PROTO_ROUTEABLE_ROCE = 23,
21};
22
23struct ena_eth_io_tx_desc {
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 u32 len_ctrl;
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77 u32 meta_ctrl;
78
79 u32 buff_addr_lo;
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96 u32 buff_addr_hi_hdr_sz;
97};
98
99struct ena_eth_io_tx_meta_desc {
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127 u32 len_ctrl;
128
129
130
131
132 u32 word1;
133
134
135
136
137
138
139
140
141
142 u32 word2;
143
144 u32 reserved;
145};
146
147struct ena_eth_io_tx_cdesc {
148
149 u16 req_id;
150
151 u8 status;
152
153
154
155
156
157 u8 flags;
158
159 u16 sub_qid;
160
161 u16 sq_head_idx;
162};
163
164struct ena_eth_io_rx_desc {
165
166 u16 length;
167
168
169 u8 reserved2;
170
171
172
173
174
175
176
177
178
179
180 u8 ctrl;
181
182 u16 req_id;
183
184
185 u16 reserved6;
186
187 u32 buff_addr_lo;
188
189 u16 buff_addr_hi;
190
191
192 u16 reserved16_w3;
193};
194
195
196
197
198struct ena_eth_io_rx_cdesc_base {
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229 u32 status;
230
231 u16 length;
232
233 u16 req_id;
234
235
236 u32 hash;
237
238 u16 sub_qid;
239
240 u8 offset;
241
242 u8 reserved;
243};
244
245
246struct ena_eth_io_rx_cdesc_ext {
247 struct ena_eth_io_rx_cdesc_base base;
248
249 u32 buff_addr_lo;
250
251 u16 buff_addr_hi;
252
253 u16 reserved16;
254
255 u32 reserved_w6;
256
257 u32 reserved_w7;
258};
259
260struct ena_eth_io_intr_reg {
261
262
263
264
265
266 u32 intr_control;
267};
268
269struct ena_eth_io_numa_node_cfg_reg {
270
271
272
273
274 u32 numa_cfg;
275};
276
277
278#define ENA_ETH_IO_TX_DESC_LENGTH_MASK GENMASK(15, 0)
279#define ENA_ETH_IO_TX_DESC_REQ_ID_HI_SHIFT 16
280#define ENA_ETH_IO_TX_DESC_REQ_ID_HI_MASK GENMASK(21, 16)
281#define ENA_ETH_IO_TX_DESC_META_DESC_SHIFT 23
282#define ENA_ETH_IO_TX_DESC_META_DESC_MASK BIT(23)
283#define ENA_ETH_IO_TX_DESC_PHASE_SHIFT 24
284#define ENA_ETH_IO_TX_DESC_PHASE_MASK BIT(24)
285#define ENA_ETH_IO_TX_DESC_FIRST_SHIFT 26
286#define ENA_ETH_IO_TX_DESC_FIRST_MASK BIT(26)
287#define ENA_ETH_IO_TX_DESC_LAST_SHIFT 27
288#define ENA_ETH_IO_TX_DESC_LAST_MASK BIT(27)
289#define ENA_ETH_IO_TX_DESC_COMP_REQ_SHIFT 28
290#define ENA_ETH_IO_TX_DESC_COMP_REQ_MASK BIT(28)
291#define ENA_ETH_IO_TX_DESC_L3_PROTO_IDX_MASK GENMASK(3, 0)
292#define ENA_ETH_IO_TX_DESC_DF_SHIFT 4
293#define ENA_ETH_IO_TX_DESC_DF_MASK BIT(4)
294#define ENA_ETH_IO_TX_DESC_TSO_EN_SHIFT 7
295#define ENA_ETH_IO_TX_DESC_TSO_EN_MASK BIT(7)
296#define ENA_ETH_IO_TX_DESC_L4_PROTO_IDX_SHIFT 8
297#define ENA_ETH_IO_TX_DESC_L4_PROTO_IDX_MASK GENMASK(12, 8)
298#define ENA_ETH_IO_TX_DESC_L3_CSUM_EN_SHIFT 13
299#define ENA_ETH_IO_TX_DESC_L3_CSUM_EN_MASK BIT(13)
300#define ENA_ETH_IO_TX_DESC_L4_CSUM_EN_SHIFT 14
301#define ENA_ETH_IO_TX_DESC_L4_CSUM_EN_MASK BIT(14)
302#define ENA_ETH_IO_TX_DESC_ETHERNET_FCS_DIS_SHIFT 15
303#define ENA_ETH_IO_TX_DESC_ETHERNET_FCS_DIS_MASK BIT(15)
304#define ENA_ETH_IO_TX_DESC_L4_CSUM_PARTIAL_SHIFT 17
305#define ENA_ETH_IO_TX_DESC_L4_CSUM_PARTIAL_MASK BIT(17)
306#define ENA_ETH_IO_TX_DESC_REQ_ID_LO_SHIFT 22
307#define ENA_ETH_IO_TX_DESC_REQ_ID_LO_MASK GENMASK(31, 22)
308#define ENA_ETH_IO_TX_DESC_ADDR_HI_MASK GENMASK(15, 0)
309#define ENA_ETH_IO_TX_DESC_HEADER_LENGTH_SHIFT 24
310#define ENA_ETH_IO_TX_DESC_HEADER_LENGTH_MASK GENMASK(31, 24)
311
312
313#define ENA_ETH_IO_TX_META_DESC_REQ_ID_LO_MASK GENMASK(9, 0)
314#define ENA_ETH_IO_TX_META_DESC_EXT_VALID_SHIFT 14
315#define ENA_ETH_IO_TX_META_DESC_EXT_VALID_MASK BIT(14)
316#define ENA_ETH_IO_TX_META_DESC_MSS_HI_SHIFT 16
317#define ENA_ETH_IO_TX_META_DESC_MSS_HI_MASK GENMASK(19, 16)
318#define ENA_ETH_IO_TX_META_DESC_ETH_META_TYPE_SHIFT 20
319#define ENA_ETH_IO_TX_META_DESC_ETH_META_TYPE_MASK BIT(20)
320#define ENA_ETH_IO_TX_META_DESC_META_STORE_SHIFT 21
321#define ENA_ETH_IO_TX_META_DESC_META_STORE_MASK BIT(21)
322#define ENA_ETH_IO_TX_META_DESC_META_DESC_SHIFT 23
323#define ENA_ETH_IO_TX_META_DESC_META_DESC_MASK BIT(23)
324#define ENA_ETH_IO_TX_META_DESC_PHASE_SHIFT 24
325#define ENA_ETH_IO_TX_META_DESC_PHASE_MASK BIT(24)
326#define ENA_ETH_IO_TX_META_DESC_FIRST_SHIFT 26
327#define ENA_ETH_IO_TX_META_DESC_FIRST_MASK BIT(26)
328#define ENA_ETH_IO_TX_META_DESC_LAST_SHIFT 27
329#define ENA_ETH_IO_TX_META_DESC_LAST_MASK BIT(27)
330#define ENA_ETH_IO_TX_META_DESC_COMP_REQ_SHIFT 28
331#define ENA_ETH_IO_TX_META_DESC_COMP_REQ_MASK BIT(28)
332#define ENA_ETH_IO_TX_META_DESC_REQ_ID_HI_MASK GENMASK(5, 0)
333#define ENA_ETH_IO_TX_META_DESC_L3_HDR_LEN_MASK GENMASK(7, 0)
334#define ENA_ETH_IO_TX_META_DESC_L3_HDR_OFF_SHIFT 8
335#define ENA_ETH_IO_TX_META_DESC_L3_HDR_OFF_MASK GENMASK(15, 8)
336#define ENA_ETH_IO_TX_META_DESC_L4_HDR_LEN_IN_WORDS_SHIFT 16
337#define ENA_ETH_IO_TX_META_DESC_L4_HDR_LEN_IN_WORDS_MASK GENMASK(21, 16)
338#define ENA_ETH_IO_TX_META_DESC_MSS_LO_SHIFT 22
339#define ENA_ETH_IO_TX_META_DESC_MSS_LO_MASK GENMASK(31, 22)
340
341
342#define ENA_ETH_IO_TX_CDESC_PHASE_MASK BIT(0)
343
344
345#define ENA_ETH_IO_RX_DESC_PHASE_MASK BIT(0)
346#define ENA_ETH_IO_RX_DESC_FIRST_SHIFT 2
347#define ENA_ETH_IO_RX_DESC_FIRST_MASK BIT(2)
348#define ENA_ETH_IO_RX_DESC_LAST_SHIFT 3
349#define ENA_ETH_IO_RX_DESC_LAST_MASK BIT(3)
350#define ENA_ETH_IO_RX_DESC_COMP_REQ_SHIFT 4
351#define ENA_ETH_IO_RX_DESC_COMP_REQ_MASK BIT(4)
352
353
354#define ENA_ETH_IO_RX_CDESC_BASE_L3_PROTO_IDX_MASK GENMASK(4, 0)
355#define ENA_ETH_IO_RX_CDESC_BASE_SRC_VLAN_CNT_SHIFT 5
356#define ENA_ETH_IO_RX_CDESC_BASE_SRC_VLAN_CNT_MASK GENMASK(6, 5)
357#define ENA_ETH_IO_RX_CDESC_BASE_L4_PROTO_IDX_SHIFT 8
358#define ENA_ETH_IO_RX_CDESC_BASE_L4_PROTO_IDX_MASK GENMASK(12, 8)
359#define ENA_ETH_IO_RX_CDESC_BASE_L3_CSUM_ERR_SHIFT 13
360#define ENA_ETH_IO_RX_CDESC_BASE_L3_CSUM_ERR_MASK BIT(13)
361#define ENA_ETH_IO_RX_CDESC_BASE_L4_CSUM_ERR_SHIFT 14
362#define ENA_ETH_IO_RX_CDESC_BASE_L4_CSUM_ERR_MASK BIT(14)
363#define ENA_ETH_IO_RX_CDESC_BASE_IPV4_FRAG_SHIFT 15
364#define ENA_ETH_IO_RX_CDESC_BASE_IPV4_FRAG_MASK BIT(15)
365#define ENA_ETH_IO_RX_CDESC_BASE_L4_CSUM_CHECKED_SHIFT 16
366#define ENA_ETH_IO_RX_CDESC_BASE_L4_CSUM_CHECKED_MASK BIT(16)
367#define ENA_ETH_IO_RX_CDESC_BASE_PHASE_SHIFT 24
368#define ENA_ETH_IO_RX_CDESC_BASE_PHASE_MASK BIT(24)
369#define ENA_ETH_IO_RX_CDESC_BASE_L3_CSUM2_SHIFT 25
370#define ENA_ETH_IO_RX_CDESC_BASE_L3_CSUM2_MASK BIT(25)
371#define ENA_ETH_IO_RX_CDESC_BASE_FIRST_SHIFT 26
372#define ENA_ETH_IO_RX_CDESC_BASE_FIRST_MASK BIT(26)
373#define ENA_ETH_IO_RX_CDESC_BASE_LAST_SHIFT 27
374#define ENA_ETH_IO_RX_CDESC_BASE_LAST_MASK BIT(27)
375#define ENA_ETH_IO_RX_CDESC_BASE_BUFFER_SHIFT 30
376#define ENA_ETH_IO_RX_CDESC_BASE_BUFFER_MASK BIT(30)
377
378
379#define ENA_ETH_IO_INTR_REG_RX_INTR_DELAY_MASK GENMASK(14, 0)
380#define ENA_ETH_IO_INTR_REG_TX_INTR_DELAY_SHIFT 15
381#define ENA_ETH_IO_INTR_REG_TX_INTR_DELAY_MASK GENMASK(29, 15)
382#define ENA_ETH_IO_INTR_REG_INTR_UNMASK_SHIFT 30
383#define ENA_ETH_IO_INTR_REG_INTR_UNMASK_MASK BIT(30)
384
385
386#define ENA_ETH_IO_NUMA_NODE_CFG_REG_NUMA_MASK GENMASK(7, 0)
387#define ENA_ETH_IO_NUMA_NODE_CFG_REG_ENABLED_SHIFT 31
388#define ENA_ETH_IO_NUMA_NODE_CFG_REG_ENABLED_MASK BIT(31)
389
390#endif
391