summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* [usb] Handle CDC union functional descriptorsMichael Brown2015-02-093-3/+100
| | | | | | | 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-092-72/+137
| | | | | | | 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>
* [ncm] Reserve headroom in received packetsMichael Brown2015-02-061-1/+11
| | | | | | | | | Some protocols (such as ARP) may modify the received packet and re-use the same I/O buffer for transmission of a reply. To allow this, reserve sufficient headroom at the start of each received packet buffer for our transmit datapath headers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Maintain a queue for received PXE UDP packetsMichael Brown2015-02-061-38/+85
| | | | | | | | | Some devices return multiple packets in a single poll. Handle such devices gracefully by enqueueing received PXE UDP packets (along with a pseudo-header to hold the IPv4 addresses and port numbers) and dequeueing them on subsequent calls to PXENV_UDP_READ. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pxe] Use tftp_uri() to construct PXE TFTP URIsMichael Brown2015-02-061-12/+15
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [uri] Allow tftp_uri() to construct a URI with a custom portMichael Brown2015-02-064-7/+30
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [tftp] Explicitly abort connection whenever parent interface is closedMichael Brown2015-02-062-48/+23Star
| | | | | | | | | Fetching the TFTP file size is currently implemented via a custom "tftpsize://" protocol hack. Generalise this approach to instead close the TFTP connection whenever the parent data-transfer interface is closed. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ncm] Use large multi-packet buffers by defaultMichael Brown2015-02-062-165/+301
| | | | | | | | | | | | | | | | | | | | | | | | Some devices have a very small number of internal buffers, and rely on being able to pack multiple packets into each buffer. Using 2048-byte buffers on such devices produces throughput of around 100Mbps. Using a small number of much larger buffers (e.g. 32kB) increases the throughput to around 780Mbps. (The full 1Gbps is not reached because the high RTT induced by the use of multi-packet buffers causes us to saturate our 256kB TCP window.) Since allocation of large buffers is very likely to fail, allocate the buffer set only once when the device is opened and recycle buffers immediately after use. Received data is now always copied to per-packet buffers. If allocation of large buffers fails, fall back to allocating a larger number of smaller buffers. This will give reduced performance, but the device will at least still be functional. Share code between the interrupt and bulk IN endpoint handlers, since the buffer handling is now very similar. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Report xHCI host controller eventsMichael Brown2015-02-052-0/+41
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ncm] Add support for CDC-NCM USB Ethernet devicesMichael Brown2015-02-036-0/+1198
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add support for xHCI host controllersMichael Brown2015-02-035-0/+4081
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add basic support for USB hubsMichael Brown2015-02-035-0/+805
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [usb] Add basic support for USB devicesMichael Brown2015-02-035-1/+2822
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [romprefix] Ensure UNDI loader can be included by all ROM typesMichael Brown2015-02-023-0/+30
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [pci] Allow drivers to specify a PCI classMichael Brown2015-02-024-101/+63Star
| | | | | | | | 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>
* [build] Include Hyper-V driver in the all-drivers buildMichael Brown2014-12-211-0/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Require support for VMBus version 3.0 or newerMichael Brown2014-12-212-17/+83
| | | | | | | | | | | | | | | | | | | | | | | | We require the ability to disconnect from and reconnect to VMBus; if we don't have this then there is no (viable) way for a loaded operating system to continue to use any VMBus devices. (There is also a small but non-zero risk that the host will continue to write to our interrupt and monitor pages, since the VMBUS_UNLOAD message in earlier versions is essentially a no-op.) This requires us to ensure that the host supports protocol version 3.0 (VMBUS_VERSION_WIN8_1). However, we can't actually _use_ protocol version 3.0, since doing so causes an iSCSI-booted Windows Server 2012 R2 VM to crash due to a NULL pointer dereference in vmbus.sys. To work around this problem, we first ensure that we can connect using protocol v3.0, then disconnect and reconnect using the oldest known protocol. This deliberately prevents the use of the iPXE native Hyper-V drivers on older versions of Hyper-V, where we could use our drivers but in so doing would break the loaded operating system. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Tidy up debug outputMichael Brown2014-12-201-2/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rndis] Ignore start-of-day RNDIS_INDICATE_STATUS_MSG with status 0x40020006Michael Brown2014-12-202-0/+6
| | | | | | | | | | | Windows Server 2012 R2 generates an RNDIS_INDICATE_STATUS_MSG with a status code of 0x4002006. This status code does not appear to be documented anywhere within the sphere of human knowledge. Explicitly ignore this status code in order to avoid unnecessarily cluttering the display when RNDIS debugging is enabled. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Assume that VMBus xfer page ranges correspond to RNDIS messagesMichael Brown2014-12-204-94/+72Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The (undocumented) VMBus protocol seems to allow for transfer page-based packets where the data payload is split into an arbitrary set of ranges within the transfer page set. The RNDIS protocol includes a length field within the header of each message, and it is known from observation that multiple RNDIS messages can be concatenated into a single VMBus message. iPXE currently assumes that the transfer page range boundaries are entirely arbitrary, and uses the RNDIS header length to determine the RNDIS message boundaries. Windows Server 2012 R2 generates an RNDIS_INDICATE_STATUS_MSG for an undocumented and unknown status code (0x40020006) with a malformed RNDIS header length: the length does not cover the StatusBuffer portion of the message. This causes iPXE to report a malformed RNDIS message and to discard any further RNDIS messages within the same VMBus message. The Linux Hyper-V driver assumes that the transfer page range boundaries correspond to RNDIS message boundaries, and so does not notice the malformed length field in the RNDIS header. Match the behaviour of the Linux Hyper-V driver: assume that the transfer page range boundaries correspond to the RNDIS message boundaries and ignore the RNDIS header length. This avoids triggering the "malformed packet" error and also avoids unnecessary data copying: since we now have one I/O buffer per RNDIS message, there is no longer any need to use iob_split(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Increase TX ring sizeMichael Brown2014-12-201-1/+1
| | | | | | | | Empirical observation suggests that 32 is a sensible size to minimise the number of deferred packet transmissions without overflowing the VMBus transmit ring buffer. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Receive all VMBus messages in a pollMichael Brown2014-12-201-1/+3
| | | | | | | Allow for elision of transmitted TCP ACKs by handling all received VMBus messages in each network device poll operation. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rndis] Clear receive filter when closing the deviceMichael Brown2014-12-201-11/+30
| | | | | | | | | On Windows Server 2012 R2, closing and reopening the device will sometimes result in a non-functional RX datapath. The root cause is unknown. Clearing the receive filter before closing the device seems to fix the problem. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Tear down NetVSC RX buffer GPADL after closing VMBus deviceMichael Brown2014-12-201-24/+20Star
| | | | | | | | | | | | | On Windows Server 2012 R2, the receive buffer teardown completion message seems to occasionally be deferred until after the VMBus channel has been closed. This happens even if there are no packets currently in the receive buffer. Work around this problem by separating the revocation and teardown of the receive buffer, and deferring the teardown until after the VMBus channel has been closed. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rndis] Send RNDIS_HALT_MSGMichael Brown2014-12-192-1/+59
| | | | | | The RNDIS specification requires that we send RNDIS_HALT_MSG. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rndis] Send RNDIS_INITIALISE_MSGMichael Brown2014-12-192-24/+181
| | | | | | | | The Hyper-V RNDIS implementation on Windows Server 2012 R2 requires that we send an explicit RNDIS initialisation message in order to get a working RX datapath. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Add support for NetVSC paravirtual network devicesMichael Brown2014-12-184-0/+1207
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Add support for VMBus devicesMichael Brown2014-12-187-0/+1905
| | | | | | Add support for an abstraction of a VMBus device. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [hyperv] Add support for Hyper-V hypervisorMichael Brown2014-12-1810-3/+977
| | | | | | | Add support for detecting and communicating with the Hyper-V hypervisor. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [rndis] Add generic RNDIS device abstractionMichael Brown2014-12-184-6/+1204
| | | | | | | RNDIS provides an abstraction of a network device on top of a generic packet transmission mechanism. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [iobuf] Add iob_split() to split an I/O buffer into portionsMichael Brown2014-12-182-0/+31
| | | | | | | | | | | RNDIS devices may provide multiple packets encapsulated into a single message. Provide an API to allow the RNDIS driver to split an I/O buffer into smaller portions. The current implementation will always copy the underlying data, rather than splitting the buffer in situ. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [device] Provide a driver-private data field for root devicesMichael Brown2014-12-181-0/+23
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [malloc] Report caller address as soon as memory corruption is detectedMichael Brown2014-12-151-1/+21
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [malloc] Check integrity of free listMichael Brown2014-12-151-1/+59
| | | | | | | | | | | | | | | | | | Check the integrity of the free memory block list before and after any modifications to the list. We check that certain invariants are preserved: - the list is a well-formed doubly linked list - all blocks are at least MIN_MEMBLOCK_SIZE - no block extends beyond the end of our address space - blocks remain sorted in ascending order of address - no blocks are adjacent (i.e. any adjacent blocks have been merged) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [malloc] Sanity check parameters to alloc_memblock() and free_memblock()Michael Brown2014-12-151-0/+6
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [malloc] Tidy up debug outputMichael Brown2014-12-151-19/+23
| | | | | | Colourise debug output and move per-allocation messages to DBGLVL_EXTRA. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [list] Add sanity checks after list-adding functionsMichael Brown2014-12-121-0/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [libc] Add ASSERTED macro to test if any assertion has triggeredMichael Brown2014-12-121-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [netdevice] Fix erroneous use of free(iobuf) instead of free_iob(iobuf)Michael Brown2014-12-121-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [vmxnet3] Add profiling code to exclude time spent in the hypervisorMichael Brown2014-12-121-1/+33
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [crypto] Fix parsing of OCSP responder ID key hashMichael Brown2014-11-242-3/+419
| | | | | | | | | | | | | | | | | | | | We currently compare the entirety of the KeyHash object (including the ASN.1 tag and length byte) against the raw SHA-1 hash of the certificate's public key. This causes OCSP validation to fail for any responses which identify the responder by key hash rather than by name, and hence prevents the use of X.509 certificates where any certificate in the chain has an OCSP responder which chooses to identify itself via its key hash. Fix by adding the missing asn1_enter() required to enter the ASN.1 octet string containing the key hash. Also add a corresponding test case including an OCSP response where the responder is identified by key hash, to ensure that this functionality cannot be broken in future. Debugged-by: Brian Rak <brak@gameservers.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [intel] Use autoloaded MAC address instead of EEPROM MAC addressMichael Brown2014-10-311-4/+4
| | | | | | | | | | | | | | | | | | | The i350 (and possibly other Intel NICs) have a non-trivial correspondence between the PCI function number and the external physical port number. For example, the i350 has a "LAN Function Sel" bit within the EEPROM which can invert the mapping so that function 0 becomes port 3, function 1 becomes port 2, etc. Unfortunately the MAC addresses within the EEPROM are indexed by physical port number rather than PCI function number. The end result is that when anything other than the default mapping is used, iPXE will use the wrong address as the base MAC address. Fix by using the autoloaded MAC address if it is valid, and falling back to reading the MAC address directly from the EEPROM only if no autoloaded address is available. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ping] Allow "ping" command output to be inhibitedMichael Brown2014-10-234-9/+17
| | | | | Originally-implemented-by: Cedric Levasseur <cyr-ius@ipocus.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ping] Allow termination after a specified number of packetsMichael Brown2014-10-235-7/+51
| | | | | | | | | | | | | | | | | | | | | | | | | Add the "-c <count>" option to the "ping" command, allowing for automatic termination after a specified number of packets. When a number of packets is specified: - if a serious error (i.e. length mismatch or content mismatch) occurs, then the ping will be immediately terminated with the relevant status code; - if at least one response is received successfully, and all errors are non-serious (i.e. timeouts or out-of-sequence responses), then the ping will be terminated after the final response (or timeout) with a success status; - if no responses are received successfully, then the ping will be terminated after the final timeout with ETIMEDOUT. If no number of packets is specified, then the ping will continue until manually interrupted. Originally-implemented-by: Cedric Levasseur <cyr-ius@ipocus.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [ping] Report timed-out pings via the callback functionMichael Brown2014-10-232-3/+14
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Include NII driver within "snp" and "snponly" build targetsMichael Brown2014-10-174-106/+195
| | | | | | | | | End users almost certainly don't care whether the underlying interface is SNP or NII/UNDI. Try to minimise surprise and unnecessary documentation by including the NII driver whenever the SNP driver is requested. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Check for presence of UNDI in NII protocolMichael Brown2014-10-171-0/+6
| | | | | | | | iPXE itself exposes a dummy NII protocol with no UNDI. Avoid potentially dereferencing a NULL pointer by checking for a non-zero UNDI address. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Add NII / UNDI driverMichael Brown2014-10-165-0/+1977
| | | | | | | | | | | | | | | | | | | | | | | Some UEFI network drivers provide a software UNDI interface which is exposed via the Network Interface Identifier Protocol (NII), rather than providing a Simple Network Protocol (SNP). The UEFI platform firmware will usually include the SnpDxe driver, which attaches to NII and provides an SNP interface. The SNP interface is usually provided on the same handle as the underlying NII device. This causes problems for our EFI driver model: when efi_driver_connect() detaches existing drivers from the handle it will cause the SNP interface to be uninstalled, and so our SNP driver will not be able to attach to the handle. The platform firmware will eventually reattach the SnpDxe driver and may attach us to the SNP handle, but we have no way to prevent other drivers from attaching first. Fix by providing a driver which can attach directly to the NII protocol, using the software UNDI interface to drive the network device. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Update to current EDK2 headersMichael Brown2014-10-165-15/+60
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [efi] Generalise snpnet_dev_info() to efi_device_info()Michael Brown2014-10-163-60/+69
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>