New upstream version 17.11-rc3
[deb_dpdk.git] / doc / guides / cryptodevs / mrvl.rst
1 ..  BSD LICENSE
2     Copyright(c) 2017 Marvell International Ltd.
3     Copyright(c) 2017 Semihalf.
4     All rights reserved.
5
6     Redistribution and use in source and binary forms, with or without
7     modification, are permitted provided that the following conditions
8     are met:
9
10       * Redistributions of source code must retain the above copyright
11         notice, this list of conditions and the following disclaimer.
12       * Redistributions in binary form must reproduce the above copyright
13         notice, this list of conditions and the following disclaimer in
14         the documentation and/or other materials provided with the
15         distribution.
16       * Neither the name of the copyright holder nor the names of its
17         contributors may be used to endorse or promote products derived
18         from this software without specific prior written permission.
19
20     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23     A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24     OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26     LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 MRVL Crypto Poll Mode Driver
33 ============================
34
35 The MRVL CRYPTO PMD (**librte_crypto_mrvl_pmd**) provides poll mode crypto driver
36 support by utilizing MUSDK library, which provides cryptographic operations
37 acceleration by using Security Acceleration Engine (EIP197) directly from
38 user-space with minimum overhead and high performance.
39
40 Features
41 --------
42
43 MRVL CRYPTO PMD has support for:
44
45 * Symmetric crypto
46 * Sym operation chaining
47 * AES CBC (128)
48 * AES CBC (192)
49 * AES CBC (256)
50 * AES CTR (128)
51 * AES CTR (192)
52 * AES CTR (256)
53 * 3DES CBC
54 * 3DES CTR
55 * MD5
56 * MD5 HMAC
57 * SHA1
58 * SHA1 HMAC
59 * SHA256
60 * SHA256 HMAC
61 * SHA384
62 * SHA384 HMAC
63 * SHA512
64 * SHA512 HMAC
65 * AES GCM (128)
66
67 Limitations
68 -----------
69
70 * Hardware only supports scenarios where ICV (digest buffer) is placed just
71   after the authenticated data. Other placement will result in error.
72
73 * Before running crypto test suite it is advised to increase limit of
74   opened files:
75
76   .. code-block:: console
77
78      ulimit -n 20000
79
80 Installation
81 ------------
82
83 MRVL CRYPTO PMD driver compilation is disabled by default due to external dependencies.
84 Currently there are two driver specific compilation options in
85 ``config/common_base`` available:
86
87 - ``CONFIG_RTE_LIBRTE_MRVL_CRYPTO`` (default ``n``)
88
89     Toggle compilation of the librte_pmd_mrvl driver.
90
91 - ``CONFIG_RTE_LIBRTE_MRVL_CRYPTO_DEBUG`` (default ``n``)
92
93     Toggle display of debugging messages.
94
95 During compilation external MUSDK library, which provides direct access
96 to Marvell's EIP197 cryptographic engine, is necessary. Library sources are
97 available `here <https://github.com/MarvellEmbeddedProcessors/musdk-marvell/tree/musdk-armada-17.08>`__.
98
99 Alternatively, prebuilt library can be downloaded from
100 `Marvell Extranet <https://extranet.marvell.com>`_. Once approval has been
101 granted, library can be found by typing ``musdk`` in the search box.
102
103 For MUSDK library build instructions please refer to ``doc/musdk_get_started.txt``
104 in library sources directory.
105
106 MUSDK requires out of tree kernel modules to work. Kernel tree needed to build
107 them is available
108 `here <https://github.com/MarvellEmbeddedProcessors/linux-marvell/tree/linux-4.4.52-armada-17.08>`__.
109
110 Initialization
111 --------------
112
113 After successfully building MRVL CRYPTO PMD, the following modules need to be
114 loaded:
115
116 .. code-block:: console
117
118    insmod musdk_uio.ko
119    insmod mvpp2x_sysfs.ko
120    insmod mv_pp_uio.ko
121    insmod mv_sam_uio.ko
122    insmod crypto_safexcel.ko
123
124 - `musdk_uio.ko`, `mv_pp2_uio.ko` and `mv_sam_uio.ko` are distributed together with MUSDK library.
125 - `crypto_safexcel.ko` is an in-kernel module.
126 - `mvpp2x_sysfs.ko` can be build from sources available `here <https://github.com/MarvellEmbeddedProcessors/mvpp2x-marvell/tree/mvpp2x-armada-17.08>`__.
127
128 The following parameters (all optional) are exported by the driver:
129
130 * max_nb_queue_pairs: maximum number of queue pairs in the device (8 by default).
131 * max_nb_sessions: maximum number of sessions that can be created (2048 by default).
132 * socket_id: socket on which to allocate the device resources on.
133
134 l2fwd-crypto example application can be used to verify MRVL CRYPTO PMD
135 operation:
136
137 .. code-block:: console
138
139    ./l2fwd-crypto --vdev=net_mrvl,iface=eth0 --vdev=crypto_mrvl -- \
140      --cipher_op ENCRYPT --cipher_algo aes-cbc \
141      --cipher_key 00:01:02:03:04:05:06:07:08:09:0a:0b:0c:0d:0e:0f  \
142      --auth_op GENERATE --auth_algo sha1-hmac \
143      --auth_key 10:11:12:13:14:15:16:17:18:19:1a:1b:1c:1d:1e:1f
144
145 Example output:
146
147 .. code-block:: console
148
149    [...]
150    AAD: at [0x7f253ceb80], len=
151    P ID 0 configuration ----
152    Port mode               : KR
153    MAC status              : disabled
154    Link status             : link up
155    Port speed              : 10G
156    Port duplex             : full
157    Port: Egress enable tx_port_num=16 qmap=0x1
158    PORT: Port0 - link
159    P ID 0 configuration ----
160    Port mode               : KR
161    MAC status              : disabled
162    Link status             : link down
163    Port speed              : 10G
164    Port duplex             : full
165    Port: Egress enable tx_port_num=16 qmap=0x1
166    Port 0, MAC address: 00:50:43:02:21:20
167
168
169    Checking link statusdone
170    Port 0 Link Up - speed 0 Mbps - full-duplex
171    Lcore 0: RX port 0
172    Allocated session pool on socket 0
173    eip197: 0:0 registers: paddr: 0xf2880000, vaddr: 0x0x7f56a80000
174    DMA buffer (131136 bytes) for CDR #0 allocated: paddr = 0xb0585e00, vaddr = 0x7f09384e00
175    DMA buffer (131136 bytes) for RDR #0 allocated: paddr = 0xb05a5f00, vaddr = 0x7f093a4f00
176    DMA buffers allocated for 2049 operations. Tokens - 256 bytes
177    Lcore 0: cryptodev 0
178    L2FWD: lcore 1 has nothing to do
179    L2FWD: lcore 2 has nothing to do
180    L2FWD: lcore 3 has nothing to do
181    L2FWD: entering main loop on lcore 0
182    L2FWD:  -- lcoreid=0 portid=0
183    L2FWD:  -- lcoreid=0 cryptoid=0
184    Options:-
185    nportmask: ffffffff
186    ports per lcore: 1
187    refresh period : 10000
188    single lcore mode: disabled
189    stats_printing: enabled
190    sessionless crypto: disabled
191
192    Crypto chain: Input --> Encrypt --> Auth generate --> Output
193
194    ---- Cipher information ---
195    Algorithm: aes-cbc
196    Cipher key: at [0x7f56db4e80], len=16
197    00000000: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | ................
198    IV: at [0x7f56db4b80], len=16
199    00000000: 20 F0 63 0E 45 EB 2D 84 72 D4 13 6E 36 B5 AF FE |  .c.E.-.r..n6...
200
201    ---- Authentication information ---
202    Algorithm: sha1-hmac
203    Auth key: at [0x7f56db4d80], len=16
204    00000000: 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F | ................
205    IV: at [0x7f56db4a80], len=0
206    AAD: at [0x7f253ceb80], len=