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

4217 Commits

Author SHA1 Message Date
Michael Brown 5b4958388d [cmdline] Store exit status of failed command in errno
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-12 15:42:29 +01:00
Michael Brown e84e19d4ed [pxeprefix] Fetch command line (if any) via PXENV_FILE_CMDLINE
Use PXENV_FILE_CMDLINE to retrieve the command line (if any) provided
by the invoking PXE stack.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-11 21:26:53 +01:00
Michael Brown a814eff38e [pxe] Add PXENV_FILE_CMDLINE API call
Allow a PXE NBP to obtain its command line (if any) via the new PXE
API call PXENV_FILE_CMDLINE.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-11 18:16:13 +01:00
Michael Brown 9e5152e095 [pxeprefix] Place temporary stack after iPXE binary
Some BIOSes (observed on a Supermicro system with an AMI BIOS) seem to
use the area immediately below 0x7c00 to store data related to the
boot process.  This data is currently liable to be overwritten by the
temporary stack used while decompressing and installing iPXE.

Try to avoid any such problems by placing the temporary stack
immediately after the loaded iPXE binary.  Any memory used by the
stack could then potentially have been overwritten anyway by a larger
binary.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-10 16:10:49 +01:00
Michael Brown 9f0b2d25a8 [intel] Explicitly enable descriptor queues
On i350 the datasheet contradicts itself in stating that the default
value of RXDCTL.ENABLE for queue zero is both set (according to the
"Receive Initialization" section) and unset (according to the "Receive
Descriptor Control - RXDCTL" section).  Empirical evidence suggests
that the default value is unset.

Explicitly enable both transmit and receive queues to avoid any
ambiguity.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-10 11:21:22 +01:00
Michael Brown 8391ff3ee0 [intel] Refill receive ring only after enabling receiver
On 82576 (and probably others), the datasheet states that "the tail
register of the queue (RDT[n]) should not be bumped until the queue is
enabled".  There is some confusion over exactly what constitutes
"enabled": the initialisation blurb says that we should "poll the
RXDCTL register until the ENABLE bit is set", while the description
for the RXDCTL register says that the ENABLE bit is set by default
(for queue zero).  Empirical evidence suggests that the ENABLE bit
reads as set immediately after writing to RCTL.EN, and so polling is
not necessary.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-10 09:32:58 +01:00
Michael Brown 2c72ce04ae [bzimage] Update setup_move_size only for protocol versions 2.00 and 2.01
The setup_move_size field is not defined in protocol versions earlier
than 2.00 (and is obsolete in versions later than 2.01).  In binaries
using versions earlier than 2.00, the relevant location is likely to
contain executable code.

Interestingly, this bug has been present since support for pre-2.00
protocol versions was added in 2009, and has been unexpectedly
modifying the memtest86+ code fragment:

	mov	$0x92, %dx
	inb	%dx, %al

Fortuitously, the modification exactly overwrote the value loaded into
%dx, and so the net effect was limited to causing Fast Gate A20
detection to always fail.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-09 20:32:34 +01:00
Michael Brown 07bc73e087 [tcp] Increase maximum window size to 256kB
A window size of 256kB should be sufficient to allow for
full-bandwidth transfers over a Gigabit LAN, and for acceptable
transfer speeds over other typical links.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-09 10:15:24 +01:00
Michael Brown 6825b2e7bf [malloc] Increase heap size to 512kB
The maximum TCP throughput is fundamentally limited by the amount of
available receive buffer space.  Increase the heap size from 128kB to
512kB to allow the use of larger TCP windows.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-09 10:13:47 +01:00
Michael Brown a5d16a91af [tcp] Truncate TCP window to prevent future packet discards
Whenever memory pressure causes a queued packet to be discarded (and
so retransmitted), reduce the maximum TCP window to a size that would
have prevented the discard.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-09 10:13:47 +01:00
Michael Brown 024247317d [arp] Try to avoid discarding ARP cache entries
Discarding the active ARP cache entry in the middle of a download will
substantially disrupt the TCP stream.  Try to minimise any such
disruption by treating ARP cache entries as expensive, and discarding
them only when nothing else is available to discard.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-09 10:08:38 +01:00
Michael Brown 8d95e1d6ff [malloc] Discard cached items less aggressively
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-09 10:08:37 +01:00
Michael Brown 4a8a7bd91a [iobuf] Allocate I/O buffer descriptor separately to conserve aligned memory
I/O buffers are allocated on aligned boundaries.  The I/O buffer
descriptor (the struct io_buffer) is currently attached to the end of
the I/O buffer.  When the size of the buffer is close to its
alignment, this can waste large amounts of aligned memory.

For example, a network card using 2048-byte receive buffers will end
up allocating 2072 bytes on a 2048-byte boundary.  This effectively
wastes 50% of the available memory.

Improve the situation by allocating the descriptor separately from the
main I/O buffer if inline allocation would cause the total allocated
size to cross the alignment boundary.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-08 17:54:53 +01:00
Michael Brown b0e236a9ee [netdevice] Process all received packets in net_poll()
The current logic is to process at most one received packet per call
to net_poll(), on the basis that refilling the hardware descriptor
ring should be delayed as little as possible.  However, this limits
the rate at which packets can be processed and ultimately ends up
adding latency which, in turn, limits the achievable throughput.

With temporary modifications in place to essentially remove all
resource constraints (heap size increased to 16MB, RX descriptor ring
increased to 64 descriptors) and a TCP window size of 1MB, the
throughput on a gigabit (i.e. 119MBps) network can be observed to fall
off exponentially from around 115MBps to around 75MBps.  Changing
net_poll() to process all received packets results in a steady
119MBps throughput.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-04 13:41:49 +01:00
Michael Brown f3d197a529 [cmdline] Do not ignore empty initial arguments in concat_args()
Reported-by: Oliver Rath <rath@mglug.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-04 13:37:08 +01:00
Michael Brown bc93e8ab41 [util] Avoid compiler warning on gcc 4.6
Commit 196751c ("[build] Enable warnings when building utilities")
revealed a previously hidden compiler warning in util/nrv2b.c
regarding an out-of-bounds array subscript in the code

    #if defined(SWD_BEST_OFF)
        if (s->best_pos[2] == 0)
            s->best_pos[2] = key + 1;
    #endif

where best_pos[] is defined by

    #define SWD_BEST_OFF 1

    #if defined(SWD_BEST_OFF)
        unsigned int best_off[ SWD_BEST_OFF ];
        unsigned int best_pos[ SWD_BEST_OFF ];
    #endif

With SWD_BEST_OFF set to 1, it can be proven that all code paths
referring to s->best_off[] and s->best_pos[] will never be executed,
with the exception of the two lines above.  Since these two lines
alone can have no effect on execution, we can safely undefine
SWD_BEST_OFF.

Verified by comparing md5sums of bin/undionly.kpxe before and after
the change.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-03 18:58:43 +01:00
Christian Hesse b3adabd07b [menu] Truncate menu title when necessary
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-03 14:12:47 +01:00
Michael Brown 19859d8ead [arp] Prevent ARP cache entries from being deleted mid-transmission
Each ARP cache entry maintains a transmission queue, which is sent out
as soon as the link-layer address is known.  If multiple packets are
queued, then it is possible for memory pressure to cause the ARP cache
discarder to be invoked during transmission of the first packet, which
may cause the ARP cache entry to be deleted before the second packet
can be sent.  This results in an invalid pointer dereference.

Avoid this problem by reference-counting ARP cache entries and
ensuring that an extra reference is held while processing the
transmission queue, and by using list_first_entry() rather than
list_for_each_entry_safe() to traverse the queue.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-01 18:31:23 +01:00
Michael Brown 55f52bb77a [tcp] Avoid potential NULL pointer dereference
Commit ea61075 ("[tcp] Add support for TCP window scaling") introduced
a potential NULL pointer dereference by referring to the connection's
send window scale before checking whether or not the connection is
known.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-30 19:03:07 +01:00
Michael Brown 49ac629821 [tcp] Use a zero window size for RST packets
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-30 19:00:05 +01:00
Michael Brown a5c016d93e [iobuf] Relax alignment requirement for small I/O buffers
iPXE currently aligns all I/O buffers on a 2kB boundary.  This is
overkill for transmitted packets, which are typically much smaller
than 2kB.

Align I/O buffers on their own size.  This reduces the alignment
requirement for small buffers, while preserving the guarantee that I/O
buffers will never cross boundaries that might cause problems for some
DMA engines.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-29 16:07:12 +01:00
Michael Brown 9a8c6b00d4 [tls] Request a maximum fragment length of 2048 bytes
The default maximum plaintext fragment length for TLS is 16kB, which
is a substantial amount of memory for iPXE to have to allocate for a
temporary decryption buffer.

Reduce the memory footprint of TLS connections by requesting a maximum
fragment length of 2kB.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-29 15:28:15 +01:00
Michael Brown ea61075c60 [tcp] Add support for TCP window scaling
The maximum unscaled TCP window (64kB) implies a maximum bandwidth of
around 300kB/s on a WAN link with an RTT of 200ms.  Add support for
the TCP window scaling option to remove this upper limit.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-29 15:05:33 +01:00
Michael Brown 76d9c1a001 [undi] Align the received frame payload for faster processing
The undinet driver always has to make a copy of the received frame
into an I/O buffer.  Align this copy sensibly so that subsequent
operations are as fast as possible.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-29 01:06:00 +01:00
Michael Brown 85917ba8dd [monojob] Check for keypresses only once per timer tick
Checking for keypresses takes a non-negligible amount of time, and
measurably affects our RTT.  Minimise the impact by checking for
keypresses only once per timer tick.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-28 16:02:37 +01:00
Michael Brown ec22e08db1 [tcpip] Add faster algorithm for calculating the TCP/IP checksum
The generic TCP/IP checksum implementation requires approximately 10
CPU clocks per byte (as measured using the TSC).  Improve this to
approximately 0.5 CPU clocks per byte by using "lodsl ; adcl" in an
unrolled loop.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-28 16:02:31 +01:00
Michael Brown bb9961fb54 [test] Add self-tests for TCP/IP checksum calculation
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-27 19:15:18 +01:00
Michael Brown 1d77d03216 [tcpip] Allow for architecture-specific TCP/IP checksum routines
Calculating the TCP/IP checksum on received packets accounts for a
substantial fraction of the response latency.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-27 19:15:17 +01:00
Michael Brown 6a4ff519c8 [libc] Simplify memcpy() implementation
The "rep" prefix can be used with an iteration count of zero, which
allows the variable-length memcpy() to be implemented without using
any conditional jumps.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-27 19:15:17 +01:00
Michael Brown 80cdf6acc7 [test] Add memcpy() self-tests
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-27 19:15:16 +01:00
Michael Brown ba480730dc [cmdline] Increase resolution of "time" command
A reasonably large (512MB) file transferred via HTTP over Gigabit
Ethernet should complete in around 4.6 seconds.  Increase the
resolution of the "time" command to tenths of a second, to allow such
transfers to be meaningfully measured.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-27 19:15:16 +01:00
Michael Brown cc3e9f068b [realtek] Add missing cpu_to_le16()
Reported-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-27 19:15:16 +01:00
Christian Hesse 512ed2b921 [ui] Allow colours to be configured via config/colour.h
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-27 18:40:17 +01:00
Michael Brown 567b9bf9e7 [ui] Change "login" colours to match other UIs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-27 18:01:33 +01:00
Valentine Barshak edcca8e91b [sky2] Fix invalid memory access
Use hw pointer in PCI driver data as expected by sky2_remove().

Signed-off-by: Valentine Barshak <gvaxon@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-27 15:44:35 +01:00
Michael Brown cbc54bf559 [syslog] Include hostname within syslog messages where possible
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-20 14:59:06 +01:00
Michael Brown 7ea6764031 [settings] Move "domain" setting from dns.c to settings.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-20 14:39:03 +01:00
Michael Brown 4010890a39 [crypto] Allow an error margin on X.509 certificate validity periods
iPXE has no concept of the local time zone, mainly because there is no
viable way to obtain time zone information in the absence of local
state.  This causes potential problems with newly-issued certificates
and certificates that are about to expire.

Avoid such problems by allowing an error margin of around 12 hours on
certificate validity periods, similar to the error margin already
allowed for OCSP response timestamps.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-20 12:15:42 +01:00
Michael Brown c0942408b7 [dhcp] Request broadcast responses when we already have an IPv4 address
FCoE requires the use of multiple local unicast link-layer addresses.
To avoid the complexity of managing multiple addresses, iPXE operates
in promiscuous mode.  As a consequence, any unicast packets with
non-matching IPv4 addresses are rejected at the IPv4 layer (rather
than at the link layer).

This can cause problems when issuing a second DHCP request: if the
address chosen by the DHCP server does not match the existing address,
then the DHCP response will itself be rejected.

Fix by requesting a broadcast response from the DHCP server if the
network interface already has any IPv4 addresses.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-20 12:01:50 +01:00
Michael Brown b9ef880c8d [romprefix] Treat 0xffffffff as an error return from PMM
PMM defines the return code 0xffffffff as meaning "unsupported
function".  It's hard to imagine a PMM BIOS that doesn't support
pmmAllocate(), but apparently such things do exist.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-19 19:35:48 +01:00
Michael Brown a3cba84bab [util] Update mergerom.pl to handle .mrom images
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-12 15:15:06 +01:00
Michael Brown b58374fe91 [romprefix] Allow .mrom image to be placed anywhere within the BAR
A .mrom image currently assumes that it is the first image within the
expansion ROM BAR, which may not be correct when multiple images are
present.

Fix by scanning through the BAR until we locate an image matching our
build ID.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-12 15:15:06 +01:00
Michael Brown 9e8d431a0d [romprefix] Add a dummy ROM header to cover the .mrom payload
The header of a .mrom image declares its length to be only a few
kilobytes; the remainder is accessed via a sideband mechanism.  This
makes it difficult to append an additional ROM image, such as an EFI
ROM.

Add a second, dummy ROM header covering the payload portion of the
.mrom image, allowing consumers to locate any appended ROM images in
the usual way.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-12 15:15:03 +01:00
Michael Brown 12be8bc544 [util] Rewrite catrom.pl to use Option::ROM library
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-12 11:36:21 +01:00
Michael Brown f2e5f8813e [util] Allow Option::ROM to access multiple ROM images
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-12 11:36:20 +01:00
Michael Brown cdee7866f5 [cmdline] Use "cpuid --ext" instead of "cpuid --amd"
Avoid potential confusion in the documentation by using a
vendor-neutral name for the extended (AMD-defined) feature set.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-12 11:33:43 +01:00
Michael Brown addf699c86 [cmdline] Add "sync" command
Add "sync" command (loosely based on the Unix "sync"), which will wait
for any pending operations to complete.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-09 19:00:04 +01:00
Michael Brown af47789ef2 [tls] Mark security negotiation as a pending operation
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-09 18:59:41 +01:00
Michael Brown 5482b0abb6 [tcp] Mark any unacknowledged transmission as a pending operation
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-09 18:56:07 +01:00
Michael Brown 021d7b21b7 [pending] Add concept of "pending operations"
iPXE is fundamentally asynchronous in operation: some operations
continue in the background even after the foreground has continued to
a new task.  For example, the closing FIN/ACK exchanges of a TCP
connection will take place in the background after an HTTP download
has completed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-06-09 18:48:28 +01:00