Valid and Invalid Hash Keys

Napatech Link™ Software Features

Intel® PAC
Napatech SmartNIC
Feature Description


Some hash key types are only valid for certain frames. The frames must contain the required protocol fields in order to be valid for a given hash key type (see Hash Key Types).

NTPL example 1

Using one of the predefined hash modes implicitly add tests to ensure that a valid hash key value can be calculated.

This NTPL example sets up the SmartNIC to use 5-tuple sorted hash keys:

HashMode = Hash5TupleSorted

As a result, a 5-tuple sorted hash key is used for all supported protocols, that is for IPv4 and IPv6 UDP/TCP/SCTP frames. For all other frames, the hash key value will be 0, the hash key value will be marked as invalid, and frames are distributed using the round-robin algorithm.

NTPL example 2

For user-defined hash keys, you should apply tests to ensure that the protocol fields used in the hash key recipe are present. Otherwise, the hash key value is not well-defined.

In this NTPL example, an explicit protocol test ensures well-defined hash key values.

Define IPv4_Flow = Hash(HashWord0_3=Layer3Header[12]/32, HashWord4_7=Layer3Header[16]/32, XOR=True)
Assign[StreamId=(0..3); Hash=IPv4_Flow] = Layer3Protocol == IPV4