xref: /dpdk/doc/guides/cryptodevs/qat.rst (revision 6b048cdfa211de588c2ca77b2040e88b8f45ae6c)
15630257fSFerruh Yigit..  SPDX-License-Identifier: BSD-3-Clause
27d5ef3bbSDamian Nowak    Copyright(c) 2015-2019 Intel Corporation.
31703e94aSDeclan Doherty
4ae20c073SDeepak Kumar JainIntel(R) QuickAssist (QAT) Crypto Poll Mode Driver
5ae20c073SDeepak Kumar Jain==================================================
61703e94aSDeclan Doherty
759ad25feSFiona TraheQAT documentation consists of three parts:
859ad25feSFiona Trahe
9bfd84d7eSArek Kusztal* Details of the symmetric and asymmetric crypto services below.
1043628b3dSDavid Marchand* Details of the :doc:`compression service <../compressdevs/qat_comp>`
1159ad25feSFiona Trahe  in the compressdev drivers section.
1259ad25feSFiona Trahe* Details of building the common QAT infrastructure and the PMDs to support the
1359ad25feSFiona Trahe  above services. See :ref:`building_qat` below.
1459ad25feSFiona Trahe
1559ad25feSFiona Trahe
1659ad25feSFiona TraheSymmetric Crypto Service on QAT
1759ad25feSFiona Trahe-------------------------------
1859ad25feSFiona Trahe
19bfd84d7eSArek KusztalThe QAT symmetric crypto PMD (hereafter referred to as `QAT SYM [PMD]`) provides
20bfd84d7eSArek Kusztalpoll mode crypto driver support for the following hardware accelerator devices:
21f546c1edSFiona Trahe
22f546c1edSFiona Trahe* ``Intel QuickAssist Technology DH895xCC``
23f546c1edSFiona Trahe* ``Intel QuickAssist Technology C62x``
24f546c1edSFiona Trahe* ``Intel QuickAssist Technology C3xxx``
25259310f3SFiona Trahe* ``Intel QuickAssist Technology D15xx``
26cb440babSAdam Dybkowski* ``Intel QuickAssist Technology C4xxx``
271703e94aSDeclan Doherty
281703e94aSDeclan Doherty
291703e94aSDeclan DohertyFeatures
3059ad25feSFiona Trahe~~~~~~~~
311703e94aSDeclan Doherty
32bfd84d7eSArek KusztalThe QAT SYM PMD has support for:
331703e94aSDeclan Doherty
341703e94aSDeclan DohertyCipher algorithms:
351703e94aSDeclan Doherty
36e1b7f509SFiona Trahe* ``RTE_CRYPTO_CIPHER_3DES_CBC``
37e1b7f509SFiona Trahe* ``RTE_CRYPTO_CIPHER_3DES_CTR``
38fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES128_CBC``
39fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES192_CBC``
40fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES256_CBC``
41fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES128_CTR``
42fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES192_CTR``
43fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES256_CTR``
447d5ef3bbSDamian Nowak* ``RTE_CRYPTO_CIPHER_AES_XTS``
45fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_SNOW3G_UEA2``
46db0e952aSDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_NULL``
47d4f27453SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_KASUMI_F8``
486cd8b4d8SArek Kusztal* ``RTE_CRYPTO_CIPHER_DES_CBC``
49d18ab45fSFiona Trahe* ``RTE_CRYPTO_CIPHER_AES_DOCSISBPI``
50d18ab45fSFiona Trahe* ``RTE_CRYPTO_CIPHER_DES_DOCSISBPI``
51d9b7d5bbSArek Kusztal* ``RTE_CRYPTO_CIPHER_ZUC_EEA3``
521703e94aSDeclan Doherty
531703e94aSDeclan DohertyHash algorithms:
541703e94aSDeclan Doherty
556e21c1a5SAdam Dybkowski* ``RTE_CRYPTO_AUTH_SHA1``
561703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_SHA1_HMAC``
576e21c1a5SAdam Dybkowski* ``RTE_CRYPTO_AUTH_SHA224``
58ebdbe12fSDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_SHA224_HMAC``
596e21c1a5SAdam Dybkowski* ``RTE_CRYPTO_AUTH_SHA256``
601703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_SHA256_HMAC``
616e21c1a5SAdam Dybkowski* ``RTE_CRYPTO_AUTH_SHA384``
62d905ee32SDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_SHA384_HMAC``
636e21c1a5SAdam Dybkowski* ``RTE_CRYPTO_AUTH_SHA512``
641703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_SHA512_HMAC``
651703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_AES_XCBC_MAC``
66a38dfe97SDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_SNOW3G_UIA2``
6761ec5181SArek Kusztal* ``RTE_CRYPTO_AUTH_MD5_HMAC``
68db0e952aSDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_NULL``
69d4f27453SDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_KASUMI_F9``
702fa64f84SArek Kusztal* ``RTE_CRYPTO_AUTH_AES_GMAC``
71d9b7d5bbSArek Kusztal* ``RTE_CRYPTO_AUTH_ZUC_EIA3``
7291c1daa4STomasz Cel* ``RTE_CRYPTO_AUTH_AES_CMAC``
731703e94aSDeclan Doherty
74b79e4c00SPablo de LaraSupported AEAD algorithms:
75655c901bSAndrea Grandi
76b79e4c00SPablo de Lara* ``RTE_CRYPTO_AEAD_AES_GCM``
777bd6f76eSTomasz Cel* ``RTE_CRYPTO_AEAD_AES_CCM``
78faa57df0SArek Kusztal* ``RTE_CRYPTO_AEAD_CHACHA20_POLY1305``
79b79e4c00SPablo de Lara
806f0ef237SDavid CoyleProtocol offloads:
816f0ef237SDavid Coyle
826f0ef237SDavid Coyle* ``RTE_SECURITY_PROTOCOL_DOCSIS``
831703e94aSDeclan Doherty
84bcd7e3e8SAdam DybkowskiSupported Chains
85bcd7e3e8SAdam Dybkowski~~~~~~~~~~~~~~~~
86bcd7e3e8SAdam Dybkowski
87bcd7e3e8SAdam DybkowskiAll the usual chains are supported and also some mixed chains:
88bcd7e3e8SAdam Dybkowski
89bcd7e3e8SAdam Dybkowski.. table:: Supported hash-cipher chains for wireless digest-encrypted cases
90bcd7e3e8SAdam Dybkowski
91bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
92bcd7e3e8SAdam Dybkowski   | Cipher algorithm | NULL AUTH | SNOW3G UIA2 | ZUC EIA3 | AES CMAC |
93bcd7e3e8SAdam Dybkowski   +==================+===========+=============+==========+==========+
94a1598e90SAdam Dybkowski   | NULL CIPHER      | Y         | 2&3         | 2&3      | Y        |
95bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
96a1598e90SAdam Dybkowski   | SNOW3G UEA2      | 2&3       | Y           | 2&3      | 2&3      |
97bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
98a1598e90SAdam Dybkowski   | ZUC EEA3         | 2&3       | 2&3         | 2&3      | 2&3      |
99bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
100a1598e90SAdam Dybkowski   | AES CTR          | Y         | 2&3         | 2&3      | Y        |
101bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
102bcd7e3e8SAdam Dybkowski
103bcd7e3e8SAdam Dybkowski* The combinations marked as "Y" are supported on all QAT hardware versions.
104bcd7e3e8SAdam Dybkowski* The combinations marked as "2&3" are supported on GEN2/GEN3 QAT hardware only.
105bcd7e3e8SAdam Dybkowski
106bcd7e3e8SAdam Dybkowski
1071703e94aSDeclan DohertyLimitations
10859ad25feSFiona Trahe~~~~~~~~~~~
1091703e94aSDeclan Doherty
1101703e94aSDeclan Doherty* Only supports the session-oriented API implementation (session-less APIs are not supported).
1112142e6dcSPablo de Lara* SNOW 3G (UEA2), KASUMI (F8) and ZUC (EEA3) supported only if cipher length and offset fields are byte-multiple.
1129333cfbaSPablo de Lara* SNOW 3G (UIA2) and ZUC (EIA3) supported only if hash length and offset fields are byte-multiple.
1138831895bSFiona Trahe* No BSD support as BSD QAT kernel driver not available.
114d9b7d5bbSArek Kusztal* ZUC EEA3/EIA3 is not supported by dh895xcc devices
1152a7bb4fdSFiona Trahe* Maximum additional authenticated data (AAD) for GCM is 240 bytes long and must be passed to the device in a buffer rounded up to the nearest block-size multiple (x16) and padded with zeros.
116026f21c0SFiona Trahe* Queue-pairs are thread-safe on Intel CPUs but Queues are not (that is, within a single
117026f21c0SFiona Trahe  queue-pair all enqueues to the TX queue must be done from one thread and all dequeues
118026f21c0SFiona Trahe  from the RX queue must be done from one thread, but enqueues and dequeues may be done
119026f21c0SFiona Trahe  in different threads.)
120aa983f03SAdam Dybkowski* A GCM limitation exists, but only in the case where there are multiple
121aa983f03SAdam Dybkowski  generations of QAT devices on a single platform.
122aa983f03SAdam Dybkowski  To optimise performance, the GCM crypto session should be initialised for the
123aa983f03SAdam Dybkowski  device generation to which the ops will be enqueued. Specifically if a GCM
124aa983f03SAdam Dybkowski  session is initialised on a GEN2 device, but then attached to an op enqueued
125aa983f03SAdam Dybkowski  to a GEN3 device, it will work but cannot take advantage of hardware
126aa983f03SAdam Dybkowski  optimisations in the GEN3 device. And if a GCM session is initialised on a
127aa983f03SAdam Dybkowski  GEN3 device, then attached to an op sent to a GEN1/GEN2 device, it will not be
128aa983f03SAdam Dybkowski  enqueued to the device and will be marked as failed. The simplest way to
129aa983f03SAdam Dybkowski  mitigate this is to use the bdf whitelist to avoid mixing devices of different
130aa983f03SAdam Dybkowski  generations in the same process if planning to use for GCM.
131a1598e90SAdam Dybkowski* The mixed algo feature on GEN2 is not supported by all kernel drivers. Check
132a1598e90SAdam Dybkowski  the notes under the Available Kernel Drivers table below for specific details.
1336f0ef237SDavid Coyle* Out-of-place is not supported for combined Crypto-CRC DOCSIS security
1346f0ef237SDavid Coyle  protocol.
1356f0ef237SDavid Coyle* ``RTE_CRYPTO_CIPHER_DES_DOCSISBPI`` is not supported for combined Crypto-CRC
1366f0ef237SDavid Coyle  DOCSIS security protocol.
137*6b048cdfSDavid Coyle* Multi-segment buffers are not supported for combined Crypto-CRC DOCSIS
138*6b048cdfSDavid Coyle  security protocol.
1391703e94aSDeclan Doherty
140bb44fb6fSFiona TraheExtra notes on KASUMI F9
14159ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~
1421703e94aSDeclan Doherty
143bb44fb6fSFiona TraheWhen using KASUMI F9 authentication algorithm, the input buffer must be
144aa38c849SFiona Traheconstructed according to the
145aa38c849SFiona Trahe`3GPP KASUMI specification <http://cryptome.org/3gpp/35201-900.pdf>`_
146aa38c849SFiona Trahe(section 4.4, page 13). The input buffer has to have COUNT (4 bytes),
147aa38c849SFiona TraheFRESH (4 bytes), MESSAGE and DIRECTION (1 bit) concatenated. After the DIRECTION
148aa38c849SFiona Trahebit, a single '1' bit is appended, followed by between 0 and 7 '0' bits, so that
149aa38c849SFiona Trahethe total length of the buffer is multiple of 8 bits. Note that the actual
150aa38c849SFiona Trahemessage can be any length, specified in bits.
151bb44fb6fSFiona Trahe
152bb44fb6fSFiona TraheOnce this buffer is passed this way, when creating the crypto operation,
153aa38c849SFiona Trahelength of data to authenticate "op.sym.auth.data.length" must be the length
154bb44fb6fSFiona Traheof all the items described above, including the padding at the end.
155aa38c849SFiona TraheAlso, offset of data to authenticate "op.sym.auth.data.offset"
156bb44fb6fSFiona Trahemust be such that points at the start of the COUNT bytes.
157bb44fb6fSFiona Trahe
158f81cbc20SArek KusztalAsymmetric Crypto Service on QAT
159f81cbc20SArek Kusztal--------------------------------
160bb44fb6fSFiona Trahe
161bfd84d7eSArek KusztalThe QAT asymmetric crypto PMD (hereafter referred to as `QAT ASYM [PMD]`) provides
162bfd84d7eSArek Kusztalpoll mode crypto driver support for the following hardware accelerator devices:
163f81cbc20SArek Kusztal
164bfd84d7eSArek Kusztal* ``Intel QuickAssist Technology DH895xCC``
165bfd84d7eSArek Kusztal* ``Intel QuickAssist Technology C62x``
166bfd84d7eSArek Kusztal* ``Intel QuickAssist Technology C3xxx``
167bfd84d7eSArek Kusztal* ``Intel QuickAssist Technology D15xx``
168cb440babSAdam Dybkowski* ``Intel QuickAssist Technology C4xxx``
169bfd84d7eSArek Kusztal
170bfd84d7eSArek KusztalThe QAT ASYM PMD has support for:
171bfd84d7eSArek Kusztal
172bfd84d7eSArek Kusztal* ``RTE_CRYPTO_ASYM_XFORM_MODEX``
173bfd84d7eSArek Kusztal* ``RTE_CRYPTO_ASYM_XFORM_MODINV``
174fb70b33bSArek Kusztal
175f81cbc20SArek KusztalLimitations
176f81cbc20SArek Kusztal~~~~~~~~~~~
177bb44fb6fSFiona Trahe
178bfd84d7eSArek Kusztal* Big integers longer than 4096 bits are not supported.
179026f21c0SFiona Trahe* Queue-pairs are thread-safe on Intel CPUs but Queues are not (that is, within a single
180026f21c0SFiona Trahe  queue-pair all enqueues to the TX queue must be done from one thread and all dequeues
181026f21c0SFiona Trahe  from the RX queue must be done from one thread, but enqueues and dequeues may be done
182026f21c0SFiona Trahe  in different threads.)
183e2c5f4eaSArek Kusztal* RSA-2560, RSA-3584 are not supported
184bfd84d7eSArek Kusztal
18559ad25feSFiona Trahe.. _building_qat:
18659ad25feSFiona Trahe
18759ad25feSFiona TraheBuilding PMDs on QAT
18859ad25feSFiona Trahe--------------------
189bb44fb6fSFiona Trahe
19002545b6cSFiona TraheA QAT device can host multiple acceleration services:
19102545b6cSFiona Trahe
19202545b6cSFiona Trahe* symmetric cryptography
19302545b6cSFiona Trahe* data compression
194f81cbc20SArek Kusztal* asymmetric cryptography
19502545b6cSFiona Trahe
19602545b6cSFiona TraheThese services are provided to DPDK applications via PMDs which register to
19702545b6cSFiona Traheimplement the corresponding cryptodev and compressdev APIs. The PMDs use
19802545b6cSFiona Trahecommon QAT driver code which manages the QAT PCI device. They also depend on a
19902545b6cSFiona TraheQAT kernel driver being installed on the platform, see :ref:`qat_kernel` below.
2001703e94aSDeclan Doherty
201bb44fb6fSFiona Trahe
20202545b6cSFiona TraheConfiguring and Building the DPDK QAT PMDs
20302545b6cSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20402545b6cSFiona Trahe
20502545b6cSFiona Trahe
20602545b6cSFiona TraheFurther information on configuring, building and installing DPDK is described
20743628b3dSDavid Marchand:doc:`here <../linux_gsg/build_dpdk>`.
20802545b6cSFiona Trahe
20902545b6cSFiona Trahe
21002545b6cSFiona TraheQuick instructions for QAT cryptodev PMD are as follows:
211d6740135SEoin Breen
212d6740135SEoin Breen.. code-block:: console
213d6740135SEoin Breen
214f546c1edSFiona Trahe	cd to the top-level DPDK directory
21502545b6cSFiona Trahe	make defconfig
216bb44fb6fSFiona Trahe	sed -i 's,\(CONFIG_RTE_LIBRTE_PMD_QAT_SYM\)=n,\1=y,' build/.config
217bfd84d7eSArek Kusztal	or/and
218bfd84d7eSArek Kusztal	sed -i 's,\(CONFIG_RTE_LIBRTE_PMD_QAT_ASYM\)=n,\1=y,' build/.config
219d6740135SEoin Breen	make
220d6740135SEoin Breen
22102545b6cSFiona TraheQuick instructions for QAT compressdev PMD are as follows:
222bb44fb6fSFiona Trahe
22302545b6cSFiona Trahe.. code-block:: console
224bb44fb6fSFiona Trahe
22502545b6cSFiona Trahe	cd to the top-level DPDK directory
22602545b6cSFiona Trahe	make defconfig
22702545b6cSFiona Trahe	make
228bb44fb6fSFiona Trahe
229bb44fb6fSFiona Trahe
2305f40555bSTomasz Jozwiak.. _building_qat_config:
2315f40555bSTomasz Jozwiak
2327ce27b9eSFiona TraheBuild Configuration
2337ce27b9eSFiona Trahe~~~~~~~~~~~~~~~~~~~
2347ce27b9eSFiona Trahe
2357ce27b9eSFiona TraheThese are the build configuration options affecting QAT, and their default values:
2367ce27b9eSFiona Trahe
2377ce27b9eSFiona Trahe.. code-block:: console
2387ce27b9eSFiona Trahe
2397ce27b9eSFiona Trahe	CONFIG_RTE_LIBRTE_PMD_QAT=y
2407ce27b9eSFiona Trahe	CONFIG_RTE_LIBRTE_PMD_QAT_SYM=n
241bfd84d7eSArek Kusztal	CONFIG_RTE_LIBRTE_PMD_QAT_ASYM=n
2427ce27b9eSFiona Trahe	CONFIG_RTE_PMD_QAT_MAX_PCI_DEVICES=48
2434e8f2d6aSFiona Trahe	CONFIG_RTE_PMD_QAT_COMP_IM_BUFFER_SIZE=65536
2447ce27b9eSFiona Trahe
2457ce27b9eSFiona TraheCONFIG_RTE_LIBRTE_PMD_QAT must be enabled for any QAT PMD to be built.
2467ce27b9eSFiona Trahe
247bfd84d7eSArek KusztalBoth QAT SYM PMD and QAT ASYM PMD have an external dependency on libcrypto, so are not
248bfd84d7eSArek Kusztalbuilt by default. CONFIG_RTE_LIBRTE_PMD_QAT_SYM/ASYM should be enabled to build them.
2497ce27b9eSFiona Trahe
2507ce27b9eSFiona TraheThe QAT compressdev PMD has no external dependencies, so needs no configuration
2517ce27b9eSFiona Traheoptions and is built by default.
2527ce27b9eSFiona Trahe
2537ce27b9eSFiona TraheThe number of VFs per PF varies - see table below. If multiple QAT packages are
2547ce27b9eSFiona Traheinstalled on a platform then CONFIG_RTE_PMD_QAT_MAX_PCI_DEVICES should be
2557ce27b9eSFiona Traheadjusted to the number of VFs which the QAT common code will need to handle.
256bfd84d7eSArek Kusztal
257bfd84d7eSArek Kusztal.. Note::
258bfd84d7eSArek Kusztal
259bfd84d7eSArek Kusztal        There are separate config items (not QAT-specific) for max cryptodevs
260bfd84d7eSArek Kusztal        CONFIG_RTE_CRYPTO_MAX_DEVS and max compressdevs CONFIG_RTE_COMPRESS_MAX_DEVS,
261bfd84d7eSArek Kusztal        if necessary these should be adjusted to handle the total of QAT and other
262bfd84d7eSArek Kusztal        devices which the process will use. In particular for crypto, where each
263bfd84d7eSArek Kusztal        QAT VF may expose two crypto devices, sym and asym, it may happen that the
264bfd84d7eSArek Kusztal        number of devices will be bigger than MAX_DEVS and the process will show an error
265bfd84d7eSArek Kusztal        during PMD initialisation. To avoid this problem CONFIG_RTE_CRYPTO_MAX_DEVS may be
266bfd84d7eSArek Kusztal        increased or -w, pci-whitelist domain:bus:devid:func option may be used.
267bfd84d7eSArek Kusztal
2687ce27b9eSFiona Trahe
2694e8f2d6aSFiona TraheQAT compression PMD needs intermediate buffers to support Deflate compression
2704e8f2d6aSFiona Trahewith Dynamic Huffman encoding. CONFIG_RTE_PMD_QAT_COMP_IM_BUFFER_SIZE
2714e8f2d6aSFiona Trahespecifies the size of a single buffer, the PMD will allocate a multiple of these,
2725f40555bSTomasz Jozwiakplus some extra space for associated meta-data. For GEN2 devices, 20 buffers are
2735f40555bSTomasz Jozwiakallocated while for GEN1 devices, 12 buffers are allocated, plus 1472 bytes overhead.
2744e8f2d6aSFiona Trahe
2754e8f2d6aSFiona Trahe.. Note::
2764e8f2d6aSFiona Trahe
2774e8f2d6aSFiona Trahe	If the compressed output of a Deflate operation using Dynamic Huffman
2784e8f2d6aSFiona Trahe	Encoding is too big to fit in an intermediate buffer, then the
279c13cecf6SAdam Dybkowski	operation will be split into smaller operations and their results will
280c13cecf6SAdam Dybkowski	be merged afterwards.
281c13cecf6SAdam Dybkowski	This is not possible if any checksum calculation was requested - in such
282c13cecf6SAdam Dybkowski	case the code falls back to fixed compression.
283a720e674STomasz Jozwiak	To avoid this less performant case, applications should configure
284a720e674STomasz Jozwiak	the intermediate buffer size to be larger than the expected input data size
285a720e674STomasz Jozwiak	(compressed output size is usually unknown, so the only option is to make
286a720e674STomasz Jozwiak	larger than the input size).
2874e8f2d6aSFiona Trahe
288bb44fb6fSFiona Trahe
28947c3f7a4SArek KusztalRunning QAT PMD with minimum threshold for burst size
29047c3f7a4SArek Kusztal~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29147c3f7a4SArek Kusztal
29247c3f7a4SArek KusztalIf only a small number or packets can be enqueued. Each enqueue causes an expensive MMIO write.
29347c3f7a4SArek KusztalThese MMIO write occurrences can be optimised by setting any of the following parameters:
29447c3f7a4SArek Kusztal
29547c3f7a4SArek Kusztal- qat_sym_enq_threshold
29647c3f7a4SArek Kusztal- qat_asym_enq_threshold
29747c3f7a4SArek Kusztal- qat_comp_enq_threshold
29847c3f7a4SArek Kusztal
29947c3f7a4SArek KusztalWhen any of these parameters is set rte_cryptodev_enqueue_burst function will
30047c3f7a4SArek Kusztalreturn 0 (thereby avoiding an MMIO) if the device is congested and number of packets
30147c3f7a4SArek Kusztalpossible to enqueue is smaller.
30247c3f7a4SArek KusztalTo use this feature the user must set the parameter on process start as a device additional parameter::
30347c3f7a4SArek Kusztal
30447c3f7a4SArek Kusztal  -w 03:01.1,qat_sym_enq_threshold=32,qat_comp_enq_threshold=16
30547c3f7a4SArek Kusztal
30647c3f7a4SArek KusztalAll parameters can be used with the same device regardless of order. Parameters are separated
30747c3f7a4SArek Kusztalby comma. When the same parameter is used more than once first occurrence of the parameter
30847c3f7a4SArek Kusztalis used.
30947c3f7a4SArek KusztalMaximum threshold that can be set is 32.
31047c3f7a4SArek Kusztal
31147c3f7a4SArek Kusztal
312bb44fb6fSFiona TraheDevice and driver naming
31359ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~
314bb44fb6fSFiona Trahe
315bfd84d7eSArek Kusztal* The qat cryptodev symmetric crypto driver name is "crypto_qat".
316bfd84d7eSArek Kusztal* The qat cryptodev asymmetric crypto driver name is "crypto_qat_asym".
317bb44fb6fSFiona Trahe
318bfd84d7eSArek KusztalThe "rte_cryptodev_devices_get()" returns the devices exposed by either of these drivers.
319bfd84d7eSArek Kusztal
320bfd84d7eSArek Kusztal* Each qat sym crypto device has a unique name, in format
321aa38c849SFiona Trahe  "<pci bdf>_<service>", e.g. "0000:41:01.0_qat_sym".
322bfd84d7eSArek Kusztal* Each qat asym crypto device has a unique name, in format
323bfd84d7eSArek Kusztal  "<pci bdf>_<service>", e.g. "0000:41:01.0_qat_asym".
324aa38c849SFiona Trahe  This name can be passed to "rte_cryptodev_get_dev_id()" to get the device_id.
325bb44fb6fSFiona Trahe
326bb44fb6fSFiona Trahe.. Note::
327bb44fb6fSFiona Trahe
328bfd84d7eSArek Kusztal	The cryptodev driver name is passed to the dpdk-test-crypto-perf tool in the "-devtype" parameter.
329bb44fb6fSFiona Trahe
330bb44fb6fSFiona Trahe	The qat crypto device name is in the format of the slave parameter passed to the crypto scheduler.
331bb44fb6fSFiona Trahe
332df8cca46SFiona Trahe* The qat compressdev driver name is "compress_qat".
333bb44fb6fSFiona Trahe  The rte_compressdev_devices_get() returns the devices exposed by this driver.
334bb44fb6fSFiona Trahe
335bb44fb6fSFiona Trahe* Each qat compression device has a unique name, in format
336bb44fb6fSFiona Trahe  <pci bdf>_<service>, e.g. "0000:41:01.0_qat_comp".
337bb44fb6fSFiona Trahe  This name can be passed to rte_compressdev_get_dev_id() to get the device_id.
338bb44fb6fSFiona Trahe
33902545b6cSFiona Trahe.. _qat_kernel:
34002545b6cSFiona Trahe
34102545b6cSFiona TraheDependency on the QAT kernel driver
34202545b6cSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34302545b6cSFiona Trahe
34402545b6cSFiona TraheTo use QAT an SRIOV-enabled QAT kernel driver is required. The VF
34502545b6cSFiona Trahedevices created and initialised by this driver will be used by the QAT PMDs.
34602545b6cSFiona Trahe
34702545b6cSFiona TraheInstructions for installation are below, but first an explanation of the
34802545b6cSFiona Traherelationships between the PF/VF devices and the PMDs visible to
34902545b6cSFiona TraheDPDK applications.
35002545b6cSFiona Trahe
35102545b6cSFiona TraheEach QuickAssist PF device exposes a number of VF devices. Each VF device can
352bfd84d7eSArek Kusztalenable one symmetric cryptodev PMD and/or one asymmetric cryptodev PMD and/or
353bfd84d7eSArek Kusztalone compressdev PMD.
35402545b6cSFiona TraheThese QAT PMDs share the same underlying device and pci-mgmt code, but are
35502545b6cSFiona Traheenumerated independently on their respective APIs and appear as independent
35602545b6cSFiona Trahedevices to applications.
35702545b6cSFiona Trahe
35802545b6cSFiona Trahe.. Note::
35902545b6cSFiona Trahe
36002545b6cSFiona Trahe   Each VF can only be used by one DPDK process. It is not possible to share
36102545b6cSFiona Trahe   the same VF across multiple processes, even if these processes are using
36202545b6cSFiona Trahe   different acceleration services.
36302545b6cSFiona Trahe
36402545b6cSFiona Trahe   Conversely one DPDK process can use one or more QAT VFs and can expose both
36502545b6cSFiona Trahe   cryptodev and compressdev instances on each of those VFs.
36602545b6cSFiona Trahe
367bb44fb6fSFiona Trahe
368bb44fb6fSFiona TraheAvailable kernel drivers
36959ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~
370bb44fb6fSFiona Trahe
371ab3dec55SFiona TraheKernel drivers for each device for each service are listed in the following table. (Scroll right
372ab3dec55SFiona Traheto see the full table)
373bb44fb6fSFiona Trahe
3741703e94aSDeclan Doherty
375f546c1edSFiona Trahe.. _table_qat_pmds_drivers:
376f546c1edSFiona Trahe
377f5160653SArek Kusztal.. table:: QAT device generations, devices and drivers
378f546c1edSFiona Trahe
379ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
380ab3dec55SFiona Trahe   | S   | A   | C   | Gen | Device   | Driver/ver    | Kernel Module | Pci Driver | PF Did | #PFs | VF Did | VFs/PF |
381ab3dec55SFiona Trahe   +=====+=====+=====+=====+==========+===============+===============+============+========+======+========+========+
382ab3dec55SFiona Trahe   | Yes | No  | No  | 1   | DH895xCC | linux/4.4+    | qat_dh895xcc  | dh895xcc   | 435    | 1    | 443    | 32     |
383ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
384bfd84d7eSArek Kusztal   | Yes | Yes | No  | "   | "        | 01.org/4.2.0+ | "             | "          | "      | "    | "      | "      |
385ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
386bfd84d7eSArek Kusztal   | Yes | Yes | Yes | "   | "        | 01.org/4.3.0+ | "             | "          | "      | "    | "      | "      |
387ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
388ab3dec55SFiona Trahe   | Yes | No  | No  | 2   | C62x     | linux/4.5+    | qat_c62x      | c6xx       | 37c8   | 3    | 37c9   | 16     |
389ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
390bfd84d7eSArek Kusztal   | Yes | Yes | Yes | "   | "        | 01.org/4.2.0+ | "             | "          | "      | "    | "      | "      |
391ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
392ab3dec55SFiona Trahe   | Yes | No  | No  | 2   | C3xxx    | linux/4.5+    | qat_c3xxx     | c3xxx      | 19e2   | 1    | 19e3   | 16     |
393ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
394bfd84d7eSArek Kusztal   | Yes | Yes | Yes | "   | "        | 01.org/4.2.0+ | "             | "          | "      | "    | "      | "      |
395ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
396ab3dec55SFiona Trahe   | Yes | No  | No  | 2   | D15xx    | p             | qat_d15xx     | d15xx      | 6f54   | 1    | 6f55   | 16     |
397ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
398cb440babSAdam Dybkowski   | Yes | No  | No  | 3   | C4xxx    | p             | qat_c4xxx     | c4xxx      | 18a0   | 1    | 18a1   | 128    |
399ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
400f546c1edSFiona Trahe
401a1598e90SAdam Dybkowski* Note: Symmetric mixed crypto algorithms feature on Gen 2 works only with 01.org driver version 4.9.0+
402a1598e90SAdam Dybkowski
403ab3dec55SFiona TraheThe first 3 columns indicate the service:
404ab3dec55SFiona Trahe
405ab3dec55SFiona Trahe* S = Symmetric crypto service (via cryptodev API)
406ab3dec55SFiona Trahe* A = Asymmetric crypto service  (via cryptodev API)
407ab3dec55SFiona Trahe* C = Compression service (via compressdev API)
408f546c1edSFiona Trahe
409f546c1edSFiona TraheThe ``Driver`` column indicates either the Linux kernel version in which
410f546c1edSFiona Trahesupport for this device was introduced or a driver available on Intel's 01.org
411ab3dec55SFiona Trahewebsite. There are both linux in-tree and 01.org kernel drivers available for some
412259310f3SFiona Trahedevices. p = release pending.
413f546c1edSFiona Trahe
414f546c1edSFiona TraheIf you are running on a kernel which includes a driver for your device, see
415f546c1edSFiona Trahe`Installation using kernel.org driver`_ below. Otherwise see
416f546c1edSFiona Trahe`Installation using 01.org QAT driver`_.
417f546c1edSFiona Trahe
418f546c1edSFiona Trahe
419f546c1edSFiona TraheInstallation using kernel.org driver
42059ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
421f546c1edSFiona Trahe
422f546c1edSFiona TraheThe examples below are based on the C62x device, if you have a different device
423f546c1edSFiona Traheuse the corresponding values in the above table.
424f546c1edSFiona Trahe
425f546c1edSFiona TraheIn BIOS ensure that SRIOV is enabled and either:
426f546c1edSFiona Trahe
427f546c1edSFiona Trahe* Disable VT-d or
428f546c1edSFiona Trahe* Enable VT-d and set ``"intel_iommu=on iommu=pt"`` in the grub file.
429f546c1edSFiona Trahe
430f546c1edSFiona TraheCheck that the QAT driver is loaded on your system, by executing::
431f546c1edSFiona Trahe
432f546c1edSFiona Trahe    lsmod | grep qa
433f546c1edSFiona Trahe
434f546c1edSFiona TraheYou should see the kernel module for your device listed, e.g.::
435f546c1edSFiona Trahe
436f546c1edSFiona Trahe    qat_c62x               5626  0
437f546c1edSFiona Trahe    intel_qat              82336  1 qat_c62x
438f546c1edSFiona Trahe
439f546c1edSFiona TraheNext, you need to expose the Virtual Functions (VFs) using the sysfs file system.
440f546c1edSFiona Trahe
441f546c1edSFiona TraheFirst find the BDFs (Bus-Device-Function) of the physical functions (PFs) of
442f546c1edSFiona Traheyour device, e.g.::
443f546c1edSFiona Trahe
444f546c1edSFiona Trahe    lspci -d:37c8
445f546c1edSFiona Trahe
446f546c1edSFiona TraheYou should see output similar to::
447f546c1edSFiona Trahe
448f546c1edSFiona Trahe    1a:00.0 Co-processor: Intel Corporation Device 37c8
449f546c1edSFiona Trahe    3d:00.0 Co-processor: Intel Corporation Device 37c8
450f546c1edSFiona Trahe    3f:00.0 Co-processor: Intel Corporation Device 37c8
451f546c1edSFiona Trahe
452f546c1edSFiona TraheEnable the VFs for each PF by echoing the number of VFs per PF to the pci driver::
453f546c1edSFiona Trahe
454f546c1edSFiona Trahe     echo 16 > /sys/bus/pci/drivers/c6xx/0000:1a:00.0/sriov_numvfs
455f546c1edSFiona Trahe     echo 16 > /sys/bus/pci/drivers/c6xx/0000:3d:00.0/sriov_numvfs
456f546c1edSFiona Trahe     echo 16 > /sys/bus/pci/drivers/c6xx/0000:3f:00.0/sriov_numvfs
457f546c1edSFiona Trahe
458f546c1edSFiona TraheCheck that the VFs are available for use. For example ``lspci -d:37c9`` should
459f546c1edSFiona Trahelist 48 VF devices available for a ``C62x`` device.
460f546c1edSFiona Trahe
461f546c1edSFiona TraheTo complete the installation follow the instructions in
462f546c1edSFiona Trahe`Binding the available VFs to the DPDK UIO driver`_.
463f546c1edSFiona Trahe
464f546c1edSFiona Trahe.. Note::
465f546c1edSFiona Trahe
466f546c1edSFiona Trahe   If the QAT kernel modules are not loaded and you see an error like ``Failed
467f546c1edSFiona Trahe   to load MMP firmware qat_895xcc_mmp.bin`` in kernel logs, this may be as a
468f546c1edSFiona Trahe   result of not using a distribution, but just updating the kernel directly.
469f546c1edSFiona Trahe
470f546c1edSFiona Trahe   Download firmware from the `kernel firmware repo
471f546c1edSFiona Trahe   <http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/>`_.
472f546c1edSFiona Trahe
473f546c1edSFiona Trahe   Copy qat binaries to ``/lib/firmware``::
474f546c1edSFiona Trahe
475f546c1edSFiona Trahe      cp qat_895xcc.bin /lib/firmware
476f546c1edSFiona Trahe      cp qat_895xcc_mmp.bin /lib/firmware
477f546c1edSFiona Trahe
478f546c1edSFiona Trahe   Change to your linux source root directory and start the qat kernel modules::
479f546c1edSFiona Trahe
480f546c1edSFiona Trahe      insmod ./drivers/crypto/qat/qat_common/intel_qat.ko
481f546c1edSFiona Trahe      insmod ./drivers/crypto/qat/qat_dh895xcc/qat_dh895xcc.ko
482f546c1edSFiona Trahe
483f546c1edSFiona Trahe
484f546c1edSFiona Trahe.. Note::
485f546c1edSFiona Trahe
486f546c1edSFiona Trahe   If you see the following warning in ``/var/log/messages`` it can be ignored:
487f546c1edSFiona Trahe   ``IOMMU should be enabled for SR-IOV to work correctly``.
488ae20c073SDeepak Kumar Jain
4891703e94aSDeclan Doherty
4901703e94aSDeclan DohertyInstallation using 01.org QAT driver
49159ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4921703e94aSDeclan Doherty
4931703e94aSDeclan DohertyDownload the latest QuickAssist Technology Driver from `01.org
494f546c1edSFiona Trahe<https://01.org/packet-processing/intel%C2%AE-quickassist-technology-drivers-and-patches>`_.
4951703e94aSDeclan DohertyConsult the *Getting Started Guide* at the same URL for further information.
4961703e94aSDeclan Doherty
4971703e94aSDeclan DohertyThe steps below assume you are:
4981703e94aSDeclan Doherty
499bb44fb6fSFiona Trahe* Building on a platform with one ``C62x`` device.
500bb44fb6fSFiona Trahe* Using package ``qat1.7.l.4.2.0-000xx.tar.gz``.
501bb44fb6fSFiona Trahe* On Fedora26 kernel ``4.11.11-300.fc26.x86_64``.
5021703e94aSDeclan Doherty
5031703e94aSDeclan DohertyIn the BIOS ensure that SRIOV is enabled and VT-d is disabled.
5041703e94aSDeclan Doherty
5051703e94aSDeclan DohertyUninstall any existing QAT driver, for example by running:
5061703e94aSDeclan Doherty
5071703e94aSDeclan Doherty* ``./installer.sh uninstall`` in the directory where originally installed.
5081703e94aSDeclan Doherty
5091703e94aSDeclan Doherty
5101703e94aSDeclan DohertyBuild and install the SRIOV-enabled QAT driver::
5111703e94aSDeclan Doherty
5121703e94aSDeclan Doherty    mkdir /QAT
5131703e94aSDeclan Doherty    cd /QAT
514f546c1edSFiona Trahe
515bb44fb6fSFiona Trahe    # Copy the package to this location and unpack
516bb44fb6fSFiona Trahe    tar zxof qat1.7.l.4.2.0-000xx.tar.gz
5171703e94aSDeclan Doherty
518bb44fb6fSFiona Trahe    ./configure --enable-icp-sriov=host
519bb44fb6fSFiona Trahe    make install
5201703e94aSDeclan Doherty
521bb44fb6fSFiona TraheYou can use ``cat /sys/kernel/debug/qat<your device type and bdf>/version/fw`` to confirm the driver is correctly installed and is using firmware version 4.2.0.
522bb44fb6fSFiona TraheYou can use ``lspci -d:37c9`` to confirm the presence of the 16 VF devices available per ``C62x`` PF.
523bb44fb6fSFiona Trahe
524bb44fb6fSFiona TraheConfirm the driver is correctly installed and is using firmware version 4.2.0::
525bb44fb6fSFiona Trahe
526bb44fb6fSFiona Trahe    cat /sys/kernel/debug/qat<your device type and bdf>/version/fw
527bb44fb6fSFiona Trahe
528bb44fb6fSFiona Trahe
529bb44fb6fSFiona TraheConfirm the presence of 48 VF devices - 16 per PF::
530bb44fb6fSFiona Trahe
531bb44fb6fSFiona Trahe    lspci -d:37c9
532bb44fb6fSFiona Trahe
5331703e94aSDeclan Doherty
5341703e94aSDeclan DohertyTo complete the installation - follow instructions in `Binding the available VFs to the DPDK UIO driver`_.
5351703e94aSDeclan Doherty
536f546c1edSFiona Trahe.. Note::
537f546c1edSFiona Trahe
538f546c1edSFiona Trahe   If using a later kernel and the build fails with an error relating to
539f546c1edSFiona Trahe   ``strict_stroul`` not being available apply the following patch:
5401703e94aSDeclan Doherty
5411703e94aSDeclan Doherty   .. code-block:: diff
5421703e94aSDeclan Doherty
5431703e94aSDeclan Doherty      /QAT/QAT1.6/quickassist/utilities/downloader/Target_CoreLibs/uclo/include/linux/uclo_platform.h
5441703e94aSDeclan Doherty      + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,5)
5451703e94aSDeclan Doherty      + #define STR_TO_64(str, base, num, endPtr) {endPtr=NULL; if (kstrtoul((str), (base), (num))) printk("Error strtoull convert %s\n", str); }
5461703e94aSDeclan Doherty      + #else
5471703e94aSDeclan Doherty      #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
5481703e94aSDeclan Doherty      #define STR_TO_64(str, base, num, endPtr) {endPtr=NULL; if (strict_strtoull((str), (base), (num))) printk("Error strtoull convert %s\n", str); }
5491703e94aSDeclan Doherty      #else
5501703e94aSDeclan Doherty      #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
5511703e94aSDeclan Doherty      #define STR_TO_64(str, base, num, endPtr) {endPtr=NULL; strict_strtoll((str), (base), (num));}
5521703e94aSDeclan Doherty      #else
5531703e94aSDeclan Doherty      #define STR_TO_64(str, base, num, endPtr)                                 \
5541703e94aSDeclan Doherty           do {                                                               \
5551703e94aSDeclan Doherty                 if (str[0] == '-')                                           \
5561703e94aSDeclan Doherty                 {                                                            \
5571703e94aSDeclan Doherty                      *(num) = -(simple_strtoull((str+1), &(endPtr), (base))); \
5581703e94aSDeclan Doherty                 }else {                                                      \
5591703e94aSDeclan Doherty                      *(num) = simple_strtoull((str), &(endPtr), (base));      \
5601703e94aSDeclan Doherty                 }                                                            \
5611703e94aSDeclan Doherty           } while(0)
5621703e94aSDeclan Doherty      + #endif
5631703e94aSDeclan Doherty      #endif
5641703e94aSDeclan Doherty      #endif
5651703e94aSDeclan Doherty
5661703e94aSDeclan Doherty
567f546c1edSFiona Trahe.. Note::
5681703e94aSDeclan Doherty
569f546c1edSFiona Trahe   If the build fails due to missing header files you may need to do following::
5701703e94aSDeclan Doherty
571f546c1edSFiona Trahe      sudo yum install zlib-devel
572f546c1edSFiona Trahe      sudo yum install openssl-devel
573bb44fb6fSFiona Trahe      sudo yum install libudev-devel
5741703e94aSDeclan Doherty
575f546c1edSFiona Trahe.. Note::
5761703e94aSDeclan Doherty
577f546c1edSFiona Trahe   If the build or install fails due to mismatching kernel sources you may need to do the following::
5781703e94aSDeclan Doherty
579f546c1edSFiona Trahe      sudo yum install kernel-headers-`uname -r`
580f546c1edSFiona Trahe      sudo yum install kernel-src-`uname -r`
581f546c1edSFiona Trahe      sudo yum install kernel-devel-`uname -r`
5821703e94aSDeclan Doherty
583f2f639c6SDeepak Kumar Jain
5841703e94aSDeclan DohertyBinding the available VFs to the DPDK UIO driver
58559ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5861703e94aSDeclan Doherty
587f546c1edSFiona TraheUnbind the VFs from the stock driver so they can be bound to the uio driver.
5881703e94aSDeclan Doherty
589f546c1edSFiona TraheFor an Intel(R) QuickAssist Technology DH895xCC device
59059ad25feSFiona Trahe^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
591f546c1edSFiona Trahe
592f546c1edSFiona TraheThe unbind command below assumes ``BDFs`` of ``03:01.00-03:04.07``, if your
593f546c1edSFiona TraheVFs are different adjust the unbind command below::
5941703e94aSDeclan Doherty
5951703e94aSDeclan Doherty    for device in $(seq 1 4); do \
5961703e94aSDeclan Doherty        for fn in $(seq 0 7); do \
5971703e94aSDeclan Doherty            echo -n 0000:03:0${device}.${fn} > \
5981703e94aSDeclan Doherty            /sys/bus/pci/devices/0000\:03\:0${device}.${fn}/driver/unbind; \
5991703e94aSDeclan Doherty        done; \
6001703e94aSDeclan Doherty    done
6011703e94aSDeclan Doherty
602f546c1edSFiona TraheFor an Intel(R) QuickAssist Technology C62x device
60359ad25feSFiona Trahe^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6041703e94aSDeclan Doherty
605f546c1edSFiona TraheThe unbind command below assumes ``BDFs`` of ``1a:01.00-1a:02.07``,
606f546c1edSFiona Trahe``3d:01.00-3d:02.07`` and ``3f:01.00-3f:02.07``, if your VFs are different
607f546c1edSFiona Traheadjust the unbind command below::
608ae20c073SDeepak Kumar Jain
609ae20c073SDeepak Kumar Jain    for device in $(seq 1 2); do \
610ae20c073SDeepak Kumar Jain        for fn in $(seq 0 7); do \
611ae20c073SDeepak Kumar Jain            echo -n 0000:1a:0${device}.${fn} > \
612ae20c073SDeepak Kumar Jain            /sys/bus/pci/devices/0000\:1a\:0${device}.${fn}/driver/unbind; \
613ae20c073SDeepak Kumar Jain
614ae20c073SDeepak Kumar Jain            echo -n 0000:3d:0${device}.${fn} > \
615ae20c073SDeepak Kumar Jain            /sys/bus/pci/devices/0000\:3d\:0${device}.${fn}/driver/unbind; \
616ae20c073SDeepak Kumar Jain
617ae20c073SDeepak Kumar Jain            echo -n 0000:3f:0${device}.${fn} > \
618ae20c073SDeepak Kumar Jain            /sys/bus/pci/devices/0000\:3f\:0${device}.${fn}/driver/unbind; \
619ae20c073SDeepak Kumar Jain        done; \
620ae20c073SDeepak Kumar Jain    done
621ae20c073SDeepak Kumar Jain
622259310f3SFiona TraheFor Intel(R) QuickAssist Technology C3xxx or D15xx device
62359ad25feSFiona Trahe^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
624ae20c073SDeepak Kumar Jain
625f546c1edSFiona TraheThe unbind command below assumes ``BDFs`` of ``01:01.00-01:02.07``, if your
626f546c1edSFiona TraheVFs are different adjust the unbind command below::
627f2f639c6SDeepak Kumar Jain
628f2f639c6SDeepak Kumar Jain    for device in $(seq 1 2); do \
629f2f639c6SDeepak Kumar Jain        for fn in $(seq 0 7); do \
630f2f639c6SDeepak Kumar Jain            echo -n 0000:01:0${device}.${fn} > \
631f2f639c6SDeepak Kumar Jain            /sys/bus/pci/devices/0000\:01\:0${device}.${fn}/driver/unbind; \
632f2f639c6SDeepak Kumar Jain        done; \
633f2f639c6SDeepak Kumar Jain    done
634f2f639c6SDeepak Kumar Jain
635f546c1edSFiona TraheBind to the DPDK uio driver
63659ad25feSFiona Trahe^^^^^^^^^^^^^^^^^^^^^^^^^^^
637f2f639c6SDeepak Kumar Jain
638f546c1edSFiona TraheInstall the DPDK igb_uio driver, bind the VF PCI Device id to it and use lspci
639f546c1edSFiona Traheto confirm the VF devices are now in use by igb_uio kernel driver,
640f546c1edSFiona Trahee.g. for the C62x device::
641f546c1edSFiona Trahe
642f546c1edSFiona Trahe    cd to the top-level DPDK directory
643f546c1edSFiona Trahe    modprobe uio
644f546c1edSFiona Trahe    insmod ./build/kmod/igb_uio.ko
645f546c1edSFiona Trahe    echo "8086 37c9" > /sys/bus/pci/drivers/igb_uio/new_id
646f546c1edSFiona Trahe    lspci -vvd:37c9
647cb4a1d14SEoin Breen
648cb4a1d14SEoin Breen
649f546c1edSFiona TraheAnother way to bind the VFs to the DPDK UIO driver is by using the
650f546c1edSFiona Trahe``dpdk-devbind.py`` script::
651cb4a1d14SEoin Breen
652f546c1edSFiona Trahe    cd to the top-level DPDK directory
653c6dab2a8SThomas Monjalon    ./usertools/dpdk-devbind.py -b igb_uio 0000:03:01.1
6549333cfbaSPablo de Lara
655b1c9177bSFiona TraheTesting
656b1c9177bSFiona Trahe~~~~~~~
657b1c9177bSFiona Trahe
658bfd84d7eSArek KusztalQAT SYM crypto PMD can be tested by running the test application::
659b1c9177bSFiona Trahe
660b1c9177bSFiona Trahe    make defconfig
661a9de470cSBruce Richardson    make -j
662b1c9177bSFiona Trahe    cd ./build/app
663b1c9177bSFiona Trahe    ./test -l1 -n1 -w <your qat bdf>
664b1c9177bSFiona Trahe    RTE>>cryptodev_qat_autotest
665b1c9177bSFiona Trahe
666bfd84d7eSArek KusztalQAT ASYM crypto PMD can be tested by running the test application::
667bfd84d7eSArek Kusztal
668bfd84d7eSArek Kusztal    make defconfig
669bfd84d7eSArek Kusztal    make -j
670bfd84d7eSArek Kusztal    cd ./build/app
671bfd84d7eSArek Kusztal    ./test -l1 -n1 -w <your qat bdf>
672bfd84d7eSArek Kusztal    RTE>>cryptodev_qat_asym_autotest
673bfd84d7eSArek Kusztal
674b1c9177bSFiona TraheQAT compression PMD can be tested by running the test application::
675b1c9177bSFiona Trahe
676b1c9177bSFiona Trahe    make defconfig
677b1c9177bSFiona Trahe    sed -i 's,\(CONFIG_RTE_COMPRESSDEV_TEST\)=n,\1=y,' build/.config
678a9de470cSBruce Richardson    make -j
679b1c9177bSFiona Trahe    cd ./build/app
680b1c9177bSFiona Trahe    ./test -l1 -n1 -w <your qat bdf>
681b1c9177bSFiona Trahe    RTE>>compressdev_autotest
682b1c9177bSFiona Trahe
6839333cfbaSPablo de Lara
6845394c11dSFiona TraheDebugging
68559ad25feSFiona Trahe~~~~~~~~~
6865394c11dSFiona Trahe
6875394c11dSFiona TraheThere are 2 sets of trace available via the dynamic logging feature:
6885394c11dSFiona Trahe
6895394c11dSFiona Trahe* pmd.qat_dp exposes trace on the data-path.
6905394c11dSFiona Trahe* pmd.qat_general exposes all other trace.
6915394c11dSFiona Trahe
6925394c11dSFiona Trahepmd.qat exposes both sets of traces.
6935394c11dSFiona TraheThey can be enabled using the log-level option (where 8=maximum log level) on
6945394c11dSFiona Trahethe process cmdline, e.g. using any of the following::
6955394c11dSFiona Trahe
6965394c11dSFiona Trahe    --log-level="pmd.qat_general,8"
6975394c11dSFiona Trahe    --log-level="pmd.qat_dp,8"
6985394c11dSFiona Trahe    --log-level="pmd.qat,8"
6995394c11dSFiona Trahe
7005394c11dSFiona Trahe.. Note::
7015394c11dSFiona Trahe
7025394c11dSFiona Trahe    The global RTE_LOG_DP_LEVEL overrides data-path trace so must be set to
7035394c11dSFiona Trahe    RTE_LOG_DEBUG to see all the trace. This variable is in config/rte_config.h
7045394c11dSFiona Trahe    for meson build and config/common_base for gnu make.
7055394c11dSFiona Trahe    Also the dynamic global log level overrides both sets of trace, so e.g. no
7065394c11dSFiona Trahe    QAT trace would display in this case::
7075394c11dSFiona Trahe
7085394c11dSFiona Trahe	--log-level="7" --log-level="pmd.qat_general,8"
709