Distributing Traffic using Key Match

Load Distribution

Platform
Intel® PAC
Napatech SmartNIC
Content Type
User Guide
Capture Software Version
Link™ Capture Software 12.8

Distribution based on user defined header fields

Received traffic can be distributed based on user defined header fields. Various header fields of a frame can be used as follows:
  • Traditional 5 tuple: Source/destination IP addresses, layer 4 source/destination port numbers and IP protocol.
  • Traditional 4 tuple: Source/destination IP addresses and layer 4 source/destination port numbers.
  • Traditional 2 tuple: Source and destination IP addresses.
  • Source and destination IP addresses, VLAN tag 1 and VLAN tag 2.
  • Source and destination MAC addresses.

NTPL examples

The following NTPL example configures the SmartNIC to match the IPv4 source address field of a frame.
Define WhiteList = Macro("3")
Define BlackList = Macro("4")
Define IPv4Src = Field(Layer3Header[12]/32)
Define HashIPv4Src = Hash(HashWord0_3=IPv4Src)

KeyType[Name=kt_ipv4] = {32}
KeyDef[Name=kd_ipv4; KeyType=kt_ipv4] = (IPv4Src)
KeyList[KeySet = WhiteList; KeyType = kt_ipv4] = ([192.168.0.2]), ([192.168.0.3]), ([192.168.0.4])
KeyList[KeySet = BlackList; KeyType = kt_ipv4] = ([192.168.1.20]), ([192.168.1.21]), ([192.168.1.24])

// Forward white list traffic to Stream 0
Assign[StreamId=(0..3); Hash=HashIPv4Src] = layer3Protocol==IPv4 \\
and Key(kd_ipv4) == WhiteList
// Forward blacklist traffic to stream 1
Assign[StreamId=4] = layer3Protocol==IPv4 and Key(kd_ipv4) == BlackList
The following NTPL example uses the source IP / layer 4 source port number fields and the destination IP address / layer 4 destination port number header fields for traffic distribution.
Define IPv4SrcField = Field(Layer3Header[12]/32)
Define IPv4DstField = Field(Layer3Header[16]/32)

Define PortSrcField = Field(Layer4Header[0]/16)
Define PortDstField = Field(Layer4Header[2]/16)
Define Hash4Tuple = Hash(HashWord0_3=IPv4SrcField, HashWord4_7=IPv4DstField, \\
HashWord8=PortSrcField, HashWord9=PortDstField, XOR=True)
KeyType[Name=IPv4; Access=Full] = {32, 16}

KeyDef[Name=IPv4Src; KeyType=IPv4] = (IPv4SrcField, PortSrcField)
KeyDef[Name=IPv4Dst; KeyType=IPv4] = (IPv4DstField, PortDstField)

KeyList[KeyType=IPv4; KeySet=3] = ([10.31.55.4], 5060)
KeyList[KeyType=IPv4; KeySet=3] = ([10.31.55.4], 5061)
KeyList[KeyType=IPv4; KeySet=3] = ([192.168.0.20], 5060)
KeyList[KeyType=IPv4; KeySet=3] = ([192.168.0.20], 5061)

Assign[StreamId=(0..7); Hash= Hash4Tuple] = Key(IPv4Src) == 3 or Key(IPv4Dst) == 3