xref: /dpdk/doc/guides/cryptodevs/cnxk.rst (revision 455a771fd6f1a9cb6edc8711ff278ad31709cf7c)
12457705eSAnkur Dwivedi.. SPDX-License-Identifier: BSD-3-Clause
22457705eSAnkur Dwivedi   Copyright(c) 2021 Marvell.
32457705eSAnkur Dwivedi
42457705eSAnkur DwivediMarvell cnxk Crypto Poll Mode Driver
52457705eSAnkur Dwivedi====================================
62457705eSAnkur Dwivedi
72457705eSAnkur DwivediThe cnxk crypto poll mode driver provides support for offloading
82457705eSAnkur Dwivedicryptographic operations to cryptographic accelerator units on the
92457705eSAnkur Dwivedi**Marvell OCTEON cnxk** SoC family.
102457705eSAnkur Dwivedi
112457705eSAnkur DwivediThe cnxk crypto PMD code is organized into different sets of files.
122457705eSAnkur DwivediThe file names starting with cn9k and cn10k provides support for CN9XX
132457705eSAnkur Dwivediand CN10XX respectively. The common code between the SoCs is present
142457705eSAnkur Dwivediin file names starting with cnxk.
152457705eSAnkur Dwivedi
162457705eSAnkur DwivediMore information about OCTEON cnxk SoCs may be obtained from `<https://www.marvell.com>`_
172457705eSAnkur Dwivedi
182457705eSAnkur DwivediSupported OCTEON cnxk SoCs
192457705eSAnkur Dwivedi--------------------------
202457705eSAnkur Dwivedi
212457705eSAnkur Dwivedi- CN9XX
222457705eSAnkur Dwivedi- CN10XX
232457705eSAnkur Dwivedi
24bf662949SAnkur DwivediFeatures
25bf662949SAnkur Dwivedi--------
26bf662949SAnkur Dwivedi
27bf662949SAnkur DwivediThe OCTEON cnxk crypto PMD has support for:
28bf662949SAnkur Dwivedi
29bf662949SAnkur DwivediSymmetric Crypto Algorithms
30bf662949SAnkur Dwivedi~~~~~~~~~~~~~~~~~~~~~~~~~~~
31bf662949SAnkur Dwivedi
32bf662949SAnkur DwivediCipher algorithms:
33bf662949SAnkur Dwivedi
34bf662949SAnkur Dwivedi* ``RTE_CRYPTO_CIPHER_NULL``
35bf662949SAnkur Dwivedi* ``RTE_CRYPTO_CIPHER_3DES_CBC``
36bf662949SAnkur Dwivedi* ``RTE_CRYPTO_CIPHER_3DES_ECB``
37bf662949SAnkur Dwivedi* ``RTE_CRYPTO_CIPHER_AES_CBC``
38bf662949SAnkur Dwivedi* ``RTE_CRYPTO_CIPHER_AES_CTR``
39bf662949SAnkur Dwivedi* ``RTE_CRYPTO_CIPHER_AES_XTS``
40bf662949SAnkur Dwivedi* ``RTE_CRYPTO_CIPHER_DES_CBC``
41bf662949SAnkur Dwivedi* ``RTE_CRYPTO_CIPHER_KASUMI_F8``
42bf662949SAnkur Dwivedi* ``RTE_CRYPTO_CIPHER_SNOW3G_UEA2``
43bf662949SAnkur Dwivedi* ``RTE_CRYPTO_CIPHER_ZUC_EEA3``
4421c1c303SVidya Sagar Velumuri* ``RTE_CRYPTO_CIPHER_SM4``
45bf662949SAnkur Dwivedi
46bf662949SAnkur DwivediHash algorithms:
47bf662949SAnkur Dwivedi
48bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_NULL``
49bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_AES_GMAC``
50bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_KASUMI_F9``
51bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_MD5``
52bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_MD5_HMAC``
53bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_SHA1``
54bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_SHA1_HMAC``
55bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_SHA224``
56bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_SHA224_HMAC``
57bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_SHA256``
58bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_SHA256_HMAC``
59bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_SHA384``
60bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_SHA384_HMAC``
61bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_SHA512``
62bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_SHA512_HMAC``
63100711afSVolodymyr Fialko* ``RTE_CRYPTO_AUTH_SHA3_224``
64100711afSVolodymyr Fialko* ``RTE_CRYPTO_AUTH_SHA3_224_HMAC``
65100711afSVolodymyr Fialko* ``RTE_CRYPTO_AUTH_SHA3_256``
66100711afSVolodymyr Fialko* ``RTE_CRYPTO_AUTH_SHA3_256_HMAC``
67100711afSVolodymyr Fialko* ``RTE_CRYPTO_AUTH_SHA3_384``
68100711afSVolodymyr Fialko* ``RTE_CRYPTO_AUTH_SHA3_384_HMAC``
69100711afSVolodymyr Fialko* ``RTE_CRYPTO_AUTH_SHA3_512``
70100711afSVolodymyr Fialko* ``RTE_CRYPTO_AUTH_SHA3_512_HMAC``
71db1813ddSVolodymyr Fialko* ``RTE_CRYPTO_AUTH_SHAKE_128``
72db1813ddSVolodymyr Fialko* ``RTE_CRYPTO_AUTH_SHAKE_256``
73bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_SNOW3G_UIA2``
74bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AUTH_ZUC_EIA3``
75759b5e65SAnoob Joseph* ``RTE_CRYPTO_AUTH_AES_CMAC``
76b657e7d6SVidya Sagar Velumuri* ``RTE_CRYPTO_AUTH_SM3``
77bf662949SAnkur Dwivedi
78bf662949SAnkur DwivediAEAD algorithms:
79bf662949SAnkur Dwivedi
80bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AEAD_AES_GCM``
81d15bc634STejasree Kondoj* ``RTE_CRYPTO_AEAD_AES_CCM``
82bf662949SAnkur Dwivedi* ``RTE_CRYPTO_AEAD_CHACHA20_POLY1305``
83bf662949SAnkur Dwivedi
84ba57cbd5SAnoob JosephAsymmetric Crypto Algorithms
85ba57cbd5SAnoob Joseph~~~~~~~~~~~~~~~~~~~~~~~~~~~~
86ba57cbd5SAnoob Joseph
87ba57cbd5SAnoob Joseph* ``RTE_CRYPTO_ASYM_XFORM_RSA``
88ba57cbd5SAnoob Joseph* ``RTE_CRYPTO_ASYM_XFORM_MODEX``
89ba57cbd5SAnoob Joseph
902457705eSAnkur DwivediInstallation
912457705eSAnkur Dwivedi------------
922457705eSAnkur Dwivedi
932457705eSAnkur DwivediThe OCTEON cnxk crypto PMD may be compiled natively on an OCTEON cnxk platform
942457705eSAnkur Dwivedior cross-compiled on an x86 platform.
952457705eSAnkur Dwivedi
962457705eSAnkur DwivediRefer to :doc:`../platform/cnxk` for instructions to build your DPDK
972457705eSAnkur Dwivediapplication.
982457705eSAnkur Dwivedi
992457705eSAnkur Dwivedi.. note::
1002457705eSAnkur Dwivedi
1012457705eSAnkur Dwivedi   The OCTEON cnxk crypto PMD uses services from the kernel mode OCTEON cnxk
1022457705eSAnkur Dwivedi   crypto PF driver in linux. This driver is included in the OCTEON TX SDK.
1032457705eSAnkur Dwivedi
1042457705eSAnkur DwivediInitialization
1052457705eSAnkur Dwivedi--------------
1062457705eSAnkur Dwivedi
1072457705eSAnkur Dwivedi``CN9K Initialization``
1082457705eSAnkur Dwivedi
1092457705eSAnkur DwivediList the CPT PF devices available on cn9k platform:
1102457705eSAnkur Dwivedi
1112457705eSAnkur Dwivedi.. code-block:: console
1122457705eSAnkur Dwivedi
1132457705eSAnkur Dwivedi    lspci -d:a0fd
1142457705eSAnkur Dwivedi
1152457705eSAnkur Dwivedi``a0fd`` is the CPT PF device id. You should see output similar to:
1162457705eSAnkur Dwivedi
1172457705eSAnkur Dwivedi.. code-block:: console
1182457705eSAnkur Dwivedi
1192457705eSAnkur Dwivedi    0002:10:00.0 Class 1080: Device 177d:a0fd
1202457705eSAnkur Dwivedi
1212457705eSAnkur DwivediSet ``sriov_numvfs`` on the CPT PF device, to create a VF:
1222457705eSAnkur Dwivedi
1232457705eSAnkur Dwivedi.. code-block:: console
1242457705eSAnkur Dwivedi
1252457705eSAnkur Dwivedi    echo 1 > /sys/bus/pci/devices/0002:10:00.0/sriov_numvfs
1262457705eSAnkur Dwivedi
1272457705eSAnkur DwivediBind the CPT VF device to the vfio_pci driver:
1282457705eSAnkur Dwivedi
1292457705eSAnkur Dwivedi.. code-block:: console
1302457705eSAnkur Dwivedi
1312457705eSAnkur Dwivedi    cd <dpdk directory>
1322457705eSAnkur Dwivedi    ./usertools/dpdk-devbind.py -u 0002:10:00.1
1332457705eSAnkur Dwivedi    ./usertools/dpdk-devbind.py -b vfio-pci 0002:10.00.1
1342457705eSAnkur Dwivedi
1352457705eSAnkur Dwivedi.. note::
1362457705eSAnkur Dwivedi
1372457705eSAnkur Dwivedi    * For CN98xx SoC, it is recommended to use even and odd DBDF VFs to achieve
1382457705eSAnkur Dwivedi      higher performance as even VF uses one crypto engine and odd one uses
1392457705eSAnkur Dwivedi      another crypto engine.
1402457705eSAnkur Dwivedi
1412457705eSAnkur Dwivedi    * Ensure that sufficient huge pages are available for your application::
1422457705eSAnkur Dwivedi
1432457705eSAnkur Dwivedi         dpdk-hugepages.py --setup 4G --pagesize 512M
1442457705eSAnkur Dwivedi
1452457705eSAnkur Dwivedi      Refer to :ref:`linux_gsg_hugepages` for more details.
1462457705eSAnkur Dwivedi
1472457705eSAnkur Dwivedi``CN10K Initialization``
1482457705eSAnkur Dwivedi
1492457705eSAnkur DwivediList the CPT PF devices available on cn10k platform:
1502457705eSAnkur Dwivedi
1512457705eSAnkur Dwivedi.. code-block:: console
1522457705eSAnkur Dwivedi
1532457705eSAnkur Dwivedi    lspci -d:a0f2
1542457705eSAnkur Dwivedi
1552457705eSAnkur Dwivedi``a0f2`` is the CPT PF device id. You should see output similar to:
1562457705eSAnkur Dwivedi
1572457705eSAnkur Dwivedi.. code-block:: console
1582457705eSAnkur Dwivedi
1592457705eSAnkur Dwivedi    0002:20:00.0 Class 1080: Device 177d:a0f2
1602457705eSAnkur Dwivedi
1612457705eSAnkur DwivediSet ``sriov_numvfs`` on the CPT PF device, to create a VF:
1622457705eSAnkur Dwivedi
1632457705eSAnkur Dwivedi.. code-block:: console
1642457705eSAnkur Dwivedi
1652457705eSAnkur Dwivedi    echo 1 > /sys/bus/pci/devices/0002:20:00.0/sriov_numvfs
1662457705eSAnkur Dwivedi
1672457705eSAnkur DwivediBind the CPT VF device to the vfio_pci driver:
1682457705eSAnkur Dwivedi
1692457705eSAnkur Dwivedi.. code-block:: console
1702457705eSAnkur Dwivedi
1712457705eSAnkur Dwivedi    cd <dpdk directory>
1722457705eSAnkur Dwivedi    ./usertools/dpdk-devbind.py -u 0002:20:00.1
1732457705eSAnkur Dwivedi    ./usertools/dpdk-devbind.py -b vfio-pci 0002:20:00.1
1742457705eSAnkur Dwivedi
175135e0b71SAnkur DwivediRuntime Config Options
176135e0b71SAnkur Dwivedi----------------------
177135e0b71SAnkur Dwivedi
178135e0b71SAnkur Dwivedi- ``Maximum queue pairs limit`` (default ``63``)
179135e0b71SAnkur Dwivedi
180135e0b71SAnkur Dwivedi   The number of maximum queue pairs supported by the device, can be limited
181135e0b71SAnkur Dwivedi   during runtime by using ``max_qps_limit`` ``devargs`` parameter.
182135e0b71SAnkur Dwivedi
183135e0b71SAnkur Dwivedi   For example::
184135e0b71SAnkur Dwivedi
185135e0b71SAnkur Dwivedi      -a 0002:20:00.1,max_qps_limit=4
186135e0b71SAnkur Dwivedi
187135e0b71SAnkur Dwivedi   With the above configuration, the number of maximum queue pairs supported
188135e0b71SAnkur Dwivedi   by the device is limited to 4.
189135e0b71SAnkur Dwivedi
190d029f353SVidya Sagar Velumuri- ``QP ID for Rx injection in case of fallback mechanism`` (default ``60``)
191d029f353SVidya Sagar Velumuri
192d029f353SVidya Sagar Velumuri   QP ID for Rx injection in fallback mechanism of security.
193d029f353SVidya Sagar Velumuri   Can be configured during runtime by using ``rx_inject_qp`` devargs parameter.
194d029f353SVidya Sagar Velumuri
195d029f353SVidya Sagar Velumuri   For example::
196d029f353SVidya Sagar Velumuri
197d029f353SVidya Sagar Velumuri      -a 0002:20:00.1,rx_inject_qp=20
198d029f353SVidya Sagar Velumuri
199d029f353SVidya Sagar Velumuri   With the above configuration, QP 20 will be used by the device for Rx injection
200d029f353SVidya Sagar Velumuri   in security in fallback mechanism scenario.
201d029f353SVidya Sagar Velumuri
2022457705eSAnkur DwivediDebugging Options
2032457705eSAnkur Dwivedi-----------------
2042457705eSAnkur Dwivedi
2052457705eSAnkur Dwivedi.. _table_octeon_cnxk_crypto_debug_options:
2062457705eSAnkur Dwivedi
2072457705eSAnkur Dwivedi.. table:: OCTEON cnxk crypto PMD debug options
2082457705eSAnkur Dwivedi
2092457705eSAnkur Dwivedi    +---+------------+-------------------------------------------------------+
2102457705eSAnkur Dwivedi    | # | Component  | EAL log command                                       |
2112457705eSAnkur Dwivedi    +===+============+=======================================================+
212*455a771fSAnoob Joseph    | 1 | CPT        | --log-level='pmd\.common\.cnxk\.crypto,8'             |
2132457705eSAnkur Dwivedi    +---+------------+-------------------------------------------------------+
2142457705eSAnkur Dwivedi
2155db3d7d0STejasree KondojTesting
2165db3d7d0STejasree Kondoj-------
2175db3d7d0STejasree Kondoj
2185db3d7d0STejasree KondojThe symmetric crypto operations on OCTEON cnxk crypto PMD may be verified by
2195db3d7d0STejasree Kondojrunning the test application:
2205db3d7d0STejasree Kondoj
2215db3d7d0STejasree Kondoj``CN9K``
2225db3d7d0STejasree Kondoj
2235db3d7d0STejasree Kondoj.. code-block:: console
2245db3d7d0STejasree Kondoj
2255db3d7d0STejasree Kondoj    ./dpdk-test
2265db3d7d0STejasree Kondoj    RTE>>cryptodev_cn9k_autotest
2275db3d7d0STejasree Kondoj
2285db3d7d0STejasree Kondoj``CN10K``
2295db3d7d0STejasree Kondoj
2305db3d7d0STejasree Kondoj.. code-block:: console
2315db3d7d0STejasree Kondoj
2325db3d7d0STejasree Kondoj    ./dpdk-test
2335db3d7d0STejasree Kondoj    RTE>>cryptodev_cn10k_autotest
2345db3d7d0STejasree Kondoj
235c7e6ab78SKiran Kumar KThe asymmetric crypto operations on OCTEON cnxk crypto PMD may be verified by
236c7e6ab78SKiran Kumar Krunning the test application:
237c7e6ab78SKiran Kumar K
238c7e6ab78SKiran Kumar K``CN9K``
239c7e6ab78SKiran Kumar K
240c7e6ab78SKiran Kumar K.. code-block:: console
241c7e6ab78SKiran Kumar K
242c7e6ab78SKiran Kumar K    ./dpdk-test
243c7e6ab78SKiran Kumar K    RTE>>cryptodev_cn9k_asym_autotest
244c7e6ab78SKiran Kumar K
245c7e6ab78SKiran Kumar K``CN10K``
246c7e6ab78SKiran Kumar K
247c7e6ab78SKiran Kumar K.. code-block:: console
248c7e6ab78SKiran Kumar K
249c7e6ab78SKiran Kumar K    ./dpdk-test
250c7e6ab78SKiran Kumar K    RTE>>cryptodev_cn10k_asym_autotest
251c7e6ab78SKiran Kumar K
25269407e79SAnoob JosephLookaside IPsec Support
25369407e79SAnoob Joseph-----------------------
25469407e79SAnoob Joseph
25569407e79SAnoob JosephThe OCTEON cnxk SoCs can accelerate IPsec traffic in lookaside protocol mode,
25669407e79SAnoob Josephwith its **cryptographic accelerator (CPT)**. ``OCTEON cnxk crypto PMD`` implements
25769407e79SAnoob Josephthis as an ``RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL`` offload.
25869407e79SAnoob Joseph
25969407e79SAnoob JosephRefer to :doc:`../prog_guide/rte_security` for more details on protocol offloads.
26069407e79SAnoob Joseph
26169407e79SAnoob JosephThis feature can be tested with ipsec-secgw sample application.
26269407e79SAnoob Joseph
26369407e79SAnoob JosephSupported OCTEON cnxk SoCs
26469407e79SAnoob Joseph~~~~~~~~~~~~~~~~~~~~~~~~~~
26569407e79SAnoob Joseph
266d38febb0SArchana Muniganti- CN9XX
26769407e79SAnoob Joseph- CN10XX
26869407e79SAnoob Joseph
269d38febb0SArchana MunigantiCN9XX Features supported
270d38febb0SArchana Muniganti~~~~~~~~~~~~~~~~~~~~~~~~
271d38febb0SArchana Muniganti
272d38febb0SArchana Muniganti* IPv4
273ba62b473SArchana Muniganti* IPv6
274d38febb0SArchana Muniganti* ESP
2756dc3f45fSTejasree Kondoj* ESN
2766dc3f45fSTejasree Kondoj* Anti-replay
277d38febb0SArchana Muniganti* Tunnel mode
278ba62b473SArchana Muniganti* Transport mode(IPv4)
279d38febb0SArchana Muniganti* UDP Encapsulation
280b4409f2bSArchana Muniganti* AH
2816dc3f45fSTejasree Kondoj
2826dc3f45fSTejasree KondojAEAD algorithms
2836dc3f45fSTejasree Kondoj+++++++++++++++
2846dc3f45fSTejasree Kondoj
285d38febb0SArchana Muniganti* AES-128/192/256-GCM
2866dc3f45fSTejasree Kondoj
2876dc3f45fSTejasree KondojCipher algorithms
2886dc3f45fSTejasree Kondoj+++++++++++++++++
2896dc3f45fSTejasree Kondoj
2907f4977e8SAnoob Joseph* NULL
2916dc3f45fSTejasree Kondoj* AES-128/192/256-CBC
292538bf100STejasree Kondoj* AES-128/192/256-CTR
2936dc3f45fSTejasree Kondoj
2946dc3f45fSTejasree KondojAuth algorithms
2956dc3f45fSTejasree Kondoj+++++++++++++++
2966dc3f45fSTejasree Kondoj
2976dc3f45fSTejasree Kondoj* SHA1-HMAC
2986dc3f45fSTejasree Kondoj* SHA256-128-HMAC
29909e5c772STejasree Kondoj* SHA384-192-HMAC
30009e5c772STejasree Kondoj* SHA512-256-HMAC
3017f4977e8SAnoob Joseph* AES-XCBC-96
302e85982abSArchana Muniganti* AES-GMAC
303d38febb0SArchana Muniganti
304d38febb0SArchana MunigantiCN10XX Features supported
305d38febb0SArchana Muniganti~~~~~~~~~~~~~~~~~~~~~~~~~
30669407e79SAnoob Joseph
30769407e79SAnoob Joseph* IPv4
30869407e79SAnoob Joseph* ESP
309670af27bSTejasree Kondoj* ESN
310670af27bSTejasree Kondoj* Anti-replay
31169407e79SAnoob Joseph* Tunnel mode
312d9bf3a41STejasree Kondoj* Transport mode
313d9bf3a41STejasree Kondoj* UDP Encapsulation
314b4409f2bSArchana Muniganti* AH
3156dc3f45fSTejasree Kondoj
3166dc3f45fSTejasree KondojAEAD algorithms
3176dc3f45fSTejasree Kondoj+++++++++++++++
3186dc3f45fSTejasree Kondoj
31969407e79SAnoob Joseph* AES-128/192/256-GCM
3206dc3f45fSTejasree Kondoj
3216dc3f45fSTejasree KondojCipher algorithms
3226dc3f45fSTejasree Kondoj+++++++++++++++++
3236dc3f45fSTejasree Kondoj
3247f4977e8SAnoob Joseph* NULL
3256dc3f45fSTejasree Kondoj* AES-128/192/256-CBC
326538bf100STejasree Kondoj* AES-128/192/256-CTR
3276dc3f45fSTejasree Kondoj
3286dc3f45fSTejasree KondojAuth algorithms
3296dc3f45fSTejasree Kondoj+++++++++++++++
3306dc3f45fSTejasree Kondoj
3316dc3f45fSTejasree Kondoj* NULL
3326dc3f45fSTejasree Kondoj* SHA1-HMAC
3336dc3f45fSTejasree Kondoj* SHA256-128-HMAC
33409e5c772STejasree Kondoj* SHA384-192-HMAC
33509e5c772STejasree Kondoj* SHA512-256-HMAC
3367f4977e8SAnoob Joseph* AES-XCBC-96
337e85982abSArchana Muniganti* AES-GMAC
338