Shortlog of iPXE merge commits


  • Guo-Fu Tseng (2):
    • [tcp] Randomize TCP bind port
    • [hci] Continue processing while prompting for shell banner
  • Michael Brown (8):
    • [tcp] Update received sequence number before delivering received data
    • [tcp] Store local port in host byte order
    • [tcp] Fix typos by changing ntohl() to htonl() where appropriate
    • [cmdline] Fix inconsistent and ugly code formatting in shell_banner()
    • [tcp] Use a dedicated timer for the TIME_WAIT state
    • [tcp] Merge boolean flags into a single “flags” field
    • [tcp] Treat ACKs as sent only when successfully transmitted
    • [tcp] Handle out-of-order received packets
  • Piotr Jaroszyński (1):
    • [tcp] Fix a 64bit compile time error

Commits that I choosed not to merge

Discard out-of-order when low memory

If we want to support Selective ACK in the future, we don't want to discard any packet.

Commit diff on iPXE

Commit diff on iPXE

commit 1d3b6619e5e35eecc29efcef6eb1dd3564a2eb45
Author: Michael Brown <>
Date:   Wed Jul 21 12:01:50 2010 +0100

    [tcp] Allow out-of-order receive queue to be discarded

    Allow packets in the receive queue to be discarded in order to free up
    memory.  This avoids a potential deadlock condition in which the
    missing packet can never be received because the receive queue is
    occupying all of the memory available for further RX buffers.

    Signed-off-by: Michael Brown <>

 src/include/ipxe/list.h |   12 ++++++++++++
 src/net/tcp.c           |   41 ++++++++++++++++++++++++++++++++++++++---
 2 files changed, 50 insertions(+), 3 deletions(-)

commit 9dc51afa2cc2b0d8310b540ae193edb37f148b8b
Author: Michael Brown <>
Date:   Wed Jul 21 11:58:50 2010 +0100

    [malloc] Add cache discard mechanism

    Add a facility allowing cached data to be discarded in order to
    satisfy memory allocations that would otherwise fail.

    Signed-off-by: Michael Brown <>

 src/core/malloc.c         |  114 +++++++++++++++++++++++++++------------------
 src/include/ipxe/malloc.h |   17 +++++++
 2 files changed, 85 insertions(+), 46 deletions(-)
Generic xfer interface

“deliver_raw() no longer exists as a data-xfer method” We might need it someday, I did think of some approach to do Selective ACK support with possibly using deliver_raw() for performance concern.

Commit diff on iPXE

commit 4327d5d39f101f1df0ace6c03f3b3ada5f6a6213
Author: Michael Brown <>
Date:   Wed Jun 16 01:31:29 2010 +0100

    [interface] Convert all data-xfer interfaces to generic interfaces

    Remove data-xfer as an interface type, and replace data-xfer
    interfaces with generic interfaces supporting the data-xfer methods.

    Filter interfaces (as used by the TLS layer) are handled using the
    generic pass-through interface capability.  A side-effect of this is
    that deliver_raw() no longer exists as a data-xfer method.  (In
    practice this doesn't lose any efficiency, since there are no
    instances within the current codebase where xfer_deliver_raw() is used
    to pass data to an interface supporting the deliver_raw() method.)

    Signed-off-by: Michael Brown <>

Re-do my previous TCP patches against merged branch


commit be160f2a9581ca791f038cff0ca476f19d8fbc0e
Author: Guo-Fu Tseng <>
Date:   Thu Jul 15 11:02:52 2010 +0800

    [tcp core][RFC] Wait for TCP to safely close

    After some discussion with Piotr and Michael, I think it might
    be an acceptable solution for the issue that gPXE leaves remote
    peer TCP in undesired state.

    The reason I don't mark activity_start at somewhere like tcp_open
    or ESTABLISHED is that sanboot do not close the TCP connection
    before hand of the control to OS.

 src/core/activity.c         |   64 +++++++++++++++++++++++++++++++++++++++++++
 src/core/image.c            |    8 +++++
 src/core/main.c             |    2 +
 src/include/gpxe/activity.h |   28 +++++++++++++++++++
 src/include/gpxe/tcp.h      |   13 +++++++++
 src/net/tcp.c               |   15 ++++++++++
 src/usr/autoboot.c          |    6 ++++
 7 files changed, 136 insertions(+), 0 deletions(-)
commit 4c985888acf02acc9bf2d94925279e7a14cbc779
Author: Guo-Fu Tseng <>
Date:   Wed May 12 09:26:08 2010 +0800

    [jme] Adding hardware RX checksum offload support

    Read corresponding flags for RX checksum status, and update the
    csum_stat field of the struct io_buffer.

 src/drivers/net/jme.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
commit 134fe7eef6f1e1a4603d58524e0b4e73265ea9cb
Author: Guo-Fu Tseng <>
Date:   Wed May 12 09:22:11 2010 +0800

    [net] Adding RX packet checksum offload support

    Add a field in struct io_buffer to pass checksum status from hardware.
    If the hardware dose not support just ignore this field, it'll work as

    I see that net/ipv6 does not check for checksum, so I temporary ignored

 src/core/iobuf.c         |    1 +
 src/include/gpxe/iobuf.h |   13 +++++++++++++
 src/net/ipv4.c           |    8 +++++---
 src/net/tcp.c            |   18 ++++++++++--------
 src/net/udp.c            |    2 +-
 5 files changed, 30 insertions(+), 12 deletions(-)
commit 155da1968f5e89c38cd5f7d76c4c44c9784f83ff
Author: Guo-Fu Tseng <>
Date:   Fri Jul 30 16:08:28 2010 +0800

    [tcp] Cleanup tcp_close()

    The complexity of tcp_close() makes the TCP closing control
    hard to maintain.
    This patch try to solve it by separating tcp_terminate() and
    tcp_dataxfer_close() from tcp_close().

    Use tcp_terminate() to immediately free all tcp resources, and
    close data transfer interface by calling tcp_dataxfer_close().

    tcp_close() now simply bing TCP connection to closing state.
    Which makes it safe to call in tcp_rx_fin().

    tcp_dataxfer_close() is separated due to early close timing of
    tcp_xfer_close() which is called by upper-layer to indicate no
    more data to send or receive.

 src/net/tcp.c |  104 +++++++++++++++++++++++++++++---------------------------
 1 files changed, 54 insertions(+), 50 deletions(-)
commit 7345fc858e6ee2f414ee8328b710b6a333a2be19
Author: Guo-Fu Tseng <>
Date:   Thu Jul 29 21:43:05 2010 +0800

    [tcp] Distinguish passive and active close with proper actions

    The original design of TCP stack dose not distinguish passive and active
    close, support is to make close action more compatible with RFC 793 and
    having the ability to benefit from passive closing that can release all
    resources immediately.

 src/include/gpxe/tcp.h |   43 ++++++++++++++++++++++++++++++++++++-------
 src/net/tcp.c          |   26 +++++++++++++++++++++-----
 2 files changed, 57 insertions(+), 12 deletions(-)
commit bdee331b5ba32557bbd092987be0af3cc1c45479
Author: Guo-Fu Tseng <>
Date:   Thu Jul 29 21:16:24 2010 +0800

    [tcp] Deliver data only after updating TCP state

    Michael suggested something like:
      struct list_head received = LIST_HEAD_INIT ( received );
      while ( ! list_empty ( &tcp->rx_queue ) ) {
         tcp_rx_data ( tcp, seq, iob_disown ( iobuf ), &received );

      list_for_each_entry_safe ( iobuf, tmp, &received, list ) {
        // deliver iobuf via xfer_deliver_iob()

      if ( tcp->state & TCP_STATE_RCVD ( TCP_FIN ) )
        tcp_close ( tcp, 0 );
    But after some thought I think making the change like this commit
    can have same behavior, but simplified by not using extra queue.
    Which can also save some code size.

    In this patch:
      1. We call xfer_deliver_iob() after fully updated/handled received TCP
         state. In which to have better timing that upper-layer protocol
         might call tcp_xfer_close() to initiate a shutdown, or sending
         extra data.
      2. We move tcp_close() out from tcp_rx_fin() because tcp_close()
         nullified the xfer interface. It'll cause error to call
         xfer_deliver_iob() after tcp_rx_fin().
         (So that I proposed an idea to clean up tcp_close(), I'll post it
          in later commit.)

 src/net/tcp.c |   34 +++++++++++++++++++---------------
 1 files changed, 19 insertions(+), 15 deletions(-)

Post the patches on the gpxe-devel and wait for feedback

QR Code
QR Code soc:2010:cooldavid:journal:week10 (generated for current page)