mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00
Remove vendor PCI check, check only pci class
This commit is contained in:
parent
07f3673b23
commit
25ef46072c
@ -56,7 +56,7 @@ func (f *DflFME) Close() error {
|
||||
// NewDflFME Opens device.
|
||||
func NewDflFME(dev string) (FME, error) {
|
||||
fme := &DflFME{DevPath: dev}
|
||||
if err := checkVendorAndClass(fme); err != nil {
|
||||
if err := checkPCIDeviceType(fme); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := fme.updateProperties(); err != nil {
|
||||
@ -92,7 +92,7 @@ func (f *DflPort) Close() error {
|
||||
// NewDflPort Opens device.
|
||||
func NewDflPort(dev string) (Port, error) {
|
||||
port := &DflPort{DevPath: dev}
|
||||
if err := checkVendorAndClass(port); err != nil {
|
||||
if err := checkPCIDeviceType(port); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := port.updateProperties(); err != nil {
|
||||
|
@ -53,7 +53,7 @@ func (f *IntelFpgaFME) Close() error {
|
||||
// NewIntelFpgaFME Opens device.
|
||||
func NewIntelFpgaFME(dev string) (FME, error) {
|
||||
fme := &IntelFpgaFME{DevPath: dev}
|
||||
if err := checkVendorAndClass(fme); err != nil {
|
||||
if err := checkPCIDeviceType(fme); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := fme.updateProperties(); err != nil {
|
||||
@ -86,7 +86,7 @@ func (f *IntelFpgaPort) Close() error {
|
||||
// NewIntelFpgaPort Opens device.
|
||||
func NewIntelFpgaPort(dev string) (Port, error) {
|
||||
port := &IntelFpgaPort{DevPath: dev}
|
||||
if err := checkVendorAndClass(port); err != nil {
|
||||
if err := checkPCIDeviceType(port); err != nil {
|
||||
port.Close()
|
||||
return nil, err
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ import (
|
||||
|
||||
const (
|
||||
pciAddressRegex = `^([[:xdigit:]]{4}):([[:xdigit:]]{2}):([[:xdigit:]]{2})\.([[:xdigit:]])$`
|
||||
vendorIntel = "0x8086"
|
||||
fpgaClass = "0x120000"
|
||||
)
|
||||
|
||||
|
@ -62,13 +62,14 @@ func cleanBasename(name string) string {
|
||||
}
|
||||
|
||||
// check that FPGA device is a compatible PCI device.
|
||||
func checkVendorAndClass(dev commonFpgaAPI) error {
|
||||
func checkPCIDeviceType(dev commonFpgaAPI) error {
|
||||
pci, err := dev.GetPCIDevice()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if pci.Vendor != vendorIntel || pci.Class != fpgaClass {
|
||||
return errors.Errorf("unsupported PCI device %s VID=%s PID=%s Class=%s", pci.BDF, pci.Vendor, pci.Device, pci.Class)
|
||||
|
||||
if pci.Class != fpgaClass {
|
||||
return errors.Errorf("unsupported PCI class device %s VID=%s PID=%s Class=%s", pci.BDF, pci.Vendor, pci.Device, pci.Class)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user