wiki:DAGNotes

Version 1 (modified by salcock, 10 years ago) (diff)

Start of some rather verbose notes on dealing with DAG in libtrace

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.

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.

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<custom>/lib CPPFLAGS="-I<custom>/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=<source location>" 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: 3.0

The number will be the DAG library version. 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 performing 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! Grab the version number and away we go.
  • 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 - if both succeed, then we've found the libraries and headers we need.
  • We also check $dag_root for these files, in the event that there is no lib/ or include/ directories in $dag_root.

DAG 2.4 details

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.