Skip to content

Commit bd77a4d

Browse files
committed
incusd/ip/vdpa: Remove unused
Signed-off-by: Gwendolyn <[email protected]>
1 parent 9843f8b commit bd77a4d

File tree

1 file changed

+0
-58
lines changed

1 file changed

+0
-58
lines changed

internal/server/ip/vdpa.go

-58
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,10 @@ import (
55
"os"
66
"path/filepath"
77
"strings"
8-
"syscall"
98

109
"github.com/vishvananda/netlink"
1110
)
1211

13-
// Base flags passed to all Netlink requests.
14-
const (
15-
commonNLFlags = syscall.NLM_F_REQUEST | syscall.NLM_F_ACK
16-
)
17-
1812
// MAX_VQP is the maximum number of VQPs supported by the vDPA device and is always the same as of now.
1913
const (
2014
vDPAMaxVQP = uint16(16)
@@ -32,20 +26,12 @@ type VhostVDPA struct {
3226
Path string
3327
}
3428

35-
// MgmtVDPADev represents the vDPA management device information.
36-
type MgmtVDPADev struct {
37-
BusName string // e.g. "pci"
38-
DevName string // e.g. "0000:00:08.2"
39-
}
40-
4129
// VDPADev represents the vDPA device information.
4230
type VDPADev struct {
4331
// Name of the vDPA created device. e.g. "vdpa0" (note: the iproute2 associated command would look like `vdpa dev add mgmtdev pci/<PCI_SLOT_NAME> name vdpa0 max_vqp <MAX_VQP>`).
4432
Name string
4533
// Max VQs supported by the vDPA device.
4634
MaxVQs uint32
47-
// Associated vDPA management device.
48-
MgmtDev *MgmtVDPADev
4935
// Associated vhost-vdpa device.
5036
VhostVDPA *VhostVDPA
5137
}
@@ -86,49 +72,6 @@ func getVhostVDPADevInPath(parentPath string) (*VhostVDPA, error) {
8672
return nil, fmt.Errorf("No vhost-vdpa device found in %s", parentPath)
8773
}
8874

89-
// ListVDPAMgmtDevices returns the list of all vDPA management devices.
90-
func ListVDPAMgmtDevices() ([]*MgmtVDPADev, error) {
91-
netlinkDevices, err := netlink.VDPAGetMGMTDevList()
92-
if err != nil {
93-
return nil, fmt.Errorf("failed to get vdpa mgmt dev list: %w", err)
94-
}
95-
96-
devices := make([]*MgmtVDPADev, 0, len(netlinkDevices))
97-
for _, dev := range netlinkDevices {
98-
devices = append(devices, &MgmtVDPADev{
99-
BusName: dev.BusName,
100-
DevName: dev.DevName,
101-
})
102-
}
103-
104-
return devices, nil
105-
}
106-
107-
// ListVDPADevices returns the list of all vDPA devices.
108-
func ListVDPADevices() ([]*VDPADev, error) {
109-
netlinkDevices, err := netlink.VDPAGetDevList()
110-
if err != nil {
111-
return nil, fmt.Errorf("failed to get vdpa dev list: %w", err)
112-
}
113-
114-
devices := make([]*VDPADev, 0, len(netlinkDevices))
115-
for _, dev := range netlinkDevices {
116-
vhostVDPA, err := getVhostVDPADevInPath(filepath.Join(vdpaBusDevDir, dev.Name))
117-
if err != nil {
118-
return nil, err
119-
}
120-
121-
devices = append(devices, &VDPADev{
122-
Name: dev.Name,
123-
MaxVQs: dev.MaxVQS,
124-
MgmtDev: nil, // TODO: the netlink library does not expose the associated management device information
125-
VhostVDPA: vhostVDPA,
126-
})
127-
}
128-
129-
return devices, nil
130-
}
131-
13275
// AddVDPADevice adds a new vDPA device.
13376
func AddVDPADevice(pciDevSlotName string, volatile map[string]string) (*VDPADev, error) {
13477
existingDevices, err := netlink.VDPAGetDevList()
@@ -176,7 +119,6 @@ func AddVDPADevice(pciDevSlotName string, volatile map[string]string) (*VDPADev,
176119
return &VDPADev{
177120
Name: dev.Name,
178121
MaxVQs: dev.MaxVQS,
179-
MgmtDev: nil, // TODO: the netlink library does not expose the associated management device information
180122
VhostVDPA: vhostVDPA,
181123
}, nil
182124
}

0 commit comments

Comments
 (0)