Lines Matching +full:mac +full:- +full:only

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 1999 - 2018 Intel Corporation. */
7 * e1000e_get_bus_info_pcie - Get PCIe bus information
16 struct e1000_mac_info *mac = &hw->mac; in e1000e_get_bus_info_pcie() local
17 struct e1000_bus_info *bus = &hw->bus; in e1000e_get_bus_info_pcie()
18 struct e1000_adapter *adapter = hw->adapter; in e1000e_get_bus_info_pcie()
21 cap_offset = adapter->pdev->pcie_cap; in e1000e_get_bus_info_pcie()
23 bus->width = e1000_bus_width_unknown; in e1000e_get_bus_info_pcie()
25 pci_read_config_word(adapter->pdev, in e1000e_get_bus_info_pcie()
28 bus->width = (enum e1000_bus_width)((pcie_link_status & in e1000e_get_bus_info_pcie()
33 mac->ops.set_lan_id(hw); in e1000e_get_bus_info_pcie()
39 * e1000_set_lan_id_multi_port_pcie - Set LAN id for PCIe multiple port devices
43 * Determines the LAN function id by reading memory-mapped registers
48 struct e1000_bus_info *bus = &hw->bus; in e1000_set_lan_id_multi_port_pcie()
55 bus->func = (reg & E1000_STATUS_FUNC_MASK) >> E1000_STATUS_FUNC_SHIFT; in e1000_set_lan_id_multi_port_pcie()
59 * e1000_set_lan_id_single_port - Set LAN id for a single port device
66 struct e1000_bus_info *bus = &hw->bus; in e1000_set_lan_id_single_port()
68 bus->func = 0; in e1000_set_lan_id_single_port()
72 * e1000_clear_vfta_generic - Clear VLAN filter table
89 * e1000_write_vfta_generic - Write value to VLAN filter table
104 * e1000e_init_rx_addrs - Initialize receive address's
109 * register to the devices MAC address and clearing all the other receive
118 e_dbg("Programming MAC Address into RAR[0]\n"); in e1000e_init_rx_addrs()
120 hw->mac.ops.rar_set(hw, hw->mac.addr, 0); in e1000e_init_rx_addrs()
122 /* Zero out the other (rar_entry_count - 1) receive addresses */ in e1000e_init_rx_addrs()
123 e_dbg("Clearing RAR[1-%u]\n", rar_count - 1); in e1000e_init_rx_addrs()
125 hw->mac.ops.rar_set(hw, mac_addr, i); in e1000e_init_rx_addrs()
129 * e1000_check_alt_mac_addr_generic - Check for alternate MAC addr
132 * Checks the nvm for an alternate MAC address. An alternate MAC address
133 * can be setup by pre-boot software and must be treated like a permanent
134 * address and must override the actual permanent MAC address. If an
135 * alternate MAC address is found it is programmed into RAR0, replacing
152 if (hw->mac.type == e1000_82573) in e1000_check_alt_mac_addr_generic()
164 /* There is no Alternate MAC Address */ in e1000_check_alt_mac_addr_generic()
167 if (hw->bus.func == E1000_FUNC_1) in e1000_check_alt_mac_addr_generic()
183 e_dbg("Ignoring Alternate Mac Address with MC bit set\n"); in e1000_check_alt_mac_addr_generic()
187 /* We have a valid alternate MAC address, and we want to treat it the in e1000_check_alt_mac_addr_generic()
188 * same as the normal permanent MAC address stored by the HW into the in e1000_check_alt_mac_addr_generic()
191 hw->mac.ops.rar_set(hw, alt_mac_addr, 0); in e1000_check_alt_mac_addr_generic()
198 return hw->mac.rar_entry_count; in e1000e_rar_get_count_generic()
202 * e1000e_rar_set_generic - Set receive address register
222 /* If MAC address zero, no need to set the AV bit */ in e1000e_rar_set_generic()
226 /* Some bridges will combine consecutive 32-bit writes into in e1000e_rar_set_generic()
239 * e1000_hash_mc_addr - Generate a multicast hash value
252 hash_mask = (hw->mac.mta_reg_count * 32) - 1; in e1000_hash_mc_addr()
254 /* For a mc_filter_type of 0, bit_shift is the number of left-shifts in e1000_hash_mc_addr()
264 * left-shifts where the MSB of mc_addr[5] would still fall within in e1000_hash_mc_addr()
267 * remaining number of bits. Thus 8 - bit_shift. The rest of the in e1000_hash_mc_addr()
270 * 8-bit shifting total. in e1000_hash_mc_addr()
272 * For example, given the following Destination MAC Address and an in e1000_hash_mc_addr()
273 * mta register count of 128 (thus a 4096-bit vector and 0xFFF mask), in e1000_hash_mc_addr()
285 switch (hw->mac.mc_filter_type) { in e1000_hash_mc_addr()
300 hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) | in e1000_hash_mc_addr()
307 * e1000e_update_mc_addr_list_generic - Update Multicast addresses
322 memset(&hw->mac.mta_shadow, 0, sizeof(hw->mac.mta_shadow)); in e1000e_update_mc_addr_list_generic()
328 hash_reg = (hash_value >> 5) & (hw->mac.mta_reg_count - 1); in e1000e_update_mc_addr_list_generic()
331 hw->mac.mta_shadow[hash_reg] |= BIT(hash_bit); in e1000e_update_mc_addr_list_generic()
336 for (i = hw->mac.mta_reg_count - 1; i >= 0; i--) in e1000e_update_mc_addr_list_generic()
337 E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, hw->mac.mta_shadow[i]); in e1000e_update_mc_addr_list_generic()
342 * e1000e_clear_hw_cntrs_base - Clear base hardware counters
389 * e1000e_check_for_copper_link - Check for link (Copper)
398 struct e1000_mac_info *mac = &hw->mac; in e1000e_check_for_copper_link() local
402 /* We only want to go out to the PHY registers to see if Auto-Neg in e1000e_check_for_copper_link()
407 if (!mac->get_link_status) in e1000e_check_for_copper_link()
409 mac->get_link_status = false; in e1000e_check_for_copper_link()
420 * immediately after link-up in e1000e_check_for_copper_link()
427 if (!mac->autoneg) in e1000e_check_for_copper_link()
428 return -E1000_ERR_CONFIG; in e1000e_check_for_copper_link()
430 /* Auto-Neg is enabled. Auto Speed Detection takes care in e1000e_check_for_copper_link()
431 * of MAC speed/duplex configuration. So we only need to in e1000e_check_for_copper_link()
432 * configure Collision Distance in the MAC. in e1000e_check_for_copper_link()
434 mac->ops.config_collision_dist(hw); in e1000e_check_for_copper_link()
436 /* Configure Flow Control now that Auto-Neg has completed. in e1000e_check_for_copper_link()
438 * settings because we may have had to re-autoneg with a in e1000e_check_for_copper_link()
448 mac->get_link_status = true; in e1000e_check_for_copper_link()
453 * e1000e_check_for_fiber_link - Check for link (Fiber)
461 struct e1000_mac_info *mac = &hw->mac; in e1000e_check_for_fiber_link() local
471 /* If we don't have link (auto-negotiation failed or link partner in e1000e_check_for_fiber_link()
472 * cannot auto-negotiate), the cable is plugged in (we have signal), in e1000e_check_for_fiber_link()
473 * and our link partner is not trying to auto-negotiate with us (we in e1000e_check_for_fiber_link()
475 * need to give auto-negotiation time to complete, in case the cable in e1000e_check_for_fiber_link()
481 if (!mac->autoneg_failed) { in e1000e_check_for_fiber_link()
482 mac->autoneg_failed = true; in e1000e_check_for_fiber_link()
487 /* Disable auto-negotiation in the TXCW register */ in e1000e_check_for_fiber_link()
488 ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE)); in e1000e_check_for_fiber_link()
490 /* Force link-up and also force full-duplex. */ in e1000e_check_for_fiber_link()
503 * sets, re-enable auto-negotiation in the TXCW register in e1000e_check_for_fiber_link()
505 * in an attempt to auto-negotiate with our link partner. in e1000e_check_for_fiber_link()
508 ew32(TXCW, mac->txcw); in e1000e_check_for_fiber_link()
511 mac->serdes_has_link = true; in e1000e_check_for_fiber_link()
518 * e1000e_check_for_serdes_link - Check for link (Serdes)
526 struct e1000_mac_info *mac = &hw->mac; in e1000e_check_for_serdes_link() local
536 /* If we don't have link (auto-negotiation failed or link partner in e1000e_check_for_serdes_link()
537 * cannot auto-negotiate), and our link partner is not trying to in e1000e_check_for_serdes_link()
538 * auto-negotiate with us (we are receiving idles or data), in e1000e_check_for_serdes_link()
539 * we need to force link up. We also need to give auto-negotiation in e1000e_check_for_serdes_link()
544 if (!mac->autoneg_failed) { in e1000e_check_for_serdes_link()
545 mac->autoneg_failed = true; in e1000e_check_for_serdes_link()
550 /* Disable auto-negotiation in the TXCW register */ in e1000e_check_for_serdes_link()
551 ew32(TXCW, (mac->txcw & ~E1000_TXCW_ANE)); in e1000e_check_for_serdes_link()
553 /* Force link-up and also force full-duplex. */ in e1000e_check_for_serdes_link()
566 * sets, re-enable auto-negotiation in the TXCW register in e1000e_check_for_serdes_link()
568 * in an attempt to auto-negotiate with our link partner. in e1000e_check_for_serdes_link()
571 ew32(TXCW, mac->txcw); in e1000e_check_for_serdes_link()
574 mac->serdes_has_link = true; in e1000e_check_for_serdes_link()
576 /* If we force link for non-auto-negotiation switch, check in e1000e_check_for_serdes_link()
577 * link status based on MAC synchronization for internal in e1000e_check_for_serdes_link()
585 mac->serdes_has_link = true; in e1000e_check_for_serdes_link()
586 e_dbg("SERDES: Link up - forced.\n"); in e1000e_check_for_serdes_link()
589 mac->serdes_has_link = false; in e1000e_check_for_serdes_link()
590 e_dbg("SERDES: Link down - force failed.\n"); in e1000e_check_for_serdes_link()
602 mac->serdes_has_link = true; in e1000e_check_for_serdes_link()
603 e_dbg("SERDES: Link up - autoneg completed successfully.\n"); in e1000e_check_for_serdes_link()
605 mac->serdes_has_link = false; in e1000e_check_for_serdes_link()
606 e_dbg("SERDES: Link down - invalid codewords detected in autoneg.\n"); in e1000e_check_for_serdes_link()
609 mac->serdes_has_link = false; in e1000e_check_for_serdes_link()
610 e_dbg("SERDES: Link down - no sync.\n"); in e1000e_check_for_serdes_link()
613 mac->serdes_has_link = false; in e1000e_check_for_serdes_link()
614 e_dbg("SERDES: Link down - autoneg failed\n"); in e1000e_check_for_serdes_link()
622 * e1000_set_default_fc_generic - Set flow control default values
636 * disabling auto-negotiation, and the direction of the in e1000_set_default_fc_generic()
637 * SW defined pins. If there is no SW over-ride of the flow in e1000_set_default_fc_generic()
638 * control setting, then the variable hw->fc will in e1000_set_default_fc_generic()
649 hw->fc.requested_mode = e1000_fc_none; in e1000_set_default_fc_generic()
651 hw->fc.requested_mode = e1000_fc_tx_pause; in e1000_set_default_fc_generic()
653 hw->fc.requested_mode = e1000_fc_full; in e1000_set_default_fc_generic()
659 * e1000e_setup_link_generic - Setup flow control and link settings
663 * control. Calls the appropriate media-specific link configuration
675 if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw)) in e1000e_setup_link_generic()
681 if (hw->fc.requested_mode == e1000_fc_default) { in e1000e_setup_link_generic()
690 hw->fc.current_mode = hw->fc.requested_mode; in e1000e_setup_link_generic()
692 e_dbg("After fix-ups FlowControl is now = %x\n", hw->fc.current_mode); in e1000e_setup_link_generic()
695 ret_val = hw->mac.ops.setup_physical_interface(hw); in e1000e_setup_link_generic()
709 ew32(FCTTV, hw->fc.pause_time); in e1000e_setup_link_generic()
715 * e1000_commit_fc_settings_generic - Configure flow control
723 struct e1000_mac_info *mac = &hw->mac; in e1000_commit_fc_settings_generic() local
727 * setup the device accordingly. If auto-negotiation is enabled, then in e1000_commit_fc_settings_generic()
729 * the Transmit Config Word Register (TXCW) and re-start auto- in e1000_commit_fc_settings_generic()
730 * negotiation. However, if auto-negotiation is disabled, then in e1000_commit_fc_settings_generic()
742 switch (hw->fc.current_mode) { in e1000_commit_fc_settings_generic()
744 /* Flow control completely disabled by a software over-ride. */ in e1000_commit_fc_settings_generic()
749 * by a software over-ride. Since there really isn't a way to in e1000_commit_fc_settings_generic()
750 * advertise that we are capable of Rx Pause ONLY, we will in e1000_commit_fc_settings_generic()
759 * by a software over-ride. in e1000_commit_fc_settings_generic()
765 * over-ride. in e1000_commit_fc_settings_generic()
771 return -E1000_ERR_CONFIG; in e1000_commit_fc_settings_generic()
775 mac->txcw = txcw; in e1000_commit_fc_settings_generic()
781 * e1000_poll_fiber_serdes_link_generic - Poll for link up
785 * up with auto-negotiation, then the link is forced if a signal is detected.
789 struct e1000_mac_info *mac = &hw->mac; in e1000_poll_fiber_serdes_link_generic() local
794 * serdes media) then poll for a "Link-Up" indication in the Device in e1000_poll_fiber_serdes_link_generic()
795 * Status Register. Time-out if a link isn't seen in 500 milliseconds in e1000_poll_fiber_serdes_link_generic()
796 * seconds (Auto-negotiation should complete in less than 500 in e1000_poll_fiber_serdes_link_generic()
806 e_dbg("Never got a valid link from auto-neg!!!\n"); in e1000_poll_fiber_serdes_link_generic()
807 mac->autoneg_failed = true; in e1000_poll_fiber_serdes_link_generic()
809 * mac->check_for_link. This routine will force the in e1000_poll_fiber_serdes_link_generic()
811 * communicate with non-autonegotiating link partners. in e1000_poll_fiber_serdes_link_generic()
813 ret_val = mac->ops.check_for_link(hw); in e1000_poll_fiber_serdes_link_generic()
818 mac->autoneg_failed = false; in e1000_poll_fiber_serdes_link_generic()
820 mac->autoneg_failed = false; in e1000_poll_fiber_serdes_link_generic()
828 * e1000e_setup_fiber_serdes_link - Setup link for fiber/serdes
844 hw->mac.ops.config_collision_dist(hw); in e1000e_setup_fiber_serdes_link()
850 /* Since auto-negotiation is enabled, take the link out of reset (the in e1000e_setup_fiber_serdes_link()
852 * will restart auto-negotiation. If auto-negotiation is successful in e1000e_setup_fiber_serdes_link()
853 * then the link-up status bit will be set and the flow control enable in e1000e_setup_fiber_serdes_link()
856 e_dbg("Auto-negotiation enabled\n"); in e1000e_setup_fiber_serdes_link()
863 * detect a signal. If we have a signal, then poll for a "Link-Up" in e1000e_setup_fiber_serdes_link()
866 if (hw->phy.media_type == e1000_media_type_internal_serdes || in e1000e_setup_fiber_serdes_link()
877 * e1000e_config_collision_dist_generic - Configure collision distance
897 * e1000e_set_fc_watermarks - Set flow control high/low watermarks
914 if (hw->fc.current_mode & e1000_fc_tx_pause) { in e1000e_set_fc_watermarks()
919 fcrtl = hw->fc.low_water; in e1000e_set_fc_watermarks()
920 if (hw->fc.send_xon) in e1000e_set_fc_watermarks()
923 fcrth = hw->fc.high_water; in e1000e_set_fc_watermarks()
932 * e1000e_force_mac_fc - Force the MAC's flow control settings
935 * Force the MAC's flow control settings. Sets the TFCE and RFCE bits in the
938 * autonegotiation is managed by the PHY rather than the MAC. Software must
947 /* Because we didn't get link via the internal auto-negotiation in e1000e_force_mac_fc()
949 * auto-neg), we have to manually enable/disable transmit an in e1000e_force_mac_fc()
953 * according to the "hw->fc.current_mode" parameter. in e1000e_force_mac_fc()
964 e_dbg("hw->fc.current_mode = %u\n", hw->fc.current_mode); in e1000e_force_mac_fc()
966 switch (hw->fc.current_mode) { in e1000e_force_mac_fc()
983 return -E1000_ERR_CONFIG; in e1000e_force_mac_fc()
992 * e1000e_config_fc_after_link_up - Configures flow control after link
995 * Checks the status of auto-negotiation after link up to ensure that the
997 * flow control needs to be forced also. If auto-negotiation is enabled
1003 struct e1000_mac_info *mac = &hw->mac; in e1000e_config_fc_after_link_up() local
1009 /* Check for the case where we have fiber media and auto-neg failed in e1000e_config_fc_after_link_up()
1011 * configuration of the MAC to match the "fc" parameter. in e1000e_config_fc_after_link_up()
1013 if (mac->autoneg_failed) { in e1000e_config_fc_after_link_up()
1014 if (hw->phy.media_type == e1000_media_type_fiber || in e1000e_config_fc_after_link_up()
1015 hw->phy.media_type == e1000_media_type_internal_serdes) in e1000e_config_fc_after_link_up()
1018 if (hw->phy.media_type == e1000_media_type_copper) in e1000e_config_fc_after_link_up()
1027 /* Check for the case where we have copper media and auto-neg is in e1000e_config_fc_after_link_up()
1028 * enabled. In this case, we need to check and see if Auto-Neg in e1000e_config_fc_after_link_up()
1032 if ((hw->phy.media_type == e1000_media_type_copper) && mac->autoneg) { in e1000e_config_fc_after_link_up()
1073 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1091 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1097 /* Now we need to check if the user selected Rx ONLY in e1000e_config_fc_after_link_up()
1100 * ONLY. Hence, we must now check to see if we need to in e1000e_config_fc_after_link_up()
1103 if (hw->fc.requested_mode == e1000_fc_full) { in e1000e_config_fc_after_link_up()
1104 hw->fc.current_mode = e1000_fc_full; in e1000e_config_fc_after_link_up()
1107 hw->fc.current_mode = e1000_fc_rx_pause; in e1000e_config_fc_after_link_up()
1108 e_dbg("Flow Control = Rx PAUSE frames only.\n"); in e1000e_config_fc_after_link_up()
1111 /* For receiving PAUSE frames ONLY. in e1000e_config_fc_after_link_up()
1115 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1122 hw->fc.current_mode = e1000_fc_tx_pause; in e1000e_config_fc_after_link_up()
1123 e_dbg("Flow Control = Tx PAUSE frames only.\n"); in e1000e_config_fc_after_link_up()
1125 /* For transmitting PAUSE frames ONLY. in e1000e_config_fc_after_link_up()
1129 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1136 hw->fc.current_mode = e1000_fc_rx_pause; in e1000e_config_fc_after_link_up()
1137 e_dbg("Flow Control = Rx PAUSE frames only.\n"); in e1000e_config_fc_after_link_up()
1142 hw->fc.current_mode = e1000_fc_none; in e1000e_config_fc_after_link_up()
1146 /* Now we need to do one last check... If we auto- in e1000e_config_fc_after_link_up()
1150 ret_val = mac->ops.get_link_up_info(hw, &speed, &duplex); in e1000e_config_fc_after_link_up()
1157 hw->fc.current_mode = e1000_fc_none; in e1000e_config_fc_after_link_up()
1159 /* Now we call a subroutine to actually force the MAC in e1000e_config_fc_after_link_up()
1169 /* Check for the case where we have SerDes media and auto-neg is in e1000e_config_fc_after_link_up()
1170 * enabled. In this case, we need to check and see if Auto-Neg in e1000e_config_fc_after_link_up()
1174 if ((hw->phy.media_type == e1000_media_type_internal_serdes) && in e1000e_config_fc_after_link_up()
1175 mac->autoneg) { in e1000e_config_fc_after_link_up()
1206 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1224 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1230 /* Now we need to check if the user selected Rx ONLY in e1000e_config_fc_after_link_up()
1233 * ONLY. Hence, we must now check to see if we need to in e1000e_config_fc_after_link_up()
1236 if (hw->fc.requested_mode == e1000_fc_full) { in e1000e_config_fc_after_link_up()
1237 hw->fc.current_mode = e1000_fc_full; in e1000e_config_fc_after_link_up()
1240 hw->fc.current_mode = e1000_fc_rx_pause; in e1000e_config_fc_after_link_up()
1241 e_dbg("Flow Control = Rx PAUSE frames only.\n"); in e1000e_config_fc_after_link_up()
1244 /* For receiving PAUSE frames ONLY. in e1000e_config_fc_after_link_up()
1248 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1255 hw->fc.current_mode = e1000_fc_tx_pause; in e1000e_config_fc_after_link_up()
1256 e_dbg("Flow Control = Tx PAUSE frames only.\n"); in e1000e_config_fc_after_link_up()
1258 /* For transmitting PAUSE frames ONLY. in e1000e_config_fc_after_link_up()
1262 *-------|---------|-------|---------|-------------------- in e1000e_config_fc_after_link_up()
1269 hw->fc.current_mode = e1000_fc_rx_pause; in e1000e_config_fc_after_link_up()
1270 e_dbg("Flow Control = Rx PAUSE frames only.\n"); in e1000e_config_fc_after_link_up()
1275 hw->fc.current_mode = e1000_fc_none; in e1000e_config_fc_after_link_up()
1279 /* Now we call a subroutine to actually force the MAC in e1000e_config_fc_after_link_up()
1297 * e1000e_get_speed_and_duplex_copper - Retrieve current speed/duplex
1331 * e1000e_get_speed_and_duplex_fiber_serdes - Retrieve current speed/duplex
1336 * Sets the speed and duplex to gigabit full duplex (the only possible option)
1349 * e1000e_get_hw_semaphore - Acquire hardware semaphore
1357 s32 timeout = hw->nvm.word_size + 1; in e1000e_get_hw_semaphore()
1371 e_dbg("Driver can't access device - SMBI bit is set.\n"); in e1000e_get_hw_semaphore()
1372 return -E1000_ERR_NVM; in e1000e_get_hw_semaphore()
1391 return -E1000_ERR_NVM; in e1000e_get_hw_semaphore()
1398 * e1000e_put_hw_semaphore - Release hardware semaphore
1413 * e1000e_get_auto_rd_done - Check for auto read completion
1431 return -E1000_ERR_RESET; in e1000e_get_auto_rd_done()
1438 * e1000e_valid_led_default - Verify a valid default LED config
1462 * e1000e_id_led_init_generic -
1468 struct e1000_mac_info *mac = &hw->mac; in e1000e_id_led_init_generic() local
1476 ret_val = hw->nvm.ops.valid_led_default(hw, &data); in e1000e_id_led_init_generic()
1480 mac->ledctl_default = er32(LEDCTL); in e1000e_id_led_init_generic()
1481 mac->ledctl_mode1 = mac->ledctl_default; in e1000e_id_led_init_generic()
1482 mac->ledctl_mode2 = mac->ledctl_default; in e1000e_id_led_init_generic()
1490 mac->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); in e1000e_id_led_init_generic()
1491 mac->ledctl_mode1 |= ledctl_on << (i << 3); in e1000e_id_led_init_generic()
1496 mac->ledctl_mode1 &= ~(ledctl_mask << (i << 3)); in e1000e_id_led_init_generic()
1497 mac->ledctl_mode1 |= ledctl_off << (i << 3); in e1000e_id_led_init_generic()
1507 mac->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); in e1000e_id_led_init_generic()
1508 mac->ledctl_mode2 |= ledctl_on << (i << 3); in e1000e_id_led_init_generic()
1513 mac->ledctl_mode2 &= ~(ledctl_mask << (i << 3)); in e1000e_id_led_init_generic()
1514 mac->ledctl_mode2 |= ledctl_off << (i << 3); in e1000e_id_led_init_generic()
1526 * e1000e_setup_led_generic - Configures SW controllable LED
1536 if (hw->mac.ops.setup_led != e1000e_setup_led_generic) in e1000e_setup_led_generic()
1537 return -E1000_ERR_CONFIG; in e1000e_setup_led_generic()
1539 if (hw->phy.media_type == e1000_media_type_fiber) { in e1000e_setup_led_generic()
1541 hw->mac.ledctl_default = ledctl; in e1000e_setup_led_generic()
1548 } else if (hw->phy.media_type == e1000_media_type_copper) { in e1000e_setup_led_generic()
1549 ew32(LEDCTL, hw->mac.ledctl_mode1); in e1000e_setup_led_generic()
1556 * e1000e_cleanup_led_generic - Set LED config to default operation
1564 ew32(LEDCTL, hw->mac.ledctl_default); in e1000e_cleanup_led_generic()
1569 * e1000e_blink_led_generic - Blink LED
1579 if (hw->phy.media_type == e1000_media_type_fiber) { in e1000e_blink_led_generic()
1580 /* always blink LED0 for PCI-E fiber */ in e1000e_blink_led_generic()
1586 * logic in hardware only works when mode is set to "on" in e1000e_blink_led_generic()
1590 ledctl_blink = hw->mac.ledctl_mode2; in e1000e_blink_led_generic()
1592 u32 mode = (hw->mac.ledctl_mode2 >> i) & in e1000e_blink_led_generic()
1594 u32 led_default = hw->mac.ledctl_default >> i; in e1000e_blink_led_generic()
1614 * e1000e_led_on_generic - Turn LED on
1623 switch (hw->phy.media_type) { in e1000e_led_on_generic()
1631 ew32(LEDCTL, hw->mac.ledctl_mode2); in e1000e_led_on_generic()
1641 * e1000e_led_off_generic - Turn LED off
1650 switch (hw->phy.media_type) { in e1000e_led_off_generic()
1658 ew32(LEDCTL, hw->mac.ledctl_mode1); in e1000e_led_off_generic()
1668 * e1000e_set_pcie_no_snoop - Set PCI-express capabilities
1672 * Set the PCI-express register to snoop for events enabled in 'no_snoop'.
1687 * e1000e_disable_pcie_master - Disables PCI-express master access
1690 * Returns 0 if successful, else returns -10
1691 * (-E1000_ERR_MASTER_REQUESTS_PENDING) if master disable bit has not caused
1694 * Disables PCI-Express master access and verifies there are no pending
1710 timeout--; in e1000e_disable_pcie_master()
1715 return -E1000_ERR_MASTER_REQUESTS_PENDING; in e1000e_disable_pcie_master()
1722 * e1000e_reset_adaptive - Reset Adaptive Interframe Spacing
1729 struct e1000_mac_info *mac = &hw->mac; in e1000e_reset_adaptive() local
1731 if (!mac->adaptive_ifs) { in e1000e_reset_adaptive()
1736 mac->current_ifs_val = 0; in e1000e_reset_adaptive()
1737 mac->ifs_min_val = IFS_MIN; in e1000e_reset_adaptive()
1738 mac->ifs_max_val = IFS_MAX; in e1000e_reset_adaptive()
1739 mac->ifs_step_size = IFS_STEP; in e1000e_reset_adaptive()
1740 mac->ifs_ratio = IFS_RATIO; in e1000e_reset_adaptive()
1742 mac->in_ifs_mode = false; in e1000e_reset_adaptive()
1747 * e1000e_update_adaptive - Update Adaptive Interframe Spacing
1755 struct e1000_mac_info *mac = &hw->mac; in e1000e_update_adaptive() local
1757 if (!mac->adaptive_ifs) { in e1000e_update_adaptive()
1762 if ((mac->collision_delta * mac->ifs_ratio) > mac->tx_packet_delta) { in e1000e_update_adaptive()
1763 if (mac->tx_packet_delta > MIN_NUM_XMITS) { in e1000e_update_adaptive()
1764 mac->in_ifs_mode = true; in e1000e_update_adaptive()
1765 if (mac->current_ifs_val < mac->ifs_max_val) { in e1000e_update_adaptive()
1766 if (!mac->current_ifs_val) in e1000e_update_adaptive()
1767 mac->current_ifs_val = mac->ifs_min_val; in e1000e_update_adaptive()
1769 mac->current_ifs_val += in e1000e_update_adaptive()
1770 mac->ifs_step_size; in e1000e_update_adaptive()
1771 ew32(AIT, mac->current_ifs_val); in e1000e_update_adaptive()
1775 if (mac->in_ifs_mode && in e1000e_update_adaptive()
1776 (mac->tx_packet_delta <= MIN_NUM_XMITS)) { in e1000e_update_adaptive()
1777 mac->current_ifs_val = 0; in e1000e_update_adaptive()
1778 mac->in_ifs_mode = false; in e1000e_update_adaptive()