platform/upstream/syslinux.git
13 years agoNEWS: document FTP syslinux-4.10-pre5
H. Peter Anvin [Mon, 25 Apr 2011 04:09:14 +0000 (21:09 -0700)]
NEWS: document FTP

13 years agopxe: use a separate poll thread instead of using an idle thread hook
H. Peter Anvin [Mon, 25 Apr 2011 03:55:47 +0000 (20:55 -0700)]
pxe: use a separate poll thread instead of using an idle thread hook

The idle thread can never sleep, so it's not really safe to do
anything inside it.  Instead, run a separate poll thread at low
priority; we can also do that to poll the serial console if needed.

Overall, the "classic" Syslinux idle handling really should go away
and be replaced by the idle thread.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agoidle.c: remove -*- fundamental -*- tag
H. Peter Anvin [Mon, 25 Apr 2011 03:53:12 +0000 (20:53 -0700)]
idle.c: remove -*- fundamental -*- tag

This is a normal C file, no reason for a -*- fundamental -*- tag as
used in NASM source code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe, tftp: unbreak the TFTP state machine syslinux-4.10-pre4
H. Peter Anvin [Sun, 24 Apr 2011 22:40:01 +0000 (15:40 -0700)]
pxe, tftp: unbreak the TFTP state machine

Some of the code motion had broken the TFTP state machine, make it
work properly again.  Furthermore, remove some no longer necessary
fields in the pxe inode structure.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe, tftp: let lwIP manage port numbers syslinux-4.10-pre3
H. Peter Anvin [Sun, 24 Apr 2011 22:16:23 +0000 (15:16 -0700)]
pxe, tftp: let lwIP manage port numbers

lwIP needs to manage port numbers for TCP and for DNS, so just let it
do it for TFTP as well.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe, ftp: remove a bogus include
H. Peter Anvin [Sun, 24 Apr 2011 22:15:07 +0000 (15:15 -0700)]
pxe, ftp: remove a bogus include

Remove an include of a header file which never actually existed.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: make lwip use IANA-blessed local port numbers
H. Peter Anvin [Sun, 24 Apr 2011 22:05:15 +0000 (15:05 -0700)]
pxe: make lwip use IANA-blessed local port numbers

Make lwip use the IANA-blessed local port numbers 49152 and higher.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: allow an empty input to dns_resolv()
H. Peter Anvin [Sun, 24 Apr 2011 21:51:31 +0000 (14:51 -0700)]
pxe: allow an empty input to dns_resolv()

If dns_resolv() gets an empty input, just return failure.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: continue to bounce URLs with unknown schemes to gPXE
H. Peter Anvin [Sun, 24 Apr 2011 21:42:56 +0000 (14:42 -0700)]
pxe: continue to bounce URLs with unknown schemes to gPXE

If we're running on top of a gPXE/iPXE stack, and get a URL we don't
know, continue to bounce it to gPXE.  It isn't entirely clear how well
this will actually work with an UNDI-based network stack, however...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: make url_set_ip() static
H. Peter Anvin [Sun, 24 Apr 2011 21:02:39 +0000 (14:02 -0700)]
pxe: make url_set_ip() static

url_set_ip() is now only used in one place, so make it static.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: move redirect processing to the URL-parsing level
H. Peter Anvin [Sun, 24 Apr 2011 20:59:18 +0000 (13:59 -0700)]
pxe: move redirect processing to the URL-parsing level

Move redirect processing out of the HTTP code and into the top
URL-processing level.  This both makes the code simpler and also deals
with absurdities like HTTP redirecting to an FTP URL (which is legal.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: add support for FTP
H. Peter Anvin [Sun, 24 Apr 2011 20:49:30 +0000 (13:49 -0700)]
pxe: add support for FTP

Add support for the FTP protocol.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: tcp: close the connection before freeing the buffers
H. Peter Anvin [Sun, 24 Apr 2011 20:48:17 +0000 (13:48 -0700)]
pxe: tcp: close the connection before freeing the buffers

As long as the connection is opened, we may end up receiving data, so
don't free the receive buffers until after the connection is closed.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: more verbose lwIP asserts
H. Peter Anvin [Sun, 24 Apr 2011 20:47:14 +0000 (13:47 -0700)]
pxe: more verbose lwIP asserts

If we're going to bother compiling in the lwIP asserts, then make them
a bit more useful in terms of the message delivered.  This may be
worth tweaking further to make a smaller footprint.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agourlparse: fix url_unescape()
H. Peter Anvin [Sun, 24 Apr 2011 20:46:45 +0000 (13:46 -0700)]
urlparse: fix url_unescape()

Fix double pointer advacing in url_unescape().

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: tcp: always call the close method
H. Peter Anvin [Sun, 24 Apr 2011 19:44:31 +0000 (12:44 -0700)]
pxe: tcp: always call the close method

Always call the designated close method, instead of assuming it is
tcp_close_file().  This isn't the case for FTP, which also needs to
manage the control connection.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: make tftp_pktbuf a dynamic buffer
H. Peter Anvin [Sun, 24 Apr 2011 04:04:58 +0000 (21:04 -0700)]
pxe: make tftp_pktbuf a dynamic buffer

We don't need tftp_pktbuf for the TCP-based protocols, so allocate it
on demand.  It should be possible to get rid of it for TFTP as well.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: move operations common to TCP-based protocols to a common file
H. Peter Anvin [Sun, 24 Apr 2011 03:48:42 +0000 (20:48 -0700)]
pxe: move operations common to TCP-based protocols to a common file

Move operations that are common to all TCP-based protocols into a
common file, tcp.c.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: use the unified URL parsing framework syslinux-4.10-pre2
H. Peter Anvin [Sat, 23 Apr 2011 23:04:00 +0000 (16:04 -0700)]
pxe: use the unified URL parsing framework

Use the unified URL parsing framework for TFTP and HTTP.  This should
also make it easier to add new protocols (e.g. FTP) in the near
future.

Note that HTTP redirects are still handled wrong: they really should
be sent all the way back to the top of URL parsing; there are sites in
the field which redirect to FTP URLs, for example.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: urlparse: add comments
H. Peter Anvin [Sat, 23 Apr 2011 20:46:54 +0000 (13:46 -0700)]
pxe: urlparse: add comments

Add comments to the URL parser functions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: Add a much more general URL-parsing framework
H. Peter Anvin [Sat, 23 Apr 2011 20:35:51 +0000 (13:35 -0700)]
pxe: Add a much more general URL-parsing framework

Add a URL-parsing framework that we can use for multiple protocols.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agothread: free curr->rmstack
Sebastian Herbszt [Sat, 23 Apr 2011 10:18:21 +0000 (12:18 +0200)]
thread: free curr->rmstack

Free curr->rmstack instead of double free of curr->stack.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: put a semaphore around PXE calls
H. Peter Anvin [Sat, 23 Apr 2011 02:35:36 +0000 (19:35 -0700)]
pxe: put a semaphore around PXE calls

Make sure we can't accidentally invoke the PXE stack from multiple
threads (except for the ISR, which presumably has to allow for
reentrancy, since the spec implies the ISR can be invoked from inside
the PXE stack strategy routine.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agothread: free(NULL) is safe, lmalloc() always return para-aligned
H. Peter Anvin [Sat, 23 Apr 2011 02:29:09 +0000 (19:29 -0700)]
thread: free(NULL) is safe, lmalloc() always return para-aligned

free(NULL) is safe and permitted, no reason to conditionalize calling
free().

lmalloc() will always return a paragraph-aligned memory block, so we
don't have to play games with the offset.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agolwip: handle UNDI stacks which need to be polled
H. Peter Anvin [Fri, 22 Apr 2011 22:57:33 +0000 (15:57 -0700)]
lwip: handle UNDI stacks which need to be polled

If the UNDI stack reports either IRQ 0 or does NOT report the NDIS IRQ
supported flag, then poll the interrupt routine from the idle thread
instead.

This is somewhat limited; we really should have a chain of idle poll
routines to support things like serial console.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agothread: thread-switch the real-mode stack, too
H. Peter Anvin [Fri, 22 Apr 2011 05:16:14 +0000 (22:16 -0700)]
thread: thread-switch the real-mode stack, too

When this code was originally written, we didn't have lmalloc().  Now
when lmalloc() is implemented, let each real-mode task have its own
stack.

Note that this means we absolutely have to continue to support the
SS != CS, DS model in the real-mode code, which should already be the
case, but...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agoNEWS: document lwIP syslinux-4.10-pre1
H. Peter Anvin [Fri, 22 Apr 2011 04:36:34 +0000 (21:36 -0700)]
NEWS: document lwIP

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agoversion: call this branch 4.10
H. Peter Anvin [Fri, 22 Apr 2011 04:33:23 +0000 (21:33 -0700)]
version: call this branch 4.10

A totally different network stack is definitely grounds for calling it
4.10 instead of 4.0x...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agoMerge branch 'master' into lwip-threads
H. Peter Anvin [Fri, 22 Apr 2011 04:32:41 +0000 (21:32 -0700)]
Merge branch 'master' into lwip-threads

13 years agoversion: now working on version 4.05
H. Peter Anvin [Fri, 22 Apr 2011 04:32:01 +0000 (21:32 -0700)]
version: now working on version 4.05

4.04 is out, next version will be 4.05 (or later).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: isr: fix formatting
H. Peter Anvin [Fri, 22 Apr 2011 04:24:33 +0000 (21:24 -0700)]
pxe: isr: fix formatting

Fix code formatting.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: fix gcc 4.6 problems
H. Peter Anvin [Fri, 22 Apr 2011 04:23:54 +0000 (21:23 -0700)]
pxe: fix gcc 4.6 problems

Remove unused variables, which give gcc 4.6 problems.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agoMerge commit 'syslinux-4.04' into dynamic-sector
H. Peter Anvin [Mon, 18 Apr 2011 21:53:45 +0000 (14:53 -0700)]
Merge commit 'syslinux-4.04' into dynamic-sector

13 years agospec: Use BuildRequires, add diag/ subdirectory syslinux-4.04
H. Peter Anvin [Mon, 18 Apr 2011 21:24:17 +0000 (14:24 -0700)]
spec: Use BuildRequires, add diag/ subdirectory

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agodiag: Don't remove BTARGET on make clean
H. Peter Anvin [Mon, 18 Apr 2011 21:12:58 +0000 (14:12 -0700)]
diag: Don't remove BTARGET on make clean

"make clean" should not remove BTARGET

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agoMerge remote-tracking branch 'pcacjr/syslinux-update-for-hpa'
H. Peter Anvin [Mon, 18 Apr 2011 21:11:26 +0000 (14:11 -0700)]
Merge remote-tracking branch 'pcacjr/syslinux-update-for-hpa'

13 years agomenu: allow "menu hiddenkey" to take multiple keys; run unlabel
H. Peter Anvin [Mon, 18 Apr 2011 21:06:54 +0000 (14:06 -0700)]
menu: allow "menu hiddenkey" to take multiple keys; run unlabel

- Allow "menu hiddenkey" to take a comma-separated list of keys.
- Run unlabel() on the commands passed to menu hiddenkey.
  XXX: Consider moving unlabelling to post-menu instead.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agoNEWS: Document MENU HIDDENKEY
H. Peter Anvin [Mon, 18 Apr 2011 20:53:19 +0000 (13:53 -0700)]
NEWS: Document MENU HIDDENKEY

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agosyslinux: check --update option properly
Paulo Alcantara [Fri, 15 Apr 2011 18:28:31 +0000 (15:28 -0300)]
syslinux: check --update option properly

Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
13 years agoextlinux: remove already_installed
Paulo Alcantara [Fri, 15 Apr 2011 18:21:10 +0000 (15:21 -0300)]
extlinux: remove already_installed

Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
13 years agoextlinux: use syslinux_already_installed instead of already_installed
Paulo Alcantara [Fri, 15 Apr 2011 18:13:54 +0000 (15:13 -0300)]
extlinux: use syslinux_already_installed instead of already_installed

Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
13 years agolibinstaller: implement syslinux_already_installed
Paulo Alcantara [Fri, 15 Apr 2011 17:55:29 +0000 (14:55 -0300)]
libinstaller: implement syslinux_already_installed

syslinux_already_installed function will be used in both extlinux and
syslinux for checking if the boot sector has either the string
"SYSLINUX" or "EXTLINUX" in the OEMID field.

Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
13 years agoundiif: Unneeded debugging functions.
Eric W. Biederman [Tue, 12 Apr 2011 21:31:34 +0000 (14:31 -0700)]
undiif: Unneeded debugging functions.

Committing so I have these somewhere in case I need them again.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agopxe: Neuter pxe_idle_init
Eric W. Biederman [Tue, 12 Apr 2011 11:54:53 +0000 (04:54 -0700)]
pxe: Neuter pxe_idle_init

The previous pxe_idle_init no longer makes sense as we are no
longer using the udp core of the pxe stack.  So gut pxe_idle_init.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agopxe: Cleanup interrupt handling making it reliabe and in spec
Eric W. Biederman [Tue, 12 Apr 2011 11:38:21 +0000 (04:38 -0700)]
pxe: Cleanup interrupt handling making it reliabe and in spec

- Rework pm_return into pxe_poll_wakeups and use the new
  sched_hook_funk to call it from schedule.  That is a
  little extra work but it is always correct to do.

- Unconditionally call schedule from the pm_core_hook.
  schedule now does everything pm_return used to do
  if perhaps in a more braindead way so this is correct
  and safe.

- Declare undiif_input in pxe.h

- Stop exporting pxe_poll.  Having it exported helped
  me track down what was going on but it was the wrong
  way to do things and exporting it is no longer needed.

- Rename pxe_poll pxe_process_irq for clarity.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: thread: Implement polling for wakeups.
Eric W. Biederman [Tue, 12 Apr 2011 11:28:32 +0000 (04:28 -0700)]
core: thread: Implement polling for wakeups.

For some reason the core_pm_hook is not getting called
every time we get an interrupt with the result that
in some situations like arping for our neighbours mac
address or a tftp transfer we can stall, we never move
forward again.

The reason for those stalls likely bears more investigating
but for now it is sufficient for me to know that they exist
and that I can work around them by polling for wakekup
conditions everytime we call schedule.  That gives us code
that works reliably and stays within the letter of the
pxe spec.  The oddities of the pxelinux core can be ironed
out later.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agoundiif: Theoretical support for infiniband.
Eric W. Biederman [Tue, 12 Apr 2011 07:50:04 +0000 (00:50 -0700)]
undiif: Theoretical support for infiniband.

Sync up the maximum address length between pxe.h and netif.h
and assert if they are different.

PXEENV_UNDI_GET_INFORMATION only returns a 16 hardware
address field, and infiniband has a 20 byte hardware address
so use MAC provided by pxe.c instead which is already set
to the proper 20 byte hardware address.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agopxe: Remove the lwip_test code
Eric W. Biederman [Tue, 12 Apr 2011 07:14:12 +0000 (00:14 -0700)]
pxe: Remove the lwip_test code

lwip works so we no longer need this test code.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Clean up the initialization sequence
Eric W. Biederman [Tue, 12 Apr 2011 07:05:58 +0000 (00:05 -0700)]
lwip: Clean up the initialization sequence

Implement an initialization sequence for lwip that is essentially
sane, and remove the previous udp stack support.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Allow up to 20 byte hardware address to support infiniband.
Eric W. Biederman [Tue, 12 Apr 2011 06:37:03 +0000 (23:37 -0700)]
lwip: Allow up to 20 byte hardware address to support infiniband.

Infiniband has a positively crazy mapping of ip to it's infiniband
form, and that crazy mapping leads to a 20 byte hardware address
used for ip (despite really only having a 8 byte hardware address).
Infiniband routers such a crazy idea.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Update the undi driver so it handles (in theory) all network types supported...
Eric W. Biederman [Tue, 12 Apr 2011 06:30:45 +0000 (23:30 -0700)]
lwip: Update the undi driver so it handles (in theory) all network types supported by undi

This involves on transmmit using theundi protocol types and letting
the undi layer put on the link level header,  On receive this
involves using the undi parsing of the link level header and generation
of the link level type.  This involves cloning etharp into undi.c
so we have our own set of arp functions that don't care how long
your hardware address is.

Using ethernet link layer frames directly removes a number of weird
limmitations so I do that by default when I know I am on ethernet
but that is not necessary, and a quick hack to change
undi_is_ethernet to always return false show that this code works
on whatever flavor of network adapter you have.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: Cleanup properly when using undi.
Eric W. Biederman [Tue, 12 Apr 2011 06:02:11 +0000 (23:02 -0700)]
core: pxe: Cleanup properly when using undi.

Unhook the interrupt handler and stop the undi processing to
make it save to exit, and allows unload_pxe to start succeeding
again.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: Improve the situation with installing and uninstalling irq handlers
Eric W. Biederman [Tue, 12 Apr 2011 05:47:31 +0000 (22:47 -0700)]
core: pxe:  Improve the situation with installing and uninstalling irq handlers

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Explicitly enable udp,tcp,icmp, and receive timeouts.
Eric W. Biederman [Mon, 11 Apr 2011 11:25:23 +0000 (04:25 -0700)]
lwip:  Explicitly enable udp,tcp,icmp, and receive timeouts.

Of the group receive timeouts are the most important as we
need those working so that tftp transfers that will actually
get back to the tftp code.

Icmp is nice so that we can test the latency to the machine
running syslinux why syslinux is downloading a file.  Allowing
us to confirm to test for excessive buffering on the network
increasing the round trip times.  Plus it is just nice to
be able to ping a machine and know it is there.

udp and tcp were already implicitly enabled so explicitly
enabling them is no big deal.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe Add native support for http urls
Eric W. Biederman [Mon, 11 Apr 2011 11:22:57 +0000 (04:22 -0700)]
core: pxe Add native support for http urls

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: Add general support for pluggable url handlers.
Eric W. Biederman [Mon, 11 Apr 2011 11:16:03 +0000 (04:16 -0700)]
core: pxe: Add general support for pluggable url handlers.

In preparation for adding http support (and possibly others)
add support for looking up a url scheme by name in a table
and calling the appropriate open function.

This also adds a struct netbuf pointer to the pxe inode allowing
for some easy to implement and nice to use streaming abstractions
like pxe_getc.

Cleanup the includes of lwip headers.  We want <> brackets
(no point in searching in the current directory first)
and the ifdefs around them can go.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Tune memory management for performance
Eric W. Biederman [Mon, 11 Apr 2011 07:45:31 +0000 (00:45 -0700)]
lwip:  Tune memory management for performance

In a series of short tests it turns out that lwip's
default memory management seems orders' of magnitude
better than using syslinux's malloc and it uses much
less memory as well.  So just use it.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Rename mem_init lwip_mem_init to remove a namespace conflict.
Eric W. Biederman [Mon, 11 Apr 2011 07:10:03 +0000 (00:10 -0700)]
lwip: Rename mem_init lwip_mem_init to remove a namespace conflict.

There are efficiency problems in the lwip stack related to memory
management.  Remove the conflict in the name memory_init so I can
experiment to see which allocator is better for large file transfers.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: Add isspace to ctype.h
Eric W. Biederman [Sun, 10 Apr 2011 16:38:45 +0000 (09:38 -0700)]
core: Add isspace to ctype.h

This is needed for the http file downloader.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: Factor out pxe_poll from pxe_receive_thread
Eric W. Biederman [Sun, 10 Apr 2011 13:14:17 +0000 (06:14 -0700)]
core: pxe: Factor out pxe_poll from pxe_receive_thread

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: Rewrite the tftp implementation to use lwip
Eric W. Biederman [Sun, 10 Apr 2011 12:34:31 +0000 (05:34 -0700)]
core: pxe: Rewrite the tftp implementation to use lwip

Since the raw pxe udp interface is unusable when lwip
is active rewrite the tftp implmentation to use netconn.

I expect this implementation can be simplified but my
goal was as straight forward a transformation as I
could possibly mange to avoid bugs slipping in.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: Add a netconn socket to the pxe private inode
Eric W. Biederman [Sun, 10 Apr 2011 12:31:38 +0000 (05:31 -0700)]
core: pxe: Add a netconn socket to the pxe private inode

Now that we are using lwip, all implementations of transfer
protocols will need a netconn, so add it to the pxe inode.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore pxe: Use the lwip dns resolver
Eric W. Biederman [Sun, 10 Apr 2011 12:29:12 +0000 (05:29 -0700)]
core pxe: Use the lwip dns resolver

When we start receiving packets at the undi layer we can
no longer use the the pxe udp layer.  So make our lives
simple by using the lwip dns resolve which which works
without changes and seems to be a little more comprehensive.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agopxe: Send tftp acks after we reach our timeout
Eric W. Biederman [Sun, 10 Apr 2011 12:14:49 +0000 (05:14 -0700)]
pxe: Send tftp acks after we reach our timeout

While looking at the tftp implementation I noticed that we are not
retransmitting acks if we reach our timeout.  Not retransmitting
can be a problem when there is packet loss present in a network.

We do retransmit if the server times out but it is better if
we retransmit ourselves in case we are dealing with a stupid
tftp server that has not noticed it missed a packet from us.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Use byteswap.h to define htons and friends
Eric W. Biederman [Sun, 10 Apr 2011 06:04:47 +0000 (23:04 -0700)]
lwip: Use byteswap.h to define htons and friends

Define lwip's byteswapping in terms of byteswap.h
This ensures htons(CONSTANT) is seen as a constant
by gcc, and it allows us to use unmodified lwip headers.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: factor out byteswap.h from netinet/in.h
Eric W. Biederman [Sun, 10 Apr 2011 06:00:14 +0000 (23:00 -0700)]
core: factor out byteswap.h from netinet/in.h

This is a logical generalization, follows the precedent set
by glibc and it will allow us to avoid problems with
lwips definition of the network byte swap functions.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore pxe: Cleanup the call to pxe_isr_init
Eric W. Biederman [Sun, 10 Apr 2011 04:24:29 +0000 (21:24 -0700)]
core pxe: Cleanup the call to pxe_isr_init

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: show stats when displaying speedtest results
H. Peter Anvin [Fri, 18 Sep 2009 20:56:53 +0000 (13:56 -0700)]
lwip: show stats when displaying speedtest results

Performance seems to be heavily inversely correlated with packet
loss...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agoundiif: Fix weird include order madness.
Eric W. Biederman [Sat, 9 Apr 2011 13:16:46 +0000 (06:16 -0700)]
undiif: Fix weird include order madness.

For some reason undiif now only compiles if core.h
is included first, but undiif gets weird mem_init
errors if core.h is included towards the end.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: fix timestamps, statistics functions
H. Peter Anvin [Fri, 18 Sep 2009 20:38:50 +0000 (13:38 -0700)]
lwip: fix timestamps, statistics functions

Add bits needed to support timestamps and stats functions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: lwipopts: additional fine-tuning
H. Peter Anvin [Fri, 18 Sep 2009 20:38:11 +0000 (13:38 -0700)]
core: lwipopts: additional fine-tuning

Fine tune parameters a bit more...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agolwip: better speed test
H. Peter Anvin [Fri, 18 Sep 2009 00:32:21 +0000 (17:32 -0700)]
lwip: better speed test

Better speed test, to make tuning easier.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agolwip: Disable lwip's malloc routines
Eric W. Biederman [Sat, 9 Apr 2011 12:47:33 +0000 (05:47 -0700)]
lwip: Disable lwip's malloc routines

lwip's malloc routines conflict with the core malloc
and free routine's and Peter's earlier port apparently
had acceptable performance without them.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: In mem.h define mem_realloc as static inline
Eric W. Biederman [Sat, 9 Apr 2011 12:28:31 +0000 (05:28 -0700)]
lwip:  In mem.h define mem_realloc as static inline

The intent was clearly for the compiler to inline
mem_realloc or else the defintion would have been placed
in a C file somewhere.   gcc complains and since -Werr
is set the build fails when the function is just static.
So make the function static inline.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agoMake sure TCP_WND is < 64K-TCP_MSS
H. Peter Anvin [Fri, 18 Sep 2009 00:25:36 +0000 (17:25 -0700)]
Make sure TCP_WND is < 64K-TCP_MSS

Avoid an error "len would wrap tcp_wnd"

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: lwip: tune parameters for performance
H. Peter Anvin [Fri, 18 Sep 2009 00:06:34 +0000 (17:06 -0700)]
core: lwip: tune parameters for performance

With these tweaks, we are up from 6 Mbps to over 200 Mbps on a
back-to-back gigabit TCP connection.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agolwip: better test case
H. Peter Anvin [Thu, 17 Sep 2009 02:56:39 +0000 (19:56 -0700)]
lwip: better test case

Download a large file from www3.kernel.org (Amsterdam) and time the
result.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agolwip: now to the point we can make a TCP connection...
H. Peter Anvin [Thu, 17 Sep 2009 00:48:26 +0000 (17:48 -0700)]
lwip: now to the point we can make a TCP connection...

lwip is now functional enough that TCP and DNS seem to work.  More
tests still need to be done, though.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Allow clearing a dns server
H. Peter Anvin [Thu, 17 Sep 2009 00:48:26 +0000 (17:48 -0700)]
lwip: Allow clearing a dns server

  /*
   * hpa: the lwip code has the dnsserver->addr != 0 test, but that would
   * seem to indicate that there is no way to cancel a previously given
   * DNS server...
   */

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore pxe: Ensure all parameters in pxe_get_cached_info are initialized.
Eric W. Biederman [Sat, 9 Apr 2011 10:55:50 +0000 (03:55 -0700)]
core pxe: Ensure all parameters in pxe_get_cached_info are initialized.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: additional work on the lwip port
H. Peter Anvin [Wed, 16 Sep 2009 06:21:24 +0000 (23:21 -0700)]
core: pxe: additional work on the lwip port

Additional work on the lwip port.  With this code, we can get pretty
far before having problems.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore pxe: Switch threads if more than one runnable.
Eric W. Biederman [Sat, 9 Apr 2011 09:25:51 +0000 (02:25 -0700)]
core pxe: Switch threads if more than one runnable.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxeisr.inc: The name of the globals is pxe_irq_vector not pxe_irq_num
Eric W. Biederman [Sat, 9 Apr 2011 09:24:11 +0000 (02:24 -0700)]
core: pxeisr.inc: The name of the globals is pxe_irq_vector not pxe_irq_num

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore thread: Make the code a little clearer.
Eric W. Biederman [Sat, 9 Apr 2011 09:23:44 +0000 (02:23 -0700)]
core thread: Make the code a little clearer.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: thread: return 0 from sem_down() if we didn't have to wait
H. Peter Anvin [Thu, 17 Sep 2009 00:47:02 +0000 (17:47 -0700)]
core: thread: return 0 from sem_down() if we didn't have to wait

Return 0 from sem_down if we passed right through the assembly code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: pxe: don't switch to the PXE stack if we're on it...
H. Peter Anvin [Fri, 11 Sep 2009 23:03:30 +0000 (16:03 -0700)]
core: pxe: don't switch to the PXE stack if we're on it...

Don't switch to the PXE stack if we are already on it.  This can
happen if we take an interrupt inside the stack switch code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: lwip: busy-wait if transmit is blocked for buffers
H. Peter Anvin [Fri, 11 Sep 2009 22:46:43 +0000 (15:46 -0700)]
pxe: lwip: busy-wait if transmit is blocked for buffers

If we can't send a packet because of insufficient buffers, simply
busy-wait and keep trying.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: lwip: update data pointer after getting a secondary fragment
H. Peter Anvin [Fri, 11 Sep 2009 22:43:52 +0000 (15:43 -0700)]
pxe: lwip: update data pointer after getting a secondary fragment

After we receive a secondary fragment we need to update the frame data
pointer.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: hook up the interrupt routine and the lwip receive routine
Eric W. Biederman [Sun, 10 Apr 2011 04:16:21 +0000 (21:16 -0700)]
pxe: hook up the interrupt routine and the lwip receive routine

Hook up the interrupt routine to the lwip receive routine; this should
be able to receive packets as written.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: fix conflict with <netinet/in.h>
H. Peter Anvin [Thu, 10 Sep 2009 20:23:46 +0000 (13:23 -0700)]
lwip: fix conflict with <netinet/in.h>

Fix a conflict with <netinet/in.h>.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agolwip: undiif - initial cut at a UNDI Ethernet-only driver
H. Peter Anvin [Thu, 10 Sep 2009 20:21:53 +0000 (13:21 -0700)]
lwip: undiif - initial cut at a UNDI Ethernet-only driver

Initial cut at an UNDI driver -- still needs to be reworked to handle
the receive side.  For now, assume the underlying interface is
Ethernet; supporting generic media types will require changes to the
ARP handling in lwIP.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: Move the gpxe url reading code into it's own file.
Eric W. Biederman [Fri, 8 Apr 2011 10:01:26 +0000 (03:01 -0700)]
pxe: Move the gpxe url reading code into it's own file.

Now that we have method pointers there is no longer any reason
to clutter up pxe.c with tftp specific details.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agopxe: Move the tftp implementation into it's own file
Eric W. Biederman [Fri, 8 Apr 2011 09:53:28 +0000 (02:53 -0700)]
pxe: Move the tftp implementation into it's own file

Now that we have method pointers there is no longer any reason
to clutter up pxe.c with tftp specific details.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agopxe: Add methods to abstract out the connection type.
Eric W. Biederman [Fri, 8 Apr 2011 09:13:15 +0000 (02:13 -0700)]
pxe: Add methods to abstract out the connection type.

The gpxe handling has already found the places where
we need to have different code to handle different
connection types.  So add function pointers into
struct pxe_pvt_inode for each of those places and
cleanup the code to call those new functions.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agokeytest: make somewhat more comprehensible
H. Peter Anvin [Mon, 11 Apr 2011 22:42:06 +0000 (15:42 -0700)]
keytest: make somewhat more comprehensible

Someone may very well need to use keytest to figure out their
keymappings.  Make it a bit more user friendly.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agokeyname: better handling of named control characters
H. Peter Anvin [Mon, 11 Apr 2011 22:41:26 +0000 (15:41 -0700)]
keyname: better handling of named control characters

Named control character (Tab, Enter, Backspace etc.) should use those
names rather than caret sequences.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agokeytest: show the human name together with the keycode
H. Peter Anvin [Mon, 11 Apr 2011 22:33:48 +0000 (15:33 -0700)]
keytest: show the human name together with the keycode

Since we now have library support for showing the keycode name, make
keytest print that as well.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agomenu: clear the timeout line on MENU HIDDENKEY
H. Peter Anvin [Mon, 11 Apr 2011 22:23:05 +0000 (15:23 -0700)]
menu: clear the timeout line on MENU HIDDENKEY

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agomenu hiddenkey: fix parsing the config file option
H. Peter Anvin [Mon, 11 Apr 2011 22:22:17 +0000 (15:22 -0700)]
menu hiddenkey: fix parsing the config file option

Fix parsing bugs in the config file.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agomenu: Add "menu hiddenkey" to make terminating menu hidden a command
H. Peter Anvin [Mon, 11 Apr 2011 21:59:45 +0000 (14:59 -0700)]
menu: Add "menu hiddenkey" to make terminating menu hidden a command

Use "menu hiddenkey" together with "menu hidden" for a one-keystroke
action.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>