1 /* 2 * Copyright (c) 2007, 2014 Mellanox Technologies. All rights reserved. 3 * 4 * This software is available to you under a choice of one of two 5 * licenses. You may choose to be licensed under the terms of the GNU 6 * General Public License (GPL) Version 2, available from the file 7 * COPYING in the main directory of this source tree, or the 8 * OpenIB.org BSD license below: 9 * 10 * Redistribution and use in source and binary forms, with or 11 * without modification, are permitted provided that the following 12 * conditions are met: 13 * 14 * - Redistributions of source code must retain the above 15 * copyright notice, this list of conditions and the following 16 * disclaimer. 17 * 18 * - Redistributions in binary form must reproduce the above 19 * copyright notice, this list of conditions and the following 20 * disclaimer in the documentation and/or other materials 21 * provided with the distribution. 22 * 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 * SOFTWARE. 31 * 32 */ 33 34 #ifndef _MLX4_EN_PORT_H_ 35 #define _MLX4_EN_PORT_H_ 36 37 38 #define SET_PORT_GEN_ALL_VALID 0x7 39 #define SET_PORT_PROMISC_SHIFT 31 40 #define SET_PORT_MC_PROMISC_SHIFT 30 41 42 #define MLX4_EN_NUM_TC 8 43 44 #define VLAN_FLTR_SIZE 128 45 struct mlx4_set_vlan_fltr_mbox { 46 __be32 entry[VLAN_FLTR_SIZE]; 47 }; 48 49 50 enum { 51 MLX4_MCAST_CONFIG = 0, 52 MLX4_MCAST_DISABLE = 1, 53 MLX4_MCAST_ENABLE = 2, 54 }; 55 56 enum mlx4_link_mode { 57 MLX4_1000BASE_CX_SGMII = 0, 58 MLX4_1000BASE_KX = 1, 59 MLX4_10GBASE_CX4 = 2, 60 MLX4_10GBASE_KX4 = 3, 61 MLX4_10GBASE_KR = 4, 62 MLX4_20GBASE_KR2 = 5, 63 MLX4_40GBASE_CR4 = 6, 64 MLX4_40GBASE_KR4 = 7, 65 MLX4_56GBASE_KR4 = 8, 66 MLX4_10GBASE_CR = 12, 67 MLX4_10GBASE_SR = 13, 68 MLX4_40GBASE_SR4 = 15, 69 MLX4_56GBASE_CR4 = 17, 70 MLX4_56GBASE_SR4 = 18, 71 MLX4_100BASE_TX = 24, 72 MLX4_1000BASE_T = 25, 73 MLX4_10GBASE_T = 26, 74 }; 75 76 #define MLX4_PROT_MASK(link_mode) (1<<(link_mode)) 77 78 enum { 79 MLX4_EN_100M_SPEED = 0x04, 80 MLX4_EN_10G_SPEED_XAUI = 0x00, 81 MLX4_EN_10G_SPEED_XFI = 0x01, 82 MLX4_EN_1G_SPEED = 0x02, 83 MLX4_EN_20G_SPEED = 0x08, 84 MLX4_EN_40G_SPEED = 0x40, 85 MLX4_EN_56G_SPEED = 0x20, 86 MLX4_EN_OTHER_SPEED = 0x0f, 87 }; 88 89 struct mlx4_en_query_port_context { 90 u8 link_up; 91 #define MLX4_EN_LINK_UP_MASK 0x80 92 #define MLX4_EN_ANC_MASK 0x40 93 u8 autoneg; 94 #define MLX4_EN_AUTONEG_MASK 0x80 95 __be16 mtu; 96 u8 reserved2; 97 u8 link_speed; 98 #define MLX4_EN_SPEED_MASK 0x6f 99 u16 reserved3[5]; 100 __be64 mac; 101 u8 transceiver; 102 }; 103 104 105 struct mlx4_en_stat_out_mbox { 106 /* Received frames with a length of 64 octets */ 107 __be64 R64_prio_0; 108 __be64 R64_prio_1; 109 __be64 R64_prio_2; 110 __be64 R64_prio_3; 111 __be64 R64_prio_4; 112 __be64 R64_prio_5; 113 __be64 R64_prio_6; 114 __be64 R64_prio_7; 115 __be64 R64_novlan; 116 /* Received frames with a length of 127 octets */ 117 __be64 R127_prio_0; 118 __be64 R127_prio_1; 119 __be64 R127_prio_2; 120 __be64 R127_prio_3; 121 __be64 R127_prio_4; 122 __be64 R127_prio_5; 123 __be64 R127_prio_6; 124 __be64 R127_prio_7; 125 __be64 R127_novlan; 126 /* Received frames with a length of 255 octets */ 127 __be64 R255_prio_0; 128 __be64 R255_prio_1; 129 __be64 R255_prio_2; 130 __be64 R255_prio_3; 131 __be64 R255_prio_4; 132 __be64 R255_prio_5; 133 __be64 R255_prio_6; 134 __be64 R255_prio_7; 135 __be64 R255_novlan; 136 /* Received frames with a length of 511 octets */ 137 __be64 R511_prio_0; 138 __be64 R511_prio_1; 139 __be64 R511_prio_2; 140 __be64 R511_prio_3; 141 __be64 R511_prio_4; 142 __be64 R511_prio_5; 143 __be64 R511_prio_6; 144 __be64 R511_prio_7; 145 __be64 R511_novlan; 146 /* Received frames with a length of 1023 octets */ 147 __be64 R1023_prio_0; 148 __be64 R1023_prio_1; 149 __be64 R1023_prio_2; 150 __be64 R1023_prio_3; 151 __be64 R1023_prio_4; 152 __be64 R1023_prio_5; 153 __be64 R1023_prio_6; 154 __be64 R1023_prio_7; 155 __be64 R1023_novlan; 156 /* Received frames with a length of 1518 octets */ 157 __be64 R1518_prio_0; 158 __be64 R1518_prio_1; 159 __be64 R1518_prio_2; 160 __be64 R1518_prio_3; 161 __be64 R1518_prio_4; 162 __be64 R1518_prio_5; 163 __be64 R1518_prio_6; 164 __be64 R1518_prio_7; 165 __be64 R1518_novlan; 166 /* Received frames with a length of 1522 octets */ 167 __be64 R1522_prio_0; 168 __be64 R1522_prio_1; 169 __be64 R1522_prio_2; 170 __be64 R1522_prio_3; 171 __be64 R1522_prio_4; 172 __be64 R1522_prio_5; 173 __be64 R1522_prio_6; 174 __be64 R1522_prio_7; 175 __be64 R1522_novlan; 176 /* Received frames with a length of 1548 octets */ 177 __be64 R1548_prio_0; 178 __be64 R1548_prio_1; 179 __be64 R1548_prio_2; 180 __be64 R1548_prio_3; 181 __be64 R1548_prio_4; 182 __be64 R1548_prio_5; 183 __be64 R1548_prio_6; 184 __be64 R1548_prio_7; 185 __be64 R1548_novlan; 186 /* Received frames with a length of 1548 < octets < MTU */ 187 __be64 R2MTU_prio_0; 188 __be64 R2MTU_prio_1; 189 __be64 R2MTU_prio_2; 190 __be64 R2MTU_prio_3; 191 __be64 R2MTU_prio_4; 192 __be64 R2MTU_prio_5; 193 __be64 R2MTU_prio_6; 194 __be64 R2MTU_prio_7; 195 __be64 R2MTU_novlan; 196 /* Received frames with a length of MTU< octets and good CRC */ 197 __be64 RGIANT_prio_0; 198 __be64 RGIANT_prio_1; 199 __be64 RGIANT_prio_2; 200 __be64 RGIANT_prio_3; 201 __be64 RGIANT_prio_4; 202 __be64 RGIANT_prio_5; 203 __be64 RGIANT_prio_6; 204 __be64 RGIANT_prio_7; 205 __be64 RGIANT_novlan; 206 /* Received broadcast frames with good CRC */ 207 __be64 RBCAST_prio_0; 208 __be64 RBCAST_prio_1; 209 __be64 RBCAST_prio_2; 210 __be64 RBCAST_prio_3; 211 __be64 RBCAST_prio_4; 212 __be64 RBCAST_prio_5; 213 __be64 RBCAST_prio_6; 214 __be64 RBCAST_prio_7; 215 __be64 RBCAST_novlan; 216 /* Received multicast frames with good CRC */ 217 __be64 MCAST_prio_0; 218 __be64 MCAST_prio_1; 219 __be64 MCAST_prio_2; 220 __be64 MCAST_prio_3; 221 __be64 MCAST_prio_4; 222 __be64 MCAST_prio_5; 223 __be64 MCAST_prio_6; 224 __be64 MCAST_prio_7; 225 __be64 MCAST_novlan; 226 /* Received unicast not short or GIANT frames with good CRC */ 227 __be64 RTOTG_prio_0; 228 __be64 RTOTG_prio_1; 229 __be64 RTOTG_prio_2; 230 __be64 RTOTG_prio_3; 231 __be64 RTOTG_prio_4; 232 __be64 RTOTG_prio_5; 233 __be64 RTOTG_prio_6; 234 __be64 RTOTG_prio_7; 235 __be64 RTOTG_novlan; 236 237 /* Count of total octets of received frames, includes framing characters */ 238 __be64 RTTLOCT_prio_0; 239 /* Count of total octets of received frames, not including framing 240 characters */ 241 __be64 RTTLOCT_NOFRM_prio_0; 242 /* Count of Total number of octets received 243 (only for frames without errors) */ 244 __be64 ROCT_prio_0; 245 246 __be64 RTTLOCT_prio_1; 247 __be64 RTTLOCT_NOFRM_prio_1; 248 __be64 ROCT_prio_1; 249 250 __be64 RTTLOCT_prio_2; 251 __be64 RTTLOCT_NOFRM_prio_2; 252 __be64 ROCT_prio_2; 253 254 __be64 RTTLOCT_prio_3; 255 __be64 RTTLOCT_NOFRM_prio_3; 256 __be64 ROCT_prio_3; 257 258 __be64 RTTLOCT_prio_4; 259 __be64 RTTLOCT_NOFRM_prio_4; 260 __be64 ROCT_prio_4; 261 262 __be64 RTTLOCT_prio_5; 263 __be64 RTTLOCT_NOFRM_prio_5; 264 __be64 ROCT_prio_5; 265 266 __be64 RTTLOCT_prio_6; 267 __be64 RTTLOCT_NOFRM_prio_6; 268 __be64 ROCT_prio_6; 269 270 __be64 RTTLOCT_prio_7; 271 __be64 RTTLOCT_NOFRM_prio_7; 272 __be64 ROCT_prio_7; 273 274 __be64 RTTLOCT_novlan; 275 __be64 RTTLOCT_NOFRM_novlan; 276 __be64 ROCT_novlan; 277 278 /* Count of Total received frames including bad frames */ 279 __be64 RTOT_prio_0; 280 /* Count of Total number of received frames with 802.1Q encapsulation */ 281 __be64 R1Q_prio_0; 282 __be64 reserved1; 283 284 __be64 RTOT_prio_1; 285 __be64 R1Q_prio_1; 286 __be64 reserved2; 287 288 __be64 RTOT_prio_2; 289 __be64 R1Q_prio_2; 290 __be64 reserved3; 291 292 __be64 RTOT_prio_3; 293 __be64 R1Q_prio_3; 294 __be64 reserved4; 295 296 __be64 RTOT_prio_4; 297 __be64 R1Q_prio_4; 298 __be64 reserved5; 299 300 __be64 RTOT_prio_5; 301 __be64 R1Q_prio_5; 302 __be64 reserved6; 303 304 __be64 RTOT_prio_6; 305 __be64 R1Q_prio_6; 306 __be64 reserved7; 307 308 __be64 RTOT_prio_7; 309 __be64 R1Q_prio_7; 310 __be64 reserved8; 311 312 __be64 RTOT_novlan; 313 __be64 R1Q_novlan; 314 __be64 reserved9; 315 316 /* Total number of Successfully Received Control Frames */ 317 __be64 RCNTL; 318 __be64 reserved10; 319 __be64 reserved11; 320 __be64 reserved12; 321 /* Count of received frames with a length/type field value between 46 322 (42 for VLANtagged frames) and 1500 (also 1500 for VLAN-tagged frames), 323 inclusive */ 324 __be64 RInRangeLengthErr; 325 /* Count of received frames with length/type field between 1501 and 1535 326 decimal, inclusive */ 327 __be64 ROutRangeLengthErr; 328 /* Count of received frames that are longer than max allowed size for 329 802.3 frames (1518/1522) */ 330 __be64 RFrmTooLong; 331 /* Count frames received with PCS error */ 332 __be64 PCS; 333 334 /* Transmit frames with a length of 64 octets */ 335 __be64 T64_prio_0; 336 __be64 T64_prio_1; 337 __be64 T64_prio_2; 338 __be64 T64_prio_3; 339 __be64 T64_prio_4; 340 __be64 T64_prio_5; 341 __be64 T64_prio_6; 342 __be64 T64_prio_7; 343 __be64 T64_novlan; 344 __be64 T64_loopbk; 345 /* Transmit frames with a length of 65 to 127 octets. */ 346 __be64 T127_prio_0; 347 __be64 T127_prio_1; 348 __be64 T127_prio_2; 349 __be64 T127_prio_3; 350 __be64 T127_prio_4; 351 __be64 T127_prio_5; 352 __be64 T127_prio_6; 353 __be64 T127_prio_7; 354 __be64 T127_novlan; 355 __be64 T127_loopbk; 356 /* Transmit frames with a length of 128 to 255 octets */ 357 __be64 T255_prio_0; 358 __be64 T255_prio_1; 359 __be64 T255_prio_2; 360 __be64 T255_prio_3; 361 __be64 T255_prio_4; 362 __be64 T255_prio_5; 363 __be64 T255_prio_6; 364 __be64 T255_prio_7; 365 __be64 T255_novlan; 366 __be64 T255_loopbk; 367 /* Transmit frames with a length of 256 to 511 octets */ 368 __be64 T511_prio_0; 369 __be64 T511_prio_1; 370 __be64 T511_prio_2; 371 __be64 T511_prio_3; 372 __be64 T511_prio_4; 373 __be64 T511_prio_5; 374 __be64 T511_prio_6; 375 __be64 T511_prio_7; 376 __be64 T511_novlan; 377 __be64 T511_loopbk; 378 /* Transmit frames with a length of 512 to 1023 octets */ 379 __be64 T1023_prio_0; 380 __be64 T1023_prio_1; 381 __be64 T1023_prio_2; 382 __be64 T1023_prio_3; 383 __be64 T1023_prio_4; 384 __be64 T1023_prio_5; 385 __be64 T1023_prio_6; 386 __be64 T1023_prio_7; 387 __be64 T1023_novlan; 388 __be64 T1023_loopbk; 389 /* Transmit frames with a length of 1024 to 1518 octets */ 390 __be64 T1518_prio_0; 391 __be64 T1518_prio_1; 392 __be64 T1518_prio_2; 393 __be64 T1518_prio_3; 394 __be64 T1518_prio_4; 395 __be64 T1518_prio_5; 396 __be64 T1518_prio_6; 397 __be64 T1518_prio_7; 398 __be64 T1518_novlan; 399 __be64 T1518_loopbk; 400 /* Counts transmit frames with a length of 1519 to 1522 bytes */ 401 __be64 T1522_prio_0; 402 __be64 T1522_prio_1; 403 __be64 T1522_prio_2; 404 __be64 T1522_prio_3; 405 __be64 T1522_prio_4; 406 __be64 T1522_prio_5; 407 __be64 T1522_prio_6; 408 __be64 T1522_prio_7; 409 __be64 T1522_novlan; 410 __be64 T1522_loopbk; 411 /* Transmit frames with a length of 1523 to 1548 octets */ 412 __be64 T1548_prio_0; 413 __be64 T1548_prio_1; 414 __be64 T1548_prio_2; 415 __be64 T1548_prio_3; 416 __be64 T1548_prio_4; 417 __be64 T1548_prio_5; 418 __be64 T1548_prio_6; 419 __be64 T1548_prio_7; 420 __be64 T1548_novlan; 421 __be64 T1548_loopbk; 422 /* Counts transmit frames with a length of 1549 to MTU bytes */ 423 __be64 T2MTU_prio_0; 424 __be64 T2MTU_prio_1; 425 __be64 T2MTU_prio_2; 426 __be64 T2MTU_prio_3; 427 __be64 T2MTU_prio_4; 428 __be64 T2MTU_prio_5; 429 __be64 T2MTU_prio_6; 430 __be64 T2MTU_prio_7; 431 __be64 T2MTU_novlan; 432 __be64 T2MTU_loopbk; 433 /* Transmit frames with a length greater than MTU octets and a good CRC. */ 434 __be64 TGIANT_prio_0; 435 __be64 TGIANT_prio_1; 436 __be64 TGIANT_prio_2; 437 __be64 TGIANT_prio_3; 438 __be64 TGIANT_prio_4; 439 __be64 TGIANT_prio_5; 440 __be64 TGIANT_prio_6; 441 __be64 TGIANT_prio_7; 442 __be64 TGIANT_novlan; 443 __be64 TGIANT_loopbk; 444 /* Transmit broadcast frames with a good CRC */ 445 __be64 TBCAST_prio_0; 446 __be64 TBCAST_prio_1; 447 __be64 TBCAST_prio_2; 448 __be64 TBCAST_prio_3; 449 __be64 TBCAST_prio_4; 450 __be64 TBCAST_prio_5; 451 __be64 TBCAST_prio_6; 452 __be64 TBCAST_prio_7; 453 __be64 TBCAST_novlan; 454 __be64 TBCAST_loopbk; 455 /* Transmit multicast frames with a good CRC */ 456 __be64 TMCAST_prio_0; 457 __be64 TMCAST_prio_1; 458 __be64 TMCAST_prio_2; 459 __be64 TMCAST_prio_3; 460 __be64 TMCAST_prio_4; 461 __be64 TMCAST_prio_5; 462 __be64 TMCAST_prio_6; 463 __be64 TMCAST_prio_7; 464 __be64 TMCAST_novlan; 465 __be64 TMCAST_loopbk; 466 /* Transmit good frames that are neither broadcast nor multicast */ 467 __be64 TTOTG_prio_0; 468 __be64 TTOTG_prio_1; 469 __be64 TTOTG_prio_2; 470 __be64 TTOTG_prio_3; 471 __be64 TTOTG_prio_4; 472 __be64 TTOTG_prio_5; 473 __be64 TTOTG_prio_6; 474 __be64 TTOTG_prio_7; 475 __be64 TTOTG_novlan; 476 __be64 TTOTG_loopbk; 477 478 /* total octets of transmitted frames, including framing characters */ 479 __be64 TTTLOCT_prio_0; 480 /* total octets of transmitted frames, not including framing characters */ 481 __be64 TTTLOCT_NOFRM_prio_0; 482 /* ifOutOctets */ 483 __be64 TOCT_prio_0; 484 485 __be64 TTTLOCT_prio_1; 486 __be64 TTTLOCT_NOFRM_prio_1; 487 __be64 TOCT_prio_1; 488 489 __be64 TTTLOCT_prio_2; 490 __be64 TTTLOCT_NOFRM_prio_2; 491 __be64 TOCT_prio_2; 492 493 __be64 TTTLOCT_prio_3; 494 __be64 TTTLOCT_NOFRM_prio_3; 495 __be64 TOCT_prio_3; 496 497 __be64 TTTLOCT_prio_4; 498 __be64 TTTLOCT_NOFRM_prio_4; 499 __be64 TOCT_prio_4; 500 501 __be64 TTTLOCT_prio_5; 502 __be64 TTTLOCT_NOFRM_prio_5; 503 __be64 TOCT_prio_5; 504 505 __be64 TTTLOCT_prio_6; 506 __be64 TTTLOCT_NOFRM_prio_6; 507 __be64 TOCT_prio_6; 508 509 __be64 TTTLOCT_prio_7; 510 __be64 TTTLOCT_NOFRM_prio_7; 511 __be64 TOCT_prio_7; 512 513 __be64 TTTLOCT_novlan; 514 __be64 TTTLOCT_NOFRM_novlan; 515 __be64 TOCT_novlan; 516 517 __be64 TTTLOCT_loopbk; 518 __be64 TTTLOCT_NOFRM_loopbk; 519 __be64 TOCT_loopbk; 520 521 /* Total frames transmitted with a good CRC that are not aborted */ 522 __be64 TTOT_prio_0; 523 /* Total number of frames transmitted with 802.1Q encapsulation */ 524 __be64 T1Q_prio_0; 525 __be64 reserved13; 526 527 __be64 TTOT_prio_1; 528 __be64 T1Q_prio_1; 529 __be64 reserved14; 530 531 __be64 TTOT_prio_2; 532 __be64 T1Q_prio_2; 533 __be64 reserved15; 534 535 __be64 TTOT_prio_3; 536 __be64 T1Q_prio_3; 537 __be64 reserved16; 538 539 __be64 TTOT_prio_4; 540 __be64 T1Q_prio_4; 541 __be64 reserved17; 542 543 __be64 TTOT_prio_5; 544 __be64 T1Q_prio_5; 545 __be64 reserved18; 546 547 __be64 TTOT_prio_6; 548 __be64 T1Q_prio_6; 549 __be64 reserved19; 550 551 __be64 TTOT_prio_7; 552 __be64 T1Q_prio_7; 553 __be64 reserved20; 554 555 __be64 TTOT_novlan; 556 __be64 T1Q_novlan; 557 __be64 reserved21; 558 559 __be64 TTOT_loopbk; 560 __be64 T1Q_loopbk; 561 __be64 reserved22; 562 563 /* Received frames with a length greater than MTU octets and a bad CRC */ 564 __be32 RJBBR; 565 /* Received frames with a bad CRC that are not runts, jabbers, 566 or alignment errors */ 567 __be32 RCRC; 568 /* Received frames with SFD with a length of less than 64 octets and a 569 bad CRC */ 570 __be32 RRUNT; 571 /* Received frames with a length less than 64 octets and a good CRC */ 572 __be32 RSHORT; 573 /* Total Number of Received Packets Dropped */ 574 __be32 RDROP; 575 /* Drop due to overflow */ 576 __be32 RdropOvflw; 577 /* Drop due to overflow */ 578 __be32 RdropLength; 579 /* Total of good frames. Does not include frames received with 580 frame-too-long, FCS, or length errors */ 581 __be32 RTOTFRMS; 582 /* Total dropped Xmited packets */ 583 __be32 TDROP; 584 }; 585 586 #endif 587