Lines Matching +full:i2c +full:- +full:atr

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2024 Intel Corporation. */
31 sizeof(((struct ixgbe_adapter *)0)->m), \
34 sizeof(((struct rtnl_link_stats64 *)0)->m), \
111 #define IXGBE_NUM_RX_QUEUES netdev->num_tx_queues
114 (netdev->num_tx_queues + IXGBE_NUM_RX_QUEUES) * \
118 (sizeof(((struct ixgbe_adapter *)0)->stats.pxonrxc) + \
119 sizeof(((struct ixgbe_adapter *)0)->stats.pxontxc) + \
120 sizeof(((struct ixgbe_adapter *)0)->stats.pxoffrxc) + \
121 sizeof(((struct ixgbe_adapter *)0)->stats.pxofftxc)) \
136 "legacy-rx",
138 "vf-ipsec",
140 "mdd-disable-vf",
150 if (!ixgbe_isbackplane(hw->phy.media_type)) { in ixgbe_set_supported_10gtypes()
156 switch (hw->device_id) { in ixgbe_set_supported_10gtypes()
183 if (!ixgbe_isbackplane(hw->phy.media_type)) { in ixgbe_set_advertising_10gtypes()
189 switch (hw->device_id) { in ixgbe_set_advertising_10gtypes()
217 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_link_ksettings()
224 hw->mac.ops.get_link_capabilities(hw, &supported_link, &autoneg); in ixgbe_get_link_ksettings()
240 if (ixgbe_isbackplane(hw->phy.media_type)) { in ixgbe_get_link_ksettings()
266 if (hw->phy.autoneg_advertised) { in ixgbe_get_link_ksettings()
268 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10_FULL) in ixgbe_get_link_ksettings()
271 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL) in ixgbe_get_link_ksettings()
274 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL) in ixgbe_get_link_ksettings()
276 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL) { in ixgbe_get_link_ksettings()
285 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_5GB_FULL) in ixgbe_get_link_ksettings()
288 if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_2_5GB_FULL) in ixgbe_get_link_ksettings()
292 if (hw->phy.multispeed_fiber && !autoneg) { in ixgbe_get_link_ksettings()
302 cmd->base.autoneg = AUTONEG_ENABLE; in ixgbe_get_link_ksettings()
304 cmd->base.autoneg = AUTONEG_DISABLE; in ixgbe_get_link_ksettings()
307 switch (adapter->hw.phy.type) { in ixgbe_get_link_ksettings()
315 cmd->base.port = PORT_TP; in ixgbe_get_link_ksettings()
320 cmd->base.port = PORT_FIBRE; in ixgbe_get_link_ksettings()
334 switch (adapter->hw.phy.sfp_type) { in ixgbe_get_link_ksettings()
342 cmd->base.port = PORT_DA; in ixgbe_get_link_ksettings()
358 cmd->base.port = PORT_FIBRE; in ixgbe_get_link_ksettings()
365 cmd->base.port = PORT_NONE; in ixgbe_get_link_ksettings()
373 cmd->base.port = PORT_TP; in ixgbe_get_link_ksettings()
381 cmd->base.port = PORT_OTHER; in ixgbe_get_link_ksettings()
390 cmd->base.port = PORT_NONE; in ixgbe_get_link_ksettings()
400 cmd->base.port = PORT_OTHER; in ixgbe_get_link_ksettings()
407 switch (hw->fc.requested_mode) { in ixgbe_get_link_ksettings()
427 switch (adapter->link_speed) { in ixgbe_get_link_ksettings()
429 cmd->base.speed = SPEED_10000; in ixgbe_get_link_ksettings()
432 cmd->base.speed = SPEED_5000; in ixgbe_get_link_ksettings()
435 cmd->base.speed = SPEED_2500; in ixgbe_get_link_ksettings()
438 cmd->base.speed = SPEED_1000; in ixgbe_get_link_ksettings()
441 cmd->base.speed = SPEED_100; in ixgbe_get_link_ksettings()
444 cmd->base.speed = SPEED_10; in ixgbe_get_link_ksettings()
449 cmd->base.duplex = DUPLEX_FULL; in ixgbe_get_link_ksettings()
451 cmd->base.speed = SPEED_UNKNOWN; in ixgbe_get_link_ksettings()
452 cmd->base.duplex = DUPLEX_UNKNOWN; in ixgbe_get_link_ksettings()
462 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_link_ksettings()
466 if ((hw->phy.media_type == ixgbe_media_type_copper) || in ixgbe_set_link_ksettings()
467 (hw->phy.multispeed_fiber)) { in ixgbe_set_link_ksettings()
472 if (!linkmode_subset(cmd->link_modes.advertising, in ixgbe_set_link_ksettings()
473 cmd->link_modes.supported)) in ixgbe_set_link_ksettings()
474 return -EINVAL; in ixgbe_set_link_ksettings()
477 if (!cmd->base.autoneg && hw->phy.multispeed_fiber) { in ixgbe_set_link_ksettings()
482 return -EINVAL; in ixgbe_set_link_ksettings()
485 old = hw->phy.autoneg_advertised; in ixgbe_set_link_ksettings()
510 /* this sets the link speed and restarts auto-neg */ in ixgbe_set_link_ksettings()
511 while (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) in ixgbe_set_link_ksettings()
514 hw->mac.autotry_restart = true; in ixgbe_set_link_ksettings()
515 err = hw->mac.ops.setup_link(hw, advertised, true); in ixgbe_set_link_ksettings()
518 hw->mac.ops.setup_link(hw, old, true); in ixgbe_set_link_ksettings()
520 clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state); in ixgbe_set_link_ksettings()
523 u32 speed = cmd->base.speed; in ixgbe_set_link_ksettings()
525 if ((cmd->base.autoneg == AUTONEG_ENABLE) || in ixgbe_set_link_ksettings()
528 (speed + cmd->base.duplex != SPEED_10000 + DUPLEX_FULL)) in ixgbe_set_link_ksettings()
529 return -EINVAL; in ixgbe_set_link_ksettings()
539 struct ixgbe_hw_stats *hwstats = &adapter->stats; in ixgbe_get_pause_stats()
541 stats->tx_pause_frames = hwstats->lxontxc + hwstats->lxofftxc; in ixgbe_get_pause_stats()
542 stats->rx_pause_frames = hwstats->lxonrxc + hwstats->lxoffrxc; in ixgbe_get_pause_stats()
549 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_pauseparam()
552 !hw->fc.disable_fc_autoneg) in ixgbe_get_pauseparam()
553 pause->autoneg = 1; in ixgbe_get_pauseparam()
555 pause->autoneg = 0; in ixgbe_get_pauseparam()
557 if (hw->fc.current_mode == ixgbe_fc_rx_pause) { in ixgbe_get_pauseparam()
558 pause->rx_pause = 1; in ixgbe_get_pauseparam()
559 } else if (hw->fc.current_mode == ixgbe_fc_tx_pause) { in ixgbe_get_pauseparam()
560 pause->tx_pause = 1; in ixgbe_get_pauseparam()
561 } else if (hw->fc.current_mode == ixgbe_fc_full) { in ixgbe_get_pauseparam()
562 pause->rx_pause = 1; in ixgbe_get_pauseparam()
563 pause->tx_pause = 1; in ixgbe_get_pauseparam()
571 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_pauseparam_finalize()
574 if (memcmp(fc, &hw->fc, sizeof(*fc))) { in ixgbe_set_pauseparam_finalize()
575 hw->fc = *fc; in ixgbe_set_pauseparam_finalize()
587 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_pauseparam()
588 struct ixgbe_fc_info fc = hw->fc; in ixgbe_set_pauseparam()
591 if ((hw->mac.type == ixgbe_mac_82598EB) && in ixgbe_set_pauseparam()
592 (adapter->flags & IXGBE_FLAG_DCB_ENABLED)) in ixgbe_set_pauseparam()
593 return -EINVAL; in ixgbe_set_pauseparam()
596 if ((pause->autoneg == AUTONEG_ENABLE) && in ixgbe_set_pauseparam()
598 return -EINVAL; in ixgbe_set_pauseparam()
600 fc.disable_fc_autoneg = (pause->autoneg != AUTONEG_ENABLE); in ixgbe_set_pauseparam()
602 if ((pause->rx_pause && pause->tx_pause) || pause->autoneg) in ixgbe_set_pauseparam()
604 else if (pause->rx_pause && !pause->tx_pause) in ixgbe_set_pauseparam()
606 else if (!pause->rx_pause && pause->tx_pause) in ixgbe_set_pauseparam()
620 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_pauseparam_e610()
621 struct ixgbe_fc_info fc = hw->fc; in ixgbe_set_pauseparam_e610()
624 return -EOPNOTSUPP; in ixgbe_set_pauseparam_e610()
626 if (pause->autoneg == AUTONEG_DISABLE) { in ixgbe_set_pauseparam_e610()
629 return -EOPNOTSUPP; in ixgbe_set_pauseparam_e610()
634 if (pause->rx_pause && pause->tx_pause) in ixgbe_set_pauseparam_e610()
636 else if (pause->rx_pause) in ixgbe_set_pauseparam_e610()
638 else if (pause->tx_pause) in ixgbe_set_pauseparam_e610()
651 return adapter->msg_enable; in ixgbe_get_msglevel()
657 adapter->msg_enable = data; in ixgbe_set_msglevel()
666 #define IXGBE_GET_STAT(_A_, _R_) _A_->stats._R_
672 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_regs()
678 regs->version = hw->mac.type << 24 | hw->revision_id << 16 | in ixgbe_get_regs()
679 hw->device_id; in ixgbe_get_regs()
724 switch (hw->mac.type) { in ixgbe_get_regs()
827 switch (hw->mac.type) { in ixgbe_get_regs()
1041 stats->link_down_events = adapter->link_down_events; in ixgbe_get_link_ext_stats()
1047 return adapter->hw.eeprom.word_size * 2; in ixgbe_get_eeprom_len()
1054 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eeprom()
1060 if (eeprom->len == 0) in ixgbe_get_eeprom()
1061 return -EINVAL; in ixgbe_get_eeprom()
1063 eeprom->magic = hw->vendor_id | (hw->device_id << 16); in ixgbe_get_eeprom()
1065 first_word = eeprom->offset >> 1; in ixgbe_get_eeprom()
1066 last_word = (eeprom->offset + eeprom->len - 1) >> 1; in ixgbe_get_eeprom()
1067 eeprom_len = last_word - first_word + 1; in ixgbe_get_eeprom()
1071 return -ENOMEM; in ixgbe_get_eeprom()
1073 ret_val = hw->eeprom.ops.read_buffer(hw, first_word, eeprom_len, in ixgbe_get_eeprom()
1076 /* Device's eeprom is always little-endian, word addressable */ in ixgbe_get_eeprom()
1080 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 1), eeprom->len); in ixgbe_get_eeprom()
1090 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_eeprom()
1096 if (eeprom->len == 0) in ixgbe_set_eeprom()
1097 return -EINVAL; in ixgbe_set_eeprom()
1099 if (eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) in ixgbe_set_eeprom()
1100 return -EINVAL; in ixgbe_set_eeprom()
1102 max_len = hw->eeprom.word_size * 2; in ixgbe_set_eeprom()
1104 first_word = eeprom->offset >> 1; in ixgbe_set_eeprom()
1105 last_word = (eeprom->offset + eeprom->len - 1) >> 1; in ixgbe_set_eeprom()
1108 return -ENOMEM; in ixgbe_set_eeprom()
1112 if (eeprom->offset & 1) { in ixgbe_set_eeprom()
1117 ret_val = hw->eeprom.ops.read(hw, first_word, &eeprom_buff[0]); in ixgbe_set_eeprom()
1123 if ((eeprom->offset + eeprom->len) & 1) { in ixgbe_set_eeprom()
1128 ret_val = hw->eeprom.ops.read(hw, last_word, in ixgbe_set_eeprom()
1129 &eeprom_buff[last_word - first_word]); in ixgbe_set_eeprom()
1134 /* Device's eeprom is always little-endian, word addressable */ in ixgbe_set_eeprom()
1135 for (i = 0; i < last_word - first_word + 1; i++) in ixgbe_set_eeprom()
1138 memcpy(ptr, bytes, eeprom->len); in ixgbe_set_eeprom()
1140 for (i = 0; i < last_word - first_word + 1; i++) in ixgbe_set_eeprom()
1143 ret_val = hw->eeprom.ops.write_buffer(hw, first_word, in ixgbe_set_eeprom()
1144 last_word - first_word + 1, in ixgbe_set_eeprom()
1149 hw->eeprom.ops.update_checksum(hw); in ixgbe_set_eeprom()
1158 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_refresh_fw_version()
1170 if (adapter->hw.mac.type == ixgbe_mac_e610) in ixgbe_get_drvinfo()
1173 strscpy(drvinfo->driver, ixgbe_driver_name, sizeof(drvinfo->driver)); in ixgbe_get_drvinfo()
1175 strscpy(drvinfo->fw_version, adapter->eeprom_id, in ixgbe_get_drvinfo()
1176 sizeof(drvinfo->fw_version)); in ixgbe_get_drvinfo()
1178 strscpy(drvinfo->bus_info, pci_name(adapter->pdev), in ixgbe_get_drvinfo()
1179 sizeof(drvinfo->bus_info)); in ixgbe_get_drvinfo()
1181 drvinfo->n_priv_flags = IXGBE_PRIV_FLAGS_STR_LEN; in ixgbe_get_drvinfo()
1186 switch (adapter->hw.mac.type) { in ixgbe_get_max_rxd()
1204 switch (adapter->hw.mac.type) { in ixgbe_get_max_txd()
1226 struct ixgbe_ring *tx_ring = adapter->tx_ring[0]; in ixgbe_get_ringparam()
1227 struct ixgbe_ring *rx_ring = adapter->rx_ring[0]; in ixgbe_get_ringparam()
1229 ring->rx_max_pending = ixgbe_get_max_rxd(adapter); in ixgbe_get_ringparam()
1230 ring->tx_max_pending = ixgbe_get_max_txd(adapter); in ixgbe_get_ringparam()
1231 ring->rx_pending = rx_ring->count; in ixgbe_get_ringparam()
1232 ring->tx_pending = tx_ring->count; in ixgbe_get_ringparam()
1245 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) in ixgbe_set_ringparam()
1246 return -EINVAL; in ixgbe_set_ringparam()
1248 new_tx_count = clamp_t(u32, ring->tx_pending, in ixgbe_set_ringparam()
1252 new_rx_count = clamp_t(u32, ring->rx_pending, in ixgbe_set_ringparam()
1256 if ((new_tx_count == adapter->tx_ring_count) && in ixgbe_set_ringparam()
1257 (new_rx_count == adapter->rx_ring_count)) { in ixgbe_set_ringparam()
1262 while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) in ixgbe_set_ringparam()
1265 if (!netif_running(adapter->netdev)) { in ixgbe_set_ringparam()
1266 for (i = 0; i < adapter->num_tx_queues; i++) in ixgbe_set_ringparam()
1267 adapter->tx_ring[i]->count = new_tx_count; in ixgbe_set_ringparam()
1268 for (i = 0; i < adapter->num_xdp_queues; i++) in ixgbe_set_ringparam()
1269 adapter->xdp_ring[i]->count = new_tx_count; in ixgbe_set_ringparam()
1270 for (i = 0; i < adapter->num_rx_queues; i++) in ixgbe_set_ringparam()
1271 adapter->rx_ring[i]->count = new_rx_count; in ixgbe_set_ringparam()
1272 adapter->tx_ring_count = new_tx_count; in ixgbe_set_ringparam()
1273 adapter->xdp_ring_count = new_tx_count; in ixgbe_set_ringparam()
1274 adapter->rx_ring_count = new_rx_count; in ixgbe_set_ringparam()
1279 i = max_t(int, adapter->num_tx_queues + adapter->num_xdp_queues, in ixgbe_set_ringparam()
1280 adapter->num_rx_queues); in ixgbe_set_ringparam()
1284 err = -ENOMEM; in ixgbe_set_ringparam()
1296 if (new_tx_count != adapter->tx_ring_count) { in ixgbe_set_ringparam()
1297 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_set_ringparam()
1298 memcpy(&temp_ring[i], adapter->tx_ring[i], in ixgbe_set_ringparam()
1305 i--; in ixgbe_set_ringparam()
1312 for (j = 0; j < adapter->num_xdp_queues; j++, i++) { in ixgbe_set_ringparam()
1313 memcpy(&temp_ring[i], adapter->xdp_ring[j], in ixgbe_set_ringparam()
1320 i--; in ixgbe_set_ringparam()
1327 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_set_ringparam()
1328 ixgbe_free_tx_resources(adapter->tx_ring[i]); in ixgbe_set_ringparam()
1330 memcpy(adapter->tx_ring[i], &temp_ring[i], in ixgbe_set_ringparam()
1333 for (j = 0; j < adapter->num_xdp_queues; j++, i++) { in ixgbe_set_ringparam()
1334 ixgbe_free_tx_resources(adapter->xdp_ring[j]); in ixgbe_set_ringparam()
1336 memcpy(adapter->xdp_ring[j], &temp_ring[i], in ixgbe_set_ringparam()
1340 adapter->tx_ring_count = new_tx_count; in ixgbe_set_ringparam()
1344 if (new_rx_count != adapter->rx_ring_count) { in ixgbe_set_ringparam()
1345 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_set_ringparam()
1346 memcpy(&temp_ring[i], adapter->rx_ring[i], in ixgbe_set_ringparam()
1349 /* Clear copied XDP RX-queue info */ in ixgbe_set_ringparam()
1357 i--; in ixgbe_set_ringparam()
1365 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_set_ringparam()
1366 ixgbe_free_rx_resources(adapter->rx_ring[i]); in ixgbe_set_ringparam()
1368 memcpy(adapter->rx_ring[i], &temp_ring[i], in ixgbe_set_ringparam()
1372 adapter->rx_ring_count = new_rx_count; in ixgbe_set_ringparam()
1379 clear_bit(__IXGBE_RESETTING, &adapter->state); in ixgbe_set_ringparam()
1393 return -EOPNOTSUPP; in ixgbe_get_sset_count()
1428 for (j = 0; j < netdev->num_tx_queues; j++) { in ixgbe_get_ethtool_stats()
1429 ring = adapter->tx_ring[j]; in ixgbe_get_ethtool_stats()
1438 start = u64_stats_fetch_begin(&ring->syncp); in ixgbe_get_ethtool_stats()
1439 data[i] = ring->stats.packets; in ixgbe_get_ethtool_stats()
1440 data[i+1] = ring->stats.bytes; in ixgbe_get_ethtool_stats()
1441 } while (u64_stats_fetch_retry(&ring->syncp, start)); in ixgbe_get_ethtool_stats()
1445 ring = adapter->rx_ring[j]; in ixgbe_get_ethtool_stats()
1454 start = u64_stats_fetch_begin(&ring->syncp); in ixgbe_get_ethtool_stats()
1455 data[i] = ring->stats.packets; in ixgbe_get_ethtool_stats()
1456 data[i+1] = ring->stats.bytes; in ixgbe_get_ethtool_stats()
1457 } while (u64_stats_fetch_retry(&ring->syncp, start)); in ixgbe_get_ethtool_stats()
1462 data[i++] = adapter->stats.pxontxc[j]; in ixgbe_get_ethtool_stats()
1463 data[i++] = adapter->stats.pxofftxc[j]; in ixgbe_get_ethtool_stats()
1466 data[i++] = adapter->stats.pxonrxc[j]; in ixgbe_get_ethtool_stats()
1467 data[i++] = adapter->stats.pxoffrxc[j]; in ixgbe_get_ethtool_stats()
1485 for (i = 0; i < netdev->num_tx_queues; i++) { in ixgbe_get_strings()
1501 /* BUG_ON(p - data != IXGBE_STATS_LEN * ETH_GSTRING_LEN); */ in ixgbe_get_strings()
1511 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_link_test()
1515 if (ixgbe_removed(hw->hw_addr)) { in ixgbe_link_test()
1521 hw->mac.ops.check_link(hw, &link_speed, &link_up, true); in ixgbe_link_test()
1541 * as a single-element array) and special-case the tables.
1545 * registers to be written without any read-back testing.
1590 /* RDH is read-only for 82598, only test RDT. */
1614 if (ixgbe_removed(adapter->hw.hw_addr)) { in reg_pattern_test()
1619 before = ixgbe_read_reg(&adapter->hw, reg); in reg_pattern_test()
1620 ixgbe_write_reg(&adapter->hw, reg, test_pattern[pat] & write); in reg_pattern_test()
1621 val = ixgbe_read_reg(&adapter->hw, reg); in reg_pattern_test()
1626 ixgbe_write_reg(&adapter->hw, reg, before); in reg_pattern_test()
1629 ixgbe_write_reg(&adapter->hw, reg, before); in reg_pattern_test()
1639 if (ixgbe_removed(adapter->hw.hw_addr)) { in reg_set_and_check()
1643 before = ixgbe_read_reg(&adapter->hw, reg); in reg_set_and_check()
1644 ixgbe_write_reg(&adapter->hw, reg, write & mask); in reg_set_and_check()
1645 val = ixgbe_read_reg(&adapter->hw, reg); in reg_set_and_check()
1650 ixgbe_write_reg(&adapter->hw, reg, before); in reg_set_and_check()
1653 ixgbe_write_reg(&adapter->hw, reg, before); in reg_set_and_check()
1663 if (ixgbe_removed(adapter->hw.hw_addr)) { in ixgbe_reg_test()
1664 e_err(drv, "Adapter removed - register test blocked\n"); in ixgbe_reg_test()
1668 switch (adapter->hw.mac.type) { in ixgbe_reg_test()
1690 * tests. Some bits are read-only, some toggle, and some in ixgbe_reg_test()
1693 before = ixgbe_read_reg(&adapter->hw, IXGBE_STATUS); in ixgbe_reg_test()
1694 value = (ixgbe_read_reg(&adapter->hw, IXGBE_STATUS) & toggle); in ixgbe_reg_test()
1695 ixgbe_write_reg(&adapter->hw, IXGBE_STATUS, toggle); in ixgbe_reg_test()
1696 after = ixgbe_read_reg(&adapter->hw, IXGBE_STATUS) & toggle; in ixgbe_reg_test()
1704 ixgbe_write_reg(&adapter->hw, IXGBE_STATUS, before); in ixgbe_reg_test()
1710 while (test->reg) { in ixgbe_reg_test()
1711 for (i = 0; i < test->array_len; i++) { in ixgbe_reg_test()
1714 switch (test->test_type) { in ixgbe_reg_test()
1717 test->reg + (i * 0x40), in ixgbe_reg_test()
1718 test->mask, in ixgbe_reg_test()
1719 test->write); in ixgbe_reg_test()
1723 test->reg + (i * 0x40), in ixgbe_reg_test()
1724 test->mask, in ixgbe_reg_test()
1725 test->write); in ixgbe_reg_test()
1728 ixgbe_write_reg(&adapter->hw, in ixgbe_reg_test()
1729 test->reg + (i * 0x40), in ixgbe_reg_test()
1730 test->write); in ixgbe_reg_test()
1734 test->reg + (i * 4), in ixgbe_reg_test()
1735 test->mask, in ixgbe_reg_test()
1736 test->write); in ixgbe_reg_test()
1740 test->reg + (i * 8), in ixgbe_reg_test()
1741 test->mask, in ixgbe_reg_test()
1742 test->write); in ixgbe_reg_test()
1746 (test->reg + 4) + (i * 8), in ixgbe_reg_test()
1747 test->mask, in ixgbe_reg_test()
1748 test->write); in ixgbe_reg_test()
1763 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_eeprom_test()
1764 if (hw->eeprom.ops.validate_checksum(hw, NULL)) in ixgbe_eeprom_test()
1776 adapter->test_icr |= IXGBE_READ_REG(&adapter->hw, IXGBE_EICR); in ixgbe_test_intr()
1783 struct net_device *netdev = adapter->netdev; in ixgbe_intr_test()
1785 u32 irq = adapter->pdev->irq; in ixgbe_intr_test()
1790 if (adapter->msix_entries) { in ixgbe_intr_test()
1791 /* NOTE: we don't test MSI-X interrupts here, yet */ in ixgbe_intr_test()
1793 } else if (adapter->flags & IXGBE_FLAG_MSI_ENABLED) { in ixgbe_intr_test()
1795 if (request_irq(irq, ixgbe_test_intr, 0, netdev->name, in ixgbe_intr_test()
1798 return -1; in ixgbe_intr_test()
1801 netdev->name, netdev)) { in ixgbe_intr_test()
1804 netdev->name, netdev)) { in ixgbe_intr_test()
1806 return -1; in ixgbe_intr_test()
1812 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF); in ixgbe_intr_test()
1813 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1829 adapter->test_icr = 0; in ixgbe_intr_test()
1830 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, in ixgbe_intr_test()
1832 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, in ixgbe_intr_test()
1834 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1837 if (adapter->test_icr & mask) { in ixgbe_intr_test()
1849 adapter->test_icr = 0; in ixgbe_intr_test()
1850 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, mask); in ixgbe_intr_test()
1851 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, mask); in ixgbe_intr_test()
1852 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1855 if (!(adapter->test_icr & mask)) { in ixgbe_intr_test()
1868 adapter->test_icr = 0; in ixgbe_intr_test()
1869 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, in ixgbe_intr_test()
1871 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, in ixgbe_intr_test()
1873 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1876 if (adapter->test_icr) { in ixgbe_intr_test()
1884 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF); in ixgbe_intr_test()
1885 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1910 ixgbe_free_tx_resources(&adapter->test_tx_ring); in ixgbe_free_desc_rings()
1911 ixgbe_free_rx_resources(&adapter->test_rx_ring); in ixgbe_free_desc_rings()
1916 struct ixgbe_ring *tx_ring = &adapter->test_tx_ring; in ixgbe_setup_desc_rings()
1917 struct ixgbe_ring *rx_ring = &adapter->test_rx_ring; in ixgbe_setup_desc_rings()
1918 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_desc_rings()
1924 tx_ring->count = IXGBE_DEFAULT_TXD; in ixgbe_setup_desc_rings()
1925 tx_ring->queue_index = 0; in ixgbe_setup_desc_rings()
1926 tx_ring->dev = &adapter->pdev->dev; in ixgbe_setup_desc_rings()
1927 tx_ring->netdev = adapter->netdev; in ixgbe_setup_desc_rings()
1928 tx_ring->reg_idx = adapter->tx_ring[0]->reg_idx; in ixgbe_setup_desc_rings()
1934 switch (adapter->hw.mac.type) { in ixgbe_setup_desc_rings()
1941 reg_data = IXGBE_READ_REG(&adapter->hw, IXGBE_DMATXCTL); in ixgbe_setup_desc_rings()
1943 IXGBE_WRITE_REG(&adapter->hw, IXGBE_DMATXCTL, reg_data); in ixgbe_setup_desc_rings()
1952 rx_ring->count = IXGBE_DEFAULT_RXD; in ixgbe_setup_desc_rings()
1953 rx_ring->queue_index = 0; in ixgbe_setup_desc_rings()
1954 rx_ring->dev = &adapter->pdev->dev; in ixgbe_setup_desc_rings()
1955 rx_ring->netdev = adapter->netdev; in ixgbe_setup_desc_rings()
1956 rx_ring->reg_idx = adapter->rx_ring[0]->reg_idx; in ixgbe_setup_desc_rings()
1964 hw->mac.ops.disable_rx(hw); in ixgbe_setup_desc_rings()
1968 rctl = IXGBE_READ_REG(&adapter->hw, IXGBE_RXCTRL); in ixgbe_setup_desc_rings()
1970 IXGBE_WRITE_REG(&adapter->hw, IXGBE_RXCTRL, rctl); in ixgbe_setup_desc_rings()
1972 hw->mac.ops.enable_rx(hw); in ixgbe_setup_desc_rings()
1983 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_loopback_test()
1997 switch (adapter->hw.mac.type) { in ixgbe_setup_loopback_test()
2008 if (hw->mac.orig_autoc) { in ixgbe_setup_loopback_test()
2009 reg_data = hw->mac.orig_autoc | IXGBE_AUTOC_FLU; in ixgbe_setup_loopback_test()
2018 /* Disable Atlas Tx lanes; re-enabled in reset path */ in ixgbe_setup_loopback_test()
2019 if (hw->mac.type == ixgbe_mac_82598EB) { in ixgbe_setup_loopback_test()
2022 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK, &atlas); in ixgbe_setup_loopback_test()
2024 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK, atlas); in ixgbe_setup_loopback_test()
2026 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_10G, &atlas); in ixgbe_setup_loopback_test()
2028 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_10G, atlas); in ixgbe_setup_loopback_test()
2030 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_1G, &atlas); in ixgbe_setup_loopback_test()
2032 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_1G, atlas); in ixgbe_setup_loopback_test()
2034 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_AN, &atlas); in ixgbe_setup_loopback_test()
2036 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_AN, atlas); in ixgbe_setup_loopback_test()
2046 reg_data = IXGBE_READ_REG(&adapter->hw, IXGBE_HLREG0); in ixgbe_loopback_cleanup()
2048 IXGBE_WRITE_REG(&adapter->hw, IXGBE_HLREG0, reg_data); in ixgbe_loopback_cleanup()
2054 memset(skb->data, 0xFF, frame_size); in ixgbe_create_lbtest_frame()
2056 memset(&skb->data[frame_size], 0xAA, frame_size / 2 - 1); in ixgbe_create_lbtest_frame()
2057 skb->data[frame_size + 10] = 0xBE; in ixgbe_create_lbtest_frame()
2058 skb->data[frame_size + 12] = 0xAF; in ixgbe_create_lbtest_frame()
2068 data = page_address(rx_buffer->page) + rx_buffer->page_offset; in ixgbe_check_lbtest_frame()
2082 rx_ntc = rx_ring->next_to_clean; in ixgbe_clean_test_rings()
2083 tx_ntc = tx_ring->next_to_clean; in ixgbe_clean_test_rings()
2086 while (tx_ntc != tx_ring->next_to_use) { in ixgbe_clean_test_rings()
2093 if (!(tx_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD))) in ixgbe_clean_test_rings()
2097 tx_buffer = &tx_ring->tx_buffer_info[tx_ntc]; in ixgbe_clean_test_rings()
2100 dev_kfree_skb_any(tx_buffer->skb); in ixgbe_clean_test_rings()
2103 dma_unmap_single(tx_ring->dev, in ixgbe_clean_test_rings()
2111 if (tx_ntc == tx_ring->count) in ixgbe_clean_test_rings()
2115 while (rx_desc->wb.upper.length) { in ixgbe_clean_test_rings()
2119 rx_buffer = &rx_ring->rx_buffer_info[rx_ntc]; in ixgbe_clean_test_rings()
2122 dma_sync_single_for_cpu(rx_ring->dev, in ixgbe_clean_test_rings()
2123 rx_buffer->dma, in ixgbe_clean_test_rings()
2134 dma_sync_single_for_device(rx_ring->dev, in ixgbe_clean_test_rings()
2135 rx_buffer->dma, in ixgbe_clean_test_rings()
2141 if (rx_ntc == rx_ring->count) in ixgbe_clean_test_rings()
2150 /* re-map buffers to ring, store next to clean values */ in ixgbe_clean_test_rings()
2152 rx_ring->next_to_clean = rx_ntc; in ixgbe_clean_test_rings()
2153 tx_ring->next_to_clean = tx_ntc; in ixgbe_clean_test_rings()
2160 struct ixgbe_ring *tx_ring = &adapter->test_tx_ring; in ixgbe_run_loopback_test()
2161 struct ixgbe_ring *rx_ring = &adapter->test_rx_ring; in ixgbe_run_loopback_test()
2166 u32 flags_orig = adapter->flags; in ixgbe_run_loopback_test()
2169 adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; in ixgbe_run_loopback_test()
2186 if (rx_ring->count <= tx_ring->count) in ixgbe_run_loopback_test()
2187 lc = ((tx_ring->count / 64) * 2) + 1; in ixgbe_run_loopback_test()
2189 lc = ((rx_ring->count / 64) * 2) + 1; in ixgbe_run_loopback_test()
2222 adapter->flags = flags_orig; in ixgbe_run_loopback_test()
2250 if (ixgbe_removed(adapter->hw.hw_addr)) { in ixgbe_diag_test()
2251 e_err(hw, "Adapter removed - test blocked\n"); in ixgbe_diag_test()
2257 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2260 set_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2261 if (eth_test->flags == ETH_TEST_FL_OFFLINE) { in ixgbe_diag_test()
2262 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_diag_test()
2264 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { in ixgbe_diag_test()
2266 for (i = 0; i < adapter->num_vfs; i++) { in ixgbe_diag_test()
2267 if (adapter->vfinfo[i].clear_to_send) { in ixgbe_diag_test()
2274 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2276 &adapter->state); in ixgbe_diag_test()
2289 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2299 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2304 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2309 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2313 if (adapter->flags & (IXGBE_FLAG_SRIOV_ENABLED | in ixgbe_diag_test()
2323 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2329 clear_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2332 else if (hw->mac.ops.disable_tx_laser) in ixgbe_diag_test()
2333 hw->mac.ops.disable_tx_laser(hw); in ixgbe_diag_test()
2339 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2347 clear_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2354 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_wol_exclusion()
2358 if (!ixgbe_wol_supported(adapter, hw->device_id, in ixgbe_wol_exclusion()
2359 hw->subsystem_device_id)) { in ixgbe_wol_exclusion()
2361 wol->supported = 0; in ixgbe_wol_exclusion()
2372 wol->supported = WAKE_UCAST | WAKE_MCAST | in ixgbe_get_wol()
2374 wol->wolopts = 0; in ixgbe_get_wol()
2377 !device_can_wakeup(&adapter->pdev->dev)) in ixgbe_get_wol()
2380 if (adapter->wol & IXGBE_WUFC_EX) in ixgbe_get_wol()
2381 wol->wolopts |= WAKE_UCAST; in ixgbe_get_wol()
2382 if (adapter->wol & IXGBE_WUFC_MC) in ixgbe_get_wol()
2383 wol->wolopts |= WAKE_MCAST; in ixgbe_get_wol()
2384 if (adapter->wol & IXGBE_WUFC_BC) in ixgbe_get_wol()
2385 wol->wolopts |= WAKE_BCAST; in ixgbe_get_wol()
2386 if (adapter->wol & IXGBE_WUFC_MAG) in ixgbe_get_wol()
2387 wol->wolopts |= WAKE_MAGIC; in ixgbe_get_wol()
2394 if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE | in ixgbe_set_wol()
2396 return -EOPNOTSUPP; in ixgbe_set_wol()
2399 return wol->wolopts ? -EOPNOTSUPP : 0; in ixgbe_set_wol()
2401 adapter->wol = 0; in ixgbe_set_wol()
2403 if (wol->wolopts & WAKE_UCAST) in ixgbe_set_wol()
2404 adapter->wol |= IXGBE_WUFC_EX; in ixgbe_set_wol()
2405 if (wol->wolopts & WAKE_MCAST) in ixgbe_set_wol()
2406 adapter->wol |= IXGBE_WUFC_MC; in ixgbe_set_wol()
2407 if (wol->wolopts & WAKE_BCAST) in ixgbe_set_wol()
2408 adapter->wol |= IXGBE_WUFC_BC; in ixgbe_set_wol()
2409 if (wol->wolopts & WAKE_MAGIC) in ixgbe_set_wol()
2410 adapter->wol |= IXGBE_WUFC_MAG; in ixgbe_set_wol()
2412 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); in ixgbe_set_wol()
2421 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_wol_acpi()
2425 return wol->wolopts ? -EOPNOTSUPP : 0; in ixgbe_set_wol_acpi()
2434 adapter->wol = 0; in ixgbe_set_wol_acpi()
2436 if (wol->wolopts & WAKE_UCAST) in ixgbe_set_wol_acpi()
2437 adapter->wol |= IXGBE_WUFC_EX; in ixgbe_set_wol_acpi()
2438 if (wol->wolopts & WAKE_MCAST) in ixgbe_set_wol_acpi()
2439 adapter->wol |= IXGBE_WUFC_MC; in ixgbe_set_wol_acpi()
2440 if (wol->wolopts & WAKE_BCAST) in ixgbe_set_wol_acpi()
2441 adapter->wol |= IXGBE_WUFC_BC; in ixgbe_set_wol_acpi()
2444 IXGBE_WRITE_REG(hw, IXGBE_WUFC, adapter->wol); in ixgbe_set_wol_acpi()
2446 hw->wol_enabled = adapter->wol; in ixgbe_set_wol_acpi()
2447 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); in ixgbe_set_wol_acpi()
2455 if (wol->wolopts & (WAKE_UCAST | WAKE_MCAST | WAKE_BCAST)) in ixgbe_set_wol_e610()
2475 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_phys_id()
2477 if (!hw->mac.ops.led_on || !hw->mac.ops.led_off) in ixgbe_set_phys_id()
2478 return -EOPNOTSUPP; in ixgbe_set_phys_id()
2482 adapter->led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); in ixgbe_set_phys_id()
2486 hw->mac.ops.led_on(hw, hw->mac.led_link_act); in ixgbe_set_phys_id()
2490 hw->mac.ops.led_off(hw, hw->mac.led_link_act); in ixgbe_set_phys_id()
2495 IXGBE_WRITE_REG(&adapter->hw, IXGBE_LEDCTL, adapter->led_reg); in ixgbe_set_phys_id()
2516 return -EOPNOTSUPP; in ixgbe_set_phys_id_e610()
2519 return ixgbe_aci_set_port_id_led(&adapter->hw, !led_active); in ixgbe_set_phys_id_e610()
2530 if (adapter->rx_itr_setting <= 1) in ixgbe_get_coalesce()
2531 ec->rx_coalesce_usecs = adapter->rx_itr_setting; in ixgbe_get_coalesce()
2533 ec->rx_coalesce_usecs = adapter->rx_itr_setting >> 2; in ixgbe_get_coalesce()
2536 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) in ixgbe_get_coalesce()
2540 if (adapter->tx_itr_setting <= 1) in ixgbe_get_coalesce()
2541 ec->tx_coalesce_usecs = adapter->tx_itr_setting; in ixgbe_get_coalesce()
2543 ec->tx_coalesce_usecs = adapter->tx_itr_setting >> 2; in ixgbe_get_coalesce()
2554 struct net_device *netdev = adapter->netdev; in ixgbe_update_rsc()
2557 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) || in ixgbe_update_rsc()
2558 !(netdev->features & NETIF_F_LRO)) in ixgbe_update_rsc()
2562 if (adapter->rx_itr_setting == 1 || in ixgbe_update_rsc()
2563 adapter->rx_itr_setting > IXGBE_MIN_RSC_ITR) { in ixgbe_update_rsc()
2564 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)) { in ixgbe_update_rsc()
2565 adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED; in ixgbe_update_rsc()
2566 e_info(probe, "rx-usecs value high enough to re-enable RSC\n"); in ixgbe_update_rsc()
2570 } else if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { in ixgbe_update_rsc()
2571 adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED; in ixgbe_update_rsc()
2572 e_info(probe, "rx-usecs set too low, disabling RSC\n"); in ixgbe_update_rsc()
2589 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) { in ixgbe_set_coalesce()
2591 if (ec->tx_coalesce_usecs) in ixgbe_set_coalesce()
2592 return -EINVAL; in ixgbe_set_coalesce()
2593 tx_itr_prev = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2595 tx_itr_prev = adapter->tx_itr_setting; in ixgbe_set_coalesce()
2598 if ((ec->rx_coalesce_usecs > (IXGBE_MAX_EITR >> 2)) || in ixgbe_set_coalesce()
2599 (ec->tx_coalesce_usecs > (IXGBE_MAX_EITR >> 2))) in ixgbe_set_coalesce()
2600 return -EINVAL; in ixgbe_set_coalesce()
2602 if (ec->rx_coalesce_usecs > 1) in ixgbe_set_coalesce()
2603 adapter->rx_itr_setting = ec->rx_coalesce_usecs << 2; in ixgbe_set_coalesce()
2605 adapter->rx_itr_setting = ec->rx_coalesce_usecs; in ixgbe_set_coalesce()
2607 if (adapter->rx_itr_setting == 1) in ixgbe_set_coalesce()
2610 rx_itr_param = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2612 if (ec->tx_coalesce_usecs > 1) in ixgbe_set_coalesce()
2613 adapter->tx_itr_setting = ec->tx_coalesce_usecs << 2; in ixgbe_set_coalesce()
2615 adapter->tx_itr_setting = ec->tx_coalesce_usecs; in ixgbe_set_coalesce()
2617 if (adapter->tx_itr_setting == 1) in ixgbe_set_coalesce()
2620 tx_itr_param = adapter->tx_itr_setting; in ixgbe_set_coalesce()
2623 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) in ixgbe_set_coalesce()
2624 adapter->tx_itr_setting = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2627 if ((adapter->tx_itr_setting != 1) && in ixgbe_set_coalesce()
2628 (adapter->tx_itr_setting < IXGBE_100K_ITR)) { in ixgbe_set_coalesce()
2641 for (i = 0; i < adapter->num_q_vectors; i++) { in ixgbe_set_coalesce()
2642 q_vector = adapter->q_vector[i]; in ixgbe_set_coalesce()
2643 if (q_vector->tx.count && !q_vector->rx.count) in ixgbe_set_coalesce()
2645 q_vector->itr = tx_itr_param; in ixgbe_set_coalesce()
2648 q_vector->itr = rx_itr_param; in ixgbe_set_coalesce()
2666 union ixgbe_atr_input *mask = &adapter->fdir_mask; in ixgbe_get_ethtool_fdir_entry()
2668 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_get_ethtool_fdir_entry()
2673 cmd->data = (1024 << adapter->fdir_pballoc) - 2; in ixgbe_get_ethtool_fdir_entry()
2676 &adapter->fdir_filter_list, fdir_node) { in ixgbe_get_ethtool_fdir_entry()
2677 if (fsp->location <= rule->sw_idx) in ixgbe_get_ethtool_fdir_entry()
2681 if (!rule || fsp->location != rule->sw_idx) in ixgbe_get_ethtool_fdir_entry()
2682 return -EINVAL; in ixgbe_get_ethtool_fdir_entry()
2687 switch (rule->filter.formatted.flow_type) { in ixgbe_get_ethtool_fdir_entry()
2689 fsp->flow_type = TCP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2692 fsp->flow_type = UDP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2695 fsp->flow_type = SCTP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2698 fsp->flow_type = IP_USER_FLOW; in ixgbe_get_ethtool_fdir_entry()
2699 fsp->h_u.usr_ip4_spec.ip_ver = ETH_RX_NFC_IP4; in ixgbe_get_ethtool_fdir_entry()
2700 fsp->h_u.usr_ip4_spec.proto = 0; in ixgbe_get_ethtool_fdir_entry()
2701 fsp->m_u.usr_ip4_spec.proto = 0; in ixgbe_get_ethtool_fdir_entry()
2704 return -EINVAL; in ixgbe_get_ethtool_fdir_entry()
2707 fsp->h_u.tcp_ip4_spec.psrc = rule->filter.formatted.src_port; in ixgbe_get_ethtool_fdir_entry()
2708 fsp->m_u.tcp_ip4_spec.psrc = mask->formatted.src_port; in ixgbe_get_ethtool_fdir_entry()
2709 fsp->h_u.tcp_ip4_spec.pdst = rule->filter.formatted.dst_port; in ixgbe_get_ethtool_fdir_entry()
2710 fsp->m_u.tcp_ip4_spec.pdst = mask->formatted.dst_port; in ixgbe_get_ethtool_fdir_entry()
2711 fsp->h_u.tcp_ip4_spec.ip4src = rule->filter.formatted.src_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2712 fsp->m_u.tcp_ip4_spec.ip4src = mask->formatted.src_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2713 fsp->h_u.tcp_ip4_spec.ip4dst = rule->filter.formatted.dst_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2714 fsp->m_u.tcp_ip4_spec.ip4dst = mask->formatted.dst_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2715 fsp->h_ext.vlan_tci = rule->filter.formatted.vlan_id; in ixgbe_get_ethtool_fdir_entry()
2716 fsp->m_ext.vlan_tci = mask->formatted.vlan_id; in ixgbe_get_ethtool_fdir_entry()
2717 fsp->h_ext.vlan_etype = rule->filter.formatted.flex_bytes; in ixgbe_get_ethtool_fdir_entry()
2718 fsp->m_ext.vlan_etype = mask->formatted.flex_bytes; in ixgbe_get_ethtool_fdir_entry()
2719 fsp->h_ext.data[1] = htonl(rule->filter.formatted.vm_pool); in ixgbe_get_ethtool_fdir_entry()
2720 fsp->m_ext.data[1] = htonl(mask->formatted.vm_pool); in ixgbe_get_ethtool_fdir_entry()
2721 fsp->flow_type |= FLOW_EXT; in ixgbe_get_ethtool_fdir_entry()
2724 if (rule->action == IXGBE_FDIR_DROP_QUEUE) in ixgbe_get_ethtool_fdir_entry()
2725 fsp->ring_cookie = RX_CLS_FLOW_DISC; in ixgbe_get_ethtool_fdir_entry()
2727 fsp->ring_cookie = rule->action; in ixgbe_get_ethtool_fdir_entry()
2741 cmd->data = (1024 << adapter->fdir_pballoc) - 2; in ixgbe_get_ethtool_fdir_all()
2744 &adapter->fdir_filter_list, fdir_node) { in ixgbe_get_ethtool_fdir_all()
2745 if (cnt == cmd->rule_cnt) in ixgbe_get_ethtool_fdir_all()
2746 return -EMSGSIZE; in ixgbe_get_ethtool_fdir_all()
2747 rule_locs[cnt] = rule->sw_idx; in ixgbe_get_ethtool_fdir_all()
2751 cmd->rule_cnt = cnt; in ixgbe_get_ethtool_fdir_all()
2761 cmd->data = 0; in ixgbe_get_rxfh_fields()
2764 switch (cmd->flow_type) { in ixgbe_get_rxfh_fields()
2766 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rxfh_fields()
2769 if (adapter->flags2 & IXGBE_FLAG2_RSS_FIELD_IPV4_UDP) in ixgbe_get_rxfh_fields()
2770 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rxfh_fields()
2777 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in ixgbe_get_rxfh_fields()
2780 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rxfh_fields()
2783 if (adapter->flags2 & IXGBE_FLAG2_RSS_FIELD_IPV6_UDP) in ixgbe_get_rxfh_fields()
2784 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rxfh_fields()
2791 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in ixgbe_get_rxfh_fields()
2794 return -EINVAL; in ixgbe_get_rxfh_fields()
2802 if (adapter->hw.mac.type < ixgbe_mac_X550) in ixgbe_rss_indir_tbl_max()
2812 int ret = -EOPNOTSUPP; in ixgbe_get_rxnfc()
2814 switch (cmd->cmd) { in ixgbe_get_rxnfc()
2816 cmd->data = min_t(int, adapter->num_rx_queues, in ixgbe_get_rxnfc()
2821 cmd->rule_cnt = adapter->fdir_filter_count; in ixgbe_get_rxnfc()
2841 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_update_ethtool_fdir_entry()
2844 int err = -EINVAL; in ixgbe_update_ethtool_fdir_entry()
2850 &adapter->fdir_filter_list, fdir_node) { in ixgbe_update_ethtool_fdir_entry()
2852 if (rule->sw_idx >= sw_idx) in ixgbe_update_ethtool_fdir_entry()
2858 if (rule && (rule->sw_idx == sw_idx)) { in ixgbe_update_ethtool_fdir_entry()
2859 if (!input || (rule->filter.formatted.bkt_hash != in ixgbe_update_ethtool_fdir_entry()
2860 input->filter.formatted.bkt_hash)) { in ixgbe_update_ethtool_fdir_entry()
2862 &rule->filter, in ixgbe_update_ethtool_fdir_entry()
2866 hlist_del(&rule->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2868 adapter->fdir_filter_count--; in ixgbe_update_ethtool_fdir_entry()
2873 * successfully found and removed from the list else -EINVAL in ixgbe_update_ethtool_fdir_entry()
2879 INIT_HLIST_NODE(&input->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2883 hlist_add_behind(&input->fdir_node, &parent->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2885 hlist_add_head(&input->fdir_node, in ixgbe_update_ethtool_fdir_entry()
2886 &adapter->fdir_filter_list); in ixgbe_update_ethtool_fdir_entry()
2889 adapter->fdir_filter_count++; in ixgbe_update_ethtool_fdir_entry()
2897 switch (fsp->flow_type & ~FLOW_EXT) { in ixgbe_flowspec_to_flow_type()
2908 switch (fsp->h_u.usr_ip4_spec.proto) { in ixgbe_flowspec_to_flow_type()
2919 if (!fsp->m_u.usr_ip4_spec.proto) { in ixgbe_flowspec_to_flow_type()
2939 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_add_ethtool_fdir_entry()
2940 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_add_ethtool_fdir_entry()
2946 if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) in ixgbe_add_ethtool_fdir_entry()
2947 return -EOPNOTSUPP; in ixgbe_add_ethtool_fdir_entry()
2952 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) { in ixgbe_add_ethtool_fdir_entry()
2955 u32 ring = ethtool_get_flow_spec_ring(fsp->ring_cookie); in ixgbe_add_ethtool_fdir_entry()
2956 u8 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie); in ixgbe_add_ethtool_fdir_entry()
2958 if (!vf && (ring >= adapter->num_rx_queues)) in ixgbe_add_ethtool_fdir_entry()
2959 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2961 ((vf > adapter->num_vfs) || in ixgbe_add_ethtool_fdir_entry()
2962 ring >= adapter->num_rx_queues_per_pool)) in ixgbe_add_ethtool_fdir_entry()
2963 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2967 queue = adapter->rx_ring[ring]->reg_idx; in ixgbe_add_ethtool_fdir_entry()
2969 queue = ((vf - 1) * in ixgbe_add_ethtool_fdir_entry()
2970 adapter->num_rx_queues_per_pool) + ring; in ixgbe_add_ethtool_fdir_entry()
2974 if (fsp->location >= ((1024 << adapter->fdir_pballoc) - 2)) { in ixgbe_add_ethtool_fdir_entry()
2976 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2981 return -ENOMEM; in ixgbe_add_ethtool_fdir_entry()
2986 input->sw_idx = fsp->location; in ixgbe_add_ethtool_fdir_entry()
2990 &input->filter.formatted.flow_type)) { in ixgbe_add_ethtool_fdir_entry()
2998 if (input->filter.formatted.flow_type == IXGBE_ATR_FLOW_TYPE_IPV4) in ixgbe_add_ethtool_fdir_entry()
3002 input->filter.formatted.src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src; in ixgbe_add_ethtool_fdir_entry()
3003 mask.formatted.src_ip[0] = fsp->m_u.tcp_ip4_spec.ip4src; in ixgbe_add_ethtool_fdir_entry()
3004 input->filter.formatted.dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst; in ixgbe_add_ethtool_fdir_entry()
3005 mask.formatted.dst_ip[0] = fsp->m_u.tcp_ip4_spec.ip4dst; in ixgbe_add_ethtool_fdir_entry()
3006 input->filter.formatted.src_port = fsp->h_u.tcp_ip4_spec.psrc; in ixgbe_add_ethtool_fdir_entry()
3007 mask.formatted.src_port = fsp->m_u.tcp_ip4_spec.psrc; in ixgbe_add_ethtool_fdir_entry()
3008 input->filter.formatted.dst_port = fsp->h_u.tcp_ip4_spec.pdst; in ixgbe_add_ethtool_fdir_entry()
3009 mask.formatted.dst_port = fsp->m_u.tcp_ip4_spec.pdst; in ixgbe_add_ethtool_fdir_entry()
3011 if (fsp->flow_type & FLOW_EXT) { in ixgbe_add_ethtool_fdir_entry()
3012 input->filter.formatted.vm_pool = in ixgbe_add_ethtool_fdir_entry()
3013 (unsigned char)ntohl(fsp->h_ext.data[1]); in ixgbe_add_ethtool_fdir_entry()
3015 (unsigned char)ntohl(fsp->m_ext.data[1]); in ixgbe_add_ethtool_fdir_entry()
3016 input->filter.formatted.vlan_id = fsp->h_ext.vlan_tci; in ixgbe_add_ethtool_fdir_entry()
3017 mask.formatted.vlan_id = fsp->m_ext.vlan_tci; in ixgbe_add_ethtool_fdir_entry()
3018 input->filter.formatted.flex_bytes = in ixgbe_add_ethtool_fdir_entry()
3019 fsp->h_ext.vlan_etype; in ixgbe_add_ethtool_fdir_entry()
3020 mask.formatted.flex_bytes = fsp->m_ext.vlan_etype; in ixgbe_add_ethtool_fdir_entry()
3024 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) in ixgbe_add_ethtool_fdir_entry()
3025 input->action = IXGBE_FDIR_DROP_QUEUE; in ixgbe_add_ethtool_fdir_entry()
3027 input->action = fsp->ring_cookie; in ixgbe_add_ethtool_fdir_entry()
3029 spin_lock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
3031 if (hlist_empty(&adapter->fdir_filter_list)) { in ixgbe_add_ethtool_fdir_entry()
3033 memcpy(&adapter->fdir_mask, &mask, sizeof(mask)); in ixgbe_add_ethtool_fdir_entry()
3039 } else if (memcmp(&adapter->fdir_mask, &mask, sizeof(mask))) { in ixgbe_add_ethtool_fdir_entry()
3045 ixgbe_atr_compute_perfect_hash_82599(&input->filter, &mask); in ixgbe_add_ethtool_fdir_entry()
3049 &input->filter, input->sw_idx, queue); in ixgbe_add_ethtool_fdir_entry()
3053 ixgbe_update_ethtool_fdir_entry(adapter, input, input->sw_idx); in ixgbe_add_ethtool_fdir_entry()
3055 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
3059 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
3062 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
3069 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_del_ethtool_fdir_entry()
3072 spin_lock(&adapter->fdir_perfect_lock); in ixgbe_del_ethtool_fdir_entry()
3073 err = ixgbe_update_ethtool_fdir_entry(adapter, NULL, fsp->location); in ixgbe_del_ethtool_fdir_entry()
3074 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_del_ethtool_fdir_entry()
3086 u32 flags2 = adapter->flags2; in ixgbe_set_rxfh_fields()
3092 if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST | in ixgbe_set_rxfh_fields()
3094 return -EINVAL; in ixgbe_set_rxfh_fields()
3096 switch (nfc->flow_type) { in ixgbe_set_rxfh_fields()
3099 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rxfh_fields()
3100 !(nfc->data & RXH_IP_DST) || in ixgbe_set_rxfh_fields()
3101 !(nfc->data & RXH_L4_B_0_1) || in ixgbe_set_rxfh_fields()
3102 !(nfc->data & RXH_L4_B_2_3)) in ixgbe_set_rxfh_fields()
3103 return -EINVAL; in ixgbe_set_rxfh_fields()
3106 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rxfh_fields()
3107 !(nfc->data & RXH_IP_DST)) in ixgbe_set_rxfh_fields()
3108 return -EINVAL; in ixgbe_set_rxfh_fields()
3109 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in ixgbe_set_rxfh_fields()
3117 return -EINVAL; in ixgbe_set_rxfh_fields()
3121 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rxfh_fields()
3122 !(nfc->data & RXH_IP_DST)) in ixgbe_set_rxfh_fields()
3123 return -EINVAL; in ixgbe_set_rxfh_fields()
3124 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in ixgbe_set_rxfh_fields()
3132 return -EINVAL; in ixgbe_set_rxfh_fields()
3143 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rxfh_fields()
3144 !(nfc->data & RXH_IP_DST) || in ixgbe_set_rxfh_fields()
3145 (nfc->data & RXH_L4_B_0_1) || in ixgbe_set_rxfh_fields()
3146 (nfc->data & RXH_L4_B_2_3)) in ixgbe_set_rxfh_fields()
3147 return -EINVAL; in ixgbe_set_rxfh_fields()
3150 return -EINVAL; in ixgbe_set_rxfh_fields()
3154 if (flags2 != adapter->flags2) { in ixgbe_set_rxfh_fields()
3155 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_rxfh_fields()
3157 unsigned int pf_pool = adapter->num_vfs; in ixgbe_set_rxfh_fields()
3159 if ((hw->mac.type >= ixgbe_mac_X550) && in ixgbe_set_rxfh_fields()
3160 (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_set_rxfh_fields()
3166 !(adapter->flags2 & UDP_RSS_FLAGS)) in ixgbe_set_rxfh_fields()
3169 adapter->flags2 = flags2; in ixgbe_set_rxfh_fields()
3186 if ((hw->mac.type >= ixgbe_mac_X550) && in ixgbe_set_rxfh_fields()
3187 (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_set_rxfh_fields()
3199 int ret = -EOPNOTSUPP; in ixgbe_set_rxnfc()
3201 switch (cmd->cmd) { in ixgbe_set_rxnfc()
3230 u16 rss_m = adapter->ring_feature[RING_F_RSS].mask; in ixgbe_get_reta()
3232 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_get_reta()
3233 rss_m = adapter->ring_feature[RING_F_RSS].indices - 1; in ixgbe_get_reta()
3236 indir[i] = adapter->rss_indir_tbl[i] & rss_m; in ixgbe_get_reta()
3244 rxfh->hfunc = ETH_RSS_HASH_TOP; in ixgbe_get_rxfh()
3246 if (rxfh->indir) in ixgbe_get_rxfh()
3247 ixgbe_get_reta(adapter, rxfh->indir); in ixgbe_get_rxfh()
3249 if (rxfh->key) in ixgbe_get_rxfh()
3250 memcpy(rxfh->key, adapter->rss_key, in ixgbe_get_rxfh()
3264 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in ixgbe_set_rxfh()
3265 rxfh->hfunc != ETH_RSS_HASH_TOP) in ixgbe_set_rxfh()
3266 return -EOPNOTSUPP; in ixgbe_set_rxfh()
3269 if (rxfh->indir) { in ixgbe_set_rxfh()
3270 int max_queues = min_t(int, adapter->num_rx_queues, in ixgbe_set_rxfh()
3273 /*Allow at least 2 queues w/ SR-IOV.*/ in ixgbe_set_rxfh()
3274 if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) && in ixgbe_set_rxfh()
3280 if (rxfh->indir[i] >= max_queues) in ixgbe_set_rxfh()
3281 return -EINVAL; in ixgbe_set_rxfh()
3284 adapter->rss_indir_tbl[i] = rxfh->indir[i]; in ixgbe_set_rxfh()
3290 if (rxfh->key) { in ixgbe_set_rxfh()
3291 memcpy(adapter->rss_key, rxfh->key, in ixgbe_set_rxfh()
3305 info->rx_filters = BIT(HWTSTAMP_FILTER_NONE); in ixgbe_get_ts_info()
3307 switch (adapter->hw.mac.type) { in ixgbe_get_ts_info()
3312 info->rx_filters |= BIT(HWTSTAMP_FILTER_ALL); in ixgbe_get_ts_info()
3316 info->rx_filters |= in ixgbe_get_ts_info()
3325 info->so_timestamping = in ixgbe_get_ts_info()
3331 if (adapter->ptp_clock) in ixgbe_get_ts_info()
3332 info->phc_index = ptp_clock_index(adapter->ptp_clock); in ixgbe_get_ts_info()
3334 info->tx_types = in ixgbe_get_ts_info()
3344 u8 tcs = adapter->hw_tcs; in ixgbe_max_channels()
3346 if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { in ixgbe_max_channels()
3347 /* We only support one q_vector without MSI-X */ in ixgbe_max_channels()
3349 } else if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { in ixgbe_max_channels()
3351 max_combined = adapter->ring_feature[RING_F_RSS].mask + 1; in ixgbe_max_channels()
3354 if (adapter->hw.mac.type == ixgbe_mac_82598EB) { in ixgbe_max_channels()
3364 } else if (adapter->atr_sample_rate) { in ixgbe_max_channels()
3365 /* support up to 64 queues with ATR */ in ixgbe_max_channels()
3381 ch->max_combined = ixgbe_max_channels(adapter); in ixgbe_get_channels()
3384 if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { in ixgbe_get_channels()
3385 ch->max_other = NON_Q_VECTORS; in ixgbe_get_channels()
3386 ch->other_count = NON_Q_VECTORS; in ixgbe_get_channels()
3390 ch->combined_count = adapter->ring_feature[RING_F_RSS].indices; in ixgbe_get_channels()
3393 if (ch->combined_count == 1) in ixgbe_get_channels()
3396 /* we do not support ATR queueing if SR-IOV is enabled */ in ixgbe_get_channels()
3397 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_get_channels()
3401 if (adapter->hw_tcs > 1) in ixgbe_get_channels()
3404 /* if ATR is disabled we can exit */ in ixgbe_get_channels()
3405 if (!adapter->atr_sample_rate) in ixgbe_get_channels()
3409 ch->combined_count = adapter->ring_feature[RING_F_FDIR].indices; in ixgbe_get_channels()
3416 unsigned int count = ch->combined_count; in ixgbe_set_channels()
3420 if (!count || ch->rx_count || ch->tx_count) in ixgbe_set_channels()
3421 return -EINVAL; in ixgbe_set_channels()
3424 if (ch->other_count != NON_Q_VECTORS) in ixgbe_set_channels()
3425 return -EINVAL; in ixgbe_set_channels()
3429 return -EINVAL; in ixgbe_set_channels()
3432 adapter->ring_feature[RING_F_FDIR].limit = count; in ixgbe_set_channels()
3437 adapter->ring_feature[RING_F_RSS].limit = count; in ixgbe_set_channels()
3443 adapter->ring_feature[RING_F_FCOE].limit = count; in ixgbe_set_channels()
3447 return ixgbe_setup_tc(dev, adapter->hw_tcs); in ixgbe_set_channels()
3454 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_module_info()
3459 if (hw->phy.type == ixgbe_phy_fw) in ixgbe_get_module_info()
3460 return -ENXIO; in ixgbe_get_module_info()
3462 /* Check whether we support SFF-8472 or not */ in ixgbe_get_module_info()
3463 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_get_module_info()
3467 return -EIO; in ixgbe_get_module_info()
3470 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_get_module_info()
3474 return -EIO; in ixgbe_get_module_info()
3483 /* We have a SFP, but it does not support SFF-8472 */ in ixgbe_get_module_info()
3484 modinfo->type = ETH_MODULE_SFF_8079; in ixgbe_get_module_info()
3485 modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN; in ixgbe_get_module_info()
3487 /* We have a SFP which supports a revision of SFF-8472. */ in ixgbe_get_module_info()
3488 modinfo->type = ETH_MODULE_SFF_8472; in ixgbe_get_module_info()
3489 modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; in ixgbe_get_module_info()
3500 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_module_eeprom()
3501 int status = -EFAULT; in ixgbe_get_module_eeprom()
3505 if (ee->len == 0) in ixgbe_get_module_eeprom()
3506 return -EINVAL; in ixgbe_get_module_eeprom()
3508 if (hw->phy.type == ixgbe_phy_fw) in ixgbe_get_module_eeprom()
3509 return -ENXIO; in ixgbe_get_module_eeprom()
3511 for (i = ee->offset; i < ee->offset + ee->len; i++) { in ixgbe_get_module_eeprom()
3512 /* I2C reads can take long time */ in ixgbe_get_module_eeprom()
3513 if (test_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) in ixgbe_get_module_eeprom()
3514 return -EBUSY; in ixgbe_get_module_eeprom()
3517 status = hw->phy.ops.read_i2c_eeprom(hw, i, &databyte); in ixgbe_get_module_eeprom()
3519 status = hw->phy.ops.read_i2c_sff8472(hw, i, &databyte); in ixgbe_get_module_eeprom()
3522 return -EIO; in ixgbe_get_module_eeprom()
3524 data[i - ee->offset] = databyte; in ixgbe_get_module_eeprom()
3558 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eee_fw()
3569 edata->lp_advertised); in ixgbe_get_eee_fw()
3573 if (hw->phy.eee_speeds_supported & ixgbe_ls_map[i].mac_speed) in ixgbe_get_eee_fw()
3575 edata->supported); in ixgbe_get_eee_fw()
3579 if (hw->phy.eee_speeds_advertised & ixgbe_ls_map[i].mac_speed) in ixgbe_get_eee_fw()
3581 edata->advertised); in ixgbe_get_eee_fw()
3584 edata->eee_enabled = !linkmode_empty(edata->advertised); in ixgbe_get_eee_fw()
3585 edata->tx_lpi_enabled = edata->eee_enabled; in ixgbe_get_eee_fw()
3587 linkmode_and(common, edata->advertised, edata->lp_advertised); in ixgbe_get_eee_fw()
3588 edata->eee_active = !linkmode_empty(common); in ixgbe_get_eee_fw()
3596 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eee()
3598 if (!(adapter->flags2 & IXGBE_FLAG2_EEE_CAPABLE)) in ixgbe_get_eee()
3599 return -EOPNOTSUPP; in ixgbe_get_eee()
3601 if (hw->phy.eee_speeds_supported && hw->phy.type == ixgbe_phy_fw) in ixgbe_get_eee()
3604 return -EOPNOTSUPP; in ixgbe_get_eee()
3610 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_eee()
3614 if (!(adapter->flags2 & IXGBE_FLAG2_EEE_CAPABLE)) in ixgbe_set_eee()
3615 return -EOPNOTSUPP; in ixgbe_set_eee()
3623 if (eee_data.eee_enabled && !edata->eee_enabled) { in ixgbe_set_eee()
3624 if (eee_data.tx_lpi_enabled != edata->tx_lpi_enabled) { in ixgbe_set_eee()
3625 e_err(drv, "Setting EEE tx-lpi is not supported\n"); in ixgbe_set_eee()
3626 return -EINVAL; in ixgbe_set_eee()
3629 if (eee_data.tx_lpi_timer != edata->tx_lpi_timer) { in ixgbe_set_eee()
3632 return -EINVAL; in ixgbe_set_eee()
3635 if (!linkmode_equal(eee_data.advertised, edata->advertised)) { in ixgbe_set_eee()
3638 return -EINVAL; in ixgbe_set_eee()
3642 if (eee_data.eee_enabled != edata->eee_enabled) { in ixgbe_set_eee()
3643 if (edata->eee_enabled) { in ixgbe_set_eee()
3644 adapter->flags2 |= IXGBE_FLAG2_EEE_ENABLED; in ixgbe_set_eee()
3645 hw->phy.eee_speeds_advertised = in ixgbe_set_eee()
3646 hw->phy.eee_speeds_supported; in ixgbe_set_eee()
3648 adapter->flags2 &= ~IXGBE_FLAG2_EEE_ENABLED; in ixgbe_set_eee()
3649 hw->phy.eee_speeds_advertised = 0; in ixgbe_set_eee()
3667 if (adapter->flags2 & IXGBE_FLAG2_RX_LEGACY) in ixgbe_get_priv_flags()
3670 if (adapter->flags2 & IXGBE_FLAG2_VF_IPSEC_ENABLED) in ixgbe_get_priv_flags()
3673 if (adapter->flags2 & IXGBE_FLAG2_AUTO_DISABLE_VF) in ixgbe_get_priv_flags()
3682 unsigned int flags2 = adapter->flags2; in ixgbe_set_priv_flags()
3695 if (adapter->hw.mac.type == ixgbe_mac_82599EB) { in ixgbe_set_priv_flags()
3697 for (i = 0; i < adapter->num_vfs; i++) in ixgbe_set_priv_flags()
3698 adapter->vfinfo[i].primary_abort_count = 0; in ixgbe_set_priv_flags()
3704 return -EOPNOTSUPP; in ixgbe_set_priv_flags()
3708 if (flags2 != adapter->flags2) { in ixgbe_set_priv_flags()
3709 adapter->flags2 = flags2; in ixgbe_set_priv_flags()
3819 if (adapter->hw.mac.type == ixgbe_mac_e610) in ixgbe_set_ethtool_ops()
3820 netdev->ethtool_ops = &ixgbe_ethtool_ops_e610; in ixgbe_set_ethtool_ops()
3822 netdev->ethtool_ops = &ixgbe_ethtool_ops; in ixgbe_set_ethtool_ops()