summaryrefslogtreecommitdiffstats
path: root/src/drivers/net
Commit message (Collapse)AuthorAgeFilesLines
* [xen] Cope with unexpected initial backend statesMichael Brown2014-08-141-10/+64
| | | | | | | | | | | | | | | | | | | | | | | | | Under some circumstances (e.g. if iPXE itself is booted via iSCSI, or after an unclean reboot), the backend may not be in the expected InitWait state when iPXE starts up. There is no generic reset mechanism for Xenbus devices. Recent versions of xen-netback will gracefully perform all of the required steps if the frontend sets its state to Initialising. Older versions (such as that found in XenServer 6.2.0) require the frontend to transition through Closed before reaching Initialising. Add a reset mechanism for netfront devices which does the following: - read current backend state - if backend state is anything other than InitWait, then set the frontend state to Closed and wait for the backend to also reach Closed - set the frontend state to Initialising and wait for the backend to reach InitWait. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xen] Use version 1 grant tables by defaultMichael Brown2014-08-131-28/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using version 1 grant tables limits guests to using 16TB of grantable RAM, and prevents the use of subpage grants. Some versions of the Xen hypervisor refuse to allow the grant table version to be set after the first grant references have been created, so the loaded operating system may be stuck with whatever choice we make here. We therefore currently use version 2 grant tables, since they give the most flexibility to the loaded OS. Current versions (7.2.0) of the Windows PV drivers have no support for version 2 grant tables, and will merrily create version 1 entries in what the hypervisor believes to be a version 2 table. This causes some confusion. Avoid this problem by attempting to use version 1 tables, since otherwise we may render Windows unable to boot. Play nicely with other potential bootloaders by accepting either version 1 or version 2 grant tables (if we are unable to set our requested version). Note that the use of version 1 tables on a 64-bit system introduces a possible failure path in which a frame number cannot fit into the 32-bit field within the v1 structure. This in turn introduces additional failure paths into netfront_transmit() and netfront_refill_rx(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Generalise snpnet_pci_info() to efi_locate_device()Michael Brown2014-08-061-34/+9Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Try various possible SNP receive filtersCurtis Larsen2014-08-061-11/+37
| | | | | | | | | | | | | | | | | | | | | | | | | The behavior observed in the Apple EFI (1.10) RecieveFilters() call is: - failure if any of the PROMISCUOUS or MULTICAST filters are included - success if only UNICAST is included, however the result is UNICAST|BROADCAST - success if only UNICAST and BROADCAST are included - if UNICAST, or UNICAST|BROADCAST are used, but the previous call tried (and failed) to set UNICAST|BROADCAST|MULTICAST, then the result is UNICAST|BROADCAST|MULTICAST Work around this apparently broken SNP implementation by trying RecieveFilterMask, then falling back to UNICAST|BROADCAST|MULTICAST, then UNICAST|BROADCAST, and finally UNICAST. Modified-by: Michael Brown <mcb30@ipxe.org> Tested-by: Curtis Larsen <larsen@dixie.edu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Open device path protocol only at point of useMichael Brown2014-08-061-4/+27
| | | | | | | | | | | | Some EFI 1.10 systems (observed on an Apple iMac) do not allow us to open the device path protocol with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER and so we cannot maintain a safe, long-lived pointer to the device path. Work around this by instead opening the device path protocol with an attribute of EFI_OPEN_PROTOCOL_GET_PROTOCOL whenever we need to use it. Debugged-by: Curtis Larsen <larsen@dixie.edu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Provide centralised definitions of commonly-used GUIDsMichael Brown2014-08-062-13/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Reset multicast filter list when setting SNP receive filtersMichael Brown2014-08-051-1/+1
| | | | | | | | According to the UEFI specification, the MCastFilter parameter (which we currently pass as NULL, along with a zero MCastFilterCnt) is optional only if ResetMCastFilter is true. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add ability to dump SNP device mode informationMichael Brown2014-08-051-0/+64
| | | | | Originally-implemented-by: Curtis Larsen <larsen@dixie.edu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Dump existing openers when we are unable to open a protocolMichael Brown2014-07-311-0/+2
| | | | | | | | Dump the existing openers of a protocol whenever we are unable to open a protocol using attributes of BY_DEVICE, EXCLUSIVE, or BY_CHILD_CONTROLLER. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Use efi_handle_name() instead of efi_devpath_text() where applicableMichael Brown2014-07-311-24/+23Star
| | | | | | | | | | Using efi_devpath_text() is marginally more efficient if we already have the device path protocol available, but the mild increase in efficiency is not worth compromising the clarity of the pattern: DBGC ( device, "THING %p %s ...", device, efi_handle_name ( device ) ); Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Use efi_handle_name() instead of efi_handle_devpath_text()Michael Brown2014-07-312-4/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xen] Add support for Xen netfront virtual NICsMichael Brown2014-07-292-0/+1005
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [natsemi] Check for ioremap() failuresMichael Brown2014-07-161-0/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [myson] Check for ioremap() failuresMichael Brown2014-07-161-0/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [skel] Check for ioremap() failuresMichael Brown2014-07-161-0/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [vmxnet3] Check for ioremap() failuresMichael Brown2014-07-161-0/+10
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Check for ioremap() failuresMichael Brown2014-07-161-0/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Check for ioremap() failuresMichael Brown2014-07-162-0/+10
| | | | | Debugged-by: Anton D. Kachalov <mouse@yandex-team.ru> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Rewrite SNP NIC driverMichael Brown2014-07-085-510/+418Star
| | | | | | | | | Rewrite the SNP NIC driver to use non-blocking and deferrable transmissions, to provide link status detection, to provide information about the underlying (PCI) hardware device, and to avoid unnecessary I/O buffer allocations during receive polling. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Allow network devices to be created on top of arbitrary SNP devicesMichael Brown2014-07-032-8/+226
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [igbvf] Allow changing of MAC addressHannes Reinecke2014-06-121-0/+4
| | | | | | | | | The VF might not have assigned a MAC address upon startup, and will end up with a random MAC address during probe(). With this patch the MAC address can be changed later on. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [igbvf] Assign random MAC address if none is setHannes Reinecke2014-06-121-10/+4Star
| | | | | | | | | If the VF doesn't have a MAC address assigned we should create a random MAC address. Signed-off-by: Hannes Reinecke <hare@suse.de> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Increase receive ring fill levelMichael Brown2014-05-161-2/+2
| | | | | | | | | | | | | | | | | | As of commit d28bb51 ("[tcp] Defer sending ACKs until all received packets have been processed"), increasing the RX ring size will increase the number of received packets per transmitted ACK (since each poll will process up to one complete receive ring). Under KVM, this can make a substantial (up to ~200%) difference to the overall download speed, since transmissions are very expensive. Increase the ring fill level from four to eight packets: this increases the download speed by around 50% at a cost of around 8kB of heap space. Further speedups are possible by increasing the ring size further, but it would be preferable to find alternative methods which do not use noticeable amounts of heap space. Tested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Exclude time spent in hypervisor from profilingMichael Brown2014-05-061-0/+3
| | | | | | | | When profiling, exclude any time spent inside the hypervisor responding to our MMIO accesses. This substantially reduces the variance accumulated on many other profilers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Push new RX descriptors in batchesMichael Brown2014-04-281-8/+13
| | | | | | | | | | | | Inside a virtual machine, writing the RX ring tail pointer may incur a substantial overhead of processing inside the hypervisor. Minimise this overhead by writing the tail pointer once per batch of descriptors, rather than once per descriptor. Profiling under qemu-kvm (version 1.6.2) shows that this reduces the amount of time taken to refill the RX descriptor ring by around 90%. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Profile common virtual machine operationsMichael Brown2014-04-281-0/+19
| | | | | | | | | Operations which are negligible on physical hardware (such as issuing a posted write to the transmit ring tail register) may involve substantial amounts of processing within the hypervisor if running in a virtual machine. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Avoid completely filling the TX descriptor ringMichael Brown2014-04-222-1/+4
| | | | | | | | | | | | | It is unclear from the datasheets whether or not the TX ring can be completely filled (i.e. whether writing the tail value as equal to the current head value will cause the ring to be treated as completely full or completely empty). It is very plausible that this edge case could differ in behaviour between real hardware and the many implementations of an emulated Intel NIC found in various virtual machines. Err on the side of caution and always leave at least one ring entry empty. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Clear bit 24 of RCRMichael Brown2014-03-202-2/+3
| | | | | | | | | | | | | | | | | | | | | | On an Asus Z87-K motherboard with an onboard 8168 NIC, booting into Windows 7 and then warm rebooting into iPXE results in a broken RX datapath: packets can be transmitted successfully but garbage is received. A cold reboot clears the problem. A dump of the PHY registers reveals only one difference: in the failure case the bits ADVERTISE_PAUSE_CAP and ADVERTISE_PAUSE_ASYM are cleared. Explicitly setting these bits does not fix the problem. A dump of the MAC registers reveals a few differences, of which the most obvious culprit is the undocumented bit 24 of the Receive Configuration Register (RCR), which is set in the failure case. Explicitly clearing this bit does fix the problem. Reported-by: Sebastian Nielsen <ipxe@sebbe.eu> Reported-by: Oliver Rath <rath@mglug.de> Debugged-by: Sebastian Nielsen <ipxe@sebbe.eu> Tested-by: Sebastian Nielsen <ipxe@sebbe.eu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Add ability to dump all internal registersMichael Brown2014-03-201-0/+27
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Dump all MII register contents when link status changesMichael Brown2014-03-101-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Include link status register details in debug messagesMichael Brown2014-03-042-2/+39
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Add some missing PCI IDsMichael Brown2014-01-291-0/+2
| | | | | Tested-by: Philipp Hagen <Philipp.Hagen@she.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Explicitly separate the concept of a completed fetched settingMichael Brown2013-12-051-5/+6
| | | | | | | | | | The fetch_setting() family of functions may currently modify the definition of the specified setting (e.g. to add missing type information). Clean up this interface by requiring callers to provide an explicit buffer to contain the completed definition of the fetched setting, if required. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Add Intel I217 Gigabit Ethernet PCI IDlolipop2013-10-231-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [netdevice] Add method for generating EUI-64 address from link-layer addressMichael Brown2013-09-031-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [3c90x] Fix High-MTU packet receptionThomas Miletich2013-08-201-0/+4
| | | | | | | | | | Prevent the card from flagging packets of 1518 bytes length as overlength. This fixes the High-MTU loopback test. Signed-off-by: Thomas Miletich <thomas.miletich@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [3c90x] Don't round up transmit packet lengthThomas Miletich2013-08-202-3/+5
| | | | | | | | | | The 3c90x B and C revisions support rounding up the packet length to a specific boundary. Disable this feature to avoid overlength packets. This fixes the loopback test. Signed-off-by: Thomas Miletich <thomas.miletich@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [3c90x] Stall upload engine before setting RX ring addressThomas Miletich2013-08-201-0/+4
| | | | | | | | According to the 3c90x datasheet we have to stall the upload (receive) engine before setting the receive ring address. Signed-off-by: Thomas Miletich <thomas.miletich@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add missing FILE_LICENCE declarationsMarin Hannache2013-07-157-0/+14
| | | | | Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Allow extra space in RX buffersMichael Brown2013-07-151-1/+2
| | | | | | | | | | | Some hardware (observed with an onboard RTL8168) will erroneously report a buffer overflow error if the received packet exactly fills the receive buffer. Fix by adding an extra four bytes of padding to each receive buffer. Debugged-by: Thomas Miletich <thomas.miletich@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [velocity] Rewrite VIA Velocity driverAdrian Jamróz2013-07-154-3859/+1163Star
| | | | | | | Signed-off-by: Adrian Jamróz <adrian.jamroz@gmail.com> Modified-by: Thomas Miletich <thomas.miletich@gmail.com> Signed-off-by: Thomas Miletich <thomas.miletich@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Report RX error detail in debug messagesMichael Brown2013-07-151-3/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add FILE_LICENCE for ath9k driver headersMarin Hannache2013-07-1413-0/+26
| | | | | | Signed-off-by: Marin Hannache <git@mareo.fr> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Incorporate ring producer and consumer counters in diagnosticsMichael Brown2013-07-141-1/+6
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rhine] Rewrite VIA Rhine driverAdrian Jamróz2013-07-143-1447/+1037Star
| | | | | | | | | | | | | | | | | | | | | | | Replace the old via-rhine driver with a new version using the iPXE API. Includes fixes by Thomas Miletich for: - MMIO access - Link detection - RX completion in RX overflow case - Reset and EEPROM reloading - CRC stripping - Missing cpu_to_le32() calls - Missing memory barriers Signed-off-by: Adrian Jamróz <adrian.jamroz@gmail.com> Modified-by: Thomas Miletich <thomas.miletich@gmail.com> Tested-by: Thomas Miletich <thomas.miletich@gmail.com> Tested-by: Robin Smidsrød <robin@smidsrod.no> Modified-by: Michael Brown <mcb30@ipxe.org> Tested-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Fix reopening of legacy-mode 8139 NICMichael Brown2013-05-261-3/+5
| | | | | | | | | | | | | | | realtek_destroy_ring() currently does nothing if the card is operating in legacy (pre-RTL8139C+) mode. In particular, the producer and consumer counters are incorrectly left holding their current values. Virtual hardware (e.g. the emulated RTL8139 in qemu and similar VMs) is tolerant of this behaviour, but real hardware will fail to transmit if the descriptors are not used in the correct order. Fix by resetting the producer and consumer counters in realtek_destroy_ring() even if the card is operating in legacy mode. Reported-by: Gelip <mrgelip@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Eliminate settings "tag magic"Michael Brown2013-05-011-8/+5Star
| | | | | | | Create an explicit concept of "settings scope" and eliminate the magic values used for numerical setting tags. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Defer packets when no transmit descriptors are availableMichael Brown2013-05-011-3/+3
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Ensure EEPROM writes reach chip before starting udelay()Michael Brown2013-05-011-0/+3
| | | | | | | | | | | | | | | On some systems, it appears to be possible for writes to the EEPROM registers to be delayed for long enough that the EEPROM's setup and hold times are violated, resulting in invalid data being read from the EEPROM. Fix by inserting a PCI read cycle immediately after writes to RTL_9346CR, to ensure that the write has completed before starting the udelay() used to time the SPI bus transitions. Reported-by: Gelip <mrgelip@gmail.com> Tested-by: Gelip <mrgelip@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [realtek] Allow reaction time between writing RTL_CAPR and reading RTL_CRMichael Brown2013-04-301-0/+3
| | | | | | | | | | | | | | Some older RTL8139 chips seem to not immediately update the RTL_CR.BUFE bit in response to a write to RTL_CAPR. This results in iPXE seeing a spurious zero-length received packet, and thereafter being out of sync with the hardware's RX ring offset. Fix by inserting an extra PCI read cycle after writing to RTL_CAPR, to give the chip time to react before we next read RTL_CR. Reported-by: Gelip <mrgelip@gmail.com> Tested-by: Gelip <mrgelip@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>