Hash Key Masks

Napatech Link™ Software Features

product_line_custom
Intel® PAC
Napatech SmartNIC
category
Feature Description

Hash key masks

The hash calculation can be controlled using hash key masks. Hash word bits that are masked out are set to 0. In this way certain parts of the input data can be disregarded from the hash calculation, so that frames with hash values that only differ due to, for instance, port numbers can be configured to end up in the same host buffer.
Note: For sorted hash keys the sorting takes place before the masking.

This figure illustrates hash calculation using hash key masks for predefined hash key types.

Hash calculation using hash key masks

NTPL example 1

This NTPL example sets up a hash key mask to process RTP and RTCP traffic from a VoIP media stream in the same process/CPU. VoIP allocates an even port number for RTP traffic and the RTP port number + 1 for RTCP traffic. Configuring the mask 0xFFFE for the port number ensures that any set of RTP and RTCP traffic get the same hash value and ends up in the same host buffer:

DefineMacro("mHashMaskSrcPort", "HashWord8_Lo")
DefineMacro("mHashMaskDstPort", "HashWord8_Hi")
HashMask[mHashMaskSrcPort = 0xFFFE; mHashMaskDstPort = 0xFFFE] = Hash5Tuple
HashMode=Hash5Tuple
Assign[StreamId=(0..7)] = All

NTPL example 2

Hash key masks can also be specified using a hash mask number (MaskNo).

The hash mask must be defined before the hash mask number is referred in a HashMode command.

This NTPL example sets up 2-tuple hash keys and corresponding hash masks to ignore the least significant byte of the source and destination IPv4 addresses (using subnet mask FF.FF.FF.0) and to ignore the least significant bytes of the source and destination IPv6 addresses (using subnet mask FFFF:0:0:0:0:0:0:0):

HashMask[HashWord0=[FF.FF.FF.0]; HashWord4=[FF.FF.FF.0]] = MaskNo == 1
HashMode[Layer3Type=IPV4; MaskNo=1] = Hash2Tuple
HashMask[HashWord0_3=[FFFF:0:0:0:0:0:0:0]; HashWord4_7=[FFFF:0:0:0:0:0:0:0]] = MaskNo == 2
HashMode[Layer3Type=IPV6; MaskNo=2] = Hash2Tuple
Assign[StreamId=(0..7)] = All