Imported Upstream version 16.04
[deb_dpdk.git] / doc / guides / sample_app_ug / intel_quickassist.rst
1 ..  BSD LICENSE
2     Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
3     All rights reserved.
4
5     Redistribution and use in source and binary forms, with or without
6     modification, are permitted provided that the following conditions
7     are met:
8
9     * Redistributions of source code must retain the above copyright
10     notice, this list of conditions and the following disclaimer.
11     * Redistributions in binary form must reproduce the above copyright
12     notice, this list of conditions and the following disclaimer in
13     the documentation and/or other materials provided with the
14     distribution.
15     * Neither the name of Intel Corporation nor the names of its
16     contributors may be used to endorse or promote products derived
17     from this software without specific prior written permission.
18
19     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22     A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23     OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25     LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31 Intel® QuickAssist Technology Sample Application
32 ================================================
33
34 This sample application demonstrates the use of the cryptographic operations provided
35 by the Intel® QuickAssist Technology from within the DPDK environment.
36 Therefore, building and running this application requires having both the DPDK and
37 the QuickAssist Technology Software Library installed, as well as at least one
38 Intel® QuickAssist Technology hardware device present in the system.
39
40 For this sample application, there is a dependency on either of:
41
42 *   Intel® Communications Chipset 8900 to 8920 Series Software for Linux* package
43
44 *   Intel® Communications Chipset 8925 to 8955 Series Software for Linux* package
45
46 Overview
47 --------
48
49 An overview of the application is provided in :numref:`figure_quickassist_block_diagram`.
50 For simplicity, only two NIC ports and one Intel® QuickAssist Technology device are shown in this diagram,
51 although the number of NIC ports and Intel® QuickAssist Technology devices can be different.
52
53 .. _figure_quickassist_block_diagram:
54
55 .. figure:: img/quickassist_block_diagram.*
56
57    Intel® QuickAssist Technology Application Block Diagram
58
59
60 The application allows the configuration of the following items:
61
62 *   Number of NIC ports
63
64 *   Number of logical cores (lcores)
65
66 *   Mapping of NIC RX queues to logical cores
67
68 Each lcore communicates with every cryptographic acceleration engine in the system through a pair of dedicated input - output queues.
69 Each lcore has a dedicated NIC TX queue with every NIC port in the system.
70 Therefore, each lcore reads packets from its NIC RX queues and cryptographic accelerator output queues and
71 writes packets to its NIC TX queues and cryptographic accelerator input queues.
72
73 Each incoming packet that is read from a NIC RX queue is either directly forwarded to its destination NIC TX port (forwarding path)
74 or first sent to one of the Intel® QuickAssist Technology devices for either encryption or decryption
75 before being sent out on its destination NIC TX port (cryptographic path).
76
77 The application supports IPv4 input packets only.
78 For each input packet, the decision between the forwarding path and
79 the cryptographic path is taken at the classification stage based on the value of the IP source address field read from the input packet.
80 Assuming that the IP source address is A.B.C.D, then if:
81
82 *   D = 0: the forwarding path is selected (the packet is forwarded out directly)
83
84 *   D = 1: the cryptographic path for encryption is selected (the packet is first encrypted and then forwarded out)
85
86 *   D = 2: the cryptographic path for decryption is selected (the packet is first decrypted and then forwarded out)
87
88 For the cryptographic path cases (D = 1 or D = 2), byte C specifies the cipher algorithm and
89 byte B the cryptographic hash algorithm to be used for the current packet.
90 Byte A is not used and can be any value.
91 The cipher and cryptographic hash algorithms supported by this application are listed in the crypto.h header file.
92
93 For each input packet, the destination NIC TX port is decided at the forwarding stage (executed after the cryptographic stage,
94 if enabled for the packet) by looking at the RX port index of the dst_ports[ ] array,
95 which was initialized at startup, being the outport the adjacent enabled port.
96 For example, if ports 1,3,5 and 6 are enabled, for input port 1, outport port will be 3 and vice versa,
97 and for input port 5, output port will be 6 and vice versa.
98
99 For the cryptographic path, it is the payload of the IPv4 packet that is encrypted or decrypted.
100
101 Setup
102 ~~~~~
103
104 Building and running this application requires having both the DPDK package and
105 the QuickAssist Technology Software Library installed,
106 as well as at least one Intel® QuickAssist Technology hardware device present in the system.
107
108 For more details on how to build and run DPDK and Intel® QuickAssist Technology applications,
109 please refer to the following documents:
110
111 *   *DPDK Getting Started Guide*
112
113 *   Intel® Communications Chipset 8900 to 8920 Series Software for Linux* Getting Started Guide (440005)
114
115 *   Intel® Communications Chipset 8925 to 8955 Series Software for Linux* Getting Started Guide (523128)
116
117 For more details on the actual platforms used to validate this application, as well as performance numbers,
118 please refer to the Test Report, which is accessible by contacting your Intel representative.
119
120 Building the Application
121 ------------------------
122
123 Steps to build the application:
124
125 #.  Set up the following environment variables:
126
127     .. code-block:: console
128
129         export RTE_SDK=<Absolute path to the DPDK installation folder>
130         export ICP_ROOT=<Absolute path to the Intel QAT installation folder>
131
132 #.  Set the target (a default target is used if not specified). For example:
133
134     .. code-block:: console
135
136         export RTE_TARGET=x86_64-native-linuxapp-gcc
137
138     Refer to the *DPDK Getting Started Guide* for possible RTE_TARGET values.
139
140 #.  Build the application:
141
142     .. code-block:: console
143
144         cd ${RTE_SDK}/examples/dpdk_qat
145         make
146
147 Running the Application
148 -----------------------
149
150 Intel® QuickAssist Technology Configuration Files
151 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
152
153 The Intel® QuickAssist Technology configuration files used by the application are located in the config_files folder in the application folder.
154 There following sets of configuration files are included in the DPDK package:
155
156 *   Stargo CRB (single CPU socket): located in the stargo folder
157
158     *   dh89xxcc_qa_dev0.conf
159
160 *   Shumway CRB (dual CPU socket): located in the shumway folder
161
162     *   dh89xxcc_qa_dev0.conf
163
164     *   dh89xxcc_qa_dev1.conf
165
166 *   Coleto Creek: located in the coleto folder
167
168     *   dh895xcc_qa_dev0.conf
169
170 The relevant configuration file(s) must be copied to the /etc/ directory.
171
172 Please note that any change to these configuration files requires restarting the Intel®
173 QuickAssist Technology driver using the following command:
174
175 .. code-block:: console
176
177     # service qat_service restart
178
179 Refer to the following documents for information on the Intel® QuickAssist Technology configuration files:
180
181 *   Intel®  Communications Chipset 8900 to 8920 Series Software Programmer's Guide
182
183 *   Intel®  Communications Chipset 8925 to 8955 Series Software Programmer's Guide
184
185 *   Intel®  Communications Chipset 8900 to 8920 Series Software for Linux* Getting Started Guide.
186
187 *   Intel®  Communications Chipset 8925 to 8955 Series Software for Linux* Getting Started Guide.
188
189 Traffic Generator Setup and Application Startup
190 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
191
192 The application has a number of command line options:
193
194     dpdk_qat [EAL options] -- -p PORTMASK [--no-promisc] [--config '(port,queue,lcore)[,(port,queue,lcore)]']
195
196 where,
197
198 *   -p PORTMASK: Hexadecimal bitmask of ports to configure
199
200 *   --no-promisc: Disables promiscuous mode for all ports,
201     so that only packets with the Ethernet MAC destination address set to the Ethernet address of the port are accepted.
202     By default promiscuous mode is enabled so that packets are accepted regardless of the packet's Ethernet MAC destination address.
203
204 *   --config'(port,queue,lcore)[,(port,queue,lcore)]':  determines which queues from which ports are mapped to which cores.
205
206 Refer to the :doc:`l3_forward` for more detailed descriptions of the --config command line option.
207
208 As an example, to run the application with two ports and two cores,
209 which are using different Intel® QuickAssist Technology execution engines,
210 performing AES-CBC-128 encryption with AES-XCBC-MAC-96 hash, the following settings can be used:
211
212 *   Traffic generator source IP address: 0.9.6.1
213
214 *   Command line:
215
216     .. code-block:: console
217
218         ./build/dpdk_qat -c 0xff -n 2 -- -p 0x3 --config '(0,0,1),(1,0,2)'
219
220 Refer to the *DPDK Test Report* for more examples of traffic generator setup and the application startup command lines.
221 If no errors are generated in response to the startup commands, the application is running correctly.