From ca569b0f7046a07d5e21202a8d4ca01b5ab1ceed Mon Sep 17 00:00:00 2001 From: Dmitry Rozhkov Date: Thu, 22 Nov 2018 10:56:35 +0200 Subject: [PATCH] qat: initial support for openssl QAT engine --- build/docker/intel-qat-plugin.Dockerfile | 22 +- cmd/qat2_plugin/qat2_plugin.go | 308 ++++++++++++++++++ cmd/qat2_plugin/qat2_plugin_test.go | 219 +++++++++++++ .../test_data/all_is_good/c6xx_dev0.conf | 205 ++++++++++++ .../test_data/all_is_good/c6xx_dev1.conf | 193 +++++++++++ .../test_data/all_is_good/c6xx_dev2.conf | 193 +++++++++++ .../missing_pinned_section/c6xx_dev0.conf | 195 +++++++++++ .../missing_pinned_section/c6xx_dev1.conf | 193 +++++++++++ .../missing_pinned_section/c6xx_dev2.conf | 193 +++++++++++ .../qat_plugin/qat_plugin_kernel_mode.yaml | 40 +++ 10 files changed, 1756 insertions(+), 5 deletions(-) create mode 100644 cmd/qat2_plugin/qat2_plugin.go create mode 100644 cmd/qat2_plugin/qat2_plugin_test.go create mode 100644 cmd/qat2_plugin/test_data/all_is_good/c6xx_dev0.conf create mode 100644 cmd/qat2_plugin/test_data/all_is_good/c6xx_dev1.conf create mode 100644 cmd/qat2_plugin/test_data/all_is_good/c6xx_dev2.conf create mode 100644 cmd/qat2_plugin/test_data/missing_pinned_section/c6xx_dev0.conf create mode 100644 cmd/qat2_plugin/test_data/missing_pinned_section/c6xx_dev1.conf create mode 100644 cmd/qat2_plugin/test_data/missing_pinned_section/c6xx_dev2.conf create mode 100644 deployments/qat_plugin/qat_plugin_kernel_mode.yaml diff --git a/build/docker/intel-qat-plugin.Dockerfile b/build/docker/intel-qat-plugin.Dockerfile index f6d908cc..eaefa389 100644 --- a/build/docker/intel-qat-plugin.Dockerfile +++ b/build/docker/intel-qat-plugin.Dockerfile @@ -1,10 +1,22 @@ -FROM golang:1.11-alpine as builder -ARG DIR=/go/src/github.com/intel/intel-device-plugins-for-kubernetes +FROM fedora:28 as builder +RUN dnf update -y && \ + dnf install -y wget make gcc-c++ findutils golang-bin && \ + mkdir -p /usr/src/qat && \ + cd /usr/src/qat && \ + wget https://01.org/sites/default/files/downloads/intelr-quickassist-technology/qat1.7.l.4.3.0-00033.tar.gz && \ + tar xf *.tar.gz +RUN cd /usr/src/qat/quickassist/utilities/adf_ctl && \ + make KERNEL_SOURCE_DIR=/usr/src/qat/quickassist/qat && \ + cp -a adf_ctl /usr/bin/ +ARG DIR=/root/go/src/github.com/intel/intel-device-plugins-for-kubernetes WORKDIR $DIR COPY . . RUN cd cmd/qat_plugin; go install -RUN chmod a+x /go/bin/qat_plugin +RUN chmod a+x /root/go/bin/qat_plugin -FROM alpine -COPY --from=builder /go/bin/qat_plugin /usr/bin/intel_qat_device_plugin +FROM fedora:28 +RUN dnf update -y && \ + dnf install -y libstdc++ +COPY --from=builder /root/go/bin/qat_plugin /usr/bin/intel_qat_device_plugin +COPY --from=builder /usr/bin/adf_ctl /usr/bin/adf_ctl CMD ["/usr/bin/intel_qat_device_plugin"] diff --git a/cmd/qat2_plugin/qat2_plugin.go b/cmd/qat2_plugin/qat2_plugin.go new file mode 100644 index 00000000..80524e91 --- /dev/null +++ b/cmd/qat2_plugin/qat2_plugin.go @@ -0,0 +1,308 @@ +// Copyright 2018 Intel Corporation. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "flag" + "fmt" + "io/ioutil" + "os" + "path" + "regexp" + "strconv" + "strings" + "time" + + "github.com/pkg/errors" + + pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1" + utilsexec "k8s.io/utils/exec" + + "github.com/intel/intel-device-plugins-for-kubernetes/pkg/debug" + dpapi "github.com/intel/intel-device-plugins-for-kubernetes/pkg/deviceplugin" + "github.com/intel/intel-device-plugins-for-kubernetes/pkg/ini" +) + +const ( + namespace = "qat.intel.com" +) + +var ( + uioRegex = regexp.MustCompile(`^uio[0-9]+$`) +) + +type endpoint struct { + id string + processes int +} + +type section struct { + endpoints []endpoint + cryptoEngines int + compressionEngines int + pinned bool +} + +func newDeviceSpec(devPath string) pluginapi.DeviceSpec { + return pluginapi.DeviceSpec{ + HostPath: devPath, + ContainerPath: devPath, + Permissions: "rw", + } +} + +func getDevTree(devfs string, config map[string]section) (dpapi.DeviceTree, error) { + devTree := dpapi.NewDeviceTree() + + devFiles, err := ioutil.ReadDir(devfs) + if err != nil { + return devTree, errors.Wrapf(err, "Can't read %s", devfs) + } + + devs := []pluginapi.DeviceSpec{ + newDeviceSpec(path.Join(devfs, "qat_adf_ctl")), + newDeviceSpec(path.Join(devfs, "qat_dev_processes")), + newDeviceSpec(path.Join(devfs, "usdm_drv")), + } + for _, devFile := range devFiles { + fname := devFile.Name() + + if uioRegex.MatchString(fname) { + devs = append(devs, newDeviceSpec(path.Join(devfs, fname))) + } + } + + uniqID := 0 + for sname, svalue := range config { + var devType string + + devType = fmt.Sprintf("cy%d_dc%d", svalue.cryptoEngines, svalue.compressionEngines) + for _, ep := range svalue.endpoints { + for i := 0; i < ep.processes; i++ { + devTree.AddDevice(devType, fmt.Sprintf("%s_%s_%d", sname, ep.id, i), dpapi.DeviceInfo{ + State: pluginapi.Healthy, + Nodes: devs, + Envs: map[string]string{ + fmt.Sprintf("QAT_SECTION_NAME_%s_%d", devType, uniqID): sname, + // This env variable may get overriden if a container requests more than one QAT process. + // But we keep this code since the majority of pod workloads run only one QAT process. + // The rest should use QAT_SECTION_NAME_XXX variables. + "QAT_SECTION_NAME": sname, + }, + }) + uniqID++ + } + + if !svalue.pinned { + break + } + } + } + + return devTree, nil +} + +type devicePlugin struct { + execer utilsexec.Interface + configDir string +} + +func newDevicePlugin(configDir string, execer utilsexec.Interface) *devicePlugin { + return &devicePlugin{ + execer: execer, + configDir: configDir, + } +} + +func (dp *devicePlugin) parseConfigs() (map[string]section, error) { + outputBytes, err := dp.execer.Command("adf_ctl", "status").CombinedOutput() + if err != nil { + return nil, errors.Wrapf(err, "Can't get driver status") + } + output := string(outputBytes[:]) + + devNum := 0 + driverConfig := make(map[string]section) + for ln, line := range strings.Split(output, "\n") { + if !strings.HasPrefix(line, " qat_") { + continue + } + + devstr := strings.SplitN(line, "-", 2) + if len(devstr) != 2 { + continue + } + + devprops := strings.Split(devstr[1], ",") + devType := "" + for _, propstr := range devprops { + if strings.TrimSpace(propstr) == "type: c6xx" { + devType = "c6xx" + } + } + + if devType == "" { + continue + } + + devID := strings.TrimPrefix(strings.TrimSpace(devstr[0]), "qat_") + + f, err := os.Open(path.Join(dp.configDir, fmt.Sprintf("%s_%s.conf", devType, devID))) + if err != nil { + return nil, errors.WithStack(err) + } + defer f.Close() + + // Parse the configuration. + config, err := ini.Parse(f) + if err != nil { + return nil, errors.WithStack(err) + } + devNum++ + + debug.Print(ln, devID, line) + + for sectionName, data := range config { + if sectionName == "GENERAL" || sectionName == "KERNEL" || sectionName == "KERNEL_QAT" || sectionName == "" { + continue + } + debug.Print(sectionName) + + numProcesses, err := strconv.Atoi(data["NumProcesses"]) + if err != nil { + return nil, errors.Wrapf(err, "Can't convert NumProcesses in %s", sectionName) + } + cryptoEngines, err := strconv.Atoi(data["NumberCyInstances"]) + if err != nil { + return nil, errors.Wrapf(err, "Can't convert NumberCyInstances in %s", sectionName) + } + compressionEngines, err := strconv.Atoi(data["NumberDcInstances"]) + if err != nil { + return nil, errors.Wrapf(err, "Can't convert NumberDcInstances in %s", sectionName) + } + pinned := false + if limitDevAccess, ok := data["LimitDevAccess"]; ok { + if limitDevAccess != "0" { + pinned = true + } + } + + if old, ok := driverConfig[sectionName]; ok { + // first check the sections are consistent across endpoints + if old.pinned != pinned { + return nil, errors.Errorf("Value of LimitDevAccess must be consistent across all devices in %s", sectionName) + } + if !pinned && old.endpoints[0].processes != numProcesses { + return nil, errors.Errorf("For not pinned section \"%s\" NumProcesses must be equal for all devices", sectionName) + } + if old.cryptoEngines != cryptoEngines || old.compressionEngines != compressionEngines { + return nil, errors.Errorf("NumberCyInstances and NumberDcInstances must be consistent across all devices in %s", sectionName) + } + + // then add a new endpoint to the section + old.endpoints = append(old.endpoints, endpoint{ + id: devID, + processes: numProcesses, + }) + driverConfig[sectionName] = old + } else { + driverConfig[sectionName] = section{ + endpoints: []endpoint{ + { + id: devID, + processes: numProcesses, + }, + }, + cryptoEngines: cryptoEngines, + compressionEngines: compressionEngines, + pinned: pinned, + } + } + } + + } + + // check if the number of sections with LimitDevAccess=1 is equal to the number of endpoints + for sname, svalue := range driverConfig { + if svalue.pinned && len(svalue.endpoints) != devNum { + return nil, errors.Errorf("Section [%s] must be defined for all QAT devices since it contains LimitDevAccess=1", sname) + } + } + + return driverConfig, nil +} + +func (dp *devicePlugin) Scan(notifier dpapi.Notifier) error { + for { + driverConfig, err := dp.parseConfigs() + if err != nil { + return err + } + + devTree, err := getDevTree("/dev", driverConfig) + if err != nil { + return err + } + + notifier.Notify(devTree) + + time.Sleep(5 * time.Second) + } +} + +func (dp *devicePlugin) PostAllocate(response *pluginapi.AllocateResponse) error { + for _, containerResponse := range response.GetContainerResponses() { + envsToDelete := []string{} + envsToAdd := make(map[string]string) + counter := 0 + for key, value := range containerResponse.Envs { + if !strings.HasPrefix(key, "QAT_SECTION_NAME_") { + continue + } + parts := strings.Split(key, "_") + if len(parts) != 6 { + return errors.Errorf("Wrong format of env variable name %s", key) + } + prefix := strings.Join(parts[0:5], "_") + envsToDelete = append(envsToDelete, key) + envsToAdd[fmt.Sprintf("%s_%d", prefix, counter)] = value + counter++ + } + + for _, key := range envsToDelete { + delete(containerResponse.Envs, key) + } + + for key, value := range envsToAdd { + containerResponse.Envs[key] = value + } + } + + return nil +} + +func main() { + debugEnabled := flag.Bool("debug", false, "enable debug output") + flag.Parse() + + if *debugEnabled { + debug.Activate() + } + + plugin := newDevicePlugin("/etc", utilsexec.New()) + + manager := dpapi.NewManager(namespace, plugin) + manager.Run() +} diff --git a/cmd/qat2_plugin/qat2_plugin_test.go b/cmd/qat2_plugin/qat2_plugin_test.go new file mode 100644 index 00000000..84c495b8 --- /dev/null +++ b/cmd/qat2_plugin/qat2_plugin_test.go @@ -0,0 +1,219 @@ +// Copyright 2018 Intel Corporation. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "fmt" + "os" + "path" + "testing" + "time" + + pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" + + "github.com/intel/intel-device-plugins-for-kubernetes/pkg/debug" +) + +const ( + adfCtlOutput = `Checking status of all devices. +There is 3 QAT acceleration device(s) in the system: + qat_dev0 - type: c6xx, inst_id: 0, node_id: 0, bsf: 3b:00.0, #accel: 5 #engines: 10 state: up + qat_dev1 - type: c6xx, inst_id: 1, node_id: 0, bsf: 3d:00.0, #accel: 5 #engines: 10 state: up + qat_dev2 - type: c6xx, inst_id: 2, node_id: 3, bsf: d8:00.0, #accel: 5 #engines: 10 state: up +` +) + +func init() { + debug.Activate() +} + +func TestParseConfigs(t *testing.T) { + tcases := []struct { + name string + testData string + expectedErr bool + }{ + { + name: "All is good", + testData: "all_is_good", + }, + { + name: "Missing section with LinitDevAccess=1", + testData: "missing_pinned_section", + expectedErr: true, + }, + } + for _, tc := range tcases { + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ + func() ([]byte, error) { + return []byte(adfCtlOutput), nil + }, + }, + } + execer := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { + return fakeexec.InitFakeCmd(&fcmd, cmd, args...) + }, + }, + } + dp := &devicePlugin{ + execer: &execer, + configDir: "./test_data/" + tc.testData, + } + _, err := dp.parseConfigs() + if tc.expectedErr && err == nil { + t.Errorf("Test case '%s': expected error hasn't been triggered", tc.name) + } + if !tc.expectedErr && err != nil { + t.Errorf("Test case '%s': Unexpected error: %+v", tc.name, err) + } + } +} + +func TestGetDevTree(t *testing.T) { + tmpdir := fmt.Sprintf("/tmp/qatplugin-getDevTree-%d", time.Now().Unix()) + tcases := []struct { + name string + devfs string + uiodevs []string + config map[string]section + expectedErr bool + }{ + { + name: "All is good", + devfs: "dev", + uiodevs: []string{"uio4", "uio5"}, + config: map[string]section{ + "TESTSHIM": { + endpoints: []endpoint{ + { + id: "dev0", + processes: 2, + }, + }, + }, + "TESTSHIM2": { + endpoints: []endpoint{ + { + id: "dev0", + processes: 2, + }, + }, + }, + "TESTPINNED": { + endpoints: []endpoint{ + { + id: "dev0", + processes: 2, + }, + }, + pinned: true, + }, + }, + }, + { + name: "Wrong devfs", + devfs: "wrongdev", + expectedErr: true, + }, + } + for _, tc := range tcases { + var err error + + devfs := path.Join(tmpdir, "dev") + err = os.MkdirAll(devfs, 0755) + if err != nil { + t.Fatal(err) + } + + for _, uiodev := range tc.uiodevs { + err = os.MkdirAll(path.Join(devfs, uiodev), 0755) + if err != nil { + t.Fatal(err) + } + } + + _, err = getDevTree(path.Join(tmpdir, tc.devfs), tc.config) + if tc.expectedErr && err == nil { + t.Errorf("Test case '%s': expected error hasn't been triggered", tc.name) + } + if !tc.expectedErr && err != nil { + t.Errorf("Test case '%s': Unexpected error: %+v", tc.name, err) + } + + err = os.RemoveAll(tmpdir) + if err != nil { + t.Fatal(err) + } + } +} + +func TestPostAllocate(t *testing.T) { + tcases := []struct { + name string + envs map[string]string + expectedEnvs []string + expectedErr bool + }{ + { + name: "All is good", + envs: map[string]string{ + "SOMEVAR": "some value", + "QAT_SECTION_NAME_cy1_dc0_15": "TESTSHIM", + "QAT_SECTION_NAME_cy1_dc0_32": "TESTSHIM2", + }, + expectedEnvs: []string{ + "SOMEVAR", + "QAT_SECTION_NAME_cy1_dc0_0", + "QAT_SECTION_NAME_cy1_dc0_1", + }, + }, + { + name: "Wrong env variable name format", + envs: map[string]string{ + "QAT_SECTION_NAME_JUSTWRONG": "some value", + }, + expectedErr: true, + }, + } + for _, tc := range tcases { + response := new(pluginapi.AllocateResponse) + cresp := new(pluginapi.ContainerAllocateResponse) + cresp.Envs = tc.envs + response.ContainerResponses = append(response.ContainerResponses, cresp) + + dp := &devicePlugin{} + + err := dp.PostAllocate(response) + + for _, key := range tc.expectedEnvs { + if _, ok := cresp.Envs[key]; !ok { + t.Errorf("Test case '%s': expcted env variable '%s' is missing", tc.name, key) + } + } + + if tc.expectedErr && err == nil { + t.Errorf("Test case '%s': expected error hasn't been triggered", tc.name) + } + if !tc.expectedErr && err != nil { + t.Errorf("Test case '%s': Unexpected error: %+v", tc.name, err) + } + debug.Print(response) + } +} diff --git a/cmd/qat2_plugin/test_data/all_is_good/c6xx_dev0.conf b/cmd/qat2_plugin/test_data/all_is_good/c6xx_dev0.conf new file mode 100644 index 00000000..e63b5950 --- /dev/null +++ b/cmd/qat2_plugin/test_data/all_is_good/c6xx_dev0.conf @@ -0,0 +1,205 @@ +################################################################ +# This file is provided under a dual BSD/GPLv2 license. When using or +# redistributing this file, you may do so under either license. +# +# GPL LICENSE SUMMARY +# +# Copyright(c) 2007-2018 Intel Corporation. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# The full GNU General Public License is included in this distribution +# in the file called LICENSE.GPL. +# +# Contact Information: +# Intel Corporation +# +# BSD LICENSE +# +# Copyright(c) 2007-2018 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.L.4.2.0-00012 +################################################################ +[GENERAL] +ServicesEnabled = cy;dc + +ConfigVersion = 2 + +#Default values for number of concurrent requests*/ +CyNumConcurrentSymRequests = 512 +CyNumConcurrentAsymRequests = 64 + +#Statistics, valid values: 1,0 +statsGeneral = 1 +statsDh = 1 +statsDrbg = 1 +statsDsa = 1 +statsEcc = 1 +statsKeyGen = 1 +statsDc = 1 +statsLn = 1 +statsPrime = 1 +statsRsa = 1 +statsSym = 1 +KptEnabled = 0 + +# Disable public key crypto and prime number +# services by specifying a value of 1 (default is 0) +PkeServiceDisabled = 0 + +# Specify size of intermediate buffers for which to +# allocate on-chip buffers. Legal values are 32 and +# 64 (default is 64). Specify 32 to optimize for +# compressing buffers <=32KB in size. +DcIntermediateBufferSizeInKB = 64 + +# This flag is to enable device auto reset on heartbeat error +AutoResetOnError = 0 + +############################################## +# Kernel Instances Section +############################################## +[KERNEL] +NumberCyInstances = 1 +NumberDcInstances = 1 + +# Crypto - Kernel instance #0 +Cy0Name = "IPSec0" +Cy0IsPolled = 0 +Cy0CoreAffinity = 0 + +# Data Compression - Kernel instance #0 +Dc0Name = "IPComp0" +Dc0IsPolled = 0 +Dc0CoreAffinity = 0 + +############################################## +# User Process Instance Section +############################################## +[SSL] +NumberCyInstances = 6 +NumberDcInstances = 2 +NumProcesses = 1 +LimitDevAccess = 0 + +# Crypto - User instance #0 +Cy0Name = "SSL0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 1 + +# Crypto - User instance #1 +Cy1Name = "SSL1" +Cy1IsPolled = 1 +# List of core affinities +Cy1CoreAffinity = 2 + +# Crypto - User instance #2 +Cy2Name = "SSL2" +Cy2IsPolled = 1 +# List of core affinities +Cy2CoreAffinity = 3 + +# Crypto - User instance #3 +Cy3Name = "SSL3" +Cy3IsPolled = 1 +# List of core affinities +Cy3CoreAffinity = 4 + +# Crypto - User instance #4 +Cy4Name = "SSL4" +Cy4IsPolled = 1 +# List of core affinities +Cy4CoreAffinity = 5 + +# Crypto - User instance #5 +Cy5Name = "SSL5" +Cy5IsPolled = 1 +# List of core affinities +Cy5CoreAffinity = 6 + + +# Data Compression - User instance #0 +Dc0Name = "Dc0" +Dc0IsPolled = 1 +# List of core affinities +Dc0CoreAffinity = 1 + +# Data Compression - User instance #1 +Dc1Name = "Dc1" +Dc1IsPolled = 1 +# List of core affinities +Dc1CoreAffinity = 2 + +[SHIM] +NumberCyInstances = 1 +NumberDcInstances = 0 +NumProcesses = 2 +LimitDevAccess = 0 + +# Crypto - User instance #0 +Cy0Name = "UserCY0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 0 + +[SHIM2] +NumberCyInstances = 1 +NumberDcInstances = 0 +NumProcesses = 2 +LimitDevAccess = 0 + +# Crypto - User instance #0 +Cy0Name = "UserCY0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 0 + +[PINNED] +NumberCyInstances = 1 +NumberDcInstances = 0 +NumProcesses = 4 +LimitDevAccess = 1 +# Crypto - User instance #0 +Cy0Name = "UserCY0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 0 diff --git a/cmd/qat2_plugin/test_data/all_is_good/c6xx_dev1.conf b/cmd/qat2_plugin/test_data/all_is_good/c6xx_dev1.conf new file mode 100644 index 00000000..df92e1d2 --- /dev/null +++ b/cmd/qat2_plugin/test_data/all_is_good/c6xx_dev1.conf @@ -0,0 +1,193 @@ +################################################################ +# This file is provided under a dual BSD/GPLv2 license. When using or +# redistributing this file, you may do so under either license. +# +# GPL LICENSE SUMMARY +# +# Copyright(c) 2007-2018 Intel Corporation. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# The full GNU General Public License is included in this distribution +# in the file called LICENSE.GPL. +# +# Contact Information: +# Intel Corporation +# +# BSD LICENSE +# +# Copyright(c) 2007-2018 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.L.4.2.0-00012 +################################################################ +[GENERAL] +ServicesEnabled = cy;dc + +ConfigVersion = 2 + +#Default values for number of concurrent requests*/ +CyNumConcurrentSymRequests = 512 +CyNumConcurrentAsymRequests = 64 + +#Statistics, valid values: 1,0 +statsGeneral = 1 +statsDh = 1 +statsDrbg = 1 +statsDsa = 1 +statsEcc = 1 +statsKeyGen = 1 +statsDc = 1 +statsLn = 1 +statsPrime = 1 +statsRsa = 1 +statsSym = 1 +KptEnabled = 0 + +# Disable public key crypto and prime number +# services by specifying a value of 1 (default is 0) +PkeServiceDisabled = 0 + +# Specify size of intermediate buffers for which to +# allocate on-chip buffers. Legal values are 32 and +# 64 (default is 64). Specify 32 to optimize for +# compressing buffers <=32KB in size. +DcIntermediateBufferSizeInKB = 64 + +# This flag is to enable device auto reset on heartbeat error +AutoResetOnError = 0 + +############################################## +# Kernel Instances Section +############################################## +[KERNEL] +NumberCyInstances = 1 +NumberDcInstances = 1 + +# Crypto - Kernel instance #0 +Cy0Name = "IPSec0" +Cy0IsPolled = 0 +Cy0CoreAffinity = 0 + +# Data Compression - Kernel instance #0 +Dc0Name = "IPComp0" +Dc0IsPolled = 0 +Dc0CoreAffinity = 0 + +############################################## +# User Process Instance Section +############################################## +[SSL] +NumberCyInstances = 6 +NumberDcInstances = 2 +NumProcesses = 1 +LimitDevAccess = 0 + +# Crypto - User instance #0 +Cy0Name = "SSL0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 9 + +# Crypto - User instance #1 +Cy1Name = "SSL1" +Cy1IsPolled = 1 +# List of core affinities +Cy1CoreAffinity = 10 + +# Crypto - User instance #2 +Cy2Name = "SSL2" +Cy2IsPolled = 1 +# List of core affinities +Cy2CoreAffinity = 11 + +# Crypto - User instance #3 +Cy3Name = "SSL3" +Cy3IsPolled = 1 +# List of core affinities +Cy3CoreAffinity = 12 + +# Crypto - User instance #4 +Cy4Name = "SSL4" +Cy4IsPolled = 1 +# List of core affinities +Cy4CoreAffinity = 13 + +# Crypto - User instance #5 +Cy5Name = "SSL5" +Cy5IsPolled = 1 +# List of core affinities +Cy5CoreAffinity = 14 + + +# Data Compression - User instance #0 +Dc0Name = "Dc0" +Dc0IsPolled = 1 +# List of core affinities +Dc0CoreAffinity = 9 + +# Data Compression - User instance #1 +Dc1Name = "Dc1" +Dc1IsPolled = 1 +# List of core affinities +Dc1CoreAffinity = 10 + +[SHIM] +NumberCyInstances = 1 +NumberDcInstances = 0 +NumProcesses = 2 +LimitDevAccess = 0 + +# Crypto - User instance #0 +Cy0Name = "UserCY0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 0 + +[PINNED] +NumberCyInstances = 1 +NumberDcInstances = 0 +NumProcesses = 4 +LimitDevAccess = 1 +# Crypto - User instance #0 +Cy0Name = "UserCY0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 0 diff --git a/cmd/qat2_plugin/test_data/all_is_good/c6xx_dev2.conf b/cmd/qat2_plugin/test_data/all_is_good/c6xx_dev2.conf new file mode 100644 index 00000000..d0779e5c --- /dev/null +++ b/cmd/qat2_plugin/test_data/all_is_good/c6xx_dev2.conf @@ -0,0 +1,193 @@ +################################################################ +# This file is provided under a dual BSD/GPLv2 license. When using or +# redistributing this file, you may do so under either license. +# +# GPL LICENSE SUMMARY +# +# Copyright(c) 2007-2018 Intel Corporation. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# The full GNU General Public License is included in this distribution +# in the file called LICENSE.GPL. +# +# Contact Information: +# Intel Corporation +# +# BSD LICENSE +# +# Copyright(c) 2007-2018 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.L.4.2.0-00012 +################################################################ +[GENERAL] +ServicesEnabled = cy;dc + +ConfigVersion = 2 + +#Default values for number of concurrent requests*/ +CyNumConcurrentSymRequests = 512 +CyNumConcurrentAsymRequests = 64 + +#Statistics, valid values: 1,0 +statsGeneral = 1 +statsDh = 1 +statsDrbg = 1 +statsDsa = 1 +statsEcc = 1 +statsKeyGen = 1 +statsDc = 1 +statsLn = 1 +statsPrime = 1 +statsRsa = 1 +statsSym = 1 +KptEnabled = 0 + +# Disable public key crypto and prime number +# services by specifying a value of 1 (default is 0) +PkeServiceDisabled = 0 + +# Specify size of intermediate buffers for which to +# allocate on-chip buffers. Legal values are 32 and +# 64 (default is 64). Specify 32 to optimize for +# compressing buffers <=32KB in size. +DcIntermediateBufferSizeInKB = 64 + +# This flag is to enable device auto reset on heartbeat error +AutoResetOnError = 0 + +############################################## +# Kernel Instances Section +############################################## +[KERNEL] +NumberCyInstances = 1 +NumberDcInstances = 1 + +# Crypto - Kernel instance #0 +Cy0Name = "IPSec0" +Cy0IsPolled = 0 +Cy0CoreAffinity = 0 + +# Data Compression - Kernel instance #0 +Dc0Name = "IPComp0" +Dc0IsPolled = 0 +Dc0CoreAffinity = 0 + +############################################## +# User Process Instance Section +############################################## +[SSL] +NumberCyInstances = 6 +NumberDcInstances = 2 +NumProcesses = 1 +LimitDevAccess = 0 + +# Crypto - User instance #0 +Cy0Name = "SSL0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 17 + +# Crypto - User instance #1 +Cy1Name = "SSL1" +Cy1IsPolled = 1 +# List of core affinities +Cy1CoreAffinity = 18 + +# Crypto - User instance #2 +Cy2Name = "SSL2" +Cy2IsPolled = 1 +# List of core affinities +Cy2CoreAffinity = 19 + +# Crypto - User instance #3 +Cy3Name = "SSL3" +Cy3IsPolled = 1 +# List of core affinities +Cy3CoreAffinity = 20 + +# Crypto - User instance #4 +Cy4Name = "SSL4" +Cy4IsPolled = 1 +# List of core affinities +Cy4CoreAffinity = 21 + +# Crypto - User instance #5 +Cy5Name = "SSL5" +Cy5IsPolled = 1 +# List of core affinities +Cy5CoreAffinity = 22 + + +# Data Compression - User instance #0 +Dc0Name = "Dc0" +Dc0IsPolled = 1 +# List of core affinities +Dc0CoreAffinity = 17 + +# Data Compression - User instance #1 +Dc1Name = "Dc1" +Dc1IsPolled = 1 +# List of core affinities +Dc1CoreAffinity = 18 + +[SHIM] +NumberCyInstances = 1 +NumberDcInstances = 0 +NumProcesses = 2 +LimitDevAccess = 0 + +# Crypto - User instance #0 +Cy0Name = "UserCY0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 0 + +[PINNED] +NumberCyInstances = 1 +NumberDcInstances = 0 +NumProcesses = 4 +LimitDevAccess = 1 +# Crypto - User instance #0 +Cy0Name = "UserCY0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 0 diff --git a/cmd/qat2_plugin/test_data/missing_pinned_section/c6xx_dev0.conf b/cmd/qat2_plugin/test_data/missing_pinned_section/c6xx_dev0.conf new file mode 100644 index 00000000..3047702b --- /dev/null +++ b/cmd/qat2_plugin/test_data/missing_pinned_section/c6xx_dev0.conf @@ -0,0 +1,195 @@ +################################################################ +# This file is provided under a dual BSD/GPLv2 license. When using or +# redistributing this file, you may do so under either license. +# +# GPL LICENSE SUMMARY +# +# Copyright(c) 2007-2018 Intel Corporation. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# The full GNU General Public License is included in this distribution +# in the file called LICENSE.GPL. +# +# Contact Information: +# Intel Corporation +# +# BSD LICENSE +# +# Copyright(c) 2007-2018 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.L.4.2.0-00012 +################################################################ +[GENERAL] +ServicesEnabled = cy;dc + +ConfigVersion = 2 + +#Default values for number of concurrent requests*/ +CyNumConcurrentSymRequests = 512 +CyNumConcurrentAsymRequests = 64 + +#Statistics, valid values: 1,0 +statsGeneral = 1 +statsDh = 1 +statsDrbg = 1 +statsDsa = 1 +statsEcc = 1 +statsKeyGen = 1 +statsDc = 1 +statsLn = 1 +statsPrime = 1 +statsRsa = 1 +statsSym = 1 +KptEnabled = 0 + +# Disable public key crypto and prime number +# services by specifying a value of 1 (default is 0) +PkeServiceDisabled = 0 + +# Specify size of intermediate buffers for which to +# allocate on-chip buffers. Legal values are 32 and +# 64 (default is 64). Specify 32 to optimize for +# compressing buffers <=32KB in size. +DcIntermediateBufferSizeInKB = 64 + +# This flag is to enable device auto reset on heartbeat error +AutoResetOnError = 0 + +############################################## +# Kernel Instances Section +############################################## +[KERNEL] +NumberCyInstances = 1 +NumberDcInstances = 1 + +# Crypto - Kernel instance #0 +Cy0Name = "IPSec0" +Cy0IsPolled = 0 +Cy0CoreAffinity = 0 + +# Data Compression - Kernel instance #0 +Dc0Name = "IPComp0" +Dc0IsPolled = 0 +Dc0CoreAffinity = 0 + +############################################## +# User Process Instance Section +############################################## +[SSL] +NumberCyInstances = 6 +NumberDcInstances = 2 +NumProcesses = 1 +LimitDevAccess = 0 + +# Crypto - User instance #0 +Cy0Name = "SSL0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 1 + +# Crypto - User instance #1 +Cy1Name = "SSL1" +Cy1IsPolled = 1 +# List of core affinities +Cy1CoreAffinity = 2 + +# Crypto - User instance #2 +Cy2Name = "SSL2" +Cy2IsPolled = 1 +# List of core affinities +Cy2CoreAffinity = 3 + +# Crypto - User instance #3 +Cy3Name = "SSL3" +Cy3IsPolled = 1 +# List of core affinities +Cy3CoreAffinity = 4 + +# Crypto - User instance #4 +Cy4Name = "SSL4" +Cy4IsPolled = 1 +# List of core affinities +Cy4CoreAffinity = 5 + +# Crypto - User instance #5 +Cy5Name = "SSL5" +Cy5IsPolled = 1 +# List of core affinities +Cy5CoreAffinity = 6 + + +# Data Compression - User instance #0 +Dc0Name = "Dc0" +Dc0IsPolled = 1 +# List of core affinities +Dc0CoreAffinity = 1 + +# Data Compression - User instance #1 +Dc1Name = "Dc1" +Dc1IsPolled = 1 +# List of core affinities +Dc1CoreAffinity = 2 + +[SHIM] +NumberCyInstances = 1 +NumberDcInstances = 0 +NumProcesses = 2 +LimitDevAccess = 0 + +# Crypto - User instance #0 +Cy0Name = "UserCY0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 0 + +[SHIM2] +NumberCyInstances = 1 +NumberDcInstances = 0 +NumProcesses = 2 +LimitDevAccess = 0 + +# Crypto - User instance #0 +Cy0Name = "UserCY0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 0 + diff --git a/cmd/qat2_plugin/test_data/missing_pinned_section/c6xx_dev1.conf b/cmd/qat2_plugin/test_data/missing_pinned_section/c6xx_dev1.conf new file mode 100644 index 00000000..df92e1d2 --- /dev/null +++ b/cmd/qat2_plugin/test_data/missing_pinned_section/c6xx_dev1.conf @@ -0,0 +1,193 @@ +################################################################ +# This file is provided under a dual BSD/GPLv2 license. When using or +# redistributing this file, you may do so under either license. +# +# GPL LICENSE SUMMARY +# +# Copyright(c) 2007-2018 Intel Corporation. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# The full GNU General Public License is included in this distribution +# in the file called LICENSE.GPL. +# +# Contact Information: +# Intel Corporation +# +# BSD LICENSE +# +# Copyright(c) 2007-2018 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.L.4.2.0-00012 +################################################################ +[GENERAL] +ServicesEnabled = cy;dc + +ConfigVersion = 2 + +#Default values for number of concurrent requests*/ +CyNumConcurrentSymRequests = 512 +CyNumConcurrentAsymRequests = 64 + +#Statistics, valid values: 1,0 +statsGeneral = 1 +statsDh = 1 +statsDrbg = 1 +statsDsa = 1 +statsEcc = 1 +statsKeyGen = 1 +statsDc = 1 +statsLn = 1 +statsPrime = 1 +statsRsa = 1 +statsSym = 1 +KptEnabled = 0 + +# Disable public key crypto and prime number +# services by specifying a value of 1 (default is 0) +PkeServiceDisabled = 0 + +# Specify size of intermediate buffers for which to +# allocate on-chip buffers. Legal values are 32 and +# 64 (default is 64). Specify 32 to optimize for +# compressing buffers <=32KB in size. +DcIntermediateBufferSizeInKB = 64 + +# This flag is to enable device auto reset on heartbeat error +AutoResetOnError = 0 + +############################################## +# Kernel Instances Section +############################################## +[KERNEL] +NumberCyInstances = 1 +NumberDcInstances = 1 + +# Crypto - Kernel instance #0 +Cy0Name = "IPSec0" +Cy0IsPolled = 0 +Cy0CoreAffinity = 0 + +# Data Compression - Kernel instance #0 +Dc0Name = "IPComp0" +Dc0IsPolled = 0 +Dc0CoreAffinity = 0 + +############################################## +# User Process Instance Section +############################################## +[SSL] +NumberCyInstances = 6 +NumberDcInstances = 2 +NumProcesses = 1 +LimitDevAccess = 0 + +# Crypto - User instance #0 +Cy0Name = "SSL0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 9 + +# Crypto - User instance #1 +Cy1Name = "SSL1" +Cy1IsPolled = 1 +# List of core affinities +Cy1CoreAffinity = 10 + +# Crypto - User instance #2 +Cy2Name = "SSL2" +Cy2IsPolled = 1 +# List of core affinities +Cy2CoreAffinity = 11 + +# Crypto - User instance #3 +Cy3Name = "SSL3" +Cy3IsPolled = 1 +# List of core affinities +Cy3CoreAffinity = 12 + +# Crypto - User instance #4 +Cy4Name = "SSL4" +Cy4IsPolled = 1 +# List of core affinities +Cy4CoreAffinity = 13 + +# Crypto - User instance #5 +Cy5Name = "SSL5" +Cy5IsPolled = 1 +# List of core affinities +Cy5CoreAffinity = 14 + + +# Data Compression - User instance #0 +Dc0Name = "Dc0" +Dc0IsPolled = 1 +# List of core affinities +Dc0CoreAffinity = 9 + +# Data Compression - User instance #1 +Dc1Name = "Dc1" +Dc1IsPolled = 1 +# List of core affinities +Dc1CoreAffinity = 10 + +[SHIM] +NumberCyInstances = 1 +NumberDcInstances = 0 +NumProcesses = 2 +LimitDevAccess = 0 + +# Crypto - User instance #0 +Cy0Name = "UserCY0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 0 + +[PINNED] +NumberCyInstances = 1 +NumberDcInstances = 0 +NumProcesses = 4 +LimitDevAccess = 1 +# Crypto - User instance #0 +Cy0Name = "UserCY0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 0 diff --git a/cmd/qat2_plugin/test_data/missing_pinned_section/c6xx_dev2.conf b/cmd/qat2_plugin/test_data/missing_pinned_section/c6xx_dev2.conf new file mode 100644 index 00000000..d0779e5c --- /dev/null +++ b/cmd/qat2_plugin/test_data/missing_pinned_section/c6xx_dev2.conf @@ -0,0 +1,193 @@ +################################################################ +# This file is provided under a dual BSD/GPLv2 license. When using or +# redistributing this file, you may do so under either license. +# +# GPL LICENSE SUMMARY +# +# Copyright(c) 2007-2018 Intel Corporation. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# The full GNU General Public License is included in this distribution +# in the file called LICENSE.GPL. +# +# Contact Information: +# Intel Corporation +# +# BSD LICENSE +# +# Copyright(c) 2007-2018 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.L.4.2.0-00012 +################################################################ +[GENERAL] +ServicesEnabled = cy;dc + +ConfigVersion = 2 + +#Default values for number of concurrent requests*/ +CyNumConcurrentSymRequests = 512 +CyNumConcurrentAsymRequests = 64 + +#Statistics, valid values: 1,0 +statsGeneral = 1 +statsDh = 1 +statsDrbg = 1 +statsDsa = 1 +statsEcc = 1 +statsKeyGen = 1 +statsDc = 1 +statsLn = 1 +statsPrime = 1 +statsRsa = 1 +statsSym = 1 +KptEnabled = 0 + +# Disable public key crypto and prime number +# services by specifying a value of 1 (default is 0) +PkeServiceDisabled = 0 + +# Specify size of intermediate buffers for which to +# allocate on-chip buffers. Legal values are 32 and +# 64 (default is 64). Specify 32 to optimize for +# compressing buffers <=32KB in size. +DcIntermediateBufferSizeInKB = 64 + +# This flag is to enable device auto reset on heartbeat error +AutoResetOnError = 0 + +############################################## +# Kernel Instances Section +############################################## +[KERNEL] +NumberCyInstances = 1 +NumberDcInstances = 1 + +# Crypto - Kernel instance #0 +Cy0Name = "IPSec0" +Cy0IsPolled = 0 +Cy0CoreAffinity = 0 + +# Data Compression - Kernel instance #0 +Dc0Name = "IPComp0" +Dc0IsPolled = 0 +Dc0CoreAffinity = 0 + +############################################## +# User Process Instance Section +############################################## +[SSL] +NumberCyInstances = 6 +NumberDcInstances = 2 +NumProcesses = 1 +LimitDevAccess = 0 + +# Crypto - User instance #0 +Cy0Name = "SSL0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 17 + +# Crypto - User instance #1 +Cy1Name = "SSL1" +Cy1IsPolled = 1 +# List of core affinities +Cy1CoreAffinity = 18 + +# Crypto - User instance #2 +Cy2Name = "SSL2" +Cy2IsPolled = 1 +# List of core affinities +Cy2CoreAffinity = 19 + +# Crypto - User instance #3 +Cy3Name = "SSL3" +Cy3IsPolled = 1 +# List of core affinities +Cy3CoreAffinity = 20 + +# Crypto - User instance #4 +Cy4Name = "SSL4" +Cy4IsPolled = 1 +# List of core affinities +Cy4CoreAffinity = 21 + +# Crypto - User instance #5 +Cy5Name = "SSL5" +Cy5IsPolled = 1 +# List of core affinities +Cy5CoreAffinity = 22 + + +# Data Compression - User instance #0 +Dc0Name = "Dc0" +Dc0IsPolled = 1 +# List of core affinities +Dc0CoreAffinity = 17 + +# Data Compression - User instance #1 +Dc1Name = "Dc1" +Dc1IsPolled = 1 +# List of core affinities +Dc1CoreAffinity = 18 + +[SHIM] +NumberCyInstances = 1 +NumberDcInstances = 0 +NumProcesses = 2 +LimitDevAccess = 0 + +# Crypto - User instance #0 +Cy0Name = "UserCY0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 0 + +[PINNED] +NumberCyInstances = 1 +NumberDcInstances = 0 +NumProcesses = 4 +LimitDevAccess = 1 +# Crypto - User instance #0 +Cy0Name = "UserCY0" +Cy0IsPolled = 1 +# List of core affinities +Cy0CoreAffinity = 0 diff --git a/deployments/qat_plugin/qat_plugin_kernel_mode.yaml b/deployments/qat_plugin/qat_plugin_kernel_mode.yaml new file mode 100644 index 00000000..177a6eac --- /dev/null +++ b/deployments/qat_plugin/qat_plugin_kernel_mode.yaml @@ -0,0 +1,40 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: intel-qat-kernel-plugin + labels: + app: intel-qat-kernel-plugin +spec: + selector: + matchLabels: + app: intel-qat-kernel-plugin + template: + metadata: + labels: + app: intel-qat-kernel-plugin + spec: + containers: + - name: intel-qat-kernel-plugin + securityContext: + privileged: true + image: intel-qat-plugin:devel + imagePullPolicy: IfNotPresent + command: ["/usr/bin/intel_qat_device_plugin", "-mode", "kernel"] + volumeMounts: + - name: devfs + mountPath: /dev + - name: etcdir + mountPath: /etc + readOnly: true + - name: kubeletsockets + mountPath: /var/lib/kubelet/device-plugins + volumes: + - name: etcdir + hostPath: + path: /etc + - name: kubeletsockets + hostPath: + path: /var/lib/kubelet/device-plugins + - name: devfs + hostPath: + path: /dev