Using Hash Keys to Allocate Traffic

Multi-CPU Distribution

product_line_custom
Napatech SmartNIC
category
User Guide

Hash key functionality

Hash keys can be used to distribute traffic flows to streams. Each hash key looks at a specific set of fields (as defined by the hash key in use) within the frame and calculates a hash value using the values of the fields as input to the hash function. This hash value is used for determining in which of the streams the specific packet is included. This ensures that packets from the same flow (as defined by the frame fields included in the given hash key) are always delivered to the same stream.

Simple hash key distribution example

In this example, all incoming traffic is distributed to eight streams using the 2-tuple hash key algorithm:

HashMode=Hash2Tuple
Assign[StreamId=(0..7)] = All

Hash key variants

Many of the hash keys have sorted and unsorted variants (see DN-1108). The unsorted variants will calculate the hash value using the fields as they are found in the frame. The sorted form will first sort the corresponding source and destination fields before calculating the hash value. Sorted hash keys are used for ensuring that the same hash value is calculated for frames traveling between two endpoints regardless of the direction the frame is heading.

Available hash key types

The available hash key types are:

  • User-defined, based on any packet data and inner or outer IP protocol.
  • None
  • Hash2Tuple
  • Hash2TupleSorted
  • Hash5Tuple
  • Hash5TupleSorted
  • Hash3TupleGREv0
  • Hash3TupleGREv0Sorted
  • Hash3TupleGTPv0
  • Hash3TupleGTPv0Sorted
  • Hash3TupleGTPv1v2
  • Hash3TupleGTPv1v2Sorted
  • Hash5TupleSCTP
  • Hash5TupleSCTPSorted
  • HashLastMPLSLabel
  • HashAllMPLSLabels
  • HashLastVLANId
  • HashAllVLANIds
  • HashInner2Tuple
  • HashInner2TupleSorted
  • HashInner5Tuple
  • HashInner5TupleSorted
  • HashRoundRobin
    Note: Although round-robin is called a hash key type, it does not calculate a hash value itself. Instead it distributes frames to the streams in a round-robin fashion.

For details, refer to DN-1108 and DN-0449.