# Patent

## Title
Memory access optimization

## Abstract

A method and an apparatus for memory access optimization are disclosed. Data unit information may be accumulated for a plurality of data units. Partial network statistics for the plurality of data units may be read sequentially in round robin fashion from each of a plurality of memory banks of a memory. The partial networks statistics may be updated based on the plurality of data units. The updated partial network statistics may be written sequentially in round robin fashion to each of the plurality of memory banks.

## Background
RELATED APPLICATION INFORMATION
This patent is a continuation-in-part of application Ser. No. 11/424,832, filed Jun. 16, 2006, entitled MEMORY ACCESS OPTIMIZATION AND COMMUNICATIONS STATISTICS COMPUTATION.


NOTICE OF COPYRIGHTS AND TRADE DRESS
A portion of the disclosure of this patent document contains material which is subject to copyright protection. This patent document may show and/or describe matter which is or may become trade dress of the owner. The copyright and trade dress owner has no objection to the facsimile reproduction by any one of the patent disclosure as it appears in the Patent and Trademark Office patent files or records, but otherwise reserves all copyright and trade dress rights whatsoever.
BACKGROUND OF THE INVENTION
1. Field
This disclosure relates to memory access, network communications, and network communications statistics computation.
2. Related Art
Networks such as the Internet carry a variety of data communicated using a variety of networking devices, including servers, routers, hubs, and switches; and network capable devices, including computers, personal digital assistants (PDAs), cell phones, telephones, and other devices. Before placing a network into use, the network, including the networking devices, network media, network segments and network applications included therein, may be tested to ensure successful operation. Network capable devices, networking devices and network applications may be tested, for example, to ensure that they function as intended, comply with supported protocols, and can withstand anticipated traffic demands. Such testing may be performed on already deployed and not yet deployed networking devices, network capable devices, network segments and network applications.
To assist with the construction, installation and maintenance of networks, network applications and network capable devices, networks may be augmented with network analyzing devices, network conformance systems, network monitoring devices, and network traffic generators, all which are referred to herein as network testing systems. The network testing systems may allow for analyzing the performance of networks, network applications and network capable devices by capturing, modifying, analyzing and/or sending network communications. The network testing systems may be used to evaluate how well network capable devices handle data communication, including streaming media and voice communications.



DESCRIPTION OF THE DRAWINGS
FIG. 1 is a block diagram of an environment in which memory access optimization and communications statistics computation may be implemented.
FIG. 2A is a block diagram of a first network card.
FIG. 2B is a block diagram of a second network card.
FIG. 3 is a block diagram of a memory and the contents thereof.
FIG. 4 is a flow chart of a method of communications statistics computation.
FIG. 5 is a flow chart of a method of memory access optimization and communications statistics computation.
FIG. 6 is a flow chart of a method of preparing communications statistics.
FIG. 7 is a flow chart of a method of memory access optimization.
FIG. 8 is a flow chart of a method of memory access optimization.



DETAILED DESCRIPTION OF THE INVENTION
Throughout this description, the embodiments and examples shown should be considered as exemplars, rather than limitations on the apparatus and methods described.
Description of Apparatus
FIG. 1 is a block diagram of an environment 100 in which memory access optimization and data communication statistics computation may be implemented. The environment 100 includes network testing system 110 coupled via a network card 120 to a network 140 over a communications medium 144. The network testing system 110 may include or be one or more of a performance analyzer, a conformance validation system, a network analyzer, a packet blaster, a network management system, a combination of these, and/or others. The network testing system may be used to evaluate and/or measure characteristics and performance of a communication line or system, including the throughput of network traffic, the number of dropped packets, jitter, and many others. Such testing may be used to evaluate the Mean Opinion Score (MOS) of voice transmission over a network or portion thereof. The network testing system 110 may be used to evaluate the performance of servers; network capable devices such as, for example, computers, personal digital assistants (PDAs), cellular phones, analog telephones, digital telephones, and voice over Internet protocol (VOIP) telephones; networking devices such as, for example, routers, gateways, hubs, load balancers, universal threat management devices (UTMs), firewalls, load sharers, and others; as well as network applications and other software.
The network testing system 110 may be in the form of a chassis or card rack, as shown in FIG. 1, or may be an integrated unit. Alternatively, the network testing system may comprise a number of separate units such as two or more chassis cooperating to provide network analysis, network conformance testing, network capable device testing, networking device testing, network application testing, and other tasks. The chassis of the network testing system 110 may include one or more network cards 120 and a back plane 112. The network cards 120 may be coupled with back plane 112. One or more network cards 120 may be included in network testing system 110. The network cards 120 may be permanently installed in the network testing system 110, may be removable, or may be a combination thereof.
The network testing system 110 and/or one or more of the network cards 120 may include an operating system such as, for example, versions of Linux, Unix and Microsoft Windows.
Network card 120 may be coupled with network 140 via a communications medium 144. Although only one connection over communications medium 144 is shown, each of the network cards 120 may be connected with network 140 over a communications medium. Although only one connection between network card 120 and network 140 over communications medium 144 is shown, the network card 120 may be have two or more connections with network 140 over a communications medium. The communications medium may be, for example, wire lines such as an Ethernet cable, fibre optic cable, and coaxial cable, and may be wireless.
The network testing system 110 and the network cards 120 may support one or more well known higher level communications standards or protocols such as, for example, one or more versions of the User Datagram Protocol (UDP), Transmission Control Protocol (TCP), Real-Time Transport Protocol (RTP), Internet Protocol (IP), Internet Control Message Protocol (ICMP), Internet Group Management Protocol (IGMP), Session Initiation Protocol (SIP), Hypertext Transfer Protocol (HTTP), address resolution protocol (ARP), reverse address resolution protocol (RARP), file transfer protocol (FTP), Simple Mail Transfer Protocol (SMTP); may support one or more well known lower level communications standards or protocols such as, for example, the 10, 40 and/or 100 Gigabit Ethernet standards, the Fibre Channel standards, one or more varieties of the IEEE 802 Ethernet standards, Asynchronous Transfer Mode (ATM), X.25, Integrated Services Digital Network (ISDN), token ring, frame relay, Point to Point Protocol (PPP), Fiber Distributed Data Interface (FDDI), Universal Serial Bus (USB), IEEE 1394 (also known as i.link® and Firewire®); may support proprietary protocols; and may support other protocols. Each network card 120 may support a single communications protocol, may support a number of related protocols, or may support a number or combination of unrelated protocols.
The term “network card” as used herein encompasses line cards, test cards, analysis cards, network line cards, load modules, interface cards, network interface cards, data interface cards, packet engine cards, service cards, smart cards, switch cards, relay access cards, CPU cards, port cards, and others. The network cards 120 may be referred to as blades, particularly when a processor is included on the network card. The network cards 120 may include one or more processors 124, memory 126, and one or more network communications units 128.
The network communications unit 128 may be implemented as one or more field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), programmable logic devices (PLDs), programmable logic arrays (PLAs), other kinds of devices, and combinations of these. The network communications unit 128 may support one or more communications protocols in hardware. The network communications unit 128 may include a network interface through which the network card 120 may transmit and/or receive communications over the network 140. The network communications unit 128 may be a network interface card (NIC).
The back plane 112 may serve as a bus or communications medium for the network cards 120. The back plane 112 may also provide power to the network cards 120.
The network testing system 110 may have a computer 100 coupled thereto. The computer 100 may be local to or remote from the network testing system 110. In another embodiment, the network testing system 110 may include a CPU on a card, motherboard or backplane that allows the chassis to also serve as a computer workstation. The network testing system 110 may have coupled therewith a display 118 and user input devices such as a keyboard 114 and a mouse 116, as well as other user input devices including, for example, pens and trackballs. The user input devices may be coupled to a network card, other card, motherboard, or backplane included in the chassis.
The network testing system 110 may be implemented in a computer such as a personal computer, server, or workstation, as well as the chassis shown. The network testing system 110 may be used alone or in conjunction with one or more other network testing systems 110. The network testing system 110 may be located physically adjacent to and/or remote to the devices 130 in the network 140. The network testing system 110 may be used to test and evaluate the network 140 and/or portions thereof, devices 130, applications or other software running on devices 130, and/or services provided by network 140 and/or devices 130.
The network 140 may be a local area network (LAN), a wide area network (WAN), a storage area network (SAN), or a combination of these. The network 140 may be wired, wireless, or a combination of these. The network 140 may include or be the Internet. The network 140 may be public or private, may be a segregated test network, and may be a combination of these. The network 140 may be comprised of a single or numerous nodes providing numerous physical and logical paths for data units to travel. The network 140 may be a packet switched network, a data network, or a combination thereof.
Communications on the network 140 may take various forms, including frames, cells, datagrams, packets, higher level logical groupings of data, or other units of information, all of which are referred to herein as data units. Those data units that are communicated over a network are referred to herein as network traffic. The network traffic may include data units that represent electronic mail messages, computer files, web pages, graphics, documents, audio and video files, streaming media such as music (audio) and video, telephone (voice) conversations, and others. The network traffic may also be referred to as communications and network communications.
The devices 130 may be devices capable of communicating over the network 140 and/or listening to, injecting, delaying, dropping, and/or modifying network traffic on network 140. The devices 130 may be network capable devices such as computer workstations, personal computers, servers, portable computers, set-top boxes, video game systems, personal video recorders, telephones (cellular, digital, VOIP), personal digital assistants (PDAs), computing tablets, and the like; peripheral devices such as printers, scanners, facsimile machines and the like; network capable storage devices including disk drives such as network attached storage (NAS) and SAN devices; network testing equipment such as analyzing devices, network conformance systems, emulation systems, network monitoring devices, and network traffic generators; and networking devices such as routers, relays, firewalls, hubs, UTMs, switches, bridges, traffic accelerators, and multiplexers. One or more of the devices 130 may be devices to be tested and may be referred to as devices under test.
FIG. 2A is a block diagram of a first network card 200, and FIG. 2B is a block diagram of a second network card 204. The network cards 200 and 204 may include hardware, software, firmware, and/or a combination thereof. The network cards 200 and 204 each may include may include a processor 210, a network communications unit 220, a backplane connector 202, and a communications connector 240. In the network card 200, the processor 210 may be coupled with a memory unit 212 and the network communications unit 220. The network card 204 may include a statistics engine 230. The statistics engine 230 may be implemented on or as an FPGA, and may also be implemented on or as an ASIC, PLD or other hardware device. The statistics engine 230 may be coupled with the network communications unit 220 and the memory 232, and the processor 210 may also be coupled with the memory 232. The statistics engine 230 may also be coupled with or include a second memory and/or a cache memory, not shown in FIG. 2B.
The network cards 200 and 204 may have two or more network communications units 220 and a corresponding number of communications connectors 240. The network card 200 may also have two or more memory units 212 and/or two or more processors 210 included thereon. The network cards 200 and 204 may include an operating system or a real-time operating system. In one embodiment of network card 200, the memory unit 212 is coupled with both the processor 210 and the network communications unit 220. In one embodiment of network card 204, the memory unit 232 is also coupled with the network communications unit 220. The backplane connector 202 may allow the network cards 200 and 204 to be coupled with a network testing system such as networking testing system 110.
The network card 204 may include two or more statistics engines 230 and a corresponding number of memories 232. When the network card 204 includes two or more statistics engines 230, the network communications unit 220 may distribute incoming data units between the statistics engines 230 such that some data units are processed by each of the statistics engines 230. For example, the network communications unit 220 may distribute incoming data units to two or more statistics engines 230 in round-robin fashion. The network communications unit 220 may consider the lengths of the individual data units and distribute incoming data units to two or more statistics engines 230 such that approximately the same total number of bytes are sent to each statistics engine 230. The network communications unit 220 may distribute incoming data units to two or more statistics engines 230 in some other manner.
In network cards 200 and 204, the processor 210 may be a multipurpose processor, such as, for example, a PowerPC processor available from IBM, Inc., and may be a specialized processor. The processor 210 may include an internal cache memory and an arithmetic logic unit or other logic unit. The processor 210 may be capable of executing instructions which may be located in a local memory, other storage medium, or other local or remote storage device.
The memory 212 and 232 may be dynamic random access memory (DRAM). In one embodiment, the memory 212 and 232 are each a 512 Mbyte DRAM having 2 Kbytes per row. An example embodiment of memory 212 and 232 is discussed in more detail below regarding FIG. 3.
The network cards 200 and 204 may include and/or have access to local and/or remote memory, storage media and storage devices. Instructions to be executed by the processor may be stored on and executed from a local or remote machine readable medium or storage device. A machine readable medium includes, for example, without limitation, magnetic media (e.g., hard disks, tape, floppy disks), optical media (e.g., CD, DVD), flash memory products (e.g., memory stick, compact flash and others), and volatile and non-volatile silicon memory products (e.g., random access memory (RAM), programmable read-only memory (PROM), electronically erasable programmable read-only memory (EEPROM), and others). A storage device is a device that allows for the reading from and/or writing to a machine readable medium. Storage devices include hard disk drives, DVD drives, flash memory devices, and others.
The network communications unit 220 may include one or more circuits, chips, logic, firmware and/or instructions that allow for communication over a network according to the optimized data unit communications techniques described herein. The network communications unit 220 may be implemented as one or more FPGAs. The network communications unit 220 may also be implemented or included on one or more ASICs, silicon devices, integrated circuits, specialized processors such as a network processor, or other devices. The network communications unit 220 may be coupled with the communications connector 240.
The network communications unit 220 may be coupled with a communications medium 250 via the communications connector 240. The communications medium 250 may be a wire such as Ethernet cabling, coaxial cable, fibre optic cable, and others, and may be wireless.
Additional and fewer units, hardware and firmware may be included in the network cards 200 and 204 to achieve the techniques described herein.
In one embodiment, the methods described herein are achieved by software executing on processor 210 of network card 200. In another embodiment, the methods described herein are performed by the statistics engine 230 of network card 204. The method describe herein may be performed in the hardware of statistic engine 230 or by executing software in the form of code or instructions stored on or as statistics engine 230, or by some combination of hardware and software.
FIG. 3 is a block diagram of a memory 300 and the contents thereof. Memory 300 is an embodiment of the memory 126, the memory 212 and the memory 232 of FIGS. 1, 2A and 2B. The memory 300 may be a DRAM having a size of 512 Mbyte and having 2 Kbytes per row. The DRAM may be a dual in-line memory module (DIMM) or a small outline (SO) DIMM. When network testing systems acquire, prepare and report summaries of information about network traffic, various data about the network traffic may be maintained. When data units are received and/or sent, information about the data units may be stored in a queue. This information is referred to herein as data unit information. The data unit information stored may include: data unit size, data unit type, sequence number, socket, stream, port, protocol, send and/or receive timestamps, source address, destination address, error code (if any), payload type, and others.
The data unit information may be used to prepare and provide summaries or reports concerning the network traffic. The summaries and reports may include, for example, one or more of the following network traffic statistics: byte count, data unit count (for example, number of packets received and/or sent); minimum data unit latency; maximum data unit latency; average data unit latency; number of errors; kinds of errors; oldest, first or earliest timestamp; most recent, last or latest timestamp; and others. For the purpose of reporting network traffic data, the data units may be organized into flows, where a “flow” is any plurality of data units for which network traffic statistics are accumulated and reported. The data units in a given flow may be distinguished by a flow identifier contained in each data unit. The flow identifier may be, for example, an address, a port number, a tag, or some other field or combination of fields within each data unit.
To improve the access to network traffic statistics for use in network traffic summaries and reports, and/or to provide near real-time network traffic summaries or reports, versions of partial network traffic statistics for each flow may be stored iteratively in a round robin fashion in four banks of the memory 300. Each version of the partial network traffic statistics is different because it is based on different data unit information from different data units. In the example shown in FIG. 3, four different versions of partial network traffic statistics for flow A are stored in row 0, slot 0 of banks 1, 2, 3 and 4. To prepare network traffic statistics for flow A, the four partial network traffic statistics data in each of banks zero through three must be added, analyzed or otherwise processed. Similarly, a version of the partial network traffic statistics for flow Q may be stored as shown in FIG. 3 in row 2, slot 2. In one embodiment each slot is a record that is 64 bytes of data. That is, each set of partial network traffic statistics may be 64 bytes. In various embodiments, the size of the record in memory and the size of each set of the partial network traffic statistics, as well as the size of the full network traffic statistics, may be 32, 64, 48, 128, 178, 256, etc. bytes. It is contemplated that the methods described herein may work with other numbers of memory banks, such as, for example, 8, 10, 12, 16 and others.
Description of Processes
FIG. 4 is a flow chart of a method of communications statistics computation. A network card, the statistics engine running in an FPGA or other PLD included in a network card, or software running on a processor or in computing device may perform this method. An incoming data unit is received, as shown in block 410. Information about the data unit may be placed in a queue for later or immediate processing, as shown in block 420. Stored network traffic statistics are read or retrieved from memory, as shown in block 430. Network traffic statistics may then be computed and/or updated based on the data units in the queue, as shown in block 440. The network traffic statistics that are computed and/or updated may pertain to a particular flow of data units, all data units, and/or a particular class or type of data units. Some individual network traffic statistics may be computed/updated by, for example, simple adding, such as, for example, the total number of bytes received (sometimes referred to as byte count), the total number of data units received (sometimes referred to a packet count), and others. Other individual network traffic statistics may be computed/updated by performing some simple analysis, such as, for example, determining the earliest or latest timestamp which requires a simple comparison of the timestamp in the current data unit with the stored earliest/latest timestamp in the network traffic statistics. The computed and/or updated network traffic statistics are stored, such as by writing them to memory, as shown in block 450.
However, when performing the method described regarding FIG. 4, the updating and computing of the network traffic statistics may be delayed and may be inefficient due to memory access characteristics typically referred to as latency. When the actions described in FIG. 4 are performed in order, memory latency causes a delay in the preparation of network traffic statistics due to the delay incurred in writing network traffic statistics to memory, as shown in block 450. The delay is caused by memory writing overhead, namely the time and clock cycles it takes to read or write to and close a row of the memory. What may occur is that incoming data units may be added to the queue at network speed, also known as, in one embodiment, wire line speed. Even when the computation of network traffic statistics is very fast and efficient (that is, taking a limited amount of time and computation cycles), before the network traffic statistics are updated based on the next data unit, the currently processed network traffic statistics are stored to memory. As such, the computing of updated network traffic statistics for the next data unit must wait until the network traffic statistics based on the current data unit are stored. This delay is caused by memory latency. As such, there is a delay in preparing and reporting network traffic statistics caused memory access latency, and, in particular, overhead in the form of the time and clock cycles it takes to close the memory.
To alleviate or reduce the impact of the latency inherent in writing to memory, and in particular writing to DRAM, versions of partial network statistics may be accessed (that is read and written) in a pipelined manner. To reduce or eliminate the impact of the amount of time and clock cycles it takes to open and close a bank of memory, partial network traffic statistics may be stored in memory 300 as described above regarding FIG. 3 so that the memory 300 may be accessed in a pipelined round robin manner as shown in and described regarding FIG. 5.
FIG. 5 is a flow chart of a method of memory access optimization and communications statistics computation. The communications statistics may also be referred to as network traffic statistics as described above. A network card, the statistics engine running in an FPGA or other PLD included in a network card, or software running on a processor or in computing device may perform this method. This method may be implemented with a memory 300 like that shown in FIG. 3 and described above. A current memory bank is set to be the first memory bank of the memory, as shown in block 500. This would be, for example, bank 0 shown in FIG. 3. The flow of actions may continue based on whether a queue of incoming data unit information is empty, as shown in block 510. If the queue of incoming data unit information is empty, after a short wait or delay, as shown in block 514, the queue may be checked again, as shown in block 510.
If the queue of incoming data unit information is not empty, as shown in block 510, the flow of actions may continue at block 512. Incoming data unit information may be read from the queue, as shown in block 512. The current memory bank may be activated, as shown in block 520. Partial network traffic statistics may be read from a memory location in the current memory bank, as shown in block 522. In one embodiment, a memory read includes memory bank activation so that blocks 520 and 522 may be combined, or block 520 may not be needed. The partial network traffic statistics may be computed and/or updated based on the data unit information, as shown in block 524. The computed/updated partial network traffic statistics may be written or stored to the memory at a location in the current bank, as shown in block 526. The memory bank may be closed, as shown in block 528. In one embodiment, a memory write includes memory bank closing, so that blocks 526 and 528 may be combined, or block 528 may not be needed.
The flow of actions may continue based on whether the current memory bank is the last memory bank, as shown in block 530. In one embodiment, there are four memory banks and bank 3 is the last memory bank, as shown in memory 300 of FIG. 3. When the current memory bank is the last memory bank, the flow of actions may continue at block 500.
When the current memory bank is not the last memory bank, the flow of actions may continue at block 532, where the current memory bank may be set to be the next memory bank. The flow of actions may continue at block 512.
As shown in FIG. 5, reads from and writes to each memory bank may proceed in sequence. However, each of the steps need not be completed before for the next step proceeds. Importantly, the memory writes need not be completed on the current memory bank before memory reads for the next memory bank are processed. As such, processing of data unit information as shown in blocks 512, 520, 522, and 524 for a current memory bank may proceed concurrently with the writing of the updated partial network traffic statistics based on the previous data unit information and the closing of the previous memory bank as shown in blocks 526 and 528. By allowing reading and processing of current data unit information with partial network statistics from one memory bank while concurrently writing partial network statistics to another memory bank based on prior data unit information in a round robin pipelined fashion reduces or alleviates the delay in preparing network statistics caused by memory latency.
FIG. 6 is a flow chart of a method of preparing communications statistics. The communications statistics may also be referred to as network traffic statistics as described above. A network card, the statistics engine running in an FPGA or other PLD included in a network card, or software running on a processor or in computing device may perform this method. This method may be implemented with a memory 300 like that shown in FIG. 3 and described above.
A request for full network statistics may be received, as shown in block 600. The requested full network traffic statistics may pertain to a particular flow or to a plurality of flows. The requestor may be a software program running on a network testing system. The request may be user initiated or automatically generated. An automatically generated request may be made every 1, 5, 10, 12, 20, 30, 44, etc. seconds, every 1, 2, 6, 8, 12, etc. minutes, every hour, every few hours, etc. An automatically generated request may be user configurable or may be system defined. An automatically generated request may be achieved using a daemon or other software process, utility, construct, etc.
A current memory bank may be set to be the first memory bank of the memory, as shown in block 602. This would be, for example, bank 0 shown in FIG. 3. The current memory bank may be activated, as shown in block 610. Partial network traffic statistics may be read from the current memory bank, as shown in block 612. In one embodiment, a memory read includes memory bank activation so that blocks 610 and 612 may be combined, or block 610 may not be needed.
Full network traffic statistics may be updated and/or computed based on the partial network traffic statistics read from the current memory bank, as shown in block 614. In one embodiment, according to the example shown in FIG. 3, when the are four memory banks, four sets of partial network statistics are computed by adding or otherwise processing each version of the four sets of partial network statistics. To prepare the full network traffic statistics, some individual network traffic statistics may be computed/updated by, for example, simple adding, such as, for example, the total number of bytes received (sometimes referred to as byte count), the total number of data units received (sometimes referred to a packet count), and others. Other individual network traffic statistics may be computed/updated by performing simple analysis, such as, for example, determining the earliest or latest timestamp which requires a simple comparison of the timestamp in the partial network statistics with the earliest/latest timestamp. The current memory bank may be closed, as shown in block 616. In one embodiment, a memory write includes memory bank closing, so that blocks 614 and 616 may be combined, or block 616 may not be needed.
The flow of actions may continue based on whether the current memory bank is the last memory bank, as shown in block 620. In one embodiment, the last memory bank check may be a check to learn whether the current memory bank is the fourth of four memory banks, such as when the memory 300 from FIG. 3 is used. When the current memory bank is not the last memory bank, the flow of actions may continue at block 622, where the current memory is set to be the next memory bank. The flow of actions may continue at block 610 as described above. When the current memory bank is the last memory bank, the flow of actions may continue at block 624, where full network statistics are provided to the requester.
When a network card, such as the network card 204 of FIG. 2, includes two or more statistics engine and a corresponding number of memories, the process of FIG. 6 may be performed by or for each statistics engine to prepare the full network statistics for each statistic engine and corresponding memory. The full network statistics from each statistics engine may then be further combined. The techniques used to combine the full network statistics from two or more statistics engines may be similar to the techniques used at 614 to prepare the full network traffic statistics. For example, to combine full network statistics from two or more statistics engines, some individual network traffic statistics may be computed/updated by simple adding, such as the total number of bytes received (sometimes referred to as byte count), the total number of data units received (sometimes referred to a packet count), and others. Other individual network traffic statistics may be computed/updated by performing simple analysis, such as, for example, determining the earliest or latest timestamp which requires a simple comparison of the timestamp in the partial network statistics with the earliest/latest timestamp. The combined full networks statistics may then be provided to a requestor.
The memories used to store partial network statistics may be dynamic random-access memory (DRAM) devices. DRAM devices commonly use a single bidirectional I/O bus to communicate both data read from the memory and data to be written into the memory. In some circumstances, the time required to reverse the direction of the memory I/O bus may limit the speed at which partial traffic statistics can be written into the memory.
FIG. 7 is a flow chart of a process 700 for optimizing memory access by sequentially reading partial network statistics for a plurality of data units and then sequentially writing updated partial networks statistics for the plurality of data units. In this manner, the direction of the memory I/O bus is reversed once after the plurality of partial network statistics are read and again after the plurality of updated partial network statistics are written.
The process 700 may be performed by a statistics engine, such as the statistics engine 230, and a memory organized into banks like the memory 300 shown in FIG. 3 and described above.
The process 700 may start at 702. At 704 data unit information may be accumulated in a queue or cache memory. In an embodiment, the process 700 may loop between 706 and 704 until data unit information for N data units are available in the queue, where N is an integer greater than 1. N may be equal to or an integer multiple of the number of banks of a memory used to store partial network statistics. When data unit information for N data units is accumulated in the queue, the process 700 may proceed to actions 708-716 for the N data units while data unit information for additional data units may be accumulated in the queue. In another embodiment, the process 700 may not loop to wait for N data units, but may proceed to actions 708-716 as soon as data unit information for a first data unit is available.
Although the actions 708-716 will be described as sequential steps, the actions 708-716 may be performed as a pipeline, where each action proceeds as soon as partial results from the previous action are available.
At 708, the data unit information for the N data units may be acquired. At 710, partial network statistics may be read from the banks of the memory in round-robin fashion. For example, partial networks statistics for a first data unit may be read from a first bank of the memory, partial networks statistics for a second data unit may be read from a second bank of the memory, and so on until partial network statistics for all N data units have been read from the memory. When N is equal to the number of banks of the memory, partial network statistics for one data unit may be read from each bank of the memory.
When N is an integer multiple of the number of banks of the memory, partial network statistics for multiple data units may be read from each bank of the memory. For example where N is equal to 8 and the memory includes four banks, partial network statistics for the 8 data units may be read in round robin fashion, making two rounds of the memory banks. If N is equal to 24 and the memory includes 8 banks, partial network statistics for the 24 data units may be read in round robin fashion, making three rounds of the memory banks.
At 712, the partial network statistics read from the memory may be updated, as previously described, based on the data unit information for the corresponding data unit.
When partial network statistics for multiple data units are read from each memory bank (when N is a multiple of the number of memory banks), an error can occur if partial network statistics for two or more data units in the same flow are read from the same memory bank. For example, assume that the memory has four banks, N is equal to eight, and that the first and fifth data units in the queue belong to flow A. In this example partial traffic statistics for flow A will be read from the first memory bank and updated based on the data unit information for the first data unit. Subsequently, the exact same partial traffic statistics for flow A (since the updated partial traffic statistics have not yet been written to the memory) will be read from the first memory bank and updated based on the data unit information for the fifth data unit. At this point, the updated traffic statistics for flow A based on the data unit information for the fifth data unit will be incorrect, since the contribution of the first data unit is not included.
To avoid this problem, at 714, situations where partial traffic statistics for a flow were read more than once from the same memory bank may be detected. The updated traffic statistics for the flow may then be corrected appropriately. Continuing the previous example, assume partial traffic statistics for a first data unit and a fifth data unit have been read from a first memory bank, and the first and fifth data units are determined to belong to the same flow. The partial network statistics read in conjunction with first data unit may be updated based on the data unit information for the first data unit. The partial network statistics read for the fifth data unit may be replaced by the updated partial network statistics resulting from the first data unit. The updated partial network statistics may be up updated again based on the data unit information for the fifth data unit. The twice-updated partial network statistics may then be written, in turn, to the first memory bank.
At 716, the updated partial traffic statistics corresponding to each of the N data units may be written back to the same memory locations where the partial traffic statistics were read at 710. When the actions from 708 to 716 are performed as a pipeline, the updated partial network statistics for the first data unit may be written immediately after the partial traffic statistics for the Nth data unit has been read. In this context, “immediately after” means “as soon as possible allowing for the time required to reverse the direction of the memory I/O bus”.
FIG. 8 is a flow chart of a process 800 for optimizing memory access by sequentially reading partial network statistics for a plurality of data units and then sequentially writing updated partial networks statistics for the plurality of data units. The process 800 is similar to the process 700 except that the actions in the process 800 are performed in a pipelined manner on a fixed schedule. Each of the actions 808-816 is repeated N times in N consecutive time intervals. Each time interval may be, for example a clock period or a plurality of clock periods. In the example of FIG. 8, each of the actions 808-816 is shown divided into 8 intervals. The number of intervals N may be fewer or more than eight.
At 808, data unit information for up to N data units may be acquired. In each of N intervals within 808, an attempt may be made to acquire data unit information from, for example, a queue or a data unit receiver. At each attempt, data unit information may be acquired if available or may not be acquired if not available.
At 810, partial network statistics may be read from the banks of the memory in round-robin fashion. For example, partial networks statistics for a first data unit may be read from a first bank of the memory, partial networks statistics for a second data unit may be read from a second bank of the memory, and so on until partial network statistics for up to N data units have been read from the memory. When N is equal to the number of banks of the memory, partial network statistics for one data unit may be read from each bank of the memory. When N is an integer multiple of the number of banks of the memory, partial network statistics for multiple data units may be read from each bank of the memory.
In situations where data unit information was not acquired in one or more time intervals at 808, the corresponding memory read operations and the associated memory banks may be skipped at 810.
At 812, the partial network statistics read from the memory may be updated, as previously described, based on the data unit information for the corresponding data unit. In situations where data unit information was not acquired in one or more time intervals at 808 and partial network statistics were not read in the corresponding intervals at 810, the corresponding intervals in 812 may be idle.
At 814, situations where partial traffic statistics for a flow have been read more than once from the same memory bank may be detected and corrected, as previously described in conjunction with FIG. 7.
At 816, the updated partial traffic statistics may be written back to the same memory locations where the partial traffic statistics were read at 810. The first updated partial network statistic (assuming that data unit information was acquired during the first attempt at 810) may be written after the partial traffic statistics for the Nth data unit has been read. The schedule for the process 800 may provide time periods 822, 824 between memory read cycles and memory write cycles to allow a direction of a memory I/O bus to be reversed.
At 818, a determination may be made if a request for full network statistics is pending. If full network statistics have not been requested, the process 800 may repeat from 808. If full network statistics have been requested, a full statistics reporting process, such as the process of FIG. 5, may be performed at 820 before the process 800 is repeated from 808.
The process 800 may be performed by a single statistics engine, such as the statistics engine 230. When a network card, such as the network card 204, contains plural statistics engines, the plural statistics engines may each perform the process 800 in synchronism with the other statistics engines.
With regard to FIGS. 4, 5, 6, 7, and 8, additional and fewer steps may be taken, and the steps as shown may be combined or further refined to achieve the methods described herein.
CLOSING COMMENTS
As used herein, “plurality” means two or more.
As used herein, a “set” of items may include one or more of such items.
As used herein, whether in the written description or the claims, the terms “comprising”, “including”, “carrying”, “having”, “containing”, “involving”, and the like are to be understood to be open-ended, i.e., to mean including but not limited to. Only the transitional phrases “consisting of” and “consisting essentially of”, respectively, are closed or semi-closed transitional phrases with respect to claims.
Use of ordinal terms such as “first”, “second”, “third”, etc., in the claims to modify a claim element does not by itself connote any priority, precedence, or order of one claim element over another or the temporal order in which acts of a method are performed, but are used merely as labels to distinguish one claim element having a certain name from another element having a same name (but for use of the ordinal term) to distinguish the claim elements.
As used herein, “and/or” means that the listed items are alternatives, but the alternatives also include any combination of the listed items.
Although exemplary embodiments have been shown and described, it will be apparent to those having ordinary skill in the art that a number of changes, modifications, or alterations as described herein may be made. All such changes, modifications and alterations should therefore be seen as within the scope of below claims.

## Claims

1. A method comprising:
acquiring data unit information for N data units, wherein N is an integer
reading partial network statistics for the N data units sequentially in round robin fashion from each of M memory banks of a memory, wherein M is an integer equal to two or more and N/M is an integer equal to two or more
updating the partial networks statistics based on the data unit information
writing the updated partial network statistics sequentially in round robin fashion to each of the M memory banks
in the event that partial network statistics for two or more data units in a single flow are read from the same memory bank of the M memory banks, correcting the corresponding updated partial network statistics prior to writing the updated partial network statistics.

2. The method of claim 1, wherein acquiring data unit information, reading partial network statistics, updating the partial networks statistics, and writing the updated partial network statistics are performed in a pipelined manner.

3. The method of claim 2, wherein the updated partial network statistics for a first data unit of the N data units are written immediately after the partial network statistics for a last data unit of the N data units has have been read.

4. The method of claim 1 wherein the method further comprises:
receiving a request for full network traffic statistics from a requestor;
preparing the full network traffic statistics including
retrieving each version of the partial network traffic statistics,
adding some individual statistics of each of the partial network statistics, and
processing some individual statistics of the partial network statistics;

providing the full network traffic statistics to the requestor.

5. The method of claim 1 wherein the partial network statistics include at least one of a byte count, a data unit count, a most recent timestamp, an oldest timestamp, a number of errors, a maximum data unit size, and a minimum data unit size.

6. A network testing system configured to perform the method recited in claim 1.

7. An apparatus, comprising:
a processor;
a memory having a plurality of banks;
a statistics engine coupled with the processor and the memory, the statistics engine configured to perform actions including:
acquiring data unit information for N data units, wherein N is an integer
reading partial network statistics for the N data units sequentially in round robin fashion from each of M memory banks of a memory, wherein M is an integer equal to 2 or more and N/M is an integer equal to two or more
updating the partial network statistics based on the data unit information
writing the updated partial network statistics sequentially in round robin fashion to each of the M memory banks
in the event that partial network statistics for two or more data units in a single flow are read from the same memory bank of the M memory banks, correcting the corresponding updated partial network statistics prior to writing the updated partial network statistics.

8. The apparatus of claim 7, wherein the actions reading partial network statistics, updating the partial networks statistics, and writing the updated partial network statistics are performed in a pipelined manner.

9. The apparatus of claim 8, wherein the updated partial network statistics for a first data unit of the N data units is written immediately after the partial network statistics for a last data unit of the N data units has been read.

10. The apparatus of claim 7, the actions performed further including:
receiving a request for full network traffic statistics from a requestor;
preparing the full network traffic statistics including
retrieving each version of the partial network traffic statistics,
adding some individual statistics of each of the partial network statistics, and
processing some individual statistics of the partial network statistics;

providing the full network traffic statistics to the requestor.

11. The apparatus of claim 7, wherein the partial network statistics include at least one of a byte count, a data unit count, a most recent timestamp, an oldest timestamp, a number of errors, a maximum data unit size, and a minimum data unit size.

12. A network testing system including at least one network card including the apparatus recited in claim 7.

13. An apparatus, comprising:
a processor;
a plurality of statistics engines, each of the plurality of statistics engines coupled to a corresponding one of a plurality of memories;
wherein each of the plurality of memories has M banks, where M is an integer equal to two or more
wherein each of the plurality of statistics engines is coupled with the processor, and
wherein each of the plurality of statistics engines is configured to perform actions including:
acquiring data unit information for N data units, wherein N is an integer multiple of M and N/M is two or more;
reading partial network statistics for the N data units sequentially in round robin fashion from the M banks of the corresponding memory;
updating the partial networks statistics based on the data unit information; and
writing the updated partial network statistics sequentially in round robin fashion to each of the M memory banks of the corresponding memory,
wherein, in the event that partial network statistics for two or more data units in a single flow are read from the same memory bank of the M memory banks, the actions performed further include correcting the corresponding updated partial network statistics prior to writing the updated partial network statistics.

14. The apparatus of claim 13, wherein the plurality of statistics engines perform the actions synchronously.