Lines Matching +full:mac +full:- +full:phy +full:- +full:ctrl
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
28 "s0ix-enabled",
36 .sizeof_stat = sizeof(((struct e1000_adapter *)0)->m), \
41 .sizeof_stat = sizeof(((struct rtnl_link_stats64 *)0)->m), \
115 struct e1000_hw *hw = &adapter->hw; in e1000_get_link_ksettings()
117 if (hw->phy.media_type == e1000_media_type_copper) { in e1000_get_link_ksettings()
127 if (hw->phy.type == e1000_phy_ife) in e1000_get_link_ksettings()
131 if (hw->mac.autoneg == 1) { in e1000_get_link_ksettings()
134 advertising |= hw->phy.autoneg_advertised; in e1000_get_link_ksettings()
137 cmd->base.port = PORT_TP; in e1000_get_link_ksettings()
138 cmd->base.phy_address = hw->phy.addr; in e1000_get_link_ksettings()
148 cmd->base.port = PORT_FIBRE; in e1000_get_link_ksettings()
152 cmd->base.duplex = DUPLEX_UNKNOWN; in e1000_get_link_ksettings()
156 speed = adapter->link_speed; in e1000_get_link_ksettings()
157 cmd->base.duplex = adapter->link_duplex - 1; in e1000_get_link_ksettings()
159 } else if (!pm_runtime_suspended(netdev->dev.parent)) { in e1000_get_link_ksettings()
171 cmd->base.duplex = DUPLEX_FULL; in e1000_get_link_ksettings()
173 cmd->base.duplex = DUPLEX_HALF; in e1000_get_link_ksettings()
177 cmd->base.speed = speed; in e1000_get_link_ksettings()
178 cmd->base.autoneg = ((hw->phy.media_type == e1000_media_type_fiber) || in e1000_get_link_ksettings()
179 hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE; in e1000_get_link_ksettings()
181 /* MDI-X => 2; MDI =>1; Invalid =>0 */ in e1000_get_link_ksettings()
182 if ((hw->phy.media_type == e1000_media_type_copper) && in e1000_get_link_ksettings()
184 cmd->base.eth_tp_mdix = hw->phy.is_mdix ? in e1000_get_link_ksettings()
187 cmd->base.eth_tp_mdix = ETH_TP_MDI_INVALID; in e1000_get_link_ksettings()
189 if (hw->phy.mdix == AUTO_ALL_MODES) in e1000_get_link_ksettings()
190 cmd->base.eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO; in e1000_get_link_ksettings()
192 cmd->base.eth_tp_mdix_ctrl = hw->phy.mdix; in e1000_get_link_ksettings()
194 if (hw->phy.media_type != e1000_media_type_copper) in e1000_get_link_ksettings()
195 cmd->base.eth_tp_mdix_ctrl = ETH_TP_MDI_INVALID; in e1000_get_link_ksettings()
197 lpa_t = mii_stat1000_to_ethtool_lpa_t(adapter->phy_regs.stat1000); in e1000_get_link_ksettings()
199 mii_lpa_to_ethtool_lpa_t(adapter->phy_regs.lpa); in e1000_get_link_ksettings()
201 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, in e1000_get_link_ksettings()
203 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising, in e1000_get_link_ksettings()
205 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.lp_advertising, in e1000_get_link_ksettings()
213 struct e1000_mac_info *mac = &adapter->hw.mac; in e1000_set_spd_dplx() local
215 mac->autoneg = 0; in e1000_set_spd_dplx()
224 if ((adapter->hw.phy.media_type == e1000_media_type_fiber) && in e1000_set_spd_dplx()
231 mac->forced_speed_duplex = ADVERTISE_10_HALF; in e1000_set_spd_dplx()
234 mac->forced_speed_duplex = ADVERTISE_10_FULL; in e1000_set_spd_dplx()
237 mac->forced_speed_duplex = ADVERTISE_100_HALF; in e1000_set_spd_dplx()
240 mac->forced_speed_duplex = ADVERTISE_100_FULL; in e1000_set_spd_dplx()
243 if (adapter->hw.phy.media_type == e1000_media_type_copper) { in e1000_set_spd_dplx()
244 mac->autoneg = 1; in e1000_set_spd_dplx()
245 adapter->hw.phy.autoneg_advertised = in e1000_set_spd_dplx()
248 mac->forced_speed_duplex = ADVERTISE_1000_FULL; in e1000_set_spd_dplx()
256 /* clear MDI, MDI(-X) override is only allowed when autoneg enabled */ in e1000_set_spd_dplx()
257 adapter->hw.phy.mdix = AUTO_ALL_MODES; in e1000_set_spd_dplx()
263 return -EINVAL; in e1000_set_spd_dplx()
270 struct e1000_hw *hw = &adapter->hw; in e1000_set_link_ksettings()
275 cmd->link_modes.advertising); in e1000_set_link_ksettings()
277 pm_runtime_get_sync(netdev->dev.parent); in e1000_set_link_ksettings()
282 if (hw->phy.ops.check_reset_block && in e1000_set_link_ksettings()
283 hw->phy.ops.check_reset_block(hw)) { in e1000_set_link_ksettings()
285 ret_val = -EINVAL; in e1000_set_link_ksettings()
293 if (cmd->base.eth_tp_mdix_ctrl) { in e1000_set_link_ksettings()
294 if (hw->phy.media_type != e1000_media_type_copper) { in e1000_set_link_ksettings()
295 ret_val = -EOPNOTSUPP; in e1000_set_link_ksettings()
299 if ((cmd->base.eth_tp_mdix_ctrl != ETH_TP_MDI_AUTO) && in e1000_set_link_ksettings()
300 (cmd->base.autoneg != AUTONEG_ENABLE)) { in e1000_set_link_ksettings()
301 e_err("forcing MDI/MDI-X state is not supported when link speed and/or duplex are forced\n"); in e1000_set_link_ksettings()
302 ret_val = -EINVAL; in e1000_set_link_ksettings()
307 while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) in e1000_set_link_ksettings()
310 if (cmd->base.autoneg == AUTONEG_ENABLE) { in e1000_set_link_ksettings()
311 hw->mac.autoneg = 1; in e1000_set_link_ksettings()
312 if (hw->phy.media_type == e1000_media_type_fiber) in e1000_set_link_ksettings()
313 hw->phy.autoneg_advertised = ADVERTISED_1000baseT_Full | in e1000_set_link_ksettings()
316 hw->phy.autoneg_advertised = advertising | in e1000_set_link_ksettings()
318 advertising = hw->phy.autoneg_advertised; in e1000_set_link_ksettings()
319 if (adapter->fc_autoneg) in e1000_set_link_ksettings()
320 hw->fc.requested_mode = e1000_fc_default; in e1000_set_link_ksettings()
322 u32 speed = cmd->base.speed; in e1000_set_link_ksettings()
324 if (e1000_set_spd_dplx(adapter, speed, cmd->base.duplex)) { in e1000_set_link_ksettings()
325 ret_val = -EINVAL; in e1000_set_link_ksettings()
330 /* MDI-X => 2; MDI => 1; Auto => 3 */ in e1000_set_link_ksettings()
331 if (cmd->base.eth_tp_mdix_ctrl) { in e1000_set_link_ksettings()
335 if (cmd->base.eth_tp_mdix_ctrl == ETH_TP_MDI_AUTO) in e1000_set_link_ksettings()
336 hw->phy.mdix = AUTO_ALL_MODES; in e1000_set_link_ksettings()
338 hw->phy.mdix = cmd->base.eth_tp_mdix_ctrl; in e1000_set_link_ksettings()
342 if (netif_running(adapter->netdev)) { in e1000_set_link_ksettings()
350 pm_runtime_put_sync(netdev->dev.parent); in e1000_set_link_ksettings()
351 clear_bit(__E1000_RESETTING, &adapter->state); in e1000_set_link_ksettings()
359 struct e1000_hw *hw = &adapter->hw; in e1000_get_pauseparam()
361 pause->autoneg = in e1000_get_pauseparam()
362 (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); in e1000_get_pauseparam()
364 if (hw->fc.current_mode == e1000_fc_rx_pause) { in e1000_get_pauseparam()
365 pause->rx_pause = 1; in e1000_get_pauseparam()
366 } else if (hw->fc.current_mode == e1000_fc_tx_pause) { in e1000_get_pauseparam()
367 pause->tx_pause = 1; in e1000_get_pauseparam()
368 } else if (hw->fc.current_mode == e1000_fc_full) { in e1000_get_pauseparam()
369 pause->rx_pause = 1; in e1000_get_pauseparam()
370 pause->tx_pause = 1; in e1000_get_pauseparam()
378 struct e1000_hw *hw = &adapter->hw; in e1000_set_pauseparam()
381 adapter->fc_autoneg = pause->autoneg; in e1000_set_pauseparam()
383 while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) in e1000_set_pauseparam()
386 pm_runtime_get_sync(netdev->dev.parent); in e1000_set_pauseparam()
388 if (adapter->fc_autoneg == AUTONEG_ENABLE) { in e1000_set_pauseparam()
389 hw->fc.requested_mode = e1000_fc_default; in e1000_set_pauseparam()
390 if (netif_running(adapter->netdev)) { in e1000_set_pauseparam()
397 if (pause->rx_pause && pause->tx_pause) in e1000_set_pauseparam()
398 hw->fc.requested_mode = e1000_fc_full; in e1000_set_pauseparam()
399 else if (pause->rx_pause && !pause->tx_pause) in e1000_set_pauseparam()
400 hw->fc.requested_mode = e1000_fc_rx_pause; in e1000_set_pauseparam()
401 else if (!pause->rx_pause && pause->tx_pause) in e1000_set_pauseparam()
402 hw->fc.requested_mode = e1000_fc_tx_pause; in e1000_set_pauseparam()
403 else if (!pause->rx_pause && !pause->tx_pause) in e1000_set_pauseparam()
404 hw->fc.requested_mode = e1000_fc_none; in e1000_set_pauseparam()
406 hw->fc.current_mode = hw->fc.requested_mode; in e1000_set_pauseparam()
408 if (hw->phy.media_type == e1000_media_type_fiber) { in e1000_set_pauseparam()
409 retval = hw->mac.ops.setup_link(hw); in e1000_set_pauseparam()
420 pm_runtime_put_sync(netdev->dev.parent); in e1000_set_pauseparam()
421 clear_bit(__E1000_RESETTING, &adapter->state); in e1000_set_pauseparam()
428 return adapter->msg_enable; in e1000_get_msglevel()
434 adapter->msg_enable = data; in e1000_set_msglevel()
447 struct e1000_hw *hw = &adapter->hw; in e1000_get_regs()
451 pm_runtime_get_sync(netdev->dev.parent); in e1000_get_regs()
455 regs->version = (1u << 24) | in e1000_get_regs()
456 (adapter->pdev->revision << 16) | in e1000_get_regs()
457 adapter->pdev->device; in e1000_get_regs()
459 regs_buff[0] = er32(CTRL); in e1000_get_regs()
474 regs_buff[12] = adapter->hw.phy.type; /* PHY type (IGP=1, M88=0) */ in e1000_get_regs()
479 if (hw->phy.type == e1000_phy_m88) { in e1000_get_regs()
482 regs_buff[14] = 0; /* Dummy (to align w/ IGP phy reg dump) */ in e1000_get_regs()
483 regs_buff[15] = 0; /* Dummy (to align w/ IGP phy reg dump) */ in e1000_get_regs()
484 regs_buff[16] = 0; /* Dummy (to align w/ IGP phy reg dump) */ in e1000_get_regs()
488 regs_buff[19] = 0; /* Dummy (to align w/ IGP phy reg dump) */ in e1000_get_regs()
490 /* phy receive errors */ in e1000_get_regs()
491 regs_buff[22] = adapter->phy_stats.receive_errors; in e1000_get_regs()
496 regs_buff[24] = (u32)phy_data; /* phy local receiver status */ in e1000_get_regs()
497 regs_buff[25] = regs_buff[24]; /* phy remote receiver status */ in e1000_get_regs()
499 pm_runtime_put_sync(netdev->dev.parent); in e1000_get_regs()
505 return adapter->hw.nvm.word_size * 2; in e1000_get_eeprom_len()
512 struct e1000_hw *hw = &adapter->hw; in e1000_get_eeprom()
519 if (eeprom->len == 0) in e1000_get_eeprom()
520 return -EINVAL; in e1000_get_eeprom()
522 eeprom->magic = adapter->pdev->vendor | (adapter->pdev->device << 16); in e1000_get_eeprom()
524 first_word = eeprom->offset >> 1; in e1000_get_eeprom()
525 last_word = (eeprom->offset + eeprom->len - 1) >> 1; in e1000_get_eeprom()
527 eeprom_buff = kmalloc_array(last_word - first_word + 1, sizeof(u16), in e1000_get_eeprom()
530 return -ENOMEM; in e1000_get_eeprom()
532 pm_runtime_get_sync(netdev->dev.parent); in e1000_get_eeprom()
534 if (hw->nvm.type == e1000_nvm_eeprom_spi) { in e1000_get_eeprom()
536 last_word - first_word + 1, in e1000_get_eeprom()
539 for (i = 0; i < last_word - first_word + 1; i++) { in e1000_get_eeprom()
547 pm_runtime_put_sync(netdev->dev.parent); in e1000_get_eeprom()
552 (last_word - first_word + 1)); in e1000_get_eeprom()
554 /* Device's eeprom is always little-endian, word addressable */ in e1000_get_eeprom()
555 for (i = 0; i < last_word - first_word + 1; i++) in e1000_get_eeprom()
559 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 1), eeprom->len); in e1000_get_eeprom()
569 struct e1000_hw *hw = &adapter->hw; in e1000_set_eeprom()
578 if (eeprom->len == 0) in e1000_set_eeprom()
579 return -EOPNOTSUPP; in e1000_set_eeprom()
581 if (eeprom->magic != in e1000_set_eeprom()
582 (adapter->pdev->vendor | (adapter->pdev->device << 16))) in e1000_set_eeprom()
583 return -EFAULT; in e1000_set_eeprom()
585 if (adapter->flags & FLAG_READ_ONLY_NVM) in e1000_set_eeprom()
586 return -EINVAL; in e1000_set_eeprom()
588 max_len = hw->nvm.word_size * 2; in e1000_set_eeprom()
590 first_word = eeprom->offset >> 1; in e1000_set_eeprom()
591 last_word = (eeprom->offset + eeprom->len - 1) >> 1; in e1000_set_eeprom()
594 return -ENOMEM; in e1000_set_eeprom()
598 pm_runtime_get_sync(netdev->dev.parent); in e1000_set_eeprom()
600 if (eeprom->offset & 1) { in e1000_set_eeprom()
606 if (((eeprom->offset + eeprom->len) & 1) && (!ret_val)) in e1000_set_eeprom()
610 &eeprom_buff[last_word - first_word]); in e1000_set_eeprom()
615 /* Device's eeprom is always little-endian, word addressable */ in e1000_set_eeprom()
616 for (i = 0; i < last_word - first_word + 1; i++) in e1000_set_eeprom()
619 memcpy(ptr, bytes, eeprom->len); in e1000_set_eeprom()
621 for (i = 0; i < last_word - first_word + 1; i++) in e1000_set_eeprom()
625 last_word - first_word + 1, eeprom_buff); in e1000_set_eeprom()
634 (hw->mac.type == e1000_82583) || in e1000_set_eeprom()
635 (hw->mac.type == e1000_82574) || in e1000_set_eeprom()
636 (hw->mac.type == e1000_82573)) in e1000_set_eeprom()
640 pm_runtime_put_sync(netdev->dev.parent); in e1000_set_eeprom()
650 strscpy(drvinfo->driver, e1000e_driver_name, sizeof(drvinfo->driver)); in e1000_get_drvinfo()
653 * PCI-E controllers in e1000_get_drvinfo()
655 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), in e1000_get_drvinfo()
656 "%d.%d-%d", in e1000_get_drvinfo()
657 FIELD_GET(0xF000, adapter->eeprom_vers), in e1000_get_drvinfo()
658 FIELD_GET(0x0FF0, adapter->eeprom_vers), in e1000_get_drvinfo()
659 (adapter->eeprom_vers & 0x000F)); in e1000_get_drvinfo()
661 strscpy(drvinfo->bus_info, pci_name(adapter->pdev), in e1000_get_drvinfo()
662 sizeof(drvinfo->bus_info)); in e1000_get_drvinfo()
672 ring->rx_max_pending = E1000_MAX_RXD; in e1000_get_ringparam()
673 ring->tx_max_pending = E1000_MAX_TXD; in e1000_get_ringparam()
674 ring->rx_pending = adapter->rx_ring_count; in e1000_get_ringparam()
675 ring->tx_pending = adapter->tx_ring_count; in e1000_get_ringparam()
689 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) in e1000_set_ringparam()
690 return -EINVAL; in e1000_set_ringparam()
692 new_rx_count = clamp_t(u32, ring->rx_pending, E1000_MIN_RXD, in e1000_set_ringparam()
696 new_tx_count = clamp_t(u32, ring->tx_pending, E1000_MIN_TXD, in e1000_set_ringparam()
700 if ((new_tx_count == adapter->tx_ring_count) && in e1000_set_ringparam()
701 (new_rx_count == adapter->rx_ring_count)) in e1000_set_ringparam()
705 while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) in e1000_set_ringparam()
708 if (!netif_running(adapter->netdev)) { in e1000_set_ringparam()
710 adapter->tx_ring->count = new_tx_count; in e1000_set_ringparam()
711 adapter->rx_ring->count = new_rx_count; in e1000_set_ringparam()
712 adapter->tx_ring_count = new_tx_count; in e1000_set_ringparam()
713 adapter->rx_ring_count = new_rx_count; in e1000_set_ringparam()
717 set_tx = (new_tx_count != adapter->tx_ring_count); in e1000_set_ringparam()
718 set_rx = (new_rx_count != adapter->rx_ring_count); in e1000_set_ringparam()
724 err = -ENOMEM; in e1000_set_ringparam()
731 err = -ENOMEM; in e1000_set_ringparam()
736 pm_runtime_get_sync(netdev->dev.parent); in e1000_set_ringparam()
741 * ISRs in MSI-X mode get passed pointers to the Tx and Rx ring in e1000_set_ringparam()
745 memcpy(temp_tx, adapter->tx_ring, size); in e1000_set_ringparam()
746 temp_tx->count = new_tx_count; in e1000_set_ringparam()
752 memcpy(temp_rx, adapter->rx_ring, size); in e1000_set_ringparam()
753 temp_rx->count = new_rx_count; in e1000_set_ringparam()
761 e1000e_free_tx_resources(adapter->tx_ring); in e1000_set_ringparam()
762 memcpy(adapter->tx_ring, temp_tx, size); in e1000_set_ringparam()
763 adapter->tx_ring_count = new_tx_count; in e1000_set_ringparam()
766 e1000e_free_rx_resources(adapter->rx_ring); in e1000_set_ringparam()
767 memcpy(adapter->rx_ring, temp_rx, size); in e1000_set_ringparam()
768 adapter->rx_ring_count = new_rx_count; in e1000_set_ringparam()
776 pm_runtime_put_sync(netdev->dev.parent); in e1000_set_ringparam()
781 clear_bit(__E1000_RESETTING, &adapter->state); in e1000_set_ringparam()
793 E1000_WRITE_REG_ARRAY(&adapter->hw, reg, offset, in reg_pattern_test()
795 val = E1000_READ_REG_ARRAY(&adapter->hw, reg, offset); in reg_pattern_test()
812 __ew32(&adapter->hw, reg, write & mask); in reg_set_and_check()
813 val = __er32(&adapter->hw, reg); in reg_set_and_check()
839 struct e1000_hw *hw = &adapter->hw; in e1000_reg_test()
840 struct e1000_mac_info *mac = &adapter->hw.mac; in e1000_reg_test() local
853 switch (mac->type) { in e1000_reg_test()
877 if (!(adapter->flags & FLAG_IS_ICH)) { in e1000_reg_test()
897 before = ((adapter->flags & FLAG_IS_ICH) ? 0x06C3B33E : 0x06DFB3FE); in e1000_reg_test()
903 if (!(adapter->flags & FLAG_IS_ICH)) in e1000_reg_test()
908 switch (mac->type) { in e1000_reg_test()
927 if (mac->type >= e1000_pch_lpt) in e1000_reg_test()
930 for (i = 0; i < mac->rar_entry_count; i++) { in e1000_reg_test()
931 if (mac->type >= e1000_pch_lpt) { in e1000_reg_test()
932 /* Cannot test write-protected SHRAL[n] registers */ in e1000_reg_test()
942 if (mac->type == e1000_pch2lan) { in e1000_reg_test()
949 /* RAR[1-6] owned by management engine - skipping */ in e1000_reg_test()
957 if ((mac->type == e1000_pch2lan) && (i > 6)) in e1000_reg_test()
958 i -= 6; in e1000_reg_test()
961 for (i = 0; i < mac->mta_reg_count; i++) in e1000_reg_test()
978 if ((e1000_read_nvm(&adapter->hw, i, 1, &temp)) < 0) { in e1000_eeprom_test()
996 struct e1000_hw *hw = &adapter->hw; in e1000_test_intr()
998 adapter->test_icr |= er32(ICR); in e1000_test_intr()
1005 struct net_device *netdev = adapter->netdev; in e1000_intr_test()
1006 struct e1000_hw *hw = &adapter->hw; in e1000_intr_test()
1009 u32 irq = adapter->pdev->irq; in e1000_intr_test()
1016 /* NOTE: we don't test MSI/MSI-X interrupts here, yet */ in e1000_intr_test()
1017 if (adapter->int_mode == E1000E_INT_MODE_MSIX) { in e1000_intr_test()
1018 int_mode = adapter->int_mode; in e1000_intr_test()
1020 adapter->int_mode = E1000E_INT_MODE_LEGACY; in e1000_intr_test()
1024 if (!request_irq(irq, e1000_test_intr, IRQF_PROBE_SHARED, netdev->name, in e1000_intr_test()
1027 } else if (request_irq(irq, e1000_test_intr, IRQF_SHARED, netdev->name, in e1000_intr_test()
1030 ret_val = -1; in e1000_intr_test()
1045 if (adapter->flags & FLAG_IS_ICH) { in e1000_intr_test()
1050 if (adapter->hw.mac.type == e1000_ich8lan || in e1000_intr_test()
1051 adapter->hw.mac.type == e1000_ich9lan) in e1000_intr_test()
1066 adapter->test_icr = 0; in e1000_intr_test()
1072 if (adapter->test_icr & mask) { in e1000_intr_test()
1084 adapter->test_icr = 0; in e1000_intr_test()
1090 if (!(adapter->test_icr & mask)) { in e1000_intr_test()
1102 adapter->test_icr = 0; in e1000_intr_test()
1108 if (adapter->test_icr) { in e1000_intr_test()
1126 adapter->int_mode = int_mode; in e1000_intr_test()
1135 struct e1000_ring *tx_ring = &adapter->test_tx_ring; in e1000_free_desc_rings()
1136 struct e1000_ring *rx_ring = &adapter->test_rx_ring; in e1000_free_desc_rings()
1137 struct pci_dev *pdev = adapter->pdev; in e1000_free_desc_rings()
1141 if (tx_ring->desc && tx_ring->buffer_info) { in e1000_free_desc_rings()
1142 for (i = 0; i < tx_ring->count; i++) { in e1000_free_desc_rings()
1143 buffer_info = &tx_ring->buffer_info[i]; in e1000_free_desc_rings()
1145 if (buffer_info->dma) in e1000_free_desc_rings()
1146 dma_unmap_single(&pdev->dev, in e1000_free_desc_rings()
1147 buffer_info->dma, in e1000_free_desc_rings()
1148 buffer_info->length, in e1000_free_desc_rings()
1150 dev_kfree_skb(buffer_info->skb); in e1000_free_desc_rings()
1154 if (rx_ring->desc && rx_ring->buffer_info) { in e1000_free_desc_rings()
1155 for (i = 0; i < rx_ring->count; i++) { in e1000_free_desc_rings()
1156 buffer_info = &rx_ring->buffer_info[i]; in e1000_free_desc_rings()
1158 if (buffer_info->dma) in e1000_free_desc_rings()
1159 dma_unmap_single(&pdev->dev, in e1000_free_desc_rings()
1160 buffer_info->dma, in e1000_free_desc_rings()
1162 dev_kfree_skb(buffer_info->skb); in e1000_free_desc_rings()
1166 if (tx_ring->desc) { in e1000_free_desc_rings()
1167 dma_free_coherent(&pdev->dev, tx_ring->size, tx_ring->desc, in e1000_free_desc_rings()
1168 tx_ring->dma); in e1000_free_desc_rings()
1169 tx_ring->desc = NULL; in e1000_free_desc_rings()
1171 if (rx_ring->desc) { in e1000_free_desc_rings()
1172 dma_free_coherent(&pdev->dev, rx_ring->size, rx_ring->desc, in e1000_free_desc_rings()
1173 rx_ring->dma); in e1000_free_desc_rings()
1174 rx_ring->desc = NULL; in e1000_free_desc_rings()
1177 kfree(tx_ring->buffer_info); in e1000_free_desc_rings()
1178 tx_ring->buffer_info = NULL; in e1000_free_desc_rings()
1179 kfree(rx_ring->buffer_info); in e1000_free_desc_rings()
1180 rx_ring->buffer_info = NULL; in e1000_free_desc_rings()
1185 struct e1000_ring *tx_ring = &adapter->test_tx_ring; in e1000_setup_desc_rings()
1186 struct e1000_ring *rx_ring = &adapter->test_rx_ring; in e1000_setup_desc_rings()
1187 struct pci_dev *pdev = adapter->pdev; in e1000_setup_desc_rings()
1188 struct e1000_hw *hw = &adapter->hw; in e1000_setup_desc_rings()
1195 if (!tx_ring->count) in e1000_setup_desc_rings()
1196 tx_ring->count = E1000_DEFAULT_TXD; in e1000_setup_desc_rings()
1198 tx_ring->buffer_info = kcalloc(tx_ring->count, in e1000_setup_desc_rings()
1200 if (!tx_ring->buffer_info) { in e1000_setup_desc_rings()
1205 tx_ring->size = tx_ring->count * sizeof(struct e1000_tx_desc); in e1000_setup_desc_rings()
1206 tx_ring->size = ALIGN(tx_ring->size, 4096); in e1000_setup_desc_rings()
1207 tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size, in e1000_setup_desc_rings()
1208 &tx_ring->dma, GFP_KERNEL); in e1000_setup_desc_rings()
1209 if (!tx_ring->desc) { in e1000_setup_desc_rings()
1213 tx_ring->next_to_use = 0; in e1000_setup_desc_rings()
1214 tx_ring->next_to_clean = 0; in e1000_setup_desc_rings()
1216 ew32(TDBAL(0), ((u64)tx_ring->dma & 0x00000000FFFFFFFF)); in e1000_setup_desc_rings()
1217 ew32(TDBAH(0), ((u64)tx_ring->dma >> 32)); in e1000_setup_desc_rings()
1218 ew32(TDLEN(0), tx_ring->count * sizeof(struct e1000_tx_desc)); in e1000_setup_desc_rings()
1225 for (i = 0; i < tx_ring->count; i++) { in e1000_setup_desc_rings()
1236 tx_ring->buffer_info[i].skb = skb; in e1000_setup_desc_rings()
1237 tx_ring->buffer_info[i].length = skb->len; in e1000_setup_desc_rings()
1238 tx_ring->buffer_info[i].dma = in e1000_setup_desc_rings()
1239 dma_map_single(&pdev->dev, skb->data, skb->len, in e1000_setup_desc_rings()
1241 if (dma_mapping_error(&pdev->dev, in e1000_setup_desc_rings()
1242 tx_ring->buffer_info[i].dma)) { in e1000_setup_desc_rings()
1246 tx_desc->buffer_addr = cpu_to_le64(tx_ring->buffer_info[i].dma); in e1000_setup_desc_rings()
1247 tx_desc->lower.data = cpu_to_le32(skb->len); in e1000_setup_desc_rings()
1248 tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP | in e1000_setup_desc_rings()
1251 tx_desc->upper.data = 0; in e1000_setup_desc_rings()
1256 if (!rx_ring->count) in e1000_setup_desc_rings()
1257 rx_ring->count = E1000_DEFAULT_RXD; in e1000_setup_desc_rings()
1259 rx_ring->buffer_info = kcalloc(rx_ring->count, in e1000_setup_desc_rings()
1261 if (!rx_ring->buffer_info) { in e1000_setup_desc_rings()
1266 rx_ring->size = rx_ring->count * sizeof(union e1000_rx_desc_extended); in e1000_setup_desc_rings()
1267 rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size, in e1000_setup_desc_rings()
1268 &rx_ring->dma, GFP_KERNEL); in e1000_setup_desc_rings()
1269 if (!rx_ring->desc) { in e1000_setup_desc_rings()
1273 rx_ring->next_to_use = 0; in e1000_setup_desc_rings()
1274 rx_ring->next_to_clean = 0; in e1000_setup_desc_rings()
1277 if (!(adapter->flags2 & FLAG2_NO_DISABLE_RX)) in e1000_setup_desc_rings()
1279 ew32(RDBAL(0), ((u64)rx_ring->dma & 0xFFFFFFFF)); in e1000_setup_desc_rings()
1280 ew32(RDBAH(0), ((u64)rx_ring->dma >> 32)); in e1000_setup_desc_rings()
1281 ew32(RDLEN(0), rx_ring->size); in e1000_setup_desc_rings()
1288 (adapter->hw.mac.mc_filter_type << E1000_RCTL_MO_SHIFT); in e1000_setup_desc_rings()
1291 for (i = 0; i < rx_ring->count; i++) { in e1000_setup_desc_rings()
1301 rx_ring->buffer_info[i].skb = skb; in e1000_setup_desc_rings()
1302 rx_ring->buffer_info[i].dma = in e1000_setup_desc_rings()
1303 dma_map_single(&pdev->dev, skb->data, 2048, in e1000_setup_desc_rings()
1305 if (dma_mapping_error(&pdev->dev, in e1000_setup_desc_rings()
1306 rx_ring->buffer_info[i].dma)) { in e1000_setup_desc_rings()
1311 rx_desc->read.buffer_addr = in e1000_setup_desc_rings()
1312 cpu_to_le64(rx_ring->buffer_info[i].dma); in e1000_setup_desc_rings()
1313 memset(skb->data, 0x00, skb->len); in e1000_setup_desc_rings()
1325 /* Write out to PHY registers 29 and 30 to disable the Receiver. */ in e1000_phy_disable_receiver()
1326 e1e_wphy(&adapter->hw, 29, 0x001F); in e1000_phy_disable_receiver()
1327 e1e_wphy(&adapter->hw, 30, 0x8FFC); in e1000_phy_disable_receiver()
1328 e1e_wphy(&adapter->hw, 29, 0x001A); in e1000_phy_disable_receiver()
1329 e1e_wphy(&adapter->hw, 30, 0x8FF0); in e1000_phy_disable_receiver()
1334 struct e1000_hw *hw = &adapter->hw; in e1000_integrated_phy_loopback()
1339 hw->mac.autoneg = 0; in e1000_integrated_phy_loopback()
1341 if (hw->phy.type == e1000_phy_ife) { in e1000_integrated_phy_loopback()
1345 /* Now set up the MAC to the same speed/duplex as the PHY. */ in e1000_integrated_phy_loopback()
1346 ctrl_reg = er32(CTRL); in e1000_integrated_phy_loopback()
1353 ew32(CTRL, ctrl_reg); in e1000_integrated_phy_loopback()
1360 /* Specific PHY configuration for loopback */ in e1000_integrated_phy_loopback()
1361 switch (hw->phy.type) { in e1000_integrated_phy_loopback()
1363 /* Auto-MDI/MDIX Off */ in e1000_integrated_phy_loopback()
1365 /* reset to update Auto-MDI/MDIX */ in e1000_integrated_phy_loopback()
1374 /* Set Default MAC Interface speed to 1GB */ in e1000_integrated_phy_loopback()
1380 hw->phy.ops.commit(hw); in e1000_integrated_phy_loopback()
1398 ret_val = hw->phy.ops.acquire(hw); in e1000_integrated_phy_loopback()
1404 hw->phy.ops.release(hw); in e1000_integrated_phy_loopback()
1407 /* Disable PHY energy detect power down */ in e1000_integrated_phy_loopback()
1413 /* Enable loopback on the PHY */ in e1000_integrated_phy_loopback()
1424 /* Now set up the MAC to the same speed/duplex as the PHY. */ in e1000_integrated_phy_loopback()
1425 ctrl_reg = er32(CTRL); in e1000_integrated_phy_loopback()
1432 if (adapter->flags & FLAG_IS_ICH) in e1000_integrated_phy_loopback()
1435 if (hw->phy.media_type == e1000_media_type_copper && in e1000_integrated_phy_loopback()
1436 hw->phy.type == e1000_phy_m88) { in e1000_integrated_phy_loopback()
1446 ew32(CTRL, ctrl_reg); in e1000_integrated_phy_loopback()
1448 /* Disable the receiver on the PHY so when a cable is plugged in, the in e1000_integrated_phy_loopback()
1449 * PHY does not begin to autoneg when a cable is reconnected to the NIC. in e1000_integrated_phy_loopback()
1451 if (hw->phy.type == e1000_phy_m88) in e1000_integrated_phy_loopback()
1461 struct e1000_hw *hw = &adapter->hw; in e1000_set_82571_fiber_loopback()
1462 u32 ctrl = er32(CTRL); in e1000_set_82571_fiber_loopback() local
1470 ctrl |= E1000_CTRL_SLU; in e1000_set_82571_fiber_loopback()
1471 ew32(CTRL, ctrl); in e1000_set_82571_fiber_loopback()
1474 ctrl = er32(TXCW); in e1000_set_82571_fiber_loopback()
1475 ctrl &= ~BIT(31); in e1000_set_82571_fiber_loopback()
1476 ew32(TXCW, ctrl); in e1000_set_82571_fiber_loopback()
1482 ctrl = er32(CTRL); in e1000_set_82571_fiber_loopback()
1483 ctrl |= E1000_CTRL_ILOS; in e1000_set_82571_fiber_loopback()
1484 ew32(CTRL, ctrl); in e1000_set_82571_fiber_loopback()
1500 struct e1000_hw *hw = &adapter->hw; in e1000_set_es2lan_mac_loopback()
1502 u32 ctrl = er32(CTRL); in e1000_set_es2lan_mac_loopback() local
1507 adapter->tx_fifo_head = ctrlext; in e1000_set_es2lan_mac_loopback()
1509 /* clear the serdes mode bits, putting the device into mac loopback */ in e1000_set_es2lan_mac_loopback()
1514 ctrl &= ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100); in e1000_set_es2lan_mac_loopback()
1515 ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX | in e1000_set_es2lan_mac_loopback()
1517 ew32(CTRL, ctrl); in e1000_set_es2lan_mac_loopback()
1519 /* set mac loopback */ in e1000_set_es2lan_mac_loopback()
1520 ctrl = er32(RCTL); in e1000_set_es2lan_mac_loopback()
1521 ctrl |= E1000_RCTL_LBM_MAC; in e1000_set_es2lan_mac_loopback()
1522 ew32(RCTL, ctrl); in e1000_set_es2lan_mac_loopback()
1535 struct e1000_hw *hw = &adapter->hw; in e1000_setup_loopback_test()
1538 if (hw->mac.type >= e1000_pch_spt) { in e1000_setup_loopback_test()
1549 if (hw->phy.media_type == e1000_media_type_fiber || in e1000_setup_loopback_test()
1550 hw->phy.media_type == e1000_media_type_internal_serdes) { in e1000_setup_loopback_test()
1551 switch (hw->mac.type) { in e1000_setup_loopback_test()
1563 } else if (hw->phy.media_type == e1000_media_type_copper) { in e1000_setup_loopback_test()
1572 struct e1000_hw *hw = &adapter->hw; in e1000_loopback_cleanup()
1580 switch (hw->mac.type) { in e1000_loopback_cleanup()
1599 if (hw->phy.media_type == e1000_media_type_fiber || in e1000_loopback_cleanup()
1600 hw->phy.media_type == e1000_media_type_internal_serdes) { in e1000_loopback_cleanup()
1602 ew32(CTRL_EXT, adapter->tx_fifo_head); in e1000_loopback_cleanup()
1603 adapter->tx_fifo_head = 0; in e1000_loopback_cleanup()
1608 if (hw->phy.media_type == e1000_media_type_fiber || in e1000_loopback_cleanup()
1609 hw->phy.media_type == e1000_media_type_internal_serdes) { in e1000_loopback_cleanup()
1617 hw->mac.autoneg = 1; in e1000_loopback_cleanup()
1618 if (hw->phy.type == e1000_phy_gg82563) in e1000_loopback_cleanup()
1624 if (hw->phy.ops.commit) in e1000_loopback_cleanup()
1625 hw->phy.ops.commit(hw); in e1000_loopback_cleanup()
1634 memset(skb->data, 0xFF, frame_size); in e1000_create_lbtest_frame()
1636 memset(&skb->data[frame_size / 2], 0xAA, frame_size / 2 - 1); in e1000_create_lbtest_frame()
1637 skb->data[frame_size / 2 + 10] = 0xBE; in e1000_create_lbtest_frame()
1638 skb->data[frame_size / 2 + 12] = 0xAF; in e1000_create_lbtest_frame()
1645 if (*(skb->data + 3) == 0xFF) in e1000_check_lbtest_frame()
1646 if ((*(skb->data + frame_size / 2 + 10) == 0xBE) && in e1000_check_lbtest_frame()
1647 (*(skb->data + frame_size / 2 + 12) == 0xAF)) in e1000_check_lbtest_frame()
1654 struct e1000_ring *tx_ring = &adapter->test_tx_ring; in e1000_run_loopback_test()
1655 struct e1000_ring *rx_ring = &adapter->test_rx_ring; in e1000_run_loopback_test()
1656 struct pci_dev *pdev = adapter->pdev; in e1000_run_loopback_test()
1657 struct e1000_hw *hw = &adapter->hw; in e1000_run_loopback_test()
1665 ew32(RDT(0), rx_ring->count - 1); in e1000_run_loopback_test()
1672 if (rx_ring->count <= tx_ring->count) in e1000_run_loopback_test()
1673 lc = ((tx_ring->count / 64) * 2) + 1; in e1000_run_loopback_test()
1675 lc = ((rx_ring->count / 64) * 2) + 1; in e1000_run_loopback_test()
1683 buffer_info = &tx_ring->buffer_info[k]; in e1000_run_loopback_test()
1685 e1000_create_lbtest_frame(buffer_info->skb, 1024); in e1000_run_loopback_test()
1686 dma_sync_single_for_device(&pdev->dev, in e1000_run_loopback_test()
1687 buffer_info->dma, in e1000_run_loopback_test()
1688 buffer_info->length, in e1000_run_loopback_test()
1691 if (k == tx_ring->count) in e1000_run_loopback_test()
1701 buffer_info = &rx_ring->buffer_info[l]; in e1000_run_loopback_test()
1703 dma_sync_single_for_cpu(&pdev->dev, in e1000_run_loopback_test()
1704 buffer_info->dma, 2048, in e1000_run_loopback_test()
1707 ret_val = e1000_check_lbtest_frame(buffer_info->skb, in e1000_run_loopback_test()
1712 if (l == rx_ring->count) in e1000_run_loopback_test()
1720 ret_val = 13; /* ret_val is the same as mis-compare */ in e1000_run_loopback_test()
1733 struct e1000_hw *hw = &adapter->hw; in e1000_loopback_test()
1735 /* PHY loopback cannot be performed if SoL/IDER sessions are active */ in e1000_loopback_test()
1736 if (hw->phy.ops.check_reset_block && in e1000_loopback_test()
1737 hw->phy.ops.check_reset_block(hw)) { in e1000_loopback_test()
1738 e_err("Cannot do PHY loopback test when SoL/IDER is active.\n"); in e1000_loopback_test()
1762 struct e1000_hw *hw = &adapter->hw; in e1000_link_test()
1765 if (hw->phy.media_type == e1000_media_type_internal_serdes) { in e1000_link_test()
1768 hw->mac.serdes_has_link = false; in e1000_link_test()
1771 * could take as long as 2-3 minutes in e1000_link_test()
1774 hw->mac.ops.check_for_link(hw); in e1000_link_test()
1775 if (hw->mac.serdes_has_link) in e1000_link_test()
1782 hw->mac.ops.check_for_link(hw); in e1000_link_test()
1783 if (hw->mac.autoneg) in e1000_link_test()
1784 /* On some Phy/switch combinations, link establishment in e1000_link_test()
1806 return -EOPNOTSUPP; in e1000e_get_sset_count()
1819 pm_runtime_get_sync(netdev->dev.parent); in e1000_diag_test()
1821 set_bit(__E1000_TESTING, &adapter->state); in e1000_diag_test()
1825 if (adapter->flags & FLAG_HAS_AMT) in e1000_diag_test()
1830 adapter->hw.phy.autoneg_wait_to_complete = 1; in e1000_diag_test()
1832 adapter->hw.phy.autoneg_wait_to_complete = 0; in e1000_diag_test()
1835 if (eth_test->flags == ETH_TEST_FL_OFFLINE) { in e1000_diag_test()
1839 autoneg_advertised = adapter->hw.phy.autoneg_advertised; in e1000_diag_test()
1840 forced_speed_duplex = adapter->hw.mac.forced_speed_duplex; in e1000_diag_test()
1841 autoneg = adapter->hw.mac.autoneg; in e1000_diag_test()
1850 eth_test->flags |= ETH_TEST_FL_FAILED; in e1000_diag_test()
1854 eth_test->flags |= ETH_TEST_FL_FAILED; in e1000_diag_test()
1858 eth_test->flags |= ETH_TEST_FL_FAILED; in e1000_diag_test()
1862 eth_test->flags |= ETH_TEST_FL_FAILED; in e1000_diag_test()
1865 adapter->hw.phy.autoneg_wait_to_complete = 1; in e1000_diag_test()
1867 adapter->hw.phy.autoneg_wait_to_complete = 0; in e1000_diag_test()
1870 eth_test->flags |= ETH_TEST_FL_FAILED; in e1000_diag_test()
1873 adapter->hw.phy.autoneg_advertised = autoneg_advertised; in e1000_diag_test()
1874 adapter->hw.mac.forced_speed_duplex = forced_speed_duplex; in e1000_diag_test()
1875 adapter->hw.mac.autoneg = autoneg; in e1000_diag_test()
1878 clear_bit(__E1000_TESTING, &adapter->state); in e1000_diag_test()
1893 eth_test->flags |= ETH_TEST_FL_FAILED; in e1000_diag_test()
1895 clear_bit(__E1000_TESTING, &adapter->state); in e1000_diag_test()
1901 if (adapter->flags & FLAG_HAS_AMT) in e1000_diag_test()
1907 pm_runtime_put_sync(netdev->dev.parent); in e1000_diag_test()
1915 wol->supported = 0; in e1000_get_wol()
1916 wol->wolopts = 0; in e1000_get_wol()
1918 if (!(adapter->flags & FLAG_HAS_WOL) || in e1000_get_wol()
1919 !device_can_wakeup(&adapter->pdev->dev)) in e1000_get_wol()
1922 wol->supported = WAKE_UCAST | WAKE_MCAST | in e1000_get_wol()
1926 if (adapter->flags & FLAG_NO_WAKE_UCAST) { in e1000_get_wol()
1927 wol->supported &= ~WAKE_UCAST; in e1000_get_wol()
1929 if (adapter->wol & E1000_WUFC_EX) in e1000_get_wol()
1930 e_err("Interface does not support directed (unicast) frame wake-up packets\n"); in e1000_get_wol()
1933 if (adapter->wol & E1000_WUFC_EX) in e1000_get_wol()
1934 wol->wolopts |= WAKE_UCAST; in e1000_get_wol()
1935 if (adapter->wol & E1000_WUFC_MC) in e1000_get_wol()
1936 wol->wolopts |= WAKE_MCAST; in e1000_get_wol()
1937 if (adapter->wol & E1000_WUFC_BC) in e1000_get_wol()
1938 wol->wolopts |= WAKE_BCAST; in e1000_get_wol()
1939 if (adapter->wol & E1000_WUFC_MAG) in e1000_get_wol()
1940 wol->wolopts |= WAKE_MAGIC; in e1000_get_wol()
1941 if (adapter->wol & E1000_WUFC_LNKC) in e1000_get_wol()
1942 wol->wolopts |= WAKE_PHY; in e1000_get_wol()
1949 if (!(adapter->flags & FLAG_HAS_WOL) || in e1000_set_wol()
1950 !device_can_wakeup(&adapter->pdev->dev) || in e1000_set_wol()
1951 (wol->wolopts & ~(WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | in e1000_set_wol()
1953 return -EOPNOTSUPP; in e1000_set_wol()
1956 adapter->wol = 0; in e1000_set_wol()
1958 if (wol->wolopts & WAKE_UCAST) in e1000_set_wol()
1959 adapter->wol |= E1000_WUFC_EX; in e1000_set_wol()
1960 if (wol->wolopts & WAKE_MCAST) in e1000_set_wol()
1961 adapter->wol |= E1000_WUFC_MC; in e1000_set_wol()
1962 if (wol->wolopts & WAKE_BCAST) in e1000_set_wol()
1963 adapter->wol |= E1000_WUFC_BC; in e1000_set_wol()
1964 if (wol->wolopts & WAKE_MAGIC) in e1000_set_wol()
1965 adapter->wol |= E1000_WUFC_MAG; in e1000_set_wol()
1966 if (wol->wolopts & WAKE_PHY) in e1000_set_wol()
1967 adapter->wol |= E1000_WUFC_LNKC; in e1000_set_wol()
1969 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); in e1000_set_wol()
1978 struct e1000_hw *hw = &adapter->hw; in e1000_set_phys_id()
1982 pm_runtime_get_sync(netdev->dev.parent); in e1000_set_phys_id()
1984 if (!hw->mac.ops.blink_led) in e1000_set_phys_id()
1987 hw->mac.ops.blink_led(hw); in e1000_set_phys_id()
1991 if (hw->phy.type == e1000_phy_ife) in e1000_set_phys_id()
1993 hw->mac.ops.led_off(hw); in e1000_set_phys_id()
1994 hw->mac.ops.cleanup_led(hw); in e1000_set_phys_id()
1995 pm_runtime_put_sync(netdev->dev.parent); in e1000_set_phys_id()
1999 hw->mac.ops.led_on(hw); in e1000_set_phys_id()
2003 hw->mac.ops.led_off(hw); in e1000_set_phys_id()
2017 if (adapter->itr_setting <= 4) in e1000_get_coalesce()
2018 ec->rx_coalesce_usecs = adapter->itr_setting; in e1000_get_coalesce()
2020 ec->rx_coalesce_usecs = 1000000 / adapter->itr_setting; in e1000_get_coalesce()
2032 if ((ec->rx_coalesce_usecs > E1000_MAX_ITR_USECS) || in e1000_set_coalesce()
2033 ((ec->rx_coalesce_usecs > 4) && in e1000_set_coalesce()
2034 (ec->rx_coalesce_usecs < E1000_MIN_ITR_USECS)) || in e1000_set_coalesce()
2035 (ec->rx_coalesce_usecs == 2)) in e1000_set_coalesce()
2036 return -EINVAL; in e1000_set_coalesce()
2038 if (ec->rx_coalesce_usecs == 4) { in e1000_set_coalesce()
2039 adapter->itr_setting = 4; in e1000_set_coalesce()
2040 adapter->itr = adapter->itr_setting; in e1000_set_coalesce()
2041 } else if (ec->rx_coalesce_usecs <= 3) { in e1000_set_coalesce()
2042 adapter->itr = 20000; in e1000_set_coalesce()
2043 adapter->itr_setting = ec->rx_coalesce_usecs; in e1000_set_coalesce()
2045 adapter->itr = (1000000 / ec->rx_coalesce_usecs); in e1000_set_coalesce()
2046 adapter->itr_setting = adapter->itr & ~3; in e1000_set_coalesce()
2049 pm_runtime_get_sync(netdev->dev.parent); in e1000_set_coalesce()
2051 if (adapter->itr_setting != 0) in e1000_set_coalesce()
2052 e1000e_write_itr(adapter, adapter->itr); in e1000_set_coalesce()
2056 pm_runtime_put_sync(netdev->dev.parent); in e1000_set_coalesce()
2066 return -EAGAIN; in e1000_nway_reset()
2068 if (!adapter->hw.mac.autoneg) in e1000_nway_reset()
2069 return -EINVAL; in e1000_nway_reset()
2071 pm_runtime_get_sync(netdev->dev.parent); in e1000_nway_reset()
2073 pm_runtime_put_sync(netdev->dev.parent); in e1000_nway_reset()
2087 pm_runtime_get_sync(netdev->dev.parent); in e1000_get_ethtool_stats()
2091 pm_runtime_put_sync(netdev->dev.parent); in e1000_get_ethtool_stats()
2141 info->data = 0; in e1000_get_rxnfc()
2143 switch (info->cmd) { in e1000_get_rxnfc()
2146 struct e1000_hw *hw = &adapter->hw; in e1000_get_rxnfc()
2149 pm_runtime_get_sync(netdev->dev.parent); in e1000_get_rxnfc()
2151 pm_runtime_put_sync(netdev->dev.parent); in e1000_get_rxnfc()
2156 switch (info->flow_type) { in e1000_get_rxnfc()
2159 info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in e1000_get_rxnfc()
2166 info->data |= RXH_IP_SRC | RXH_IP_DST; in e1000_get_rxnfc()
2170 info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in e1000_get_rxnfc()
2177 info->data |= RXH_IP_SRC | RXH_IP_DST; in e1000_get_rxnfc()
2185 return -EOPNOTSUPP; in e1000_get_rxnfc()
2192 struct e1000_hw *hw = &adapter->hw; in e1000e_get_eee()
2196 if (!(adapter->flags2 & FLAG2_HAS_EEE)) in e1000e_get_eee()
2197 return -EOPNOTSUPP; in e1000e_get_eee()
2199 switch (hw->phy.type) { in e1000e_get_eee()
2211 return -EOPNOTSUPP; in e1000e_get_eee()
2214 pm_runtime_get_sync(netdev->dev.parent); in e1000e_get_eee()
2216 ret_val = hw->phy.ops.acquire(hw); in e1000e_get_eee()
2218 pm_runtime_put_sync(netdev->dev.parent); in e1000e_get_eee()
2219 return -EBUSY; in e1000e_get_eee()
2226 edata->supported = mmd_eee_cap_to_ethtool_sup_t(phy_data); in e1000e_get_eee()
2229 edata->advertised = mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert); in e1000e_get_eee()
2235 edata->lp_advertised = mmd_eee_adv_to_ethtool_adv_t(phy_data); in e1000e_get_eee()
2241 if (hw->phy.type == e1000_phy_82579) in e1000e_get_eee()
2244 /* Result of the EEE auto negotiation - there is no register that in e1000e_get_eee()
2245 * has the status of the EEE negotiation so do a best-guess based in e1000e_get_eee()
2249 edata->eee_active = true; in e1000e_get_eee()
2251 edata->eee_enabled = !hw->dev_spec.ich8lan.eee_disable; in e1000e_get_eee()
2252 edata->tx_lpi_enabled = true; in e1000e_get_eee()
2253 edata->tx_lpi_timer = er32(LPIC) >> E1000_LPIC_LPIET_SHIFT; in e1000e_get_eee()
2256 hw->phy.ops.release(hw); in e1000e_get_eee()
2258 ret_val = -ENODATA; in e1000e_get_eee()
2260 pm_runtime_put_sync(netdev->dev.parent); in e1000e_get_eee()
2268 struct e1000_hw *hw = &adapter->hw; in e1000e_set_eee()
2276 if (eee_curr.tx_lpi_enabled != edata->tx_lpi_enabled) { in e1000e_set_eee()
2277 e_err("Setting EEE tx-lpi is not supported\n"); in e1000e_set_eee()
2278 return -EINVAL; in e1000e_set_eee()
2281 if (eee_curr.tx_lpi_timer != edata->tx_lpi_timer) { in e1000e_set_eee()
2283 return -EINVAL; in e1000e_set_eee()
2286 if (edata->advertised & ~(ADVERTISE_100_FULL | ADVERTISE_1000_FULL)) { in e1000e_set_eee()
2287 e_err("EEE advertisement supports only 100TX and/or 1000T full-duplex\n"); in e1000e_set_eee()
2288 return -EINVAL; in e1000e_set_eee()
2291 adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised); in e1000e_set_eee()
2293 hw->dev_spec.ich8lan.eee_disable = !edata->eee_enabled; in e1000e_set_eee()
2295 pm_runtime_get_sync(netdev->dev.parent); in e1000e_set_eee()
2303 pm_runtime_put_sync(netdev->dev.parent); in e1000e_set_eee()
2315 if (!(adapter->flags & FLAG_HAS_HW_TIMESTAMP)) in e1000e_get_ts_info()
2318 info->so_timestamping |= (SOF_TIMESTAMPING_TX_HARDWARE | in e1000e_get_ts_info()
2322 info->tx_types = BIT(HWTSTAMP_TX_OFF) | BIT(HWTSTAMP_TX_ON); in e1000e_get_ts_info()
2324 info->rx_filters = (BIT(HWTSTAMP_FILTER_NONE) | in e1000e_get_ts_info()
2336 if (adapter->ptp_clock) in e1000e_get_ts_info()
2337 info->phc_index = ptp_clock_index(adapter->ptp_clock); in e1000e_get_ts_info()
2347 if (adapter->flags2 & FLAG2_ENABLE_S0IX_FLOWS) in e1000e_get_priv_flags()
2356 unsigned int flags2 = adapter->flags2; in e1000e_set_priv_flags()
2360 struct e1000_hw *hw = &adapter->hw; in e1000e_set_priv_flags()
2362 if (hw->mac.type < e1000_pch_cnp) in e1000e_set_priv_flags()
2363 return -EINVAL; in e1000e_set_priv_flags()
2367 if (flags2 != adapter->flags2) in e1000e_set_priv_flags()
2368 adapter->flags2 = flags2; in e1000e_set_priv_flags()
2410 netdev->ethtool_ops = &e1000_ethtool_ops; in e1000e_set_ethtool_ops()