Network Interface Card over NetCOPE Handbook

The Liberouter Project Team

Version 1.0.0, revision 0.90, 21 Feb 2008

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. The license can be found at GNU web page.


Table of Contents

1. Introduction
NIC Card over NetCOPE
HW Parameters of NIC Card
SW Parameters of NIC Card
Typical Applications of NIC Card
Obtaining NIC Package
Package Structure
2. Installing NIC Card
System Requirements
Software Requirements
Hardware Requirements
Supported Cards
Supported Firmware
Supported Software
Installing COMBO6X Card
NIC Card Port Numbers
Building Package
Installing Package
Upgrading Package
liberouterpkg Tool
List of Installed Packages
Uninstalling Package
Switching Packages
3. Configuration of the NIC Card
Basic parameters
Aggregation parameters
Network interfaces parameters
4. Using NIC Card
Loading kernel modules
Setting up NIC Card
Standard Network Interfaces
Aggregation Mode and Timestamps
Data format
szeread - sample application
Using libpcap Library
init.d script
Running startup script at the boot time
Stopping Combo NIC service
Status of the NIC service
Changing speed on interface
Connecting PORTs, INPUTs and OUTPUTs
Devices' properties
5. Known HW and SW Limitations, Problems
6. FAQ
7. Contacting the NIC Card Team
Submitting Problem Reports
How to Report a Bug
Other COMBO6(X) Based Projects
8. NIC Card Developers Team
A. References
Bibliography

List of Figures

1.1. HW SW Communication Models
2.1. COMBO6X Card
2.2. NIC Card COMBO-4SFPRO Card Port Numbers
4.1. Crossbar default state

List of Tables

2.1. COMBO6X Motherboard Compatibility
2.2. Tested GBICs
2.3. Supported Firmware
4.1. Data format
4.2. Hardware header format

Chapter 1. Introduction

This handbook describes NIC Card itself, its installation, configuration and different ways how to use it.

You can check latest news about NIC Card or NetCOPE at our web site: http://www.liberouter.org/.

NIC Card over NetCOPE

The NIC Card is a basic network device for packet reception and transmission based on COMBO6X technology. It is able to receive and transmit packets on various speeds (1Gbps, 100Mbps and 10Mbps). Additionally this card supports precise timestamps, that can be very useful for instance for measuring of latencies in your network topology. This information can be later used for improving your topology or network device faults detection.

This NIC Card has been developed on NetCOPE platform as its simplest application. The NetCOPE platform supports rapid development of network application on FPGA accelerated cards by providing low-level abstraction layer for each card. This layer encapsulates network, system bus controllers or DMA transfers and thus speeds up application development. One of the main targets of NetCOPE on each card is to achieve maximal data throughput between user acceleration core on FPGA and software applications. In case of the NIC Card, data are transferred directly from Input blocks to user software applications without any modifications in user application core on FPGA.

HW Parameters of NIC Card

SW Parameters of NIC Card

NetCOPE platform provides these interfaces to software:

  1. Standard network interface - NIC over NetCOPE acts in system as ordinary network interface. Received packets are passed from driver to operating system kernel and further through TCP stack to target application. Alternatively PCAP library, part of operating system, can be used to access packets in raw format avoiding passage through TCP stack (typical for monitoring applications as Tcpdump, Wireshark, Snort etc.). Advantage of this interface is its universality and possibility of using existing applications. Disadvantage is low throughput caused by passage through operating system kernel which requires disassembling packets into segments without exploiting advantages of aggregation.

  2. Application specific interface - NetCOPE card provides general interface for block transfers to applications. Communication takes place directly between driver and userspace application without passage through TCP stack. Format of passed data is not restricted by operating system kernel and therefore this interface can benefit from using aggregated packets with control information, timestamps etc. appended. Except packet data various data (depending on accelerator purpose) such as netflow records, information extracted form packet headers, etc. can be transferred. NIC over NetCOPE uses this interface to transfer aggregated packets. In addition PCAP library adjusted to work within this interface, communicating directly to driver, avoiding passage through operating system kernel, has been created and is provided. Similar approach use companies as Endace, Napatech, etc.. Main advantage of this approach is high throughput using aggregation of smaller packets reducing DMA transfers overhead.

Figure 1.1. HW SW Communication Models

HW SW Communication Models


Typical Applications of NIC Card

  • classic NIC Card

  • NIC Card with guaranteed wirespeed for all packet lengths

  • NIC Card with guaranteed wirespeed for all packet lengths, with precise timestamp support

Obtaining NIC Package

NIC package is available via WWW download page: http://www.liberouter.org/clients

To verify that the downloaded files are genuine and complete SHA1 digests are available. Download both the CHECKSUM.SHA1 file and the package file to the same directory. Run the sha1sum(1) command to verify the package file e.g. nic-2.0.0.tgz:

$ cat CHECKSUM.SHA1 | grep nic-2.0.0.tgz | sha1sum -c
      

If there are any errors in the package file integrity, they will be reported.

Package Structure

	/firmware      - COMBO6X card firmware (*.mcs files)
	/base          - source code for software tools and drivers
	  /mk                        - build system (makefiles)
	  /sys_sw/drivers            - kernel drivers
	  /sys_sw/hwtools            - necessary hardware tools for COMBO6X card
	  /sys_sw/lib*               - libraries necessary for other tools
    /sys_sw/projects/nic_netcope - configuration files and scripts for using NIC
    /sys_sw/swtools/csxtool    - tool for handle COMBO6X XML files
	/doc           - NIC project documentation - NIC Handbook
	README         - short manual how to build, install and use NIC Card
	RELNOTES       - differences against previous release

Chapter 2. Installing NIC Card

System Requirements

Software Requirements

Compilation and installation process is covered by the build system located in the base/mk directory.

To build package you will need following tools (programs, libraries):

  • gmake 3.80 or later

  • autoconf 2.59 or later

  • automake 1.4 or later

  • gcc 3.0 or later

  • pciutils (lspci) 2.2.2 or later

  • lsof 4.72 or later

All scripts are running in /bin/sh shell interpreter so all scripts were created with aim to portability. But on all testing machine the /bin/sh program was actually Bash (/bin/bash). Therefore we recommend using Bash as a default shell.

To build kernel drivers needed by NIC package you will need fully configured Linux 2.4 or 2.6 kernel source tree. More installation and compilation details about kernel drivers are available in the README file inside base/sys_sw/drivers/linux directory.

Hardware Requirements

The NIC Card has been designed to work on any PC-AT compatible computer running GNU/Linux or other "Unix-like" operating system. It has been tested only on computers that use the x86 family of processors. The hardware requirements necessary to run NIC Card are:

  • Intel Pentium or equivalent x86 based PC

  • COMBO6X - 64-bit/66 MHz PCI bus

The "sandwich" consisting of COMBO6X card and an interface card COMBO-4SFPRO fits into one PCI slot.

Following table express our experience with COMBO6X card compatibility to some motherboards.

Table 2.1. COMBO6X Motherboard Compatibility

MB typeCOMBO6X
Intel SE7501CW2compatible
Intel SE7520BD2Dcompatible
Intel S5000VSAcompatible
Intel S5000PAL0compatible
Intel SE7525GP2incompatible
Intel SE7221BK1-Eincompatible

Following table displays list of compatible GBICs, which we have tested. We haven't found any non-compatible GBIC yet, all GBIC satisfying SFP/XFP MSA specification should work.

Table 2.2. Tested GBICs

Metallic 1Gbps (1000base-T) for COMBO-4SFPRO cardsOptical 1Gbps (1000BASE-LX and 1000BASE-SX) for COMBO-4SFPRO
Finisar FCLF-8521-3Agilent HFBR 57M5AP (850nm)
Linksys MGBT1Dell FTRJ-8519-7D (850nm)
Methode Electronics SP7041MSFP-FO-0850-M8511-111 (850nm)
 Finisar FTRJ1321P1BTL (1310nm)


Supported Cards

This package can be used with the COMBO6X mother card and COMBO-4SFPRO add-on card with four SFP cages for GE interfaces.

Figure 2.1. COMBO6X Card

COMBO6X Card

Note

You can find more information about COMBO6X cards at http://www.liberouter.org/hardware.php.

Supported Firmware

Table 2.3. Supported Firmware

Mother CardAdd-on CardFirmwareFeatures
COMBO6XCOMBO-4SFPRO03_044x Network interface for 1000/100/10Mbps with MTU control (=1526 Bytes)
Precise timestamps

Supported Software

NIC Card software works on GNU/Linux OS with 2.4 and 2.6 kernels.

Installing COMBO6X Card

After plugging COMBO6X card into your PCI slot, you should test connection between the card and your PC. We use lspci(8) utility for this purpose. lspci(8) is a utility for displaying information about all PCI buses in the system and all devices connected to them. For correct recognition of the COMBO6X card you need update PCI ID Database used by lspci(8) or download pciutils-2.2.2 (program collection containing lspci(8) or later. If the lspci(8) output contains the following line your COMBO6X card is connected properly.

	$ lspci -d 18ec:
	03:01.0 Ethernet controller: Cesnet, z.s.p.o. COMBO6X (rev 01)
	

Note

Numbers at the beginning of the line can be different.

NIC Card Port Numbers

The general rule for numbering card ports is that the ports closer to the motherboard (PCI slot) have lower numbers, e.g. the closest port has number 0, the next one number 1 etc. See figures bellow for examples:

Figure 2.2. NIC Card COMBO-4SFPRO Card Port Numbers

NIC Card COMBO-4SFPRO Card Port Numbers


Building Package

pkgtool(1) helps to build, install and uninstall the NIC distribution package.

	$ tar -xzvf nic-XX.YY.ZZ.tgz
	$ cd nic-XX.YY.ZZ/base
	$ ./pkgtool --build
	

Note

Replace XX.YY.ZZ with the chosen package version number such as 2.0.0.

If this is the first Liberouter package you have ever installed, you can define installation directory with the --prefix=path option. But remember that this installation path MUST not exists (e.g. /usr/local is invalid installation path on most systems because this directory exists). This restriction is due to new installation framework which enables easy package uninstall or package switching. More information about these features can be found in the liberouterpkg section.

The --prefix option takes effect only during building package. If no prefix is set then /usr/local/liberouter path is used.

	$ ./pkgtool --build --prefix=/usr/local/nic
    

If you have previously installed some Liberouter package (flowmon, nic, nific, ids with liberouterpkg mechanism), the installation path is detected automatically as path used for the first installed package.

Remember that installation path given as --prefix parameter will contain next subdirectories for binaries, libraries, man pages, etc. These directories can be affected by future uninstalling or package switching so it could be used as installation directory only for Liberouter packages.

Installing Package

The tools and kernel drivers will be installed to the installation directory (by default /usr/local/liberouter)).

	# ./pkgtool --install
	

If you are going to use udev mechanism to creating device files, you can use pkgtool with --udev option. This option cause copying file with COMBO6X card rules (combo6.udev.rules) to the /etc/udev/rules directory.

	# ./pkgtool --install --udev
	

Note

--udev option takes effect only with --install option.

There are necessary following post-install steps:

  1. Export Liberouter environment variables generated by pkgtool. These variables were printed as last output of pkgtool --install command and they are environment variables are in the following form

            VARIABLE=value
            

    Please, use these lines as a parameter for export command like in following example:

            # ./pkgtool --install
            ...
            [pkgtool output]
            ...
            ###  Liberouter environment variables:
            CS_XML_INDEX_PATH=/usr/local/liberouter/mcs/index
    
            $ export CS_XML_INDEX_PATH=/usr/local/liberouter/mcs/index
            

    For permanent export of this variable add same line (export command) into the /etc/profile configuration file.

            export CS_XML_INDEX_PATH=/usr/local/liberouter/mcs/index
            

    Liberouter environment variables are prepared only if they are needed. So if pkgtool doesn't print any "Liberouter environment variables:" you doesn't need export any variable.

  2. Set PATH variable to point to installed NIC tools directory (${PREFIX}/bin)

            $ export PATH=/usr/local/liberouter/bin:$PATH
            

    For permanent PATH change add following line into the /etc/profile configuration file

            export PATH=/usr/local/liberouter/bin:$PATH
            

  3. Configure dynamic linker run time bindings by setting /etc/ld.so.conf to point to the NIC library directory (${PREFIX}/lib).

    Add /usr/local/liberouter/lib (by default) entry to the /etc/ld.so.conf file.

            # echo "/usr/local/liberouter/lib" >> /etc/ld.so.conf
            # ldconfig
            

  4. Set /etc/man.config file to point to the NIC man pages (${PREFIX}/man).

    Add line

              MANPATH /usr/local/liberouter/man
              

    entry to the /etc/man.config file (name of this file can little differ on different Linux distribution).

  5. If you want to load NIC kernel modules when the PC starts up, add following lines to the /etc/modules file.

    For COMBO6X card when using szedata interface:

            combo6core
            combo6x
            szedata
            szedatax_c6pcr szedatax_c6pcr blocks=4096 block_size=4096
    

    For COMBO6X card when using standard network interface:

            combo6core
            combo6x
            combo6x-c6pcreth
    

    After this, you don't need to run niclkm(1) script any more.

    Note

    In some distribution (e.g. Red Hat Enterprise Linux 4) you have to use file /etc/rc.modules in place of /etc/modules file. This file contains commands to load kernel modules at boot time - it is actually script so it must be an executable file:

            # chmod +x /etc/rc.modules
    

    so such file will look like this for COMBO6X card when using szedata interface:

            #!/bin/sh
            /sbin/modprobe combo6core
            /sbin/modprobe combo6x
            /sbin/modprobe szedata
            /sbin/modprobe szedatax_c6pcr blocks=4096 block_size=4096
    

    or like this for COMBO6X card when using standard network interface:

            #!/bin/sh
            /sbin/modprobe combo6core
            /sbin/modprobe combo6x
            /sbin/modprobe combo6x-c6pcreth
    

  6. The NIC Card driver needs device files in the /dev/combosix/ and /dev/szedata/ directory. To create them, run the combo6devices and szedatadevices scripts in the packages directory base/sys_sw/drivers/linux. These devices are removed after reboot, so you need to run this script after each reboot.

            # ./combo6devices
            # ./szedatadevices
            

    To run NIC as a non-privileged user set r/w permissions on /dev/combosix/0 and /dev/szedata/0 devices.

    You have to change the permissions of the device files so that the non-privileged user that will execute the NIC tools has read-write access. For example, you can create a new group, say combo-rw, add that user to this group and change the file group ownership and permissions as follows:

            # chgrp combo-rw /dev/combosix/0 /dev/szedata/0
            # chmod 664 /dev/combosix/0 /dev/szedata/0
            

    Using recent 2.6 kernels it might be wanted to use the sysfs/udev mechanisms to create device files. For more details about udev see http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html

    Example udev rules are placed in the package in sys_sw/drivers/linux/combo6.udev.rules file. If you didn't use option --udev during package installation, copy this file to /etc/udev/rules.d directory and modify it (change group or permissions). Following line will create COMBO6X device files required by the NIC Card:

            KERNEL=="combosix[0-9]*", NAME="combosix/%n", GROUP="combo-rw", MODE="0664"
            KERNEL=="szedata[0-9]*", NAME="szedata/%n", GROUP="combo-rw", MODE="0664"
    

    Note

    Depending on your version of udevd you must adjust syntax of your udev rule file. Older versions of udevd require '=' character to match KERNEL key e.g. KERNEL="combosix[0-9]*". The newer one require '==' characters to match KERNEL key e.g. KERNEL=="combosix[0-9]*".

  7. Please copy (and rewrite any previous version) liberouterpkg script, located in the package base directory into your standard binary directory (e.g. /usr/local/bin/). This enables using liberouterpkg script as standard system tool

            $ liberouterpkg
            

    Note

    Path where the liberouterpkg script is placed must be different from used package installation path. More information about liberouterpkg can be found in the liberouterpkg section.

All NIC tools come with its manual pages so for information about any tool (included configuration files) you can see these man pages by man(1) program, e.g.

        $ man nic
        $ man nic.conf
        

Upgrading Package

The nic-2.0.0 is the Liberouter package using liberouterpkg tool enabling package switching and fully package uninstalling. If you have installed any previous Liberouter package without liberouterpkg, please remove it completely (including all libraries and drivers) to ensure proper behavior of the installed package.

More information about these features can be found in the liberouterpkg section.

If you are installing new version of previously installed package (e.g. you have installed nic-2.0.0 and now you are installing nic-2.0.1 package) you will be asked by pkgtool(1) to decide if you wish to keep your own (but may be obsolete) configuration files or to overwrite them with our default (but up-to-date) configuration files.

liberouterpkg Tool

liberouterpkg script is new tool covering new Liberouter package installation framework which enables safe and easy package uninstalling or simple package switching (and using different project packages on the same PC). To display all available functions of the liberouterpkg script use --help option

    $ liberouterpkg --help
    

liberouterpkg uses /etc/liberouter/packages.list configuration file that stores information about installed packages.

List of Installed Packages

liberouterpkg can be used to display list of all installed Liberouter packages

      # liberouterpkg --list
      # Installed packages:
      nic-2.0.0
      

or to display currently active package (only one package can be active at the same time)

      # liberouterpkg
      nic-2.0.0
      

Uninstalling Package

liberouterpkg tool is able to safely uninstall any previously installed Liberouter package (covered by new Liberouter package installation framework with liberouterpkg) by --uninstall=<PKG_ID> option where <PKG_ID> is a package identification string (that can be displayed by --list option)

      # liberouterpkg --uninstall=nic-2.0.0
      

Switching Packages

If you are using a nic package (nic-x.y.z package is active) you are unable to use tools from e.g. flowmon package. Using liberouterpkg script you can switch to any installed package and change this way currently active package. For switching packages use --switch=<PKG_ID> option where <PKG_ID> is a package identification string of a package that will be activated. List of available packages can be displayed by --list option)

      # liberouterpkg --switch=flowmon-1.3.0
      

Chapter 3. Configuration of the NIC Card

NIC Card configuration is based on nic.conf (5) configuration file located in the /etc/liberouter/ directory. This file stores e.g. network interfaces names and other network interfaces properties. nic.conf is connected to the NIC Card's starting scripts by the . (dot) shell command, so it is, actually, set of variable definitions and these variables are then used in our scripts. You can freely modify this file and redefine default values of the NIC settings. Such changes take effect after running the niclkm(1) and nic(1) scripts described in the next chapter.

The possible variables and their meanings are described in following sections.

Basic parameters

COMBO6_DEVICE
This variable contains path to the Combo6x device file.
FIRMWARE_PATH
Path to the storage of the firmware files. Value of this variable is automatically generated during building and installation process of the package.
FIRMWARE_ID
Hardware identification string for the Combo6x card.
FIRMWARE_PTM_RELPATH
Relative path from $FIRMWARE_PATH to the PTM firmware.
BINDIR
Path to installed programs.

Aggregation parameters

These variables are only used when aggregation is enabled by setting AGREGATOR="YES".

AGREGATOR
Set AGREGATOR="YES" to enable aggregation. Set to anything else or comment out to use standard network interfaces.
SZEDATA_BLOCK_SIZE
Size of one memory block allocated for szedata driver.
SZEDATA_BLOCKS
Number of blocks allocated for the szedata driver.
PTM_TIMESTAMPS
set PTM_TIMESTAMPS="YES" to use PTM card for packets timestamping.

Network interfaces parameters

These variables are ignored when aggregation is enabled by setting AGREGATOR="YES".

You need to specify four network interfaces (N=[0-3]).

C6ETHN_NAME
The interface name. Under Linux, interface names always begin with c6eth and then two digits are dynamically appended according to number of card plugged in PC and number of interface on the card. Concrete form of interface names you can get from output of the nic(1 ) script when the firmware is booted successfully. If the form of interface names is c6eth0X , you should see lines similar to these lines:
booting finished successfully
  c6eth03: Ethernet address ff:ff:ff:ff:ff:ff
C6ETHN_IP
Interface IP address.
C6ETHN_MASK
Interface network mask.

Chapter 4. Using NIC Card

Most of this chapter describes a single NIC Card design start - the NIC Card will not be automatically started again after rebooting PC. If you wish to start NIC Card anytime you will reboot the PC, please see the section called “init.d script”.

After building and installing package including post-install steps, all NIC Card tools are available as any other system tool. There are two main scripts to start NIC. Both scripts use the /etc/liberouter/nic.conf configuration file.

Loading kernel modules

For loading/removing NIC Card kernel modules the niclkm(1) script is used. This script must be executed with root privileges. There are two main options for this script. Option -l is used for loading NIC Card kernel modules. Modules are loaded appropriately to the selected mode (no aggregation, aggregation, ptm timestamps) in the nic.conf. Option -r is used to remove any modules previously loaded. Script supports only combo6x card. Detection of the card is performed by the lspci(8) utility.

Note

It may take udev(8) a while to create all necessary devices. Therefore running applications working with these devices (nic script) right after loading modules can fail with message:
Combosix device "/dev/combosix/0" doesn't exist.
Please create all necessary devices.
    
Just give udev(8) few seconds to do its job.

Note

Before using niclkm, make sure that NIC Card is not running. How to stop it is described in the section called “Setting up NIC Card”.

When all kernel modules are loaded, csid (1) is able to detect type of plugged cards and provide more detailed information. You should get following output on PC with installed combo6x mother card and sfpro add-on card:

$ csid
combo6x sfpro xc2vp20

Note

NIC design supports some other add-on cards (with some different chips), so don't worry about differing last two parts of the csid's output.

Setting up NIC Card

nic(1) is the main start up script for NIC design. Script boots firmware files (according to FIRMWARE_PATH variable from the /etc/liberouter/nic.conf) and configures combo card interfaces. To simply set up NIC, run nic script without any parameters:

$ nic

To shut down combo card interfaces and detach drivers (actually stop NIC), run the nic script with -s option:

$ nic -s

Note

User running the nic script have to has permissions to set up network interfaces.

Note

Running the nic script may sometimes end up with the message:
-----------------------------------------------------
Attaching driver
-----------------------------------------------------
csboot: unable to attach driver: Cannot allocate memory
/usr/local/liberouter/bin/nic: Failed to attach driver!
This error is caused by memory fragmentation and the solution is to reboot the machine.

More information about using nic script can be displayed by -h option.

Booted firmware can be checked by csid (1):

$ csid -s
Board    : combo6x
Addon    : sfpro
Chip     : xc2vp20
LAN ports: 4
Firmware : ok
SW       : 0x41c10200
HW       : 0x00030000
Text     : NIC_NetCOPE
PCI brver: c610.05.09 (2007/11/09 14:30) NetCOPE Bridge
PCI PPC  : [nic Nov  9 2007 21:02:59] 0xdeadbaff -booted- -running-

Standard Network Interfaces

To use NIC Card in a mode with standard network interfaces, which are configurable by e.g. ifconfig, you need to edit nic.conf configuration file. This file is described in Chapter 3, Configuration of the NIC Card.

  1. Make sure aggregation is not enabled, so that there is no AGREGATOR="YES" in the configuration file. You may for example comment out that line or set AGREGATOR="NO"

  2. Create/Edit configuration for all four network interfaces.

After saving your settings, run these commands:

# niclkm -l
$ nic

Note

Commands which begin with # must be run by root.

After the execution of those scripts NIC Card is started and ready to use. There are four new network interfaces in the system. Numbers in the interface names are set according to number of card plugged in the PC (the first digit) and according to number of interface (second digit).

You can check that NIC Card is set up correctly by setting desired IP address to NIC interfaces (via nic.conf or ifconfig) and then ping (8) it from PC connected to some NIC's port. NIC should answer to echo request by echo reply.

Aggregation Mode and Timestamps

To provide high throughput interface to access data from hardware, SZEDATA interface has been created in form of kernel modules szedata and szedatax_c6pcr. SZEDATA stands for straight zero-copy data interface API. More described in introduction section.

Use of NIC Card with SZEDATA interface is called Aggregation Mode.

To use NIC Card in aggregation mode you need to edit nic.conf configuration file. This file is described in Chapter 3, Configuration of the NIC Card.

  1. Enable aggregation by setting AGREGATOR="YES".

  2. Set memory size available to the szedata driver. Setting SZEDATA_BLOCKS="65536" and SZEDATA_BLOCK_SIZE="4096" should fit most cases.

  3. If you have a PTM installed on your system, you may also set PTM_TIMESTAMPS="YES" to use PTM card for packets timestamping.

After saving your settings, run these commands:

# niclkm -l
$ nic

Note

Commands which begin with # must be run by root.

After the execution of those scripts NIC Card is started and ready to use. There are eight new szedata interfaces in /dev/szedata/.

Data format

In this section is described format of data passed to software through szedata interface in NIC over NetCOPE card.

One block typically contains more data segments of variable length. Segment describes hardware data (hardware header) and content of one packet.

Length of whole segment is aligned to 8 bytes, although real length of data can be smaller - this empty gap must be skipped by application.

Table 4.1. Data format

Offset (bytes)Size (bytes)Description
02Segment size in bytes
22Size of hardware data
4Size of hardware dataHardware header
ALIGN(4 + Size of hardware data, 8)Segment size in bytes minus offsetSegment data (packet content), beginning aligned to 8 bytes

Example:
  • Segment size: 60 bytes with content [00 01 02 ...]
  • Header size: 3 bytes with content [a0 a1 a2]
  • Align gap: last 4 bytes with content [00 00 00 00]
 7  6  5  4  3  2  1  0

 00 a2 a1 a0 00 03 00 3c
 07 06 05 04 03 02 01 00
 0f 0e 0d 0c 0b 0a 09 08
 17 16 15 14 13 12 11 10
 1f 1e 1d 1c 1b 1a 19 18
 27 26 25 24 23 22 21 20
 2f 2e 2d 2c 2b 2a 29 28
 37 36 35 34 33 32 31 30
 00 00 00 00 3b 3a 39 38

More detailed format of hardware header in NIC over NetCOPE card:

Table 4.2. Hardware header format

Offset (bytes)Size (bytes)DescriptionValues and meaning
01Interface number0x1 - interface number 0, 0x2 - interface number 1, 0x4 - interface number 2, else - interface number 3
13Reserved 
48PTM hardware timestamp 

szeread - sample application

For demonstration of work with szedata interface in NIC over NetCOPE card, szeread application has been created.

This application counts all received packets and can write packet information and content either in human readable or in PCAP format.

Please, see documented source code.

Using libpcap Library

Well known libpcap library has been modified to support szedata interface as regular NIC. It allows to use widely used applications such as tcpdump, wireshark, nprobe or fprobe with benefits of Liberouter NIC Card or create new applications using PCAP API.

Detailed howto and examples can be found at tcpdump webpages (www.tcpdump.org)

To use libpcap-sze library, NIC Card must be run in Aggregation Mode, please see the section called “Aggregation Mode and Timestamps”.

Compiling libpcap with SZEDATA interface support

Modified libpcap-sze sources are located in package in nic-2.0.0/base/sys_sw/ports/libpcap-sze-0.9.8 directory. To compile libpcap with SZEDATA interface support follow these steps:

  1. Configure libpcap with specific parameters:

    ./configure --with-szedata=/absolute/path/to/linux/drivers --enable-ipv6
    e.g. ./configure --with-szedata=/home/foo/src/nic-2.0.0/base/sys_sw/drivers/linux/ --enable-ipv6
    

  2. Compile library (only static library is compiled as default):

    make
    

  3. Compile dynamic library by script mkshared.sh (optional):

    ./mkshared.sh
    

Check of compiled libraries

To check that libraries compiled well follow these steps:

  1. libpcap.a

    ar -t libpcap.a
    

    Output should look like this:

    pcap-sze.o
    

  2. libpcap.so

    nm libpcap.so | grep sze
    

    Output should look like this:

    00000000000142a0 T sze_datalink_op
    0000000000014590 T sze_interface
    00000000000145d0 T sze_mkpath
    0000000000014680 T sze_open_live
    00000000000142c0 T sze_platform_close
    00000000000142b0 T sze_platform_finddevs
    0000000000014330 T sze_read
    00000000000142e0 T sze_setfilter
    0000000000014260 T sze_stats
    

Compiling applications with created libpcap-sze

  1. For dynamic version (libpcap.so) add -L/path/to/libpcap-sze/ to LDFLAGS variable.

  2. For static version (libpcap.a) add -L/path/to/libpcap-sze/ -lpcap to compiler parameters.

Example using libpcap-sze - tcpdump

  1. Check if application we want to use is compiled with dynamic version of libpcap library:

    ldd $(which tcpdump)
    

    linux-vdso.so.1 =>  (0x00007fff837fe000)
    libpcap.so.0 => /usr/lib64/libpcap.so.0 (0x00002ada27630000)
    libc.so.6 => /lib64/libc.so.6 (0x00002ada2785d000)
    /lib64/ld-linux-x86-64.so.2 (0x00002ada27413000)
    

  2. Set LD_LIBRARY_PATH or LD_PRELOAD variables:

    export LD_LIBRARY_PATH=/path/to/libpcap/directory/
    

    or

    export LD_PRELOAD=/path/to/libpcap.so
    

  3. Run application with szedata interface as parameter szeX (X is number of card).

    tcpdump -i sze0
    

    Optionally particular port of NIC Card can be specified with szeX:N or szeX.N parameter (N is number of port - NIC interface).

    tcpdump -i sze0:2
    

init.d script

Startup scripts are used to start some service (or some script) at the machine's boot time. Our sample startup script is used to automatically start up the NIC (loads kernel modules, boots firmware and set up network interfaces) anytime your PC is starting up. Sample script is stored in the package directory structure in the base/sys_sw/projects/nic_netcope/doc directory as a nic.rc file. It is prepared for use in the SysV init system (tested on the Red Hat Linux distribution). Script is commented so you can get a lot of information directly from the script.

Provided sample startup script uses the nic.conf file.

Running startup script at the boot time

To run startup script at the boot time, follow these steps

  1. Copy sample script to the /etc/rc.d/init.d/ directory and rename it to the nic.

  2. Run chkconfig(8 ) and add nic as new service:

    # chkconfig --add nic

    To verify, everything is right, you can try to find nic in the list of services:

    $ chkconfig --list | grep nic

  3. Reboot your system.

Stopping Combo NIC service

To stop NIC Card (shut down interfaces, detach drivers and unload kernel modules) go to the /etc/rc.d/init.d/ directory and use following command:

# ./nic stop

This command causes stopping NIC but the service will be started again during the next reboot. To switch off the NIC service, in the current runlevel, use chkconfig(8) with off option after service name (nic in our case):

# chkconfig nic off

Last possibility is to remove NIC service from chkconfig management:

# chkconfig --del nic

Note

More detailed information you can find in the chkconfig's man page.

Status of the NIC service

To show current status of the Combo NIC use argument status:

# ./nic status

Changing speed on interface

For correct functionality changing the speed requires two steps. First the transceiver speed must be changed using the tool phyterctl(1). Next the IBUF component speed needs to be updated corresponding to the transceiver speed using the tool ibufctl(1).

phyterctl(1) is a tool used to display and change configuration of 4 interfaces available on COMBO-4SFPRO add-on cards. The tool displays information about link status, resolved speed or duplex mode on link. phyterctl(1) is also able to change the advertised speed and duplex mode and provides r/w access to internal registers of the physical layer IC.

ibufctl(1) is used to display and change configuration of IBUF components in COMBO6X designs.

Example of changing the speed on interface 0 to 100Mbps.

	$ phyterctl -c speed 100 -i0 ... set transceiver speed to 100Mbps on interface 0
	$ ibufctl -s100 -i0 ... set IBUF speed to 100Mbps on interface 0

Example of phyterctl(1) listing with GBIC EEPROM information:

	$ phyterctl -c gbic
	Settings for card 0 (device /dev/combosix/0):
	------------------------------ Interface 0 ---
	Transceiver      FINISAR CORP.
	Model		 FCMJ-8521-3
	Phyter vendor    MARVELL
	Phyter model     88E1111 Gigabit PHY
	Speed            1000 Mb/s
	Mode             Full-duplex
	Link status      Up
	------------------------------ Interface 1 ---
	Transceiver      FINISAR CORP.
	Model            FCMJ-8521-3
	Phyter vendor    MARVELL
	Phyter model     88E1111 Gigabit PHY
	Speed            1000 Mb/s
	Mode             Full-duplex
	Link status      Up
	------------------------------ Interface 2 ---
	Transceiver      FINISAR CORP.
	Model            FCMJ-8521-3
	Phyter vendor    MARVELL
	Phyter model     88E1111 Gigabit PHY
	Link status      Down
	------------------------------ Interface 3 ---
	Transceiver      FINISAR CORP.
	Model            FCMJ-8521-3
	Phyter vendor    MARVELL
	Phyter model     88E1111 Gigabit PHY
	Speed            1000 Mb/s
	Mode             Full-duplex
	Link status      Up
	

More information can be found in the phyterctl(1) and ibufctl(1) man pages or in the README files placed in the base/sys_sw/hwtools/phyter/ and base/sys_sw/hwtools/ibufctl/ directories.

Note

COMBO card doesn't support autonegotiation and autoswitching between 10Mbps/100Mbps/1000Mbps. You need to use phyterctl(1) and ibufctl(1) tools.

Connecting PORTs, INPUTs and OUTPUTs

Crossbar component provides option that every PORT (RX part) and INPUT can be assigned to zero or more PORTS (TX part) or OUTPUTS. Vice versa, every PORT (TX part) and OUTPUT must have assigned exactly one of PORTS (RX part) or INPUTS.

crossbarctl(1) is a command line tool used to display current configuration and to connect ports, outputs and inputs.

Figure 4.1. Crossbar default state

Crossbar default state


$ crossbarctl -l
p0 <== obuf0
p1 <== obuf1
p2 <== obuf2
p3 <== obuf3
--------
ibuf0 <== p0
ibuf1 <== p1
ibuf2 <== p2
ibuf3 <== p3

Example of connecting OUTPUT2 with INPUT3.

$ crossbarctl -s obuf2 -t ibuf3 

Example of connecting PORT1 with INPUT3.

$ crossbarctl -s p1 -t ibuf2

More information can be found in the crossbarctl(1) man page.

Devices' properties

Information about created devices /dev/combosix/* and /dev/szedata/* are held after creation in /proc directory.

/dev/combosix/*

General information about /dev/combosix/* devices are stored in /proc/driver/combo6 directory. Information about /dev/combosix/X devices are stored in /proc/driver/cardX subdirectories, where X stands for device number.

Driver version:

$ cat /proc/driver/combo6/version 
Combo6 Driver Version 0.3.57.
Compiled on Feb 14 2008 09:11:04 for kernel 2.6.9-11.EL.

Additional information:

$ cat /proc/driver/combo6/card0/id 
Board    : combo6x
Addon    : sfpro
Chip     : xc2vp20
LAN ports: 4
Firmware : none
SW       : 0x00000000
HW       : 0x00000000
Text     : unknown
PCI brver: c610.05.0a (2007/11/22 19:55) NetCOPE Bridge
PCI PPC  : [] 0x0 -not loaded- -inactive-

Device [combo6x] c6pcreth
(0xabcdef02-0xabcdef02) {}: inactive
Device [combo6x] c6pcreth
(0x4f1c0000-0x4f1c0000) {NIFIC_1Gbps}: inactive
Device [combo6x] c6pcreth
(0x4f1c0000-0x4f1c0000) {Nific4_1Gb_COMBO6X}: inactive
Device [combo6x] c6pcreth
(0x4f1c0101-0x4f1c01ff) {Liberouter (4-NIC filtration)}: inactive
Device [combo6x] c6pcreth
(0x4f1c0100-0x4f1c01ff) {NIFIC_NetCOPE}: inactive
Device [combo6x] netcope-pcreth
(0x41c10200-0x41c102ff) {NIC_NetCOPE}: inactive
Device [combo6x] netflow-ph1-pcr
(0xf1010001-0xf10102ff) {NETFLOW_1Gbps_Probe}: inactive
Device [combo6x] scampi-ph2-pcr
(0x5ca20001-0x5ca20001) {SCAMPI 10Gbps Monitoring adapter}:
inactive
Device [combo6x] scampi-ids1-pcr
(0x1d510001-0x1d510001) {IDS_1Gbps_Traffic_Scanner}: inactive
Device [combo6x] scampi-ids2-pcr
(0x1d510200-0x1d510200) {IDS_1Gbps_Traffic_Scanner}:
inactive

/dev/szedata/*

General information about /dev/szedata/* devices are stored in /proc/driver/szedata directory. Information about /dev/szedata/X devices are stored in /proc/driver/szedata/deviceX subdirectories, where X stands for device number.

Version:

$ cat /proc/driver/szedata/version
SZEData Driver Version 0.3.57.
Compiled on Feb 14 2008 09:11:14 for kernel 2.6.9-11.EL.

Statistics:

cat /proc/driver/szedata/device0/stats 
General:
Alloc blocks:         65536		/* number of allocated blocks */
Alloc bsize:          4096		/* allocated block size */
Alloc mmap:           268435456		/* allocated memory - product of two numbers above */
Alloc failed:         0			/* failed allocations */
Alloc over:           0			
Active apps:          00000001		/* number of active applications using szedata interface */
Running apps:         00000001		/* number of running applications using szedata interface */
Application #0:				/* INFORMATION about running applications */
Subs. interfaces:     0000000f		/* subscribed interfaces mask - 0000000f means interfaces 0,1,2,3 */
Waiting packets:      0			
Waiting peak pkts:    1			
Poll threshold:       1			 
Total locks:          497
Total unlocks:        497
Application #1:
Subs. interfaces:     00000000
Waiting packets:      0
Waiting peak pkts:    0
Poll threshold:       0
Total locks:          0
Total unlocks:        0
Application #2:
Subs. interfaces:     00000000
Waiting packets:      0
Waiting peak pkts:    0
Poll threshold:       0
Total locks:          0
Total unlocks:        0
Application #3:
Subs. interfaces:
00000000
Waiting packets:      0
Waiting peak pkts:    0
Poll threshold:       0
Total locks:          0
Total unlocks:        0

Chapter 5. Known HW and SW Limitations, Problems

There are currently no known HW or SW limitations, in case that any will show up, they should be listed here.

Chapter 6. FAQ

Chapter 7. Contacting the NIC Card Team

Submitting Problem Reports

Suggestions, bug reports and contributions of code are always valued. Please do not hesitate to report any problems you may find. If you encounter any suspicious behavior of your NIC Card please contact us.

How to Report a Bug

Before submitting a problem, be sure you are running the latest NIC Card package version. Please send the following information to us:

  • Description of the buggy behavior, including operating system type, kernel version and anything else that causes the bug to appear.

  • The exact and complete text of any error messages printed or logged.

  • Exactly what you typed or did to demonstrate the problem.

  • A suggested fix, or even a patch, if you have one.

This will help us track the problem and resolve it. Bug reports with attached fixes are of course even more welcome.

Other COMBO6(X) Based Projects

Check our web pages for information about other projects, e.g. FlowMon (flexible flow monitoring system) or intrusion detection system.

http://www.liberouter.org/

Chapter 8. NIC Card Developers Team

We would like to acknowledge and thank to developers who contributed on the NIC Card project. This is the list of those developers in alphabetical order.

Andrej Hank
Software tools
Juraj Blaho
Startup scripts
Tomas Konir
PCAP library port
Petr Kastovsky
DMA Controller, drivers
Petr Kobiersky
Interconnection system on FPGA
Martin Kosek
Firmware design and maintenace
Radek Krejci
package installation framework
Vojtech Krmicek
NIC Card Handbook
Jaroslav Kysela
Drivers
Jiri Slaby
Drivers
Tomas Martinek
DMA transfers
Libor Polcak
Network interface buffers
Michal Trunecka
Testing
Kamil Vesely
Testing

Appendix A. References

Table of Contents

Bibliography

Bibliography

[CoHW] The Liberouter Project Team. Description of COMBO cards, http://www.liberouter.org/hardware.php .