Print this page
4431 igb support for I354
4616 igb has uninitialized kstats

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/igb/igb_gld.c
          +++ new/usr/src/uts/common/io/igb/igb_gld.c
↓ open down ↓ 18 lines elided ↑ open up ↑
  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   28   * Copyright 2013, Nexenta Systems, Inc. All rights reserved.
       29 + * Copyright 2014 Pluribus Networks Inc.
  29   30   */
  30   31  
  31   32  #include "igb_sw.h"
  32   33  
  33   34  int
  34   35  igb_m_stat(void *arg, uint_t stat, uint64_t *val)
  35   36  {
  36   37          igb_t *igb = (igb_t *)arg;
  37   38          struct e1000_hw *hw = &igb->hw;
  38   39          igb_stat_t *igb_ks;
↓ open down ↓ 7 lines elided ↑ open up ↑
  46   47                  mutex_exit(&igb->gen_lock);
  47   48                  return (ECANCELED);
  48   49          }
  49   50  
  50   51          switch (stat) {
  51   52          case MAC_STAT_IFSPEED:
  52   53                  *val = igb->link_speed * 1000000ull;
  53   54                  break;
  54   55  
  55   56          case MAC_STAT_MULTIRCV:
  56      -                igb_ks->mprc.value.ui64 +=
  57      -                    E1000_READ_REG(hw, E1000_MPRC);
  58      -                *val = igb_ks->mprc.value.ui64;
       57 +                igb->stat_mprc += E1000_READ_REG(hw, E1000_MPRC);
       58 +                *val = igb->stat_mprc;
  59   59                  break;
  60   60  
  61   61          case MAC_STAT_BRDCSTRCV:
  62      -                igb_ks->bprc.value.ui64 +=
  63      -                    E1000_READ_REG(hw, E1000_BPRC);
  64      -                *val = igb_ks->bprc.value.ui64;
       62 +                igb->stat_bprc += E1000_READ_REG(hw, E1000_BPRC);
       63 +                *val = igb->stat_bprc;
  65   64                  break;
  66   65  
  67   66          case MAC_STAT_MULTIXMT:
  68      -                igb_ks->mptc.value.ui64 +=
  69      -                    E1000_READ_REG(hw, E1000_MPTC);
  70      -                *val = igb_ks->mptc.value.ui64;
       67 +                igb->stat_mptc += E1000_READ_REG(hw, E1000_MPTC);
       68 +                *val = igb->stat_mptc;
  71   69                  break;
  72   70  
  73   71          case MAC_STAT_BRDCSTXMT:
  74      -                igb_ks->bptc.value.ui64 +=
  75      -                    E1000_READ_REG(hw, E1000_BPTC);
  76      -                *val = igb_ks->bptc.value.ui64;
       72 +                igb->stat_bptc += E1000_READ_REG(hw, E1000_BPTC);
       73 +                *val = igb->stat_bptc;
  77   74                  break;
  78   75  
  79   76          case MAC_STAT_NORCVBUF:
  80      -                igb_ks->rnbc.value.ui64 +=
  81      -                    E1000_READ_REG(hw, E1000_RNBC);
  82      -                *val = igb_ks->rnbc.value.ui64;
       77 +                igb->stat_rnbc += E1000_READ_REG(hw, E1000_RNBC);
       78 +                *val = igb->stat_rnbc;
  83   79                  break;
  84   80  
  85   81          case MAC_STAT_IERRORS:
  86      -                igb_ks->rxerrc.value.ui64 +=
  87      -                    E1000_READ_REG(hw, E1000_RXERRC);
  88      -                igb_ks->algnerrc.value.ui64 +=
  89      -                    E1000_READ_REG(hw, E1000_ALGNERRC);
       82 +                igb->stat_rxerrc += E1000_READ_REG(hw, E1000_RXERRC);
       83 +                igb->stat_algnerrc += E1000_READ_REG(hw, E1000_ALGNERRC);
  90   84                  igb_ks->rlec.value.ui64 +=
  91   85                      E1000_READ_REG(hw, E1000_RLEC);
  92      -                igb_ks->crcerrs.value.ui64 +=
  93      -                    E1000_READ_REG(hw, E1000_CRCERRS);
  94      -                igb_ks->cexterr.value.ui64 +=
  95      -                    E1000_READ_REG(hw, E1000_CEXTERR);
  96      -                *val = igb_ks->rxerrc.value.ui64 +
  97      -                    igb_ks->algnerrc.value.ui64 +
       86 +                igb->stat_crcerrs += E1000_READ_REG(hw, E1000_CRCERRS);
       87 +                igb->stat_cexterr += E1000_READ_REG(hw, E1000_CEXTERR);
       88 +                *val = igb->stat_rxerrc +
       89 +                    igb->stat_algnerrc +
  98   90                      igb_ks->rlec.value.ui64 +
  99      -                    igb_ks->crcerrs.value.ui64 +
 100      -                    igb_ks->cexterr.value.ui64;
       91 +                    igb->stat_crcerrs +
       92 +                    igb->stat_cexterr;
 101   93                  break;
 102   94  
 103   95          case MAC_STAT_NOXMTBUF:
 104   96                  *val = 0;
 105   97                  break;
 106   98  
 107   99          case MAC_STAT_OERRORS:
 108      -                igb_ks->ecol.value.ui64 +=
 109      -                    E1000_READ_REG(hw, E1000_ECOL);
 110      -                *val = igb_ks->ecol.value.ui64;
      100 +                igb->stat_ecol += E1000_READ_REG(hw, E1000_ECOL);
      101 +                *val = igb->stat_ecol;
 111  102                  break;
 112  103  
 113  104          case MAC_STAT_COLLISIONS:
 114      -                igb_ks->colc.value.ui64 +=
 115      -                    E1000_READ_REG(hw, E1000_COLC);
 116      -                *val = igb_ks->colc.value.ui64;
      105 +                igb->stat_colc += E1000_READ_REG(hw, E1000_COLC);
      106 +                *val = igb->stat_colc;
 117  107                  break;
 118  108  
 119  109          case MAC_STAT_RBYTES:
 120  110                  /*
 121  111                   * The 64-bit register will reset whenever the upper
 122  112                   * 32 bits are read. So we need to read the lower
 123  113                   * 32 bits first, then read the upper 32 bits.
 124  114                   */
 125  115                  low_val = E1000_READ_REG(hw, E1000_TORL);
 126  116                  high_val = E1000_READ_REG(hw, E1000_TORH);
 127      -                igb_ks->tor.value.ui64 +=
 128      -                    (uint64_t)high_val << 32 | (uint64_t)low_val;
 129      -                *val = igb_ks->tor.value.ui64;
      117 +                igb->stat_tor += (uint64_t)high_val << 32 | (uint64_t)low_val;
      118 +                *val = igb->stat_tor;
 130  119                  break;
 131  120  
 132  121          case MAC_STAT_IPACKETS:
 133      -                igb_ks->tpr.value.ui64 +=
 134      -                    E1000_READ_REG(hw, E1000_TPR);
 135      -                *val = igb_ks->tpr.value.ui64;
      122 +                igb->stat_tpr += E1000_READ_REG(hw, E1000_TPR);
      123 +                *val = igb->stat_tpr;
 136  124                  break;
 137  125  
 138  126          case MAC_STAT_OBYTES:
 139  127                  /*
 140  128                   * The 64-bit register will reset whenever the upper
 141  129                   * 32 bits are read. So we need to read the lower
 142  130                   * 32 bits first, then read the upper 32 bits.
 143  131                   */
 144  132                  low_val = E1000_READ_REG(hw, E1000_TOTL);
 145  133                  high_val = E1000_READ_REG(hw, E1000_TOTH);
 146      -                igb_ks->tot.value.ui64 +=
 147      -                    (uint64_t)high_val << 32 | (uint64_t)low_val;
 148      -                *val = igb_ks->tot.value.ui64;
      134 +                igb->stat_tot += (uint64_t)high_val << 32 | (uint64_t)low_val;
      135 +                *val = igb->stat_tot;
 149  136                  break;
 150  137  
 151  138          case MAC_STAT_OPACKETS:
 152      -                igb_ks->tpt.value.ui64 +=
 153      -                    E1000_READ_REG(hw, E1000_TPT);
 154      -                *val = igb_ks->tpt.value.ui64;
      139 +                igb->stat_tpt += E1000_READ_REG(hw, E1000_TPT);
      140 +                *val = igb->stat_tpt;
 155  141                  break;
 156  142  
 157  143          /* RFC 1643 stats */
 158  144          case ETHER_STAT_ALIGN_ERRORS:
 159      -                igb_ks->algnerrc.value.ui64 +=
 160      -                    E1000_READ_REG(hw, E1000_ALGNERRC);
 161      -                *val = igb_ks->algnerrc.value.ui64;
      145 +                igb->stat_algnerrc += E1000_READ_REG(hw, E1000_ALGNERRC);
      146 +                *val = igb->stat_algnerrc;
 162  147                  break;
 163  148  
 164  149          case ETHER_STAT_FCS_ERRORS:
 165      -                igb_ks->crcerrs.value.ui64 +=
 166      -                    E1000_READ_REG(hw, E1000_CRCERRS);
 167      -                *val = igb_ks->crcerrs.value.ui64;
      150 +                igb->stat_crcerrs += E1000_READ_REG(hw, E1000_CRCERRS);
      151 +                *val = igb->stat_crcerrs;
 168  152                  break;
 169  153  
 170  154          case ETHER_STAT_FIRST_COLLISIONS:
 171      -                igb_ks->scc.value.ui64 +=
 172      -                    E1000_READ_REG(hw, E1000_SCC);
 173      -                *val = igb_ks->scc.value.ui64;
      155 +                igb->stat_scc += E1000_READ_REG(hw, E1000_SCC);
      156 +                *val = igb->stat_scc;
 174  157                  break;
 175  158  
 176  159          case ETHER_STAT_MULTI_COLLISIONS:
 177      -                igb_ks->mcc.value.ui64 +=
 178      -                    E1000_READ_REG(hw, E1000_MCC);
 179      -                *val = igb_ks->mcc.value.ui64;
      160 +                igb->stat_mcc += E1000_READ_REG(hw, E1000_MCC);
      161 +                *val = igb->stat_mcc;
 180  162                  break;
 181  163  
 182  164          case ETHER_STAT_SQE_ERRORS:
 183      -                igb_ks->sec.value.ui64 +=
 184      -                    E1000_READ_REG(hw, E1000_SEC);
 185      -                *val = igb_ks->sec.value.ui64;
      165 +                igb->stat_sec += E1000_READ_REG(hw, E1000_SEC);
      166 +                *val = igb->stat_sec;
 186  167                  break;
 187  168  
 188  169          case ETHER_STAT_DEFER_XMTS:
 189      -                igb_ks->dc.value.ui64 +=
 190      -                    E1000_READ_REG(hw, E1000_DC);
 191      -                *val = igb_ks->dc.value.ui64;
      170 +                igb->stat_dc += E1000_READ_REG(hw, E1000_DC);
      171 +                *val = igb->stat_dc;
 192  172                  break;
 193  173  
 194  174          case ETHER_STAT_TX_LATE_COLLISIONS:
 195      -                igb_ks->latecol.value.ui64 +=
 196      -                    E1000_READ_REG(hw, E1000_LATECOL);
 197      -                *val = igb_ks->latecol.value.ui64;
      175 +                igb->stat_latecol += E1000_READ_REG(hw, E1000_LATECOL);
      176 +                *val = igb->stat_latecol;
 198  177                  break;
 199  178  
 200  179          case ETHER_STAT_EX_COLLISIONS:
 201      -                igb_ks->ecol.value.ui64 +=
 202      -                    E1000_READ_REG(hw, E1000_ECOL);
 203      -                *val = igb_ks->ecol.value.ui64;
      180 +                igb->stat_ecol += E1000_READ_REG(hw, E1000_ECOL);
      181 +                *val = igb->stat_ecol;
 204  182                  break;
 205  183  
 206  184          case ETHER_STAT_MACXMT_ERRORS:
 207      -                igb_ks->ecol.value.ui64 +=
 208      -                    E1000_READ_REG(hw, E1000_ECOL);
 209      -                *val = igb_ks->ecol.value.ui64;
      185 +                igb->stat_ecol += E1000_READ_REG(hw, E1000_ECOL);
      186 +                *val = igb->stat_ecol;
 210  187                  break;
 211  188  
 212  189          case ETHER_STAT_CARRIER_ERRORS:
 213      -                igb_ks->cexterr.value.ui64 +=
 214      -                    E1000_READ_REG(hw, E1000_CEXTERR);
 215      -                *val = igb_ks->cexterr.value.ui64;
      190 +                igb->stat_cexterr += E1000_READ_REG(hw, E1000_CEXTERR);
      191 +                *val = igb->stat_cexterr;
 216  192                  break;
 217  193  
 218  194          case ETHER_STAT_TOOLONG_ERRORS:
 219      -                igb_ks->roc.value.ui64 +=
 220      -                    E1000_READ_REG(hw, E1000_ROC);
 221      -                *val = igb_ks->roc.value.ui64;
      195 +                igb->stat_roc += E1000_READ_REG(hw, E1000_ROC);
      196 +                *val = igb->stat_roc;
 222  197                  break;
 223  198  
 224  199          case ETHER_STAT_MACRCV_ERRORS:
 225      -                igb_ks->rxerrc.value.ui64 +=
 226      -                    E1000_READ_REG(hw, E1000_RXERRC);
 227      -                *val = igb_ks->rxerrc.value.ui64;
      200 +                igb->stat_rxerrc += E1000_READ_REG(hw, E1000_RXERRC);
      201 +                *val = igb->stat_rxerrc;
 228  202                  break;
 229  203  
 230  204          /* MII/GMII stats */
 231  205          case ETHER_STAT_XCVR_ADDR:
 232  206                  /* The Internal PHY's MDI address for each MAC is 1 */
 233  207                  *val = 1;
 234  208                  break;
 235  209  
 236  210          case ETHER_STAT_XCVR_ID:
 237  211                  *val = hw->phy.id | hw->phy.revision;
↓ open down ↓ 140 lines elided ↑ open up ↑
 378  352          case ETHER_STAT_LINK_AUTONEG:
 379  353                  *val = hw->mac.autoneg;
 380  354                  break;
 381  355  
 382  356          case ETHER_STAT_LINK_DUPLEX:
 383  357                  *val = (igb->link_duplex == FULL_DUPLEX) ?
 384  358                      LINK_DUPLEX_FULL : LINK_DUPLEX_HALF;
 385  359                  break;
 386  360  
 387  361          case ETHER_STAT_TOOSHORT_ERRORS:
 388      -                igb_ks->ruc.value.ui64 +=
 389      -                    E1000_READ_REG(hw, E1000_RUC);
 390      -                *val = igb_ks->ruc.value.ui64;
      362 +                igb->stat_ruc += E1000_READ_REG(hw, E1000_RUC);
      363 +                *val = igb->stat_ruc;
 391  364                  break;
 392  365  
 393  366          case ETHER_STAT_CAP_REMFAULT:
 394  367                  *val = igb->param_rem_fault;
 395  368                  break;
 396  369  
 397  370          case ETHER_STAT_ADV_REMFAULT:
 398  371                  *val = igb->param_adv_rem_fault;
 399  372                  break;
 400  373  
 401  374          case ETHER_STAT_LP_REMFAULT:
 402  375                  *val = igb->param_lp_rem_fault;
 403  376                  break;
 404  377  
 405  378          case ETHER_STAT_JABBER_ERRORS:
 406      -                igb_ks->rjc.value.ui64 +=
 407      -                    E1000_READ_REG(hw, E1000_RJC);
 408      -                *val = igb_ks->rjc.value.ui64;
      379 +                igb->stat_rjc += E1000_READ_REG(hw, E1000_RJC);
      380 +                *val = igb->stat_rjc;
 409  381                  break;
 410  382  
 411  383          case ETHER_STAT_CAP_100T4:
 412  384                  *val = igb->param_100t4_cap;
 413  385                  break;
 414  386  
 415  387          case ETHER_STAT_ADV_CAP_100T4:
 416  388                  *val = igb->param_adv_100t4_cap;
 417  389                  break;
 418  390  
↓ open down ↓ 967 lines elided ↑ open up ↑
1386 1358          struct e1000_hw *hw = &igb->hw;
1387 1359          int i;
1388 1360  
1389 1361          if (strcmp(pr_name, "_eee_support") == 0) {
1390 1362                  if (pr_val == NULL)
1391 1363                          return (EINVAL);
1392 1364                  (void) ddi_strtol(pr_val, (char **)NULL, 0, &result);
1393 1365                  switch (result) {
1394 1366                  case 0:
1395 1367                  case 1:
1396      -                        if (hw->mac.type != e1000_i350) {
1397      -                                /*
1398      -                                 * For now, only supported on I350.
1399      -                                 * Add new mac.type values (or use < instead)
1400      -                                 * as new cards offer up EEE.
1401      -                                 */
     1368 +                        /*
     1369 +                         * For now, only supported on I350/I354.
     1370 +                         * Add new mac.type values (or use < instead)
     1371 +                         * as new cards offer up EEE.
     1372 +                         */
     1373 +                        switch (hw->mac.type) {
     1374 +                        case e1000_i350:
     1375 +                                /* Must set this prior to the set call. */
     1376 +                                hw->dev_spec._82575.eee_disable = !result;
     1377 +                                if (e1000_set_eee_i350(hw) != E1000_SUCCESS)
     1378 +                                        err = EIO;
     1379 +                                break;
     1380 +                        case e1000_i354:
     1381 +                                /* Must set this prior to the set call. */
     1382 +                                hw->dev_spec._82575.eee_disable = !result;
     1383 +                                if (e1000_set_eee_i354(hw) != E1000_SUCCESS)
     1384 +                                        err = EIO;
     1385 +                                break;
     1386 +                        default:
1402 1387                                  return (ENXIO);
1403 1388                          }
1404      -                        /* Must set this prior to the set call. */
1405      -                        hw->dev_spec._82575.eee_disable = !result;
1406      -                        if (e1000_set_eee_i350(hw) != E1000_SUCCESS)
1407      -                                err = EIO;
1408 1389                          break;
1409 1390                  default:
1410 1391                          err = EINVAL;
1411 1392                          /* FALLTHRU */
1412 1393                  }
1413 1394                  return (err);
1414 1395          }
1415 1396          if (strcmp(pr_name, "_tx_copy_thresh") == 0) {
1416 1397                  if (pr_val == NULL) {
1417 1398                          err = EINVAL;
↓ open down ↓ 114 lines elided ↑ open up ↑
1532 1513  
1533 1514          if (strcmp(pr_name, "_adv_pause_cap") == 0) {
1534 1515                  value = igb->param_adv_pause_cap;
1535 1516          } else if (strcmp(pr_name, "_adv_asym_pause_cap") == 0) {
1536 1517                  value = igb->param_adv_asym_pause_cap;
1537 1518          } else if (strcmp(pr_name, "_eee_support") == 0) {
1538 1519                  /*
1539 1520                   * For now, only supported on I350.  Add new mac.type values
1540 1521                   * (or use < instead) as new cards offer up EEE.
1541 1522                   */
1542      -                value = (igb->hw.mac.type != e1000_i350) ? 0 :
1543      -                    !(igb->hw.dev_spec._82575.eee_disable);
     1523 +                switch (igb->hw.mac.type) {
     1524 +                case e1000_i350:
     1525 +                case e1000_i354:
     1526 +                        value = !(igb->hw.dev_spec._82575.eee_disable);
     1527 +                        break;
     1528 +                default:
     1529 +                        value = 0;
     1530 +                }
1544 1531          } else if (strcmp(pr_name, "_tx_copy_thresh") == 0) {
1545 1532                  value = igb->tx_copy_thresh;
1546 1533          } else if (strcmp(pr_name, "_tx_recycle_thresh") == 0) {
1547 1534                  value = igb->tx_recycle_thresh;
1548 1535          } else if (strcmp(pr_name, "_tx_overload_thresh") == 0) {
1549 1536                  value = igb->tx_overload_thresh;
1550 1537          } else if (strcmp(pr_name, "_tx_resched_thresh") == 0) {
1551 1538                  value = igb->tx_resched_thresh;
1552 1539          } else if (strcmp(pr_name, "_rx_copy_thresh") == 0) {
1553 1540                  value = igb->rx_copy_thresh;
↓ open down ↓ 43 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX