Merge pull request #56 from mythi/qat

qat: read maxNumdevice as integer
This commit is contained in:
Dmitry Rozhkov 2018-07-30 11:11:56 +03:00 committed by GitHub
commit 5bb12f515a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,6 @@ import (
"os" "os"
"path" "path"
"path/filepath" "path/filepath"
"strconv"
"strings" "strings"
"time" "time"
@ -56,7 +55,7 @@ const (
var ( var (
dpdkDriver = flag.String("dpdk-driver", "igb_uio", "DPDK Device driver for configuring the QAT device") dpdkDriver = flag.String("dpdk-driver", "igb_uio", "DPDK Device driver for configuring the QAT device")
kernelVfDrivers = flag.String("kernel-vf-drivers", "dh895xccvf,c6xxvf,c3xxxvf,d15xxvf", "Comma separated VF Device Driver of the QuickAssist Devices in the system. Devices supported: DH895xCC,C62x,C3xxx and D15xx") kernelVfDrivers = flag.String("kernel-vf-drivers", "dh895xccvf,c6xxvf,c3xxxvf,d15xxvf", "Comma separated VF Device Driver of the QuickAssist Devices in the system. Devices supported: DH895xCC,C62x,C3xxx and D15xx")
maxNumdevice = flag.String("max-num-devices", "32", "maximum number of QAT devices to be provided to the QuickAssist device plugin") maxNumdevice = flag.Int("max-num-devices", 32, "maximum number of QAT devices to be provided to the QuickAssist device plugin")
) )
// deviceManager manages Intel gpu devices. // deviceManager manages Intel gpu devices.
@ -218,12 +217,8 @@ func (dm *deviceManager) discoverQATs() (bool, error) {
for n, file := range files { for n, file := range files {
if strings.HasPrefix(file.Name(), "0000:") { if strings.HasPrefix(file.Name(), "0000:") {
vfpciaddr := strings.TrimPrefix(file.Name(), "0000:") vfpciaddr := strings.TrimPrefix(file.Name(), "0000:")
max, err := strconv.Atoi(*maxNumdevice)
if err != nil {
return found, fmt.Errorf("Error in getting maximum number of devices: %v", err)
}
if n < max { if n < *maxNumdevice {
err = bindDevice(*dpdkDriver, vfpciaddr) err = bindDevice(*dpdkDriver, vfpciaddr)
if err != nil { if err != nil {
return found, fmt.Errorf("Error in binding the device to the dpdk driver") return found, fmt.Errorf("Error in binding the device to the dpdk driver")
@ -335,10 +330,6 @@ func main() {
if err != nil { if err != nil {
glog.Fatalf("Error in user input for DPDK Device Driver: %v", err) glog.Fatalf("Error in user input for DPDK Device Driver: %v", err)
} }
_, err = strconv.Atoi(*maxNumdevice)
if err != nil {
glog.Fatalf("Error in getting maximum number of devices: %v", err)
}
dm, err := newDeviceManager() dm, err := newDeviceManager()
if err != nil { if err != nil {
glog.Fatal(err) glog.Fatal(err)