16. dpdk-graph Application
The dpdk-graph
tool is a Data Plane Development Kit (DPDK)
application that allows exercising various graph use cases.
This application has a generic framework to add new graph based use cases
to verify functionality.
Each use case is defined as a <usecase>.cli
file.
Based on the input file, application creates a graph to cater the use case.
Also this application framework can be used by other graph-based applications.
16.1. Running the Application
The application has a number of command line options which can be provided in following syntax:
dpdk-graph [EAL Options] -- [application options]
16.1.1. EAL Options
Following are the EAL command-line options that can be used in conjunction
with the dpdk-graph
application.
See the DPDK Getting Started Guides for more information on these options.
-c <COREMASK>
or -l <CORELIST>
Set the hexadecimal bit mask of the cores to run on. The CORELIST is a list of cores to be used.
16.1.2. Application Options
Following are the application command-line options:
-h
Set the host IPv4 address over which telnet session can be opened. It is an optional parameter. Default host address is
0.0.0.0
.
-p
- Set the L4 port number over which telnet session can be opened.
It is an optional parameter. Default port is
8086
.
-s
Script name with absolute path which specifies the use case. It is a mandatory parameter which will be used to create desired graph for a given use case.
--enable-graph-stats
Enable graph statistics printing on console. By default, graph statistics are disabled.
--help
Dumps application usage.
16.2. Supported Use cases
16.2.1. l3fwd
This use case is supported for both H/W and PCAP vdev network devices.
To demonstrate, corresponding .cli
files are available at app/graph/examples/
named as l3fwd.cli
and l3fwd_pcap.cli
respectively.
16.2.1.1. Example Commands
For H/W devices
./dpdk-graph -c 0xff -a 0002:02:00.0 -a 0002:03:00.0 --
-s <dpdk_root_dir>/app/graph/examples/l3fwd.cli
For net_pcapX devices
./dpdk-graph -c 0xff --vdev=net_pcap0,rx_pcap=in_net_pcap0.pcap,tx_pcap=out_net_pcap1.pcap
--vdev=net_pcap1,rx_pcap=in_net_pcap1.pcap,tx_pcap=out_net_pcap0.pcap
-- -s <dpdk_root_dir>/app/graph/examples/l3fwd_pcap.cli
16.2.1.2. Verifying traffic
l3fwd.cli
and l3fwd_pcap.cli
creates setup with two network ports.
Routing between these ports are done by lookup node routing information.
For current use case, following routing table is used:
DIP port
10.0.2.2 1
20.0.2.2 0
On the successful execution of l3fwd.cli
or l3fwd_pcap.cli
,
user needs to send traffic with mentioned DIP.
For net_pcapX devices, required pcap file should be created and passed to application. These pcap files can be created in several ways. Scapy is one of the method to get the same:
# scapy
>>> pkts=[Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="28.0.0.1", dst="10.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="28.0.0.1", dst="10.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="28.0.0.1", dst="10.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="28.0.0.1", dst="10.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="28.0.0.1", dst="10.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="28.0.0.1", dst="10.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="28.0.0.1", dst="10.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="28.0.0.1", dst="10.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="28.0.0.1", dst="10.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="28.0.0.1", dst="10.0.2.2")]
>>>
>>> wrpcap("in_net_pcap1.pcap",pkts)
>>>
>>> pkts=[Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="29.0.0.1", dst="20.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="29.0.0.1", dst="20.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="29.0.0.1", dst="20.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="29.0.0.1", dst="20.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="29.0.0.1", dst="20.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="29.0.0.1", dst="20.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="29.0.0.1", dst="20.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="29.0.0.1", dst="20.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="29.0.0.1", dst="20.0.2.2"),
Ether(dst="FA:09:F9:D7:E0:9D", src="10:70:1d:2f:42:2d")/IP(src="28.0.0.1", dst="20.0.2.2")]
>>>
>>> wrpcap("in_net_pcap0.pcap",pkts)
>>> quit
16.3. Supported CLI commands
This section provides details on commands which can be used in <usecase>.cli
file to express the requested use case configuration.
Command |
Description |
Dynamic |
Optional |
---|---|---|---|
graph <usecases> [bsz <size>]
[tmo <ns>] [coremask <bitmask>]
model <rtc/mcd/default> pcap_enable
<0/1> num_pcap_pkts <num> pcap_file
<output_capture_file>
|
Command to express the desired
use case. Also enables/disable
pcap capturing.
|
No |
No |
graph start |
Command to start the graph.
This command triggers that no
more commands are left to be
parsed and graph initialization
can be started now. It must be
the last command in usecase.cli
|
No |
No |
graph stats show |
Command to dump current graph
statistics.
|
Yes |
Yes |
help graph |
Command to dump graph help
message.
|
Yes |
Yes |
mempool <mempool_name> size
<mbuf_size> buffers
<number_of_buffers>
cache <cache_size> numa <numa_id>
|
Command to create mempool which
will be further associated to
RxQ to dequeue the packets.
|
No |
No |
help mempool |
Command to dump mempool help
message.
|
Yes |
Yes |
ethdev <ethdev_name> rxq <n_queues>
txq <n_queues> <mempool_name>
|
Command to create DPDK port with
given number of Rx and Tx queues
. Also attach RxQ with given
mempool. Each port can have
single mempool only i.e. all
RxQs will share the same mempool
.
|
No |
No |
ethdev <ethdev_name> mtu <mtu_sz> |
Command to configure MTU of DPDK
port.
|
Yes |
Yes |
ethdev <ethdev_name> promiscuous
<on/off>
|
Command to enable/disable
promiscuous mode on DPDK port.
|
Yes |
Yes |
ethdev <ethdev_name> show |
Command to dump current ethdev
configuration.
|
Yes |
Yes |
ethdev <ethdev_name> stats |
Command to dump current ethdev
statistics.
|
Yes |
Yes |
ethdev <ethdev_name> ip4 addr add
<ip> netmask <mask>
|
Command to configure IPv4
address on given PCI device. It
is needed if user wishes to use
ipv4_lookup node. |
Yes |
Yes |
ethdev <ethdev_name> ip6 addr add
<ip> netmask <mask>
|
Command to configure IPv6
address on given PCI device. It
is needed if user wishes to use
ipv6_lookup node. |
Yes |
Yes |
help ethdev |
Command to dump ethdev help
message.
|
Yes |
Yes |
ipv4_lookup route add ipv4 <ip>
netmask <mask> via <ip>
|
Command to add a route into
ipv4_lookup LPM table. It isneeded if user wishes to route
the packets based on LPM lookup
table.
|
Yes |
Yes |
help ipv4_lookup |
Command to dump
ipv4_lookup help message.
|
Yes |
Yes |
ipv6_lookup route add ipv6 <ip>
netmask <mask> via <ip>
|
Command to add a route into
ipv6_lookup LPM table. It isneeded if user wishes to route
the packets based on LPM6 lookup
table.
|
Yes |
Yes |
help ipv6_lookup |
Command to dump
ipv6_lookup help message.
|
Yes |
Yes |
neigh add ipv4 <ip> <mac> |
Command to add a neighbour
information into
ipv4_rewrite node. |
Yes |
Yes |
neigh add ipv6 <ip> <mac> |
Command to add a neighbour
information into
ipv6_rewrite node. |
Yes |
Yes |
help neigh |
Command to dump neigh help
message.
|
Yes |
Yes |
ethdev_rx map port <ethdev_name>
queue <q_num> core <core_id>
|
Command to add port-queue-core
mapping to
ethdev_rx node.ethdev_rx node instance willbe pinned on given core and will
poll on requested port/queue
pair.
|
No |
No |
help ethdev_rx |
Command to dump ethdev_rx help
message.
|
Yes |
Yes |
16.4. Runtime configuration
Application allows some configuration to be modified at runtime using a telnet session.
Application initiates a telnet server with host address 0.0.0.0
and port number 8086
by default.
If user passes -h
and -p
options while running application,
then corresponding IP address and port number will be used for telnet session.
After successful launch of application,
client can connect to application using given host & port
and console will be accessed with prompt graph>
.
Command to access a telnet session:
telnet <host> <port>
Example: dpdk-graph
is started with -h 10.28.35.207
and -p 50000
then
$ telnet 10.28.35.207 50000
Trying 10.28.35.207...
Connected to 10.28.35.207.
Escape character is '^]'.
Welcome!
graph>
graph>
graph> help ethdev
----------------------------- ethdev command help -----------------------------
ethdev <ethdev_name> rxq <n_queues> txq <n_queues> <mempool_name>
ethdev <ethdev_name> ip4 addr add <ip> netmask <mask>
ethdev <ethdev_name> ip6 addr add <ip> netmask <mask>
ethdev <ethdev_name> promiscuous <on/off>
ethdev <ethdev_name> mtu <mtu_sz>
ethdev <ethdev_name> stats
ethdev <ethdev_name> show
graph>
To exit the telnet session, type Ctrl + ]
.
This changes the graph>
command prompt to telnet>
command prompt.
Now running close
or quit
command on telnet>
prompt
will terminate the telnet session.
16.5. Created graph for use case
On the successful execution of <usecase>.cli
file, corresponding graph will be created.
This section mentions the created graph for each use case.