Print this page
6064 ixgbe needs X550 support

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/ixgbe/ixgbe_gld.c
          +++ new/usr/src/uts/common/io/ixgbe/ixgbe_gld.c
↓ open down ↓ 289 lines elided ↑ open up ↑
 290  290  ixgbe_m_setprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
 291  291      uint_t pr_valsize, const void *pr_val)
 292  292  {
 293  293          ixgbe_t *ixgbe = (ixgbe_t *)arg;
 294  294          struct ixgbe_hw *hw = &ixgbe->hw;
 295  295          int err = 0;
 296  296          uint32_t flow_control;
 297  297          uint32_t cur_mtu, new_mtu;
 298  298          uint32_t rx_size;
 299  299          uint32_t tx_size;
      300 +        ixgbe_link_speed speeds = 0;
 300  301  
 301  302          mutex_enter(&ixgbe->gen_lock);
 302  303          if (ixgbe->ixgbe_state & IXGBE_SUSPENDED) {
 303  304                  mutex_exit(&ixgbe->gen_lock);
 304  305                  return (ECANCELED);
 305  306          }
 306  307  
      308 +        /*
      309 +         * We cannot always rely on the common code maintaining
      310 +         * hw->phy.speeds_supported, therefore we fall back to use the recorded
      311 +         * supported speeds which were obtained during instance init in
      312 +         * ixgbe_init_params().
      313 +         */
      314 +        speeds = hw->phy.speeds_supported;
      315 +        if (speeds == 0)
      316 +                speeds = ixgbe->speeds_supported;
      317 +
 307  318          if (ixgbe->loopback_mode != IXGBE_LB_NONE &&
 308  319              ixgbe_param_locked(pr_num)) {
 309  320                  /*
 310  321                   * All en_* parameters are locked (read-only)
 311  322                   * while the device is in any sort of loopback mode.
 312  323                   */
 313  324                  mutex_exit(&ixgbe->gen_lock);
 314  325                  return (EBUSY);
 315  326          }
 316  327  
      328 +        /*
      329 +         * We allow speed changes only on baseT PHYs. MAC_PROP_EN_* are marked
      330 +         * read-only on non-baseT PHYs.
      331 +         */
 317  332          switch (pr_num) {
 318  333          case MAC_PROP_EN_10GFDX_CAP:
 319      -                /* read/write on copper, read-only on serdes */
 320      -                if (ixgbe->hw.phy.media_type != ixgbe_media_type_copper) {
 321      -                        err = ENOTSUP;
 322      -                        break;
 323      -                } else {
      334 +                if (hw->phy.media_type == ixgbe_media_type_copper &&
      335 +                    speeds & IXGBE_LINK_SPEED_10GB_FULL) {
 324  336                          ixgbe->param_en_10000fdx_cap = *(uint8_t *)pr_val;
 325      -                        ixgbe->param_adv_10000fdx_cap = *(uint8_t *)pr_val;
 326  337                          goto setup_link;
      338 +                } else {
      339 +                        err = ENOTSUP;
      340 +                        break;
 327  341                  }
 328      -        case MAC_PROP_EN_1000FDX_CAP:
 329      -                /* read/write on copper, read-only on serdes */
 330      -                if (ixgbe->hw.phy.media_type != ixgbe_media_type_copper) {
      342 +        case MAC_PROP_EN_5000FDX_CAP:
      343 +                if (hw->phy.media_type == ixgbe_media_type_copper &&
      344 +                    speeds & IXGBE_LINK_SPEED_5GB_FULL) {
      345 +                        ixgbe->param_en_5000fdx_cap = *(uint8_t *)pr_val;
      346 +                        goto setup_link;
      347 +                } else {
 331  348                          err = ENOTSUP;
 332  349                          break;
      350 +                }
      351 +        case MAC_PROP_EN_2500FDX_CAP:
      352 +                if (hw->phy.media_type == ixgbe_media_type_copper &&
      353 +                    speeds & IXGBE_LINK_SPEED_2_5GB_FULL) {
      354 +                        ixgbe->param_en_2500fdx_cap = *(uint8_t *)pr_val;
      355 +                        goto setup_link;
 333  356                  } else {
      357 +                        err = ENOTSUP;
      358 +                        break;
      359 +                }
      360 +        case MAC_PROP_EN_1000FDX_CAP:
      361 +                if (hw->phy.media_type == ixgbe_media_type_copper &&
      362 +                    speeds & IXGBE_LINK_SPEED_1GB_FULL) {
 334  363                          ixgbe->param_en_1000fdx_cap = *(uint8_t *)pr_val;
 335      -                        ixgbe->param_adv_1000fdx_cap = *(uint8_t *)pr_val;
 336  364                          goto setup_link;
 337      -                }
 338      -        case MAC_PROP_EN_100FDX_CAP:
 339      -                /* read/write on copper, read-only on serdes */
 340      -                if (ixgbe->hw.phy.media_type != ixgbe_media_type_copper) {
      365 +                } else {
 341  366                          err = ENOTSUP;
 342  367                          break;
 343      -                } else {
      368 +                }
      369 +        case MAC_PROP_EN_100FDX_CAP:
      370 +                if (hw->phy.media_type == ixgbe_media_type_copper &&
      371 +                    speeds & IXGBE_LINK_SPEED_100_FULL) {
 344  372                          ixgbe->param_en_100fdx_cap = *(uint8_t *)pr_val;
 345      -                        ixgbe->param_adv_100fdx_cap = *(uint8_t *)pr_val;
 346  373                          goto setup_link;
      374 +                } else {
      375 +                        err = ENOTSUP;
      376 +                        break;
 347  377                  }
 348  378          case MAC_PROP_AUTONEG:
 349      -                /* read/write on copper, read-only on serdes */
 350  379                  if (ixgbe->hw.phy.media_type != ixgbe_media_type_copper) {
 351  380                          err = ENOTSUP;
 352  381                          break;
 353  382                  } else {
 354  383                          ixgbe->param_adv_autoneg_cap = *(uint8_t *)pr_val;
 355  384                          goto setup_link;
 356  385                  }
 357  386          case MAC_PROP_FLOWCTRL:
 358  387                  bcopy(pr_val, &flow_control, sizeof (flow_control));
 359  388  
↓ open down ↓ 15 lines elided ↑ open up ↑
 375  404                          break;
 376  405                  }
 377  406  setup_link:
 378  407                  if (err == 0) {
 379  408                          if (ixgbe_driver_setup_link(ixgbe, B_TRUE) !=
 380  409                              IXGBE_SUCCESS)
 381  410                                  err = EINVAL;
 382  411                  }
 383  412                  break;
 384  413          case MAC_PROP_ADV_10GFDX_CAP:
      414 +        case MAC_PROP_ADV_5000FDX_CAP:
      415 +        case MAC_PROP_ADV_2500FDX_CAP:
 385  416          case MAC_PROP_ADV_1000FDX_CAP:
 386  417          case MAC_PROP_ADV_100FDX_CAP:
 387  418          case MAC_PROP_STATUS:
 388  419          case MAC_PROP_SPEED:
 389  420          case MAC_PROP_DUPLEX:
 390  421                  err = ENOTSUP; /* read-only prop. Can't set this. */
 391  422                  break;
 392  423          case MAC_PROP_MTU:
 393  424                  cur_mtu = ixgbe->default_mtu;
 394  425                  bcopy(pr_val, &new_mtu, sizeof (new_mtu));
↓ open down ↓ 46 lines elided ↑ open up ↑
 441  472  
 442  473  int
 443  474  ixgbe_m_getprop(void *arg, const char *pr_name, mac_prop_id_t pr_num,
 444  475      uint_t pr_valsize, void *pr_val)
 445  476  {
 446  477          ixgbe_t *ixgbe = (ixgbe_t *)arg;
 447  478          struct ixgbe_hw *hw = &ixgbe->hw;
 448  479          int err = 0;
 449  480          uint32_t flow_control;
 450  481          uint64_t tmp = 0;
      482 +        ixgbe_link_speed speeds = 0;
 451  483  
      484 +        /*
      485 +         * We cannot always rely on the common code maintaining
      486 +         * hw->phy.speeds_supported, therefore we fall back to use the recorded
      487 +         * supported speeds which were obtained during instance init in
      488 +         * ixgbe_init_params().
      489 +         */
      490 +        speeds = hw->phy.speeds_supported;
      491 +        if (speeds == 0)
      492 +                speeds = ixgbe->speeds_supported;
      493 +
 452  494          switch (pr_num) {
 453  495          case MAC_PROP_DUPLEX:
 454  496                  ASSERT(pr_valsize >= sizeof (link_duplex_t));
 455  497                  bcopy(&ixgbe->link_duplex, pr_val,
 456  498                      sizeof (link_duplex_t));
 457  499                  break;
 458  500          case MAC_PROP_SPEED:
 459  501                  ASSERT(pr_valsize >= sizeof (uint64_t));
 460  502                  tmp = ixgbe->link_speed * 1000000ull;
 461  503                  bcopy(&tmp, pr_val, sizeof (tmp));
↓ open down ↓ 14 lines elided ↑ open up ↑
 476  518                          case ixgbe_fc_tx_pause:
 477  519                                  flow_control = LINK_FLOWCTRL_TX;
 478  520                                  break;
 479  521                          case ixgbe_fc_full:
 480  522                                  flow_control = LINK_FLOWCTRL_BI;
 481  523                                  break;
 482  524                  }
 483  525                  bcopy(&flow_control, pr_val, sizeof (flow_control));
 484  526                  break;
 485  527          case MAC_PROP_ADV_10GFDX_CAP:
 486      -                *(uint8_t *)pr_val = ixgbe->param_adv_10000fdx_cap;
      528 +                if (speeds & IXGBE_LINK_SPEED_10GB_FULL)
      529 +                        *(uint8_t *)pr_val = ixgbe->param_adv_10000fdx_cap;
      530 +                else
      531 +                        err = ENOTSUP;
 487  532                  break;
 488  533          case MAC_PROP_EN_10GFDX_CAP:
 489      -                *(uint8_t *)pr_val = ixgbe->param_en_10000fdx_cap;
      534 +                if (speeds & IXGBE_LINK_SPEED_10GB_FULL)
      535 +                        *(uint8_t *)pr_val = ixgbe->param_en_10000fdx_cap;
      536 +                else
      537 +                        err = ENOTSUP;
 490  538                  break;
      539 +        case MAC_PROP_ADV_5000FDX_CAP:
      540 +                if (speeds & IXGBE_LINK_SPEED_5GB_FULL)
      541 +                        *(uint8_t *)pr_val = ixgbe->param_adv_5000fdx_cap;
      542 +                else
      543 +                        err = ENOTSUP;
      544 +                break;
      545 +        case MAC_PROP_EN_5000FDX_CAP:
      546 +                if (speeds & IXGBE_LINK_SPEED_5GB_FULL)
      547 +                        *(uint8_t *)pr_val = ixgbe->param_en_5000fdx_cap;
      548 +                else
      549 +                        err = ENOTSUP;
      550 +                break;
      551 +        case MAC_PROP_ADV_2500FDX_CAP:
      552 +                if (speeds & IXGBE_LINK_SPEED_2_5GB_FULL)
      553 +                        *(uint8_t *)pr_val = ixgbe->param_adv_2500fdx_cap;
      554 +                else
      555 +                        err = ENOTSUP;
      556 +                break;
      557 +        case MAC_PROP_EN_2500FDX_CAP:
      558 +                if (speeds & IXGBE_LINK_SPEED_2_5GB_FULL)
      559 +                        *(uint8_t *)pr_val = ixgbe->param_en_2500fdx_cap;
      560 +                else
      561 +                        err = ENOTSUP;
      562 +                break;
 491  563          case MAC_PROP_ADV_1000FDX_CAP:
 492      -                *(uint8_t *)pr_val = ixgbe->param_adv_1000fdx_cap;
      564 +                if (speeds & IXGBE_LINK_SPEED_1GB_FULL)
      565 +                        *(uint8_t *)pr_val = ixgbe->param_adv_1000fdx_cap;
      566 +                else
      567 +                        err = ENOTSUP;
 493  568                  break;
 494  569          case MAC_PROP_EN_1000FDX_CAP:
 495      -                *(uint8_t *)pr_val = ixgbe->param_en_1000fdx_cap;
      570 +                if (speeds & IXGBE_LINK_SPEED_1GB_FULL)
      571 +                        *(uint8_t *)pr_val = ixgbe->param_en_1000fdx_cap;
      572 +                else
      573 +                        err = ENOTSUP;
 496  574                  break;
 497  575          case MAC_PROP_ADV_100FDX_CAP:
 498      -                *(uint8_t *)pr_val = ixgbe->param_adv_100fdx_cap;
      576 +                if (speeds & IXGBE_LINK_SPEED_100_FULL)
      577 +                        *(uint8_t *)pr_val = ixgbe->param_adv_100fdx_cap;
      578 +                else
      579 +                        err = ENOTSUP;
 499  580                  break;
 500  581          case MAC_PROP_EN_100FDX_CAP:
 501      -                *(uint8_t *)pr_val = ixgbe->param_en_100fdx_cap;
      582 +                if (speeds & IXGBE_LINK_SPEED_100_FULL)
      583 +                        *(uint8_t *)pr_val = ixgbe->param_en_100fdx_cap;
      584 +                else
      585 +                        err = ENOTSUP;
 502  586                  break;
 503  587          case MAC_PROP_PRIVATE:
 504  588                  err = ixgbe_get_priv_prop(ixgbe, pr_name,
 505  589                      pr_valsize, pr_val);
 506  590                  break;
 507  591          default:
 508  592                  err = ENOTSUP;
 509  593                  break;
 510  594          }
 511  595          return (err);
 512  596  }
 513  597  
 514  598  void
 515  599  ixgbe_m_propinfo(void *arg, const char *pr_name, mac_prop_id_t pr_num,
 516  600      mac_prop_info_handle_t prh)
 517  601  {
 518  602          ixgbe_t *ixgbe = (ixgbe_t *)arg;
      603 +        struct ixgbe_hw *hw = &ixgbe->hw;
 519  604          uint_t perm;
      605 +        uint8_t value;
      606 +        ixgbe_link_speed speeds = 0;
 520  607  
      608 +        /*
      609 +         * We cannot always rely on the common code maintaining
      610 +         * hw->phy.speeds_supported, therefore we fall back to use the
      611 +         * recorded supported speeds which were obtained during instance init in
      612 +         * ixgbe_init_params().
      613 +         */
      614 +        speeds = hw->phy.speeds_supported;
      615 +        if (speeds == 0)
      616 +                speeds = ixgbe->speeds_supported;
      617 +
 521  618          switch (pr_num) {
 522  619          case MAC_PROP_DUPLEX:
 523  620          case MAC_PROP_SPEED:
 524  621                  mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
 525  622                  break;
 526  623  
 527  624          case MAC_PROP_ADV_100FDX_CAP:
      625 +                mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
      626 +                value = (speeds & IXGBE_LINK_SPEED_100_FULL) ? 1 : 0;
      627 +                mac_prop_info_set_default_uint8(prh, value);
      628 +                break;
      629 +
 528  630          case MAC_PROP_ADV_1000FDX_CAP:
      631 +                mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
      632 +                value = (speeds & IXGBE_LINK_SPEED_1GB_FULL) ? 1 : 0;
      633 +                mac_prop_info_set_default_uint8(prh, value);
      634 +                break;
      635 +
      636 +        case MAC_PROP_ADV_2500FDX_CAP:
      637 +                mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
      638 +                value = (speeds & IXGBE_LINK_SPEED_2_5GB_FULL) ? 1 : 0;
      639 +                mac_prop_info_set_default_uint8(prh, value);
      640 +                break;
      641 +
      642 +        case MAC_PROP_ADV_5000FDX_CAP:
      643 +                mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
      644 +                value = (speeds & IXGBE_LINK_SPEED_5GB_FULL) ? 1 : 0;
      645 +                mac_prop_info_set_default_uint8(prh, value);
      646 +                break;
      647 +
 529  648          case MAC_PROP_ADV_10GFDX_CAP:
 530  649                  mac_prop_info_set_perm(prh, MAC_PROP_PERM_READ);
 531      -                mac_prop_info_set_default_uint8(prh, 1);
      650 +                value = (speeds & IXGBE_LINK_SPEED_10GB_FULL) ? 1 : 0;
      651 +                mac_prop_info_set_default_uint8(prh, value);
 532  652                  break;
 533  653  
      654 +        /*
      655 +         * We allow speed changes only on baseT PHYs. MAC_PROP_EN_* are marked
      656 +         * read-only on non-baseT (SFP) PHYs.
      657 +         */
 534  658          case MAC_PROP_AUTONEG:
 535      -        case MAC_PROP_EN_10GFDX_CAP:
 536      -        case MAC_PROP_EN_1000FDX_CAP:
 537      -        case MAC_PROP_EN_100FDX_CAP:
 538      -                perm = (ixgbe->hw.phy.media_type == ixgbe_media_type_copper) ?
      659 +                perm = (hw->phy.media_type == ixgbe_media_type_copper) ?
 539  660                      MAC_PROP_PERM_RW : MAC_PROP_PERM_READ;
 540  661                  mac_prop_info_set_perm(prh, perm);
 541  662                  mac_prop_info_set_default_uint8(prh, 1);
 542  663                  break;
 543  664  
      665 +        case MAC_PROP_EN_10GFDX_CAP:
      666 +                if (speeds & IXGBE_LINK_SPEED_10GB_FULL) {
      667 +                        perm = (hw->phy.media_type == ixgbe_media_type_copper) ?
      668 +                            MAC_PROP_PERM_RW : MAC_PROP_PERM_READ;
      669 +                        mac_prop_info_set_perm(prh, perm);
      670 +                        mac_prop_info_set_default_uint8(prh, 1);
      671 +                }
      672 +                break;
      673 +
      674 +        case MAC_PROP_EN_5000FDX_CAP:
      675 +                if (speeds & IXGBE_LINK_SPEED_5GB_FULL) {
      676 +                        perm = (hw->phy.media_type == ixgbe_media_type_copper) ?
      677 +                            MAC_PROP_PERM_RW : MAC_PROP_PERM_READ;
      678 +                        mac_prop_info_set_perm(prh, perm);
      679 +                        mac_prop_info_set_default_uint8(prh, 1);
      680 +                }
      681 +                break;
      682 +
      683 +        case MAC_PROP_EN_2500FDX_CAP:
      684 +                if (speeds & IXGBE_LINK_SPEED_2_5GB_FULL) {
      685 +                        perm = (hw->phy.media_type == ixgbe_media_type_copper) ?
      686 +                            MAC_PROP_PERM_RW : MAC_PROP_PERM_READ;
      687 +                        mac_prop_info_set_perm(prh, perm);
      688 +                        mac_prop_info_set_default_uint8(prh, 1);
      689 +                }
      690 +                break;
      691 +
      692 +        case MAC_PROP_EN_1000FDX_CAP:
      693 +                if (speeds & IXGBE_LINK_SPEED_1GB_FULL) {
      694 +                        perm = (hw->phy.media_type == ixgbe_media_type_copper) ?
      695 +                            MAC_PROP_PERM_RW : MAC_PROP_PERM_READ;
      696 +                        mac_prop_info_set_perm(prh, perm);
      697 +                        mac_prop_info_set_default_uint8(prh, 1);
      698 +                }
      699 +                break;
      700 +
      701 +        case MAC_PROP_EN_100FDX_CAP:
      702 +                if (speeds & IXGBE_LINK_SPEED_100_FULL) {
      703 +                        perm = (hw->phy.media_type == ixgbe_media_type_copper) ?
      704 +                            MAC_PROP_PERM_RW : MAC_PROP_PERM_READ;
      705 +                        mac_prop_info_set_perm(prh, perm);
      706 +                        mac_prop_info_set_default_uint8(prh, 1);
      707 +                }
      708 +                break;
      709 +
 544  710          case MAC_PROP_FLOWCTRL:
 545  711                  mac_prop_info_set_default_link_flowctrl(prh,
 546  712                      LINK_FLOWCTRL_NONE);
 547  713                  break;
 548  714  
 549  715          case MAC_PROP_MTU:
 550  716                  mac_prop_info_set_range_uint32(prh,
 551  717                      DEFAULT_MTU, ixgbe->capab->max_mtu);
 552  718                  break;
 553  719  
↓ open down ↓ 34 lines elided ↑ open up ↑
 588  754  
 589  755  boolean_t
 590  756  ixgbe_param_locked(mac_prop_id_t pr_num)
 591  757  {
 592  758          /*
 593  759           * All en_* parameters are locked (read-only) while
 594  760           * the device is in any sort of loopback mode ...
 595  761           */
 596  762          switch (pr_num) {
 597  763                  case MAC_PROP_EN_10GFDX_CAP:
      764 +                case MAC_PROP_EN_5000FDX_CAP:
      765 +                case MAC_PROP_EN_2500FDX_CAP:
 598  766                  case MAC_PROP_EN_1000FDX_CAP:
 599  767                  case MAC_PROP_EN_100FDX_CAP:
 600  768                  case MAC_PROP_AUTONEG:
 601  769                  case MAC_PROP_FLOWCTRL:
 602  770                          return (B_TRUE);
 603  771          }
 604  772          return (B_FALSE);
 605  773  }
 606  774  
 607  775  /* ARGSUSED */
↓ open down ↓ 97 lines elided ↑ open up ↑
 705  873                  }
 706  874                  (void) ddi_strtol(pr_val, (char **)NULL, 0, &result);
 707  875  
 708  876                  if (result < ixgbe->capab->min_intr_throttle ||
 709  877                      result > ixgbe->capab->max_intr_throttle)
 710  878                          err = EINVAL;
 711  879                  else {
 712  880                          ixgbe->intr_throttling[0] = (uint32_t)result;
 713  881  
 714  882                          /*
 715      -                         * 82599 and X540 require the interrupt throttling
      883 +                         * 82599, X540 and X550 require the interrupt throttling
 716  884                           * rate is a multiple of 8. This is enforced by the
 717  885                           * register definiton.
 718  886                           */
 719  887                          if (hw->mac.type == ixgbe_mac_82599EB ||
 720      -                            hw->mac.type == ixgbe_mac_X540) {
      888 +                            hw->mac.type == ixgbe_mac_X540 ||
      889 +                            hw->mac.type == ixgbe_mac_X550 ||
      890 +                            hw->mac.type == ixgbe_mac_X550EM_x) {
 721  891                                  ixgbe->intr_throttling[0] =
 722  892                                      ixgbe->intr_throttling[0] & 0xFF8;
 723  893                          }
 724  894  
 725  895                          for (i = 0; i < MAX_INTR_VECTOR; i++)
 726  896                                  ixgbe->intr_throttling[i] =
 727  897                                      ixgbe->intr_throttling[0];
 728  898  
 729  899                          /* Set interrupt throttling rate */
 730  900                          for (i = 0; i < ixgbe->intr_cnt; i++)
↓ open down ↓ 66 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX