You can add an NTPL expression to the configuration in order to take advantage of hardware-accelerated filtering and slicing.
About this task
Part of the configuration of Napatech libpcap is stored in the file /opt/napatech3/config/ntpcap.ini. To add hardware-accelerated filtering and slicing, you edit NTPL commands in this file.
The ntpcap.ini file
The ntpcap.ini file is located in /opt/napatech3/config/. This file is part of the configuration created using setup_wizard.
The ntpcap.ini file consists of a number of sections: a [Common] section, and one or more subsequent sections that create libpcap interfaces.
The [Common] section
The [Common] section contains DefineMacro commands that make it easier to add filters, and Assign commands that create streams and map SmartNIC ports to these streams.
[Common] Ntpl1 = 'DefineMacro("mMacDestAddr", "Data[DynOffset=DynOffLayer2Frame;Offset=0;DataType=MacAddr]")' Ntpl2 = 'DefineMacro("mMacSrcAddr", "Data[DynOffset=DynOffLayer2Frame;Offset=6;DataType=MacAddr]")' Ntpl3 = 'DefineMacro("mIPVersion", "Data[DynOffset=DynOffIPv4Frame;Offset=0;DataType=ByteStr1;DataMask=[7:4]]")' Ntpl4 = 'DefineMacro("mIPv4SrcAddrIP", "Data[DynOffset=DynOffIPv4Frame;Offset=12;DataType=IPv4Addr]")' Ntpl5 = 'DefineMacro("mIPv4DestAddrIP","Data[DynOffset=DynOffIPv4Frame;Offset=16;DataType=IPv4Addr]")' Ntpl6 = 'DefineMacro("mIPv6SrcAddrIP", "Data[DynOffset=DynOffIPv6Frame;Offset=8;DataType=IPv6Addr]")' Ntpl7 = 'DefineMacro("mIPv6DestAddrIP","Data[DynOffset=DynOffIPv6Frame;Offset=24;DataType=IPv6Addr]")' Ntpl8 = 'DefineMacro("mUdpSrcPort", "Data[DynOffset=DynOffUDPFrame;Offset=0;DataType=ByteStr2]")' Ntpl9 = 'DefineMacro("mUdpDestPort", "Data[DynOffset=DynOffUDPFrame;Offset=2;DataType=ByteStr2]")' Ntpl10 = 'DefineMacro("mTcpSrcPort", "Data[DynOffset=DynOffTCPFrame;Offset=0;DataType=ByteStr2]")' Ntpl11 = 'DefineMacro("mTcpDestPort", "Data[DynOffset=DynOffTCPFrame;Offset=2;DataType=ByteStr2]")' Ntpl12 = "Assign[StreamId = 0] = Port == 0" Ntpl13 = "Assign[StreamId = 1] = Port == 1" Ntpl14 = "Assign[StreamId = 2] = Port == 2" Ntpl15 = ... ... [napa0] StreamId = 0 Tx = 0 [napa1] StreamId = 1 Tx = 1
For filtering, add conditions in the expression on the right side of the Assign command.
For slicing, add options in the square brackets on the left side of the Assign command.
libpcap interface sections
The streams created in the [Common] section are mapped to libpcap interface names in the subsequent sections.
You do not need to edit these sections.
You can map a stream to more than one libpcap interface in order to share resources (host buffers). In this case, the slowest application that open one of these libpcap interface blocks the other interfaces mapped to this stream.
Procedure
- Use the interactive setup_wizard tool to create the initial configuration.
- Open ntpcap.ini in a text editor, and locate the Assign command that create the StreamId used by the libpcap interface you want to accelerate.
- Add filter expressions and Assign options.
- Save ntpcap.ini.
Results
ntpcap.ini take effect as soon as all currently open Napatech libpcap interface are closed and a Napatech libpcap interface is then opened.
You do not have to restart ntservice.