Configuring libpcap

libpcap Installation

product_line_custom
IntelĀ® PAC
Napatech SmartNIC
category
Software Installation Guide

Introduction

The Napatech libpcap library works on devices explicitly created and assigned to a stream in the ntpcap.ini configuration file as well as streams created, for instance, by using the ntpl tool. For each stream a virtual device is created.

Existing streams

Each stream not created by ntpcap.ini appears to libpcap as a device named nt3g<n>, where <n> is the stream ID. Examples of names are: nt3g0 and nt3g1. Only streams created by ntpcap.ini have TX capabilities in libpcap.

Streams defined in the ntpcap.ini file

The configuration file ntpcap.ini is read whenever a libpcap application initializes its device list.

libpcap devices corresponding to streams defined in the ntpcap.ini file have user-defined names. The names are defined in the ntpcap.ini file, which must have the format described in Format of the ntpcap.ini File. Streams defined in the ntpcap.ini file can have both RX and TX capabilities in libpcap.

You can create a new ntpcap.ini file from scratch in /opt/napatech3/config/ or copy a default ntpcap.ini file to /opt/napatech3/config/.

If you have installed libpcap using package_install_3gd-x.y.z.sh, a default ntpcap.ini file has been copied to /opt/napatech3/config (see The Default ntpcap.ini File).

If you have installed libpcap using the procedure in Installing libpcap with Napatech Extensions, you can execute these commands to copy a default ntpcap.ini file to /opt/napatech3/config:
$ cd libpcap-x.y.z
$ cp ntpcap.ini /opt/napatech3/config/

Considerations on allocation of TX host buffers

When TX capabilities are defined for a libpcap device in the ntpcap.ini file, one TX host buffer is used for each application that opens the device. This is in contrast to RX, where all applications share the same host buffers created by NTPL and associated with a stream ID. The maximum number of RX and TX host buffers are specified in the ntservice.ini file (see DN-0449).

Note: In the default ntservice.ini file 4 TX host buffers are allocated, and in the default ntpcap.ini file, 4 libpcap devices (napa0, napa1, napa2, and napa3) with TX capabilities are defined (see The Default ntpcap.ini File). So when all 4 devices are opened, all 4 available TX host buffers are used, and an attempt from a new application to open one of the 4 devices and thereby use a fifth host buffer will fail. The solution is to allocate more TX host buffers in the ntservice.ini file, or to remove TX capabilities in the ntpcap.ini file for devices not needing them.