# US 2013/0212296 A1 · Flow cache mechanism for performing packet flow lookups in a network device

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2013/0212296 A1
- Document ID: US20130212296A1
- Status: Published application
- Kind: A1
- Application number: 13/372,014
- Filed: 2012-02-13
- Published: 2013-08-15
- Earliest claimed: 2012-02-13
- Assignees: Juniper Networks, Inc.
- Inventors: Deepak Goel; John Keen; Venkatasubramanian Swaminathan
- Web page: https://patentgrep.com/patent/US20130212296A1

## CPC

- H04L 45/748: using longest matching prefix
- H04L 45/742: {Route cache; Operation thereof}
- H04L 45/7453: using hashing
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

An example network device includes a network interface configured to receive a packet of a packet flow, wherein the packet flow is one of a plurality of packet flows processed by the network device, a flow cache configured to receive a lookup key associated with the packet flow, and a Bloom filter configured to process the lookup key. The flow cache is further configured to store information about a portion of the plurality of packet flows processed by the network device, and determine whether to store information about the packet flow by at least applying a selection criterion to processing of the lookup key by the Bloom filter. The flow cache is configured to determine whether the lookup key is stored in the flow cache, and, when the lookup key is stored in the flow cache, retrieve a stored result associated with the lookup key and output the stored result.

## Claims

### Claim 1

A method comprising:
receiving, with a flow cache of a network device, a lookup key associated with a packet flow, wherein the packet flow is one of a plurality of packet flows processed by the network device, wherein the flow cache stores information about a portion of the plurality of packet flows processed by the network device, and wherein the flow cache determines whether to store information about the packet flow by at least applying a selection criterion to processing of the lookup key by a Bloom filter of the network device;
determining, with the flow cache, whether the lookup key is stored in the flow cache; and
when the lookup key is stored in the flow cache:
retrieving, with the flow cache, a stored result associated with the lookup key; and
outputting the stored result.

### Claim 2 (depends on 1)

The method of claim 1, further comprising, when the lookup key is not stored in the flow cache:
receiving, with a prefix lookup module of the network device, the lookup key;
generating, with the prefix lookup module, a set of prefixes based on the lookup key;
processing, with the Bloom filter, each prefix of the set of prefixes to identify a portion of the set of prefixes to use in searching a hash table of the network device;
searching, with a controller of the network device, the hash table using one or more of the identified portion of the set of prefixes;
receiving, with the controller, a result of the search from the hash table; and
determining, with a flow cache of the network device, whether to store the lookup key and the result in the flow cache by at least applying the selection criteria to one or more of the processing of each prefix and the searching of the hash table.

### Claim 3 (depends on 2)

The method of claim 2, further comprising:
sending, from the prefix lookup module to the Bloom filter, the set of prefixes for processing with the Bloom filter;
initializing, with the controller, a clock cycle counter to a value;
incrementing, with the controller, the value of the clock cycle counter for each clock cycle that elapses until the controller receives the result from the search;
determining, with the flow cache, whether the value of the clock cycle counter exceeds a threshold value; and
storing, with the flow cache, the lookup key and the result when the value of the clock cycle counter exceeds the threshold value.

### Claim 4 (depends on 3)

The method of claim 3, wherein storing the lookup key and the result comprising:
applying a hash function to the lookup key in order to identify a location within the flow cache, wherein the location includes a plurality of cells, and wherein each of the plurality of cells is configured to store a respective lookup key and result pair;
determining whether all of the plurality of cells of the location currently store previous lookup key and result pairs;
when all of the plurality of cells currently store previous lookup key and result pairs, selecting one of the plurality of cells to store the lookup key and the result; and
overwriting the selected one of the plurality of cells with the lookup key and the result.

### Claim 5 (depends on 4)

The method of claim 4, wherein selecting one of the plurality of cells to store the lookup key and the result comprises:
generating a random number; and
selecting the one of the plurality of cells based on the generated random number.

### Claim 6 (depends on 4)

The method of claim 4, wherein selecting one of the plurality of cells to store the lookup key and the result comprises:
retrieving session information for each of the plurality of cells;
determining which cell of the plurality of cells was least recently used based on the session information for each respective cell of the plurality of cells; and
selecting the one of the plurality of cells based on which cell was least recently used.

### Claim 7 (depends on 2)

The method of claim 2, wherein searching the hash table further comprises:
initializing, with the controller, a lookup counter to a value;
selecting, with the controller, a first prefix of the identified portion of the set of prefixes;
searching, with the controller, the hash table based on the first prefix;
receiving a first result of the search of the first prefix; and
when the first result indicates that a match was found in the hash table, sending, from the controller and to the flow cache, the lookup key, the first result, and the value of the lookup counter.

### Claim 8 (depends on 7)

The method of claim 7, further comprising:
comparing, with the flow cache, the value of the lookup counter to a threshold value;
when the value of the lookup counter is greater than the threshold value, storing, with the flow cache, the lookup key and the first result; and
when the value of the lookup counter is not greater than the threshold value, determining, with the flow cache, not to store the lookup key and the first result in the flow cache.

### Claim 9 (depends on 7)

The method of claim 7, further comprising, when the first result indicates that a match was not found in the hash table:
incrementing the value of the lookup counter;
selecting a second prefix of the identified portion of the set of prefixes, wherein the second prefix is different from the first prefix;
searching, with the controller, the hash table based on the second prefix;
receiving a second result of the search of the second prefix; and
when the second result indicates that a match was found in the hash table, sending, from the controller and to the flow cache, the lookup key, the second result, and the value of the lookup counter.

### Claim 10 (depends on 1)

The method of claim 1, wherein determining whether the lookup key is stored in the flow cache comprises:
applying, with the flow cache, a hash function to the lookup key to generate a hash result;
identifying a location within a hash table of the flow cache based on the hash result; and
retrieving a value stored at the identified location,
wherein the flow cache determines that the lookup key is stored in the flow cache when the value stored at the identified location matches the value of the lookup key, and
wherein the flow cache determines that the lookup key is not stored in the flow cache when the value stored at the identified location does not match the value of the lookup key.

### Claim 11

A network device comprising:
one or more network interfaces configured to receive a packet of a packet flow, wherein the packet flow is one of a plurality of packet flows processed by the network device;
a flow cache configured to receive a lookup key associated with the packet flow; and
a Bloom filter configured to process the lookup key,
wherein the flow cache is further configured to store information about a portion of the plurality of packet flows processed by the network device, determine whether to store information about the packet flow by at least applying a selection criterion to processing of the lookup key by the Bloom filter, determine whether the lookup key is stored in the flow cache, and, when the lookup key is stored in the flow cache, retrieve a stored result associated with the lookup key and output the stored result.

### Claim 12 (depends on 11)

The network device of claim 11, further comprising:
a prefix lookup module configured to receive the lookup key and generate a set of prefixes based on the lookup key;
a hash table configured to store information associated with the packet flows; and
a controller,
wherein the Bloom filter is configured to process each prefix of the set of prefixes to identify a portion of the set of prefixes to use in searching the hash table,
wherein the controller is configured to search the hash table using one or more of the identified portion of the set of prefixes, and receive a result of the search from the hash table, and
wherein the flow cache is configured to determine whether to store the lookup key and the result by at least applying the selection criteria to one or more of the processing of each prefix by the Bloom filter and the searching of the hash table by the controller.

### Claim 13 (depends on 12)

The network device of claim 12,
wherein the prefix lookup module is configured to send the set of prefixes to the Bloom filter for processing by the Bloom filter, and send a message to the controller to cause the controller to start a clock cycle counter,
wherein the controller is configured to receive the message and initialize the clock cycle counter to a value, increment the value of the clock cycle counter for each clock cycle that elapses until the controller receives the result from the search, and, upon receiving the result, send the lookup key, the result, and the value of the clock cycle counter to the flow cache, and
wherein the flow cache is configured to determine whether the value of the clock cycle counter exceeds a threshold value, and store the lookup key and the result when the value of the clock cycle counter exceeds the threshold value.

### Claim 14 (depends on 13)

The network device of claim 13, wherein the flow cache includes:
a flow cache hash table having a plurality of buckets each having a plurality of cells, wherein each of the plurality of cells is configured to store a respective lookup key and result pair,
wherein the flow cache is configured to apply a hash function to the lookup key in order to identify one of the plurality of buckets of the flow cache hash table, determine whether all of the plurality of cells of the identified bucket currently store previous lookup key and result pairs, when all of the plurality of cells currently store previous lookup key and result pairs, select one of the plurality of cells to store the lookup key and the result, and overwrite the selected one of the plurality of cells with the lookup key and the result.

### Claim 15 (depends on 14)

The network device of claim 14,
wherein the flow cache is configured to select one of the plurality of cells to store the lookup key and the result by at least being configured to generate a random number, and select the one of the plurality of cells based on the generated random number.

### Claim 16 (depends on 14)

The network device of claim 14, wherein the flow cache is configured to select one of the plurality of cells to store the lookup key and the result by at least being configured to retrieve session information for each of the plurality of cells, determine which cell of the plurality of cells was least recently used based on the session information each respective cell of the plurality of cells, and select the one of the plurality of cells based on which cell was least recently used.

### Claim 17 (depends on 12)

The network device of claim 12,
wherein the controller is configured to initialize a lookup counter to a value, select a first prefix of the identified portion of the set of prefixes, search the hash table based on the first prefix, receive a first result of the search, and, when the first result indicates that a match was found in the hash table, send the lookup key, the first result, and the value of the lookup counter to the flow cache.

### Claim 18 (depends on 17)

The network device of claim 17,
wherein the flow cache is configured to compare the value of the lookup counter to a threshold value, when the value of the lookup counter is greater than the threshold value, store the lookup key and the first result, and when the value of the lookup counter is not greater than the threshold value, determine not to store the lookup key and the first result in the flow cache.

### Claim 19 (depends on 17)

The network device of claim 17,
wherein, when the first result indicates that a match was not found in the hash table, the controller is configured to increment the value of the lookup counter, select a second prefix of the identified portion of the set of prefixes, wherein the second prefix is different from the first prefix, search the hash table based on the second prefix, receive a second result of the search, and, when the second result indicates that a match was found in the hash table, send the lookup key, the second result, and the value of the lookup counter to the flow cache.

### Claim 20

A computer-readable storage medium encoded with instructions for causing one or more programmable processors of a computing device to:
receive a lookup key associated with a packet flow, wherein the packet flow is one of a plurality of packet flows processed by the computing device, wherein a flow cache of the computing device stores information about a portion of the plurality of packet flows processed by the network device, and wherein the flow cache determines whether to store information about the packet flow based at least in part on applying a selection criterion to processing of the lookup key by a Bloom filter of the network device;
determine whether the lookup key is stored in the flow cache; and
when the lookup key is stored in the flow cache:
retrieve a stored result associated with the lookup key; and
output the stored result.
