Draft 3 (under construction)
Table of Content Zone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ConceptsThe low-level interface to an RCE's protocol plug-ins uses abstractions called ports, frames, frame buffers, channels, lanes, pipes and factories. A port is the RCE end of a two-way communications link similar in concept to a BSD socket. Ports are globally visible but not MT-safe; at a given time at most one task may be waiting for data from, receiving data from or delivering data to any given port. Ports take and deliver data as frames. The exact content of a frame depends on the transmission protocol being used. but the the API recognizes a broad division into header and payload. One frame corresponds to one message on the I/O medium and is delivered in a single frame buffer. In other words all ports implement datagram rather than byte-stream protocols. It's up to higher-level software such as a TCP stack to provide any operations that cross frame boundaries. Each port contains a queue of frames which have arrived and have not yet been consumed by the application. A channel represents a hardware I/O engine capable of DMA to and from system RAM, i.e., a protocol plug-in. An RCE has at most eight channels. Most channels will make use of one or more of the Multi-Gigabit Tranceiver modules (lanes) available in firmware, though some may simply offer access to on-board resources such as DSPs. Each channel has its own port space where each port is identified by a 16-bit unsigned integer. Each port represents a different source of incoming data such as a UDP port or a Petacache flash lane. The size of the port number space on a channel depends on the channel type and may be as low as one. There is a one-to-one correspondence between the pairs (channel, port no.) and port objects. If a channel receives a frame that doesn't belong to any open port of the channel, the channel object just counts it before reclaiming the frame buffer. All the lanes (if any) of a given channel go to one the outputs (pipes) of the backplane. This mapping is fixed by hardware. Each type of channel has both an offical (unsigned) number and an official short name such as "eth" or "config". Channels that differ only in the number of lanes they use, e.g., 10 Gb/s ethernet (4) and a slower ethernet (1) will have the same channel type, in this case "eth". The factory code that creates the right kind of Channel objects for a given type of channel may be already part of the system core or it may be in a container in configuration flash. In the latter case the code must be loaded, relocated and bound to the system core before its first use. An entry point is called in each such loaded factory code module which will register a channel factory object in a central table using a registry object exported by the core for this purpose. Pre-loaded code must also be registered. Factory code returns values of Channel* though the actual objects pointed to are of derived classes for the specific channel type. The information needed to find the factory code modules and create the the channel objects is found in configuration flash. InterfaceOfficial RCE channel type numbersThese are given in a header file made available to both core and application code. The numbers are members of an enumeration.
Channel registryAn instance of this class will be exported by the core code using some design pattern such as Singleton or functional equivalent. This instance is created during system startup and lasts until system shutdown. Assignment or copying of instances is forbidden.
ChannelA channel object manages a set of I/O buffers and a particular instance of a protocol plug-in. At the beginning of each buffer the channel will build a FrameBuffer object. Each channel object is created at system startup, initially in a disabled state. Afterward the system startup code will allocate the buffers, feed them to the channel objects and then enable them. Channel objects live until system shutdown. Each channel creates and destroys Port objects on demand. Each port is assigned one of the channel's legal port numbers not used by any other port. The client code may request a port number for the type of channel, e.g., a well-known TCP port number. The client may also allow the channel to assign an ID not currently in use by any port. A channel knows how to derive a port number from the header of a frame it has received. Channel and its derived classes do not allow copying or assignment of their instances.
PortRemembers the Channel that created it. Allows client code to wait for new frames. Reclaims frame buffers that the client code has finished using (or has just
ImplementationGeneralBit numbering: Bit zero is the least significant bit of a value (contrary to the convention in PowerPC documents). Channel factoryThe abstract base class for objects that manufacture Channel instances. Channel factories are created during system startup and last until system shutdown. Assignment or copying of instances is forbidden. Derived classes add the type name, the recommended number of buffers and the description string to the information gotten from the configuration tables.
Virtex-4 (Gen I)Frames are still divided into header and payload sections. Location and format of the configuration tablesA data container in the configuration flash contains tables of information about the hardware and firmware; this information can't be gotten directly from the Virtex-4 hardware and firmware. The tables are called PpiDefs and Pipes. Each table is an array of plain-old-data structs. To make alignment easier we use 32-bit fields wherever possible, even for 16-bit quantities such as port numbers. All of the declarations for the configuration structs are in namespace RCE::config. The PpiDefs table will come first, at the beginning of the container, followed by the Pipes table. PpiDefs tableThe PpiDefs table will have eight elements, one for each possible PPI in the system. An element is considered unused if the
Member descriptions (when
Pipes tableIn order to discover which pipe PPI uses will use you take the lowest lane number used by the PpiDef entry and use it to index the Pipes table, which has 32 elements. A pipe number of 0xffffffff indicates an unused element, otherwise the ID of the pipe is given. A pipe ID will probably contain several subfields telling what kind of target the pipe connects to, etc.
Class FrameBufferA FrameBuffer instance is placed at the beginning of a buffer that will also hold the frame proper. The instances are created at system startup and live until system shutdown. A FrameBuffer contains regions of fixed size used in the management of the frame itself and its buffer:
Immediately following the end of the FrameBuffer buffer in we have first the frame's header and then its payload. The links, descriptor and status areas have the same sizes for all channel types. The descriptor must begin on a 64-byte boundary; for ease of layout the entire buffer also has that alignment. The buffer should also begin on a cache line boundary in order to reduce cache thrashing but since a cache line is only 32 bytes long this requirement is already met. FrameBuffer instances may not be copied or assigned.
Use case: System startupFor Gen I we need to store the configuration tables and factory code modules in configuration flash. We'll use the core's boot-level flash-reading code to read them during this startup process. That way the configuration flash's channel object factory and channel object will be constructed in the usual way, so there must be a corresponding factory code module in flash. Once startup is complete the boot-level flash code will no longer be used.
ChannelList constructor:
Use case: Frame importTBD. Use case: Frame exportTBD. Virtex-5,6 (Gen II)Location of the configuration tablesProbably somewhere in DCR space so we'll have to use mfdcr instructions to read them. The exact organization is TBD. No PIC blocksProtocol plugins will no longer be implemented using PIC blocks. No header/payload divisionThe old division of frames into header and payload will no longer be made. |