11703e94aSDeclan Doherty.. BSD LICENSE 2a38dfe97SDeepak Kumar Jain Copyright(c) 2015-2016 Intel Corporation. All rights reserved. 31703e94aSDeclan Doherty 41703e94aSDeclan Doherty Redistribution and use in source and binary forms, with or without 51703e94aSDeclan Doherty modification, are permitted provided that the following conditions 61703e94aSDeclan Doherty are met: 71703e94aSDeclan Doherty 81703e94aSDeclan Doherty * Redistributions of source code must retain the above copyright 91703e94aSDeclan Doherty notice, this list of conditions and the following disclaimer. 101703e94aSDeclan Doherty * Redistributions in binary form must reproduce the above copyright 111703e94aSDeclan Doherty notice, this list of conditions and the following disclaimer in 121703e94aSDeclan Doherty the documentation and/or other materials provided with the 131703e94aSDeclan Doherty distribution. 141703e94aSDeclan Doherty * Neither the name of Intel Corporation nor the names of its 151703e94aSDeclan Doherty contributors may be used to endorse or promote products derived 161703e94aSDeclan Doherty from this software without specific prior written permission. 171703e94aSDeclan Doherty 181703e94aSDeclan Doherty THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 191703e94aSDeclan Doherty "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 201703e94aSDeclan Doherty LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 211703e94aSDeclan Doherty A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 221703e94aSDeclan Doherty OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 231703e94aSDeclan Doherty SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 241703e94aSDeclan Doherty LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 251703e94aSDeclan Doherty DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 261703e94aSDeclan Doherty THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 271703e94aSDeclan Doherty (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 281703e94aSDeclan Doherty OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 291703e94aSDeclan Doherty 301703e94aSDeclan DohertyQuick Assist Crypto Poll Mode Driver 311703e94aSDeclan Doherty==================================== 321703e94aSDeclan Doherty 331703e94aSDeclan DohertyThe QAT PMD provides poll mode crypto driver support for **Intel QuickAssist 341703e94aSDeclan DohertyTechnology DH895xxC** hardware accelerator. 351703e94aSDeclan Doherty 361703e94aSDeclan Doherty 371703e94aSDeclan DohertyFeatures 381703e94aSDeclan Doherty-------- 391703e94aSDeclan Doherty 401703e94aSDeclan DohertyThe QAT PMD has support for: 411703e94aSDeclan Doherty 421703e94aSDeclan DohertyCipher algorithms: 431703e94aSDeclan Doherty 441703e94aSDeclan Doherty* ``RTE_CRYPTO_SYM_CIPHER_AES128_CBC`` 451703e94aSDeclan Doherty* ``RTE_CRYPTO_SYM_CIPHER_AES192_CBC`` 461703e94aSDeclan Doherty* ``RTE_CRYPTO_SYM_CIPHER_AES256_CBC`` 474ee18e57SArek Kusztal* ``RTE_CRYPTO_SYM_CIPHER_AES128_CTR`` 484ee18e57SArek Kusztal* ``RTE_CRYPTO_SYM_CIPHER_AES192_CTR`` 494ee18e57SArek Kusztal* ``RTE_CRYPTO_SYM_CIPHER_AES256_CTR`` 50a38dfe97SDeepak Kumar Jain* ``RTE_CRYPTO_SYM_CIPHER_SNOW3G_UEA2`` 5153d8971cSJohn Griffin* ``RTE_CRYPTO_CIPHER_AES_GCM`` 52db0e952aSDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_NULL`` 531703e94aSDeclan Doherty 541703e94aSDeclan DohertyHash algorithms: 551703e94aSDeclan Doherty 561703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_SHA1_HMAC`` 57ebdbe12fSDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_SHA224_HMAC`` 581703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_SHA256_HMAC`` 59d905ee32SDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_SHA384_HMAC`` 601703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_SHA512_HMAC`` 611703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_AES_XCBC_MAC`` 62a38dfe97SDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_SNOW3G_UIA2`` 6361ec5181SArek Kusztal* ``RTE_CRYPTO_AUTH_MD5_HMAC`` 64db0e952aSDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_NULL`` 651703e94aSDeclan Doherty 661703e94aSDeclan Doherty 671703e94aSDeclan DohertyLimitations 681703e94aSDeclan Doherty----------- 691703e94aSDeclan Doherty 701703e94aSDeclan Doherty* Chained mbufs are not supported. 71a38dfe97SDeepak Kumar Jain* Hash only is not supported except Snow3G UIA2. 72a38dfe97SDeepak Kumar Jain* Cipher only is not supported except Snow3G UEA2. 731703e94aSDeclan Doherty* Only supports the session-oriented API implementation (session-less APIs are not supported). 741703e94aSDeclan Doherty* Not performance tuned. 75a59ffe7eSDeepak Kumar Jain* Snow3g(UEA2) supported only if cipher length, cipher offset fields are byte-aligned. 76a59ffe7eSDeepak Kumar Jain* Snow3g(UIA2) supported only if hash length, hash offset fields are byte-aligned. 778831895bSFiona Trahe* No BSD support as BSD QAT kernel driver not available. 781703e94aSDeclan Doherty 791703e94aSDeclan Doherty 801703e94aSDeclan DohertyInstallation 811703e94aSDeclan Doherty------------ 821703e94aSDeclan Doherty 831703e94aSDeclan DohertyTo use the DPDK QAT PMD an SRIOV-enabled QAT kernel driver is required. The 841703e94aSDeclan DohertyVF devices exposed by this driver will be used by QAT PMD. 851703e94aSDeclan Doherty 86*d6740135SEoin BreenTo enable QAT in DPDK, follow the instructions mentioned in 87*d6740135SEoin Breenhttp://dpdk.org/doc/guides/linux_gsg/build_dpdk.html 88*d6740135SEoin Breen 89*d6740135SEoin BreenQuick instructions as follows: 90*d6740135SEoin Breen 91*d6740135SEoin Breen.. code-block:: console 92*d6740135SEoin Breen 93*d6740135SEoin Breen make config T=x86_64-native-linuxapp-gcc 94*d6740135SEoin Breen sed -i 's,\(CONFIG_RTE_LIBRTE_PMD_QAT\)=n,\1=y,' build/.config 95*d6740135SEoin Breen make 96*d6740135SEoin Breen 97d0a6a326SJohn GriffinIf you are running on kernel 4.4 or greater, see instructions for 981703e94aSDeclan Doherty`Installation using kernel.org driver`_ below. If you are on a kernel earlier 99d0a6a326SJohn Griffinthan 4.4, see `Installation using 01.org QAT driver`_. 1001703e94aSDeclan Doherty 1011703e94aSDeclan Doherty 1021703e94aSDeclan DohertyInstallation using 01.org QAT driver 1031703e94aSDeclan Doherty------------------------------------ 1041703e94aSDeclan Doherty 1051703e94aSDeclan DohertyDownload the latest QuickAssist Technology Driver from `01.org 1061703e94aSDeclan Doherty<https://01.org/packet-processing/intel%C2%AE-quickassist-technology-drivers-and-patches>`_ 1071703e94aSDeclan DohertyConsult the *Getting Started Guide* at the same URL for further information. 1081703e94aSDeclan Doherty 1091703e94aSDeclan DohertyThe steps below assume you are: 1101703e94aSDeclan Doherty 1111703e94aSDeclan Doherty* Building on a platform with one ``DH895xCC`` device. 1121703e94aSDeclan Doherty* Using package ``qatmux.l.2.3.0-34.tgz``. 1131703e94aSDeclan Doherty* On Fedora21 kernel ``3.17.4-301.fc21.x86_64``. 1141703e94aSDeclan Doherty 1151703e94aSDeclan DohertyIn the BIOS ensure that SRIOV is enabled and VT-d is disabled. 1161703e94aSDeclan Doherty 1171703e94aSDeclan DohertyUninstall any existing QAT driver, for example by running: 1181703e94aSDeclan Doherty 1191703e94aSDeclan Doherty* ``./installer.sh uninstall`` in the directory where originally installed. 1201703e94aSDeclan Doherty 1211703e94aSDeclan Doherty* or ``rmmod qat_dh895xcc; rmmod intel_qat``. 1221703e94aSDeclan Doherty 1231703e94aSDeclan DohertyBuild and install the SRIOV-enabled QAT driver:: 1241703e94aSDeclan Doherty 1251703e94aSDeclan Doherty mkdir /QAT 1261703e94aSDeclan Doherty cd /QAT 1271703e94aSDeclan Doherty # copy qatmux.l.2.3.0-34.tgz to this location 1281703e94aSDeclan Doherty tar zxof qatmux.l.2.3.0-34.tgz 1291703e94aSDeclan Doherty 1301703e94aSDeclan Doherty export ICP_WITHOUT_IOMMU=1 1311703e94aSDeclan Doherty ./installer.sh install QAT1.6 host 1321703e94aSDeclan Doherty 1331703e94aSDeclan DohertyYou can use ``cat /proc/icp_dh895xcc_dev0/version`` to confirm the driver is correctly installed. 1341703e94aSDeclan DohertyYou can use ``lspci -d:443`` to confirm the bdf of the 32 VF devices are available per ``DH895xCC`` device. 1351703e94aSDeclan Doherty 1361703e94aSDeclan DohertyTo complete the installation - follow instructions in `Binding the available VFs to the DPDK UIO driver`_. 1371703e94aSDeclan Doherty 1381703e94aSDeclan Doherty**Note**: If using a later kernel and the build fails with an error relating to ``strict_stroul`` not being available apply the following patch: 1391703e94aSDeclan Doherty 1401703e94aSDeclan Doherty.. code-block:: diff 1411703e94aSDeclan Doherty 1421703e94aSDeclan Doherty /QAT/QAT1.6/quickassist/utilities/downloader/Target_CoreLibs/uclo/include/linux/uclo_platform.h 1431703e94aSDeclan Doherty + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,5) 1441703e94aSDeclan Doherty + #define STR_TO_64(str, base, num, endPtr) {endPtr=NULL; if (kstrtoul((str), (base), (num))) printk("Error strtoull convert %s\n", str); } 1451703e94aSDeclan Doherty + #else 1461703e94aSDeclan Doherty #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) 1471703e94aSDeclan Doherty #define STR_TO_64(str, base, num, endPtr) {endPtr=NULL; if (strict_strtoull((str), (base), (num))) printk("Error strtoull convert %s\n", str); } 1481703e94aSDeclan Doherty #else 1491703e94aSDeclan Doherty #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) 1501703e94aSDeclan Doherty #define STR_TO_64(str, base, num, endPtr) {endPtr=NULL; strict_strtoll((str), (base), (num));} 1511703e94aSDeclan Doherty #else 1521703e94aSDeclan Doherty #define STR_TO_64(str, base, num, endPtr) \ 1531703e94aSDeclan Doherty do { \ 1541703e94aSDeclan Doherty if (str[0] == '-') \ 1551703e94aSDeclan Doherty { \ 1561703e94aSDeclan Doherty *(num) = -(simple_strtoull((str+1), &(endPtr), (base))); \ 1571703e94aSDeclan Doherty }else { \ 1581703e94aSDeclan Doherty *(num) = simple_strtoull((str), &(endPtr), (base)); \ 1591703e94aSDeclan Doherty } \ 1601703e94aSDeclan Doherty } while(0) 1611703e94aSDeclan Doherty + #endif 1621703e94aSDeclan Doherty #endif 1631703e94aSDeclan Doherty #endif 1641703e94aSDeclan Doherty 1651703e94aSDeclan Doherty 1661703e94aSDeclan DohertyIf the build fails due to missing header files you may need to do following: 1671703e94aSDeclan Doherty 1681703e94aSDeclan Doherty* ``sudo yum install zlib-devel`` 1691703e94aSDeclan Doherty* ``sudo yum install openssl-devel`` 1701703e94aSDeclan Doherty 1711703e94aSDeclan DohertyIf the build or install fails due to mismatching kernel sources you may need to do the following: 1721703e94aSDeclan Doherty 1731703e94aSDeclan Doherty* ``sudo yum install kernel-headers-`uname -r``` 1741703e94aSDeclan Doherty* ``sudo yum install kernel-src-`uname -r``` 1751703e94aSDeclan Doherty* ``sudo yum install kernel-devel-`uname -r``` 1761703e94aSDeclan Doherty 1771703e94aSDeclan Doherty 1781703e94aSDeclan DohertyInstallation using kernel.org driver 1791703e94aSDeclan Doherty------------------------------------ 1801703e94aSDeclan Doherty 181d0a6a326SJohn GriffinAssuming you are running on at least a 4.4 kernel, you can use the stock kernel.org QAT 1821703e94aSDeclan Dohertydriver to start the QAT hardware. 1831703e94aSDeclan Doherty 1841703e94aSDeclan DohertyThe steps below assume you are: 1851703e94aSDeclan Doherty 1861703e94aSDeclan Doherty* Running DPDK on a platform with one ``DH895xCC`` device. 187d0a6a326SJohn Griffin* On a kernel at least version 4.4. 1881703e94aSDeclan Doherty 1891703e94aSDeclan DohertyIn BIOS ensure that SRIOV is enabled and VT-d is disabled. 1901703e94aSDeclan Doherty 1911703e94aSDeclan DohertyEnsure the QAT driver is loaded on your system, by executing:: 1921703e94aSDeclan Doherty 1931703e94aSDeclan Doherty lsmod | grep qat 1941703e94aSDeclan Doherty 1951703e94aSDeclan DohertyYou should see the following output:: 1961703e94aSDeclan Doherty 1971703e94aSDeclan Doherty qat_dh895xcc 5626 0 1981703e94aSDeclan Doherty intel_qat 82336 1 qat_dh895xcc 1991703e94aSDeclan Doherty 2001703e94aSDeclan DohertyNext, you need to expose the VFs using the sysfs file system. 2011703e94aSDeclan Doherty 2021703e94aSDeclan DohertyFirst find the bdf of the DH895xCC device:: 2031703e94aSDeclan Doherty 2041703e94aSDeclan Doherty lspci -d : 435 2051703e94aSDeclan Doherty 2061703e94aSDeclan DohertyYou should see output similar to:: 2071703e94aSDeclan Doherty 2081703e94aSDeclan Doherty 03:00.0 Co-processor: Intel Corporation Coleto Creek PCIe Endpoint 2091703e94aSDeclan Doherty 2101703e94aSDeclan DohertyUsing the sysfs, enable the VFs:: 2111703e94aSDeclan Doherty 2121703e94aSDeclan Doherty echo 32 > /sys/bus/pci/drivers/dh895xcc/0000\:03\:00.0/sriov_numvfs 2131703e94aSDeclan Doherty 214d0a6a326SJohn GriffinIf you get an error, it's likely you're using a QAT kernel driver earlier than kernel 4.4. 2151703e94aSDeclan Doherty 2161703e94aSDeclan DohertyTo verify that the VFs are available for use - use ``lspci -d:443`` to confirm 2171703e94aSDeclan Dohertythe bdf of the 32 VF devices are available per ``DH895xCC`` device. 2181703e94aSDeclan Doherty 2191703e94aSDeclan DohertyTo complete the installation - follow instructions in `Binding the available VFs to the DPDK UIO driver`_. 2201703e94aSDeclan Doherty 2218831895bSFiona Trahe**Note**: If the QAT kernel modules are not loaded and you see an error like 2228831895bSFiona Trahe ``Failed to load MMP firmware qat_895xcc_mmp.bin`` this may be as a 2238831895bSFiona Trahe result of not using a distribution, but just updating the kernel directly. 2248831895bSFiona Trahe 2258831895bSFiona TraheDownload firmware from the kernel firmware repo at: 2268831895bSFiona Trahehttp://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/ 2278831895bSFiona Trahe 2288831895bSFiona TraheCopy qat binaries to /lib/firmware: 2298831895bSFiona Trahe* ``cp qat_895xcc.bin /lib/firmware`` 2308831895bSFiona Trahe* ``cp qat_895xcc_mmp.bin /lib/firmware`` 2318831895bSFiona Trahe 2328831895bSFiona Trahecd to your linux source root directory and start the qat kernel modules: 2338831895bSFiona Trahe* ``insmod ./drivers/crypto/qat/qat_common/intel_qat.ko`` 2348831895bSFiona Trahe* ``insmod ./drivers/crypto/qat/qat_dh895xcc/qat_dh895xcc.ko`` 2358831895bSFiona Trahe 2368831895bSFiona Trahe**Note**:The following warning in /var/log/messages can be ignored: 2378831895bSFiona Trahe ``IOMMU should be enabled for SR-IOV to work correctly`` 2388831895bSFiona Trahe 2398831895bSFiona Trahe 2401703e94aSDeclan Doherty 2411703e94aSDeclan DohertyBinding the available VFs to the DPDK UIO driver 2421703e94aSDeclan Doherty------------------------------------------------ 2431703e94aSDeclan Doherty 2441703e94aSDeclan DohertyThe unbind command below assumes ``bdfs`` of ``03:01.00-03:04.07``, if yours are different adjust the unbind command below:: 2451703e94aSDeclan Doherty 2461703e94aSDeclan Doherty cd $RTE_SDK 2471703e94aSDeclan Doherty modprobe uio 2481703e94aSDeclan Doherty insmod ./build/kmod/igb_uio.ko 2491703e94aSDeclan Doherty 2501703e94aSDeclan Doherty for device in $(seq 1 4); do \ 2511703e94aSDeclan Doherty for fn in $(seq 0 7); do \ 2521703e94aSDeclan Doherty echo -n 0000:03:0${device}.${fn} > \ 2531703e94aSDeclan Doherty /sys/bus/pci/devices/0000\:03\:0${device}.${fn}/driver/unbind; \ 2541703e94aSDeclan Doherty done; \ 2551703e94aSDeclan Doherty done 2561703e94aSDeclan Doherty 2571703e94aSDeclan Doherty echo "8086 0443" > /sys/bus/pci/drivers/igb_uio/new_id 2581703e94aSDeclan Doherty 2591703e94aSDeclan DohertyYou can use ``lspci -vvd:443`` to confirm that all devices are now in use by igb_uio kernel driver. 260