Relocate qat17 to stx-integ/kernel/kernel-modules/qat17

Move content from stx-gplv2 into stx-integ

Packages will be relocated to

stx-integ:
    base/
        bash
        cgcs-users
        cluster-resource-agents
        dpkg
        haproxy
        libfdt
        netpbm
        rpm

    database/
        mariadb

    filesystem/
        iscsi-initiator-utils

    filesystem/drbd/
        drbd-tools

    kernel/kernel-modules/
        drbd
        integrity
        intel-e1000e
        intel-i40e
        intel-i40evf
        intel-ixgbe
        intel-ixgbevf
        qat17
        tpmdd

    ldap/
        ldapscripts

    networking/
        iptables
        net-tools

Change-Id: I4d9456faf2d92c2557175ed84ec6e16d21eb8702
Story: 2002801
Task: 22687
Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
Scott Little 2018-08-01 14:17:33 -04:00
parent fa24e6eadb
commit 4437bc6c24
9 changed files with 636 additions and 0 deletions

View File

@ -121,3 +121,4 @@ kernel/kernel-modules/intel-i40evf
kernel/kernel-modules/intel-i40e
kernel/kernel-modules/intel-ixgbevf
kernel/kernel-modules/intel-ixgbe
kernel/kernel-modules/qat17

View File

@ -7,3 +7,4 @@ kernel/kernel-modules/intel-i40evf
kernel/kernel-modules/intel-i40e
kernel/kernel-modules/intel-ixgbevf
kernel/kernel-modules/intel-ixgbe
kernel/kernel-modules/qat17

View File

@ -0,0 +1,13 @@
Metadata-Version: 1.1
Name: qat17
Version: 1.0
Summary: Intel(r) QuickAssist Technology API
Home-page: https://01.org/packet-processing/intel%C2%AE-quickassist-technology-drivers-and-patches
Author:
Author-email:
License: GPLv2
Description: Intel(r) QuickAssist Technology API
Platform: UNKNOWN

View File

@ -0,0 +1,6 @@
COPY_LIST=" \
$CGCS_BASE/mwa-gplv2/qat17/files/* \
$CGCS_BASE/downloads/qat1.7.upstream.l.1.0.3-42.tar.gz \
"
TIS_PATCH_VER=4
BUILD_IS_SLOW=3

View File

@ -0,0 +1,134 @@
%if "%{?_tis_build_type}" == "rt"
%define bt_ext -rt
%else
%undefine bt_ext
%endif
Summary: Intel(r) QuickAssist Technology API
%define pkgname qat17
Name: %{pkgname}%{?bt_ext}
Version: 1.0.3
%define upstream_release 42
Release: %{upstream_release}%{?_tis_dist}.%{tis_patch_ver}
License: GPLv2
Group: base
Packager: Wind River <info@windriver.com>
URL: https://01.org/packet-processing/intel%C2%AE-quickassist-technology-drivers-and-patches
BuildRequires: kernel%{?bt_ext}-devel
BuildRequires: zlib-devel
BuildRequires: openssl-devel
BuildRequires: pciutils
BuildRequires: libudev-devel
BuildRequires: boost-devel
BuildRequires: perl
BuildRequires: openssl
%define icp_tools accelcomp
%define kernel_version %(rpm -q kernel%{?bt_ext}-devel | sed 's/kernel%{?bt_ext}-devel-//')
%define staging_kernel_dir /usr/src/kernels/%{kernel_version}/
%define qat_unpack_dir %{_builddir}/%{name}-%{version}
%define qat_src_dir %{qat_unpack_dir}
Source: qat1.7.upstream.l.%{version}-%{upstream_release}.tar.gz
Source1: qat
# Use our own service script rather than massively patching theirs
Source2: qat_service
Patch1: 0001-Install-config-file-for-each-VF.patch
Patch2: Get-and-report-the-return-code-on-firmware-load-fail.patch
%description
Intel(r) QuickAssist Technology API
%prep
rm -rf %{qat_unpack_dir}
mkdir -p %{qat_unpack_dir}
cd %{qat_unpack_dir}
gzip -dc %{_sourcedir}/qat1.7.upstream.l.%{version}-%{upstream_release}.tar.gz | tar -xvvf -
if [ $? -ne 0 ]; then
exit $?
fi
%patch1 -p1
%patch2 -p1
%build
ICP_ROOT=%{qat_src_dir}
KERNEL_SOURCE_ROOT=%{staging_kernel_dir}
mkdir -p %{qat_src_dir}/build
ICP_BUILD_OUTPUT=%{qat_src_dir}/build
export ICP_ROOT KERNEL_SOURCE_ROOT ICP_BUILD_OUTPUT
cd %{qat_src_dir}
%configure
make -C %{qat_src_dir}/
# intel test sample
make -C %{qat_src_dir}/ sample-all
%install
%{__install} -d %{buildroot}%{_sysconfdir}/default
%{__install} -m 750 %SOURCE1 %{buildroot}%{_sysconfdir}/default
%{__install} -d %{buildroot}%{_sysconfdir}/modprobe.d
%{__install} -d %{buildroot}%{_sysconfdir}/qat/conf_files
%{__install} -m 640 %{qat_src_dir}/build/*.conf %{buildroot}%{_sysconfdir}/qat/conf_files
%{__install} -m 640 %{qat_src_dir}/build/*.vm %{buildroot}%{_sysconfdir}/qat/conf_files
%{__install} -d %{buildroot}%{_sbindir}
%{__install} -m 750 %{qat_src_dir}/build/adf_ctl %{buildroot}%{_sbindir}
%{__install} -d %{buildroot}%{_sysconfdir}/init.d
%{__install} -m 750 %SOURCE2 %{buildroot}%{_sysconfdir}/init.d/qat_service
%{__install} -d %{buildroot}%{_libdir}
%{__install} -m 750 %{qat_src_dir}/build/*.so %{buildroot}%{_libdir}
%{__install} -d %{buildroot}/lib/modules/%{kernel_version}/kernel/drivers/crypto/qat/
%{__install} -m 750 %{qat_src_dir}/build/*qat*.ko %{buildroot}/lib/modules/%{kernel_version}/kernel/drivers/crypto/qat/
%{__install} -m 750 %{qat_src_dir}/build/usdm_drv.ko %{buildroot}/lib/modules/%{kernel_version}/kernel/drivers/crypto/qat
# intel test sample
%{__install} -d %{buildroot}/usr/lib/firmware
%{__install} -m 750 %{qat_src_dir}/build/cpa_sample_code %{buildroot}%{_sbindir}/cpa_sample_code
%{__install} -m 640 %{qat_src_dir}/quickassist/lookaside/access_layer/src/sample_code/performance/compression/calgary %{buildroot}/usr/lib/firmware
%{__install} -m 640 %{qat_src_dir}/quickassist/lookaside/access_layer/src/sample_code/performance/compression/calgary32 %{buildroot}/usr/lib/firmware
%{__install} -m 640 %{qat_src_dir}/quickassist/lookaside/access_layer/src/sample_code/performance/compression/canterbury %{buildroot}/usr/lib/firmware
# device firmware
# install to the updates directory so this firmware will get grabbed ahead of
# anything supplied by the linux-firmware package
%{__install} -d %{buildroot}/usr/lib/firmware/updates
%{__install} -m 640 %{qat_src_dir}/build/*.bin %{buildroot}/usr/lib/firmware/updates
# Strip the modules(s).
find %{buildroot} -type f -name \*.ko -exec %{__strip} --strip-debug \{\} \;
# Always Sign the modules(s).
# If the module signing keys are not defined, define them here.
%{!?privkey: %define privkey /usr/src/kernels/%{kernel_version}/signing_key.priv}
%{!?pubkey: %define pubkey /usr/src/kernels/%{kernel_version}/signing_key.x509}
for module in $(find %{buildroot} -type f -name \*.ko);
do %{__perl} /usr/src/kernels/%{kernel_version}/scripts/sign-file \
sha256 %{privkey} %{pubkey} $module;
done
%clean
%{__rm} -rf %{buildroot}
%files
"%{_sbindir}/*"
"%{_sysconfdir}/default/qat"
"%{_sysconfdir}/init.d/qat_service"
"/lib/modules/%{kernel_version}/kernel/drivers/crypto/qat/*.ko"
"%{_libdir}/*.so"
"/usr/lib/firmware/*"
"/usr/lib/firmware/updates/*"
"%{_sysconfdir}/qat/*"
"%{_sysconfdir}/qat/conf_files/*"

View File

@ -0,0 +1,118 @@
From ab216edc24f2fb9d8c28662f069b027c6479d277 Mon Sep 17 00:00:00 2001
From: eric zhang <eric.zhang@windriver.com>
Date: Fri, 17 Nov 2017 15:41:35 -0500
Subject: [PATCH 1/1] Install config file for each VF
Signed-off-by: eric zhang <eric.zhang@windriver.com>
---
quickassist/build_system/build_files/qat_service | 60 +++++++++++++++++++++---
1 file changed, 54 insertions(+), 6 deletions(-)
diff --git a/quickassist/build_system/build_files/qat_service b/quickassist/build_system/build_files/qat_service
index 168413b..8e2b838 100755
--- a/quickassist/build_system/build_files/qat_service
+++ b/quickassist/build_system/build_files/qat_service
@@ -65,6 +65,12 @@ C3XX_DEVICE_PCI_ID_VM="19e3"
D15XX_DEVICE_PCI_ID="6f54"
D15XX_DEVICE_PCI_ID_VM="6f55"
+QAT_DH895XCC_NUM_VFS=32
+QAT_DHC62X_NUM_VFS=16
+QAT_DHD15XX_NUM_VFS=16
+QAT_DHC3XXX_NUM_VFS=16
+
+
usage() {
echo
echo --------------------------------------------------------
@@ -84,7 +90,7 @@ echo --------------------------------------------------------
exit 1
}
-ADF_CTL=/usr/sbin/adf_ctl
+ADF_CTL=/usr/bin/adf_ctl
# store the total number of each type of device
numDh895xDevicesPF=$(lspci -n | egrep -c "$INTEL_VENDORID:$DH895_DEVICE_PCI_ID")
@@ -193,15 +199,57 @@ case $1 in
if [ $DO_ENABLE_SRIOV == 1 ]; then
echo enable sriov
+
+ if [ $numDh895xDevicesPF != 0 ];then
+ for (( dev=0; dev<$numDh895xDevicesPF; dev++ ))
+ do
+ for (( vf_dev = 0; vf_dev < $QAT_DH895XCC_NUM_VFS; vf_dev++ ))
+ do
+ vf_dev_num=$(($dev * $numDh895xDevicesPF + $vf_dev))
+ cp /etc/qat/dh895xccvf_dev0.conf.vm /etc/dh895xccvf_dev$vf_dev_num.conf
+ done
+ done
+ fi
+ if [ $numC62xDevicesPF != 0 ];then
+ for (( dev=0; dev<$numC62xDevicesPF; dev++ ))
+ do
+ for (( vf_dev = 0; vf_dev<$QAT_DHC62X_NUM_VFS; vf_dev++ ))
+ do
+ vf_dev_num=$(($dev * $numC62xDevicesPF + $vf_dev))
+ cp /etc/qat/c6xxvf_dev0.conf.vm /etc/c6xxvf_dev$vf_dev_num.conf
+ done
+ done
+ fi
+ if [ $numC3xxDevicesPF != 0 ];then
+ for (( dev=0; dev<$numC3xxDevicesPF; dev++ ))
+ do
+ for (( vf_dev = 0; vf_dev<$QAT_DHC3XXX_NUM_VFS; vf_dev++ ))
+ do
+ vf_dev_num=$(($dev * $numC3xxDevicesPF + $vf_dev))
+ cp /etc/qat/c3xxvf_dev0.conf.vm /etc/c3xxvf_dev$vf_dev_num.conf
+ done
+ done
+ fi
+ if [ $numD15xxDevicesPF != 0 ];then
+ for (( dev=0; dev<$numD15xxDevicesPF; dev++ ))
+ do
+ for (( vf_dev = 0; vf_dev<$QAT_DHD15XX_NUM_VFS; vf_dev++ ))
+ do
+ vf_dev_num=$(($dev * $numD15xxDevicesPF + $vf_dev))
+ cp /etc/qat/D15xxvf_dev0.conf.vm /etc/D15xxvf_dev$vf_dev_num.conf
+ done
+ done
+ fi
+
enable_sriov $2
fi
# Show device status
- /usr/sbin/adf_ctl $2 status
+ /usr/bin/adf_ctl $2 status
;;
Shutdown|shutdown)
- /usr/sbin/adf_ctl down
+ /usr/bin/adf_ctl down
modprobe -q -r usdm_drv
modprobe -q -r qat_dh895xccvf
modprobe -q -r qat_c62xvf
@@ -215,15 +263,15 @@ case $1 in
;;
Stop|stop)
- /usr/sbin/adf_ctl $2 down
+ /usr/bin/adf_ctl $2 down
;;
Restart|restart)
- /usr/sbin/adf_ctl $2 down && /usr/sbin/adf_ctl $2 up
+ /usr/bin/adf_ctl $2 down && /usr/bin/adf_ctl $2 up
;;
Status|status)
- /usr/sbin/adf_ctl status
+ /usr/bin/adf_ctl status
if [ "$?" -ne 0 ]
then
echo "No devices found. Please start the driver using:"
--
1.8.3.1

View File

@ -0,0 +1,42 @@
From 996bdb87cbaab4d8f498ec7897c38bc9d19e29e7 Mon Sep 17 00:00:00 2001
Message-Id: <996bdb87cbaab4d8f498ec7897c38bc9d19e29e7.1511969785.git.Jim.Somerville@windriver.com>
From: Jim Somerville <Jim.Somerville@windriver.com>
Date: Wed, 29 Nov 2017 10:36:12 -0500
Subject: [PATCH 1/1] Get and report the return code on firmware load failure
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
---
.../qat/drivers/crypto/qat/qat_common/adf_accel_engine.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/adf_accel_engine.c b/quickassist/qat/drivers/crypto/qat/qat_common/adf_accel_engine.c
index 6d96fd6..522cbf0 100644
--- a/quickassist/qat/drivers/crypto/qat/qat_common/adf_accel_engine.c
+++ b/quickassist/qat/drivers/crypto/qat/qat_common/adf_accel_engine.c
@@ -57,6 +57,7 @@ int adf_ae_fw_load(struct adf_accel_dev *accel_dev)
struct adf_hw_device_data *hw_device = accel_dev->hw_device;
void *uof_addr, *mmp_addr;
u32 uof_size, mmp_size;
+ int rc;
#ifdef QAT_UIO
struct adf_accel_pci *pci_info = &accel_dev->accel_pci_dev;
unsigned long storage_enabled = 0;
@@ -72,10 +73,11 @@ int adf_ae_fw_load(struct adf_accel_dev *accel_dev)
if (!hw_device->fw_name)
return 0;
- if (request_firmware(&loader_data->mmp_fw, hw_device->fw_mmp_name,
- &accel_dev->accel_pci_dev.pci_dev->dev)) {
- dev_err(&GET_DEV(accel_dev), "Failed to load MMP firmware %s\n",
- hw_device->fw_mmp_name);
+ rc = request_firmware(&loader_data->mmp_fw, hw_device->fw_mmp_name,
+ &accel_dev->accel_pci_dev.pci_dev->dev);
+ if (rc) {
+ dev_err(&GET_DEV(accel_dev), "Failed to load MMP firmware %s rc=%d\n",
+ hw_device->fw_mmp_name, rc);
return -EFAULT;
}
if (request_firmware(&loader_data->uof_fw, hw_device->fw_name,
--
1.8.3.1

View File

@ -0,0 +1 @@
SRIOV_ENABLE=1

View File

@ -0,0 +1,320 @@
#!/bin/bash
#################################################################
#
# BSD LICENSE
#
# Copyright(c) 2007-2016 Intel Corporation. All rights reserved.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# version: QAT1.7.Upstream.L.1.0.3-42
#
#################################################################
#
### BEGIN INIT INFO
# Provides: QAT
# Required-Start: $ALL
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop: 0 1 4 6
# Description: Intel QAT service
### END INIT INFO
#
# qat_service Start/Stop the Intel QAT.
#
# chkconfig: 345 99 99
# description: modprobe the QAT modules, which loads dependant \
# modules, before calling the user space \
# utility to pass configuration parameters
usage() {
echo
echo --------------------------------------------------------
echo USAGE:
echo --------------------------------------------------------
echo "# $0 start||stop||status||restart||shutdown"
echo --------------------------------------------------------
echo " Note: If there is more devices in the system"
echo " you can start, stop or restart separate device by "
echo " passing the dev to be restarted or stopped as a"
echo " parameter for instance: "
echo " $0 stop qat_dev<N>"
echo " where N is device number."
echo " To see all devices in the system use:"
echo " $0 status"
echo --------------------------------------------------------
exit 1
}
inventory_the_devices() {
# dynamically inventory the devices by looking at the pci bus
# store the total number of each type of device seen
numDh895xDevicesPF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${DH895_DEVICE_PCI_ID}")
numDh895xDevicesVF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${DH895_DEVICE_PCI_ID_VM}")
numC62xDevicesPF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${C62X_DEVICE_PCI_ID}")
numC62xDevicesVF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${C62X_DEVICE_PCI_ID_VM}")
numC3xxDevicesPF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${C3XX_DEVICE_PCI_ID}")
numC3xxDevicesVF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${C3XX_DEVICE_PCI_ID_VM}")
numD15xxDevicesPF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${D15XX_DEVICE_PCI_ID}")
numD15xxDevicesVF=$(lspci -n | egrep -c "${INTEL_VENDORID}:${D15XX_DEVICE_PCI_ID_VM}")
}
enable_sriov() {
PF_LIST=`${ADF_CTL} $1 status | grep -e "^ *qat_dev" | grep -v "vf," | awk '{print $1}'`
for PF_DEV in ${PF_LIST}
do
# Extract the BSF to build the path to /sys/bus/.../sriov)_numvfs
BSF=`${ADF_CTL} ${PF_DEV} status | tail -1 | awk '{print $8}' | awk 'BEGIN{FS=","}{print $1}'`
B=`echo ${BSF} | awk 'BEGIN{FS=":"}{print $1}'`
SF=`echo ${BSF} | awk 'BEGIN{FS=":"}{print $2}'`
S=`echo ${SF} | awk 'BEGIN{FS="."}{print $1}'`
F=`echo ${SF} | awk 'BEGIN{FS="."}{print $2}'`
SYSFS_DIR=/sys/bus/pci/devices/0000:${B}:${S}.${F}
if [ ! -e ${SYSFS_DIR}/sriov_numvfs ]; then
echo "Cannot enable SRIOV for ${PF_DEV}. No sriov_numvs file"
exit 1
fi
NUMVFS=`cat ${SYSFS_DIR}/sriov_numvfs`
if [ ${NUMVFS} != 0 ]; then
echo "SRIOV is already enabled for ${PF_DEV}"
exit 1
fi
cat ${SYSFS_DIR}/sriov_totalvfs > ${SYSFS_DIR}/sriov_numvfs
if [ $? != 0 ]; then
echo "Could not enable SRIOV for ${PF_DEV}"
exit 1;
fi
# Get a list of all the VFs for this PF and bring then down
VF_LIST=`${ADF_CTL} status | grep "bsf: ${B}" | grep "vf," | awk '{print $1}'`
for VF_DEV in ${VF_LIST}
do
${ADF_CTL} ${VF_DEV} down
done
done
${ADF_CTL} up
}
load_the_required_modules() {
# Using the collected inventory, install the modules. No harm done if already installed.
if [ ${numDh895xDevicesPF} != 0 ]; then
modprobe qat_dh895xcc
fi
if [ ${numC62xDevicesPF} != 0 ]; then
modprobe qat_c62x
fi
if [ ${numC3xxDevicesPF} != 0 ]; then
modprobe qat_c3xxx
fi
if [ ${numD15xxDevicesPF} != 0 ]; then
modprobe qat_d15xx
fi
if [ `lsmod | grep "usdm_drv" | wc -l` == "0" ]; then
modprobe usdm_drv
fi
# Loading VF drivers as necessary
# The VF devices only appear after SRIOV is enabled on the PF,
# therefore we can't use lspci to determine that the VF driver should be loaded.
# Instead, if we want SRIOV, and we have a specific PF device, then load the driver.
if [ ${SRIOV_ENABLE} == 1 ]; then
if [ ${numDh895xDevicesPF} != 0 -o ${numDh895xDevicesVF} != 0 ]; then
modprobe qat_dh895xccvf
fi
if [ ${numC62xDevicesPF} != 0 -o ${numC62xDevicesVF} != 0 ]; then
modprobe qat_c62xvf
fi
if [ ${numC3xxDevicesPF} != 0 -o ${numC3xxDevicesVF} != 0 ]; then
modprobe qat_c3xxxvf
fi
if [ ${numD15xxDevicesPF} != 0 -o ${numD15xxDevicesVF} != 0 ]; then
modprobe qat_d15xxvf
fi
fi
}
copy_in_config_files() {
local num_devices=${1}
local device_file_prefix=${2}
local source_file_suffix="${3}"
if [ ${num_devices} != 0 ]; then
for (( dev=0; dev<${num_devices}; dev++ ))
do
if [ -e /etc/qat/conf_files/${device_file_prefix}_dev${dev}.conf${source_file_suffix} ]; then
cp /etc/qat/conf_files/${device_file_prefix}_dev${dev}.conf${source_file_suffix} /etc/${device_file_prefix}_dev${dev}.conf
else
echo "QAT: ${device_file_prefix}: using dev0 device config for device ${dev}, settings may be suboptimal"
cp /etc/qat/conf_files/${device_file_prefix}_dev0.conf${source_file_suffix} /etc/${device_file_prefix}_dev${dev}.conf
fi
done
fi
}
establish_the_device_PF_config_files() {
copy_in_config_files ${numDh895xDevicesPF} 'dh895xcc' ''
copy_in_config_files ${numC62xDevicesPF} 'c6xx' ''
copy_in_config_files ${numC3xxDevicesPF} 'c3xxx' ''
copy_in_config_files ${numD15xxDevicesPF} 'd15xx' ''
}
establish_the_device_VF_config_files() {
copy_in_config_files $(( ${numDh895xDevicesPF} * ${QAT_DH895XCC_NUM_VFS} )) 'dh895xccvf' '.vm'
copy_in_config_files $(( ${numC62xDevicesPF} * ${QAT_DHC62X_NUM_VFS} )) 'c6xxvf' '.vm'
copy_in_config_files $(( ${numC3xxDevicesPF} * ${QAT_DHC3XXX_NUM_VFS} )) 'c3xxxvf' '.vm'
copy_in_config_files $(( ${numD15xxDevicesPF} * ${QAT_DHD15XX_NUM_VFS} )) 'd15xxvf' '.vm'
}
establish_the_guest_VF_config_files() {
copy_in_config_files ${numDh895xDevicesVF} 'dh895xccvf' '.vm'
copy_in_config_files ${numC62xDevicesVF} 'c6xxvf' '.vm'
copy_in_config_files ${numC3xxDevicesVF} 'c3xxxvf' '.vm'
copy_in_config_files ${numD15xxDevicesVF} 'd15xxvf' '.vm'
}
############### Mainline Begins ################
# Set the SRIOV_ENABLE variable by sourcing the qat file
test -f /etc/default/qat && . /etc/default/qat
INTEL_VENDORID="8086"
DH895_DEVICE_PCI_ID="0435"
DH895_DEVICE_PCI_ID_VM="0443"
C62X_DEVICE_PCI_ID="37c8"
C62X_DEVICE_PCI_ID_VM="37c9"
C3XX_DEVICE_PCI_ID="19e2"
C3XX_DEVICE_PCI_ID_VM="19e3"
D15XX_DEVICE_PCI_ID="6f54"
D15XX_DEVICE_PCI_ID_VM="6f55"
QAT_DH895XCC_NUM_VFS=32
QAT_DHC62X_NUM_VFS=16
QAT_DHD15XX_NUM_VFS=16
QAT_DHC3XXX_NUM_VFS=16
ADF_CTL=/usr/sbin/adf_ctl
inventory_the_devices
case $1 in
Start|start)
load_the_required_modules
# Make sure the devices are off
${ADF_CTL} $2 down
establish_the_device_PF_config_files
${ADF_CTL} $2 status | grep -e "^ *qat_dev" | grep -v vf > /dev/null
if [ $? == 0 ]; then
PHYS_FUNCTIONS=1
else
PHYS_FUNCTIONS=0
fi
${ADF_CTL} $2 status | grep -e "^ *qat_dev" | grep vf > /dev/null
if [ $? == 0 ]; then
VIRT_FUNCTIONS=1
else
VIRT_FUNCTIONS=0
fi
# Check if sriov should be enabled.
if [ ${SRIOV_ENABLE} == 1 ]; then
if [ ${PHYS_FUNCTIONS} == 1 ]; then
# We have physical functions
DO_ENABLE_SRIOV=1
else
# No physical functions
DO_ENABLE_SRIOV=0
fi
else
DO_ENABLE_SRIOV=0
fi
if [ ${DO_ENABLE_SRIOV} == 1 ]; then
echo "enabling sriov"
establish_the_device_VF_config_files
enable_sriov $2
else
if [ ${PHYS_FUNCTIONS} == 0 ]; then
if [ ${VIRT_FUNCTIONS} == 1 ]; then
establish_the_guest_VF_config_files
fi
fi
fi
# Turn the devices on
${ADF_CTL} $2 up
# Show device status
${ADF_CTL} $2 status
;;
Shutdown|shutdown)
${ADF_CTL} down
modprobe -q -r usdm_drv
modprobe -q -r qat_dh895xccvf
modprobe -q -r qat_c62xvf
modprobe -q -r qat_c3xxxvf
modprobe -q -r qat_dh895xcc
modprobe -q -r qat_c62x
modprobe -q -r qat_c3xxx
modprobe -q -r qat_d15xx
modprobe -q -r qat_d15xxvf
modprobe -q -r intel_qat
;;
Stop|stop)
${ADF_CTL} $2 down
;;
Restart|restart)
${ADF_CTL} $2 down && ${ADF_CTL} $2 up
;;
Status|status)
${ADF_CTL} status
if [ "$?" -ne 0 ]
then
echo "No devices found. Please start the driver using:"
echo "$0 start"
fi
;;
*)
usage
;;
esac
exit 0