Distributing Traffic Based on Filtering

Multi-CPU Distribution

product_line_custom
IntelĀ® PAC
Napatech SmartNIC
category
User Guide

Selection based on filtering

Filter logic can be used to enable multi-CPU distribution. All of the filtering functionality (see DN-1128) can be used for this purpose.

Protocol filter with round robin distribution example

In this example, all traffic will be sent to stream 7 by default, but all UDP and TCP traffic will be distributed in round robin fashion between streams 0, 1, 2, 3, 4, 5 and 6.

Assign[StreamId=7] = All
Assign[StreamId=(0..6)] = Layer4Protocol == UDP, TCP

This example does not use explicit priorities, but relies on the UDP/TCP filter being last, taking precedence over the previous filter.

Protocol and protocol port filter example

This example filters on the SIP (Session Initiation Protocol) protocol. Frames from port 0 that are not SIP frames are directed to stream 0, and frames from port 1 that are not SIP frames are directed to stream 1. All SIP frames (with TCP or UDP port set to 5060 (unencrypted) or 5061 (encrypted)) are directed to stream 2.

DefineMacro("mTcpSrcPort", "Data[DynOffset=DynOffTCPFrame;Offset=0;DataType=ByteStr4;DataMask=[31:16]]")
DefineMacro("mTcpDstPort", "Data[DynOffset=DynOffTCPFrame;Offset=0;DataType=ByteStr4;DataMask=[15:0]]")
DefineMacro("mUdpSrcPort", "Data[DynOffset=DynOffUdpFrame;Offset=0;DataType=ByteStr4;DataMask=[31:16]]")
DefineMacro("mUdpDstPort", "Data[DynOffset=DynOffUdpFrame;Offset=0;DataType=ByteStr4;DataMask=[15:0]]")
Assign[StreamId = 0] = Port == 0
Assign[StreamId = 1] = Port == 1
Assign[StreamId = 2] = mTcpSrcPort == 5060, 5061 AND mTcpDstPort == 5060, 5061 OR mUdpSrcPort == 5060, 5061 AND mUdpDstPort == 5060, 5061

This example does not use explicit priorities, but relies on the SIP filter being last, taking precedence over the previous filters.

Protocol and SmartNIC port filter example

In this example, protocol filters are used to direct all UDP frames received on port 0 or 1 to stream 0, all TCP frames received on port 0 or 1 to stream 1, all SCTP frames received on port 0 or 1 to stream 2 and all other frames received on port 0 or 1 to stream 3.

HashMode = None
Assign[StreamId = 0; Priority = 0] = Layer4Protocol == UDP AND Port == (0..1)
Assign[StreamId = 1; Priority = 0] = Layer4Protocol == TCP AND Port == (0..1)
Assign[StreamId = 2; Priority = 0] = Layer4Protocol == SCTP AND Port == (0..1)
Assign[StreamId = 3; Priority = 1] = Port == (0..1)

In this example, the explicit priority on the filters ensure that the last filter does not take precedence. 0 is the highest priority.