summaryrefslogtreecommitdiffstats
path: root/src/include
Commit message (Collapse)AuthorAgeFilesLines
* [usb] Fix USB timeouts to match specificationMichael Brown2015-03-181-5/+27
| | | | | | | | | | | | | | | Several of the USB timeouts were chosen on the principle of "pick an arbitrary but ridiculously large value, just to be safe". It turns out that some of the timeouts permitted by the USB specification are even larger: for example, control transactions are allowed to take up to five seconds to complete. Fix up these USB timeout values to match those found in the USB2 specification. Debugged-by: Robin Smidsrød <robin@smidsrod.no> Tested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ehci] Add support for EHCI host controllersMichael Brown2015-03-182-0/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add functions for manual device address assignmentMichael Brown2015-03-161-0/+26
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add the concept of a USB bus maximum transfer sizeMichael Brown2015-03-161-1/+5
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Add ffs(), ffsl(), and ffsll()Michael Brown2015-03-161-4/+77
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tcp] Implement support for TCP Selective Acknowledgements (SACK)Michael Brown2015-03-121-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The TCP Selective Acknowledgement option (specified in RFC2018) provides a mechanism for the receiver to indicate packets that have been received out of order (e.g. due to earlier dropped packets). iPXE often operates in environments in which there is a high probability of packet loss. For example, the legacy USB keyboard emulation in some BIOSes involves polling the USB bus from within a system management interrupt: this introduces an invisible delay of around 500us which is long enough for around 40 full-length packets to be dropped. Similarly, almost all 1Gbps USB2 devices will eventually end up dropping packets because the USB2 bus does not provide enough bandwidth to sustain a 1Gbps stream, and most devices will not provide enough internal buffering to hold a full TCP window's worth of received packets. Add support for sending TCP Selective Acknowledgements. This provides the sender with more detailed information about which packets have been lost, and so allows for a more efficient retransmission strategy. We include a SACK-permitted option in our SYN packet, since experimentation shows that at least Linux peers will not include a SACK-permitted option in the SYN-ACK packet if one was not present in the initial SYN. (RFC2018 does not seem to mandate this behaviour, but it is consistent with the approach taken in RFC1323.) We ignore any received SACK options; this is safe to do since SACK is only ever advisory and we never have to send non-trivial amounts of data. Since our TCP receive queue is a candidate for cache discarding under low memory conditions, we may end up discarding data that has been reported as received via a SACK option. This is permitted by RFC2018. We follow the stricture that SACK blocks must not report data which is no longer held by the receiver: previously-reported blocks are validated against the current receive queue before being included within the current SACK block list. Experiments in a qemu VM using forced packet drops (by setting NETDEV_DISCARD_RATE to 32) show that implementing SACK improves throughput by around 400%. Experiments with a USB2 NIC (an SMSC7500) show that implementing SACK improves throughput by around 700%, increasing the download rate from 35Mbps up to 250Mbps (which is approximately the usable bandwidth limit for USB2). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [smsc75xx] Add driver for SMSC/Microchip LAN75xx USB Ethernet NICsMichael Brown2015-03-111-0/+1
| | | | | | | | | | | | | | | | | | | This driver is functional but any downloads via a TCP-based protocol tend to perform poorly. The 1Gbps Ethernet line rate is substantially higher than the 480Mbps (in practice around 280Mbps) provided by USB2, and the device has only 32kB of internal buffer memory. Our 256kB TCP receive window therefore rapidly overflows the RX FIFO, leading to multiple dropped packets (usually within the same TCP window) and hence a low overall throughput. Reducing the TCP window size so that the RX FIFO does not overflow greatly increases throughput, but is not a general-purpose solution. Further investigation is required to determine how other OSes (e.g. Linux) cope with this scenario. It is possible that implementing TCP SACK would provide some benefit. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [mii] Add generic mii_check_link() functionMichael Brown2015-03-101-0/+2
| | | | | | | | | | | | Most devices expose at least the link up/down status via a bit in a MAC register, since the MAC generally already needs to know whether or not the link is up. Some devices (e.g. the SMSC75xx USB NIC) expose this information to software only via the MII registers. Provide a generic mii_check_link() implementation to check the BMSR and report the link status via netdev_link_{up,down}(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [dm96xx] Add driver for Davicom DM96xx USB Ethernet NICsMichael Brown2015-03-092-1/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-054-4/+4
| | | | | | | | | | | Relicense files with kind permission from Stefan Hajnoczi <stefanha@redhat.com> alongside the contributors who have already granted such relicensing permission. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [retry] Rewrite unrelicensable portions of retry.cMichael Brown2015-03-051-10/+26
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [linux] Rewrite headers included in all buildsMichael Brown2015-03-056-79/+73Star
| | | | | | | Rewrite (and relicense) the header files which are included in all builds of iPXE (including non-Linux builds). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Fix the REQUIRE_SYMBOL mechanismMichael Brown2015-03-052-43/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | At some point in the past few years, binutils became more aggressive at removing unused symbols. To function as a symbol requirement, a relocation record must now be in a section marked with @progbits and must not be in a section which gets discarded during the link (either via --gc-sections or via /DISCARD/). Update REQUIRE_SYMBOL() to generate relocation records meeting these criteria. To minimise the impact upon the final binary size, we use existing symbols (specified via the REQUIRING_SYMBOL() macro) as the relocation targets where possible. We use R_386_NONE or R_X86_64_NONE relocation types to prevent any actual unwanted relocation taking place. Where no suitable symbol exists for REQUIRING_SYMBOL() (such as in config.c), the macro PROVIDE_REQUIRING_SYMBOL() can be used to generate a one-byte-long symbol to act as the relocation target. If there are versions of binutils for which this approach fails, then the fallback will probably involve killing off REQUEST_SYMBOL(), redefining REQUIRE_SYMBOL() to use the current definition of REQUEST_SYMBOL(), and postprocessing the linked ELF file with something along the lines of "nm -u | wc -l" to check that there are no undefined symbols remaining. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Use REQUIRE_OBJECT() to drag in per-object configurationMichael Brown2015-03-051-5/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Remove obsolete and unused portions of config.cMichael Brown2015-03-041-1/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Remove unused __keepme macroMichael Brown2015-03-031-8/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Remove unused IMPORT_SYMBOL() and EXPORT_SYMBOL() macrosMichael Brown2015-03-031-48/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [malloc] Rewrite unrelicensable portions of malloc.cMichael Brown2015-03-031-2/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [malloc] Move valgrind headers out of arch/x86Michael Brown2015-03-032-0/+4849
| | | | | | | The valgrind headers are not x86-specific; they detect the CPU architecture and contain inline assembly for multiple architectures. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [menu] Abstract out the generic concept of a jump scrollerMichael Brown2015-03-031-0/+50
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Rewrite unrelicensable portions of pci.hMichael Brown2015-03-031-296/+101Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Remove outdated and mostly-unused pci_ids.h fileMichael Brown2015-03-022-289/+50Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [list] Relicense list.hMichael Brown2015-03-021-1/+1
| | | | | | | | | | | The code in list.h was originally taken from the Linux kernel many years ago, but has been rewritten to the point that no original code remains, and may therefore be relicensed. The functions and data structures remain largely API-compatible, to facilitate the conversion of Linux network drivers to iPXE. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [elf] Rewrite ELF headerMichael Brown2015-03-021-215/+62Star
| | | | | | | Rewrite the ELF header to include only the relevant portions from the ELF specification. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Rewrite byte-swapping codeMichael Brown2015-03-024-140/+148
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Rewrite unrelicensable portions of ctype.hMichael Brown2015-03-021-17/+101
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Rewrite unrelicensable portions of stddef.hMichael Brown2015-03-021-11/+29
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-0237-37/+41
| | | | | | | | | | These files cannot be automatically relicensed by util/relicense.pl since they either contain unusual but trivial contributions (such as the addition of __nonnull function attributes), or contain lines dating back to the initial git revision (and so require manual knowledge of the code's origin). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-028-8/+8
| | | | | | | | | | | | | | | Relicence files with kind permission from the following contributors: Alex Williamson <alex.williamson@redhat.com> Eduardo Habkost <ehabkost@redhat.com> Greg Jednaszewski <jednaszewski@gmail.com> H. Peter Anvin <hpa@zytor.com> Marin Hannache <git@mareo.fr> Robin Smidsrød <robin@smidsrod.no> Shao Miller <sha0.miller@gmail.com> Thomas Horsten <thomas@horsten.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-02201-201/+213
| | | | | | | Relicense files for which I am the sole author (as identified by util/relicense.pl). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add support for the Unmodified Binary Distribution LicenceMichael Brown2015-03-021-0/+11
| | | | | | | | | | | | | | | Add the text for the Unmodified Binary Distribution Licence. This Licence allows for the distribution of unmodified binaries built from publicly available source code, without imposing the obligations of the GNU General Public License upon anyone who chooses to distribute only the unmodified binaries built from that source code. See the licence text for the precise terms and conditions. Add the licence GPL2_OR_LATER_OR_UBDL to the set of licences which can be declared using FILE_LICENCE(), and add the corresponding support to licence.pl. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Include full licence text for all GPL2_OR_LATER filesMichael Brown2015-02-261-3/+13
| | | | | | | | Add the standard warranty disclaimer and Free Software Foundation address paragraphs to the licence text where these are not currently present. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [dhcp] Extract timing parameters out to config/dhcp.hAlex Williamson2015-02-251-10/+0Star
| | | | | | | | | | | | | | iPXE uses DHCP timeouts loosely based on values recommended by the specification, but often abbreviated to reduce timeouts for reliable and/or simple network topologies. Extract the DHCP timing parameters to config/dhcp.h and document them. The resulting default iPXE behavior is exactly the same, but downstreams are now afforded the opportunity to implement spec-compliant behavior via config file overrides. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Rewrite strtoul()Michael Brown2015-02-192-25/+17Star
| | | | | | | | | | The implementation of strtoul() has a partially unknown provenance. Rewrite this code to avoid potential licensing uncertainty. Since we now use -ffunction-sections, there is no need to place strtoull() in a separate file from strtoul(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add generic USB network device frameworkMichael Brown2015-02-172-0/+63
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Rewrite string functionsMichael Brown2015-02-172-42/+97
| | | | | | | | | | | | Some of the C library string functions have an unknown provenance. Reimplement all such functions to avoid potential licensing uncertainty. Remove the inline-assembler versions of strlen(), memswap(), and strncmp(); these save a minimal amount of space (around 40 bytes in total) and are not performance-critical. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Remove unused string functionsMichael Brown2015-02-161-6/+0Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Provide generic framework for refilling receive endpointsMichael Brown2015-02-131-0/+40
| | | | | | | Provide a generic framework for allocating, refilling, and optionally recycling I/O buffers used by bulk IN and interrupt endpoints. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Handle port status changes received after failing to find a driverMichael Brown2015-02-121-1/+7
| | | | | | | | | | | | | | | | | | | | | Commit a60f2dd ("[usb] Try multiple USB device configurations") changed the behaviour of register_usb() such that if no drivers are found then the device will be closed and the memory used will be freed. If a port status change subsequently occurs while the device is still physically attached, then usb_hotplug() will see this as a new device having been attached, since there is no device recorded as being currently attached to the port. This can lead to spurious hotplug events (or even endless loops of hotplug events, if the process of opening and closing the device happens to generate a port status change). Fix by using a separate flag to indicate that a device is physically attached (even if we have no corresponding struct usb_device). Reported-by: Dan Ellis <Dan.Ellis@displaylink.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rndis] Add rndis_rx_err()Michael Brown2015-02-111-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Allow usb_stream() to enforce a terminating short packetMichael Brown2015-02-101-3/+5
| | | | | | | | | | Some USB endpoints require that a short packet be used to terminate transfers, since they have no other way to determine message boundaries. If the message length happens to be an exact multiple of the USB packet size, then this requires the use of an additional zero-length packet. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Parse endpoint descriptor bInterval fieldMichael Brown2015-02-101-1/+8
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Handle CDC union functional descriptorsMichael Brown2015-02-091-0/+17
| | | | | | | USB Communications Device Class devices may use a union functional descriptor to group several interfaces into a function. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Try multiple USB device configurationsMichael Brown2015-02-091-3/+3
| | | | | | | Iterate over a USB device's available configurations until we find one for which we have working drivers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Allow tftp_uri() to construct a URI with a custom portMichael Brown2015-02-061-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ncm] Add support for CDC-NCM USB Ethernet devicesMichael Brown2015-02-032-0/+40
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add support for xHCI host controllersMichael Brown2015-02-031-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add basic support for USB hubsMichael Brown2015-02-031-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add basic support for USB devicesMichael Brown2015-02-033-1/+1154
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Allow drivers to specify a PCI classMichael Brown2015-02-022-93/+55Star
| | | | | | | | Allow drivers to specify a supported PCI class code. To save space in the final binary, make this an attribute of the driver rather than an attribute of a PCI device ID list entry. Signed-off-by: Michael Brown <mcb30@ipxe.org>