Saturday, July 14, 2012

New TCP/IP Stack Progress Report

It is no secret that OAR has been working furiously on an update of the very old FreeBSD TCP/IP stack in RTEMS. This effort builds upon a port of the USB stack portion of FreeBSD 8.2 implemented by Embedded Brains. Kevin Kirspel did some initial work on incorporating the TCP/IP FreeBSD files and bringing over RTEMS support code from the old port. This blog entry attempts to capture the current state of the project and highlight the challenges still remaining.

The rtems-libbsd code base is currently being debugged using the Intel EtherExpress Pro (e.g. fxp) NIC on the pc386 BSP on qemu. The highlights of the status are as follows:

  • Kernel with TCP/IP enabled and FXP NIC completes initialization successfully
  • Initialization of the loopback interface IP address and route is currently failing. This appears to be due to RTEMS having a limited subset of proc and ucred (e.g. process and user credential) structures and these not being completely correctly initialized yet.
  • User space has 51 of 56 methods in old libnetworking/libc directory compiling cleanly
  • Popular PCI NICs compile but no testing
  • Target specific code
    • Internet packet checksum (e.g. in_cksum) support for architectures supported by both RTEMS and FreeBSD is in place. For targets only supported by RTEMS, the intent is to use one of the implementations that is in 100% C with no assembly support.
    • cpufunc.h file in place for all architectures even though on many it is an empty file
    • FreeBSD PCI Bus and Legacy Bus drivers are x86 specific. RTEMS will need the equivalent drivers for all architectures. The hope is that this driver can be used across all targets with minor modification. If not, the backup plan is a minimal cross-target RTEMS specific version. Initial indications are that the x86 specific version is target independent.
  • BSPs need new sections added to their linkcmds.
  • No NICs for ISA or System on Chips.
We feel that we are close to having the fxp driver working on pc386 and qemu. But there is a lot of work left to ensure that the stack is ready to become the preferred TCP/IP stack for RTEMS. The community is encouraged to pitch in and take on some of the following:
  • Test FreeBSD PCI NIC drivers currently in tree
  • Update NIC drivers in RTEMS not found in FreeBSD
    • RTEMS Project may be forced to deprecate some NIC drivers if not updated
  • Port other FreeBSD NIC drivers of interest
    • no ISA NIC drivers
  • Help get rest of libc methods to compile
    • ensure set of user APIs is complete
  • Select best in_cksum implementation for all architectures
  • Bus support methods for all architectures.
    • currently assume simple memory access is OK and it is untested
  • Help in testing user space code
    • includes network demos, servers, clients, etc.
  • Need to write API verification tests for each network method
    • tests similar to those in psxhdrs which ensure that you can invoke the method using only the header files in the man page.
  • Optimizations in code space, resources, and execution time
    • effort has focused strictly on getting it to work
In general, OAR has focused on the "depth" part of the project. There has been an enormous amount of effort expended so far. Although some of the work has been sponsored, much of it has been done as OAR overhead and volunteer effort, including Kevin Polulak who is a Google Summer of Code student. Once OAR can successfully ping an RTEMS target with the new stack, it will definitely be time for the RTEMS Community to rally and help speed the transition to the new TCP/IP stack.

2 comments: