# Patent

## Title
TCP offload send optimization

## Abstract

A host with a network interface that offloads a TCP connection is disclosed in which the notification that relatively small data transmit commands have completed is batched whereas the notification that relatively large data transmit commands have completed are not batched. The notification that data transmit commands have completed may be intrinsically modulated by the size and frequency of the commands and the processing of the data transfer by the TCP connection. One embodiment involves a method comprising: running an application on a computer having a network interface; running, on the network interface, a TCP connection for the application; providing, by the computer to the network interface, a command to send data from the application; updating, by the network interface, a SndUna value for the TCP connection; and providing, by the network interface to the computer, the SndUna value, thereby indicating to the computer that the command has been completed.

## Background
CROSS-REFERENCE TO RELATED APPLICATIONS
This application claims the benefit under 35 U.S.C. 120 of (is a continuation of) application Ser. No. 13/716,635, filed Dec. 17, 2012, which in turn claims the benefit under 35 U.S.C. 120 of (is a divisional of) application Ser. No. 12/504,021, filed Jul. 16, 2009, which in turn claims the benefit under 35 U.S.C. 119 of Provisional Patent Application Ser. No. 61/085,352, filed Jul. 31, 2008. All of those applications have the same title and inventors as the present application, and all of those applications are incorporated by reference herein.


BACKGROUND
This invention relates to network communication, for example serial communication between devices using a protocol such as Transmission Control Protocol (TCP).
TCP has been employed for decades and has increased in popularity, or at least in usage, over the years. An advantage of TCP is its guaranteed delivery of error free data. Unfortunately, this guarantee comes with a price of greater complexity relative to some other network protocols. Such complexity can slow TCP communication, or at least make it difficult for TCP to be used as network data rates increase, for example from 100 MB/s ten years ago to 10 GB/s currently. Moreover, even for a 100 MB/s transmission line rate that was conventional ten years ago, TCP processing at the endpoints of the network proved a bottleneck that slowed network communication, as well as consumed inordinate CPU cycles.
A solution to the TCP bottleneck was provided by Alacritech, Inc., which offloaded established TCP connections from the host CPU to hardware that could process data transfer much more rapidly, significantly increasing TCP data transfer rates while reducing CPU utilization. Descriptions and claims to such a solution can be found in multiple patents, including U.S. Pat. Nos. 7,337,241; 7,284,070; 7,254,696; 7,237,036; 7,191,318; 7,191,241; 7,185,266; 7,174,393; 7,167,927; 7,167,926; 7,133,940; 7,124,205; 7,093,099; 7,089,326; 7,076,568; 7,042,898; 6,996,070; 6,965,941; 6,941,386; 6,938,092; 6,807,581; 6,757,746; 6,751,665; 6,697,868; 6,687,758; 6,658,480; 6,591,302; 6,470,415; 6,434,620; 6,427,173; 6,427,171; 6,393,487; 6,389,479; 6,334,153; 6,247,060; and 6,226,680, which are incorporated by reference herein. Also incorporated by reference is U.S. patent application Ser. No. 11/799,720, filed May 1, 2007.
For a situation in which an application is running on a host CPU while a TCP connection for that application is handled by a network interface card, however, certain communications between the host and the device could hamper performance. For example, some previous Alacritech host interface designs employed a command-response interface for sending data. That is, if an application performed a send, the host would encapsulate that send in a command. The address of that command was then written to the card, which would read out the command contents and send the data specified. When that data was fully acknowledged by the peer (the other side of the TCP connection), the card would notify the driver of the command completion by filling in a response buffer.
This interface worked well when performing large data transfers. For instance, if the application sent 64 KB of data, the driver would encapsulate it into a single command and hand it to the card. After all 64 KB of data was sent and acknowledged, the card would send a response to the host. As a result, 64 KB of data required only two interactions with the card—a dramatic reduction compared to traditional networking, which would have required sending 44 segments and processing  ̃22 ACKs (assuming the default ACK-every-other-segment behavior of Windows®).
That command/response interface did not perform nearly so well, however, with small data transfers. For example, consider an application that is instead sending 64-byte sends asynchronously (meaning it doesn't wait for a previous send to complete before starting on the next one). In the previous model, the host would have constructed a command for each send, and received a response every time a send was acknowledged—a particularly high overhead for such a small amount of data. Although there were times when multiple sends could be coalesced into a single command, the inherent problem of relatively high overhead for small packet sends has remained.
SUMMARY
The problem has been solved, in one exemplary embodiment, by batching the notification that relatively small data transmit commands have completed whereas the notification that relatively large data transmit commands have completed are not batched. In one exemplary embodiment, the notification that data transmit commands have completed may be intrinsically modulated by the size and frequency of the commands and the processing of the data transfer by the TCP connection.
In one exemplary embodiment, a method is disclosed comprising: running, on a network interface for a computer, a TCP connection for an application, including maintaining a SndUna value for the TCP connection; setting a SndUna threshold at the network interface; and providing the SndUna value to the computer when the SndUna value is greater than or equal to the SndUna threshold.
In one exemplary embodiment, a method is disclosed comprising: running an application on a computer having a network interface; running, on the network interface, a transmission control protocol (TCP) connection for the application; providing, by the computer to the network interface, a command to send data from the application; updating, by the network interface, a SndUna value for the TCP connection; and providing, by the network interface to the computer, the SndUna value, thereby indicating to the computer that the command has been completed.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a schematic block diagram of a computer and network interface card (NIC) that transfers a SndUna value to the computer.
FIG. 2 is a flow chart of a process for sending data by the computer and NIC of FIG. 1 in which the NIC notifies the computer that a send command has completed by transferring a SndUna value to the computer.
FIG. 3 is a flow chart of a process for sending data by the computer and NIC of FIG. 1 in which the NIC notifies the computer that a send command has completed by transferring a SndUna value to the computer when the SndUna value equals or exceeds a SndUna threshold.
FIG. 4 is a flow chart of a process for sending data by the computer and NIC of FIG. 1 in which the NIC notifies the computer that a single large send command has completed and separately provides a single notification that several small send commands have completed.



DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
FIG. 1 shows a computer 20 having a central processing unit (CPU) 22 and a memory 24. Although a single processor and memory are shown to facilitate understanding by showing the minimal elements of a computer, plural processors and/or plural memories may be employed in place of those individual elements, in this embodiment as well as in subsequent embodiments. The computer 20 is connected to a network interface such as a NIC 40 by an I/O channel 38 such as a PCI bus, and the NIC 40 is connected to a network 55.
The computer 20 is running an operating system (OS) 30, with an application 28 running above the OS 30. The operating system 30 has a network stack 33 that includes conventional components such as a TCP layer and an Internet Protocol (IP) layer, and may include instructions regarding offloading and uploading TCP connections to and from NIC 40. A device driver 35 allows the OS 30 to interact with the NIC 40.
The NIC 40 includes a processor 46 and memory 48, and may also include other communications processing hardware and instructions for handling a TCP connection, including maintaining the connection as a TCP control block (TCB) 44 in NIC memory 48. A TCB is a large block of information, occupying well over 100 bytes and 100 fields, which stores the status of TCP communication for a particular connection. Many of the TCB fields are interrelated and many of the TCB fields change rapidly for an active connection. One of the many variables maintained in TCB 44 is a SndUna value 50, which indicates the data for that TCB that has been transmitted by NIC 40 and acknowledged (ACKed) by a receiving node. According to the TCP protocol, every byte transferred over a TCP connection is given a sequence number, which is used in part to track whether data has been successfully transferred. The SndUna value, like the ACK from which it is derived, indicates the contiguous data that has been successfully transferred, by indicating the next expected sequence number (i.e., the sequence number immediately following the largest sequence number of the contiguous data that has been successfully transferred).
The NIC 40 may include instructions regarding offloading and uploading TCP connections from and to computer 20, which is sometimes referred to as “partial offload” or “dynamic offload,” or the NIC may establish, maintain and close TCP connections without transfer to or from the computer, which is sometimes referred to as “full offload.” In either of these cases, the NIC 40 may sometimes be referred to as a “TCP offload engine” or “TOE.” Similarly, although the NIC 40 is shown as a separate entity in FIG. 1 to facilitate illustration, a network interface may be connected to processor 22 and memory 24 by an internal computer bus rather than an I/O channel. In the example shown in FIG. 1, TCB 44 is employed to communicate over network 55 between application 28 and a peer application on a remote node.
As noted above, some prior art TOEs communicated to their computers the successful transmission of data for a TCP connection by posting a “response buffer” to a “command” to send the data. In one embodiment, instead of posting a “response buffer”, the mechanism by which these sends are completed is the current SndUna value 50, which is set based on acknowledgments received from the peer. As represented by arrow 58, the SndUna value 50 is sent from NIC 40 to device driver 35 to indicate that the transmission of certain application 28 data to the peer has been successfully completed by NIC 40.
In this embodiment, while the SndUna value 50 contained within the TCB 44 is owned and adjusted by the NIC 40, the computer 20 can very easily keep an association between pending sends and their starting and ending sequence numbers. This is due to the fact that each byte sent corresponds to a single sequence number. For example, say the starting sequence number at the time a connection is offloaded to the NIC 40 is 10000. Also assume that the driver 35 is given a series of 64-byte sends which it provides to the NIC 40. The computer 20 can easily keep track of the starting and ending sequence numbers of each send (send #1 starts with 10000, send #2 starts with 10064, and so on).
The NIC 40 can then complete one or more sends by simply providing the computer 20 with the current SndUna value 50. Using the above example, a SndUna value 50 of 10100 would complete the first send, but not the second, since the second send starts with 10064, but ends with 10127.
This offers a convenient way to notify the computer 20 of the completion of a batch of sends by the NIC 40. A SndUna value of 12960 in the above example would complete 46 64-byte sends at once back to the device driver 35. In turn, the driver 35 can complete this entire batch of sends back to the network stack 33 above it, and subsequently to the application 28. The savings of this embodiment are tremendous when contrasted against the response-per-send model of the prior art.
One challenge, which has been solved as explained below, is determining when the NIC 40 should send these SndUna values 50 (also known as “SndUna updates” or “SndUna events”) to the host computer 20. If one considers the 64-byte send example, the temptation would be to have the NIC 40 issue a SndUna event every time it receives an ACK from the peer. It should be noted that TCP implementations typically only send acknowledgments after they've received a minimum amount of data (or a delayed ACK timer expires). A typical minimum value is two full segments—2960 bytes in the case of IPv4 with no TCP options and standard Ethernet Maximum Transmission Unit (MTU).
But a SndUna event per ACK would be inefficient if applied to 64 KB sends in comparison with the previous Alacritech command-response mechanism. As noted above, that previous host interface resulted in a single response buffer per 64 KB send. If instead a SndUna event is provided to the host per ACK, and the peer were to ACK every other segment, the driver would have to process 22 SndUna events (44 send segments per 64 KB assuming standard MTU) before the 64 KB send was completely acknowledged, which requires far greater overhead than the previous Alacritech command-response mechanism.
To overcome this problem, in one embodiment a mechanism is utilized that ensures that a SndUna event from the NIC 40 completes, at a minimum, one outstanding send operation. In one embodiment, the NIC 40 keeps track of the ending sequence number of the data denoted by any send commands that it has received from the driver 35, to forward a SndUna value or related number to the driver indicating that at least one of the commands has been completed. This minimum value for forwarding a SndUna event may be termed a SndUna threshold.
As shown FIG. 3, a method according to this embodiment can include running 100 on a network interface a TCP connection for an application running on a computer; providing 105 by the computer to the network interface a command to send data for the application; setting 110 a SndUna threshold on the network interface based upon the ending sequence number of the data; and providing 115 by the NIC to the computer an indication that the command has completed, when the SndUna value exceeds the threshold.
Another problem that has been discovered, however, is that it is more difficult than it might first appear for a program running on the NIC processor 40 to keep track of the ending sequence number of each send command that is outstanding on the NIC 40. Note that the processor 46 cannot simply keep track of the ending sequence number of the first outstanding send, because once that is completed, it then needs to know the sequence number of the next outstanding send. Although possible, this can require a costly amount of highly accessible storage such as SRAM.
In one embodiment, the task of tracking the ending sequence number of the send commands outstanding on the NIC 40 is instead handled by the device driver 35. When multiple sends are outstanding, the driver 35 in this embodiment is responsible for providing the NIC 40 with a SndUna threshold value that indicates the completion the first outstanding send. Returning to the previous example in which multiple 64-byte sends were outstanding and the starting sequence number was 10000, the driver 35 would in this case provide the NIC 40 with a SndUna threshold of 10064, so that the NIC would provide to the driver the current SndUna value when it equaled or exceeded 10064. If the NIC 40 were to receive an ACK for 10030, it would update its TCB 44 accordingly, but not issue a SndUna event. If it were to receive an ACK for 10100, however, it would also issue a SndUna event. Upon receiving this event, the driver 35 would complete the first outstanding send to the network stack 33 and application 28 above it, and issue a new SndUna threshold of 10128 (the sequence number which completes the next outstanding send) to the NIC 40.
As noted above, it is unlikely that the NIC 40 would receive an ACK for 10100. A more likely value would be the 2-full-segment value of 12960, which would complete 46 sends. That ACK, being larger than the current SndUna threshold of 10064, would result in a SndUna event which specified a current value of 12960. That would in turn cause the driver 35 to complete 46 of the outstanding sends. After doing so, the driver 35 would provide a new SndUna threshold of 13008, which is the sequence number of the 47th 64-byte send.
Note that this embodiment avoids paying a penalty with large sends in comparison with the prior art command-response mechanism. When multiple 64 KB sends are outstanding, the SndUna threshold is set to the end of the first send, so like the prior art host interface, in this embodiment the host will receive a single SndUna event, like the single response buffer of the prior art, per send. In other words, this embodiment can batch the notification that relatively small data transmit commands have completed whereas the notification that relatively large data transmit commands have completed are not batched.
As shown in FIG. 4, one embodiment includes running 200 on the NIC 40 a TCP connection for corresponding applications on the computer 20, and providing 205 by the computer to the network interface a series of commands to transmit data from the application by the network interface. The commands may vary in the size of the data that they denote, so that a plurality of the commands together denote an amount of data that is less than the amount denoted by one of the commands. The driver 35 in this embodiment provides to the NIC 40 an ending sequence number of a first of the commands, which is stored as a SndUna threshold by the NIC 40. This first command may be for the one relatively large command, and may be completed when the SndUna value for the connection equals or exceeds the SndUna threshold that has been provided to NIC 40, which may be set to equal the ending sequence number of the data denoted by that command. The NIC 40 then provides 215 to the driver 35 a notification that the one relatively large command has been completed, for example by providing the SndUna value to the driver. A SndUna threshold may then be set to an ending sequence number of the first of the relatively small commands. The data denoted by all the relatively small commands may be acknowledged in an ACK having a sequence number exceeding the SndUna threshold, causing the NIC 40 to provide 220 to the driver 35 a single notification that the plurality of relatively small commands have been completed, for example by providing the SndUna value to the driver.
A surprising advantage of making the driver 35 responsible for setting the SndUna threshold on the NIC 40 is that the completion notification mechanism in this embodiment has some self-tuning attributes. Consider, for example, a series of 2920-byte sends from the host computer 20, starting with relative sequence number 0. In a typical environment, each of these sends (being 2 full segments) would result in an ACK from the peer. If the NIC 40 were to implement an embodiment in which the SndUna value 50 is provided to the driver 35 whenever an ACK completes a send command, then it would result in a SndUna event per send. This may be optimal if the host could keep up, but imagine that the host CPU 20 is having trouble keeping up with this amount of traffic. In that case what is likely to happen in one exemplary embodiment in which the driver 35 is responsible for setting the SndUna threshold on the NIC 40 is the following:
1. Multiple 2920-byte sends are provided to the NIC 40;
2. The driver 35 provides a SndUna threshold of 2920 (the acknowledgment that completes the first outstanding send) to the NIC 40;
3. On the arrival of the first ACK, a SndUna event with a value of 2920 is generated (the SndUna value 50 of 2920 is provided to the driver 35);
4. At this point the host 20 is delayed in processing the SndUna event due to the fact that it is CPU-bound;
5. Additional acknowledgements arrive on the NIC 40, but since there is no outstanding SndUna threshold they do not result in SndUna events to the host;
6. Ultimately the driver processes the SndUna event, completes the first send, and issues a SndUna threshold of 5840—the acknowledgment that completes the next outstanding send;
7. Upon receiving a SndUna threshold of 5840, the NIC 40, having received several acknowledgments greater than 5840 (step 5), issues a SndUna event with the current SndUna value. This event results in the completion of several outstanding events.
In other words, the delay in step 4 actually facilitates additional batching and “self-tunes” based on CPU load. Stated differently, the notification that data transmit commands have completed may be intrinsically modulated by the size and frequency of the commands and the processing of the data transfer by the TCP connection.
In one embodiment, assurance is provided that the SndUna threshold mechanism does not result in undesired latency. Consider, for instance, a situation in which the application 28 has sent a series of sends and is then waiting for the last of the sends to be completed. Undesirable delay could be caused by the NIC 40 waiting for a SndUna threshold to be provided to the NIC before completing the last outstanding send. For this reason, when the NIC 40 receives an acknowledgment that completes all of its outstanding data (SndUna==SndNxt), it automatically issues a SndUna event to the driver 35.
On the other hand, when the host computer 20 has a single send command outstanding, it doesn't bother setting the SndUna threshold in one embodiment. This is because the processor 46 microcode is written to complete the single command when all outstanding send data is ACKed. When the host has two or more outstanding send commands, the host sets the SndUna threshold to the ending sequence of the first outstanding command. As SndUna events are received from the NIC 40, associated commands are completed back to the OS 30. Then, if there are still multiple commands outstanding, a new SndUna threshold is given to the processor 46 running the microcode, again set to the ending sequence number of the first outstanding send command.
Careful consideration of a variety of such scenarios has led to the development, in one embodiment, of the following set of rules:
A) Driver 35 response to a new host computer 20 TCP Send request:

    
    
        If no other send requests outstanding, don't set SndUna threshold;
        Else, if SndUna threshold already set, don't set SndUna threshold;
        Else, set SndUna threshold to ending sequence number of first outstanding send request.
    
    


B) Driver 35 response to a SndUna Event from Network Interface 40:

    
    
        ASSERT SndUna event>=outstanding SndUna threshold;
        ASSERT new SndUna value completes at least one command;
        Mark SndUna threshold as not set.
        Complete command(s):
        If multiple commands outstanding set new SndUna threshold to the ending sequence number of the next outstanding send command.
    
    


C) Network Interface 40 operation for ACK Processing:

    
    
        If all outstanding data is ACKed (SndUna=SndNxt), then issue a SndUna event to the host and clear SndUna threshold;
        Else, if ACK exceeds SndUna threshold, issue a SndUna event and clear SndUna threshold;
        Else, don't issue SndUna event.
    
    


D) Network Interface 40 operation for New SndUna Threshold value:

    
    
        If SndUna threshold value is less than previous SndUna event, ignore SndUna threshold value;
        Else if SndUna threshold is already set, panic;
        Else if current SndUna exceeds new SndUna threshold value, issue a SndUna event and clear SndUna threshold;
        Else, store SndUna threshold and wait for ACK.
    
    


Some or all of these rules may be used in a particular embodiment. Moreover, while the embodiments above have typically involved providing a SndUna value from the NIC 40 to the driver 35, in other embodiments other numbers could instead be used, provided that the driver 35 or another entity on a host such as computer 20 keeps track of certain byte sequence numbers for connections that are owned by a network interface such as NIC 40. For example, one embodiment can include providing, for an offloaded connection, a command to send data while maintaining, by the computer, an ending sequence number for the data corresponding to the command; and notifying the computer, by the network interface, that the command has been completed by providing to the computer a sequence number from which the ending sequence number can be determined. Thus, even if a computer does not know the sequence numbers used by a network interface for an offloaded TCP connection, once an ending sequence number is known to complete a particular command, relative sequence numbers can be established between the computer and the network interface that allows the computer to determine whether a another command has been completed.
Evidence that a system employs the present invention can take many forms. In one example, for a situation in which a binary device driver and interface device are available but source code is not, it may be possible to reverse engineer the communication between the driver and the interface device using a logic analyzer. This process may be enhanced with the use of a NDIS filter driver in Windows®. An NDIS filter driver could be implemented to monitor interactions between a NDIS device driver and the TCP stack above it. For instance, a filter driver could be written to “catch” chimney send completions that are performed by the underlying driver. For example, the filter driver could be written to trigger a logic analyzer (by writing to a specified PCI address for instance), as well as stop the system (via an assert or panic of some kind).
Having done this, one can correlate several pieces of information. From the filter driver one can extract the contents of the send completion to determine which send is being completed. One can also locate the corresponding data and associated acknowledgements on a sniffer attached to the network. One can analyze the interaction between the interface device and the driver that occurred immediately before the send completion. Using this information one may determine the process by which the interface device completes send commands to the driver.
It may be possible then to further analyze the relationship between send commands, acknowledgments on the wire, and send completions from the card to the host. For instance, if acknowledgments arrive which acknowledge all data for a given outstanding send command, and those acknowledgments do not result in a send completion from the card, then one can surmise that the interface device is batching multiple send completions together. Further analysis of the data being passed between the driver and the interface device (using the PCI analyzer) may be used to identify SndUna values. Since SndUna values are comprised of a 4-byte sequence number, they are pretty reliably identifiable—a coincidental match has a probability of one in four billion.
If one sees an acknowledgment value specified by the host to the interface device (contained in data written to the interface device, or read out of host memory by the interface device) and then a subsequent send completion that is triggered by the receipt of an ACK (packet) equal to or greater than this value, then one can be reasonably certain that the system is using the innovations disclosed herein.
Although we have focused on detailed descriptions of particular embodiments, other embodiments and modifications are within the spirit of this invention as defined by the appended claims. For example, although TCP is discussed as an exemplary transport level protocol, other protocols that define logical connections using streams of bytes may instead be employed. As another example, although particular numbers are discussed, such as setting a SndUna threshold to be equal to an ending sequence number of data denoted by a command, varying either or both sequence numbers slightly could still perform the same function in the same way with the same result, and is therefore intended to be covered.

## Claims

1. A method comprising:
running, on a computer, an application;
running, on a network interface for the computer, a transmission control protocol (TCP) connection for the application;
providing, by the computer to the network interface, a plurality of transmit commands to send data for the TCP connection, wherein the transmit commands vary in an amount of data that they denote; and
providing, by the network interface to the computer, a plurality of notifications that the transmit commands have been completed by the network interface, including batching notifications that transmit commands denoting relatively small amounts of data have completed, and not batching notifications that transmit commands denoting relatively large amounts of data have completed.

2. The method of claim 1, wherein providing a plurality of notifications that the transmit commands have been completed by the network interface includes providing, by the network interface to the computer, a plurality of SndUna values of the TCP connection.

3. The method of claim 1, including providing, by the computer to the network interface, a SndUna threshold that is not less than an ending sequence number for one of the transmit commands.

4. The method of claim 1, including maintaining, by the network interface, a SndUna threshold, wherein providing a plurality of notifications that the transmit commands have been completed by the network interface includes providing, by the network interface to the computer, a notification that a transmit command has completed when the SndUna value of the TCP connection matches or exceeds the SndUna threshold.

5. The method of claim 1, including maintaining, by a driver for the network interface, a SndUna threshold, wherein providing a plurality of notifications that the transmit commands have been completed by the network interface includes providing, by the network interface to the computer, a notification that a transmit command has completed when the SndUna value of the TCP connection matches or exceeds the SndUna threshold.

6. The method of claim 1, wherein the notifications that the transmit commands have completed are modulated by the size and frequency of the transmit commands and the processing of the data transfer by the TCP connection.

7. The method of claim 1, wherein the notifications that transmit commands denoting relatively small amounts of data have completed together denote an amount of data that is less than the amount denoted by one of the transmit commands denoting relatively large amounts of data have completed.

8. An apparatus comprising:
a computer that is adapted to run an application;
a network interface for the computer, the network interface adapted to run a transmission control protocol (TCP) connection for the application;
means for providing, by the computer to the network interface, a plurality of transmit commands to send data for the TCP connection, including means for providing, by the computer to the network interface, transmit commands that vary in the amount of data they denote;
means for providing, by the network interface to the computer, a plurality of notifications that the transmit commands have been completed by the network interface, including means for batching notifications that transmit commands denoting relatively small amounts of data have completed and not batching notifications that transmit commands denoting relatively large amounts of data have completed.

9. The apparatus of claim 8, wherein the means for providing a plurality of notifications that the transmit commands have been completed by the network interface includes means for providing, by the network interface to the computer, a plurality of SndUna values of the TCP connection.

10. The apparatus of claim 8, including means for providing, by the computer to the network interface, a SndUna threshold that is not less than an ending sequence number for one of the transmit commands.

11. The apparatus of claim 8, including means for maintaining, by the network interface, a SndUna threshold, wherein the means for providing a plurality of notifications that the transmit commands have been completed by the network interface includes means for providing, by the network interface to the computer, a notification that a transmit command has completed when the SndUna value of the TCP connection matches or exceeds the SndUna threshold.

12. The apparatus of claim 8, including means for maintaining, by a driver for the network interface, a SndUna threshold, wherein providing a plurality of notifications that the transmit commands have been completed by the network interface includes means for providing, by the network interface to the computer, a notification that a transmit command has completed when the SndUna value of the TCP connection matches or exceeds the SndUna threshold.

13. The apparatus of claim 8, including means for modulating the notifications that the transmit commands have completed.

14. The apparatus of claim 8, wherein the notifications that transmit commands denoting relatively small amounts of data have completed together denote an amount of data that is less than the amount denoted by one of the transmit commands denoting relatively large amounts of data have completed.

15. An apparatus comprising:
a computer that is adapted to run an application;
a network interface for the computer, the network interface adapted to run a transmission control protocol (TCP) connection for the application;
a first program that is adapted to run on the computer and provide to the network interface a plurality of transmit commands to send data for the TCP connection, wherein the transmit commands vary in an amount of data that they denote;
a second program that is adapted to run on the network interface and provide to the computer a plurality of notifications that the transmit commands have been completed by the network interface, wherein notifications that transmit commands denoting relatively small amounts of data have completed are batched and notifications that transmit commands denoting relatively large amounts of data have completed are not batched.

16. The apparatus of claim 15, wherein the second program is adapted to provide a plurality of SndUna values of the TCP connection to the computer, wherein the SndUna values are the notifications that the transmit commands have been completed by the network interface.

17. The apparatus of claim 15, wherein the first program is adapted to provide, by the computer to the network interface, a SndUna threshold that is not less than an ending sequence number for one of the transmit commands.

18. The apparatus of claim 15, wherein the network interface is adapted to maintain a SndUna threshold and to provide a notification that a transmit command has completed when the SndUna value of the TCP connection matches or exceeds the SndUna threshold.

19. The apparatus of claim 15, wherein a driver on the computer is adapted to maintain a SndUna threshold and the network interface is adapted to provide a notification that a transmit command has completed when the SndUna value of the TCP connection matches or exceeds the SndUna threshold.

20. The apparatus of claim 15, wherein the notifications that transmit commands denoting relatively small amounts of data have completed together denote an amount of data that is less than the amount denoted by one of the transmit commands denoting relatively large amounts of data have completed.