Skip to content

DAG Notes

salcock edited this page Sep 10, 2014 · 1 revision

Notes on Libtrace DAG Support

This page describes the libtrace DAG support in much more detail. This is primarily intended to aid libtrace developers, but may be of some interest to users having difficulty getting their DAG card to work with libtrace.

To build libtrace with DAG support, you will need to have the appropriate DAG libraries and drivers installed. This software is provided by Endace - it is NOT included with libtrace. You can still read and write ERF (the trace format used by DAG cards) without the DAG libraries, but live capture using the DAG hardware requires the DAG software.

DAG 2.4 vs DAG 2.5

There are two format modules for DAG included in the libtrace source: format_dag24 and format_dag25.

format_dag24 uses the old DAG API from the 2.4.X DAG libraries. The DAG 2.4 libraries are notoriously difficult to use compared with the DAG 2.5 and later libraries. For starters, just getting the DAG 2.4 code to compile on recent Linux kernels is an achievement.

format_dag25 uses the newer API from the DAG libraries starting at version 2.5 onwards, including any version 3 libraries and apparently 4.0.0 as well.

Most DAG users should be using a card that is compatible with format_dag25. format_dag24 is essentially legacy code and we don't really support it anymore, due to not having any cards that use DAG 2.4 in production.

DAG detection in libtrace

If you are using DAG 2.5 or later, this should be fairly straightforward. libdag.so should be installed in /usr/local/lib if you installed the DAG library using the default options, in which case libtrace will find it automatically.

If you installed to a custom location, you will need to add "LDFLAGS=-L/lib CPPFLAGS="-I/include" to the ./configure command to enable libtrace to find the libraries (where custom is the prefix you used when installing the DAG drivers).

DAG 2.4 is trickier - not all the needed libraries and header files are installed, so you need to use "--with-dag=" to tell ./configure where the DAG 2.4 source is located so libtrace can find the needed files.

If libtrace was successful in finding your DAG libraries, the following line will appear in the summary at the end of the ./configure output: configure: Compiled with DAG live capture support: 2.5

The number indicates which libtrace DAG format will be built. If this is 2.4, libtrace will build using format_dag24, otherwise format_dag25 will be used.

If you get the following, no DAG libraries were found for your system: configure: Compiled with DAG live capture support: No

Detection Approach

The following is the list of steps libtrace's DAG detection performs - if it is not behaving as you'd expect, maybe this will help figure out what is going on!

  • Perform a standard autoconf check for the existence of libdag. This will check the standard library locations (/usr/lib, /usr/local/lib, etc) as well as any locations specified using LDFLAGS.
  • If libdag is found, job done! Libtrace will build using the format_dag25 code.
  • Otherwise, we assume no format_dag25-compatible libraries are present, but we still need to check for format_dag24.
  • If the user gave us a value for --with-dag, set that directory to be "dag_root". Otherwise we'll use /usr/local/dag as our best guess for the location of the DAG source.
  • Search $dag_root/lib for libdag.a and $dag_root/include for dagapi.h. We also check $dag_root for these files, in the event that there is no lib/ or include/ directories in $dag_root.
  • If both files are found, libtrace will be built using the format_dag24 code.
  • If the files are not found but the user explicitly asked to build with DAG, throw an error. Otherwise, we will just build without DAG support.
Clone this wiki locally