xref: /dpdk/doc/guides/cryptodevs/dpaa2_sec.rst (revision fcee050aa1d74b3e65ea349f401728ece7cbdc50)
14bbee28bSAkhil Goyal..  BSD LICENSE
2*fcee050aSShreyansh Jain    Copyright 2016 NXP.
34bbee28bSAkhil Goyal
44bbee28bSAkhil Goyal    Redistribution and use in source and binary forms, with or without
54bbee28bSAkhil Goyal    modification, are permitted provided that the following conditions
64bbee28bSAkhil Goyal    are met:
74bbee28bSAkhil Goyal
84bbee28bSAkhil Goyal    * Redistributions of source code must retain the above copyright
94bbee28bSAkhil Goyal    notice, this list of conditions and the following disclaimer.
104bbee28bSAkhil Goyal    * Redistributions in binary form must reproduce the above copyright
114bbee28bSAkhil Goyal    notice, this list of conditions and the following disclaimer in
124bbee28bSAkhil Goyal    the documentation and/or other materials provided with the
134bbee28bSAkhil Goyal    distribution.
144bbee28bSAkhil Goyal    * Neither the name of NXP nor the names of its
154bbee28bSAkhil Goyal    contributors may be used to endorse or promote products derived
164bbee28bSAkhil Goyal    from this software without specific prior written permission.
174bbee28bSAkhil Goyal
184bbee28bSAkhil Goyal    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
194bbee28bSAkhil Goyal    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
204bbee28bSAkhil Goyal    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
214bbee28bSAkhil Goyal    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
224bbee28bSAkhil Goyal    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
234bbee28bSAkhil Goyal    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
244bbee28bSAkhil Goyal    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
254bbee28bSAkhil Goyal    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
264bbee28bSAkhil Goyal    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
274bbee28bSAkhil Goyal    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
284bbee28bSAkhil Goyal    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
294bbee28bSAkhil Goyal
304bbee28bSAkhil Goyal
314bbee28bSAkhil GoyalNXP DPAA2 CAAM (DPAA2_SEC)
324bbee28bSAkhil Goyal==========================
334bbee28bSAkhil Goyal
344bbee28bSAkhil GoyalThe DPAA2_SEC PMD provides poll mode crypto driver support for NXP DPAA2 CAAM
354bbee28bSAkhil Goyalhardware accelerator.
364bbee28bSAkhil Goyal
374bbee28bSAkhil GoyalArchitecture
384bbee28bSAkhil Goyal------------
394bbee28bSAkhil Goyal
404bbee28bSAkhil GoyalSEC is the SOC's security engine, which serves as NXP's latest cryptographic
414bbee28bSAkhil Goyalacceleration and offloading hardware. It combines functions previously
424bbee28bSAkhil Goyalimplemented in separate modules to create a modular and scalable acceleration
434bbee28bSAkhil Goyaland assurance engine. It also implements block encryption algorithms, stream
444bbee28bSAkhil Goyalcipher algorithms, hashing algorithms, public key algorithms, run-time
454bbee28bSAkhil Goyalintegrity checking, and a hardware random number generator. SEC performs
464bbee28bSAkhil Goyalhigher-level cryptographic operations than previous NXP cryptographic
474bbee28bSAkhil Goyalaccelerators. This provides significant improvement to system level performance.
484bbee28bSAkhil Goyal
494bbee28bSAkhil GoyalDPAA2_SEC is one of the hardware resource in DPAA2 Architecture. More information
504bbee28bSAkhil Goyalon DPAA2 Architecture is described in :ref:`dpaa2_overview`.
514bbee28bSAkhil Goyal
524bbee28bSAkhil GoyalDPAA2_SEC PMD is one of DPAA2 drivers which interacts with Management Complex (MC)
534bbee28bSAkhil Goyalportal to access the hardware object - DPSECI. The MC provides access to create,
544bbee28bSAkhil Goyaldiscover, connect, configure and destroy dpseci objects in DPAA2_SEC PMD.
554bbee28bSAkhil Goyal
564bbee28bSAkhil GoyalDPAA2_SEC PMD also uses some of the other hardware resources like buffer pools,
574bbee28bSAkhil Goyalqueues, queue portals to store and to enqueue/dequeue data to the hardware SEC.
584bbee28bSAkhil Goyal
594bbee28bSAkhil GoyalDPSECI objects are detected by PMD using a resource container called DPRC (like
604bbee28bSAkhil Goyalin :ref:`dpaa2_overview`).
614bbee28bSAkhil Goyal
624bbee28bSAkhil GoyalFor example:
634bbee28bSAkhil Goyal
644bbee28bSAkhil Goyal.. code-block:: console
654bbee28bSAkhil Goyal
664bbee28bSAkhil Goyal    DPRC.1 (bus)
674bbee28bSAkhil Goyal      |
684bbee28bSAkhil Goyal      +--+--------+-------+-------+-------+---------+
694bbee28bSAkhil Goyal         |        |       |       |       |         |
704bbee28bSAkhil Goyal       DPMCP.1  DPIO.1  DPBP.1  DPNI.1  DPMAC.1  DPSECI.1
714bbee28bSAkhil Goyal       DPMCP.2  DPIO.2          DPNI.2  DPMAC.2  DPSECI.2
724bbee28bSAkhil Goyal       DPMCP.3
734bbee28bSAkhil Goyal
744bbee28bSAkhil GoyalImplementation
754bbee28bSAkhil Goyal--------------
764bbee28bSAkhil Goyal
774bbee28bSAkhil GoyalSEC provides platform assurance by working with SecMon, which is a companion
784bbee28bSAkhil Goyallogic block that tracks the security state of the SOC. SEC is programmed by
794bbee28bSAkhil Goyalmeans of descriptors (not to be confused with frame descriptors (FDs)) that
804bbee28bSAkhil Goyalindicate the operations to be performed and link to the message and
814bbee28bSAkhil Goyalassociated data. SEC incorporates two DMA engines to fetch the descriptors,
824bbee28bSAkhil Goyalread the message data, and write the results of the operations. The DMA
834bbee28bSAkhil Goyalengine provides a scatter/gather capability so that SEC can read and write
844bbee28bSAkhil Goyaldata scattered in memory. SEC may be configured by means of software for
854bbee28bSAkhil Goyaldynamic changes in byte ordering. The default configuration for this version
864bbee28bSAkhil Goyalof SEC is little-endian mode.
874bbee28bSAkhil Goyal
884bbee28bSAkhil GoyalA block diagram similar to dpaa2 NIC is shown below to show where DPAA2_SEC
894bbee28bSAkhil Goyalfits in the DPAA2 Bus model
904bbee28bSAkhil Goyal
914bbee28bSAkhil Goyal.. code-block:: console
924bbee28bSAkhil Goyal
934bbee28bSAkhil Goyal
944bbee28bSAkhil Goyal                                       +----------------+
954bbee28bSAkhil Goyal                                       | DPDK DPAA2_SEC |
964bbee28bSAkhil Goyal                                       |     PMD        |
974bbee28bSAkhil Goyal                                       +----------------+       +------------+
984bbee28bSAkhil Goyal                                       |  MC SEC object |.......|  Mempool   |
994bbee28bSAkhil Goyal                    . . . . . . . . .  |   (DPSECI)     |       |  (DPBP)    |
1004bbee28bSAkhil Goyal                   .                   +---+---+--------+       +-----+------+
1014bbee28bSAkhil Goyal                  .                        ^   |                      .
1024bbee28bSAkhil Goyal                 .                         |   |<enqueue,             .
1034bbee28bSAkhil Goyal                .                          |   | dequeue>             .
1044bbee28bSAkhil Goyal               .                           |   |                      .
1054bbee28bSAkhil Goyal              .                        +---+---V----+                 .
1064bbee28bSAkhil Goyal             .      . . . . . . . . . .| DPIO driver|                 .
1074bbee28bSAkhil Goyal            .      .                   |  (DPIO)    |                 .
1084bbee28bSAkhil Goyal           .      .                    +-----+------+                 .
1094bbee28bSAkhil Goyal          .      .                     |  QBMAN     |                 .
1104bbee28bSAkhil Goyal         .      .                      |  Driver    |                 .
1114bbee28bSAkhil Goyal    +----+------+-------+              +-----+----- |                 .
1124bbee28bSAkhil Goyal    |   dpaa2 bus       |                    |                        .
1134bbee28bSAkhil Goyal    |   VFIO fslmc-bus  |....................|.........................
1144bbee28bSAkhil Goyal    |                   |                    |
1154bbee28bSAkhil Goyal    |     /bus/fslmc    |                    |
1164bbee28bSAkhil Goyal    +-------------------+                    |
1174bbee28bSAkhil Goyal                                             |
1184bbee28bSAkhil Goyal    ========================== HARDWARE =====|=======================
1194bbee28bSAkhil Goyal                                           DPIO
1204bbee28bSAkhil Goyal                                             |
1214bbee28bSAkhil Goyal                                           DPSECI---DPBP
1224bbee28bSAkhil Goyal    =========================================|========================
1234bbee28bSAkhil Goyal
1244bbee28bSAkhil Goyal
1254bbee28bSAkhil Goyal
1264bbee28bSAkhil GoyalFeatures
1274bbee28bSAkhil Goyal--------
1284bbee28bSAkhil Goyal
12913273250SAkhil GoyalThe DPAA2_SEC PMD has support for:
1304bbee28bSAkhil Goyal
1314bbee28bSAkhil GoyalCipher algorithms:
1324bbee28bSAkhil Goyal
1334bbee28bSAkhil Goyal* ``RTE_CRYPTO_CIPHER_3DES_CBC``
1344bbee28bSAkhil Goyal* ``RTE_CRYPTO_CIPHER_AES128_CBC``
1354bbee28bSAkhil Goyal* ``RTE_CRYPTO_CIPHER_AES192_CBC``
1364bbee28bSAkhil Goyal* ``RTE_CRYPTO_CIPHER_AES256_CBC``
13713273250SAkhil Goyal* ``RTE_CRYPTO_CIPHER_AES128_CTR``
13813273250SAkhil Goyal* ``RTE_CRYPTO_CIPHER_AES192_CTR``
13913273250SAkhil Goyal* ``RTE_CRYPTO_CIPHER_AES256_CTR``
1404bbee28bSAkhil Goyal
1414bbee28bSAkhil GoyalHash algorithms:
1424bbee28bSAkhil Goyal
1434bbee28bSAkhil Goyal* ``RTE_CRYPTO_AUTH_SHA1_HMAC``
1444bbee28bSAkhil Goyal* ``RTE_CRYPTO_AUTH_SHA224_HMAC``
1454bbee28bSAkhil Goyal* ``RTE_CRYPTO_AUTH_SHA256_HMAC``
1464bbee28bSAkhil Goyal* ``RTE_CRYPTO_AUTH_SHA384_HMAC``
1474bbee28bSAkhil Goyal* ``RTE_CRYPTO_AUTH_SHA512_HMAC``
1484bbee28bSAkhil Goyal* ``RTE_CRYPTO_AUTH_MD5_HMAC``
1494bbee28bSAkhil Goyal
15013273250SAkhil GoyalAEAD algorithms:
15113273250SAkhil Goyal
15213273250SAkhil Goyal* ``RTE_CRYPTO_AEAD_AES_GCM``
15313273250SAkhil Goyal
1544bbee28bSAkhil GoyalSupported DPAA2 SoCs
1554bbee28bSAkhil Goyal--------------------
1564bbee28bSAkhil Goyal
1574bbee28bSAkhil Goyal* LS2080A/LS2040A
1584bbee28bSAkhil Goyal* LS2084A/LS2044A
1594bbee28bSAkhil Goyal* LS2088A/LS2048A
1604bbee28bSAkhil Goyal* LS1088A/LS1048A
1614bbee28bSAkhil Goyal
1624bbee28bSAkhil GoyalLimitations
1634bbee28bSAkhil Goyal-----------
1644bbee28bSAkhil Goyal
1654bbee28bSAkhil Goyal* Chained mbufs are not supported.
1664bbee28bSAkhil Goyal* Hash followed by Cipher mode is not supported
1674bbee28bSAkhil Goyal* Only supports the session-oriented API implementation (session-less APIs are not supported).
1684bbee28bSAkhil Goyal
1694bbee28bSAkhil GoyalPrerequisites
1704bbee28bSAkhil Goyal-------------
1714bbee28bSAkhil Goyal
1724bbee28bSAkhil GoyalDPAA2_SEC driver has similar pre-requisites as described in :ref:`dpaa2_overview`.
1734bbee28bSAkhil GoyalThe following dependencies are not part of DPDK and must be installed separately:
1744bbee28bSAkhil Goyal
1754bbee28bSAkhil Goyal* **NXP Linux SDK**
1764bbee28bSAkhil Goyal
1774bbee28bSAkhil Goyal  NXP Linux software development kit (SDK) includes support for the family
1784bbee28bSAkhil Goyal  of QorIQ® ARM-Architecture-based system on chip (SoC) processors
1794bbee28bSAkhil Goyal  and corresponding boards.
1804bbee28bSAkhil Goyal
1814bbee28bSAkhil Goyal  It includes the Linux board support packages (BSPs) for NXP SoCs,
1824bbee28bSAkhil Goyal  a fully operational tool chain, kernel and board specific modules.
1834bbee28bSAkhil Goyal
1844bbee28bSAkhil Goyal  SDK and related information can be obtained from:  `NXP QorIQ SDK  <http://www.nxp.com/products/software-and-tools/run-time-software/linux-sdk/linux-sdk-for-qoriq-processors:SDKLINUX>`_.
1854bbee28bSAkhil Goyal
1864bbee28bSAkhil Goyal* **DPDK Helper Scripts**
1874bbee28bSAkhil Goyal
1884bbee28bSAkhil Goyal  DPAA2 based resources can be configured easily with the help of ready scripts
1894bbee28bSAkhil Goyal  as provided in the DPDK helper repository.
1904bbee28bSAkhil Goyal
1914bbee28bSAkhil Goyal  `DPDK Helper Scripts <https://github.com/qoriq-open-source/dpdk-helper>`_.
1924bbee28bSAkhil Goyal
1934bbee28bSAkhil GoyalCurrently supported by DPDK:
1944bbee28bSAkhil Goyal
1954bbee28bSAkhil Goyal* NXP SDK **2.0+**.
1964bbee28bSAkhil Goyal* MC Firmware version **10.0.0** and higher.
1974bbee28bSAkhil Goyal* Supported architectures:  **arm64 LE**.
1984bbee28bSAkhil Goyal
1994bbee28bSAkhil Goyal* Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
2004bbee28bSAkhil Goyal
2014bbee28bSAkhil GoyalPre-Installation Configuration
2024bbee28bSAkhil Goyal------------------------------
2034bbee28bSAkhil Goyal
2044bbee28bSAkhil GoyalConfig File Options
2054bbee28bSAkhil Goyal~~~~~~~~~~~~~~~~~~~
2064bbee28bSAkhil Goyal
2074bbee28bSAkhil GoyalBasic DPAA2 config file options are described in :ref:`dpaa2_overview`.
2084bbee28bSAkhil GoyalIn addition to those, the following options can be modified in the ``config`` file
2094bbee28bSAkhil Goyalto enable DPAA2_SEC PMD.
2104bbee28bSAkhil Goyal
2114bbee28bSAkhil GoyalPlease note that enabling debugging options may affect system performance.
2124bbee28bSAkhil Goyal
2134bbee28bSAkhil Goyal* ``CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC`` (default ``n``)
2144bbee28bSAkhil Goyal  By default it is only enabled in defconfig_arm64-dpaa2-* config.
2154bbee28bSAkhil Goyal  Toggle compilation of the ``librte_pmd_dpaa2_sec`` driver.
2164bbee28bSAkhil Goyal
2174bbee28bSAkhil Goyal* ``CONFIG_RTE_LIBRTE_DPAA2_SEC_DEBUG_INIT`` (default ``n``)
2184bbee28bSAkhil Goyal  Toggle display of initialization related driver messages
2194bbee28bSAkhil Goyal
2204bbee28bSAkhil Goyal* ``CONFIG_RTE_LIBRTE_DPAA2_SEC_DEBUG_DRIVER`` (default ``n``)
2214bbee28bSAkhil Goyal  Toggle display of driver runtime messages
2224bbee28bSAkhil Goyal
2234bbee28bSAkhil Goyal* ``CONFIG_RTE_LIBRTE_DPAA2_SEC_DEBUG_RX`` (default ``n``)
2244bbee28bSAkhil Goyal  Toggle display of receive fast path run-time message
2254bbee28bSAkhil Goyal
2264bbee28bSAkhil Goyal* ``CONFIG_RTE_DPAA2_SEC_PMD_MAX_NB_SESSIONS``
2274bbee28bSAkhil Goyal  By default it is set as 2048 in defconfig_arm64-dpaa2-* config.
2284bbee28bSAkhil Goyal  It indicates Number of sessions to create in the session memory pool
2294bbee28bSAkhil Goyal  on a single DPAA2 SEC device.
2304bbee28bSAkhil Goyal
2314bbee28bSAkhil GoyalInstallations
2324bbee28bSAkhil Goyal-------------
2334bbee28bSAkhil GoyalTo compile the DPAA2_SEC PMD for Linux arm64 gcc target, run the
2344bbee28bSAkhil Goyalfollowing ``make`` command:
2354bbee28bSAkhil Goyal
2364bbee28bSAkhil Goyal.. code-block:: console
2374bbee28bSAkhil Goyal
2384bbee28bSAkhil Goyal   cd <DPDK-source-directory>
2394bbee28bSAkhil Goyal   make config T=arm64-dpaa2-linuxapp-gcc install
240