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