Anda di halaman 1dari 4

1. Accolade Support — PF_RING 7.0 documentation http://www.ntop.org/guides/pf_ring/modules/acc...

Docs » Drivers and Modules » 1. Accolade Support

1. Accolade Support

1.1. Prerequisite
PF_RING has na�ve support for Accolade adapters, the Accolade SDK (v.1.2.26 or later) needs to
be installed (under /opt/accolade) in order to enable the Accolade module at run�me.

1.2. Installation
In order to install the Accolade SDK and drivers run the following commands:

tar xvzf SDK_*.tgz


cd SDK_*
cd drv; sudo make install; cd ..
cd lib; sudo make install; cd ..
sudo sh -c "echo /opt/accolade/lib/ > /etc/ld.so.conf.d/accolade.conf"

Before running any applica�on please load the driver with:

sudo sh -c "echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages"


sudo insmod /opt/accolade/driver/anic_mem.ko mbytes_per_device=64
sudo /opt/accolade/bin/anic_load

If you are running an old firmware and you need to update it, you should run the following
commands:

cd SDK_*/tools/; make
gunzip fpga_*.rbt.gz
sudo ./anic_fwupdate --id 0 --script fpga_*.rbt
sudo reboot

Now you are ready to compile and run PF_RING with Accolade support. Note that if you are
installing pfring from packages, Accolade support is already enabled.

cd PF_RING/kernel; make
sudo insmod pf_ring.ko; cd ..
cd userland; ./configure
cd lib; make; cd ..
cd libpcap; ./configure; make; cd ..
cd examples; make
sudo ./pfcount -i anic:0

1 di 4 13/07/18, 09:14
Please note that:
in Support
1. Accolade order to open port 0 from
— PF_RING adapter 0 you should specify
7.0 documentation anic:DEV:PORT, example:
http://www.ntop.org/guides/pf_ring/modules/acc...

pfcount -i anic:0:0

or just anic:PORT when using the default adapter 0, example:

pfcount -i anic:0

Opening a port this way, the full card is ini�alised, causing issues when opening other ports later
(previous ports stop working), this can be avoided using the port-to-ring binding as explained later
on. - in order to open ring 0 from adapter 0 you should specify anic:DEV@RING, example:

pfcount -i anic:0@0

This is usually used in combina�on with anic_rx_block_mfl which is used to setup the card for
mul�-process applica�ons.

Example of ports aggrega�on and load-balancing to 2 rings:

anic_rx_block_mfl -i 0 --mode=2

Example of port-to-ring (ring 0 is port 0) binding:

anic_rx_block_mfl -i 0 --mode=port

1.3. Accolade and Packet Copy


If you use the PF_RING (non-ZC) API packets are read in zero-copy. Instead if you use PF_RING ZC
API, a per-packet copy takes place, which is required to move payload data from Accolade memory
to ZC memory. Keep this in mind!

1.4. Hw Filtering
Accolade adapters support packet filtering in hw. In order to set an hw filter there are two op�ons:

Using the standard BPF filter: PF_RING thanks to the nBPF library automa�cally translates BPF
filters into hw filters
Using the pfring_add_hw_rule() API.
2 di 4 13/07/18, 09:14

When using the pfring_add_hw_rule() API, as first ac�on we need to set the default behaviour for
packets,
1. Accolade this can
Support — be ‘pass’ or7.0
PF_RING ‘drop’. Example:
documentation http://www.ntop.org/guides/pf_ring/modules/acc...

hw_filtering_rule r;
r.rule_family_type = accolade_default;
r.rule_family.accolade_rule.action = accolade_pass;
pfring_add_hw_rule(pd, &r);

In order to set a filtering rule, we need to create a rule and assign a rule ID, which is a unique
iden�fier for the rule. A standard Accolade firmware supports up to 32 rules (called ‘legacy mode’
or ‘mode 1’), with IDs from 0 to 31. Enhanced Accolade firmwares for 100 Gbit adapters can
support up to 1000 rules, with IDs from 0 to 999 (called ‘mode 2’). PF_RING automa�cally select
‘mode 2’ when available, and ‘mode 1’ as fallback. It is possible to use the
FILTERING_RULE_AUTO_RULE_ID macro as rule.rule_id in order to automa�cally assign the next
available rule ID. Example of se�ng a filtering rule with ‘drop’ ac�on for an IPv4 packet:

hw_filtering_rule r = { 0 };
r.rule_id = rule_id++;
r.rule_family_type = accolade_rule;
r.rule_family.accolade_rule.action = accolade_drop;
r.rule_family.accolade_rule.ip_version = h->extended_hdr.parsed_pkt.ip_version;
r.rule_family.accolade_rule.src_addr_bits = 32;
r.rule_family.accolade_rule.src_addr.v4 = h->extended_hdr.parsed_pkt.ipv4_src;
r.rule_family.accolade_rule.dst_addr_bits = 32;
r.rule_family.accolade_rule.dst_addr.v4 = h->extended_hdr.parsed_pkt.ipv4_dst;
r.rule_family.accolade_rule.protocol = h->extended_hdr.parsed_pkt.l3_proto;
r.rule_family.accolade_rule.src_port_low = h->extended_hdr.parsed_pkt.l4_src_port;
r.rule_family.accolade_rule.dst_port_low = h->extended_hdr.parsed_pkt.l4_dst_port;
pfring_add_hw_rule(pd, &r);

Please note that all fields are in host byte order.

For a full list of supported fields please take a look at the hw_filtering_rule struct. Please also note
that mode 1 and 2 support different fields, please refer to the fields descrip�on to check what is
supported in each mode.

Example of removing a filtering rule by id:

pfring_remove_hw_rule(pd, rule_id);

1.5. TX DMA
If you have an Accolade adapter (e.g. 200Ku-Flex) with a firmware suppor�ng TX DMA for
replaying PCAP files at line-rate up to 100G, you need to enable both 2MB and 1G hugepages.

First of all you should check that your CPU supports 1G hugepages, running the command below
you should get some output:

3 di 4 grep pdpe1gb /proc/cpuinfo 13/07/18, 09:14


In order
1. Accolade to make
Support — sure that the
PF_RING 7.0system is able to reservehttp://www.ntop.org/guides/pf_ring/modules/acc...
documentation 1G pages from physical memory, it is
recommended to add the boot parameters below to GRUB_CMDLINE_LINUX in /etc/default/grub:

default_hugepagesz=2MB hugepagesz=1GB hugepages=1 hugepagesz=2M hugepages=1024

In order to apply the changes, update grub and reboot the system:

sudo update-grub
sudo reboot

A�er reboo�ng the system, you should mount the hugepages and reload the Accolade driver:

sudo sh -c "echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages"


sudo mkdir /mnt/hugetlbfs1G
sudo mount -t hugetlbfs none -opagesize=1G /mnt/hugetlbfs1G
sudo insmod /opt/accolade/driver/anic_mem.ko mbytes_per_device=64
sudo /opt/accolade/bin/anic_load

At this point you should be finally able to run the TX tool provided by Accolade, example:

cd SDK_*/examples/; make
sudo ./anic_200k_tx -i 0 -p 0 -r 1000000 mixed.pcap

4 di 4 13/07/18, 09:14

Anda mungkin juga menyukai