Abstract:
A communication adapter connected between a communication line and a host processor segments a received data frame by storing the received data in a buffer chain made up of equal length buffers. As each buffer is filled, the adapter interrupts the host. The host moves the data stored in the filled buffer into its own storage. It interrupts the adapter so that the buffer can be returned to the chain of free buffer and completes transmission protocol processing before the entire frame is received. If the frame has been received without error or buffer overrun it is delivered to the user immediately after transfer of the last buffer.

Description:
FIELD OF THE INVENTION 
     This invention relates to the field of data communications and more particularly to a structure and a method for transferring a block of data received from a communications network to a user application which is running in a connected computer substantially concurrently with receipt of the data from the network. 
     BACKGROUND OF THE INVENTION 
     In the past, networks have, regardless of the architected physical connectivity, received complete data messages or blocks and checked them for accuracy of transmission before passing them on to an ultimate user program. This technique appears to adversely impact the users perception of the response time of the network. 
     In those networks in which only short blocks of data are transmitted, the perception is not harmful. However, in networks where large blocks of data are transmitted, the impact on the perception of response time can be significant and any improvement which can be achieved with little or no cost is of great value. 
     SUMMARY OF THE INVENTION 
     The invention contemplates a structure and method for segmenting a block or stream of received data by storing the data in a chain of equal sized buffers located in a communication adapter. As each buffer is filled, it is transferred across the host processor input/output bus by a driver and delivered to a transport application (such as Novel&#39;s IPX program or IBM&#39;s NETBIOS program) running in the host processor along with the driver and the user application program. The data is checked for accuracy of reception as it is received in the adapter and as the last buffer is transferred the status of the received frame or block of data is also transferred. If the data is invalid the user application is denied access to the data. The transport application program can complete all transport protocol processing prior to receipt of status from the communication adapter and if the status is good the received data it turned over to the user program immediately. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a flow diagram of a prior art receive interface; 
     FIG. 2 is a flow diagram of a segmented receive interface according to the invention; 
     FIG. 3 is a block diagram illustrating received data flow; 
     FIG. 4 is a block diagram illustrating the content and organization of the adapter shared RAM and the organization of a portion of the host or processor memory; and, 
     FIGS. 5A, 5B, 6A, 6B and 7 are flow diagrams illustrating the operation of both the adapter and the driver running in the host processor for moving received data from the communication link across the host I/O bus to the host memory for further processing by the transport application and subsequent use by the user application program. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     The receive interface illustrated in FIG. 1 is typical of the prior art. Data from the communication line is received and stored in a communication adapter shared RAM. It is checked and handed over to a driver, running in the host system with the transport program, which moves the data from the shared RAM to a host application buffer in the host processor. 
     With a block or message size of 4,096 bytes, this process consumes approximately 3.7 msec in a typical computer. A segmented receive interface constructed according to the invention and illustrated in FIG. 2 consumes 2.2 msec when the same hardware is utilized. This results in an improvement in latency of more than 40 percent, a significant benefit. 
     In FIG. 2 the incoming data is segmented by storing the data in a chain of buffers, each having 512 bytes. As soon as the first buffer is filled the input handler interrupts the driver which moves the data in the first buffer across the processor I/O bus into a host application buffer. As each additional buffer is filled it is moved into the host application buffer by the driver. The last buffer may or may not be completely filled depending on the exact length of the block. Along with the last buffer, the status of the block (valid/invalid) is provided. Based on the status, the received block is turned over to the application program or dumped. 
     In FIG. 3, an adapter 30 includes a network interface and an input handler 31 connected to the network 32 and to a shared RAM memory 33. Data from network 32 is received by the network interface and input handler 31 and segmented by storing the data in a plurality of equal fixed length chained buffers in the shared RAM 33. 
     When the input handler 31 fills a buffer in memory 33, it interrupts the driver 34 which is responsible for moving the buffer full of data across an I/O bus 35 to the host application buffer in the host or programmed CPU 36 for further processing by the transport application or protocol stack. 
     The organization of the adapter shared RAM 33 is illustrated in FIG. 4. The shared RAM is divided into a plurality of equal fixed length buffers 38. Each buffer has a two byte forward pointer which is the address of the next sequential buffer in the chain of buffers; one byte is reserved for status; two bytes are used for indicating the length of the data stored in the buffer in the event that the buffer contains the end of a message or frame; and a fixed number of bytes (B --  LEN bytes) are reserved for storing received data. The buffer chain is circular and the forward pointer of the last buffer points to the first buffer. 
     In addition to the buffers described above the shared RAM includes two bytes which are the address of the first free buffer or head of the chain (ADPTR --  RCV --  HEAD). It also includes two bytes which are the address of the last free buffer or tail of the chain (ADPTR --  RCV --  TAIL). It addition it includes two bytes (RCV --  OFFSET) for defining an offset from the ADPTR --  RCV --  HEAD where the next byte of data is to be stored. The RCV --  OFFSET is incremented after each storage operation. When the RCV --  OFFSET equals B --  LEN the buffer is full and another buffer, if available, must be placed at the head. How this and other steps are implemented will be described below. The shared RAM also includes two blocks of storage for storing adapter and host interrupt status. 
     Also illustrated in FIG. 4 are four values stored in the host 36 memory. These are: a two byte address (HOST --  RCV --  BUF) which points to the starting address of the buffer in shared RAM 33 which is to be moved across the I/O bus by the driver; a two byte offset value (HOST --  RCV --  OFFSET), initially set at zero, indicating the offset from the starting address HOST --  RCV --  BUF for the next data byte to be moved; a four byte host application buffer address (HOST --  APP --  BUF) defining the starting address in the host memory where the frame or block of data is to be stored; and, a two byte host application offset (HOST --  APP --  OFFSET), initially set at zero, indicating where the next byte transferred by the driver is to be stored with resect to the starting address HOST --  APP --  BUF. 
     The flow diagram illustrated in FIG. 5 is executed in the communication adapter 30. The adapter 30 can be in one of three receive states depending on the availability of buffers. In one state RCV --  NORMAL at least one buffer (either full or partial) is available for storing a received byte. In the second state OUT 13  OF --  BUFFERS no buffers are available. Once the adapter enters this state it remains there until a buffer is freed in which case it returns to the RCV --  NORMAL state or if a byte is received before a buffer is freed it changes state to the third state OVERRUN. 
     As each data byte is received, the receive state of the adapter (and shared RAM 33) is checked. If the receive state is normal blocks 40 and 41 exit false. The received data byte is stored in the shared RAM 33 at the address specified by the adapter RCV --  HEAD plus the RCV --  OFFSET 42 and the RCV --  OFFSET is incremented 43 to await the next byte. If the last byte was not the end of the frame 44 the RCV --  OFFSET is checked 45 to see if is less than B --  LEN. If it is, that indicates that there is room in the buffer for at least one more byte of data and the program goes to wait where it awaits the next byte. 
     If 45 exits false the buffer is full; the status is marked VALID --  MIDDLE --  DATA 46; the data length is marked B --  LEN 47 (indicating a full buffer) and the RCV --  OFFSET is set to zero 48 in anticipation of selecting the next free buffer in the buffer chain. The driver in the host is interrupted 50 so that it can transfer the buffer across the processor I/O to the host application buffer in the processor. If the ADPTR --  RCV --  HEAD does not equal the ADPTR --  RCV --  TAIL 51 the FORWARD --  PTR of the ADPTR --  RCV --  HEAD becomes the new ADPTR --  RCV --  HEAD 52 and the program goes to wait. If 51 exits true the RCV --  STATE is set to OUT --  OF --  BUFFERS 53 and the program goes to wait. 
     If the program exits 44 true status is set END --  OF --  FRAME and FRAME --  STATUS 54 and the data length is set to RCV --  OFFSET 55. If 41 exits true the RECEIVE STATE is set to OVERRUN 56 and the ADAPTR --  RCV --  HEAD status is set to OVERRUN 57 and the program goes to wait. 
     If the adapter receive state is OVERRUN, block 40 exits true. The program checks to see if the end of frame was received 54. If it was not the program goes to wait. If the end of frame was received, the program interrupts the device driver running in the host with received status signalled 55. If the ADAPTR --  RCV --  HEAD is equal to the ADAPTR --  RCV --  TAIL 56, the adapter receive state is changed to OUT --  OF --  BUFFERS 57 and the program goes to wait. When the program exits block 56 false, the ADAPTR --  RCV --  HEAD is changed to the FORWARD --  PTR of the ADAPTR --  RCV --  HEAD 58 and the RCV --  STATE is RECV --  NORMAL 59 and then the program goes to wait. 
     The flow diagram illustrated in FIG. 6 is executed in the host 30 by the device driver. The program can be in one of three receive states. These are: START --  OF --  FRAME, RECEIVING --  FRAME or END --  OF --  FRAME. When the driver receives an interrupt from the adapter program indicating that a buffer has been filled it checks the status byte of the buffer 60 to determine if it is an END --  OF 13  FRAME. If false and the status indicates VALID --  MIDDLE --  DATA 61, the HOST --  RCV --  OFFSET is set equal to zero 62. 
     If the HOST --  RCV --  STATE=START --  OF --  FRAME 63 exits false the HOST --  RCV --  OFFSET is checked to see if it is less than the DATA --  LENGTH 64. If it is less, the loop 65, 66 and 67 moves the received data contents from the shared RAM in the adapter into the application buffer in the host memory. When the buffer is emptied block 64 exits false. If the buffer was an end of frame 68, the transport is notified that the frame has been received and the HOST --  RCV --  STATE is set to START --  OF --  FRAME 70 in preparation for receipt of the next frame. 
     Afterwards the HOST --  RCV --  BUF status is set to FREE 71; the HOST --  RCV --  BUF is set to the HOST --  RCV --  BUF at FORWARD --  PTR 72 and the adapter is interrupted to indicate that a buffer has been freed 73. When block 68 exits false the program goes to goes to blocks 71-73 directly since the buffer was valid middle data and functions 69 and 70 are not appropriate. 
     If block 63 exits true indicating a START --  OF --  FRAME, the driver signals the transport protocol 74 and provides the HOST --  RCV --  BUF pointer to the transport protocol and receives the HOST --  APP --  BUF pointer from the transport protocol; sets the HOST --  RCV --  STATE to RECEIVING --  FRAME 75 and sets the HOST --  APP --  OFFSET equal to zero 76 and proceeds as described above. 
     When block 61 exits false and the HOST --  RCV --  BUF status 77 is free, the driver goes to a wait state since the buffer is empty. If block 77 exits false and the HOST --  RCV --  BUF status is OVERRUN 78 the HOST --  RCV --  STATE is set equal to START --  OF --  FRAME 79 and if block 78 exits false an adapter error 80 is noted. 
     When block 60 exits true, indicating an end of frame, the frame status is checked 81. if the error bit is not set the state is set to END --  OF --  FRAME 82 and goes to block 62 as previously described. If the frame status error bit is set, the START --  OF --  FRAME state is checked 83. If it is set, the program proceeds to 71. If it is reset the program signals the transport protocol of a frame error 84 and then goes to block 71. 
     The flow diagram illustrated in FIG. 7 is executed in the communication adapter and is designed to restore freed buffers to the buffer chain by modifying the ADPTR --  RCV --  TAIL. When the adapter receives a buffer free interrupt from the driver it checks the FREE status of the buffer indicated by the FORWARD --  POINTER of the ADPTR --  RCV --  TAIL 90. If it is FREE it checks to see if the FORWARD --  POINTER of the ADPTR --  RCV --  TAIL is equal to the ADPTR --  RCV --  HEAD 91. If they are not equal it replaces the ADPTR --  RCV --  TAIL with ADPTR --  RCV --  TAIL FORWARD --  POINTER. If the RCV --  STATE 93 is OUT --  OF --  BUFFERS, the FORWARD --  PTR of the ADPTR --  RCV --  HEAD is made the ADPTR --  RCV --  HEAD 94 and the RCV --  STATE is set to NORMAL --  RCV 95. 
     While a single embodiment of the invention has been described and illustrated in detail it should be obvious to those skilled in this art that changes can be made without departing from the spirit or scope of the invention.