Lines Matching +full:mac +full:- +full:wol
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()
572 struct ixgbe_fc_info fc = hw->fc; in ixgbe_set_pauseparam()
575 if ((hw->mac.type == ixgbe_mac_82598EB) && in ixgbe_set_pauseparam()
576 (adapter->flags & IXGBE_FLAG_DCB_ENABLED)) in ixgbe_set_pauseparam()
577 return -EINVAL; in ixgbe_set_pauseparam()
580 if ((pause->autoneg == AUTONEG_ENABLE) && in ixgbe_set_pauseparam()
582 return -EINVAL; in ixgbe_set_pauseparam()
584 fc.disable_fc_autoneg = (pause->autoneg != AUTONEG_ENABLE); in ixgbe_set_pauseparam()
586 if ((pause->rx_pause && pause->tx_pause) || pause->autoneg) in ixgbe_set_pauseparam()
588 else if (pause->rx_pause && !pause->tx_pause) in ixgbe_set_pauseparam()
590 else if (!pause->rx_pause && pause->tx_pause) in ixgbe_set_pauseparam()
596 if (memcmp(&fc, &hw->fc, sizeof(struct ixgbe_fc_info))) { in ixgbe_set_pauseparam()
597 hw->fc = fc; in ixgbe_set_pauseparam()
610 return adapter->msg_enable; in ixgbe_get_msglevel()
616 adapter->msg_enable = data; in ixgbe_set_msglevel()
625 #define IXGBE_GET_STAT(_A_, _R_) _A_->stats._R_
631 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_regs()
637 regs->version = hw->mac.type << 24 | hw->revision_id << 16 | in ixgbe_get_regs()
638 hw->device_id; in ixgbe_get_regs()
683 switch (hw->mac.type) { in ixgbe_get_regs()
786 switch (hw->mac.type) { in ixgbe_get_regs()
901 /* MAC */ in ixgbe_get_regs()
998 return adapter->hw.eeprom.word_size * 2; in ixgbe_get_eeprom_len()
1005 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eeprom()
1011 if (eeprom->len == 0) in ixgbe_get_eeprom()
1012 return -EINVAL; in ixgbe_get_eeprom()
1014 eeprom->magic = hw->vendor_id | (hw->device_id << 16); in ixgbe_get_eeprom()
1016 first_word = eeprom->offset >> 1; in ixgbe_get_eeprom()
1017 last_word = (eeprom->offset + eeprom->len - 1) >> 1; in ixgbe_get_eeprom()
1018 eeprom_len = last_word - first_word + 1; in ixgbe_get_eeprom()
1022 return -ENOMEM; in ixgbe_get_eeprom()
1024 ret_val = hw->eeprom.ops.read_buffer(hw, first_word, eeprom_len, in ixgbe_get_eeprom()
1027 /* Device's eeprom is always little-endian, word addressable */ in ixgbe_get_eeprom()
1031 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 1), eeprom->len); in ixgbe_get_eeprom()
1041 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_eeprom()
1047 if (eeprom->len == 0) in ixgbe_set_eeprom()
1048 return -EINVAL; in ixgbe_set_eeprom()
1050 if (eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) in ixgbe_set_eeprom()
1051 return -EINVAL; in ixgbe_set_eeprom()
1053 max_len = hw->eeprom.word_size * 2; in ixgbe_set_eeprom()
1055 first_word = eeprom->offset >> 1; in ixgbe_set_eeprom()
1056 last_word = (eeprom->offset + eeprom->len - 1) >> 1; in ixgbe_set_eeprom()
1059 return -ENOMEM; in ixgbe_set_eeprom()
1063 if (eeprom->offset & 1) { in ixgbe_set_eeprom()
1068 ret_val = hw->eeprom.ops.read(hw, first_word, &eeprom_buff[0]); in ixgbe_set_eeprom()
1074 if ((eeprom->offset + eeprom->len) & 1) { in ixgbe_set_eeprom()
1079 ret_val = hw->eeprom.ops.read(hw, last_word, in ixgbe_set_eeprom()
1080 &eeprom_buff[last_word - first_word]); in ixgbe_set_eeprom()
1085 /* Device's eeprom is always little-endian, word addressable */ in ixgbe_set_eeprom()
1086 for (i = 0; i < last_word - first_word + 1; i++) in ixgbe_set_eeprom()
1089 memcpy(ptr, bytes, eeprom->len); in ixgbe_set_eeprom()
1091 for (i = 0; i < last_word - first_word + 1; i++) in ixgbe_set_eeprom()
1094 ret_val = hw->eeprom.ops.write_buffer(hw, first_word, in ixgbe_set_eeprom()
1095 last_word - first_word + 1, in ixgbe_set_eeprom()
1100 hw->eeprom.ops.update_checksum(hw); in ixgbe_set_eeprom()
1112 strscpy(drvinfo->driver, ixgbe_driver_name, sizeof(drvinfo->driver)); in ixgbe_get_drvinfo()
1114 strscpy(drvinfo->fw_version, adapter->eeprom_id, in ixgbe_get_drvinfo()
1115 sizeof(drvinfo->fw_version)); in ixgbe_get_drvinfo()
1117 strscpy(drvinfo->bus_info, pci_name(adapter->pdev), in ixgbe_get_drvinfo()
1118 sizeof(drvinfo->bus_info)); in ixgbe_get_drvinfo()
1120 drvinfo->n_priv_flags = IXGBE_PRIV_FLAGS_STR_LEN; in ixgbe_get_drvinfo()
1125 switch (adapter->hw.mac.type) { in ixgbe_get_max_rxd()
1143 switch (adapter->hw.mac.type) { in ixgbe_get_max_txd()
1165 struct ixgbe_ring *tx_ring = adapter->tx_ring[0]; in ixgbe_get_ringparam()
1166 struct ixgbe_ring *rx_ring = adapter->rx_ring[0]; in ixgbe_get_ringparam()
1168 ring->rx_max_pending = ixgbe_get_max_rxd(adapter); in ixgbe_get_ringparam()
1169 ring->tx_max_pending = ixgbe_get_max_txd(adapter); in ixgbe_get_ringparam()
1170 ring->rx_pending = rx_ring->count; in ixgbe_get_ringparam()
1171 ring->tx_pending = tx_ring->count; in ixgbe_get_ringparam()
1184 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) in ixgbe_set_ringparam()
1185 return -EINVAL; in ixgbe_set_ringparam()
1187 new_tx_count = clamp_t(u32, ring->tx_pending, in ixgbe_set_ringparam()
1191 new_rx_count = clamp_t(u32, ring->rx_pending, in ixgbe_set_ringparam()
1195 if ((new_tx_count == adapter->tx_ring_count) && in ixgbe_set_ringparam()
1196 (new_rx_count == adapter->rx_ring_count)) { in ixgbe_set_ringparam()
1201 while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) in ixgbe_set_ringparam()
1204 if (!netif_running(adapter->netdev)) { in ixgbe_set_ringparam()
1205 for (i = 0; i < adapter->num_tx_queues; i++) in ixgbe_set_ringparam()
1206 adapter->tx_ring[i]->count = new_tx_count; in ixgbe_set_ringparam()
1207 for (i = 0; i < adapter->num_xdp_queues; i++) in ixgbe_set_ringparam()
1208 adapter->xdp_ring[i]->count = new_tx_count; in ixgbe_set_ringparam()
1209 for (i = 0; i < adapter->num_rx_queues; i++) in ixgbe_set_ringparam()
1210 adapter->rx_ring[i]->count = new_rx_count; in ixgbe_set_ringparam()
1211 adapter->tx_ring_count = new_tx_count; in ixgbe_set_ringparam()
1212 adapter->xdp_ring_count = new_tx_count; in ixgbe_set_ringparam()
1213 adapter->rx_ring_count = new_rx_count; in ixgbe_set_ringparam()
1218 i = max_t(int, adapter->num_tx_queues + adapter->num_xdp_queues, in ixgbe_set_ringparam()
1219 adapter->num_rx_queues); in ixgbe_set_ringparam()
1223 err = -ENOMEM; in ixgbe_set_ringparam()
1235 if (new_tx_count != adapter->tx_ring_count) { in ixgbe_set_ringparam()
1236 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_set_ringparam()
1237 memcpy(&temp_ring[i], adapter->tx_ring[i], in ixgbe_set_ringparam()
1244 i--; in ixgbe_set_ringparam()
1251 for (j = 0; j < adapter->num_xdp_queues; j++, i++) { in ixgbe_set_ringparam()
1252 memcpy(&temp_ring[i], adapter->xdp_ring[j], in ixgbe_set_ringparam()
1259 i--; in ixgbe_set_ringparam()
1266 for (i = 0; i < adapter->num_tx_queues; i++) { in ixgbe_set_ringparam()
1267 ixgbe_free_tx_resources(adapter->tx_ring[i]); in ixgbe_set_ringparam()
1269 memcpy(adapter->tx_ring[i], &temp_ring[i], in ixgbe_set_ringparam()
1272 for (j = 0; j < adapter->num_xdp_queues; j++, i++) { in ixgbe_set_ringparam()
1273 ixgbe_free_tx_resources(adapter->xdp_ring[j]); in ixgbe_set_ringparam()
1275 memcpy(adapter->xdp_ring[j], &temp_ring[i], in ixgbe_set_ringparam()
1279 adapter->tx_ring_count = new_tx_count; in ixgbe_set_ringparam()
1283 if (new_rx_count != adapter->rx_ring_count) { in ixgbe_set_ringparam()
1284 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_set_ringparam()
1285 memcpy(&temp_ring[i], adapter->rx_ring[i], in ixgbe_set_ringparam()
1288 /* Clear copied XDP RX-queue info */ in ixgbe_set_ringparam()
1296 i--; in ixgbe_set_ringparam()
1304 for (i = 0; i < adapter->num_rx_queues; i++) { in ixgbe_set_ringparam()
1305 ixgbe_free_rx_resources(adapter->rx_ring[i]); in ixgbe_set_ringparam()
1307 memcpy(adapter->rx_ring[i], &temp_ring[i], in ixgbe_set_ringparam()
1311 adapter->rx_ring_count = new_rx_count; in ixgbe_set_ringparam()
1318 clear_bit(__IXGBE_RESETTING, &adapter->state); in ixgbe_set_ringparam()
1332 return -EOPNOTSUPP; in ixgbe_get_sset_count()
1367 for (j = 0; j < netdev->num_tx_queues; j++) { in ixgbe_get_ethtool_stats()
1368 ring = adapter->tx_ring[j]; in ixgbe_get_ethtool_stats()
1377 start = u64_stats_fetch_begin(&ring->syncp); in ixgbe_get_ethtool_stats()
1378 data[i] = ring->stats.packets; in ixgbe_get_ethtool_stats()
1379 data[i+1] = ring->stats.bytes; in ixgbe_get_ethtool_stats()
1380 } while (u64_stats_fetch_retry(&ring->syncp, start)); in ixgbe_get_ethtool_stats()
1384 ring = adapter->rx_ring[j]; in ixgbe_get_ethtool_stats()
1393 start = u64_stats_fetch_begin(&ring->syncp); in ixgbe_get_ethtool_stats()
1394 data[i] = ring->stats.packets; in ixgbe_get_ethtool_stats()
1395 data[i+1] = ring->stats.bytes; in ixgbe_get_ethtool_stats()
1396 } while (u64_stats_fetch_retry(&ring->syncp, start)); in ixgbe_get_ethtool_stats()
1401 data[i++] = adapter->stats.pxontxc[j]; in ixgbe_get_ethtool_stats()
1402 data[i++] = adapter->stats.pxofftxc[j]; in ixgbe_get_ethtool_stats()
1405 data[i++] = adapter->stats.pxonrxc[j]; in ixgbe_get_ethtool_stats()
1406 data[i++] = adapter->stats.pxoffrxc[j]; in ixgbe_get_ethtool_stats()
1424 for (i = 0; i < netdev->num_tx_queues; i++) { in ixgbe_get_strings()
1440 /* BUG_ON(p - data != IXGBE_STATS_LEN * ETH_GSTRING_LEN); */ in ixgbe_get_strings()
1450 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_link_test()
1454 if (ixgbe_removed(hw->hw_addr)) { in ixgbe_link_test()
1460 hw->mac.ops.check_link(hw, &link_speed, &link_up, true); in ixgbe_link_test()
1480 * as a single-element array) and special-case the tables.
1484 * registers to be written without any read-back testing.
1529 /* RDH is read-only for 82598, only test RDT. */
1553 if (ixgbe_removed(adapter->hw.hw_addr)) { in reg_pattern_test()
1558 before = ixgbe_read_reg(&adapter->hw, reg); in reg_pattern_test()
1559 ixgbe_write_reg(&adapter->hw, reg, test_pattern[pat] & write); in reg_pattern_test()
1560 val = ixgbe_read_reg(&adapter->hw, reg); in reg_pattern_test()
1565 ixgbe_write_reg(&adapter->hw, reg, before); in reg_pattern_test()
1568 ixgbe_write_reg(&adapter->hw, reg, before); in reg_pattern_test()
1578 if (ixgbe_removed(adapter->hw.hw_addr)) { in reg_set_and_check()
1582 before = ixgbe_read_reg(&adapter->hw, reg); in reg_set_and_check()
1583 ixgbe_write_reg(&adapter->hw, reg, write & mask); in reg_set_and_check()
1584 val = ixgbe_read_reg(&adapter->hw, reg); in reg_set_and_check()
1589 ixgbe_write_reg(&adapter->hw, reg, before); in reg_set_and_check()
1592 ixgbe_write_reg(&adapter->hw, reg, before); in reg_set_and_check()
1602 if (ixgbe_removed(adapter->hw.hw_addr)) { in ixgbe_reg_test()
1603 e_err(drv, "Adapter removed - register test blocked\n"); in ixgbe_reg_test()
1607 switch (adapter->hw.mac.type) { in ixgbe_reg_test()
1629 * tests. Some bits are read-only, some toggle, and some in ixgbe_reg_test()
1632 before = ixgbe_read_reg(&adapter->hw, IXGBE_STATUS); in ixgbe_reg_test()
1633 value = (ixgbe_read_reg(&adapter->hw, IXGBE_STATUS) & toggle); in ixgbe_reg_test()
1634 ixgbe_write_reg(&adapter->hw, IXGBE_STATUS, toggle); in ixgbe_reg_test()
1635 after = ixgbe_read_reg(&adapter->hw, IXGBE_STATUS) & toggle; in ixgbe_reg_test()
1643 ixgbe_write_reg(&adapter->hw, IXGBE_STATUS, before); in ixgbe_reg_test()
1649 while (test->reg) { in ixgbe_reg_test()
1650 for (i = 0; i < test->array_len; i++) { in ixgbe_reg_test()
1653 switch (test->test_type) { in ixgbe_reg_test()
1656 test->reg + (i * 0x40), in ixgbe_reg_test()
1657 test->mask, in ixgbe_reg_test()
1658 test->write); in ixgbe_reg_test()
1662 test->reg + (i * 0x40), in ixgbe_reg_test()
1663 test->mask, in ixgbe_reg_test()
1664 test->write); in ixgbe_reg_test()
1667 ixgbe_write_reg(&adapter->hw, in ixgbe_reg_test()
1668 test->reg + (i * 0x40), in ixgbe_reg_test()
1669 test->write); in ixgbe_reg_test()
1673 test->reg + (i * 4), in ixgbe_reg_test()
1674 test->mask, in ixgbe_reg_test()
1675 test->write); in ixgbe_reg_test()
1679 test->reg + (i * 8), in ixgbe_reg_test()
1680 test->mask, in ixgbe_reg_test()
1681 test->write); in ixgbe_reg_test()
1685 (test->reg + 4) + (i * 8), in ixgbe_reg_test()
1686 test->mask, in ixgbe_reg_test()
1687 test->write); in ixgbe_reg_test()
1702 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_eeprom_test()
1703 if (hw->eeprom.ops.validate_checksum(hw, NULL)) in ixgbe_eeprom_test()
1715 adapter->test_icr |= IXGBE_READ_REG(&adapter->hw, IXGBE_EICR); in ixgbe_test_intr()
1722 struct net_device *netdev = adapter->netdev; in ixgbe_intr_test()
1724 u32 irq = adapter->pdev->irq; in ixgbe_intr_test()
1729 if (adapter->msix_entries) { in ixgbe_intr_test()
1730 /* NOTE: we don't test MSI-X interrupts here, yet */ in ixgbe_intr_test()
1732 } else if (adapter->flags & IXGBE_FLAG_MSI_ENABLED) { in ixgbe_intr_test()
1734 if (request_irq(irq, ixgbe_test_intr, 0, netdev->name, in ixgbe_intr_test()
1737 return -1; in ixgbe_intr_test()
1740 netdev->name, netdev)) { in ixgbe_intr_test()
1743 netdev->name, netdev)) { in ixgbe_intr_test()
1745 return -1; in ixgbe_intr_test()
1751 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF); in ixgbe_intr_test()
1752 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1768 adapter->test_icr = 0; in ixgbe_intr_test()
1769 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, in ixgbe_intr_test()
1771 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, in ixgbe_intr_test()
1773 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1776 if (adapter->test_icr & mask) { in ixgbe_intr_test()
1788 adapter->test_icr = 0; in ixgbe_intr_test()
1789 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, mask); in ixgbe_intr_test()
1790 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, mask); in ixgbe_intr_test()
1791 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1794 if (!(adapter->test_icr & mask)) { in ixgbe_intr_test()
1807 adapter->test_icr = 0; in ixgbe_intr_test()
1808 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, in ixgbe_intr_test()
1810 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, in ixgbe_intr_test()
1812 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1815 if (adapter->test_icr) { in ixgbe_intr_test()
1823 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFFFFFF); in ixgbe_intr_test()
1824 IXGBE_WRITE_FLUSH(&adapter->hw); in ixgbe_intr_test()
1849 ixgbe_free_tx_resources(&adapter->test_tx_ring); in ixgbe_free_desc_rings()
1850 ixgbe_free_rx_resources(&adapter->test_rx_ring); in ixgbe_free_desc_rings()
1855 struct ixgbe_ring *tx_ring = &adapter->test_tx_ring; in ixgbe_setup_desc_rings()
1856 struct ixgbe_ring *rx_ring = &adapter->test_rx_ring; in ixgbe_setup_desc_rings()
1857 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_desc_rings()
1863 tx_ring->count = IXGBE_DEFAULT_TXD; in ixgbe_setup_desc_rings()
1864 tx_ring->queue_index = 0; in ixgbe_setup_desc_rings()
1865 tx_ring->dev = &adapter->pdev->dev; in ixgbe_setup_desc_rings()
1866 tx_ring->netdev = adapter->netdev; in ixgbe_setup_desc_rings()
1867 tx_ring->reg_idx = adapter->tx_ring[0]->reg_idx; in ixgbe_setup_desc_rings()
1873 switch (adapter->hw.mac.type) { in ixgbe_setup_desc_rings()
1880 reg_data = IXGBE_READ_REG(&adapter->hw, IXGBE_DMATXCTL); in ixgbe_setup_desc_rings()
1882 IXGBE_WRITE_REG(&adapter->hw, IXGBE_DMATXCTL, reg_data); in ixgbe_setup_desc_rings()
1891 rx_ring->count = IXGBE_DEFAULT_RXD; in ixgbe_setup_desc_rings()
1892 rx_ring->queue_index = 0; in ixgbe_setup_desc_rings()
1893 rx_ring->dev = &adapter->pdev->dev; in ixgbe_setup_desc_rings()
1894 rx_ring->netdev = adapter->netdev; in ixgbe_setup_desc_rings()
1895 rx_ring->reg_idx = adapter->rx_ring[0]->reg_idx; in ixgbe_setup_desc_rings()
1903 hw->mac.ops.disable_rx(hw); in ixgbe_setup_desc_rings()
1907 rctl = IXGBE_READ_REG(&adapter->hw, IXGBE_RXCTRL); in ixgbe_setup_desc_rings()
1909 IXGBE_WRITE_REG(&adapter->hw, IXGBE_RXCTRL, rctl); in ixgbe_setup_desc_rings()
1911 hw->mac.ops.enable_rx(hw); in ixgbe_setup_desc_rings()
1922 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_setup_loopback_test()
1926 /* Setup MAC loopback */ in ixgbe_setup_loopback_test()
1936 switch (adapter->hw.mac.type) { in ixgbe_setup_loopback_test()
1947 if (hw->mac.orig_autoc) { in ixgbe_setup_loopback_test()
1948 reg_data = hw->mac.orig_autoc | IXGBE_AUTOC_FLU; in ixgbe_setup_loopback_test()
1957 /* Disable Atlas Tx lanes; re-enabled in reset path */ in ixgbe_setup_loopback_test()
1958 if (hw->mac.type == ixgbe_mac_82598EB) { in ixgbe_setup_loopback_test()
1961 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK, &atlas); in ixgbe_setup_loopback_test()
1963 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_LPBK, atlas); in ixgbe_setup_loopback_test()
1965 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_10G, &atlas); in ixgbe_setup_loopback_test()
1967 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_10G, atlas); in ixgbe_setup_loopback_test()
1969 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_1G, &atlas); in ixgbe_setup_loopback_test()
1971 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_1G, atlas); in ixgbe_setup_loopback_test()
1973 hw->mac.ops.read_analog_reg8(hw, IXGBE_ATLAS_PDN_AN, &atlas); in ixgbe_setup_loopback_test()
1975 hw->mac.ops.write_analog_reg8(hw, IXGBE_ATLAS_PDN_AN, atlas); in ixgbe_setup_loopback_test()
1985 reg_data = IXGBE_READ_REG(&adapter->hw, IXGBE_HLREG0); in ixgbe_loopback_cleanup()
1987 IXGBE_WRITE_REG(&adapter->hw, IXGBE_HLREG0, reg_data); in ixgbe_loopback_cleanup()
1993 memset(skb->data, 0xFF, frame_size); in ixgbe_create_lbtest_frame()
1995 memset(&skb->data[frame_size], 0xAA, frame_size / 2 - 1); in ixgbe_create_lbtest_frame()
1996 skb->data[frame_size + 10] = 0xBE; in ixgbe_create_lbtest_frame()
1997 skb->data[frame_size + 12] = 0xAF; in ixgbe_create_lbtest_frame()
2007 data = page_address(rx_buffer->page) + rx_buffer->page_offset; in ixgbe_check_lbtest_frame()
2021 rx_ntc = rx_ring->next_to_clean; in ixgbe_clean_test_rings()
2022 tx_ntc = tx_ring->next_to_clean; in ixgbe_clean_test_rings()
2025 while (tx_ntc != tx_ring->next_to_use) { in ixgbe_clean_test_rings()
2032 if (!(tx_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD))) in ixgbe_clean_test_rings()
2036 tx_buffer = &tx_ring->tx_buffer_info[tx_ntc]; in ixgbe_clean_test_rings()
2039 dev_kfree_skb_any(tx_buffer->skb); in ixgbe_clean_test_rings()
2042 dma_unmap_single(tx_ring->dev, in ixgbe_clean_test_rings()
2050 if (tx_ntc == tx_ring->count) in ixgbe_clean_test_rings()
2054 while (rx_desc->wb.upper.length) { in ixgbe_clean_test_rings()
2058 rx_buffer = &rx_ring->rx_buffer_info[rx_ntc]; in ixgbe_clean_test_rings()
2061 dma_sync_single_for_cpu(rx_ring->dev, in ixgbe_clean_test_rings()
2062 rx_buffer->dma, in ixgbe_clean_test_rings()
2073 dma_sync_single_for_device(rx_ring->dev, in ixgbe_clean_test_rings()
2074 rx_buffer->dma, in ixgbe_clean_test_rings()
2080 if (rx_ntc == rx_ring->count) in ixgbe_clean_test_rings()
2089 /* re-map buffers to ring, store next to clean values */ in ixgbe_clean_test_rings()
2091 rx_ring->next_to_clean = rx_ntc; in ixgbe_clean_test_rings()
2092 tx_ring->next_to_clean = tx_ntc; in ixgbe_clean_test_rings()
2099 struct ixgbe_ring *tx_ring = &adapter->test_tx_ring; in ixgbe_run_loopback_test()
2100 struct ixgbe_ring *rx_ring = &adapter->test_rx_ring; in ixgbe_run_loopback_test()
2105 u32 flags_orig = adapter->flags; in ixgbe_run_loopback_test()
2108 adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; in ixgbe_run_loopback_test()
2125 if (rx_ring->count <= tx_ring->count) in ixgbe_run_loopback_test()
2126 lc = ((tx_ring->count / 64) * 2) + 1; in ixgbe_run_loopback_test()
2128 lc = ((rx_ring->count / 64) * 2) + 1; in ixgbe_run_loopback_test()
2161 adapter->flags = flags_orig; in ixgbe_run_loopback_test()
2189 if (ixgbe_removed(adapter->hw.hw_addr)) { in ixgbe_diag_test()
2190 e_err(hw, "Adapter removed - test blocked\n"); in ixgbe_diag_test()
2196 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2199 set_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2200 if (eth_test->flags == ETH_TEST_FL_OFFLINE) { in ixgbe_diag_test()
2201 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_diag_test()
2203 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { in ixgbe_diag_test()
2205 for (i = 0; i < adapter->num_vfs; i++) { in ixgbe_diag_test()
2206 if (adapter->vfinfo[i].clear_to_send) { in ixgbe_diag_test()
2213 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2215 &adapter->state); in ixgbe_diag_test()
2228 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2238 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2243 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2248 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2250 /* If SRIOV or VMDq is enabled then skip MAC in ixgbe_diag_test()
2252 if (adapter->flags & (IXGBE_FLAG_SRIOV_ENABLED | in ixgbe_diag_test()
2254 e_info(hw, "Skip MAC loopback diagnostic in VT mode\n"); in ixgbe_diag_test()
2262 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2268 clear_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2271 else if (hw->mac.ops.disable_tx_laser) in ixgbe_diag_test()
2272 hw->mac.ops.disable_tx_laser(hw); in ixgbe_diag_test()
2278 eth_test->flags |= ETH_TEST_FL_FAILED; in ixgbe_diag_test()
2286 clear_bit(__IXGBE_TESTING, &adapter->state); in ixgbe_diag_test()
2291 struct ethtool_wolinfo *wol) in ixgbe_wol_exclusion() argument
2293 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_wol_exclusion()
2296 /* WOL not supported for all devices */ in ixgbe_wol_exclusion()
2297 if (!ixgbe_wol_supported(adapter, hw->device_id, in ixgbe_wol_exclusion()
2298 hw->subsystem_device_id)) { in ixgbe_wol_exclusion()
2300 wol->supported = 0; in ixgbe_wol_exclusion()
2307 struct ethtool_wolinfo *wol) in ixgbe_get_wol() argument
2311 wol->supported = WAKE_UCAST | WAKE_MCAST | in ixgbe_get_wol()
2313 wol->wolopts = 0; in ixgbe_get_wol()
2315 if (ixgbe_wol_exclusion(adapter, wol) || in ixgbe_get_wol()
2316 !device_can_wakeup(&adapter->pdev->dev)) in ixgbe_get_wol()
2319 if (adapter->wol & IXGBE_WUFC_EX) in ixgbe_get_wol()
2320 wol->wolopts |= WAKE_UCAST; in ixgbe_get_wol()
2321 if (adapter->wol & IXGBE_WUFC_MC) in ixgbe_get_wol()
2322 wol->wolopts |= WAKE_MCAST; in ixgbe_get_wol()
2323 if (adapter->wol & IXGBE_WUFC_BC) in ixgbe_get_wol()
2324 wol->wolopts |= WAKE_BCAST; in ixgbe_get_wol()
2325 if (adapter->wol & IXGBE_WUFC_MAG) in ixgbe_get_wol()
2326 wol->wolopts |= WAKE_MAGIC; in ixgbe_get_wol()
2329 static int ixgbe_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) in ixgbe_set_wol() argument
2333 if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE | in ixgbe_set_wol()
2335 return -EOPNOTSUPP; in ixgbe_set_wol()
2337 if (ixgbe_wol_exclusion(adapter, wol)) in ixgbe_set_wol()
2338 return wol->wolopts ? -EOPNOTSUPP : 0; in ixgbe_set_wol()
2340 adapter->wol = 0; in ixgbe_set_wol()
2342 if (wol->wolopts & WAKE_UCAST) in ixgbe_set_wol()
2343 adapter->wol |= IXGBE_WUFC_EX; in ixgbe_set_wol()
2344 if (wol->wolopts & WAKE_MCAST) in ixgbe_set_wol()
2345 adapter->wol |= IXGBE_WUFC_MC; in ixgbe_set_wol()
2346 if (wol->wolopts & WAKE_BCAST) in ixgbe_set_wol()
2347 adapter->wol |= IXGBE_WUFC_BC; in ixgbe_set_wol()
2348 if (wol->wolopts & WAKE_MAGIC) in ixgbe_set_wol()
2349 adapter->wol |= IXGBE_WUFC_MAG; in ixgbe_set_wol()
2351 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); in ixgbe_set_wol()
2370 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_phys_id()
2372 if (!hw->mac.ops.led_on || !hw->mac.ops.led_off) in ixgbe_set_phys_id()
2373 return -EOPNOTSUPP; in ixgbe_set_phys_id()
2377 adapter->led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL); in ixgbe_set_phys_id()
2381 hw->mac.ops.led_on(hw, hw->mac.led_link_act); in ixgbe_set_phys_id()
2385 hw->mac.ops.led_off(hw, hw->mac.led_link_act); in ixgbe_set_phys_id()
2390 IXGBE_WRITE_REG(&adapter->hw, IXGBE_LEDCTL, adapter->led_reg); in ixgbe_set_phys_id()
2405 if (adapter->rx_itr_setting <= 1) in ixgbe_get_coalesce()
2406 ec->rx_coalesce_usecs = adapter->rx_itr_setting; in ixgbe_get_coalesce()
2408 ec->rx_coalesce_usecs = adapter->rx_itr_setting >> 2; in ixgbe_get_coalesce()
2411 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) in ixgbe_get_coalesce()
2415 if (adapter->tx_itr_setting <= 1) in ixgbe_get_coalesce()
2416 ec->tx_coalesce_usecs = adapter->tx_itr_setting; in ixgbe_get_coalesce()
2418 ec->tx_coalesce_usecs = adapter->tx_itr_setting >> 2; in ixgbe_get_coalesce()
2429 struct net_device *netdev = adapter->netdev; in ixgbe_update_rsc()
2432 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) || in ixgbe_update_rsc()
2433 !(netdev->features & NETIF_F_LRO)) in ixgbe_update_rsc()
2437 if (adapter->rx_itr_setting == 1 || in ixgbe_update_rsc()
2438 adapter->rx_itr_setting > IXGBE_MIN_RSC_ITR) { in ixgbe_update_rsc()
2439 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)) { in ixgbe_update_rsc()
2440 adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED; in ixgbe_update_rsc()
2441 e_info(probe, "rx-usecs value high enough to re-enable RSC\n"); in ixgbe_update_rsc()
2445 } else if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { in ixgbe_update_rsc()
2446 adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED; in ixgbe_update_rsc()
2447 e_info(probe, "rx-usecs set too low, disabling RSC\n"); in ixgbe_update_rsc()
2464 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) { in ixgbe_set_coalesce()
2466 if (ec->tx_coalesce_usecs) in ixgbe_set_coalesce()
2467 return -EINVAL; in ixgbe_set_coalesce()
2468 tx_itr_prev = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2470 tx_itr_prev = adapter->tx_itr_setting; in ixgbe_set_coalesce()
2473 if ((ec->rx_coalesce_usecs > (IXGBE_MAX_EITR >> 2)) || in ixgbe_set_coalesce()
2474 (ec->tx_coalesce_usecs > (IXGBE_MAX_EITR >> 2))) in ixgbe_set_coalesce()
2475 return -EINVAL; in ixgbe_set_coalesce()
2477 if (ec->rx_coalesce_usecs > 1) in ixgbe_set_coalesce()
2478 adapter->rx_itr_setting = ec->rx_coalesce_usecs << 2; in ixgbe_set_coalesce()
2480 adapter->rx_itr_setting = ec->rx_coalesce_usecs; in ixgbe_set_coalesce()
2482 if (adapter->rx_itr_setting == 1) in ixgbe_set_coalesce()
2485 rx_itr_param = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2487 if (ec->tx_coalesce_usecs > 1) in ixgbe_set_coalesce()
2488 adapter->tx_itr_setting = ec->tx_coalesce_usecs << 2; in ixgbe_set_coalesce()
2490 adapter->tx_itr_setting = ec->tx_coalesce_usecs; in ixgbe_set_coalesce()
2492 if (adapter->tx_itr_setting == 1) in ixgbe_set_coalesce()
2495 tx_itr_param = adapter->tx_itr_setting; in ixgbe_set_coalesce()
2498 if (adapter->q_vector[0]->tx.count && adapter->q_vector[0]->rx.count) in ixgbe_set_coalesce()
2499 adapter->tx_itr_setting = adapter->rx_itr_setting; in ixgbe_set_coalesce()
2502 if ((adapter->tx_itr_setting != 1) && in ixgbe_set_coalesce()
2503 (adapter->tx_itr_setting < IXGBE_100K_ITR)) { in ixgbe_set_coalesce()
2516 for (i = 0; i < adapter->num_q_vectors; i++) { in ixgbe_set_coalesce()
2517 q_vector = adapter->q_vector[i]; in ixgbe_set_coalesce()
2518 if (q_vector->tx.count && !q_vector->rx.count) in ixgbe_set_coalesce()
2520 q_vector->itr = tx_itr_param; in ixgbe_set_coalesce()
2523 q_vector->itr = rx_itr_param; in ixgbe_set_coalesce()
2541 union ixgbe_atr_input *mask = &adapter->fdir_mask; in ixgbe_get_ethtool_fdir_entry()
2543 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_get_ethtool_fdir_entry()
2548 cmd->data = (1024 << adapter->fdir_pballoc) - 2; in ixgbe_get_ethtool_fdir_entry()
2551 &adapter->fdir_filter_list, fdir_node) { in ixgbe_get_ethtool_fdir_entry()
2552 if (fsp->location <= rule->sw_idx) in ixgbe_get_ethtool_fdir_entry()
2556 if (!rule || fsp->location != rule->sw_idx) in ixgbe_get_ethtool_fdir_entry()
2557 return -EINVAL; in ixgbe_get_ethtool_fdir_entry()
2562 switch (rule->filter.formatted.flow_type) { in ixgbe_get_ethtool_fdir_entry()
2564 fsp->flow_type = TCP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2567 fsp->flow_type = UDP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2570 fsp->flow_type = SCTP_V4_FLOW; in ixgbe_get_ethtool_fdir_entry()
2573 fsp->flow_type = IP_USER_FLOW; in ixgbe_get_ethtool_fdir_entry()
2574 fsp->h_u.usr_ip4_spec.ip_ver = ETH_RX_NFC_IP4; in ixgbe_get_ethtool_fdir_entry()
2575 fsp->h_u.usr_ip4_spec.proto = 0; in ixgbe_get_ethtool_fdir_entry()
2576 fsp->m_u.usr_ip4_spec.proto = 0; in ixgbe_get_ethtool_fdir_entry()
2579 return -EINVAL; in ixgbe_get_ethtool_fdir_entry()
2582 fsp->h_u.tcp_ip4_spec.psrc = rule->filter.formatted.src_port; in ixgbe_get_ethtool_fdir_entry()
2583 fsp->m_u.tcp_ip4_spec.psrc = mask->formatted.src_port; in ixgbe_get_ethtool_fdir_entry()
2584 fsp->h_u.tcp_ip4_spec.pdst = rule->filter.formatted.dst_port; in ixgbe_get_ethtool_fdir_entry()
2585 fsp->m_u.tcp_ip4_spec.pdst = mask->formatted.dst_port; in ixgbe_get_ethtool_fdir_entry()
2586 fsp->h_u.tcp_ip4_spec.ip4src = rule->filter.formatted.src_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2587 fsp->m_u.tcp_ip4_spec.ip4src = mask->formatted.src_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2588 fsp->h_u.tcp_ip4_spec.ip4dst = rule->filter.formatted.dst_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2589 fsp->m_u.tcp_ip4_spec.ip4dst = mask->formatted.dst_ip[0]; in ixgbe_get_ethtool_fdir_entry()
2590 fsp->h_ext.vlan_tci = rule->filter.formatted.vlan_id; in ixgbe_get_ethtool_fdir_entry()
2591 fsp->m_ext.vlan_tci = mask->formatted.vlan_id; in ixgbe_get_ethtool_fdir_entry()
2592 fsp->h_ext.vlan_etype = rule->filter.formatted.flex_bytes; in ixgbe_get_ethtool_fdir_entry()
2593 fsp->m_ext.vlan_etype = mask->formatted.flex_bytes; in ixgbe_get_ethtool_fdir_entry()
2594 fsp->h_ext.data[1] = htonl(rule->filter.formatted.vm_pool); in ixgbe_get_ethtool_fdir_entry()
2595 fsp->m_ext.data[1] = htonl(mask->formatted.vm_pool); in ixgbe_get_ethtool_fdir_entry()
2596 fsp->flow_type |= FLOW_EXT; in ixgbe_get_ethtool_fdir_entry()
2599 if (rule->action == IXGBE_FDIR_DROP_QUEUE) in ixgbe_get_ethtool_fdir_entry()
2600 fsp->ring_cookie = RX_CLS_FLOW_DISC; in ixgbe_get_ethtool_fdir_entry()
2602 fsp->ring_cookie = rule->action; in ixgbe_get_ethtool_fdir_entry()
2616 cmd->data = (1024 << adapter->fdir_pballoc) - 2; in ixgbe_get_ethtool_fdir_all()
2619 &adapter->fdir_filter_list, fdir_node) { in ixgbe_get_ethtool_fdir_all()
2620 if (cnt == cmd->rule_cnt) in ixgbe_get_ethtool_fdir_all()
2621 return -EMSGSIZE; in ixgbe_get_ethtool_fdir_all()
2622 rule_locs[cnt] = rule->sw_idx; in ixgbe_get_ethtool_fdir_all()
2626 cmd->rule_cnt = cnt; in ixgbe_get_ethtool_fdir_all()
2634 cmd->data = 0; in ixgbe_get_rss_hash_opts()
2637 switch (cmd->flow_type) { in ixgbe_get_rss_hash_opts()
2639 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rss_hash_opts()
2642 if (adapter->flags2 & IXGBE_FLAG2_RSS_FIELD_IPV4_UDP) in ixgbe_get_rss_hash_opts()
2643 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rss_hash_opts()
2650 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in ixgbe_get_rss_hash_opts()
2653 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rss_hash_opts()
2656 if (adapter->flags2 & IXGBE_FLAG2_RSS_FIELD_IPV6_UDP) in ixgbe_get_rss_hash_opts()
2657 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in ixgbe_get_rss_hash_opts()
2664 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in ixgbe_get_rss_hash_opts()
2667 return -EINVAL; in ixgbe_get_rss_hash_opts()
2675 if (adapter->hw.mac.type < ixgbe_mac_X550) in ixgbe_rss_indir_tbl_max()
2685 int ret = -EOPNOTSUPP; in ixgbe_get_rxnfc()
2687 switch (cmd->cmd) { in ixgbe_get_rxnfc()
2689 cmd->data = min_t(int, adapter->num_rx_queues, in ixgbe_get_rxnfc()
2694 cmd->rule_cnt = adapter->fdir_filter_count; in ixgbe_get_rxnfc()
2717 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_update_ethtool_fdir_entry()
2720 int err = -EINVAL; in ixgbe_update_ethtool_fdir_entry()
2726 &adapter->fdir_filter_list, fdir_node) { in ixgbe_update_ethtool_fdir_entry()
2728 if (rule->sw_idx >= sw_idx) in ixgbe_update_ethtool_fdir_entry()
2734 if (rule && (rule->sw_idx == sw_idx)) { in ixgbe_update_ethtool_fdir_entry()
2735 if (!input || (rule->filter.formatted.bkt_hash != in ixgbe_update_ethtool_fdir_entry()
2736 input->filter.formatted.bkt_hash)) { in ixgbe_update_ethtool_fdir_entry()
2738 &rule->filter, in ixgbe_update_ethtool_fdir_entry()
2742 hlist_del(&rule->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2744 adapter->fdir_filter_count--; in ixgbe_update_ethtool_fdir_entry()
2749 * successfully found and removed from the list else -EINVAL in ixgbe_update_ethtool_fdir_entry()
2755 INIT_HLIST_NODE(&input->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2759 hlist_add_behind(&input->fdir_node, &parent->fdir_node); in ixgbe_update_ethtool_fdir_entry()
2761 hlist_add_head(&input->fdir_node, in ixgbe_update_ethtool_fdir_entry()
2762 &adapter->fdir_filter_list); in ixgbe_update_ethtool_fdir_entry()
2765 adapter->fdir_filter_count++; in ixgbe_update_ethtool_fdir_entry()
2773 switch (fsp->flow_type & ~FLOW_EXT) { in ixgbe_flowspec_to_flow_type()
2784 switch (fsp->h_u.usr_ip4_spec.proto) { in ixgbe_flowspec_to_flow_type()
2795 if (!fsp->m_u.usr_ip4_spec.proto) { in ixgbe_flowspec_to_flow_type()
2815 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_add_ethtool_fdir_entry()
2816 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_add_ethtool_fdir_entry()
2822 if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) in ixgbe_add_ethtool_fdir_entry()
2823 return -EOPNOTSUPP; in ixgbe_add_ethtool_fdir_entry()
2828 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) { in ixgbe_add_ethtool_fdir_entry()
2831 u32 ring = ethtool_get_flow_spec_ring(fsp->ring_cookie); in ixgbe_add_ethtool_fdir_entry()
2832 u8 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie); in ixgbe_add_ethtool_fdir_entry()
2834 if (!vf && (ring >= adapter->num_rx_queues)) in ixgbe_add_ethtool_fdir_entry()
2835 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2837 ((vf > adapter->num_vfs) || in ixgbe_add_ethtool_fdir_entry()
2838 ring >= adapter->num_rx_queues_per_pool)) in ixgbe_add_ethtool_fdir_entry()
2839 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2843 queue = adapter->rx_ring[ring]->reg_idx; in ixgbe_add_ethtool_fdir_entry()
2845 queue = ((vf - 1) * in ixgbe_add_ethtool_fdir_entry()
2846 adapter->num_rx_queues_per_pool) + ring; in ixgbe_add_ethtool_fdir_entry()
2850 if (fsp->location >= ((1024 << adapter->fdir_pballoc) - 2)) { in ixgbe_add_ethtool_fdir_entry()
2852 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2857 return -ENOMEM; in ixgbe_add_ethtool_fdir_entry()
2862 input->sw_idx = fsp->location; in ixgbe_add_ethtool_fdir_entry()
2866 &input->filter.formatted.flow_type)) { in ixgbe_add_ethtool_fdir_entry()
2874 if (input->filter.formatted.flow_type == IXGBE_ATR_FLOW_TYPE_IPV4) in ixgbe_add_ethtool_fdir_entry()
2878 input->filter.formatted.src_ip[0] = fsp->h_u.tcp_ip4_spec.ip4src; in ixgbe_add_ethtool_fdir_entry()
2879 mask.formatted.src_ip[0] = fsp->m_u.tcp_ip4_spec.ip4src; in ixgbe_add_ethtool_fdir_entry()
2880 input->filter.formatted.dst_ip[0] = fsp->h_u.tcp_ip4_spec.ip4dst; in ixgbe_add_ethtool_fdir_entry()
2881 mask.formatted.dst_ip[0] = fsp->m_u.tcp_ip4_spec.ip4dst; in ixgbe_add_ethtool_fdir_entry()
2882 input->filter.formatted.src_port = fsp->h_u.tcp_ip4_spec.psrc; in ixgbe_add_ethtool_fdir_entry()
2883 mask.formatted.src_port = fsp->m_u.tcp_ip4_spec.psrc; in ixgbe_add_ethtool_fdir_entry()
2884 input->filter.formatted.dst_port = fsp->h_u.tcp_ip4_spec.pdst; in ixgbe_add_ethtool_fdir_entry()
2885 mask.formatted.dst_port = fsp->m_u.tcp_ip4_spec.pdst; in ixgbe_add_ethtool_fdir_entry()
2887 if (fsp->flow_type & FLOW_EXT) { in ixgbe_add_ethtool_fdir_entry()
2888 input->filter.formatted.vm_pool = in ixgbe_add_ethtool_fdir_entry()
2889 (unsigned char)ntohl(fsp->h_ext.data[1]); in ixgbe_add_ethtool_fdir_entry()
2891 (unsigned char)ntohl(fsp->m_ext.data[1]); in ixgbe_add_ethtool_fdir_entry()
2892 input->filter.formatted.vlan_id = fsp->h_ext.vlan_tci; in ixgbe_add_ethtool_fdir_entry()
2893 mask.formatted.vlan_id = fsp->m_ext.vlan_tci; in ixgbe_add_ethtool_fdir_entry()
2894 input->filter.formatted.flex_bytes = in ixgbe_add_ethtool_fdir_entry()
2895 fsp->h_ext.vlan_etype; in ixgbe_add_ethtool_fdir_entry()
2896 mask.formatted.flex_bytes = fsp->m_ext.vlan_etype; in ixgbe_add_ethtool_fdir_entry()
2900 if (fsp->ring_cookie == RX_CLS_FLOW_DISC) in ixgbe_add_ethtool_fdir_entry()
2901 input->action = IXGBE_FDIR_DROP_QUEUE; in ixgbe_add_ethtool_fdir_entry()
2903 input->action = fsp->ring_cookie; in ixgbe_add_ethtool_fdir_entry()
2905 spin_lock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
2907 if (hlist_empty(&adapter->fdir_filter_list)) { in ixgbe_add_ethtool_fdir_entry()
2909 memcpy(&adapter->fdir_mask, &mask, sizeof(mask)); in ixgbe_add_ethtool_fdir_entry()
2915 } else if (memcmp(&adapter->fdir_mask, &mask, sizeof(mask))) { in ixgbe_add_ethtool_fdir_entry()
2921 ixgbe_atr_compute_perfect_hash_82599(&input->filter, &mask); in ixgbe_add_ethtool_fdir_entry()
2925 &input->filter, input->sw_idx, queue); in ixgbe_add_ethtool_fdir_entry()
2929 ixgbe_update_ethtool_fdir_entry(adapter, input, input->sw_idx); in ixgbe_add_ethtool_fdir_entry()
2931 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
2935 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_add_ethtool_fdir_entry()
2938 return -EINVAL; in ixgbe_add_ethtool_fdir_entry()
2945 (struct ethtool_rx_flow_spec *)&cmd->fs; in ixgbe_del_ethtool_fdir_entry()
2948 spin_lock(&adapter->fdir_perfect_lock); in ixgbe_del_ethtool_fdir_entry()
2949 err = ixgbe_update_ethtool_fdir_entry(adapter, NULL, fsp->location); in ixgbe_del_ethtool_fdir_entry()
2950 spin_unlock(&adapter->fdir_perfect_lock); in ixgbe_del_ethtool_fdir_entry()
2960 u32 flags2 = adapter->flags2; in ixgbe_set_rss_hash_opt()
2966 if (nfc->data & ~(RXH_IP_SRC | RXH_IP_DST | in ixgbe_set_rss_hash_opt()
2968 return -EINVAL; in ixgbe_set_rss_hash_opt()
2970 switch (nfc->flow_type) { in ixgbe_set_rss_hash_opt()
2973 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
2974 !(nfc->data & RXH_IP_DST) || in ixgbe_set_rss_hash_opt()
2975 !(nfc->data & RXH_L4_B_0_1) || in ixgbe_set_rss_hash_opt()
2976 !(nfc->data & RXH_L4_B_2_3)) in ixgbe_set_rss_hash_opt()
2977 return -EINVAL; in ixgbe_set_rss_hash_opt()
2980 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
2981 !(nfc->data & RXH_IP_DST)) in ixgbe_set_rss_hash_opt()
2982 return -EINVAL; in ixgbe_set_rss_hash_opt()
2983 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in ixgbe_set_rss_hash_opt()
2991 return -EINVAL; in ixgbe_set_rss_hash_opt()
2995 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
2996 !(nfc->data & RXH_IP_DST)) in ixgbe_set_rss_hash_opt()
2997 return -EINVAL; in ixgbe_set_rss_hash_opt()
2998 switch (nfc->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) { in ixgbe_set_rss_hash_opt()
3006 return -EINVAL; in ixgbe_set_rss_hash_opt()
3017 if (!(nfc->data & RXH_IP_SRC) || in ixgbe_set_rss_hash_opt()
3018 !(nfc->data & RXH_IP_DST) || in ixgbe_set_rss_hash_opt()
3019 (nfc->data & RXH_L4_B_0_1) || in ixgbe_set_rss_hash_opt()
3020 (nfc->data & RXH_L4_B_2_3)) in ixgbe_set_rss_hash_opt()
3021 return -EINVAL; in ixgbe_set_rss_hash_opt()
3024 return -EINVAL; in ixgbe_set_rss_hash_opt()
3028 if (flags2 != adapter->flags2) { in ixgbe_set_rss_hash_opt()
3029 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_rss_hash_opt()
3031 unsigned int pf_pool = adapter->num_vfs; in ixgbe_set_rss_hash_opt()
3033 if ((hw->mac.type >= ixgbe_mac_X550) && in ixgbe_set_rss_hash_opt()
3034 (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_set_rss_hash_opt()
3040 !(adapter->flags2 & UDP_RSS_FLAGS)) in ixgbe_set_rss_hash_opt()
3043 adapter->flags2 = flags2; in ixgbe_set_rss_hash_opt()
3060 if ((hw->mac.type >= ixgbe_mac_X550) && in ixgbe_set_rss_hash_opt()
3061 (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) in ixgbe_set_rss_hash_opt()
3073 int ret = -EOPNOTSUPP; in ixgbe_set_rxnfc()
3075 switch (cmd->cmd) { in ixgbe_set_rxnfc()
3107 u16 rss_m = adapter->ring_feature[RING_F_RSS].mask; in ixgbe_get_reta()
3109 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_get_reta()
3110 rss_m = adapter->ring_feature[RING_F_RSS].indices - 1; in ixgbe_get_reta()
3113 indir[i] = adapter->rss_indir_tbl[i] & rss_m; in ixgbe_get_reta()
3121 rxfh->hfunc = ETH_RSS_HASH_TOP; in ixgbe_get_rxfh()
3123 if (rxfh->indir) in ixgbe_get_rxfh()
3124 ixgbe_get_reta(adapter, rxfh->indir); in ixgbe_get_rxfh()
3126 if (rxfh->key) in ixgbe_get_rxfh()
3127 memcpy(rxfh->key, adapter->rss_key, in ixgbe_get_rxfh()
3141 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in ixgbe_set_rxfh()
3142 rxfh->hfunc != ETH_RSS_HASH_TOP) in ixgbe_set_rxfh()
3143 return -EOPNOTSUPP; in ixgbe_set_rxfh()
3146 if (rxfh->indir) { in ixgbe_set_rxfh()
3147 int max_queues = min_t(int, adapter->num_rx_queues, in ixgbe_set_rxfh()
3150 /*Allow at least 2 queues w/ SR-IOV.*/ in ixgbe_set_rxfh()
3151 if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) && in ixgbe_set_rxfh()
3157 if (rxfh->indir[i] >= max_queues) in ixgbe_set_rxfh()
3158 return -EINVAL; in ixgbe_set_rxfh()
3161 adapter->rss_indir_tbl[i] = rxfh->indir[i]; in ixgbe_set_rxfh()
3167 if (rxfh->key) { in ixgbe_set_rxfh()
3168 memcpy(adapter->rss_key, rxfh->key, in ixgbe_set_rxfh()
3182 info->rx_filters = BIT(HWTSTAMP_FILTER_NONE); in ixgbe_get_ts_info()
3184 switch (adapter->hw.mac.type) { in ixgbe_get_ts_info()
3188 info->rx_filters |= BIT(HWTSTAMP_FILTER_ALL); in ixgbe_get_ts_info()
3192 info->rx_filters |= in ixgbe_get_ts_info()
3201 info->so_timestamping = in ixgbe_get_ts_info()
3207 if (adapter->ptp_clock) in ixgbe_get_ts_info()
3208 info->phc_index = ptp_clock_index(adapter->ptp_clock); in ixgbe_get_ts_info()
3210 info->tx_types = in ixgbe_get_ts_info()
3220 u8 tcs = adapter->hw_tcs; in ixgbe_max_channels()
3222 if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { in ixgbe_max_channels()
3223 /* We only support one q_vector without MSI-X */ in ixgbe_max_channels()
3225 } else if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { in ixgbe_max_channels()
3227 max_combined = adapter->ring_feature[RING_F_RSS].mask + 1; in ixgbe_max_channels()
3230 if (adapter->hw.mac.type == ixgbe_mac_82598EB) { in ixgbe_max_channels()
3240 } else if (adapter->atr_sample_rate) { in ixgbe_max_channels()
3257 ch->max_combined = ixgbe_max_channels(adapter); in ixgbe_get_channels()
3260 if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { in ixgbe_get_channels()
3261 ch->max_other = NON_Q_VECTORS; in ixgbe_get_channels()
3262 ch->other_count = NON_Q_VECTORS; in ixgbe_get_channels()
3266 ch->combined_count = adapter->ring_feature[RING_F_RSS].indices; in ixgbe_get_channels()
3269 if (ch->combined_count == 1) in ixgbe_get_channels()
3272 /* we do not support ATR queueing if SR-IOV is enabled */ in ixgbe_get_channels()
3273 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) in ixgbe_get_channels()
3277 if (adapter->hw_tcs > 1) in ixgbe_get_channels()
3281 if (!adapter->atr_sample_rate) in ixgbe_get_channels()
3285 ch->combined_count = adapter->ring_feature[RING_F_FDIR].indices; in ixgbe_get_channels()
3292 unsigned int count = ch->combined_count; in ixgbe_set_channels()
3296 if (!count || ch->rx_count || ch->tx_count) in ixgbe_set_channels()
3297 return -EINVAL; in ixgbe_set_channels()
3300 if (ch->other_count != NON_Q_VECTORS) in ixgbe_set_channels()
3301 return -EINVAL; in ixgbe_set_channels()
3305 return -EINVAL; in ixgbe_set_channels()
3308 adapter->ring_feature[RING_F_FDIR].limit = count; in ixgbe_set_channels()
3313 adapter->ring_feature[RING_F_RSS].limit = count; in ixgbe_set_channels()
3319 adapter->ring_feature[RING_F_FCOE].limit = count; in ixgbe_set_channels()
3323 return ixgbe_setup_tc(dev, adapter->hw_tcs); in ixgbe_set_channels()
3330 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_module_info()
3335 if (hw->phy.type == ixgbe_phy_fw) in ixgbe_get_module_info()
3336 return -ENXIO; in ixgbe_get_module_info()
3338 /* Check whether we support SFF-8472 or not */ in ixgbe_get_module_info()
3339 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_get_module_info()
3343 return -EIO; in ixgbe_get_module_info()
3346 status = hw->phy.ops.read_i2c_eeprom(hw, in ixgbe_get_module_info()
3350 return -EIO; in ixgbe_get_module_info()
3359 /* We have a SFP, but it does not support SFF-8472 */ in ixgbe_get_module_info()
3360 modinfo->type = ETH_MODULE_SFF_8079; in ixgbe_get_module_info()
3361 modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN; in ixgbe_get_module_info()
3363 /* We have a SFP which supports a revision of SFF-8472. */ in ixgbe_get_module_info()
3364 modinfo->type = ETH_MODULE_SFF_8472; in ixgbe_get_module_info()
3365 modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; in ixgbe_get_module_info()
3376 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_module_eeprom()
3377 int status = -EFAULT; in ixgbe_get_module_eeprom()
3381 if (ee->len == 0) in ixgbe_get_module_eeprom()
3382 return -EINVAL; in ixgbe_get_module_eeprom()
3384 if (hw->phy.type == ixgbe_phy_fw) in ixgbe_get_module_eeprom()
3385 return -ENXIO; in ixgbe_get_module_eeprom()
3387 for (i = ee->offset; i < ee->offset + ee->len; i++) { in ixgbe_get_module_eeprom()
3389 if (test_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) in ixgbe_get_module_eeprom()
3390 return -EBUSY; in ixgbe_get_module_eeprom()
3393 status = hw->phy.ops.read_i2c_eeprom(hw, i, &databyte); in ixgbe_get_module_eeprom()
3395 status = hw->phy.ops.read_i2c_sff8472(hw, i, &databyte); in ixgbe_get_module_eeprom()
3398 return -EIO; in ixgbe_get_module_eeprom()
3400 data[i - ee->offset] = databyte; in ixgbe_get_module_eeprom()
3434 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eee_fw()
3445 edata->lp_advertised); in ixgbe_get_eee_fw()
3449 if (hw->phy.eee_speeds_supported & ixgbe_ls_map[i].mac_speed) in ixgbe_get_eee_fw()
3451 edata->supported); in ixgbe_get_eee_fw()
3455 if (hw->phy.eee_speeds_advertised & ixgbe_ls_map[i].mac_speed) in ixgbe_get_eee_fw()
3457 edata->advertised); in ixgbe_get_eee_fw()
3460 edata->eee_enabled = !linkmode_empty(edata->advertised); in ixgbe_get_eee_fw()
3461 edata->tx_lpi_enabled = edata->eee_enabled; in ixgbe_get_eee_fw()
3463 linkmode_and(common, edata->advertised, edata->lp_advertised); in ixgbe_get_eee_fw()
3464 edata->eee_active = !linkmode_empty(common); in ixgbe_get_eee_fw()
3472 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_get_eee()
3474 if (!(adapter->flags2 & IXGBE_FLAG2_EEE_CAPABLE)) in ixgbe_get_eee()
3475 return -EOPNOTSUPP; in ixgbe_get_eee()
3477 if (hw->phy.eee_speeds_supported && hw->phy.type == ixgbe_phy_fw) in ixgbe_get_eee()
3480 return -EOPNOTSUPP; in ixgbe_get_eee()
3486 struct ixgbe_hw *hw = &adapter->hw; in ixgbe_set_eee()
3490 if (!(adapter->flags2 & IXGBE_FLAG2_EEE_CAPABLE)) in ixgbe_set_eee()
3491 return -EOPNOTSUPP; in ixgbe_set_eee()
3499 if (eee_data.eee_enabled && !edata->eee_enabled) { in ixgbe_set_eee()
3500 if (eee_data.tx_lpi_enabled != edata->tx_lpi_enabled) { in ixgbe_set_eee()
3501 e_err(drv, "Setting EEE tx-lpi is not supported\n"); in ixgbe_set_eee()
3502 return -EINVAL; in ixgbe_set_eee()
3505 if (eee_data.tx_lpi_timer != edata->tx_lpi_timer) { in ixgbe_set_eee()
3508 return -EINVAL; in ixgbe_set_eee()
3511 if (!linkmode_equal(eee_data.advertised, edata->advertised)) { in ixgbe_set_eee()
3514 return -EINVAL; in ixgbe_set_eee()
3518 if (eee_data.eee_enabled != edata->eee_enabled) { in ixgbe_set_eee()
3519 if (edata->eee_enabled) { in ixgbe_set_eee()
3520 adapter->flags2 |= IXGBE_FLAG2_EEE_ENABLED; in ixgbe_set_eee()
3521 hw->phy.eee_speeds_advertised = in ixgbe_set_eee()
3522 hw->phy.eee_speeds_supported; in ixgbe_set_eee()
3524 adapter->flags2 &= ~IXGBE_FLAG2_EEE_ENABLED; in ixgbe_set_eee()
3525 hw->phy.eee_speeds_advertised = 0; in ixgbe_set_eee()
3543 if (adapter->flags2 & IXGBE_FLAG2_RX_LEGACY) in ixgbe_get_priv_flags()
3546 if (adapter->flags2 & IXGBE_FLAG2_VF_IPSEC_ENABLED) in ixgbe_get_priv_flags()
3549 if (adapter->flags2 & IXGBE_FLAG2_AUTO_DISABLE_VF) in ixgbe_get_priv_flags()
3558 unsigned int flags2 = adapter->flags2; in ixgbe_set_priv_flags()
3571 if (adapter->hw.mac.type == ixgbe_mac_82599EB) { in ixgbe_set_priv_flags()
3573 for (i = 0; i < adapter->num_vfs; i++) in ixgbe_set_priv_flags()
3574 adapter->vfinfo[i].primary_abort_count = 0; in ixgbe_set_priv_flags()
3580 return -EOPNOTSUPP; in ixgbe_set_priv_flags()
3584 if (flags2 != adapter->flags2) { in ixgbe_set_priv_flags()
3585 adapter->flags2 = flags2; in ixgbe_set_priv_flags()
3642 netdev->ethtool_ops = &ixgbe_ethtool_ops; in ixgbe_set_ethtool_ops()