Direct data placement
A method for communication includes mapping transport sequence numbers in headers of data packets received from a network to respective buffers in a memory of a host computer. At least a part of the data from payloads of the received data packets is written directly to the respective buffers.
1. A method for communication, comprising:
receiving data packets from a network in a network interface controller (NIC) of the host computer; mapping transport sequence numbers in headers of data packets received from a network to respective buffers, having a given buffer size, in a memory of a host computer;
receiving work requests from the host computer defining second buffers in the memory;
writing at least a part of the data from payloads of the received data packets directly from the NIC to the respective first buffers up to the given buffer size;
writing the headers of the received data packets from the NIC to the second buffers responsively to the work requests; and
when a size of the data in a given data packet exceeds the given buffer size, writing a remainder of the data from the given data packet from the NIC to one of the second buffers.
2. The method according to claim 1 , wherein mapping the transport sequence numbers comprises looking up the first buffers in a table that is indexed according to the transport sequence numbers.
3. The method according to claim 2 , wherein writing the data comprises, upon receiving a data packet having a transport sequence number that is absent from the table, writing all the data from a payload of the received data packet to at least one of the second buffers.
4. The method according to comprising, after the host computer has read the data from a given first buffer that is indexed by a given transport sequence number, updating the table to remove the given transport sequence number from the table and to add a new first buffer that is indexed by a further transport sequence number.
5. The apparatus according to claim 1 , wherein the headers comprise Transmission Control Protocol (TCP) headers, and the transport sequence numbers comprise TCP sequence numbers.
6. Communication apparatus, comprising:
a network interface, to receive from a network data packets comprising headers containing respective transport sequence numbers and payloads containing data;
a host interface, for connection to a host computer having a memory; and
processing circuitry, to map the transport sequence numbers in headers of data packets received from a network to respective buffers in the memory of the host computer and to write at least a part of the data from the payloads of the received data packets to the respective buffers.
7. The apparatus according to claim 6 , wherein the processing circuitry is to map the transport sequence numbers to the respective first buffers using a table that is indexed according to the transport sequence numbers.
8. The apparatus according to claim 7 , wherein upon receiving a data packet having a transport sequence number that is absent from the table, the processing circuitry is to write all the data from a payload of the received data packet to the second buffers.
9. The apparatus according to claim 6 , wherein after the host computer has read the data from a given first buffer that is indexed by a given transport sequence number, the table is updated to remove the given transport sequence number from the table and to add a new first buffer that is indexed by a further transport sequence number.
10. The apparatus according to claim 6 , wherein the headers comprise Transmission Control Protocol (TCP) headers, and the transport sequence numbers comprise TCP sequence numbers.