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