Print this page
12011 ixgbe reports incorrect MAC_STAT_NORCVBUF
Change-Id: Ia71b5669b2bc8f6256a84b0b9c673153f327f5ab

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/ixgbe/ixgbe_main.c
          +++ new/usr/src/uts/common/io/ixgbe/ixgbe_main.c
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright(c) 2007-2010 Intel Corporation. All rights reserved.
  24   24   */
  25   25  
  26   26  /*
  27   27   * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  28      - * Copyright (c) 2017, Joyent, Inc.
       28 + * Copyright 2019 Joyent, Inc.
  29   29   * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
  30   30   * Copyright (c) 2013 Saso Kiselkov. All rights reserved.
  31   31   * Copyright (c) 2013 OSN Online Service Nuernberg GmbH. All rights reserved.
  32   32   * Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
  33   33   */
  34   34  
  35   35  #include "ixgbe_sw.h"
  36   36  
  37   37  static char ixgbe_ident[] = "Intel 10Gb Ethernet";
  38   38  
↓ open down ↓ 2395 lines elided ↑ open up ↑
2434 2434          reg_val |= IXGBE_SRRCTL_DROP_EN;
2435 2435          IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(rx_ring->hw_index), reg_val);
2436 2436  }
2437 2437  
2438 2438  static void
2439 2439  ixgbe_setup_rx(ixgbe_t *ixgbe)
2440 2440  {
2441 2441          ixgbe_rx_ring_t *rx_ring;
2442 2442          struct ixgbe_hw *hw = &ixgbe->hw;
2443 2443          uint32_t reg_val;
2444      -        uint32_t ring_mapping;
2445      -        uint32_t i, index;
     2444 +        uint32_t i;
2446 2445          uint32_t psrtype_rss_bit;
2447 2446  
2448 2447          /*
2449 2448           * Ensure that Rx is disabled while setting up
2450 2449           * the Rx unit and Rx descriptor ring(s)
2451 2450           */
2452 2451          ixgbe_disable_rx(hw);
2453 2452  
2454 2453          /* PSRTYPE must be configured for 82599 */
2455 2454          if (ixgbe->classify_mode != IXGBE_CLASSIFY_VMDQ &&
↓ open down ↓ 85 lines elided ↑ open up ↑
2541 2540  
2542 2541          /*
2543 2542           * ixgbe_setup_rx_ring must be called after configuring RXCTRL
2544 2543           */
2545 2544          for (i = 0; i < ixgbe->num_rx_rings; i++) {
2546 2545                  rx_ring = &ixgbe->rx_rings[i];
2547 2546                  ixgbe_setup_rx_ring(rx_ring);
2548 2547          }
2549 2548  
2550 2549          /*
2551      -         * Setup the per-ring statistics mapping.
     2550 +         * The 82598 controller gives us the RNBC (Receive No Buffer
     2551 +         * Count) register to determine the number of frames dropped
     2552 +         * due to no available descriptors on the destination queue.
     2553 +         * However, this register was removed starting with 82599 and
     2554 +         * it was replaced with the RQSMR/QPRDC registers. The nice
     2555 +         * thing about the new registers is that they allow you to map
     2556 +         * groups of queues to specific stat registers. The bad thing
     2557 +         * is there are only 16 slots in the stat registers, so this
     2558 +         * won't work when we have 32 Rx groups. Instead, we map all
     2559 +         * queues to the zero slot of the stat registers, giving us a
     2560 +         * global counter at QPRDC[0] (with the equivalent semantics
     2561 +         * of RNBC). Perhaps future controllers will have more slots
     2562 +         * and we can implement per-group counters.
2552 2563           */
2553      -        ring_mapping = 0;
2554 2564          for (i = 0; i < ixgbe->num_rx_rings; i++) {
2555      -                index = ixgbe->rx_rings[i].hw_index;
2556      -                ring_mapping = IXGBE_READ_REG(hw, IXGBE_RQSMR(index >> 2));
2557      -                ring_mapping |= (i & 0xF) << (8 * (index & 0x3));
2558      -                IXGBE_WRITE_REG(hw, IXGBE_RQSMR(index >> 2), ring_mapping);
     2565 +                uint32_t index = ixgbe->rx_rings[i].hw_index;
     2566 +                IXGBE_WRITE_REG(hw, IXGBE_RQSMR(index >> 2), 0);
2559 2567          }
2560 2568  
2561 2569          /*
2562 2570           * The Max Frame Size in MHADD/MAXFRS will be internally increased
2563 2571           * by four bytes if the packet has a VLAN field, so includes MTU,
2564 2572           * ethernet header and frame check sequence.
2565 2573           * Register is MAXFRS in 82599.
2566 2574           */
2567 2575          reg_val = IXGBE_READ_REG(hw, IXGBE_MHADD);
2568 2576          reg_val &= ~IXGBE_MHADD_MFS_MASK;
↓ open down ↓ 134 lines elided ↑ open up ↑
2703 2711           */
2704 2712          bzero(&tx_ring->tx_context, sizeof (ixgbe_tx_context_t));
2705 2713  }
2706 2714  
2707 2715  static void
2708 2716  ixgbe_setup_tx(ixgbe_t *ixgbe)
2709 2717  {
2710 2718          struct ixgbe_hw *hw = &ixgbe->hw;
2711 2719          ixgbe_tx_ring_t *tx_ring;
2712 2720          uint32_t reg_val;
2713      -        uint32_t ring_mapping;
2714 2721          int i;
2715 2722  
2716 2723          for (i = 0; i < ixgbe->num_tx_rings; i++) {
2717 2724                  tx_ring = &ixgbe->tx_rings[i];
2718 2725                  ixgbe_setup_tx_ring(tx_ring);
2719 2726          }
2720 2727  
2721 2728          /*
2722      -         * Setup the per-ring statistics mapping.
     2729 +         * Setup the per-ring statistics mapping. We map all Tx queues
     2730 +         * to slot 0 to stay consistent with Rx.
2723 2731           */
2724      -        ring_mapping = 0;
2725 2732          for (i = 0; i < ixgbe->num_tx_rings; i++) {
2726      -                ring_mapping |= (i & 0xF) << (8 * (i & 0x3));
2727      -                if ((i & 0x3) == 0x3) {
2728      -                        switch (hw->mac.type) {
2729      -                        case ixgbe_mac_82598EB:
2730      -                                IXGBE_WRITE_REG(hw, IXGBE_TQSMR(i >> 2),
2731      -                                    ring_mapping);
2732      -                                break;
2733      -
2734      -                        case ixgbe_mac_82599EB:
2735      -                        case ixgbe_mac_X540:
2736      -                        case ixgbe_mac_X550:
2737      -                        case ixgbe_mac_X550EM_x:
2738      -                        case ixgbe_mac_X550EM_a:
2739      -                                IXGBE_WRITE_REG(hw, IXGBE_TQSM(i >> 2),
2740      -                                    ring_mapping);
2741      -                                break;
2742      -
2743      -                        default:
2744      -                                break;
2745      -                        }
2746      -
2747      -                        ring_mapping = 0;
2748      -                }
2749      -        }
2750      -        if (i & 0x3) {
2751 2733                  switch (hw->mac.type) {
2752 2734                  case ixgbe_mac_82598EB:
2753      -                        IXGBE_WRITE_REG(hw, IXGBE_TQSMR(i >> 2), ring_mapping);
     2735 +                        IXGBE_WRITE_REG(hw, IXGBE_TQSMR(i >> 2), 0);
2754 2736                          break;
2755 2737  
2756      -                case ixgbe_mac_82599EB:
2757      -                case ixgbe_mac_X540:
2758      -                case ixgbe_mac_X550:
2759      -                case ixgbe_mac_X550EM_x:
2760      -                case ixgbe_mac_X550EM_a:
2761      -                        IXGBE_WRITE_REG(hw, IXGBE_TQSM(i >> 2), ring_mapping);
2762      -                        break;
2763      -
2764 2738                  default:
     2739 +                        IXGBE_WRITE_REG(hw, IXGBE_TQSM(i >> 2), 0);
2765 2740                          break;
2766 2741                  }
2767 2742          }
2768 2743  
2769 2744          /*
2770 2745           * Enable CRC appending and TX padding (for short tx frames)
2771 2746           */
2772 2747          reg_val = IXGBE_READ_REG(hw, IXGBE_HLREG0);
2773 2748          reg_val |= IXGBE_HLREG0_TXCRCEN | IXGBE_HLREG0_TXPADEN;
2774 2749          IXGBE_WRITE_REG(hw, IXGBE_HLREG0, reg_val);
↓ open down ↓ 3624 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX