Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #7 from telekom/fix/sriov-bind
Browse files Browse the repository at this point in the history
Reset sriov_drivers_autoprobe to 1 before rebinding
  • Loading branch information
Cellebyte authored Apr 3, 2024
2 parents 8a97fab + 6789b31 commit 1aa0d01
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions netplanner/sriov/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,5 @@ def config(configuration: NetplannerConfig, queue_rebind: bool = False):
def rebind(pci_addresses: list[str]):
for pci_address in pci_addresses:
device = pci.PCIDevice(pci_address)
device.sriov_drivers_autoprobe = True
pci.bind_vfs(device.vfs)
14 changes: 14 additions & 0 deletions netplanner/sriov/pci.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,19 @@ def devlink_set(self, obj_name: str, prop: str, value: str):
]
)

@property
def sriov_drivers_autoprobe(self) -> bool:
sriov_drivers_autoprobe_file = self.subpath("sriov_drivers_autoprobe")
with open(sriov_drivers_autoprobe_file, "r") as f:
read_data = f.read()
return bool(int(read_data.strip()))

@sriov_drivers_autoprobe.setter
def sriov_drivers_autoprobe(self, value: bool):
sriov_drivers_autoprobe_file = self.subpath("sriov_drivers_autoprobe")
with open(sriov_drivers_autoprobe_file, "w") as f:
f.write("1" if value else "0")

def __str__(self) -> str:
"""String represenation of object
Expand Down Expand Up @@ -424,6 +437,7 @@ def set_eswitch_mode(self, switch_mode: str):
self.update_attributes()

def bind_vfs(self):
self.pci_device.sriov_drivers_autoprobe = True
bind_vfs(self.pci_device.vfs)


Expand Down

0 comments on commit 1aa0d01

Please sign in to comment.