Selection based on filtering
Filter logic can be used to enable load distribution. All of the filtering functionality can be used for this purpose. See DN-0987 for more information on filtering.
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 port set to 5060 (unencrypted) or 5061 (encrypted)) are directed to stream 2.
Define SrcPort = \\ Macro("Data[ProtOffset=Layer4Header[0];DataType=ByteStr4;DataMask=[31:16]]") Define DstPort = \\ Macro("Data[DynOffset=ProtOffset=Layer4Header[0];DataType=ByteStr4;DataMask=[15:0]]") Assign[StreamId=0] = Port==0 Assign[StreamId=1] = Port==1 Assign[StreamId=2] = SrcPort==5060, 5061 OR DstPort==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.