Print this page
3014 Intel X540 Support (fix lint)

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/ixgbe/ixgbe_82599.c
          +++ new/usr/src/uts/common/io/ixgbe/ixgbe_82599.c
↓ open down ↓ 944 lines elided ↑ open up ↑
 945  945                                           bool autoneg,
 946  946                                           bool autoneg_wait_to_complete)
 947  947  {
 948  948          s32 status;
 949  949  
 950  950          DEBUGFUNC("ixgbe_setup_copper_link_82599");
 951  951  
 952  952          /* Setup the PHY according to input speed */
 953  953          status = hw->phy.ops.setup_link_speed(hw, speed, autoneg,
 954  954                                                autoneg_wait_to_complete);
 955      -        /* Set up MAC */
 956      -        ixgbe_start_mac_link_82599(hw, autoneg_wait_to_complete);
      955 +        if (status == IXGBE_SUCCESS) {
      956 +                /* Set up MAC */
      957 +                status =
      958 +                    ixgbe_start_mac_link_82599(hw, autoneg_wait_to_complete);
      959 +        }
 957  960  
 958  961          return status;
 959  962  }
 960  963  
 961  964  /**
 962  965   *  ixgbe_reset_hw_82599 - Perform hardware reset
 963  966   *  @hw: pointer to hardware structure
 964  967   *
 965  968   *  Resets the hardware by resetting the transmit and receive units, masks
 966  969   *  and clears all interrupts, perform a PHY reset, and perform a link (MAC)
↓ open down ↓ 200 lines elided ↑ open up ↑
1167 1170                                     IXGBE_FDIRCTRL_INIT_DONE)
1168 1171                          break;
1169 1172                  usec_delay(10);
1170 1173          }
1171 1174          if (i >= IXGBE_FDIR_INIT_DONE_POLL) {
1172 1175                  DEBUGOUT("Flow Director Signature poll time exceeded!\n");
1173 1176                  return IXGBE_ERR_FDIR_REINIT_FAILED;
1174 1177          }
1175 1178  
1176 1179          /* Clear FDIR statistics registers (read to clear) */
1177      -        IXGBE_READ_REG(hw, IXGBE_FDIRUSTAT);
1178      -        IXGBE_READ_REG(hw, IXGBE_FDIRFSTAT);
1179      -        IXGBE_READ_REG(hw, IXGBE_FDIRMATCH);
1180      -        IXGBE_READ_REG(hw, IXGBE_FDIRMISS);
1181      -        IXGBE_READ_REG(hw, IXGBE_FDIRLEN);
     1180 +        (void) IXGBE_READ_REG(hw, IXGBE_FDIRUSTAT);
     1181 +        (void) IXGBE_READ_REG(hw, IXGBE_FDIRFSTAT);
     1182 +        (void) IXGBE_READ_REG(hw, IXGBE_FDIRMATCH);
     1183 +        (void) IXGBE_READ_REG(hw, IXGBE_FDIRMISS);
     1184 +        (void) IXGBE_READ_REG(hw, IXGBE_FDIRLEN);
1182 1185  
1183 1186          return IXGBE_SUCCESS;
1184 1187  }
1185 1188  
1186 1189  /**
1187 1190   *  ixgbe_fdir_enable_82599 - Initialize Flow Director control registers
1188 1191   *  @hw: pointer to hardware structure
1189 1192   *  @fdirctrl: value to write to flow director control register
1190 1193   **/
1191 1194  static void ixgbe_fdir_enable_82599(struct ixgbe_hw *hw, u32 fdirctrl)
↓ open down ↓ 90 lines elided ↑ open up ↑
1282 1285          return IXGBE_SUCCESS;
1283 1286  }
1284 1287  
1285 1288  /*
1286 1289   * These defines allow us to quickly generate all of the necessary instructions
1287 1290   * in the function below by simply calling out IXGBE_COMPUTE_SIG_HASH_ITERATION
1288 1291   * for values 0 through 15
1289 1292   */
1290 1293  #define IXGBE_ATR_COMMON_HASH_KEY \
1291 1294                  (IXGBE_ATR_BUCKET_HASH_KEY & IXGBE_ATR_SIGNATURE_HASH_KEY)
     1295 +#if lint
     1296 +#define IXGBE_COMPUTE_SIG_HASH_ITERATION(_n)
     1297 +#else
1292 1298  #define IXGBE_COMPUTE_SIG_HASH_ITERATION(_n) \
1293 1299  do { \
1294 1300          u32 n = (_n); \
1295 1301          if (IXGBE_ATR_COMMON_HASH_KEY & (0x01 << n)) \
1296 1302                  common_hash ^= lo_hash_dword >> n; \
1297 1303          else if (IXGBE_ATR_BUCKET_HASH_KEY & (0x01 << n)) \
1298 1304                  bucket_hash ^= lo_hash_dword >> n; \
1299 1305          else if (IXGBE_ATR_SIGNATURE_HASH_KEY & (0x01 << n)) \
1300 1306                  sig_hash ^= lo_hash_dword << (16 - n); \
1301 1307          if (IXGBE_ATR_COMMON_HASH_KEY & (0x01 << (n + 16))) \
1302 1308                  common_hash ^= hi_hash_dword >> n; \
1303 1309          else if (IXGBE_ATR_BUCKET_HASH_KEY & (0x01 << (n + 16))) \
1304 1310                  bucket_hash ^= hi_hash_dword >> n; \
1305 1311          else if (IXGBE_ATR_SIGNATURE_HASH_KEY & (0x01 << (n + 16))) \
1306 1312                  sig_hash ^= hi_hash_dword << (16 - n); \
1307 1313  } while (0);
     1314 +#endif
1308 1315  
1309 1316  /**
1310 1317   *  ixgbe_atr_compute_sig_hash_82599 - Compute the signature hash
1311 1318   *  @stream: input bitstream to compute the hash on
1312 1319   *
1313 1320   *  This function is almost identical to the function above but contains
1314 1321   *  several optomizations such as unwinding all of the loops, letting the
1315 1322   *  compiler work out all of the conditional ifs since the keys are static
1316 1323   *  defines, and computing two keys at once since the hashed dword stream
1317 1324   *  will be the same for both keys.
↓ open down ↓ 100 lines elided ↑ open up ↑
1418 1425           */
1419 1426          fdirhashcmd = (u64)fdircmd << 32;
1420 1427          fdirhashcmd |= ixgbe_atr_compute_sig_hash_82599(input, common);
1421 1428          IXGBE_WRITE_REG64(hw, IXGBE_FDIRHASH, fdirhashcmd);
1422 1429  
1423 1430          DEBUGOUT2("Tx Queue=%x hash=%x\n", queue, (u32)fdirhashcmd);
1424 1431  
1425 1432          return IXGBE_SUCCESS;
1426 1433  }
1427 1434  
     1435 +#if lint
     1436 +#define IXGBE_COMPUTE_BKT_HASH_ITERATION(_n)
     1437 +#else
1428 1438  #define IXGBE_COMPUTE_BKT_HASH_ITERATION(_n) \
1429 1439  do { \
1430 1440          u32 n = (_n); \
1431 1441          if (IXGBE_ATR_BUCKET_HASH_KEY & (0x01 << n)) \
1432 1442                  bucket_hash ^= lo_hash_dword >> n; \
1433 1443          if (IXGBE_ATR_BUCKET_HASH_KEY & (0x01 << (n + 16))) \
1434 1444                  bucket_hash ^= hi_hash_dword >> n; \
1435 1445  } while (0);
1436      -
     1446 +#endif
1437 1447  /**
1438 1448   *  ixgbe_atr_compute_perfect_hash_82599 - Compute the perfect filter hash
1439 1449   *  @atr_input: input bitstream to compute the hash on
1440 1450   *  @input_mask: mask for the input bitstream
1441 1451   *
1442 1452   *  This function serves two main purposes.  First it applys the input_mask
1443 1453   *  to the atr_input resulting in a cleaned up atr_input data stream.
1444 1454   *  Secondly it computes the hash and stores it in the bkt_hash field at
1445 1455   *  the end of the input byte stream.  This way it will be available for
1446 1456   *  future use without needing to recompute the hash.
↓ open down ↓ 130 lines elided ↑ open up ↑
1577 1587           */
1578 1588  
1579 1589          /* verify bucket hash is cleared on hash generation */
1580 1590          if (input_mask->formatted.bkt_hash)
1581 1591                  DEBUGOUT(" bucket hash should always be 0 in mask\n");
1582 1592  
1583 1593          /* Program FDIRM and verify partial masks */
1584 1594          switch (input_mask->formatted.vm_pool & 0x7F) {
1585 1595          case 0x0:
1586 1596                  fdirm |= IXGBE_FDIRM_POOL;
     1597 +                /* FALLTHRU */
1587 1598          case 0x7F:
1588 1599                  break;
1589 1600          default:
1590 1601                  DEBUGOUT(" Error on vm pool mask\n");
1591 1602                  return IXGBE_ERR_CONFIG;
1592 1603          }
1593 1604  
1594 1605          switch (input_mask->formatted.flow_type & IXGBE_ATR_L4TYPE_MASK) {
1595 1606          case 0x0:
1596 1607                  fdirm |= IXGBE_FDIRM_L4P;
1597 1608                  if (input_mask->formatted.dst_port ||
1598 1609                      input_mask->formatted.src_port) {
1599 1610                          DEBUGOUT(" Error on src/dst port mask\n");
1600 1611                          return IXGBE_ERR_CONFIG;
1601 1612                  }
     1613 +                /* FALLTHRU */
1602 1614          case IXGBE_ATR_L4TYPE_MASK:
1603 1615                  break;
1604 1616          default:
1605 1617                  DEBUGOUT(" Error on flow type mask\n");
1606 1618                  return IXGBE_ERR_CONFIG;
1607 1619          }
1608 1620  
1609 1621          switch (IXGBE_NTOHS(input_mask->formatted.vlan_id) & 0xEFFF) {
1610 1622          case 0x0000:
1611 1623                  /* mask VLAN ID, fall through to mask VLAN priority */
1612 1624                  fdirm |= IXGBE_FDIRM_VLANID;
     1625 +                /* FALLTHRU */
1613 1626          case 0x0FFF:
1614 1627                  /* mask VLAN priority */
1615 1628                  fdirm |= IXGBE_FDIRM_VLANP;
1616 1629                  break;
1617 1630          case 0xE000:
1618 1631                  /* mask VLAN ID only, fall through */
1619 1632                  fdirm |= IXGBE_FDIRM_VLANID;
     1633 +                /* FALLTHRU */
1620 1634          case 0xEFFF:
1621 1635                  /* no VLAN fields masked */
1622 1636                  break;
1623 1637          default:
1624 1638                  DEBUGOUT(" Error on VLAN mask\n");
1625 1639                  return IXGBE_ERR_CONFIG;
1626 1640          }
1627 1641  
1628 1642          switch (input_mask->formatted.flex_bytes & 0xFFFF) {
1629 1643          case 0x0000:
1630 1644                  /* Mask Flex Bytes, fall through */
1631 1645                  fdirm |= IXGBE_FDIRM_FLEX;
     1646 +                /* FALLTHRU */
1632 1647          case 0xFFFF:
1633 1648                  break;
1634 1649          default:
1635 1650                  DEBUGOUT(" Error on flexible byte mask\n");
1636 1651                  return IXGBE_ERR_CONFIG;
1637 1652          }
1638 1653  
1639 1654          /* Now mask VM pool and destination IPv6 - bits 5 and 2 */
1640 1655          IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
1641 1656  
↓ open down ↓ 145 lines elided ↑ open up ↑
1787 1802                  if (input->formatted.dst_port || input->formatted.src_port) {
1788 1803                          DEBUGOUT(" Error on src/dst port\n");
1789 1804                          return IXGBE_ERR_CONFIG;
1790 1805                  }
1791 1806                  break;
1792 1807          case IXGBE_ATR_FLOW_TYPE_SCTPV4:
1793 1808                  if (input->formatted.dst_port || input->formatted.src_port) {
1794 1809                          DEBUGOUT(" Error on src/dst port\n");
1795 1810                          return IXGBE_ERR_CONFIG;
1796 1811                  }
     1812 +                /* FALLTHRU */
1797 1813          case IXGBE_ATR_FLOW_TYPE_TCPV4:
1798 1814          case IXGBE_ATR_FLOW_TYPE_UDPV4:
1799 1815                  input_mask->formatted.flow_type = IXGBE_ATR_L4TYPE_IPV6_MASK |
1800 1816                                                    IXGBE_ATR_L4TYPE_MASK;
1801 1817                  break;
1802 1818          default:
1803 1819                  DEBUGOUT(" Error on flow type input\n");
1804 1820                  return err;
1805 1821          }
1806 1822  
↓ open down ↓ 434 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX