david/ipxe
david
/
ipxe
Archived
1
0
Fork 0
Commit Graph

4982 Commits

Author SHA1 Message Date
Michael Brown c9dbe1d39c [pxe] Use tftp_uri() to construct PXE TFTP URIs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-06 12:27:20 +00:00
Michael Brown e2a26f76de [uri] Allow tftp_uri() to construct a URI with a custom port
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-06 12:18:18 +00:00
Michael Brown 2dfdcae938 [tftp] Explicitly abort connection whenever parent interface is closed
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>
2015-02-06 12:08:54 +00:00
Michael Brown 2d3f2b2446 [ncm] Use large multi-packet buffers by default
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>
2015-02-06 09:54:04 +00:00
Michael Brown 66048e3214 [usb] Report xHCI host controller events
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-05 12:40:05 +00:00
Michael Brown cc5a27f9cb [ncm] Add support for CDC-NCM USB Ethernet devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-03 12:33:35 +00:00
Michael Brown fd53ada87c [usb] Add support for xHCI host controllers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-03 12:33:28 +00:00
Michael Brown e17e771a13 [usb] Add basic support for USB hubs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-03 12:19:52 +00:00
Michael Brown 018b13dcec [usb] Add basic support for USB devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-03 12:19:47 +00:00
Michael Brown 8c43891db4 [romprefix] Ensure UNDI loader can be included by all ROM types
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-02 15:11:41 +00:00
Michael Brown 072d656a2f [pci] Allow drivers to specify a PCI class
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>
2015-02-02 14:31:18 +00:00
Michael Brown d38bac05e7 [build] Include Hyper-V driver in the all-drivers build
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-21 11:21:34 +00:00
Michael Brown 0166a68351 [hyperv] Require support for VMBus version 3.0 or newer
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>
2014-12-21 11:21:23 +00:00
Michael Brown af07324af9 [hyperv] Tidy up debug output
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-20 21:33:59 +00:00
Michael Brown f6a3bc0aa1 [rndis] Ignore start-of-day RNDIS_INDICATE_STATUS_MSG with status 0x40020006
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>
2014-12-20 21:33:59 +00:00
Michael Brown 639632b059 [hyperv] Assume that VMBus xfer page ranges correspond to RNDIS messages
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>
2014-12-20 21:33:53 +00:00
Michael Brown a69c9953ac [hyperv] Increase TX ring size
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>
2014-12-20 12:41:42 +00:00
Michael Brown 4e6821662c [hyperv] Receive all VMBus messages in a poll
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>
2014-12-20 12:40:17 +00:00
Michael Brown 67291465ea [rndis] Clear receive filter when closing the device
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>
2014-12-20 12:06:35 +00:00
Michael Brown cd68d93b6e [hyperv] Tear down NetVSC RX buffer GPADL after closing VMBus device
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>
2014-12-20 01:53:35 +00:00
Michael Brown 4de0e273a7 [rndis] Send RNDIS_HALT_MSG
The RNDIS specification requires that we send RNDIS_HALT_MSG.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-19 18:09:04 +00:00
Michael Brown 1d0ade42db [rndis] Send RNDIS_INITIALISE_MSG
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>
2014-12-19 17:05:56 +00:00
Michael Brown ef16d0d2b3 [hyperv] Add support for NetVSC paravirtual network devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-18 16:27:37 +00:00
Michael Brown d1894970db [hyperv] Add support for VMBus devices
Add support for an abstraction of a VMBus device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-18 16:27:37 +00:00
Michael Brown d77a546fb4 [hyperv] Add support for Hyper-V hypervisor
Add support for detecting and communicating with the Hyper-V
hypervisor.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-18 16:27:27 +00:00
Michael Brown 1d2b7c91f7 [rndis] Add generic RNDIS device abstraction
RNDIS provides an abstraction of a network device on top of a generic
packet transmission mechanism.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-18 14:46:38 +00:00
Michael Brown c86b22221d [iobuf] Add iob_split() to split an I/O buffer into portions
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>
2014-12-18 14:46:38 +00:00
Michael Brown d83fb45b66 [device] Provide a driver-private data field for root devices
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-18 14:46:38 +00:00
Michael Brown 35c5379760 [malloc] Report caller address as soon as memory corruption is detected
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-15 14:48:02 +00:00
Michael Brown 7871666740 [malloc] Check integrity of free list
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>
2014-12-15 14:45:05 +00:00
Michael Brown 9154f2aef3 [malloc] Sanity check parameters to alloc_memblock() and free_memblock()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-15 14:42:26 +00:00
Michael Brown 998e69ae14 [malloc] Tidy up debug output
Colourise debug output and move per-allocation messages to DBGLVL_EXTRA.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-15 14:39:55 +00:00
Michael Brown 28149d30f5 [list] Add sanity checks after list-adding functions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-12 10:18:03 +00:00
Michael Brown 67879f66eb [libc] Add ASSERTED macro to test if any assertion has triggered
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-12 10:18:03 +00:00
Michael Brown 14722c27d6 [netdevice] Fix erroneous use of free(iobuf) instead of free_iob(iobuf)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-12 10:18:03 +00:00
Michael Brown d08547309b [vmxnet3] Add profiling code to exclude time spent in the hypervisor
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-12 10:18:03 +00:00
Michael Brown 5cbdc41778 [crypto] Fix parsing of OCSP responder ID key hash
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>
2014-11-24 15:05:43 +00:00
Michael Brown a937615151 [intel] Use autoloaded MAC address instead of EEPROM MAC address
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>
2014-10-31 15:24:40 +00:00
Michael Brown dea6a6c1a0 [ping] Allow "ping" command output to be inhibited
Originally-implemented-by: Cedric Levasseur <cyr-ius@ipocus.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-23 16:52:08 +01:00
Michael Brown 1c34ca70d1 [ping] Allow termination after a specified number of packets
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>
2014-10-23 16:39:42 +01:00
Michael Brown d1afe731ea [ping] Report timed-out pings via the callback function
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-23 15:04:10 +01:00
Michael Brown af17abf67f [efi] Include NII driver within "snp" and "snponly" build targets
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>
2014-10-17 16:52:31 +01:00
Michael Brown feb3a0f7d5 [efi] Check for presence of UNDI in NII protocol
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>
2014-10-17 16:52:31 +01:00
Michael Brown 047baaba38 [efi] Add NII / UNDI driver
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>
2014-10-16 14:13:20 +01:00
Michael Brown 318b5fca1a [efi] Update to current EDK2 headers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-16 14:12:42 +01:00
Michael Brown b9a5ff2b03 [efi] Generalise snpnet_dev_info() to efi_device_info()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-16 14:12:42 +01:00
Michael Brown b71e93bb71 [efi] Free transmit ring entry before calling netdev_tx_complete()
The snpnet driver uses netdev_tx_defer() and so must ensure that space
in the (single-entry) transmit descriptor ring is freed up before
calling netdev_tx_complete().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-16 14:12:42 +01:00
Anton D. Kachalov 86285d1d54 [intel] Add 8086:1557 card (Intel 82599 10G ethernet mezz)
Signed-off-by: Anton D. Kachalov <mouse@yandex-team.ru>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-03 13:22:09 +01:00
Michael Brown a48a71b720 [efi] Add definitions of GUIDs observed when chainloading from Intel driver
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-25 13:16:44 +01:00
Michael Brown 9ee89d0bf1 [efi] Centralise definitions of more protocol GUIDs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-25 12:29:12 +01:00