]> git.proxmox.com Git - ceph.git/blob - ceph/src/seastar/dpdk/drivers/net/qede/base/eth_common.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / seastar / dpdk / drivers / net / qede / base / eth_common.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2016 - 2018 Cavium Inc.
3 * All rights reserved.
4 * www.cavium.com
5 */
6
7 #ifndef __ETH_COMMON__
8 #define __ETH_COMMON__
9 /********************/
10 /* ETH FW CONSTANTS */
11 /********************/
12
13 /* FP HSI version. FP HSI is compatible if (fwVer.major == drvVer.major &&
14 * fwVer.minor >= drvVer.minor)
15 */
16 /* ETH FP HSI Major version */
17 #define ETH_HSI_VER_MAJOR 3
18 /* ETH FP HSI Minor version */
19 #define ETH_HSI_VER_MINOR 10
20
21 /* Alias for 8.7.x.x/8.8.x.x ETH FP HSI MINOR version. In this version driver
22 * is not required to set pkt_len field in eth_tx_1st_bd struct, and tunneling
23 * offload is not supported.
24 */
25 #define ETH_HSI_VER_NO_PKT_LEN_TUNN 5
26
27 #define ETH_CACHE_LINE_SIZE 64
28 #define ETH_RX_CQE_GAP 32
29 #define ETH_MAX_RAMROD_PER_CON 8
30 #define ETH_TX_BD_PAGE_SIZE_BYTES 4096
31 #define ETH_RX_BD_PAGE_SIZE_BYTES 4096
32 #define ETH_RX_CQE_PAGE_SIZE_BYTES 4096
33 #define ETH_RX_NUM_NEXT_PAGE_BDS 2
34
35 /* Limitation for Tunneled LSO Packets on the offset (in bytes) of the inner IP
36 * header (relevant to LSO for tunneled packet):
37 */
38 /* Offset is limited to 253 bytes (inclusive). */
39 #define ETH_MAX_TUNN_LSO_INNER_IPV4_OFFSET 253
40 /* Offset is limited to 251 bytes (inclusive). */
41 #define ETH_MAX_TUNN_LSO_INNER_IPV6_OFFSET 251
42
43 #define ETH_TX_MIN_BDS_PER_NON_LSO_PKT 1
44 #define ETH_TX_MAX_BDS_PER_NON_LSO_PACKET 18
45 #define ETH_TX_MAX_BDS_PER_LSO_PACKET 255
46 #define ETH_TX_MAX_LSO_HDR_NBD 4
47 #define ETH_TX_MIN_BDS_PER_LSO_PKT 3
48 #define ETH_TX_MIN_BDS_PER_TUNN_IPV6_WITH_EXT_PKT 3
49 #define ETH_TX_MIN_BDS_PER_IPV6_WITH_EXT_PKT 2
50 #define ETH_TX_MIN_BDS_PER_PKT_W_LOOPBACK_MODE 2
51 /* (QM_REG_TASKBYTECRDCOST_0, QM_VOQ_BYTE_CRD_TASK_COST) -
52 * (VLAN-TAG + CRC + IPG + PREAMBLE)
53 */
54 #define ETH_TX_MAX_NON_LSO_PKT_LEN (9700 - (4 + 4 + 12 + 8))
55 #define ETH_TX_MAX_LSO_HDR_BYTES 510
56 /* Number of BDs to consider for LSO sliding window restriction is
57 * (ETH_TX_LSO_WINDOW_BDS_NUM - hdr_nbd)
58 */
59 #define ETH_TX_LSO_WINDOW_BDS_NUM (18 - 1)
60 /* Minimum data length (in bytes) in LSO sliding window */
61 #define ETH_TX_LSO_WINDOW_MIN_LEN 9700
62 /* Maximum LSO packet TCP payload length (in bytes) */
63 #define ETH_TX_MAX_LSO_PAYLOAD_LEN 0xFE000
64 /* Number of same-as-last resources in tx switching */
65 #define ETH_TX_NUM_SAME_AS_LAST_ENTRIES 320
66 /* Value for a connection for which same as last feature is disabled */
67 #define ETH_TX_INACTIVE_SAME_AS_LAST 0xFFFF
68
69 /* Maximum number of statistics counters */
70 #define ETH_NUM_STATISTIC_COUNTERS MAX_NUM_VPORTS
71 /* Maximum number of statistics counters when doubled VF zone used */
72 #define ETH_NUM_STATISTIC_COUNTERS_DOUBLE_VF_ZONE \
73 (ETH_NUM_STATISTIC_COUNTERS - MAX_NUM_VFS / 2)
74 /* Maximum number of statistics counters when quad VF zone used */
75 #define ETH_NUM_STATISTIC_COUNTERS_QUAD_VF_ZONE \
76 (ETH_NUM_STATISTIC_COUNTERS - 3 * MAX_NUM_VFS / 4)
77
78 /* Maximum number of buffers, used for RX packet placement */
79 #define ETH_RX_MAX_BUFF_PER_PKT 5
80 /* Minimum number of free BDs in RX ring, that guarantee receiving of at least
81 * one RX packet.
82 */
83 #define ETH_RX_BD_THRESHOLD 12
84
85 /* num of MAC/VLAN filters */
86 #define ETH_NUM_MAC_FILTERS 512
87 #define ETH_NUM_VLAN_FILTERS 512
88
89 /* approx. multicast constants */
90 /* CRC seed for multicast bin calculation */
91 #define ETH_MULTICAST_BIN_FROM_MAC_SEED 0
92 #define ETH_MULTICAST_MAC_BINS 256
93 #define ETH_MULTICAST_MAC_BINS_IN_REGS (ETH_MULTICAST_MAC_BINS / 32)
94
95 /* ethernet vport update constants */
96 #define ETH_FILTER_RULES_COUNT 10
97 /* number of RSS indirection table entries, per Vport) */
98 #define ETH_RSS_IND_TABLE_ENTRIES_NUM 128
99 /* Length of RSS key (in regs) */
100 #define ETH_RSS_KEY_SIZE_REGS 10
101 /* number of available RSS engines in K2 */
102 #define ETH_RSS_ENGINE_NUM_K2 207
103 /* number of available RSS engines in BB */
104 #define ETH_RSS_ENGINE_NUM_BB 127
105
106 /* TPA constants */
107 /* Maximum number of open TPA aggregations */
108 #define ETH_TPA_MAX_AGGS_NUM 64
109 /* Maximum number of additional buffers, reported by TPA-start CQE */
110 #define ETH_TPA_CQE_START_LEN_LIST_SIZE ETH_RX_MAX_BUFF_PER_PKT
111 /* Maximum number of buffers, reported by TPA-continue CQE */
112 #define ETH_TPA_CQE_CONT_LEN_LIST_SIZE 6
113 /* Maximum number of buffers, reported by TPA-end CQE */
114 #define ETH_TPA_CQE_END_LEN_LIST_SIZE 4
115
116 /* Control frame check constants */
117 /* Number of etherType values configured by driver for control frame check */
118 #define ETH_CTL_FRAME_ETH_TYPE_NUM 4
119
120 /* GFS constants */
121 #define ETH_GFT_TRASHCAN_VPORT 0x1FF /* GFT drop flow vport number */
122
123
124
125 /*
126 * Destination port mode
127 */
128 enum dest_port_mode {
129 DEST_PORT_PHY /* Send to physical port. */,
130 DEST_PORT_LOOPBACK /* Send to loopback port. */,
131 DEST_PORT_PHY_LOOPBACK /* Send to physical and loopback port. */,
132 DEST_PORT_DROP /* Drop the packet in PBF. */,
133 MAX_DEST_PORT_MODE
134 };
135
136
137 /*
138 * Ethernet address type
139 */
140 enum eth_addr_type {
141 BROADCAST_ADDRESS,
142 MULTICAST_ADDRESS,
143 UNICAST_ADDRESS,
144 UNKNOWN_ADDRESS,
145 MAX_ETH_ADDR_TYPE
146 };
147
148
149 struct eth_tx_1st_bd_flags {
150 u8 bitfields;
151 /* Set to 1 in the first BD. (for debug) */
152 #define ETH_TX_1ST_BD_FLAGS_START_BD_MASK 0x1
153 #define ETH_TX_1ST_BD_FLAGS_START_BD_SHIFT 0
154 /* Do not allow additional VLAN manipulations on this packet. */
155 #define ETH_TX_1ST_BD_FLAGS_FORCE_VLAN_MODE_MASK 0x1
156 #define ETH_TX_1ST_BD_FLAGS_FORCE_VLAN_MODE_SHIFT 1
157 /* Recalculate IP checksum. For tunneled packet - relevant to inner header. */
158 #define ETH_TX_1ST_BD_FLAGS_IP_CSUM_MASK 0x1
159 #define ETH_TX_1ST_BD_FLAGS_IP_CSUM_SHIFT 2
160 /* Recalculate TCP/UDP checksum.
161 * For tunneled packet - relevant to inner header.
162 */
163 #define ETH_TX_1ST_BD_FLAGS_L4_CSUM_MASK 0x1
164 #define ETH_TX_1ST_BD_FLAGS_L4_CSUM_SHIFT 3
165 /* If set, insert VLAN tag from vlan field to the packet.
166 * For tunneled packet - relevant to outer header.
167 */
168 #define ETH_TX_1ST_BD_FLAGS_VLAN_INSERTION_MASK 0x1
169 #define ETH_TX_1ST_BD_FLAGS_VLAN_INSERTION_SHIFT 4
170 /* If set, this is an LSO packet. Note: For Tunneled LSO packets, the offset of
171 * the inner IPV4 (and IPV6) header is limited to 253 (and 251 respectively)
172 * bytes, inclusive.
173 */
174 #define ETH_TX_1ST_BD_FLAGS_LSO_MASK 0x1
175 #define ETH_TX_1ST_BD_FLAGS_LSO_SHIFT 5
176 /* Recalculate Tunnel IP Checksum (if Tunnel IP Header is IPv4) */
177 #define ETH_TX_1ST_BD_FLAGS_TUNN_IP_CSUM_MASK 0x1
178 #define ETH_TX_1ST_BD_FLAGS_TUNN_IP_CSUM_SHIFT 6
179 /* Recalculate Tunnel UDP/GRE Checksum (Depending on Tunnel Type) */
180 #define ETH_TX_1ST_BD_FLAGS_TUNN_L4_CSUM_MASK 0x1
181 /* Recalculate Tunnel UDP/GRE Checksum (Depending on Tunnel Type). In case of
182 * GRE tunnel, this flag means GRE CSO, and in this case GRE checksum field
183 * Must be present.
184 */
185 #define ETH_TX_1ST_BD_FLAGS_TUNN_L4_CSUM_MASK 0x1
186 #define ETH_TX_1ST_BD_FLAGS_TUNN_L4_CSUM_SHIFT 7
187 };
188
189 /*
190 * The parsing information data for the first tx bd of a given packet.
191 */
192 struct eth_tx_data_1st_bd {
193 /* VLAN tag to insert to packet (if enabled by vlan_insertion flag). */
194 __le16 vlan;
195 /* Number of BDs in packet. Should be at least 1 in non-LSO packet and at least
196 * 3 in LSO (or Tunnel with IPv6+ext) packet.
197 */
198 u8 nbds;
199 struct eth_tx_1st_bd_flags bd_flags;
200 __le16 bitfields;
201 /* Indicates a tunneled packet. Must be set for encapsulated packet. */
202 #define ETH_TX_DATA_1ST_BD_TUNN_FLAG_MASK 0x1
203 #define ETH_TX_DATA_1ST_BD_TUNN_FLAG_SHIFT 0
204 #define ETH_TX_DATA_1ST_BD_RESERVED0_MASK 0x1
205 #define ETH_TX_DATA_1ST_BD_RESERVED0_SHIFT 1
206 /* Total packet length - must be filled for non-LSO packets. */
207 #define ETH_TX_DATA_1ST_BD_PKT_LEN_MASK 0x3FFF
208 #define ETH_TX_DATA_1ST_BD_PKT_LEN_SHIFT 2
209 };
210
211 /*
212 * The parsing information data for the second tx bd of a given packet.
213 */
214 struct eth_tx_data_2nd_bd {
215 /* For tunnel with IPv6+ext - Tunnel header IP datagram length (in BYTEs) */
216 __le16 tunn_ip_size;
217 __le16 bitfields1;
218 /* For Tunnel header with IPv6 ext. - Inner L2 Header Size (in 2-byte WORDs) */
219 #define ETH_TX_DATA_2ND_BD_TUNN_INNER_L2_HDR_SIZE_W_MASK 0xF
220 #define ETH_TX_DATA_2ND_BD_TUNN_INNER_L2_HDR_SIZE_W_SHIFT 0
221 /* For Tunnel header with IPv6 ext. - Inner L2 Header MAC DA Type
222 * (use enum eth_addr_type)
223 */
224 #define ETH_TX_DATA_2ND_BD_TUNN_INNER_ETH_TYPE_MASK 0x3
225 #define ETH_TX_DATA_2ND_BD_TUNN_INNER_ETH_TYPE_SHIFT 4
226 /* Destination port mode. (use enum dest_port_mode) */
227 #define ETH_TX_DATA_2ND_BD_DEST_PORT_MODE_MASK 0x3
228 #define ETH_TX_DATA_2ND_BD_DEST_PORT_MODE_SHIFT 6
229 /* Should be 0 in all the BDs, except the first one. (for debug) */
230 #define ETH_TX_DATA_2ND_BD_START_BD_MASK 0x1
231 #define ETH_TX_DATA_2ND_BD_START_BD_SHIFT 8
232 /* For Tunnel header with IPv6 ext. - Tunnel Type (use enum eth_tx_tunn_type) */
233 #define ETH_TX_DATA_2ND_BD_TUNN_TYPE_MASK 0x3
234 #define ETH_TX_DATA_2ND_BD_TUNN_TYPE_SHIFT 9
235 /* For LSO / Tunnel header with IPv6+ext - Set if inner header is IPv6 */
236 #define ETH_TX_DATA_2ND_BD_TUNN_INNER_IPV6_MASK 0x1
237 #define ETH_TX_DATA_2ND_BD_TUNN_INNER_IPV6_SHIFT 11
238 /* In tunneling mode - Set to 1 when the Inner header is IPv6 with extension.
239 * Otherwise set to 1 if the header is IPv6 with extension.
240 */
241 #define ETH_TX_DATA_2ND_BD_IPV6_EXT_MASK 0x1
242 #define ETH_TX_DATA_2ND_BD_IPV6_EXT_SHIFT 12
243 /* Set to 1 if Tunnel (outer = encapsulating) header has IPv6 ext. (Note: 3rd BD
244 * is required, hence EDPM does not support Tunnel [outer] header with Ipv6Ext)
245 */
246 #define ETH_TX_DATA_2ND_BD_TUNN_IPV6_EXT_MASK 0x1
247 #define ETH_TX_DATA_2ND_BD_TUNN_IPV6_EXT_SHIFT 13
248 /* Set if (inner) L4 protocol is UDP. (Required when IPv6+ext (or tunnel with
249 * inner or outer Ipv6+ext) and l4_csum is set)
250 */
251 #define ETH_TX_DATA_2ND_BD_L4_UDP_MASK 0x1
252 #define ETH_TX_DATA_2ND_BD_L4_UDP_SHIFT 14
253 /* The pseudo header checksum type in the L4 checksum field. Required when
254 * IPv6+ext and l4_csum is set. (use enum eth_l4_pseudo_checksum_mode)
255 */
256 #define ETH_TX_DATA_2ND_BD_L4_PSEUDO_CSUM_MODE_MASK 0x1
257 #define ETH_TX_DATA_2ND_BD_L4_PSEUDO_CSUM_MODE_SHIFT 15
258 __le16 bitfields2;
259 /* For inner/outer header IPv6+ext - (inner) L4 header offset (in 2-byte WORDs).
260 * For regular packet - offset from the beginning of the packet. For tunneled
261 * packet - offset from the beginning of the inner header
262 */
263 #define ETH_TX_DATA_2ND_BD_L4_HDR_START_OFFSET_W_MASK 0x1FFF
264 #define ETH_TX_DATA_2ND_BD_L4_HDR_START_OFFSET_W_SHIFT 0
265 #define ETH_TX_DATA_2ND_BD_RESERVED0_MASK 0x7
266 #define ETH_TX_DATA_2ND_BD_RESERVED0_SHIFT 13
267 };
268
269 /*
270 * Firmware data for L2-EDPM packet.
271 */
272 struct eth_edpm_fw_data {
273 /* Parsing information data from the 1st BD. */
274 struct eth_tx_data_1st_bd data_1st_bd;
275 /* Parsing information data from the 2nd BD. */
276 struct eth_tx_data_2nd_bd data_2nd_bd;
277 __le32 reserved;
278 };
279
280
281 /*
282 * FW debug.
283 */
284 struct eth_fast_path_cqe_fw_debug {
285 __le16 reserved2 /* FW reserved. */;
286 };
287
288
289 /*
290 * tunneling parsing flags
291 */
292 struct eth_tunnel_parsing_flags {
293 u8 flags;
294 /* 0 - no tunneling, 1 - GENEVE, 2 - GRE, 3 - VXLAN
295 * (use enum eth_rx_tunn_type)
296 */
297 #define ETH_TUNNEL_PARSING_FLAGS_TYPE_MASK 0x3
298 #define ETH_TUNNEL_PARSING_FLAGS_TYPE_SHIFT 0
299 /* If it s not an encapsulated packet then put 0x0. If it s an encapsulated
300 * packet but the tenant-id doesn t exist then put 0x0. Else put 0x1
301 *
302 */
303 #define ETH_TUNNEL_PARSING_FLAGS_TENNANT_ID_EXIST_MASK 0x1
304 #define ETH_TUNNEL_PARSING_FLAGS_TENNANT_ID_EXIST_SHIFT 2
305 /* Type of the next header above the tunneling: 0 - unknown, 1 - L2, 2 - Ipv4,
306 * 3 - IPv6 (use enum tunnel_next_protocol)
307 */
308 #define ETH_TUNNEL_PARSING_FLAGS_NEXT_PROTOCOL_MASK 0x3
309 #define ETH_TUNNEL_PARSING_FLAGS_NEXT_PROTOCOL_SHIFT 3
310 /* The result of comparing the DA-ip of the tunnel header. */
311 #define ETH_TUNNEL_PARSING_FLAGS_FIRSTHDRIPMATCH_MASK 0x1
312 #define ETH_TUNNEL_PARSING_FLAGS_FIRSTHDRIPMATCH_SHIFT 5
313 #define ETH_TUNNEL_PARSING_FLAGS_IPV4_FRAGMENT_MASK 0x1
314 #define ETH_TUNNEL_PARSING_FLAGS_IPV4_FRAGMENT_SHIFT 6
315 #define ETH_TUNNEL_PARSING_FLAGS_IPV4_OPTIONS_MASK 0x1
316 #define ETH_TUNNEL_PARSING_FLAGS_IPV4_OPTIONS_SHIFT 7
317 };
318
319 /*
320 * PMD flow control bits
321 */
322 struct eth_pmd_flow_flags {
323 u8 flags;
324 #define ETH_PMD_FLOW_FLAGS_VALID_MASK 0x1 /* CQE valid bit */
325 #define ETH_PMD_FLOW_FLAGS_VALID_SHIFT 0
326 #define ETH_PMD_FLOW_FLAGS_TOGGLE_MASK 0x1 /* CQE ring toggle bit */
327 #define ETH_PMD_FLOW_FLAGS_TOGGLE_SHIFT 1
328 #define ETH_PMD_FLOW_FLAGS_RESERVED_MASK 0x3F
329 #define ETH_PMD_FLOW_FLAGS_RESERVED_SHIFT 2
330 };
331
332 /*
333 * Regular ETH Rx FP CQE.
334 */
335 struct eth_fast_path_rx_reg_cqe {
336 u8 type /* CQE type */;
337 u8 bitfields;
338 /* Type of calculated RSS hash (use enum rss_hash_type) */
339 #define ETH_FAST_PATH_RX_REG_CQE_RSS_HASH_TYPE_MASK 0x7
340 #define ETH_FAST_PATH_RX_REG_CQE_RSS_HASH_TYPE_SHIFT 0
341 /* Traffic Class */
342 #define ETH_FAST_PATH_RX_REG_CQE_TC_MASK 0xF
343 #define ETH_FAST_PATH_RX_REG_CQE_TC_SHIFT 3
344 #define ETH_FAST_PATH_RX_REG_CQE_RESERVED0_MASK 0x1
345 #define ETH_FAST_PATH_RX_REG_CQE_RESERVED0_SHIFT 7
346 __le16 pkt_len /* Total packet length (from the parser) */;
347 /* Parsing and error flags from the parser */
348 struct parsing_and_err_flags pars_flags;
349 __le16 vlan_tag /* 802.1q VLAN tag */;
350 __le32 rss_hash /* RSS hash result */;
351 __le16 len_on_first_bd /* Number of bytes placed on first BD */;
352 u8 placement_offset /* Offset of placement from BD start */;
353 /* Tunnel Parsing Flags */
354 struct eth_tunnel_parsing_flags tunnel_pars_flags;
355 u8 bd_num /* Number of BDs, used for packet */;
356 u8 reserved[9];
357 struct eth_fast_path_cqe_fw_debug fw_debug /* FW reserved. */;
358 u8 reserved1[3];
359 struct eth_pmd_flow_flags pmd_flags /* CQE valid and toggle bits */;
360 };
361
362
363 /*
364 * TPA-continue ETH Rx FP CQE.
365 */
366 struct eth_fast_path_rx_tpa_cont_cqe {
367 u8 type /* CQE type */;
368 u8 tpa_agg_index /* TPA aggregation index */;
369 /* List of the segment sizes */
370 __le16 len_list[ETH_TPA_CQE_CONT_LEN_LIST_SIZE];
371 u8 reserved;
372 u8 reserved1 /* FW reserved. */;
373 __le16 reserved2[ETH_TPA_CQE_CONT_LEN_LIST_SIZE] /* FW reserved. */;
374 u8 reserved3[3];
375 struct eth_pmd_flow_flags pmd_flags /* CQE valid and toggle bits */;
376 };
377
378
379 /*
380 * TPA-end ETH Rx FP CQE .
381 */
382 struct eth_fast_path_rx_tpa_end_cqe {
383 u8 type /* CQE type */;
384 u8 tpa_agg_index /* TPA aggregation index */;
385 __le16 total_packet_len /* Total aggregated packet length */;
386 u8 num_of_bds /* Total number of BDs comprising the packet */;
387 /* Aggregation end reason. Use enum eth_tpa_end_reason */
388 u8 end_reason;
389 __le16 num_of_coalesced_segs /* Number of coalesced TCP segments */;
390 __le32 ts_delta /* TCP timestamp delta */;
391 /* List of the segment sizes */
392 __le16 len_list[ETH_TPA_CQE_END_LEN_LIST_SIZE];
393 __le16 reserved3[ETH_TPA_CQE_END_LEN_LIST_SIZE] /* FW reserved. */;
394 __le16 reserved1;
395 u8 reserved2 /* FW reserved. */;
396 struct eth_pmd_flow_flags pmd_flags /* CQE valid and toggle bits */;
397 };
398
399
400 /*
401 * TPA-start ETH Rx FP CQE.
402 */
403 struct eth_fast_path_rx_tpa_start_cqe {
404 u8 type /* CQE type */;
405 u8 bitfields;
406 /* Type of calculated RSS hash (use enum rss_hash_type) */
407 #define ETH_FAST_PATH_RX_TPA_START_CQE_RSS_HASH_TYPE_MASK 0x7
408 #define ETH_FAST_PATH_RX_TPA_START_CQE_RSS_HASH_TYPE_SHIFT 0
409 /* Traffic Class */
410 #define ETH_FAST_PATH_RX_TPA_START_CQE_TC_MASK 0xF
411 #define ETH_FAST_PATH_RX_TPA_START_CQE_TC_SHIFT 3
412 #define ETH_FAST_PATH_RX_TPA_START_CQE_RESERVED0_MASK 0x1
413 #define ETH_FAST_PATH_RX_TPA_START_CQE_RESERVED0_SHIFT 7
414 __le16 seg_len /* Segment length (packetLen from the parser) */;
415 /* Parsing and error flags from the parser */
416 struct parsing_and_err_flags pars_flags;
417 __le16 vlan_tag /* 802.1q VLAN tag */;
418 __le32 rss_hash /* RSS hash result */;
419 __le16 len_on_first_bd /* Number of bytes placed on first BD */;
420 u8 placement_offset /* Offset of placement from BD start */;
421 /* Tunnel Parsing Flags */
422 struct eth_tunnel_parsing_flags tunnel_pars_flags;
423 u8 tpa_agg_index /* TPA aggregation index */;
424 u8 header_len /* Packet L2+L3+L4 header length */;
425 /* Additional BDs length list. */
426 __le16 ext_bd_len_list[ETH_TPA_CQE_START_LEN_LIST_SIZE];
427 struct eth_fast_path_cqe_fw_debug fw_debug /* FW reserved. */;
428 u8 reserved;
429 struct eth_pmd_flow_flags pmd_flags /* CQE valid and toggle bits */;
430 };
431
432
433 /*
434 * The L4 pseudo checksum mode for Ethernet
435 */
436 enum eth_l4_pseudo_checksum_mode {
437 /* Pseudo Header checksum on packet is calculated with the correct packet length
438 * field.
439 */
440 ETH_L4_PSEUDO_CSUM_CORRECT_LENGTH,
441 /* Pseudo Header checksum on packet is calculated with zero length field. */
442 ETH_L4_PSEUDO_CSUM_ZERO_LENGTH,
443 MAX_ETH_L4_PSEUDO_CHECKSUM_MODE
444 };
445
446
447
448 struct eth_rx_bd {
449 struct regpair addr /* single continues buffer */;
450 };
451
452
453 /*
454 * regular ETH Rx SP CQE
455 */
456 struct eth_slow_path_rx_cqe {
457 u8 type /* CQE type */;
458 u8 ramrod_cmd_id;
459 u8 error_flag;
460 u8 reserved[25];
461 __le16 echo;
462 u8 reserved1;
463 struct eth_pmd_flow_flags pmd_flags /* CQE valid and toggle bits */;
464 };
465
466 /*
467 * union for all ETH Rx CQE types
468 */
469 union eth_rx_cqe {
470 /* Regular FP CQE */
471 struct eth_fast_path_rx_reg_cqe fast_path_regular;
472 /* TPA-start CQE */
473 struct eth_fast_path_rx_tpa_start_cqe fast_path_tpa_start;
474 /* TPA-continue CQE */
475 struct eth_fast_path_rx_tpa_cont_cqe fast_path_tpa_cont;
476 /* TPA-end CQE */
477 struct eth_fast_path_rx_tpa_end_cqe fast_path_tpa_end;
478 struct eth_slow_path_rx_cqe slow_path /* SP CQE */;
479 };
480
481
482 /*
483 * ETH Rx CQE type
484 */
485 enum eth_rx_cqe_type {
486 ETH_RX_CQE_TYPE_UNUSED,
487 ETH_RX_CQE_TYPE_REGULAR /* Regular FP ETH Rx CQE */,
488 ETH_RX_CQE_TYPE_SLOW_PATH /* Slow path ETH Rx CQE */,
489 ETH_RX_CQE_TYPE_TPA_START /* TPA start ETH Rx CQE */,
490 ETH_RX_CQE_TYPE_TPA_CONT /* TPA Continue ETH Rx CQE */,
491 ETH_RX_CQE_TYPE_TPA_END /* TPA end ETH Rx CQE */,
492 MAX_ETH_RX_CQE_TYPE
493 };
494
495
496 /*
497 * Wrapper for PD RX CQE - used in order to cover full cache line when writing
498 * CQE
499 */
500 struct eth_rx_pmd_cqe {
501 union eth_rx_cqe cqe /* CQE data itself */;
502 u8 reserved[ETH_RX_CQE_GAP];
503 };
504
505
506 /*
507 * Eth RX Tunnel Type
508 */
509 enum eth_rx_tunn_type {
510 ETH_RX_NO_TUNN /* No Tunnel. */,
511 ETH_RX_TUNN_GENEVE /* GENEVE Tunnel. */,
512 ETH_RX_TUNN_GRE /* GRE Tunnel. */,
513 ETH_RX_TUNN_VXLAN /* VXLAN Tunnel. */,
514 MAX_ETH_RX_TUNN_TYPE
515 };
516
517
518
519 /*
520 * Aggregation end reason.
521 */
522 enum eth_tpa_end_reason {
523 ETH_AGG_END_UNUSED,
524 ETH_AGG_END_SP_UPDATE /* SP configuration update */,
525 /* Maximum aggregation length or maximum buffer number used. */
526 ETH_AGG_END_MAX_LEN,
527 /* TCP PSH flag or TCP payload length below continue threshold. */
528 ETH_AGG_END_LAST_SEG,
529 ETH_AGG_END_TIMEOUT /* Timeout expiration. */,
530 /* Packet header not consistency: different IPv4 TOS, TTL or flags, IPv6 TC,
531 * Hop limit or Flow label, TCP header length or TS options. In GRO different
532 * TS value, SMAC, DMAC, ackNum, windowSize or VLAN
533 */
534 ETH_AGG_END_NOT_CONSISTENT,
535 /* Out of order or retransmission packet: sequence, ack or timestamp not
536 * consistent with previous segment.
537 */
538 ETH_AGG_END_OUT_OF_ORDER,
539 /* Next segment cant be aggregated due to LLC/SNAP, IP error, IP fragment, IPv4
540 * options, IPv6 extension, IP ECN = CE, TCP errors, TCP options, zero TCP
541 * payload length , TCP flags or not supported tunnel header options.
542 */
543 ETH_AGG_END_NON_TPA_SEG,
544 MAX_ETH_TPA_END_REASON
545 };
546
547
548
549 /*
550 * The first tx bd of a given packet
551 */
552 struct eth_tx_1st_bd {
553 struct regpair addr /* Single continuous buffer */;
554 __le16 nbytes /* Number of bytes in this BD. */;
555 struct eth_tx_data_1st_bd data /* Parsing information data. */;
556 };
557
558
559
560 /*
561 * The second tx bd of a given packet
562 */
563 struct eth_tx_2nd_bd {
564 struct regpair addr /* Single continuous buffer */;
565 __le16 nbytes /* Number of bytes in this BD. */;
566 struct eth_tx_data_2nd_bd data /* Parsing information data. */;
567 };
568
569
570 /*
571 * The parsing information data for the third tx bd of a given packet.
572 */
573 struct eth_tx_data_3rd_bd {
574 __le16 lso_mss /* For LSO packet - the MSS in bytes. */;
575 __le16 bitfields;
576 /* For LSO with inner/outer IPv6+ext - TCP header length (in 4-byte WORDs) */
577 #define ETH_TX_DATA_3RD_BD_TCP_HDR_LEN_DW_MASK 0xF
578 #define ETH_TX_DATA_3RD_BD_TCP_HDR_LEN_DW_SHIFT 0
579 /* LSO - number of BDs which contain headers. value should be in range
580 * (1..ETH_TX_MAX_LSO_HDR_NBD).
581 */
582 #define ETH_TX_DATA_3RD_BD_HDR_NBD_MASK 0xF
583 #define ETH_TX_DATA_3RD_BD_HDR_NBD_SHIFT 4
584 /* Should be 0 in all the BDs, except the first one. (for debug) */
585 #define ETH_TX_DATA_3RD_BD_START_BD_MASK 0x1
586 #define ETH_TX_DATA_3RD_BD_START_BD_SHIFT 8
587 #define ETH_TX_DATA_3RD_BD_RESERVED0_MASK 0x7F
588 #define ETH_TX_DATA_3RD_BD_RESERVED0_SHIFT 9
589 /* For tunnel with IPv6+ext - Pointer to tunnel L4 Header (in 2-byte WORDs) */
590 u8 tunn_l4_hdr_start_offset_w;
591 /* For tunnel with IPv6+ext - Total size of Tunnel Header (in 2-byte WORDs) */
592 u8 tunn_hdr_size_w;
593 };
594
595 /*
596 * The third tx bd of a given packet
597 */
598 struct eth_tx_3rd_bd {
599 struct regpair addr /* Single continuous buffer */;
600 __le16 nbytes /* Number of bytes in this BD. */;
601 struct eth_tx_data_3rd_bd data /* Parsing information data. */;
602 };
603
604
605 /*
606 * Complementary information for the regular tx bd of a given packet.
607 */
608 struct eth_tx_data_bd {
609 __le16 reserved0;
610 __le16 bitfields;
611 #define ETH_TX_DATA_BD_RESERVED1_MASK 0xFF
612 #define ETH_TX_DATA_BD_RESERVED1_SHIFT 0
613 /* Should be 0 in all the BDs, except the first one. (for debug) */
614 #define ETH_TX_DATA_BD_START_BD_MASK 0x1
615 #define ETH_TX_DATA_BD_START_BD_SHIFT 8
616 #define ETH_TX_DATA_BD_RESERVED2_MASK 0x7F
617 #define ETH_TX_DATA_BD_RESERVED2_SHIFT 9
618 __le16 reserved3;
619 };
620
621 /*
622 * The common regular TX BD ring element
623 */
624 struct eth_tx_bd {
625 struct regpair addr /* Single continuous buffer */;
626 __le16 nbytes /* Number of bytes in this BD. */;
627 struct eth_tx_data_bd data /* Complementary information. */;
628 };
629
630
631 union eth_tx_bd_types {
632 struct eth_tx_1st_bd first_bd /* The first tx bd of a given packet */;
633 /* The second tx bd of a given packet */
634 struct eth_tx_2nd_bd second_bd;
635 struct eth_tx_3rd_bd third_bd /* The third tx bd of a given packet */;
636 struct eth_tx_bd reg_bd /* The common non-special bd */;
637 };
638
639
640
641
642
643
644 /*
645 * Eth Tx Tunnel Type
646 */
647 enum eth_tx_tunn_type {
648 ETH_TX_TUNN_GENEVE /* GENEVE Tunnel. */,
649 ETH_TX_TUNN_TTAG /* T-Tag Tunnel. */,
650 ETH_TX_TUNN_GRE /* GRE Tunnel. */,
651 ETH_TX_TUNN_VXLAN /* VXLAN Tunnel. */,
652 MAX_ETH_TX_TUNN_TYPE
653 };
654
655
656 /*
657 * Ystorm Queue Zone
658 */
659 struct xstorm_eth_queue_zone {
660 /* Tx interrupt coalescing TimeSet */
661 struct coalescing_timeset int_coalescing_timeset;
662 u8 reserved[7];
663 };
664
665
666 /*
667 * ETH doorbell data
668 */
669 struct eth_db_data {
670 u8 params;
671 /* destination of doorbell (use enum db_dest) */
672 #define ETH_DB_DATA_DEST_MASK 0x3
673 #define ETH_DB_DATA_DEST_SHIFT 0
674 /* aggregative command to CM (use enum db_agg_cmd_sel) */
675 #define ETH_DB_DATA_AGG_CMD_MASK 0x3
676 #define ETH_DB_DATA_AGG_CMD_SHIFT 2
677 #define ETH_DB_DATA_BYPASS_EN_MASK 0x1 /* enable QM bypass */
678 #define ETH_DB_DATA_BYPASS_EN_SHIFT 4
679 #define ETH_DB_DATA_RESERVED_MASK 0x1
680 #define ETH_DB_DATA_RESERVED_SHIFT 5
681 /* aggregative value selection */
682 #define ETH_DB_DATA_AGG_VAL_SEL_MASK 0x3
683 #define ETH_DB_DATA_AGG_VAL_SEL_SHIFT 6
684 /* bit for every DQ counter flags in CM context that DQ can increment */
685 u8 agg_flags;
686 __le16 bd_prod;
687 };
688
689 #endif /* __ETH_COMMON__ */