diff --git a/pkg/nvlib/device/device.go b/pkg/nvlib/device/device.go index 640c01f..bcc1409 100644 --- a/pkg/nvlib/device/device.go +++ b/pkg/nvlib/device/device.go @@ -18,11 +18,9 @@ package device import ( "fmt" - "strings" "github.com/NVIDIA/go-nvml/pkg/dl" "gitlab.com/nvidia/cloud-native/go-nvlib/pkg/nvml" - "gitlab.com/nvidia/cloud-native/go-nvlib/pkg/nvpci" ) // Device defines the set of extended functions associated with a device.Device @@ -41,15 +39,6 @@ type device struct { lib *devicelib } -// Class represents the PCI class for a device -type Class uint32 - -// Define constants for common device classes -const ( - ClassCompute = Class(nvpci.PCI3dControllerClass) - ClassDisplay = Class(nvpci.PCIVgaControllerClass) -) - var _ Device = &device{} // NewDevice builds a new Device from an nvml.Device @@ -62,16 +51,6 @@ func (d *devicelib) newDevice(dev nvml.Device) (*device, error) { return &device{dev, d}, nil } -// classIsSelected checks whether the specified class has been selected when constructing the devicelib -func (d *devicelib) classIsSelected(c Class) bool { - if d.selectedDeviceClasses == nil { - return false - } - _, exists := d.selectedDeviceClasses[c] - - return exists -} - // IsMigCapable checks if a device is capable of having MIG paprtitions created on it func (d *device) IsMigCapable() (bool, error) { err := nvmlLookupSymbol("nvmlDeviceGetMigMode") @@ -209,35 +188,6 @@ func (d *device) GetMigProfiles() ([]MigProfile, error) { return profiles, nil } -// getClass returns the PCI device class for the device -func (d *device) getClass() (Class, error) { - info, ret := d.GetPciInfo() - if ret != nvml.SUCCESS { - return 0, fmt.Errorf("failed to get PCI info: %v", ret) - } - - // We convert the BusId to a string - var bytes []byte - for _, b := range info.BusId { - if byte(b) == '\x00' { - break - } - bytes = append(bytes, byte(b)) - } - id := strings.ToLower(string(bytes)) - - if id != "0000" { - id = strings.TrimPrefix(id, "0000") - } - - device, err := nvpci.New().GetGPUByPciBusID(id) - if err != nil { - return 0, fmt.Errorf("failed to construct PCI device: %v", err) - } - - return Class(device.Class), nil -} - // isSkipped checks whether the device should be skipped. func (d *device) isSkipped() (bool, error) { name, ret := d.GetName()