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