15a441543SLee Daly.. SPDX-License-Identifier: BSD-3-Clause 25a441543SLee Daly Copyright(c) 2018 Intel Corporation. 35a441543SLee Daly 45a441543SLee DalyISA-L Compression Poll Mode Driver 55a441543SLee Daly================================== 65a441543SLee Daly 7*8809f78cSBruce RichardsonThe ISA-L PMD (**librte_compress_isal**) provides poll mode compression & 85a441543SLee Dalydecompression driver support for utilizing Intel ISA-L library, 98a38e972SLee Dalywhich implements the deflate algorithm for both Deflate(compression) and Inflate(decompression). 108a38e972SLee Daly 115a441543SLee Daly 125a441543SLee DalyFeatures 135a441543SLee Daly-------- 145a441543SLee Daly 155a441543SLee DalyISA-L PMD has support for: 165a441543SLee Daly 175a441543SLee DalyCompression/Decompression algorithm: 185a441543SLee Daly 195a441543SLee Daly * DEFLATE 205a441543SLee Daly 215a441543SLee DalyHuffman code type: 225a441543SLee Daly 235a441543SLee Daly * FIXED 245a441543SLee Daly * DYNAMIC 255a441543SLee Daly 265a441543SLee DalyWindow size support: 275a441543SLee Daly 285a441543SLee Daly * 32K 295a441543SLee Daly 30bd03d3f1SLee DalyChecksum: 31bd03d3f1SLee Daly 32bd03d3f1SLee Daly * CRC32 33bd03d3f1SLee Daly * ADLER32 34bd03d3f1SLee Daly 35bd03d3f1SLee DalyTo enable a checksum in the driver, the compression and/or decompression xform 36bd03d3f1SLee Dalystructure, rte_comp_xform, must be filled with either of the CompressDev 37bd03d3f1SLee Dalychecksum flags supported. :: 38bd03d3f1SLee Daly 39bd03d3f1SLee Daly compress_xform->compress.chksum = RTE_COMP_CHECKSUM_CRC32 40bd03d3f1SLee Daly 41bd03d3f1SLee Daly decompress_xform->decompress.chksum = RTE_COMP_CHECKSUM_CRC32 42bd03d3f1SLee Daly 43bd03d3f1SLee Daly:: 44bd03d3f1SLee Daly 45bd03d3f1SLee Daly compress_xform->compress.chksum = RTE_COMP_CHECKSUM_ADLER32 46bd03d3f1SLee Daly 47bd03d3f1SLee Daly decompress_xform->decompress.chksum = RTE_COMP_CHECKSUM_ADLER32 48bd03d3f1SLee Daly 49bd03d3f1SLee DalyIf you request a checksum for compression or decompression, 50bd03d3f1SLee Dalythe checksum field in the operation structure, ``op->output_chksum``, 51bd03d3f1SLee Dalywill be filled with the checksum. 52bd03d3f1SLee Daly 53bd03d3f1SLee Daly.. Note:: 54bd03d3f1SLee Daly 55bd03d3f1SLee Daly For the compression case above, your output buffer will need to be large enough to hold the compressed data plus a scratchpad for the checksum at the end, the scratchpad is 8 bytes for CRC32 and 4 bytes for Adler32. 56bd03d3f1SLee Daly 578a38e972SLee DalyLevel guide: 588a38e972SLee Daly 598a38e972SLee DalyThe ISA-L levels have been mapped to somewhat correspond to the same ZLIB level, 608a38e972SLee Dalyi.e. ZLIB L1 gives a compression ratio similar to ISA-L L1. 618a38e972SLee DalyCompressdev level 0 enables "No Compression", which passes the uncompressed 628a38e972SLee Dalydata to the output buffer, plus deflate headers. 638a38e972SLee DalyThe ISA-L library does not support this, therefore compressdev level 0 is not supported. 648a38e972SLee Daly 658a38e972SLee DalyThe compressdev API has 10 levels, 0-9. ISA-L has 4 levels of compression, 0-3. 668a38e972SLee DalyAs a result the level mappings from the API to the PMD are shown below. 678a38e972SLee Daly 688a38e972SLee Daly.. _table_ISA-L_compression_levels: 698a38e972SLee Daly 708a38e972SLee Daly.. table:: Level mapping from Compressdev to ISA-L PMD. 718a38e972SLee Daly 728a38e972SLee Daly +-------------+----------------------------------------------+-----------------------------------------------+ 738a38e972SLee Daly | Compressdev | PMD Functionality | Internal ISA-L | 748a38e972SLee Daly | API Level | | Level | 758a38e972SLee Daly +=============+==============================================+===============================================+ 768a38e972SLee Daly | 0 | No compression, Not Supported | --- | 778a38e972SLee Daly +-------------+----------------------------------------------+-----------------------------------------------+ 788a38e972SLee Daly | 1 | Dynamic (Fast compression) | 1 | 798a38e972SLee Daly +-------------+----------------------------------------------+-----------------------------------------------+ 808a38e972SLee Daly | 2 | Dynamic | 2 | 818a38e972SLee Daly | | (Higher compression ratio) | | 828a38e972SLee Daly +-------------+----------------------------------------------+-----------------------------------------------+ 838a38e972SLee Daly | 3 | Dynamic | 3 | 848a38e972SLee Daly | | (Best compression ratio) | (Level 2 if | 858a38e972SLee Daly | | | no AVX512/AVX2) | 868a38e972SLee Daly +-------------+----------------------------------------------+-----------------------------------------------+ 878a38e972SLee Daly | 4 | Dynamic (Best compression ratio) | Same as above | 888a38e972SLee Daly +-------------+----------------------------------------------+-----------------------------------------------+ 898a38e972SLee Daly | 5 | Dynamic (Best compression ratio) | Same as above | 908a38e972SLee Daly +-------------+----------------------------------------------+-----------------------------------------------+ 918a38e972SLee Daly | 6 | Dynamic (Best compression ratio) | Same as above | 928a38e972SLee Daly +-------------+----------------------------------------------+-----------------------------------------------+ 938a38e972SLee Daly | 7 | Dynamic (Best compression ratio) | Same as above | 948a38e972SLee Daly +-------------+----------------------------------------------+-----------------------------------------------+ 958a38e972SLee Daly | 8 | Dynamic (Best compression ratio) | Same as above | 968a38e972SLee Daly +-------------+----------------------------------------------+-----------------------------------------------+ 978a38e972SLee Daly | 9 | Dynamic (Best compression ratio) | Same as above | 988a38e972SLee Daly +-------------+----------------------------------------------+-----------------------------------------------+ 998a38e972SLee Daly 1008a38e972SLee Daly.. Note:: 1018a38e972SLee Daly 1028a38e972SLee Daly The above table only shows mapping when API calls for dynamic compression. 1038a38e972SLee Daly For fixed compression, regardless of API level, internally ISA-L level 0 is always used. 1048a38e972SLee Daly 105bd03d3f1SLee Daly 1065a441543SLee DalyLimitations 1075a441543SLee Daly----------- 1085a441543SLee Daly 1098a38e972SLee Daly* Compressdev level 0, no compression, is not supported. 1105a441543SLee Daly 1115a441543SLee DalyInstallation 1125a441543SLee Daly------------ 1135a441543SLee Daly 1145a441543SLee Daly* To build DPDK with Intel's ISA-L library, the user is required to download the library from `<https://github.com/01org/isa-l>`_. 1155a441543SLee Daly 1165a441543SLee Daly* Once downloaded, the user needs to build the library, the ISA-L autotools are usually sufficient:: 1175a441543SLee Daly 1185a441543SLee Daly ./autogen.sh 1195a441543SLee Daly ./configure 1205a441543SLee Daly 1215a441543SLee Daly* make can be used to install the library on their system, before building DPDK:: 1225a441543SLee Daly 1235a441543SLee Daly make 1245a441543SLee Daly sudo make install 1255a441543SLee Daly 1265a441543SLee Daly* To build with meson, the **libisal.pc** file, must be copied into "pkgconfig", 1275a441543SLee Daly e.g. /usr/lib/pkgconfig or /usr/lib64/pkgconfig depending on your system, 1285a441543SLee Daly for meson to find the ISA-L library. The **libisal.pc** is located in library sources:: 1295a441543SLee Daly 1305a441543SLee Daly cp isal/libisal.pc /usr/lib/pkgconfig/ 1315a441543SLee Daly 1325a441543SLee Daly 1335a441543SLee DalyInitialization 1345a441543SLee Daly-------------- 1355a441543SLee Daly 1365a441543SLee DalyTo use the PMD in an application, user must: 1375a441543SLee Daly 1385a441543SLee Daly* Call ``rte_vdev_init("compress_isal")`` within the application. 1395a441543SLee Daly 1405a441543SLee Daly* Use ``--vdev="compress_isal"`` in the EAL options, which will call ``rte_vdev_init()`` internally. 1415a441543SLee Daly 1425a441543SLee DalyThe following parameter (optional) can be provided in the previous two calls: 1435a441543SLee Daly 1445a441543SLee Daly* ``socket_id:`` Specify the socket where the memory for the device is going to be allocated 1455a441543SLee Daly (by default, socket_id will be the socket where the core that is creating the PMD is running on). 146