Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: add --force, --enable-sriov to opae.io #3038

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tswhison
Copy link
Contributor

@tswhison tswhison commented Nov 7, 2023

Description

Add --force and --enable-sriov options to the subparser for opae.io init. The --force option enables controlling the force parameter to vfio_init() that was previously hard-coded to False.

The --enable-sriov option, when given, causes opae.io init to write 'Y' to /sys/module/vfio_pci/parameters/enable_sriov.

The default value for both options is False.

Collateral (docs, reports, design examples, case IDs):

  • Document Update Required? (Specify FIM/AFU/Scripts)

Tests added:

Tests run:

$ cat /sys/module/vfio_pci/parameters/enable_sriov
N
$ sudo opae.io init -e -d 0000:ca:00.0 tswhison:tswhison
$ cat /sys/module/vfio_pci/parameters/enable_sriov
Y

Add --force and --enable-sriov options to the subparser for
opae.io init. The --force option enables controlling the force
parameter to vfio_init() that was previously hard-coded to False.

The --enable-sriov option, when given, causes opae.io init to
write 'Y' to /sys/module/vfio_pci/parameters/enable_sriov.

The default value for both options is False.

Signed-off-by: Tim Whisonant <tim.whisonant@intel.com>
@tswhison tswhison self-assigned this Nov 7, 2023
@tswhison tswhison requested a review from a team as a code owner November 7, 2023 22:57
@coveralls
Copy link

coveralls commented Nov 7, 2023

Pull Request Test Coverage Report for Build 6792808737

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 68.217%

Totals Coverage Status
Change from base Build 6790070612: 0.0%
Covered Lines: 15767
Relevant Lines: 23113

💛 - Coveralls

def vfio_init(pci_addr, new_owner='', force=False):
def enable_sriov(enable):
sriov = '/sys/module/vfio_pci/parameters/enable_sriov'
if os.path.exists(sriov):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Linux kernel folks would suggest trying to minimize indentation by something like the following:

if not os.path.exists(sriov):
LOG.error("Cannot enable sriov because {sriov} does not exist")
return FALSE

try:...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants