HashMask Command

Reference Documentation

product_line_custom
Napatech SmartNIC
category
Reference Information

This section specifies the syntax and semantics for the hashmask command. Supported for all feature sets.

The syntax for hash masks is shown below.

<HashMaskAction>     ::= 'HashMask' [ '[' <HashMaskOptionList> ']' ] '='
                             <HashModeSpec> | <HashMaskNo>
<HashMaskNo>         ::= 'MaskNo' '==' <MaskNumber>
<HashMaskOptionList> ::= <HashMaskOption> { ';' <HashMaskOption> }
<HashMaskOption>     ::= ( 'HashWord0' '=' ( <32-bit hex value> | <IPv4AddrMask> ) ) |
                         ( 'HashWord1' '=' <32-bit hex value> ) |
                         ( 'HashWord2' '=' <32-bit hex value> ) |
                         ( 'HashWord3' '=' <32-bit hex value> ) |
                         ( 'HashWord4' '=' ( <32-bit hex value> | <IPv4AddrMask> ) ) |
                         ( 'HashWord5' '=' <32-bit hex value> ) |
                         ( 'HashWord6' '=' <32-bit hex value> ) |
                         ( 'HashWord7' '=' <32-bit hex value> ) |
                         ( 'HashWord8' '=' <32-bit hex value> ) |
                         ( 'HashWord9' '=' <32-bit hex value> ) |
                         ( 'HashWord0_3' '=' <IPv6AddrMask> ) |
                         ( 'HashWord4_7' '=' <IPv6AddrMask> ) |
                         ( 'HashWord8_Hi' '=' <16-bit value> ) |
                         ( 'HashWord8_Lo' '=' <16-bit value> ) |
                         ( 'HashWord9_Hi' '=' <16-bit value> ) |
                         ( 'Tag' '=' <Identifier> )

Each <HashMaskAction> command defines the masks to be used when generating the hash key for the specified hash mode or hash mask number.

For a description of the 'Tag' option please refer to Tag Option.

Note: HashMask can only be set for hash modes that include values that can be masked out. This means that HashMask cannot be set for hash modes 'None' and 'HashRoundRobin'.

Note: If 'MaskNo' is used, the mask must be defined before the HashMode command is issued.

Hash Key Generation Examples

This section describes some examples of multi-CPU buffer distribution using hash masks.

Sorted 5-Tuple Hash Keys

This section describes an example of setting up a hash key type and the hash masks to use. The example illustrates how to set up the adapter to generate sorted 5-tuple hash keys and setting up the corresponding hash masks to ignore the least significant byte of the source and destination IP addresses (using subnet mask FF.FF.FF.0).

The hash key NTPL example is shown below.

HashMask[HashWord0=[FF.FF.FF.0]; HashWord4=[FF.FF.FF.0]] = Hash5TupleSorted HashMode = Hash5TupleSorted

Sorted 2-Tuple Hash Keys based on IP version

This section describes an example of setting up a hash key type and the hash masks to use. The example illustrates how to set up the adapter to generate sorted 2-tuple hash keys and setting up the corresponding hash masks to ignore the least significant byte of the source and destination of 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::).

HashMask[HashWord0=[FF.FF.FF.0]; HashWord4=[FF.FF.FF.0]] = MaskNo == 1 HashMode[Layer3Type=IPV4; MaskNo=1] = Hash2TupleSorted 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] = Hash2TupleSorted