Adding an NTPL Expression

Installation and Use of Napatech Link™ Capture Software for Intel® PAC with Intel® Arria® 10 GX FPGA

Platform
Content Type
Quick Guide
Capture Software Version
Link™ Capture Software 12.0

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.

Note: ntpcap.ini is created from scratch, overwriting any manual modifications, each time you exit the setup_wizard tool using the Save and exit command. The previous version of ntpcap.ini is renamed ntpcap.ini.old.

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("mIPv4SrcAddr", "Data[DynOffset=DynOffIPv4Frame;Offset=12;DataType=IPv4Addr]")'
Ntpl5 = 'DefineMacro("mIPv4DestAddr","Data[DynOffset=DynOffIPv4Frame;Offset=16;DataType=IPv4Addr]")'
Ntpl6 = 'DefineMacro("mIPv6SrcAddr", "Data[DynOffset=DynOffIPv6Frame;Offset=8;DataType=IPv6Addr]")'
Ntpl7 = 'DefineMacro("mIPv6DestAddr","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
To add filtering and slicing, you edit the Assign commands in the [Common] section. Each NTPL command in the [Common] section is prepended with a numbered key, Ntpl1, Ntpl2, Ntpl3, etc.
Note: The Ntpl1, Ntpl2, etc. keys are not shown in the examples. If you need to add a new Assign command, prepend it with a numbered Ntplnn key and renumber subsequent Ntplnn keys.

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.

Note:

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

  1. Use the interactive setup_wizard tool to create the initial configuration.
  2. 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.
  3. Add filter expressions and Assign options.
  4. 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.

Note:

You do not have to restart ntservice.