# Patent

## Title
Packet capture

## Abstract

Roughly described, a network interface device for connection between a host data processing device and a network, comprising: a controller for supporting communication with a host data processing device over a data bus interface; and a packet capture unit between the controller and the network and comprising: a packet inspector configured to parse incoming data packets to identify data packets of a first data flow; a duplication engine to generate a duplicate data flow from the first data flow; and a packet capture engine to process said duplicate data flow into a packet capture data stream having a predefined format. The network interface device is configured to cause: the first data flow to be made available to a consumer process of a host data processing device to which the network interface device is connected; and the processed packet capture data stream to be stored at a packet capture buffer.

## Background
CROSS REFERENCE TO OTHER APPLICATIONS
This application claims the benefit of prior U.S. Provisional Patent Application No. 61/829,145, filed 30 May 2013, entitled “PACKET CAPTURE,” by Steve L. Pope, David J. Riddoch and Martin Porter, which application is incorporated herein by reference in its entirety.


BACKGROUND
This invention relates to network interface devices for performing packet capture at a host data processing system.
Packet capture is an important tool for network management and is used for many monitoring and troubleshooting purposes. With increasingly many applications, especially those in financial services, operating with very aggressive quality of service and jitter requirements, packet capture can provide a means of performing application level performance tuning and diagnostics by recording a log of packet activity on application data flows. Packet capture can further satisfy the requirements of regulatory compliance that exist in financial services, such as the logging of trading messages to and/or from a server.
Packet capture commonly requires hardware timestamp support, especially if a precision of tens of nanoseconds is to be achieved, which in turn requires the use of network time synchronisation protocols such as IEEE 1588 v2. Furthermore, the high speeds of modern networks (such as 1, 10 or 40 GbE) has resulted in the development of dedicated hardware packet capture devices for performing packet capture of received data flows by processing received data packets into a standard format logfile, such as PCAP. For example, Napatech's network analysis adaptors support high speed packet capture at up to 20 Gb/s. However, such devices terminate the network flows they receive and therefore rely on the network architecture itself to be configured to provide duplicate data flows to the packet capture devices. This is conventionally achieved through the use of high speed switches (e.g. via a spanning port) arranged to duplicate the data flows which a packet capture device is intended to capture. The parent data flow from which the duplicate flow is made is delivered to the appropriate endpoint in the normal manner. Furthermore, dedicated packet capture devices that stream capture data into host memory typically rely on a complex interface to the host which is primarily concerned with supporting the high data rates of the capture streams and does not guarantee uninhibited data flow for other applications supported at the capture system.
The conventional use of network switches to provide duplicate data flows for packet capture has several disadvantages:

    
    
        i. it requires the use of expensive switches and the architecture of the network to be designed to ensure that the data flows to be captured are routed via the switches at which the data flows are to be duplicated—it can be particularly expensive to engineer a network such that all data flows are monitored at a packet capture device;
        ii. since the duplicated data flow and its parent data flow take different paths through the network to their respective endpoints, the packet capture device does not measure the jitter for the parent data flow downstream from the switch, which is in fact the data flow intended to be monitored;
        iii. furthermore, because the parent and duplicate data flows take different paths, the packet capture device actually measures the jitter experienced by the duplicate data flow, which can include contributions from the network fabric downstream from the switch on the path of the duplicate data flow;
        iv. packet capture devices are a point of traffic aggregation in a network and must therefore make use of high end link technologies if they are to cope with the convergence of many data flows in a high volume network—this makes conventional packet capture devices expensive.
    
    


Some switches, such as Cisco's IOS switches supporting Embedded Packet Capture, provide the ability to perform packet capture at the switch itself. However, this does not address problems (i), (ii) or (iv) and requires the captured data to be streamed across a network for storage, which can itself lead to increased jitter and congestion on the links supporting the monitored data flows.
There is therefore a need for an improved packet capture device that addresses one or more of these problems.
SUMMARY
According to a first aspect of the present invention there is provided a network interface device for connection between a host data processing device supporting a consumer process and a network, the network interface device comprising:
a data bus interface;
a controller for supporting communication with a host data processing device over the data bus interface; and
a packet capture unit located between the controller and the network and comprising:
a packet inspector configured to parse incoming data packets so as to identify data packets belonging to a first data flow;
a duplication engine configured to generate a duplicate data flow from the first data flow; and
a packet capture engine configured to process said duplicate data flow into a packet capture data stream having a predefined format;
wherein the network interface device is configured to cause:
the first data flow to be made available to a consumer process of a host data processing device to which the network interface device is connected; and
the processed packet capture data stream to be stored at a packet capture buffer.
Preferably the packet capture buffer is supported at the network interface device.
Suitably the controller is arranged to make available the first data flow to a consumer process by:
identifying an endpoint representing a corresponding consumer process accessible over the data bus interface; and
delivering over the data bus interface data of the first data flow addressed to said identified endpoint.
Preferably the packet capture unit is arranged to make available the processed packet capture data to the controller for delivery to an endpoint accessible over the data bus interface. Preferably the processed packet capture data is assigned a lower priority than data of the first data flow and the controller is configured to enforce a quality of service protocol such that the processed packet capture data is delivered over the data bus interface between data of the first data flow. Preferably the controller is configured to deliver data of the first data flow over the data bus interface when the data bus interface is otherwise quiescent.
Suitably the network interface device further comprises interconnect logic for connection to a storage subsystem, the packet capture unit being configured to deliver the processed packet capture data stream to the interconnect logic for storage at the storage subsystem, the data path between the packet capture unit and the interconnect logic not including the controller.
Suitably the packet capture unit is arranged to deliver the processed packet capture data stream onto the network over a data path that does not include the controller. Preferably the processed packet capture data is assigned a lower priority than data of the first data flow and the packet capture unit is configured to enforce a quality of service protocol such that the processed packet capture data is delivered onto the network between data of any outgoing data flows.
Preferably the packet capture unit further comprises a data store including one or more triggers, the packet inspector being configured to parse incoming data packets by matching said one or more triggers to each received data packet so as to identify data packets belonging to the first data flow. Suitably the one or more triggers include a regular expression over at least a portion of incoming data packets.
The network interface device preferably further comprises timestamping apparatus configured to, on each data packet of the first data flow being received at the network interface device, generate a timestamp, each such timestamp being included in the processed packet capture data stream by the packet capture engine.
Suitably the processing of said duplicate data flow into a packet capture data stream by the packet capture engine includes performing data compression.
Preferably the packet capture unit is a reconfigurable logic device such as an FPGA. Suitably the packet inspector, duplication engine and packet capture engine are defined by one or more firmware modules installed at the reconfigurable logic device.
According to a second aspect of the present invention there is provided a data processing system comprising:
a network interface device according to the first aspect of the present invention; and
a host data processing device having a plurality of processing cores, a memory subsystem and being coupled to the network interface device by means of a data bus, the host data processing device supporting said consumer process and a packet capture process arranged to support a host packet capture buffer;
wherein the consumer process and the packet capture process are supported at different processing cores of the host data processing device.
Preferably the packet capture process is a user level process supporting the host packet capture buffer in its address space, the network interface device being arranged to deliver the processed packet capture data stream over the data bus by means of direct memory access.
The data processing system preferably further comprises a user level protocol processing engine, the packet capture unit being configured to pass the processed packet capture data stream to a controller of the network interface device as a series of data packets for delivery to an endpoint associated with the user level protocol processing engine.
Preferably the packet capture process is arranged to, in a first mode, service one or more receive queues associated with said endpoint so as to read data of the processed packet capture data stream into the host packet capture buffer.
Preferably the packet capture process is arranged to, in a second mode, read processed packet capture data including timestamp information from the host packet capture buffer and cause the packet capture unit to enter a replay mode in which it:
receives the read processed packet capture data from the packet capture process;
reforms the read processed packet capture data into a reformed sequence of data packets and associated timestamp information representative of a corresponding sequence of received data packets of the first data flow; and
causes the reformed sequence of data packets to be delivered to the host by means of the controller according to a schedule commensurate with the relative receive time intervals indicated by the associated timestamp information.
Suitably the packet capture unit further includes a replay unit configured to perform at least the reforming step of the replay mode.
Preferably, if the read processed packet capture data at the packet capture buffer does not allow the payload data of the corresponding sequence of received data packets of the first data flow to be entirely reformed, the packet capture unit is configured to generate the reformed sequence of data packets using one or more predetermined test patterns in the place of any missing payload data.
Preferably the packet capture process is arranged to cause at least some of the packet capture data to be delivered to a buffer of the network interface device prior to the packet capture unit being caused to enter its replay mode.
According to a third aspect of the present invention there is provided a network interface device for connection between a host data processing device and a network, the network interface device comprising:
a data bus interface;
a controller for supporting communication with a host data processing device over the data bus interface; and
a packet capture unit located between the controller and the network and comprising:
a packet inspector configured to parse outgoing data packets so as to identify data packets belonging to a first data flow;
a duplication engine configured to generate a duplicate data flow from the first data flow; and
a packet capture engine configured to process said duplicate data flow into a packet capture data stream having a predefined format;
wherein the network interface device is configured to cause:
the first data flow to be transmitted onto a network to which the network interface device is connected; and
the processed packet capture data stream to be stored at a packet capture buffer.
Preferably the packet capture unit is arranged to deliver the processed packet capture data stream onto the network over a data path that does not include the controller.
Preferably the processed packet capture data is assigned a lower priority than data of the first data flow and the packet capture unit is configured to enforce a quality of service protocol such that the processed packet capture data is delivered onto the network between data of the first data flow.
According to a fourth aspect of the present invention there is provided a data processing system comprising:
a network interface device according to the third aspect of the present invention; and
a host data processing device having a plurality of processing cores, a memory subsystem and being coupled to the network interface device by means of a data bus, the host data processing device supporting a source process from which data of the first data flow originates and a packet capture process arranged to support a host packet capture buffer; wherein the source process and the packet capture process are supported at different processing cores of the host data processing device.
Preferably the packet capture process is a user level process supporting the host packet capture buffer in its address space, the network interface device being arranged to deliver the processed packet capture data stream over the data bus by means of direct memory access.
The data processing system preferably further comprises a user level protocol processing engine, the packet capture unit being configured to pass the processed packet capture data stream to a controller of the network interface device as a series of data packets for delivery to an endpoint associated with the user level protocol processing engine.
Preferably the packet capture process is arranged to, in a first mode, service one or more receive queues associated with said endpoint so as to read data of the processed packet capture data stream into the host packet capture buffer.
Preferably the packet capture process is arranged to, in a second mode, read processed packet capture data including timestamp information from the host packet capture buffer and cause the packet capture unit to enter a replay mode in which it:
receives the read processed packet capture data from the packet capture process;
reforms the read processed packet capture data into a reformed sequence of data packets and associated timestamp information representative of a corresponding sequence of received data packets of the first data flow; and
transmits the reformed sequence of data packets onto the network at the relative time intervals indicated by the associated timestamp information.
Suitably the packet capture unit further includes a replay unit configured to perform at least the reforming step of the replay mode.



BRIEF DESCRIPTION OF THE DRAWINGS
The present invention will now be described by way of example with reference to the accompanying drawings, in which:
FIG. 1 is a schematic diagram of a data processing system configured in accordance with the present invention.
FIG. 2 is a schematic diagram of a network interface device configured in accordance with the present invention illustrating packet capture on the receive path.
FIG. 3 is a schematic diagram of a network interface device configured in accordance with the present invention illustrating packet capture on the transmit path.



DETAILED DESCRIPTION
The following description is presented to enable any person skilled in the art to make and use the invention, and is provided in the context of a particular application. Various modifications to the disclosed embodiments will be readily apparent to those skilled in the art.
The general principles defined herein may be applied to other embodiments and applications without departing from the spirit and scope of the present invention. Thus, the present invention is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
The present invention relates to network interface devices for performing packet capture at a host data processing system. A network interface device as described herein could be provided in any suitable form, including as a peripheral device or integrated with the hardware of a host data processing device. A data processing device could be any kind of computer system, including a server, personal computer, or a bespoke processing unit. A network interface device as described herein provides an interface to a network for use by its host data processing device.
A schematic diagram of a data processing system configured in accordance with the present invention is shown in FIG. 1. Data processing system 120 comprises a network interface device 100 and a host data processing device 101 coupled together by means of a data bus 103. Network interface device 100 provides access to network 102 for the data processing device.
Data processing device 101 preferably supports a software environment comprising kernel space 104 and user level space 105. The kernel would typically support a network protocol stack 118 for performing processing of network data packets communicated over the network interface device, along with communication queues 111 and 112 for receiving incoming data and/or holding data for transmission over the network. User space 105 supports at least one application 106 arranged to communicate data over the network interface device. For example, application 106 might be one or both of a consumer of an incoming data flow and a source for an outgoing data flow. Preferably user space further supports a packet capture application 107 whose function will be later described.
One or both of application 106 and packet capture application 107 could be provided with a user level protocol processing engine 110/109. Most preferably user level stacks 110 and 109 would be provided in the respective address spaces of applications 106 and 107, but in less preferred embodiments this need not be the case and applications 106 and 107 could share a single user level stack 110 or 109. One or more of communication queues 111/112 could be located in user space 105 but preferably the communication queues corresponding to the network endpoints supported by a user level stack would be located in kernel space and memory mapped into the address space of the respective user level stack.
As is conventional, network interface device comprises a controller 113 for supporting communication with data processing device 101 over data bus 103. The controller is configured to match network data flows to their respective endpoints supported at data processing device 101 (e.g. a queue pair of communication queues 111/112). Preferably controller 113 includes a DMA manager for supporting direct memory access over data bus 103 with the communication queues 111/112 held at the memory subsystem of host device 101.
In accordance with the present invention, network interface device 100 further includes a packet capture unit 114 for capturing data packets sent or received over the network interface device. Packet capture unit 114 is provided between network 102 and controller 113 such that network data flows terminating at data processing device 101 pass through the packet capture unit. Packet capture unit 114 is configured to capture data packets received or transmitted over one or more specified data flows and process the captured data packets into a stream of packet capture data having a predefined format (e.g. PCAP).
The packet capture data stream is stored at a packet capture buffer, which could be located, to give four examples, at buffer 115 on the network interface device, at buffer 108 at the host device, at external storage 117, or at network storage 119. All four buffers 115, 108, 117 and 119 are shown in FIG. 1 for completeness only and in a given system 120, one, two, three or all four of buffer 115, buffer 108, buffer 117 and buffer 119 might be present. Buffer 115 could be any kind of data store at the network interface device, and could be provided at the packet capture unit itself. Buffer 108 is a data store maintained at the host by packet capture software 107 and would be located at a memory subsystem of the host device, such as RAM, a solid state memory, hard disk or other storage unit. Buffer 117 is a storage device (e.g. a solid state memory or hard disk) external to the network interface device but connected directly to the network interface device by means of optional interconnect 116 such that packet capture data is not written to the buffer over host device 101. Buffer 119 is a network entity comprising a data store for supporting a packet capture buffer and is accessible to packet capture unit 114 over network 102. Because capture unit 114 is located between the controller and the network, capture data can be sent back out onto the network without passing through the controller and influencing data flows to/from the host.
Other buffer locations are envisaged and the four locations described herein are given by way of example only. As will become apparent, the architecture proposed by the present invention means that the location of the buffer at which packet capture data is stored is of lesser importance than with prior art packet capture systems.
Preferably packet capture data stream is at least initially stored at buffer 115 or buffer 117 since these locations allow the packet capture unit to stream the capture data into the buffer without introducing latency and jitter into the communication of data to and from the network interface device over data bus 103 or network 102.
It is advantageous if packet capture unit 114 is configured to provide a network interface to both network 102 and controller 113 such that controller communicates with the packet capture unit by means of flows of network data packets. This allows a conventional NIC controller 113 to be used. Preferably the controller and packet capture unit are each provided with a media access control (MAC) unit so as to permit logically-formed data packets to pass between the two. Any suitable physical layer could be provided between the controller and packet capture unit. Preferably only the packet capture unit would be provided with a network PHY between it and the network in order to support the physical signalling of data packets over the network.
In any embodiment of the present invention the packet capture unit could be physically and/or electrically integrated with the controller. For example, the packet capture unit and controller could be co-located on the same integrated circuit/die or provided on separate integrated circuits/dies within the same package.
The operation of the packet capture unit will now be described in more detail with reference to FIGS. 2 and 3.
FIG. 2 schematically illustrates packet capture on the receive path of a network interface device (NIC) configured in accordance with the present invention. NIC 100 receives network data flows 210 at physical interface 201 (e.g. a network PHY). On receiving each data packet, timestamp unit 202 records the precise time at which each data packet is received and forms a timestamp representing this information. Each timestamp represents metadata for the respective data packet and can be, for example, written or appended to that packet, or provided separately to the packet capture unit. As is known in the art, through the use of clock synchronization protocols such as IEEE 1588 v2 to synchronize the oscillator used by the hardware timestamp, a time resolution of tens of nanoseconds is possible with hardware timestamp units. Timestamp unit 202 preferably forms part of packet capture unit 114 but could alternatively be provided between the packet capture unit and the network interface device.
Packet capture unit 114 captures one or more specified data flows received from the network through the use of a packet inspector 203, a duplication engine 204 and a packet capture engine 205 (whose functionality may be achieved at the packet capture unit by one or more physical units). Packet inspector 203 is configured to parse incoming data flows in order to identify data packets belonging to one or more specified data flows. This is preferably accomplished by arranging the packet inspector to match each received data packet against a set of one or more triggers in order to identify data packets of the specified data flows. The triggers therefore identify to the packet inspector the data flows that are to be captured. The triggers could be stored at a data store 206 of the packet capture unit. Preferably the triggers are regular expressions over packet contents.
Data packets for which no match is found are passed in stream 211 to controller 114 for delivery in the conventional manner to their respective endpoints at the host device. Data packets that are identified as belonging to one of the specified data flows are passed in stream 212 to duplication engine 204 which duplicates the specified data flows, passing the first of each data packet over stream 216 to be delivered to its respective endpoint at the host device and the second of each data packet onto packet capture engine 205. Packet capture engine 205 is configured to process each of the second data packets of the specified data flows in order to form packet capture data of a predetermined format (e.g. PCAP).
Packet capture engine transforms the duplicate data flows in accordance with the predetermined format by, for example, performing lossless or lossy compression of data packet payloads and/or headers. The packet capture engine further includes in the packet capture data the timestamp information generated for each data packet. Preferably the timestamp unit 202 and packet inspector 203 are arranged to include the timestamps for the specified data flows in data stream 212 (e.g. the timestamps could be written/appended to the packets).
Packet capture unit 114 is preferably a reconfigurable logic device, such as an FPGA, with packet inspector 203, duplication engine 204 and packet capture engine 205 being functional components defined at the reconfigurable logic device by one or more firmware modules. Other applications could co-exist at the reconfigurable logic device, for example line-arbitration, financial symbol filtering, compression or encryption applications.
The stream of packet capture data generated at the packet capture engine is stored at a packet capture buffer. In the example shown in FIG. 2, capture streams 217 are delivered to buffer 115 at the network interface device (which may or may not be part of the packet capture unit). Preferably the packet capture unit is configured to provide a different capture stream for each of the specified data flows for storage at a different packet capture buffer of buffer 115. In preferred embodiments of the present invention, buffer 115 comprises RAM external to the packet capture unit at the NIC, the buffer supporting the packet capture buffers. In alternative embodiments, the capture buffer could be located at a storage device directly connected to the network interface device—for example, at a solid state disk (SSD) connected by means of a SATA interface.
If the capture buffers are not held at a buffer of the network interface device or a storage device 117 directly connected to the NIC, the packet capture engine is arranged to cause the capture streams 217 to be delivered to the appropriate endpoint at the host or network. Thus, if capture buffers are maintained at the host device, the capture streams are delivered over data bus interface 207 into the appropriate receive queues of the host device by means of controller 113. It is nonetheless advantageous if some caching of the capture streams is performed at the network interface device (e.g. at buffer 115) in order to allow the capture streams to be delivered at lower priority than the data flows to which the capture streams relate. This helps to minimise the introduction of latency or jitter into the data flows received at the host. For example, the capture streams could be delivered into capture buffers at the host when the data bus is quiescent.
If the capture buffers are maintained at a network entity 119 accessible over the network, the capture streams are delivered back onto the network over physical interface 201 for delivery to the appropriate network entity. This would require the packet capture data to be encapsulated as a stream of network data packets, which could be performed at the packet capture engine or at a subsequent processing functionality of the packet capture unit. The capture streams could be delivered to the controller for appropriate routing and transmission out onto the network on the transmit path, but preferably the capture unit is configured to push the capture streams directly out onto the network. Again, it is advantageous if some caching of the capture streams is performed at the network interface device (e.g. at buffer 115) in order to allow the capture data to be transmitted at lower priority than outgoing data flows. This helps to minimise the introduction of latency or jitter into the transmission and reception of network data flows at the network interface device.
A preferred embodiment of the present invention will now be described in which the network interface devices includes temporary buffer 115 for caching packet capture data streams formed at packet capture engine 205, the cached capture streams being subsequently delivered to host receive queues for storage at the capture buffers. The host data processing device includes a plurality of processing cores, including a first core 208 supporting a packet capture process and a second core 209 supporting a consumer application receiving at least one of the incoming data flows captured at the packet capture unit.
The packet capture unit is arranged to cause the cached capture streams to be delivered in stream 213 directed to the receive queues of the packet capture process at core 208. This can be achieved, for example, by encapsulating the capture data as a sequence of network frames addressed to the host endpoint corresponding to the packet capture process. This allows controller 113 to direct the capture streams to the appropriate endpoint by handling the encapsulated stream as regular network data packets (e.g. demuxing the encapsulated data packets onto the VNIC supporting the DMA queue pair of the packet capture software). Since the capture streams correspond to data flows for delivery to one or more consumers at the host, the network interface device is also configured to deliver the received data packets to the appropriate consumer processes. One such data flow is represented by flow 214 to the consumer process supported at core 209.
In order to minimise the introduction of latency and/or jitter into the received data flows, the data processing system is preferably configured to (a) deliver packet capture streams 213 over data bus interface 207 at a lower priority than data flows 214, and (b) arrange that the packet capture process consuming the packet capture streams is supported at a different processing core to the consumer process(es) of the corresponding data flows. By arranging that capture streams are transferred over data bus interface 207 when the data bus is not occupied delivering data flows to the host, the capture stream data is interleaved between the data flows so as to minimise any impact on the conventional flow of data to each consumer. By arranging that the packet capture and consumer processes are at different cores, switches in context between the processes are avoided that can result in delays at the software layer. This is particularly important in low latency applications, such as financial trading systems. Most preferably, the packet capture process is supported at a core that does not support any consumer processes.
In order to minimise the receive processing performed at the host, it is advantageous to arrange that the capture data is delivered to the host in large frames, for example superpackets that could be larger than the maximum frame size normally permitted for the network protocol according to which the captured data packets are formed.
Whether buffer 115 supports the packet capture buffers or whether it merely caches packet capture streams prior to delivery to the packet capture buffers, buffer 115 could have sufficient capacity to hold the capture streams for a considerable time. For example, in a data processing system supporting a financial trading platform, buffer 115 could be sufficiently large to buffer an entire trading day. This has the advantage that the capture unit can wait until the end of the trading day before transferring the packet capture data into packet capture buffers or into longer term storage, and hence avoids introducing latency and jitter into the financial data flows being captured.
Host device preferably supports capture software 107 for configuring packet capture unit 114 and receiving capture streams from buffer 115 for storage at data store 108 (e.g. a non-volatile memory or storage device at the host system). Capture software 107 would therefore include the capture process supported at core 208 discussed above in relation to FIG. 2. The capture software therefore represents the endpoint for the capture streams delivered into its receive queues 112, with the capture process servicing the receive queues in order to receive the data into store 108. Preferably the capture software receives capture data by means of a user level protocol processing engine 109 configured as is known in the art so as to bypass the kernel stack 118 and avoid the use of interrupts, both of which are causes of latency and jitter at the software level.
In such an embodiment, encapsulated capture data held at buffer 115 is delivered by controller 113 as network frames to the receive queues 112 of capture software 107 that is supported at its own core of the system. The receive queues 112 preferably correspond to a VNIC defined at the NIC for the user level stack 109. The user level stack processes the frames carrying the capture data and make the capture data available to the capture software in the address space of which the user level stack resides. It is then up to the capture software to perform any required processing of the capture streams (perhaps to complete the formation of the capture streams into the predetermined format) and store the data at data store 108. This architecture allows capture data to be provided to capture software at the host and low latency and without disturbing data flows or consumer processes running at the host machine.
FIG. 2 relates to the capture of incoming data flows on the receive path of a NIC. The packet capture unit can be additionally or alternatively configured to perform packet capture on outgoing data flows.
The transmit path of network interface device 100 is shown schematically in FIG. 3 and includes the packet capture unit 114. Again, packet capture unit comprise a packet inspector 303, a duplication engine 304 and a packet capture engine 305. These functional components of the capture unit could be the same functional components as their equivalents 203, 204 and 205 shown in FIG. 2, with incoming and outgoing data flows being parsed at the packet inspector so as to identify which incoming or outgoing streams are to be captured. In order to maintain the independence of the transmit and receive paths on a NIC it is preferable that components 303, 304 and 305 are provided in addition to 203, 204 and 205, and are dedicated to processing outgoing data flows on the transmit path.
Packet capture is performed in the same manner on a data flow whether it is incoming or outgoing. As described in relation to FIG. 2, data flows 312 identified at the packet inspector 303 as being for capture (potentially in dependence on a set of triggers stored at data store 306 identifying those flows) are duplicated at duplication engine 304, with the first flow passing to the packet capture engine for formation into a packet capture stream and the second flow 316 passing out onto the network with data flows 311 that are not identified as being for capture. Preferably the capture data formed at the capture engine 305 is written in stream 317 to buffer 115, potentially for storage at capture buffers located at buffer 115. Alternatively and as described in relation to FIG. 2, the capture buffers could be located elsewhere, such as at the host at data store 108, at a storage device 117 or at a network entity 119.
Packet capture software at the host for receiving and potentially processing packet capture data is preferably supported at a different processing core 308 of the host system to the source process(es) from which the captured data flows originate. Such a source process is supported at processing core 309 in FIG. 3. Data flows 314 originating from the source process are received at the NIC over data bus interface 207 and captured at the packet capture unit 114 in the manner described herein. The captured streams are at least temporarily cached at buffer 115 before being delivered in stream 313 to the capture process supported at processing core 308. It is advantageous if capture streams 313 are assigned a lower priority than data flows 314 so as to minimise any latency or jitter caused by the capture streams sharing the same data bus as the source data flows. Outgoing data flows 314, whether captured or not, are transmitted onto the network 310 by the network interface device in the conventional manner.
By arranging that the packet capture unit is located at the host device which terminates the data flows to be captured (i.e. the host supporting the source/consumer applications of the data flows), the capture streams provide an accurate record of the data flows to and from the host. The packet capture is performed at the point at which the data flows are processed and therefore the capture data represents a true reflection of packet timings: there is no false contribution specific to the capture data path, and the capture data is not missing any latency or jitter specific to the network path taken by the data flows. Furthermore, there is no requirement for expensive switches to provide duplicate data flows to dedicated packet capture units designed to cope with the high data rates resulting from the convergence of many data flows in the network. A network interface device configured in accordance with the present invention can be readily provided at each data processing system whose data flows are to be monitored, removing the need for careful network engineering and dedicated packet capture units remote from the system supporting the endpoints of the monitored data flows.
It should be noted that even in the event that packet capture streams generated by a NIC as described herein and delivered across a network to a remote network entity for storage (e.g. 119 in FIG. 1), the packet timings are captured at the host device and therefore do not suffer from the problems associated with providing separate parent data flow and capture streams within a network. Thus, in the system of the present invention, it is of limited consequence where the capture buffers are located. It is however advantageous for the NIC to support sufficient buffer space to allow the capture streams to be delivered from the NIC at times that minimise the impact of such data delivery on the data flows of the system (e.g. by assigning the capture streams a lower priority and enforcing quality of service protocols, or allowing delivery only when the relevant data bus or network interface is quiescent).
Capture data can be useful for several reasons: it can provide an audit trail for financial transactions performed by a trading platform; it can provide an additional layer of security by logging data flowing in or out of a server; it can allow data flows to be analysed asynchronously at greater fidelity than is possible in real time (e.g. for intrusion detection). Because capture data includes a precise record of the time at which data packets are sent/received, it can further be used to recreate conditions present on a network or at a particular entity. This can be useful to help optimise a network and for debugging network or application layer software.
A data processing system configured in accordance with the present invention can be arranged to replay capture data stored at a capture buffer in order to recreate the data flows represented by the capture data and cause the transmission of those data flows at the precise relative timings expressed in the capture data. For example, capture software 107 in FIG. 1 might be operable to cause capture data to be delivered back to capture unit 114 for recreation of the original data packets. If the packet capture data includes packet data compressed losslessly, the original packets can be recreated by decompressing the capture data. In the event that the format in which the packet capture data is stored involves lossy compression of packet data, missing sequences of data can be replaced by padding data in order to recreate data packets of the correct size (e.g. by predetermined patterns of data or random garbage that can be ignored at the receiver).
The decompression of capture data and formation of the original packets (or their proxies) is performed at the capture unit 114. This could be through re-tasking of the chain of packet inspector, duplication engine and packet capture engine, or a replay engine (not shown in the figures) could be provided at the capture unit for recreating data flows from capture data. For example, if the capture unit is a reconfigurable logic device, the replay engine could be a functionality defined in firmware. In its replay mode (in which its functional modules are re-tasked or its replay engine initialised), the packet capture unit is configured to generate flows of data packets from received capture data along with timing data indicating the relative times at which each packet is to be transmitted. The capture engine then pushes the data packets out onto the network in accordance with the indicated timings, hence precisely recreating the flows of data transmitted from the NIC at the time of capture.
For captured incoming data flows, replay of the capture data causes the capture engine to provide a precisely recreated stream of received data packets to the controller in accordance with the packet timings expressed in the capture data. The controller delivers the received data flows in its conventional manner so as to recreate the receive path conditions at the time of packet capture.
In order to avoid the NIC to transferring capture data over its interfaces whilst the replay of capture data is being performed, it is preferable if the capture software causes at least some of the capture data for replay to be transferred into buffer 115 at the NIC prior to the replay being initiated. This ensures that at least some of the required data is available at the NIC to the capture unit in advance of the network test and by providing a significant cache of the capture data at the NIC negates the impact of any delays or jitter on subsequent transfers of capture data to the NIC.
Note that the interconnections shown in figures are merely schematic and not necessarily indicative of actual connections between physical or logical components.
The applicant hereby discloses in isolation each individual feature described herein and any combination of two or more such features, to the extent that such features or combinations are capable of being carried out based on the present specification as a whole in the light of the common general knowledge of a person skilled in the art, irrespective of whether such features or combinations of features solve any problems disclosed herein, and without limitation to the scope of the claims. The applicant indicates that aspects of the present invention may consist of any such individual feature or combination of features. In view of the foregoing description it will be evident to a person skilled in the art that various modifications may be made within the scope of the invention.

## Claims

1. A network interface device for connection between a host data processing device supporting a consumer process and a network, the network interface device comprising:
a data bus interface;
a controller for supporting communication with a host data processing device over the data bus interface; and
a packet capture unit located between the controller and the network and comprising:
a packet inspector configured to parse incoming data packets so as to identify data packets belonging to a first data flow;
a duplication engine configured to generate a duplicate data flow from the first data flow; and
a packet capture engine configured to process said duplicate data flow into a packet capture data stream having a predefined format;

wherein the network interface device is configured to cause:
the first data flow to be made available to a consumer process of a host data processing device to which the network interface device is connected; and
the processed packet capture data stream to be stored at a packet capture buffer.

2. The network interface device as claimed in claim 1, wherein the packet capture buffer is supported at the network interface device.

3. The network interface device as claimed in claim 1, wherein the controller is arranged to make available the first data flow to a consumer process by:
identifying an endpoint representing a corresponding consumer process accessible over the data bus interface; and
delivering over the data bus interface data of the first data flow addressed to said identified endpoint.

4. The network interface device as claimed in claim 1, wherein the packet capture unit is arranged to make available the processed packet capture data to the controller for delivery to an endpoint accessible over the data bus interface.

5. The network interface device as claimed in claim 4, wherein the processed packet capture data is assigned a lower priority than data of the first data flow and the controller is configured to enforce a quality of service protocol such that the processed packet capture data is delivered over the data bus interface between data of the first data flow.

6. The network interface device as claimed in claim 4, wherein the controller is configured to deliver data of the first data flow over the data bus interface when the data bus interface is otherwise quiescent.

7. The network interface device as claimed in claim 1, further comprising interconnect logic for connection to a storage subsystem, the packet capture unit being configured to deliver the processed packet capture data stream to the interconnect logic for storage at the storage subsystem, the data path between the packet capture unit and the interconnect logic not including the controller.

8. The network interface device as claimed in claim 1, wherein the packet capture unit is arranged to deliver the processed packet capture data stream onto the network over a data path that does not include the controller.

9. The network interface device as claimed in claim 8, wherein the processed packet capture data is assigned a lower priority than data of the first data flow and the packet capture unit is configured to enforce a quality of service protocol such that the processed packet capture data is delivered onto the network between data of any outgoing data flows.

10. The network interface device as claimed in claim 1, wherein the packet capture unit further comprises a data store including one or more triggers, the packet inspector being configured to parse incoming data packets by matching said one or more triggers to each received data packet so as to identify data packets belonging to the first data flow.

11. The network interface device as claimed in claim 10, wherein the one or more triggers include a regular expression over at least a portion of incoming data packets.

12. The network interface device as claimed in claim 1, further comprising timestamping apparatus configured to, on each data packet of the first data flow being received at the network interface device, generate a timestamp, each such timestamp being included in the processed packet capture data stream by the packet capture engine.

13. The network interface device as claimed in claim 1, wherein the processing of said duplicate data flow into a packet capture data stream by the packet capture engine includes performing data compression.

14. The network interface device as claimed in claim 1, wherein the packet capture unit is a reconfigurable logic device such as an FPGA.

15. The network interface device as claimed in claim 14, wherein the packet inspector, duplication engine and packet capture engine are defined by one or more firmware modules installed at the reconfigurable logic device.

16. A data processing system comprising:
the network interface device as claimed in claim 1; and
a host data processing device having a plurality of processing cores, a memory subsystem and being coupled to the network interface device by means of a data bus, the host data processing device supporting said consumer process and a packet capture process arranged to support a host packet capture buffer;
wherein the consumer process and the packet capture process are supported at different processing cores of the host data processing device.

17. The data processing system as claimed in claim 16, wherein the packet capture process is a user level process supporting the host packet capture buffer in its address space, the network interface device being arranged to deliver the processed packet capture data stream over the data bus by means of direct memory access.

18. The data processing system as claimed in claim 17, further comprising a user level protocol processing engine, the packet capture unit being configured to pass the processed packet capture data stream to a controller of the network interface device as a series of data packets for delivery to an endpoint associated with the user level protocol processing engine.

19. The data processing system as claimed in claim 18, wherein the packet capture process is arranged to, in a first mode, service one or more receive queues associated with said endpoint so as to read data of the processed packet capture data stream into the host packet capture buffer.

20. The data processing system as claimed in claim 19, wherein the packet capture process is arranged to, in a second mode, read processed packet capture data including timestamp information from the host packet capture buffer and cause the packet capture unit to enter a replay mode in which it:
receives the read processed packet capture data from the packet capture process;
reforms the read processed packet capture data into a reformed sequence of data packets and associated timestamp information representative of a corresponding sequence of received data packets of the first data flow; and
causes the reformed sequence of data packets to be delivered to the host by means of the controller according to a schedule commensurate with the relative receive time intervals indicated by the associated timestamp information.

21. The data processing system as claimed in claim 20, wherein the packet capture unit further includes a replay unit configured to perform at least the reforming step of the replay mode.

22. The data processing system as claimed in claim 20, wherein, if the read processed packet capture data at the packet capture buffer does not allow the payload data of the corresponding sequence of received data packets of the first data flow to be entirely reformed, the packet capture unit is configured to generate the reformed sequence of data packets using one or more predetermined test patterns in the place of any missing payload data.

23. The data processing system as claimed in claim 20, wherein the packet capture process is arranged to cause at least some of the packet capture data to be delivered to a buffer of the network interface device prior to the packet capture unit being caused to enter its replay mode.

24. A network interface device for connection between a host data processing device and a network, the network interface device comprising:
a data bus interface;
a controller for supporting communication with a host data processing device over the data bus interface; and
a packet capture unit located between the controller and the network and comprising:
a packet inspector configured to parse outgoing data packets so as to identify data packets belonging to a first data flow;
a duplication engine configured to generate a duplicate data flow from the first data flow; and
a packet capture engine configured to process said duplicate data flow into a packet capture data stream having a predefined format;

wherein the network interface device is configured to cause:
the first data flow to be transmitted onto a network to which the network interface device is connected; and
the processed packet capture data stream to be stored at a packet capture buffer.

25. The network interface device as claimed in claim 24, wherein the packet capture unit is arranged to deliver the processed packet capture data stream onto the network over a data path that does not include the controller.

26. The network interface device as claimed in claim 25, wherein the processed packet capture data is assigned a lower priority than data of the first data flow and the packet capture unit is configured to enforce a quality of service protocol such that the processed packet capture data is delivered onto the network between data of the first data flow.

27. A data processing system comprising:
the network interface device as claimed in claim 24; and
a host data processing device having a plurality of processing cores, a memory subsystem and being coupled to the network interface device by means of a data bus, the host data processing device supporting a source process from which data of the first data flow originates and a packet capture process arranged to support a host packet capture buffer;
wherein the source process and the packet capture process are supported at different processing cores of the host data processing device.

28. The data processing system as claimed in claim 27, wherein the packet capture process is a user level process supporting the host packet capture buffer in its address space, the network interface device being arranged to deliver the processed packet capture data stream over the data bus by means of direct memory access.

29. The data processing system as claimed in claim 28, further comprising a user level protocol processing engine, the packet capture unit being configured to pass the processed packet capture data stream to a controller of the network interface device as a series of data packets for delivery to an endpoint associated with the user level protocol processing engine.

30. The data processing system as claimed in claim 29, wherein the packet capture process is arranged to, in a first mode, service one or more receive queues associated with said endpoint so as to read data of the processed packet capture data stream into the host packet capture buffer.

31. The data processing system as claimed in claim 30, wherein the packet capture process is arranged to, in a second mode, read processed packet capture data including timestamp information from the host packet capture buffer and cause the packet capture unit to enter a replay mode in which it:
receives the read processed packet capture data from the packet capture process;
reforms the read processed packet capture data into a reformed sequence of data packets and associated timestamp information representative of a corresponding sequence of received data packets of the first data flow; and
transmits the reformed sequence of data packets onto the network at the relative time intervals indicated by the associated timestamp information.

32. The data processing system as claimed in claim 31, wherein the packet capture unit further includes a replay unit configured to perform at least the reforming step of the replay mode.

33. The network interface device as claimed in claim 1, wherein the packet capture unit is arranged to deliver the processed packet capture data stream onto the network over a data path that does not include the controller.