list_for_each_entry(entry, &pdev->bus->devices, bus_list) { /* When the devices on the bus don't all match our device ID, *wecan'treliablydeterminethecorrectnumberof *functions.Thiscanoccurifafunctionhasbeendirect *attachedtoavirtualmachineusingVT-d.
*/ if (entry->vendor != pdev->vendor ||
entry->device != pdev->device) return -EINVAL;
physfns++;
}
return physfns;
}
staticvoid txgbe_sfp_detection_subtask(struct wx *wx)
{ int err;
if (!test_bit(WX_FLAG_NEED_SFP_RESET, wx->flags)) return;
/* wait for SFP module ready */
msleep(200);
err = txgbe_identify_sfp(wx); if (err) return;
clear_bit(WX_FLAG_NEED_SFP_RESET, wx->flags);
}
staticvoid txgbe_link_config_subtask(struct wx *wx)
{ int err;
if (!test_bit(WX_FLAG_NEED_LINK_CONFIG, wx->flags)) return;
/* Set PF Reset Done bit so PF/VF Mail Ops can work */
wr32m(wx, WX_CFG_PORT_CTL, WX_CFG_PORT_CTL_PFRSTD,
WX_CFG_PORT_CTL_PFRSTD); /* update setting rx tx for all active vfs */
wx_set_all_vfs(wx);
}
wx_start_hw(wx); /* do not flush user set addresses */
memcpy(old_addr, &wx->mac_table[0].addr, netdev->addr_len);
wx_flush_sw_mac_table(wx);
wx_mac_set_default_filter(wx, old_addr);
if (test_bit(WX_STATE_PTP_RUNNING, wx->state))
wx_ptp_reset(wx);
}
/* disable all enabled rx queues */ for (i = 0; i < wx->num_rx_queues; i++) /* this call also flushes the previous write */
wx_disable_rx_queue(wx, wx->rx_ring[i]);
if (wx->bus.func < 2)
wr32m(wx, TXGBE_MIS_PRB_CTL, TXGBE_MIS_PRB_CTL_LAN_UP(wx->bus.func), 0); else
wx_err(wx, "%s: invalid bus lan id %d\n",
__func__, wx->bus.func);
if (wx->num_vfs) { /* Clear EITR Select mapping */
wr32(wx, WX_PX_ITRSEL, 0); /* Mark all the VFs as inactive */ for (i = 0; i < wx->num_vfs; i++)
wx->vfinfo[i].clear_to_send = 0; /* update setting rx tx for all active vfs */
wx_set_all_vfs(wx);
}
switch (wx->device_id) { case TXGBE_DEV_ID_SP1000: case TXGBE_DEV_ID_WX1820:
wx->mac.type = wx_mac_sp; break; case TXGBE_DEV_ID_AML5010: case TXGBE_DEV_ID_AML5110: case TXGBE_DEV_ID_AML5025: case TXGBE_DEV_ID_AML5125:
wx->mac.type = wx_mac_aml; break; case TXGBE_DEV_ID_AML5040: case TXGBE_DEV_ID_AML5140:
wx->mac.type = wx_mac_aml40; break; default:
wx->mac.type = wx_mac_unknown; break;
}
switch (device_type) { case TXGBE_ID_SFP:
wx->media_type = wx_media_fiber; break; case TXGBE_ID_XAUI: case TXGBE_ID_SGMII:
wx->media_type = wx_media_copper; break; case TXGBE_ID_KR_KX_KX4: case TXGBE_ID_MAC_XAUI: case TXGBE_ID_MAC_SGMII:
wx->media_type = wx_media_backplane; break; case TXGBE_ID_SFI_XAUI: if (wx->bus.func == 0)
wx->media_type = wx_media_fiber; else
wx->media_type = wx_media_copper; break; default:
wx->media_type = wx_media_unknown; break;
}
}
/* PCI config space info */
err = wx_sw_init(wx); if (err < 0) return err;
txgbe_init_type_code(wx);
/* Set common capability flags and settings */
wx->max_q_vectors = TXGBE_MAX_MSIX_VECTORS;
err = wx_get_pcie_msix_counts(wx, &msix_count, TXGBE_MAX_MSIX_VECTORS); if (err)
wx_err(wx, "Do not support MSI-X\n");
wx->mac.max_msix_vectors = msix_count;
/* Hardware has to reinitialize queues and interrupts to *matchpacketbufferalignment.Unfortunately,the *hardwareisnotflexibleenoughtodothisdynamically.
*/ if (netif_running(dev))
txgbe_close(dev); else
txgbe_reset(wx);
wx_clear_interrupt_scheme(wx);
if (tc)
netdev_set_num_tc(dev, tc); else
netdev_reset_tc(dev);
wx_init_interrupt_scheme(wx);
if (netif_running(dev))
txgbe_open(dev);
return0;
}
staticvoid txgbe_reinit_locked(struct wx *wx)
{ int err = 0;
/* The sapphire supports up to 63 VFs per pf, but physical *functionalsoneedonepoolforbasicnetworking.
*/
pci_sriov_set_totalvfs(pdev, TXGBE_MAX_VFS_DRV_LIMIT);
wx->driver_name = txgbe_driver_name;
txgbe_set_ethtool_ops(netdev);
netdev->netdev_ops = &txgbe_netdev_ops;
netdev->udp_tunnel_nic_info = &txgbe_udp_tunnels;
/* setup the private structure */
err = txgbe_sw_init(wx); if (err) goto err_pci_release_regions;
/* check if flash load is done after hw power up */
err = wx_check_flash_load(wx, TXGBE_SPI_ILDR_STATUS_PERST); if (err) goto err_free_mac_table;
err = wx_check_flash_load(wx, TXGBE_SPI_ILDR_STATUS_PWRRST); if (err) goto err_free_mac_table;
err = wx_mng_present(wx); if (err) {
dev_err(&pdev->dev, "Management capability is not present\n"); goto err_free_mac_table;
}
/* make sure the EEPROM is good */
err = txgbe_validate_eeprom_checksum(wx, NULL); if (err != 0) {
dev_err(&pdev->dev, "The EEPROM Checksum Is Not Valid\n");
wr32(wx, WX_MIS_RST, WX_MIS_RST_SW_RST);
err = -EIO; goto err_free_mac_table;
}
err = wx_init_interrupt_scheme(wx); if (err) goto err_cancel_service;
/* Save off EEPROM version number and Option Rom version which *togethermakeauniqueidentifyfortheeeprom
*/
wx_read_ee_hostif(wx,
wx->eeprom.sw_region_offset + TXGBE_EEPROM_VERSION_H,
&eeprom_verh);
wx_read_ee_hostif(wx,
wx->eeprom.sw_region_offset + TXGBE_EEPROM_VERSION_L,
&eeprom_verl);
etrack_id = (eeprom_verh << 16) | eeprom_verl;
err = txgbe_init_phy(txgbe); if (err) goto err_release_hw;
err = register_netdev(netdev); if (err) goto err_remove_phy;
pci_set_drvdata(pdev, wx);
netif_tx_stop_all_queues(netdev);
/* calculate the expected PCIe bandwidth required for optimal *performance.Notethatsomeolderpartswillneverhaveenough *bandwidthduetobeingoldergenerationPCIeparts.Weclampthese *partstoensurethatnowarningisdisplayed,asthiscouldconfuse *usersotherwise.
*/
expected_gts = txgbe_enumerate_functions(wx) * 10;
/* don't check link if we failed to enumerate functions */ if (expected_gts > 0)
txgbe_check_minimum_link(wx); else
dev_warn(&pdev->dev, "Failed to enumerate PF devices.\n");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.